CPG V1.5.16 - You Have A Coding Error CPG V1.5.16 - You Have A Coding Error
 

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]

Main Menu

CPG V1.5.16 - You Have A Coding Error

Started by JUSTINTIME, September 30, 2011, 09:55:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JUSTINTIME

CPG V1.5.16

The following "new" line of code in the latest CPG version mentioned above does NOT find two worded keywords such as "Science Fiction" when using keywords separated by a comma, whereas the standard search does:

Example Keywords - Space,Planets,Science Fiction,Universe

New Code from CPG V1.5.16 - This fails...
$keyword_param = urlencode(str_replace(' ','+',$keywords_array[$i]));

Changing that line of code back to an earlier version such as CPG V1.5.8 works correctly with single and double or triple keywords separated by a comma:


Old Code from CPG V1.5.8 - This Works...
$keyword_param = str_replace(' ','+',$keywords_array[$i]);

This correctly finds "Science Fiction"

I hope you all can understand this and update your code accordingly.

Cheers

Jeff Bailey

There doesn't seem to be an issue for me. When using the Match any words (OR) it works fine and without commas it works fine. There is no search word separator specification so using one includes it in the search query. I understand it worked before but I don't believe it was an intended feature. 

Rather then taking out the urlencode we should probably add an option for a search word separator. Or specify one on the search page.

There is a problem on the other hand when clicking on keywords with spaces. The plus sign is inserted into the search query instead of the url of the search.

I could be completely wrong as well so thank you for the input, Αndré or another senior developer will probably give a clearer response.
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Αndré

That line has been changed for a good reason: http://forum.coppermine-gallery.net/index.php/topic,73161.0.html

If it breaks some other functionality, we can have a look at it. I currently don't know what exactly doesn't work as expected as I don't know your gallery setup and your keywords. I guess you entered
Quote from: JUSTINTIME on September 30, 2011, 09:55:07 AM
Space,Planets,Science Fiction,Universe
to the search form and it returned not what you expected.


Please give us more information if you want to have a fix in the next version.