bug 3101: Allow multi language tags to be recognized from selectize or metadata sync

git-svn-id: http://piwigo.org/svn/trunk@29066 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2014-07-21 21:00:17 +00:00
parent ddbe02d7e0
commit 2eca26b97c
2 changed files with 25 additions and 12 deletions

View file

@ -1553,23 +1553,29 @@ SELECT id
;';
if (count($existing_tags = query2array($query, null, 'id')) == 0)
{
// search existing by case insensitive name
$url_name = trigger_change('render_tag_url', $tag_name);
// search existing by url name
$query = '
SELECT id
FROM '.TAGS_TABLE.'
WHERE CONVERT(name, CHAR) = \''.$tag_name.'\'
;';
if (count($existing_tags = query2array($query, null, 'id')) == 0)
{
$url_name = trigger_change('render_tag_url', $tag_name);
// search existing by url name
$query = '
SELECT id
FROM '.TAGS_TABLE.'
WHERE url_name = \''.$url_name.'\'
;';
if (count($existing_tags = query2array($query, null, 'id')) == 0)
if (count($existing_tags = query2array($query, null, 'id')) == 0)
{
// search by extended description (plugin sub name)
$sub_name_where = trigger_change('get_tag_name_like_where', array(), $tag_name);
if (count($sub_name_where))
{
$query = '
SELECT id
FROM '.TAGS_TABLE.'
WHERE '.implode(' OR ', $sub_name_where).'
;';
$existing_tags = query2array($query, null, 'id');
}
if (count($existing_tags) == 0)
{// finally create the tag
mass_inserts(
TAGS_TABLE,
array('name', 'url_name'),