forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: freesouljah on January 28, 2006, 06:08:00 am

Title: Bug Fixes for SEF URLS Plugin
Post by: freesouljah on January 28, 2006, 06:08:00 am
okay...I found a couple fixes for the sef urls plugin...I am hoping somebody will be cool & knowledgable enough to help me out with the ones I can't figure out...

Now working great!

so far here are the fixes I made:


add this to the /cpg/plugins/sef_urls/codebase.php page:
before // Return modified HTML
add:


Code: [Select]
           //
           // Bug Fix for SEF URLS plugin
           // freesoulJAH ~ www.staticFiends.com
           //

    // Rewrite for search with multiple pages
    $html = preg_replace('/thumbnails\.php\?album=search&cat=0&page=([0-9_-]+)/i','search-page-$1.html',$html);

        // Rewrite for search by key words
    $html = preg_replace('/thumbnails\.php\?album=search&search=([a-zA-z0-9_-ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ@°-]+)/i','search-$1.html',$html);

    // Rewrite for most viewed
    $html = preg_replace('/thumbnails\.php\?album=topn&cat=([a-zA-z0-9_-ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ@°-]+)/i','top-$1.html',$html);

    // Rewrite for last uploaded
    $html = preg_replace('/thumbnails\.php\?album=lastup&cat=([\-]?[0-9]+)/i','newest-$1.html',$html);

    // Rewrite for last uploaded with multiple pages
    $html = preg_replace('/thumbnails\.php\?album=lastup&cat=([\-]?[0-9]+)&page=([0-9_-]+)/i','newest-$1-page-$2.html',$html);

    // Rewrite for top rated
    $html = preg_replace('/thumbnails\.php\?album=toprated&cat=([\-]?[0-9]+)/i','top-rated-photos-$1.html',$html);

    // Rewrite for last comments
    $html = preg_replace('/thumbnails\.php\?album=lastcom&cat=([\-]?[0-9]+)/i','last-comment-$1.html',$html);


add to the /cpg/.htaccess page:

after similar RewriteRules
add:


Code: [Select]
###
#Bug Fix for SEF URLS plugin
#freesoulJAH ~ www.staticFiends.com
###
RewriteRule search-([a-z0-9]*)\.html thumbnails.php?album=search&search=$1 [NC]

RewriteRule search-page-([0-9]*)\.html thumbnails.php?album=search&cat=0&page=$1 [NC]

RewriteRule top-([\-]?[0-9]+)\.html thumbnails.php?album=topn&cat=$1 [NC]

