Bug Fixes for SEF URLS Plugin Bug Fixes for SEF URLS Plugin
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Bug Fixes for SEF URLS Plugin

Started by freesouljah, January 28, 2006, 06:08:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

freesouljah

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:



           //
           // 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:



###
#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]

Joachim Müller

could some dev who has mod_rewrite available on his/her testserver look into the proposed changes and commit if applicable? Thanks.

Nibbler

Committed an update to address these issues.

freesouljah

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...

Nibbler

There is no difference, I've used the same code for all the meta albums.

freesouljah

#5
hmm....maybe you could shed a little light on why mod_rewrite is acting differently for them?  I am stumped...

Nibbler

The code is in CVS 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.

freesouljah

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

Develar

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]



freesouljah

Quote from: 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]


cool man...thanks  8)

just a note, those additions have to be in those exact lines to work...

Nowayhome

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 ?

Paver

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.

Joachim Müller

Did a dev have the chance to test the suggested improvements, so we could add it to the core?

Joachim Müller

OK, obviously not. Since the original suggestion has been taken care of I'm marking this thread as "fixed".