Advanced search  

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

Pages: [1]   Go Down

Author Topic: CPG V1.5.16 - You Have A Coding Error  (Read 2346 times)

0 Members and 1 Guest are viewing this topic.

JUSTINTIME

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
CPG V1.5.16 - You Have A Coding Error
« on: September 30, 2011, 09:55:07 am »

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
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.
Re: CPG V1.5.16 - You Have A Coding Error
« Reply #1 on: September 30, 2011, 09:06:42 pm »

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.
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: CPG V1.5.16 - You Have A Coding Error
« Reply #2 on: October 05, 2011, 03:41:44 pm »

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
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.
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.