aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_tag.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-02-23 13:18:34 +0000
committerrvelices <rv-github@modusoptimus.com>2007-02-23 13:18:34 +0000
commitcb2408a82c9bc93bef177dc33a8981bc36800839 (patch)
tree85728267a379dd1b39ac089ab2021f000e6cb668 /include/functions_tag.inc.php
parent6f03e29735ea395f31d09bbfd15a4e15eaf961e3 (diff)
Plugins:
- display author and and author url (if present) on plugin admin page - uniformized versions/authors... for all plugins in svn - security fix (html escape name, version, uri, author... to avoid javascript injection which could automatically simulate click on Install) - added confirmation for install/uninstall plugins Web services: - web service explorer now caches method details in order to avoid unnecessary web calls - web service explorer can now send parameters as arrays - web service explorer uses now prototype.js version 1.5 - small improvements - added and use function bad_request (sends http status code 400) git-svn-id: http://piwigo.org/svn/trunk@1852 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_tag.inc.php')
-rw-r--r--include/functions_tag.inc.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php
index 4f8c95563..c6dc01db6 100644
--- a/include/functions_tag.inc.php
+++ b/include/functions_tag.inc.php
@@ -271,4 +271,65 @@ SELECT id, name, url_name, count(*) counter
usort($tags, 'name_compare');
return $tags;
}
+
+/**
+ * return a list of tags corresponding to any of ids, url_names, names
+ *
+ * @param array ids
+ * @param array url_names
+ * @param array names
+ * @return array
+ */
+function find_tags($ids, $url_names=array(), $names=array() )
+{
+ $where_clauses = array();
+ if ( !empty($ids) )
+ {
+ $where_clauses[] = 'id IN ('.implode(',', $ids).')';
+ }
+ if ( !empty($url_names) )
+ {
+ $where_clauses[] =
+ 'url_name IN ('.
+ implode(
+ ',',
+ array_map(
+ create_function('$s', 'return "\'".$s."\'";'),
+ $url_names
+ )
+ )
+ .')';
+ }
+ if ( !empty($names) )
+ {
+ $where_clauses[] =
+ 'name IN ('.
+ implode(
+ ',',
+ array_map(
+ create_function('$s', 'return "\'".$s."\'";'),
+ $names
+ )
+ )
+ .')';
+ }
+ if (empty($where_clauses))
+ {
+ return array();
+ }
+
+ $query = '
+SELECT id, url_name, name
+ FROM '.TAGS_TABLE.'
+ WHERE '. implode( '
+ OR ', $where_clauses);
+
+ $result = pwg_query($query);
+ $tags = array();
+ while ($row = mysql_fetch_assoc($result))
+ {
+ array_push($tags, $row);
+ }
+ return $tags;
+}
?> \ No newline at end of file