problem with keywords after upgrade problem with keywords after upgrade
 

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

problem with keywords after upgrade

Started by veki, June 23, 2014, 11:05:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

veki

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

Αndré

Which form do you use to change the keywords?

veki

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

Αndré

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
    header("Location: keywordmgr.php?page=display");

    break;

case 'delete':

and above, add
cpg_die(1,nl2br(print_r($newquerys,true)));

Now, try to change a keyword and post the content of the blue information box.

veki

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

Αndré

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.

Αndré

#6
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
$lowercase_word  = addslashes(utf_strtolower($word_escaped));
and replace with
$lowercase_word  = addslashes(($word_escaped));


I'll try to find a better fix.

Αndré

Quote from: Αndré on June 25, 2014, 12:24:45 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
$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.

veki

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

Αndré

Quote from: veki on June 25, 2014, 12:57:22 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.


Quote from: veki on June 25, 2014, 12:57:22 PM
Should I leave it or remove it
Please remove it.

veki

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