Changeset 20251 for extensions/user_tags/include/t4u_ws.class.php
- Timestamp:
- Jan 18, 2013, 8:21:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/user_tags/include/t4u_ws.class.php
r20139 r20251 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | 8 // | it under the terms of the GNU General Public License version 2 as|8 // | it under the terms of the GNU General Public License version 2 as | 9 9 // | published by the Free Software Foundation | 10 10 // | | … … 28 28 29 29 $service->addMethod(T4U_WS.'list', array($this, 'tagsList'), 30 array( ),30 array('q' => array()), 31 31 'retrieves a list of tags than can be filtered' 32 32 ); … … 41 41 42 42 public function tagsList($params, &$service) { 43 $query = ' 44 SELECT 45 id AS tag_id, 46 name AS tag_name 47 FROM '.TAGS_TABLE.' 48 ;'; 49 43 $query = 'SELECT id AS tag_id, name AS tag_name FROM '.TAGS_TABLE; 44 if (!empty($params['q'])) { 45 $query .= sprintf(' WHERE name like \'%%%s%%\'', $params['q']); 46 } 47 50 48 $tagslist = $this->__makeTagsList($query); 51 49 unset($tagslist['__associative_tags']); … … 106 104 } 107 105 108 if (!empty($tags_to_associate)) { 109 $tag_ids = get_tag_ids(implode(',', $tags_to_associate)); 110 set_tags($tag_ids, $params['image_id']); 106 if (empty($message['error'])) { 107 if (empty($tags_to_associate)) { // remove all tags for an image 108 $query = 'DELETE FROM '.IMAGE_TAG_TABLE; 109 $query .= sprintf(' WHERE image_id = %d', $params['image_id']); 110 pwg_query($query); 111 } else { 112 $tag_ids = get_tag_ids(implode(',', $tags_to_associate)); 113 set_tags($tag_ids, $params['image_id']); 114 } 111 115 } 112 116
Note: See TracChangeset
for help on using the changeset viewer.