[SOLVED] Bug in story.php with category URL

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-17-2008, 03:29 AM
Pligg Donor
Pligg Version: 9.8.2
Pligg Template: custom
 
Join Date: Sep 2007
Location: King of Prussia, PA
Posts: 62
I found a corner case bug with category URLs being incorrectly formed in story.php.
It involves when you are using Friendly URL's for categories.
Let's say you have a category called 'Arts & Sciences". When you created this category and the makeCategoryFriendly function was applied to it, you end up with 'Arts_Sciences' (the '&' gets changed to '_') which is fine so far.

However, if story.php, the code tries to use $globals['category_url'] (which has been already sanitized) and apply to it the makeCategoryFriendly function again.
Code:
$navwhere['link1'] = getmyurl('maincategory', makeCategoryFriendly($globals['category_url']));
This is wrong, because the $globals['category_url'] variable which contains now 'Arts_Sciences' now gets changed to 'ArtsSciences' (the '_' gets changed to ''), so you end up with a broken URL (since the correct URL for the category should have 'Arts_Sciences').

Again, this is a corner case. You are applying makeCategoryFriendly to an already sanitized version of the category name and messing it up.
I fixed this by removing the makeCategoryFriendly function:
Code:
$navwhere['link1'] = getmyurl('maincategory', $globals['category_url']);
Please NOTE that I am using Friendly URL's for categories, so this code fixes my problem. However, I don't know how this will work if someone isn't using this method.
So be careful with this fix as I am not aware of the implication with NOT using Friendly URL's for categories.
Reply With Quote
  #2 (permalink)  
Old 01-18-2008, 07:11 PM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
Thanks for catching this. I'll update the Pligg SVN code.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Category specific banner ad targeting (story.php / story_center.tpl) teachwny Questions and Comments 9 12-26-2009 07:23 PM
Control of meta description - categories Divisive Cotton Questions and Comments 65 11-06-2009 07:10 PM
Pligg Categories Yankidank Wiki Articles 1 12-17-2008 10:10 AM
[SOLVED] Filter by category don not work any more jeanfils Questions and Comments 7 09-11-2008 06:42 PM
[SOLVED] Category order does not match Category Management page grey580 Questions and Comments 7 09-09-2008 01:31 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development