RewriteRule newest-([\-]?[[0-9]*)\.html thumbnails.php?album=lastup&cat=$1 [NC]

RewriteRule newest-([\-]?[[0-9]*)-page-([\-]?[[0-9]*)\.html thumbnails.php?album=lastup&cat=$1&page=$2 [NC]

RewriteRule last-comment-([\-]?[[0-9]*)\.html thumbnails.php?album=lastcom&cat=$1 [NC]

RewriteRule top-rated-([\-]?[[0-9]*)-page-([\-]?[[0-9]*)\.html thumbnails.php?album=toprated&cat=$1&page=$2 [NC]



 ;D

now for the one that is stumping me:

rewriting the multiple pages for most viewed:

http://www.staticfiends.com/photos/thumbnails.php?album=topn&cat=-144&page=2

every time I try I wind up with:

http://www.staticfiends.com/photos/top--144.html&page=2

the same thing is coming up for lastcom & toprated

no matter what I friggen' do...it keeps coming up like that...like I didn't do anything at all...so if anyone can tell me what I am doing wrong, or has other fixes for the SEF URLS plugin, then please post them on this thread.

in the next couple days/hours (depending on how long it takes) I will be working on the top rated, last uploaded, last comments....but I got stuck working on the most viewed and it cost me a few hours before I gave up and decided to make this post...

peace
8)


[edit]
I added the last uploaded & last uploaded w/ multiple pages and the first pages of top rated and last comments
[/edit]
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Joachim Müller on February 20, 2006, 08:41:21 am
could some dev who has mod_rewrite available on his/her testserver look into the proposed changes and commit if applicable? Thanks.
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Nibbler on February 22, 2006, 10:00:45 pm
Committed an update to address these issues.
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: freesouljah on February 23, 2006, 04:18:15 am
in the coding what is the difference between how lasthits, topn, toprated, and lastcom is created compared to lastup?  I can't figure out how to make the other ones conform to what lastup does...meaning I can get mod_rewrite to rewrite the lastup&page=$ just fine, but the other ones are not working...
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Nibbler on February 23, 2006, 04:25:31 am
There is no difference, I've used the same code for all the meta albums.
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: freesouljah on February 23, 2006, 04:32:02 am
hmm....maybe you could shed a little light on why mod_rewrite is acting differently for them?  I am stumped...
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Nibbler on February 23, 2006, 04:52:35 am
The code is in CVS http://cvs.sourceforge.net/viewcvs.py/coppermine/stable/plugins/sef_urls/ (http://cvs.sourceforge.net/viewcvs.py/coppermine/stable/plugins/sef_urls/)

You have to watch out for links being partially replaced, which seems to be the case from your original post. You need to try and match the longer patterns first to avoid this.
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: freesouljah on February 23, 2006, 05:18:39 am
ahh...I see...and you took care of the problem for me/us too  8)

okay...now how can we fix the sort options?   ;)

thanks
fvd
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Develar on March 02, 2006, 11:01:25 am
After codebase.php line 53 add string
#FIX BY DEVELAR
// Rewrite thumbnails.php?album=[album]&page=[category] URLs to thumbnails-[album]-page-[page].html
$html = preg_replace('/thumbnails\.php\?album=([a-z0-9]+)(\&|\&)page=([0-9]+)(\&|\&)sort=([a-z]+)/i','thumbnails-$1-page-$3-sort-$5.html',$html);

After .htaccess line 43 add string
#FIX BY DEVELAR
RewriteRule thumbnails-([a-z0-9]+)-page-([0-9]+)-sort-([a-z]+)\.html thumbnails.php?album=$1&page=$2&sort=$3 [NC,L]


Title: Re: Bug Fixes for SEF URLS Plugin
Post by: freesouljah on March 05, 2006, 09:47:36 am
After codebase.php line 53 add string
#FIX BY DEVELAR
// Rewrite thumbnails.php?album=[album]&page=[category] URLs to thumbnails-[album]-page-[page].html
$html = preg_replace('/thumbnails\.php\?album=([a-z0-9]+)(\&|\&)page=([0-9]+)(\&|\&)sort=([a-z]+)/i','thumbnails-$1-page-$3-sort-$5.html',$html);

After .htaccess line 43 add string
#FIX BY DEVELAR
RewriteRule thumbnails-([a-z0-9]+)-page-([0-9]+)-sort-([a-z]+)\.html thumbnails.php?album=$1&page=$2&sort=$3 [NC,L]


cool man...thanks  8)

just a note, those additions have to be in those exact lines to work...
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Nowayhome on May 09, 2006, 07:24:04 pm
Hi ..

I made the bug fixes but the search is still bugged .
The search works but when i click on the result , no image to display .

Any idea ?
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Paver on May 10, 2006, 05:58:51 am
As the board description says, there is no support on this board.

You are only supposed to reply with reports with results saying "this works" or "this doesn't work but I did this and now it works".  You can post saying "this doesn't work but I think this might be the issue because when I do this, this happens".  In other words, you can post reports but cannot ask for support.

We do not provide support for bugs or even for possible bug fixes posted here.  You are welcome to contribute if you are able to.
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Joachim Müller on August 10, 2006, 09:23:20 am
Did a dev have the chance to test the suggested improvements, so we could add it to the core?
Title: Re: Bug Fixes for SEF URLS Plugin
Post by: Joachim Müller on December 28, 2006, 10:55:37 am
OK, obviously not. Since the original suggestion has been taken care of I'm marking this thread as "fixed".