add support to query multiple tags, use "," as a separation character
[photo-tags.git] / getjson.php
index 007ef7c7d181c9f816d57eb2bcc5ab652aee3c9b..97f8c4973acc5d33a7f4cf880ceb0f3ab4f4604d 100644 (file)
@@ -34,11 +34,13 @@ else
     if (isset($_REQUEST["T"]))
       {
        /* single tag or part of tag */
-       $tags = sqlite_escape_string($_REQUEST["T"]);
-       $tags = explode("+",$tags);
+       $tags = $_REQUEST["T"];
+       $tags = explode(",",$tags);
+       foreach ($tags as $key => $value)
+         $tags[$key]=sqlite_escape_string(trim($value));
        $tags = "'".implode("','",$tags)."'";
 
-       /* individual tags are seperated by '+' */
+       /* individual tags are seperated by ',' */
        $result = $DB->query("SELECT base_uri, filename FROM photos ".
                             "    left join photo_tags on photos.id=photo_tags.photo_id ".
                             "    left join tags on tags.id=photo_tags.tag_id ".