Ignore:
Timestamp:
Jan 18, 2013, 8:22:05 PM (11 years ago)
Author:
nikrou
Message:

Fix issue with path in help pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/user_tags/include/t4u_ws.class.php

    r20251 r20252  
    2828
    2929    $service->addMethod(T4U_WS.'list', array($this, 'tagsList'),
    30                         array('q' => array()),
    31                         'retrieves a list of tags than can be filtered'
    32                         );
    33 
     30                        array('q' => array()),
     31                        'retrieves a list of tags than can be filtered'
     32                        );
     33   
    3434    $service->addMethod(T4U_WS.'update', array($this, 'updateTags'),
    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                         );
     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                        );
    4040  }
    41 
     41 
    4242  public function tagsList($params, &$service) {
    4343    $query = 'SELECT id AS tag_id, name AS tag_name FROM '.TAGS_TABLE;
     
    4545      $query .= sprintf(' WHERE name like \'%%%s%%\'', $params['q']);
    4646    }
    47 
     47   
    4848    $tagslist = $this->__makeTagsList($query);
    4949    unset($tagslist['__associative_tags']);
     
    5353    return $tagslist;
    5454  }
    55 
     55 
    5656  public function updateTags($params, &$service) {
    5757    if (!$service->isPost()) {
     
    6262      return array('error' => l10n('You are not allowed to add nor delete tags'));
    6363    }
    64 
     64   
    6565    if (empty($params['tags'])) {
    6666      $params['tags'] = array();
     
    9090    if (count($removed_tags)>0) {
    9191      if (!t4u_Config::getInstance()->hasPermission('delete')) {
    92         $message['error'][] = l10n('You are not allowed to delete tags');
     92        $message['error'][] = l10n('You are not allowed to delete tags');
    9393      } else {
    94         $message['info'] = l10n('Tags updated');
     94        $message['info'] = l10n('Tags updated');
    9595      }
    9696    }
    9797    if (count($new_tags)>0) {
    9898      if (!t4u_Config::getInstance()->hasPermission('add')) {
    99         $message['error'][] = l10n('You are not allowed to add tags');
    100         $tags_to_associate = array_diff($tags_to_associate, $new_tags);
     99        $message['error'][] = l10n('You are not allowed to add tags');
     100        $tags_to_associate = array_diff($tags_to_associate, $new_tags);
    101101      } else {
    102         $message['info'] = l10n('Tags updated');
     102        $message['info'] = l10n('Tags updated');
    103103      }
    104104    }
     
    106106    if (empty($message['error'])) {
    107107      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);
     108        $query = 'DELETE FROM '.IMAGE_TAG_TABLE;
     109        $query .= sprintf(' WHERE image_id = %d', $params['image_id']);
     110        pwg_query($query);
    111111      } else {
    112         $tag_ids = get_tag_ids(implode(',', $tags_to_associate));
    113         set_tags($tag_ids, $params['image_id']); 
     112        $tag_ids = get_tag_ids(implode(',', $tags_to_associate));
     113        set_tags($tag_ids, $params['image_id']); 
    114114      }
    115115    }
     
    126126      $associative_tags['~~'.$row['tag_id'].'~~'] = $row['tag_name'];
    127127      $tagslist[] = array('id' => '~~'.$row['tag_id'].'~~',
    128                           'name' => $row['tag_name']
    129                           );
     128                          'name' => $row['tag_name']
     129                          );
    130130     
    131131    }
Note: See TracChangeset for help on using the changeset viewer.