Changeset 20252 for extensions
- Timestamp:
- Jan 18, 2013, 8:22:05 PM (11 years ago)
- Location:
- extensions/user_tags
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/user_tags/CHANGELOG
r20251 r20252 1 User Tags 0.7.2 - 2013-01-18 2 ================================ 3 * Fix issue with path in help pages 4 1 5 User Tags 0.7.1 - 2012-09-12 2 6 ================================ -
extensions/user_tags/include/t4u_config.class.php
r20251 r20252 60 60 61 61 private function get_config_file_dir() { 62 return $GLOBALS['conf']['data_location'].'/plugins/';62 return PHPWG_ROOT_PATH . $GLOBALS['conf']['data_location'].'plugins/'; 63 63 } 64 64 … … 90 90 } 91 91 92 public function plugin_admin_menu($menu) { 93 array_push($menu, 94 array('NAME' => $this->plugin_name, 95 'URL' => get_admin_plugin_menu_link(T4U_PLUGIN_ROOT .'/admin.php') 96 ) 97 ); 92 public static function plugin_admin_menu($menu) { 93 $menu[] = array('NAME' => T4U_PLUGIN_NAME, 94 'URL' => get_admin_plugin_menu_link(T4U_PLUGIN_ROOT .'/admin.php') 95 ); 96 98 97 return $menu; 99 98 } 100 99 101 public function get_admin_help($help_content, $page) {100 public static function get_admin_help($help_content, $page) { 102 101 return load_language('help/'.$page.'.html', 103 $this->plugin_dir.'/',104 array('return'=>true)105 102 T4U_PLUGIN_ROOT .'/', 103 array('return' => true) 104 ); 106 105 } 107 106 … … 115 114 private function setDefaults() { 116 115 include_once $this->plugin_dir.'/include/default_values.inc.php'; 117 116 118 117 foreach ($default_values as $key => $value) { 119 118 if (empty($this->config[$key])) { 120 119 $this->config[$key] = $value; 121 120 } 122 121 } -
extensions/user_tags/include/t4u_ws.class.php
r20251 r20252 28 28 29 29 $service->addMethod(T4U_WS.'list', array($this, 'tagsList'), 30 31 32 33 30 array('q' => array()), 31 'retrieves a list of tags than can be filtered' 32 ); 33 34 34 $service->addMethod(T4U_WS.'update', array($this, 'updateTags'), 35 36 37 38 39 35 array('image_id' => array(), 36 'tags' => array('default' => array()) 37 ), 38 'Updates (add or remove) tags associated to an image (POST method only)' 39 ); 40 40 } 41 41 42 42 public function tagsList($params, &$service) { 43 43 $query = 'SELECT id AS tag_id, name AS tag_name FROM '.TAGS_TABLE; … … 45 45 $query .= sprintf(' WHERE name like \'%%%s%%\'', $params['q']); 46 46 } 47 47 48 48 $tagslist = $this->__makeTagsList($query); 49 49 unset($tagslist['__associative_tags']); … … 53 53 return $tagslist; 54 54 } 55 55 56 56 public function updateTags($params, &$service) { 57 57 if (!$service->isPost()) { … … 62 62 return array('error' => l10n('You are not allowed to add nor delete tags')); 63 63 } 64 64 65 65 if (empty($params['tags'])) { 66 66 $params['tags'] = array(); … … 90 90 if (count($removed_tags)>0) { 91 91 if (!t4u_Config::getInstance()->hasPermission('delete')) { 92 92 $message['error'][] = l10n('You are not allowed to delete tags'); 93 93 } else { 94 94 $message['info'] = l10n('Tags updated'); 95 95 } 96 96 } 97 97 if (count($new_tags)>0) { 98 98 if (!t4u_Config::getInstance()->hasPermission('add')) { 99 100 99 $message['error'][] = l10n('You are not allowed to add tags'); 100 $tags_to_associate = array_diff($tags_to_associate, $new_tags); 101 101 } else { 102 102 $message['info'] = l10n('Tags updated'); 103 103 } 104 104 } … … 106 106 if (empty($message['error'])) { 107 107 if (empty($tags_to_associate)) { // remove all tags for an image 108 109 110 108 $query = 'DELETE FROM '.IMAGE_TAG_TABLE; 109 $query .= sprintf(' WHERE image_id = %d', $params['image_id']); 110 pwg_query($query); 111 111 } else { 112 113 112 $tag_ids = get_tag_ids(implode(',', $tags_to_associate)); 113 set_tags($tag_ids, $params['image_id']); 114 114 } 115 115 } … … 126 126 $associative_tags['~~'.$row['tag_id'].'~~'] = $row['tag_name']; 127 127 $tagslist[] = array('id' => '~~'.$row['tag_id'].'~~', 128 129 128 'name' => $row['tag_name'] 129 ); 130 130 131 131 } -
extensions/user_tags/init.php
r20251 r20252 34 34 if (defined('IN_ADMIN')) { 35 35 add_event_handler('get_admin_plugin_menu_links', 36 array($plugin_config, 'plugin_admin_menu') 37 36 't4u_Config::plugin_admin_menu' 37 ); 38 38 add_event_handler('get_popup_help_content', 39 array($plugin_config, 'get_admin_help'),40 41 42 39 't4u_Config::get_admin_help', 40 EVENT_HANDLER_PRIORITY_NEUTRAL, 41 2 42 ); 43 43 } else { 44 44 include_once T4U_PLUGIN_ROOT . '/public.php'; -
extensions/user_tags/main.inc.php
r20251 r20252 22 22 /* 23 23 Plugin Name: User Tags 24 Version: 0.7. 124 Version: 0.7.2 25 25 Description: Allow visitors to add tag to images 26 26 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=441 -
extensions/user_tags/maintain.inc.php
r20251 r20252 34 34 35 35 function plugin_uninstall($plugin_id) { 36 $config_file = $GLOBALS['conf']['data_location'].'/plugins/';36 $config_file = PHPWG_ROOT_PATH . $GLOBALS['conf']['data_location'] . 'plugins/'; 37 37 $config_file .= basename(dirname(__FILE__)).'.dat'; 38 38 if (file_exists($config_file)) {
Note: See TracChangeset
for help on using the changeset viewer.