Skip to content

Commit

Permalink
bug 3101: Allow multi language tags to be recognized from selectize o…
Browse files Browse the repository at this point in the history
…r metadata sync

git-svn-id: http://piwigo.org/svn/trunk@29066 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rvelices committed Jul 21, 2014
1 parent ddbe02d commit 2eca26b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
22 changes: 14 additions & 8 deletions admin/include/functions.php
Expand Up @@ -1553,23 +1553,29 @@ function tag_id_from_tag_name($tag_name)
;';
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.'\'
WHERE url_name = \''.$url_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 = '
// 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 url_name = \''.$url_name.'\'
WHERE '.implode(' OR ', $sub_name_where).'
;';
if (count($existing_tags = query2array($query, null, 'id')) == 0)
{
$existing_tags = query2array($query, null, 'id');
}

if (count($existing_tags) == 0)
{// finally create the tag
mass_inserts(
TAGS_TABLE,
array('name', 'url_name'),
Expand Down
9 changes: 8 additions & 1 deletion tools/triggers_list.php
Expand Up @@ -227,10 +227,17 @@
array(
'name' => 'get_tag_alt_names',
'type' => 'trigger_change',
'vars' => array('array', null, 'array', 'raw_name'),
'vars' => array('array', null, 'string', 'raw_name'),
'files' => array('admin\tags.php', 'admin\include\functions.php (get_taglist)'),
'infos' => 'New in 2.4',
),
array(
'name' => 'get_tag_name_like_where',
'type' => 'trigger_change',
'vars' => array('array', null, 'string', 'tag_name'),
'files' => array('admin\include\functions.php (tag_id_from_tag_name)'),
'infos' => 'New in 2.7',
),
array(
'name' => 'get_webmaster_mail_address',
'type' => 'trigger_change',
Expand Down

0 comments on commit 2eca26b

Please sign in to comment.