From c17ed8b55fc7886a5cbe4797694b310ed3dc4816 Mon Sep 17 00:00:00 2001 From: rvelices Date: Sat, 30 Jul 2011 04:49:02 +0000 Subject: feature 2387: addd a filter by tag in the batch manager git-svn-id: http://piwigo.org/svn/trunk@11853 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'admin/include') diff --git a/admin/include/functions.php b/admin/include/functions.php index afd6c7eaf..8d7a178bd 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -2048,7 +2048,7 @@ function get_taglist($query) $taglist = array(); while ($row = pwg_db_fetch_assoc($result)) { - if (preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['tag_name'], $matches)) + if (preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches)) { foreach ($matches[2] as $tag_name) { @@ -2056,7 +2056,7 @@ function get_taglist($query) $taglist, array( 'name' => trigger_event('render_tag_name', $tag_name), - 'id' => '~~'.$row['tag_id'].'~~', + 'id' => '~~'.$row['id'].'~~', ) ); } @@ -2064,13 +2064,13 @@ function get_taglist($query) $row['tag_name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['tag_name']); } - if (strlen($row['tag_name']) > 0) + if (strlen($row['name']) > 0) { array_push( $taglist, array( - 'name' => trigger_event('render_tag_name', $row['tag_name']), - 'id' => '~~'.$row['tag_id'].'~~', + 'name' => trigger_event('render_tag_name', $row['name']), + 'id' => '~~'.$row['id'].'~~', ) ); } @@ -2082,7 +2082,7 @@ function get_taglist($query) return $taglist; } -function get_tag_ids($raw_tags) +function get_tag_ids($raw_tags, $allow_create=true) { // In $raw_tags we receive something like array('~~6~~', '~~59~~', 'New // tag', 'Another new tag') The ~~34~~ means that it is an existing @@ -2098,13 +2098,10 @@ function get_tag_ids($raw_tags) { array_push($tag_ids, $matches[1]); } - else + elseif ($allow_create) { // we have to create a new tag - array_push( - $tag_ids, - tag_id_from_tag_name($raw_tag) - ); + $tag_ids[] = tag_id_from_tag_name($raw_tag); } } -- cgit v1.2.3