From c15f6faced7691ce67015fe1d1b61ff270ae5f96 Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 25 Sep 2008 00:30:42 +0000 Subject: - 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 --- admin/menubar.php | 4 ++-- admin/template/goto/menubar.tpl | 4 ++-- include/ws_core.inc.php | 2 +- include/ws_functions.inc.php | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/admin/menubar.php b/admin/menubar.php index 9873fb8f6..1bf4a61c0 100644 --- a/admin/menubar.php +++ b/admin/menubar.php @@ -64,7 +64,7 @@ foreach ($mb_conf as $id => $pos) unset($mb_conf[$id]); } -if ( isset($_POST['reset']) ) +if ( isset($_POST['reset']) and !is_adviser()) { $mb_conf = array(); $query = ' @@ -85,7 +85,7 @@ foreach ($reg_blocks as $id => $block) } -if ( isset($_POST['submit']) ) +if ( isset($_POST['submit']) and !is_adviser() ) { foreach ( $mb_conf as $id => $pos ) { diff --git a/admin/template/goto/menubar.tpl b/admin/template/goto/menubar.tpl index 29f546e16..7ce3d29e7 100644 --- a/admin/template/goto/menubar.tpl +++ b/admin/template/goto/menubar.tpl @@ -24,7 +24,7 @@ {/foreach}

- - + +

\ No newline at end of file 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; } ?> -- cgit v1.2.3