mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
- 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
This commit is contained in:
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{/foreach}
|
||||
</table>
|
||||
<p>
|
||||
<input type="submit" name="submit" value="{'Submit'|@translate}" >
|
||||
<input type="submit" name="reset" value="{'Reset'|@translate}" >
|
||||
<input type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}/>
|
||||
<input type="submit" name="reset" value="{'Reset'|@translate}" {$TAG_INPUT_ENABLED}/>
|
||||
</p>
|
||||
</form>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user