aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2014-07-21 21:00:17 +0000
committerrvelices <rv-github@modusoptimus.com>2014-07-21 21:00:17 +0000
commit2eca26b97c277250f7848eba852605c8460edbca (patch)
tree465f7274bba5949bf7de02080c11e31e55c217f1
parentddbe02d7e064dbe7971facab15cd2386d03c8d4c (diff)
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
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php22
-rw-r--r--tools/triggers_list.php9
2 files changed, 22 insertions, 9 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index fff158d27..d5c8986ad 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -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.'\'
+ 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'),
diff --git a/tools/triggers_list.php b/tools/triggers_list.php
index 406f5e697..b94ca18ab 100644
--- a/tools/triggers_list.php
+++ b/tools/triggers_list.php
@@ -227,11 +227,18 @@ array(
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',
'vars' => array('string', 'email'),