Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: problem with keywords after upgrade  (Read 4464 times)

0 Members and 1 Guest are viewing this topic.

veki

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
problem with keywords after upgrade
« on: June 23, 2014, 11:05:10 pm »

After upgrade from 1.5.26 to 1.5.28 I still do have the  same problem with keywords.  For example, if keyword is written in capital letters and I want tochange it after Apply changes there is no change and keyword is not changed.
Please advise

veki
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15415
Re: problem with keywords after upgrade
« Reply #1 on: June 24, 2014, 02:28:32 pm »

Which form do you use to change the keywords?
Logged

veki

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: problem with keywords after upgrade
« Reply #2 on: June 24, 2014, 08:15:20 pm »

I use form provided when I clikc on Search as admin and below list of keyowrds there is option to change keywords. After click on that button I modify keywords.
I define keyowrds by going into albums and typing keywords in teh keyword field.

THanks

veki
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15415
Re: problem with keywords after upgrade
« Reply #3 on: June 25, 2014, 10:35:36 am »

So you're using keywordmgr.php, right? I just tested the keyword manager and it works for me as expected. I changed "Asia" to "ASIA", then to "asia" and back to "Asia" without an issue.

In keywordmgr.php, find
Code: [Select]
    header("Location: keywordmgr.php?page=display");

    break;

case 'delete':
and above, add
Code: [Select]
cpg_die(1,nl2br(print_r($newquerys,true)));
Now, try to change a keyword and post the content of the blue information box.
Logged

veki

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: problem with keywords after upgrade
« Reply #4 on: June 25, 2014, 11:39:28 am »

Hello,

I changed many keywords but for some it does not work. I do not know why.  For example I have one keyword that is in capilat letters:

TO ŠTO SE DOGODILO SA NJIMA NEMA NIKAKVE VEZE SA BEZBOLOM

When I changed it so small letters
To što se dogodilo s anjima nema nikakve veze sa bezbolom


and confirmed change I got this message after applying your code:
Information Array
 (
 
  • => UPDATE cpg15x_pictures SET keywords = TRIM(REPLACE(keywords, ';;', ';'))
  • [1] => UPDATE cpg15x_pictures SET keywords = '' WHERE keywords = ';'
     )
     
    Please advise
    Veki
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15415
Re: problem with keywords after upgrade
« Reply #5 on: June 25, 2014, 11:50:38 am »

Next time, please describe your issue more detailed in your initial post. I performed some tests and this seems to happen just for upper case non-latin characters. Actually, you cannot edit any keyword if it contains such a character. I'll try to fix this.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15415
Re: problem with keywords after upgrade
« Reply #6 on: June 25, 2014, 12:24:45 pm »

By default, the keyword manager just displays one keyword for different case varieties, i.e.
- Test
- TEST
- test

will be displayed just once. Which variety is displayed in the keyword manager depends on which is found first while scanning all pictures for keywords. If you edit that (actually 3 in my example) keyword, all case varieties will be changed to the new keyword. This is okay, as Coppermine (actually the MySQL database) doesn't care about the case.

However, it obviously won't work for non-latin characters (at least not in my testbed, but I just noticed that there seems to be an encoding issue, as those characters aren't displayed correctly in my database). Additionally, there's an inconsistency in the keyword manager. The "edit" mode always submits the keyword in lower case (which is why editing keywords with upper case non-latin characters fails), while the "delete" mode submits it (respectively the first match of that lower case keyword, see above) in its actual case. This is why deleting keywords works as expected.


A quick and dirty solution would be to modify the keyword manager to display all case varieties of each keyword. It's quick and dirty, as it's not obvious for users if they edit keyword "Test", the keyword "TEST" will also be changed. This is why that change won't be added to the official Coppermine code. If you want to use it anyway, open keywordmgr.php, find
Code: [Select]
$lowercase_word  = addslashes(utf_strtolower($word_escaped));and replace with
Code: [Select]
$lowercase_word  = addslashes(($word_escaped));

I'll try to find a better fix.
« Last Edit: June 25, 2014, 12:38:31 pm by Αndré »
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15415
Re: problem with keywords after upgrade
« Reply #7 on: June 25, 2014, 12:38:07 pm »

I just noticed that there seems to be an encoding issue, as those characters aren't displayed correctly in my database

I fixed that issue by setting the database connection to UTF8. You can do this by adding
Code: [Select]
$CONFIG['dbcharset'] = 'utf8';to include/config.inc.php.

As expected, this broke all non-latin characters in titles/descriptions/keywords/etc. in Coppermine. I manually used the keyword manager to fix my broken keywords (didn't care about the rest of my test gallery) and now it's possible to change also keywords with upper case non-latin characters as expected.
Logged

veki

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: problem with keywords after upgrade
« Reply #8 on: June 25, 2014, 12:57:22 pm »

Hello,

Thanks.  Yes, it is possible now to change keywords. I guess, I have to fix all other keywords with non-latin characters.
I realized that after each change of kezword I get the blue box information about applied change.

Should I leave it or remove it since I do not need it anymore?

Thanks,

Veki
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15415
Re: problem with keywords after upgrade
« Reply #9 on: June 25, 2014, 01:37:41 pm »

I guess, I have to fix all other keywords
Don't forget the other text fields for pictures, albums, categories and maybe even your gallery name/description. Also comments are affected.


Should I leave it or remove it
Please remove it.
Logged

veki

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: problem with keywords after upgrade
« Reply #10 on: June 25, 2014, 02:46:44 pm »

Hello,
We will enable search only by using keywords.  Thanks on good suggestion.
I commented line that produced blue box so it is OK now.
I did not have issue with the same keyword in uppercase and lowercase, just it was the problem that some keywords with non-latin characters did not change properly.
Thanks a lot,


veki
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 21 queries.