Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Bug Fixes for SEF URLS Plugin  (Read 11859 times)

0 Members and 1 Guest are viewing this topic.

freesouljah

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 116
  • Can you feel the Love?
    • freesouljah.com
Bug Fixes for SEF URLS Plugin
« 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]
« Last Edit: December 28, 2006, 10:55:54 am by GauGau »
Logged

Joachim Mller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Bug Fixes for SEF URLS Plugin
« Reply #1 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.
Logged

Nibbler

  • Guest
Re: Bug Fixes for SEF URLS Plugin
« Reply #2 on: February 22, 2006, 10:00:45 pm »

Committed an update to address these issues.
Logged

freesouljah

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 116
  • Can you feel the Love?
    • freesouljah.com
Re: Bug Fixes for SEF URLS Plugin
« Reply #3 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...

Nibbler

  • Guest
Re: Bug Fixes for SEF URLS Plugin
« Reply #4 on: February 23, 2006, 04:25:31 am »

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

freesouljah

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 116
  • Can you feel the Love?
    • freesouljah.com
Re: Bug Fixes for SEF URLS Plugin
« Reply #5 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...
« Last Edit: February 23, 2006, 04:38:58 am by freesouljah »
Logged

Nibbler

  • Guest
Re: Bug Fixes for SEF URLS Plugin
« Reply #6 on: February 23, 2006, 04:52:35 am »

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

freesouljah

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 116
  • Can you feel the Love?
    • freesouljah.com
Re: Bug Fixes for SEF URLS Plugin
« Reply #7 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

Develar

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Bug Fixes for SEF URLS Plugin
« Reply #8 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]


Logged

freesouljah

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 116
  • Can you feel the Love?
    • freesouljah.com
Re: Bug Fixes for SEF URLS Plugin
« Reply #9 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...

Nowayhome

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Bug Fixes for SEF URLS Plugin
« Reply #10 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 ?
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Bug Fixes for SEF URLS Plugin
« Reply #11 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.
Logged

Joachim Mller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Bug Fixes for SEF URLS Plugin
« Reply #12 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?
Logged

Joachim Mller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Bug Fixes for SEF URLS Plugin
« Reply #13 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".
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 19 queries.