feature 2060: Remove adviser mode.

First commit: only php files.

git-svn-id: http://piwigo.org/svn/trunk@8126 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2010-12-14 13:47:24 +00:00
parent bf1aa6fcf1
commit 731f8888a4
28 changed files with 123 additions and 164 deletions

View file

@ -103,7 +103,7 @@ $navigation.= '</a>';
// | virtual categories management | // | virtual categories management |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// request to delete a virtual category / not for an adviser // request to delete a virtual category / not for an adviser
if (isset($_GET['delete']) and is_numeric($_GET['delete']) and !is_adviser()) if (isset($_GET['delete']) and is_numeric($_GET['delete']))
{ {
delete_categories(array($_GET['delete'])); delete_categories(array($_GET['delete']));
array_push($page['infos'], l10n('Virtual album deleted')); array_push($page['infos'], l10n('Virtual album deleted'));

View file

@ -37,7 +37,7 @@ check_status(ACCESS_ADMINISTRATOR);
// | actions | // | actions |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (!empty($_POST) and !is_adviser()) if (!empty($_POST))
{ {
if (empty($_POST['comments'])) if (empty($_POST['comments']))
{ {

View file

@ -106,7 +106,7 @@ $display_info_checkboxes = array(
); );
//------------------------------ verification and registration of modifications //------------------------------ verification and registration of modifications
if (isset($_POST['submit']) and !is_adviser()) if (isset($_POST['submit']))
{ {
$int_pattern = '/^\d+$/'; $int_pattern = '/^\d+$/';
@ -323,14 +323,11 @@ switch ($page['section'])
include_once(PHPWG_ROOT_PATH.'profile.php'); include_once(PHPWG_ROOT_PATH.'profile.php');
$errors = array(); $errors = array();
if ( !is_adviser() ) if (save_profile_from_post($edit_user, $errors))
{ {
if (save_profile_from_post($edit_user, $errors)) // Reload user
{ $edit_user = build_user($conf['guest_id'], false);
// Reload user array_push($page['infos'], l10n('Information data registered in database'));
$edit_user = build_user($conf['guest_id'], false);
array_push($page['infos'], l10n('Information data registered in database'));
}
} }
$page['errors'] = array_merge($page['errors'], $errors); $page['errors'] = array_merge($page['errors'], $errors);

View file

@ -117,7 +117,7 @@ $available_templates = array_merge(
// | selected templates | // | selected templates |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['submit']) and !is_adviser()) if (isset($_POST['submit']))
{ {
$replacements = array(); $replacements = array();
$i = 0; $i = 0;

View file

@ -42,7 +42,7 @@ if (!empty($_POST) or isset($_GET['delete']) or isset($_GET['toggle_is_default']
// | delete a group | // | delete a group |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_GET['delete']) and is_numeric($_GET['delete']) and !is_adviser()) if (isset($_GET['delete']) and is_numeric($_GET['delete']))
{ {
// destruction of the access linked to the group // destruction of the access linked to the group
$query = ' $query = '
@ -85,7 +85,7 @@ DELETE
// | add a group | // | add a group |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['submit_add']) and !is_adviser()) if (isset($_POST['submit_add']))
{ {
if (empty($_POST['groupname'])) if (empty($_POST['groupname']))
{ {
@ -127,7 +127,7 @@ INSERT INTO '.GROUPS_TABLE.'
// | toggle is default group property | // | toggle is default group property |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_GET['toggle_is_default']) and is_numeric($_GET['toggle_is_default']) and !is_adviser()) if (isset($_GET['toggle_is_default']) and is_numeric($_GET['toggle_is_default']))
{ {
$query = ' $query = '
SELECT name, is_default SELECT name, is_default

View file

@ -77,80 +77,77 @@ class check_integrity
} }
// Treatments // Treatments
if (!is_adviser()) if (isset($_POST['c13y_submit_correction']) and isset($_POST['c13y_selection']))
{ {
if (isset($_POST['c13y_submit_correction']) and isset($_POST['c13y_selection'])) $corrected_count = 0;
$not_corrected_count = 0;
foreach ($this->retrieve_list as $i => $c13y)
{ {
$corrected_count = 0; if (!empty($c13y['correction_fct']) and
$not_corrected_count = 0; $c13y['is_callable'] and
in_array($c13y['id'], $_POST['c13y_selection']))
{
if (is_array($c13y['correction_fct_args']))
{
$args = $c13y['correction_fct_args'];
}
else
if (!is_null($c13y['correction_fct_args']))
{
$args = array($c13y['correction_fct_args']);
}
else
{
$args = array();
}
$this->retrieve_list[$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
if ($this->retrieve_list[$i]['corrected'])
{
$corrected_count += 1;
}
else
{
$not_corrected_count += 1;
}
}
}
if ($corrected_count > 0)
{
$page['infos'][] =
l10n_dec('%d anomaly has been corrected.', '%d anomalies have been detected corrected.',
$corrected_count);
}
if ($not_corrected_count > 0)
{
$page['errors'][] =
l10n_dec('%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
$not_corrected_count);
}
}
else
{
if (isset($_POST['c13y_submit_ignore']) and isset($_POST['c13y_selection']))
{
$ignored_count = 0;
foreach ($this->retrieve_list as $i => $c13y) foreach ($this->retrieve_list as $i => $c13y)
{ {
if (!empty($c13y['correction_fct']) and if (in_array($c13y['id'], $_POST['c13y_selection']))
$c13y['is_callable'] and
in_array($c13y['id'], $_POST['c13y_selection']))
{ {
if (is_array($c13y['correction_fct_args'])) $this->build_ignore_list[] = $c13y['id'];
{ $this->retrieve_list[$i]['ignored'] = true;
$args = $c13y['correction_fct_args']; $ignored_count += 1;
}
else
if (!is_null($c13y['correction_fct_args']))
{
$args = array($c13y['correction_fct_args']);
}
else
{
$args = array();
}
$this->retrieve_list[$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
if ($this->retrieve_list[$i]['corrected'])
{
$corrected_count += 1;
}
else
{
$not_corrected_count += 1;
}
} }
} }
if ($corrected_count > 0) if ($ignored_count > 0)
{ {
$page['infos'][] = $page['infos'][] =
l10n_dec('%d anomaly has been corrected.', '%d anomalies have been detected corrected.', l10n_dec('%d anomaly has been ignored.', '%d anomalies have been ignored.',
$corrected_count); $ignored_count);
}
if ($not_corrected_count > 0)
{
$page['errors'][] =
l10n_dec('%d anomaly has not been corrected.', '%d anomalies have not been corrected.',
$not_corrected_count);
}
}
else
{
if (isset($_POST['c13y_submit_ignore']) and isset($_POST['c13y_selection']))
{
$ignored_count = 0;
foreach ($this->retrieve_list as $i => $c13y)
{
if (in_array($c13y['id'], $_POST['c13y_selection']))
{
$this->build_ignore_list[] = $c13y['id'];
$this->retrieve_list[$i]['ignored'] = true;
$ignored_count += 1;
}
}
if ($ignored_count > 0)
{
$page['infos'][] =
l10n_dec('%d anomaly has been ignored.', '%d anomalies have been ignored.',
$ignored_count);
}
} }
} }
} }

View file

@ -37,7 +37,7 @@ $languages->get_db_languages();
$languages->set_tabsheet($page['page']); $languages->set_tabsheet($page['page']);
//--------------------------------------------------perform requested actions //--------------------------------------------------perform requested actions
if (isset($_GET['action']) and isset($_GET['language']) and !is_adviser()) if (isset($_GET['action']) and isset($_GET['language']))
{ {
$page['errors'] = $languages->perform_action($_GET['action'], $_GET['language']); $page['errors'] = $languages->perform_action($_GET['action'], $_GET['language']);

View file

@ -56,7 +56,7 @@ if (!is_writable($languages_dir))
// | perform installation | // | perform installation |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_GET['revision']) and !is_adviser()) if (isset($_GET['revision']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {

View file

@ -37,7 +37,7 @@ check_status(ACCESS_ADMINISTRATOR);
// | actions | // | actions |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
$action = (isset($_GET['action']) and !is_adviser()) ? $_GET['action'] : ''; $action = isset($_GET['action']) ? $_GET['action'] : '';
switch ($action) switch ($action)
{ {

View file

@ -64,7 +64,7 @@ foreach ($mb_conf as $id => $pos)
unset($mb_conf[$id]); unset($mb_conf[$id]);
} }
if ( isset($_POST['reset']) and !is_adviser()) if ( isset($_POST['reset']))
{ {
$mb_conf = array(); $mb_conf = array();
$query = ' $query = '
@ -85,7 +85,7 @@ foreach ($reg_blocks as $id => $block)
} }
if ( isset($_POST['submit']) and !is_adviser() ) if ( isset($_POST['submit']) )
{ {
foreach ( $mb_conf as $id => $pos ) foreach ( $mb_conf as $id => $pos )
{ {

View file

@ -506,7 +506,7 @@ switch ($page['mode'])
{ {
case 'param' : case 'param' :
{ {
if (isset($_POST['param_submit']) and !is_adviser()) if (isset($_POST['param_submit']))
{ {
$updated_param_count = 0; $updated_param_count = 0;
// Update param // Update param
@ -539,26 +539,23 @@ where
} }
case 'subscribe' : case 'subscribe' :
{ {
if (!is_adviser()) if (isset($_POST['falsify']) and isset($_POST['cat_true']))
{ {
if (isset($_POST['falsify']) and isset($_POST['cat_true'])) $check_key_treated = unsubscribe_notification_by_mail(true, $_POST['cat_true']);
{ do_timeout_treatment('cat_true', $check_key_treated);
$check_key_treated = unsubscribe_notification_by_mail(true, $_POST['cat_true']); }
do_timeout_treatment('cat_true', $check_key_treated); else
} if (isset($_POST['trueify']) and isset($_POST['cat_false']))
else {
if (isset($_POST['trueify']) and isset($_POST['cat_false'])) $check_key_treated = subscribe_notification_by_mail(true, $_POST['cat_false']);
{ do_timeout_treatment('cat_false', $check_key_treated);
$check_key_treated = subscribe_notification_by_mail(true, $_POST['cat_false']);
do_timeout_treatment('cat_false', $check_key_treated);
}
} }
break; break;
} }
case 'send' : case 'send' :
{ {
if (isset($_POST['send_submit']) and isset($_POST['send_selection']) and isset($_POST['send_customize_mail_content']) and !is_adviser()) if (isset($_POST['send_submit']) and isset($_POST['send_selection']) and isset($_POST['send_customize_mail_content']))
{ {
$check_key_treated = do_action_send_mail_notification('send', $_POST['send_selection'], stripslashes($_POST['send_customize_mail_content'])); $check_key_treated = do_action_send_mail_notification('send', $_POST['send_selection'], stripslashes($_POST['send_customize_mail_content']));
do_timeout_treatment('send_selection', $check_key_treated); do_timeout_treatment('send_selection', $check_key_treated);

View file

@ -83,7 +83,7 @@ if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
include_once(PHPWG_ROOT_PATH.'admin/include/functions_permalinks.php'); include_once(PHPWG_ROOT_PATH.'admin/include/functions_permalinks.php');
$selected_cat = array(); $selected_cat = array();
if ( isset($_POST['set_permalink']) and $_POST['cat_id']>0 and !is_adviser() ) if ( isset($_POST['set_permalink']) and $_POST['cat_id']>0 )
{ {
$permalink = $_POST['permalink']; $permalink = $_POST['permalink'];
if ( empty($permalink) ) if ( empty($permalink) )
@ -92,7 +92,7 @@ if ( isset($_POST['set_permalink']) and $_POST['cat_id']>0 and !is_adviser() )
set_cat_permalink($_POST['cat_id'], $permalink, isset($_POST['save']) ); set_cat_permalink($_POST['cat_id'], $permalink, isset($_POST['save']) );
$selected_cat = array( $_POST['cat_id'] ); $selected_cat = array( $_POST['cat_id'] );
} }
elseif ( isset($_GET['delete_permanent']) and !is_adviser() ) elseif ( isset($_GET['delete_permanent']) )
{ {
$query = ' $query = '
DELETE FROM '.OLD_PERMALINKS_TABLE.' DELETE FROM '.OLD_PERMALINKS_TABLE.'

View file

@ -40,7 +40,7 @@ check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
// | synchronize metadata | // | synchronize metadata |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_GET['sync_metadata']) and !is_adviser()) if (isset($_GET['sync_metadata']))
{ {
$query = ' $query = '
SELECT path SELECT path
@ -70,7 +70,7 @@ if (isset($_POST['date_creation_action'])
} }
} }
if (isset($_POST['submit']) and count($page['errors']) == 0 and !is_adviser()) if (isset($_POST['submit']) and count($page['errors']) == 0)
{ {
$data = array(); $data = array();
$data{'id'} = $_GET['image_id']; $data{'id'} = $_GET['image_id'];
@ -124,7 +124,6 @@ if (isset($_POST['submit']) and count($page['errors']) == 0 and !is_adviser())
if (isset($_POST['associate']) if (isset($_POST['associate'])
and isset($_POST['cat_dissociated']) and isset($_POST['cat_dissociated'])
and count($_POST['cat_dissociated']) > 0 and count($_POST['cat_dissociated']) > 0
and !is_adviser()
) )
{ {
associate_images_to_categories( associate_images_to_categories(
@ -136,7 +135,6 @@ if (isset($_POST['associate'])
if (isset($_POST['dissociate']) if (isset($_POST['dissociate'])
and isset($_POST['cat_associated']) and isset($_POST['cat_associated'])
and count($_POST['cat_associated']) > 0 and count($_POST['cat_associated']) > 0
and !is_adviser()
) )
{ {
$query = ' $query = '
@ -152,7 +150,6 @@ DELETE FROM '.IMAGE_CATEGORY_TABLE.'
if (isset($_POST['elect']) if (isset($_POST['elect'])
and isset($_POST['cat_dismissed']) and isset($_POST['cat_dismissed'])
and count($_POST['cat_dismissed']) > 0 and count($_POST['cat_dismissed']) > 0
and !is_adviser()
) )
{ {
$datas = array(); $datas = array();
@ -170,7 +167,6 @@ if (isset($_POST['elect'])
if (isset($_POST['dismiss']) if (isset($_POST['dismiss'])
and isset($_POST['cat_elected']) and isset($_POST['cat_elected'])
and count($_POST['cat_elected']) > 0 and count($_POST['cat_elected']) > 0
and !is_adviser()
) )
{ {
set_random_representant($_POST['cat_elected']); set_random_representant($_POST['cat_elected']);

View file

@ -36,7 +36,7 @@ $action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.get_pwg_token();
$plugins = new plugins(); $plugins = new plugins();
//--------------------------------------------------perform requested actions //--------------------------------------------------perform requested actions
if (isset($_GET['action']) and isset($_GET['plugin']) and !is_adviser()) if (isset($_GET['action']) and isset($_GET['plugin']))
{ {
check_pwg_token(); check_pwg_token();

View file

@ -35,7 +35,7 @@ $base_url = get_root_url().'admin.php?page='.$page['page'];
$plugins = new plugins(); $plugins = new plugins();
//-----------------------------------------------------------automatic upgrade //-----------------------------------------------------------automatic upgrade
if (isset($_GET['plugin']) and isset($_GET['revision']) and !is_adviser()) if (isset($_GET['plugin']) and isset($_GET['revision']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {

View file

@ -33,10 +33,7 @@ if (!empty($_POST))
include_once(PHPWG_ROOT_PATH.'profile.php'); include_once(PHPWG_ROOT_PATH.'profile.php');
$errors = array(); $errors = array();
if ( !is_adviser() ) save_profile_from_post($edit_user, $errors);
{
save_profile_from_post($edit_user, $errors);
}
load_profile_in_template( load_profile_in_template(
get_root_url().'admin.php?page=profile&amp;user_id='.$edit_user['id'], get_root_url().'admin.php?page=profile&amp;user_id='.$edit_user['id'],

View file

@ -70,7 +70,7 @@ if (isset($_GET['users']))
} }
} }
if (isset($_GET['del']) and !is_adviser()) if (isset($_GET['del']))
{ {
$del_params = urldecode( $_GET['del'] ); $del_params = urldecode( $_GET['del'] );
parse_str($del_params, $vars); parse_str($del_params, $vars);

View file

@ -83,8 +83,7 @@ $template->set_filenames(array('site_manager'=>'site_manager.tpl'));
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | new site creation form | // | new site creation form |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['submit']) and !empty($_POST['galleries_url']) if (isset($_POST['submit']) and !empty($_POST['galleries_url']))
and !is_adviser() )
{ {
$is_remote = url_is_remote( $_POST['galleries_url'] ); $is_remote = url_is_remote( $_POST['galleries_url'] );
$url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']); $url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']);
@ -167,7 +166,7 @@ if (isset($_GET['site']) and is_numeric($_GET['site']))
{ {
$page['site'] = $_GET['site']; $page['site'] = $_GET['site'];
} }
if (isset($_GET['action']) and isset($page['site']) and !is_adviser()) if (isset($_GET['action']) and isset($page['site']))
{ {
$query = ' $query = '
SELECT galleries_url SELECT galleries_url

View file

@ -108,7 +108,7 @@ if (isset($_POST['submit']))
} }
// shall we simulate only // shall we simulate only
if ((isset($_POST['simulate']) and $_POST['simulate'] == 1) or is_adviser()) if (isset($_POST['simulate']) and $_POST['simulate'] == 1)
{ {
$simulate = true; $simulate = true;
} }

View file

@ -38,7 +38,7 @@ if (!empty($_POST))
// | edit tags | // | edit tags |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['submit']) and !is_adviser()) if (isset($_POST['submit']))
{ {
$query = ' $query = '
SELECT name SELECT name
@ -104,7 +104,7 @@ SELECT id, name
// | delete tags | // | delete tags |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['delete']) and isset($_POST['tags']) and !is_adviser()) if (isset($_POST['delete']) and isset($_POST['tags']))
{ {
$query = ' $query = '
SELECT name SELECT name
@ -141,7 +141,7 @@ DELETE
// | add a tag | // | add a tag |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['add']) and !empty($_POST['add_tag']) and !is_adviser()) if (isset($_POST['add']) and !empty($_POST['add_tag']))
{ {
$tag_name = $_POST['add_tag']; $tag_name = $_POST['add_tag'];

View file

@ -36,7 +36,7 @@ $themes = new themes();
// | perform actions | // | perform actions |
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_GET['action']) and isset($_GET['theme']) and !is_adviser()) if (isset($_GET['action']) and isset($_GET['theme']))
{ {
$page['errors'] = $themes->perform_action($_GET['action'], $_GET['theme']); $page['errors'] = $themes->perform_action($_GET['action'], $_GET['theme']);

View file

@ -207,11 +207,6 @@ if ($conf['check_upgrade_feed'])
} }
} }
if (is_adviser())
{
$header_msgs[] = l10n('Adviser mode enabled');
}
if (count($header_msgs) > 0) if (count($header_msgs) > 0)
{ {
$template->assign('header_msgs', $header_msgs); $template->assign('header_msgs', $header_msgs);

View file

@ -1319,14 +1319,12 @@ function check_status($access_type, $user_status = '')
} }
/* /*
* Return if current user is an adviser * Adviser status is depreciated from piwigo 2.2
* @return bool * @return false
*/ */
function is_adviser() function is_adviser()
{ {
global $user; return false;
return ($user['adviser'] == 'true');
} }
/* /*
@ -1384,14 +1382,7 @@ function get_email_address_as_display_text($email_address)
} }
else else
{ {
if (defined('IN_ADMIN') and is_adviser()) return $email_address;
{
return 'adviser.mode@'.$_SERVER['SERVER_NAME'];
}
else
{
return $email_address;
}
} }
} }

View file

@ -353,8 +353,7 @@ class Template {
} }
$this->smarty->assign( 'ROOT_URL', get_root_url() ); $this->smarty->assign( 'ROOT_URL', get_root_url() );
$this->smarty->assign( 'TAG_INPUT_ENABLED', $this->smarty->assign( 'TAG_INPUT_ENABLED', '');
((is_adviser()) ? 'disabled="disabled" onclick="return false;"' : ''));
$save_compile_id = $this->smarty->compile_id; $save_compile_id = $this->smarty->compile_id;
$this->load_external_filters($handle); $this->load_external_filters($handle);

View file

@ -892,7 +892,7 @@ SELECT * FROM '.IMAGES_TABLE.'
function ws_images_setPrivacyLevel($params, &$service) function ws_images_setPrivacyLevel($params, &$service)
{ {
if (!is_admin() || is_adviser() ) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -935,7 +935,7 @@ function ws_images_add_chunk($params, &$service)
// type {thumb, file, high} // type {thumb, file, high}
// position // position
if (!is_admin() || is_adviser() ) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1139,7 +1139,7 @@ function ws_images_addFile($params, &$service)
// sum // sum
global $conf; global $conf;
if (!is_admin() || is_adviser() ) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1208,7 +1208,7 @@ SELECT
function ws_images_add($params, &$service) function ws_images_add($params, &$service)
{ {
global $conf; global $conf;
if (!is_admin() || is_adviser() ) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1584,7 +1584,7 @@ LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['p
function ws_categories_add($params, &$service) function ws_categories_add($params, &$service)
{ {
if (!is_admin() or is_adviser()) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1608,7 +1608,7 @@ function ws_categories_add($params, &$service)
function ws_tags_add($params, &$service) function ws_tags_add($params, &$service)
{ {
if (!is_admin() or is_adviser()) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1629,7 +1629,7 @@ function ws_images_exist($params, &$service)
{ {
global $conf; global $conf;
if (!is_admin() or is_adviser()) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1705,7 +1705,7 @@ SELECT
function ws_images_checkFiles($params, &$service) function ws_images_checkFiles($params, &$service)
{ {
if (!is_admin() or is_adviser()) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -1790,7 +1790,7 @@ function file_path_for_type($file_path, $type='thumb')
function ws_images_setInfo($params, &$service) function ws_images_setInfo($params, &$service)
{ {
global $conf; global $conf;
if (!is_admin() || is_adviser() ) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -2073,7 +2073,7 @@ SELECT
function ws_categories_setInfo($params, &$service) function ws_categories_setInfo($params, &$service)
{ {
global $conf; global $conf;
if (!is_admin() || is_adviser() ) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }
@ -2147,7 +2147,7 @@ function ws_images_checkUpload($params, &$service)
{ {
global $conf; global $conf;
if (!is_admin() or is_adviser()) if (!is_admin())
{ {
return new PwgError(401, 'Access denied'); return new PwgError(401, 'Access denied');
} }

View file

@ -276,7 +276,7 @@ DELETE FROM '.FAVORITES_TABLE.'
} }
case 'set_as_representative' : case 'set_as_representative' :
{ {
if (is_admin() and !is_adviser() and isset($page['category'])) if (is_admin() and isset($page['category']))
{ {
$query = ' $query = '
UPDATE '.CATEGORIES_TABLE.' UPDATE '.CATEGORIES_TABLE.'

View file

@ -164,7 +164,7 @@ switch ($page['tab'])
case 'tpl': case 'tpl':
// New file form creation // New file form creation
if ($newfile_page and !is_adviser()) if ($newfile_page)
{ {
$filename = isset($_POST['tpl_name']) ? $_POST['tpl_name'] : ''; $filename = isset($_POST['tpl_name']) ? $_POST['tpl_name'] : '';
$selected['model'] = isset($_POST['tpl_model']) ? $_POST['tpl_model'] : '0'; $selected['model'] = isset($_POST['tpl_model']) ? $_POST['tpl_model'] : '0';
@ -280,7 +280,7 @@ switch ($page['tab'])
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | Load backup file // | Load backup file
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['restore']) and !is_adviser()) if (isset($_POST['restore']))
{ {
$edited_file = $_POST['edited_file']; $edited_file = $_POST['edited_file'];
$content_file = file_get_contents(get_bak_file($edited_file)); $content_file = file_get_contents(get_bak_file($edited_file));
@ -292,7 +292,7 @@ if (isset($_POST['restore']) and !is_adviser())
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
// | Save file // | Save file
// +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+
if (isset($_POST['submit']) and !is_adviser()) if (isset($_POST['submit']))
{ {
if (!is_webmaster()) if (!is_webmaster())
{ {

View file

@ -30,8 +30,6 @@ $refresh_main = false;
if ( isset($_GET['view_as']) ) if ( isset($_GET['view_as']) )
{ {
if ( is_adviser() and $user['id']!=$_GET['view_as'] and $conf['guest_id']!=$_GET['view_as'])
die('security error');
if ($user['id']===$_GET['view_as']) if ($user['id']===$_GET['view_as'])
pwg_unset_session_var( 'multiview_as' ); pwg_unset_session_var( 'multiview_as' );
else else
@ -111,14 +109,7 @@ $my_url = get_root_url().'plugins/'.basename(dirname(__FILE__)).'/'.basename(__F
// | users | // | users |
$query = ' $query = '
SELECT '.$conf['user_fields']['id'].' AS id,'.$conf['user_fields']['username'].' AS username SELECT '.$conf['user_fields']['id'].' AS id,'.$conf['user_fields']['username'].' AS username
FROM '.USERS_TABLE; FROM '.USERS_TABLE.'
if (is_adviser())
{
$query .='
WHERE '.$conf['user_fields']['id']. ' IN ('.$user['id'].','.$conf['guest_id'].')
';
}
$query .='
ORDER BY CONVERT('.$conf['user_fields']['username'].',CHAR) ORDER BY CONVERT('.$conf['user_fields']['username'].',CHAR)
;'; ;';
$user_map = simple_hash_from_query($query, 'id', 'username'); $user_map = simple_hash_from_query($query, 'id', 'username');