diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-09-25 00:30:42 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-09-25 00:30:42 +0000 |
commit | c15f6faced7691ce67015fe1d1b61ff270ae5f96 (patch) | |
tree | b5951e57c89b872e84ebac4888b69518509ccc9f /include | |
parent | 5adad7565c9c169dd623bac6704121f7d6aba151 (diff) |
- some checks for admins that are advisers (no write access)
- send the charset in http header for web services
- tag name becomes an xml attribute instead of content for tags.getList and related tags in images.getInfo (more logical and coherent with tags.getAdminList)
git-svn-id: http://piwigo.org/svn/trunk@2585 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/ws_core.inc.php | 2 | ||||
-rw-r--r-- | include/ws_functions.inc.php | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/ws_core.inc.php b/include/ws_core.inc.php index 24f10f114..0fb0641ca 100644 --- a/include/ws_core.inc.php +++ b/include/ws_core.inc.php @@ -369,7 +369,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF $encodedResponse = $this->_responseEncoder->encodeResponse($response); $contentType = $this->_responseEncoder->getContentType(); - @header('Content-Type: '.$contentType); + @header('Content-Type: '.$contentType.'; charset='.get_pwg_charset()); print_r($encodedResponse); } diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 0e4b1a8c2..f125515c6 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -475,8 +475,8 @@ SELECT $id = $row['id']; $row['nb_images'] = isset($nb_images_of[$id]) ? $nb_images_of[$id] : 0; array_push($cats, $row); - } - + } + usort($cats, 'global_rank_compare'); return array( 'categories' => new PwgNamedArray( @@ -721,7 +721,7 @@ SELECT id, date, author, content $ret['rates'] = array( WS_XML_ATTRIBUTES => $rating ); $ret['categories'] = new PwgNamedArray($related_categories, 'category', array('id','url', 'page_url') ); - $ret['tags'] = new PwgNamedArray($related_tags, 'tag', array('id','url_name','url','page_url') ); + $ret['tags'] = new PwgNamedArray($related_tags, 'tag', array('id','url_name','url','name','page_url') ); if ( isset($comment_post_data) ) { $ret['comment_post'] = array( WS_XML_ATTRIBUTES => $comment_post_data ); @@ -975,7 +975,7 @@ function ws_images_add($params, &$service) // fwrite($fh_log, 'output: '.md5_file($thumbnail_path)."\n"); list($width, $height) = getimagesize($file_path); - + // database registration $insert = array( 'file' => $filename_wo_ext.'.jpg', @@ -1025,14 +1025,14 @@ function ws_images_add($params, &$service) $cat_ids = array(); $rank_on_category = array(); $search_current_ranks = false; - + $tokens = explode(';', $params['categories']); foreach ($tokens as $token) { list($cat_id, $rank) = explode(',', $token); array_push($cat_ids, $cat_id); - + if (!isset($rank)) { $rank = 'auto'; @@ -1105,7 +1105,7 @@ SELECT $image_id ); } - + invalidate_user_cache(); // fclose($fh_log); @@ -1189,7 +1189,7 @@ function ws_tags_getList($params, &$service) ) ); } - return array('tags' => new PwgNamedArray($tags, 'tag', array('id','url_name','url', 'counter' )) ); + return array('tags' => new PwgNamedArray($tags, 'tag', array('id','url_name','url', 'name', 'counter' )) ); } /** @@ -1205,7 +1205,7 @@ function ws_tags_getAdminList($params, &$service) { return new PwgError(401, 'Access denied'); } - + $tags = get_all_tags(); return array( 'tags' => new PwgNamedArray( @@ -1365,7 +1365,7 @@ LIMIT '.$params['per_page']*$params['page'].','.$params['per_page']; function ws_categories_add($params, &$service) { - if (!is_admin()) + if (!is_admin() or is_adviser()) { return new PwgError(401, 'Access denied'); } @@ -1381,7 +1381,7 @@ function ws_categories_add($params, &$service) { return new PwgError(500, $creation_output['error']); } - + return $creation_output; } ?> |