diff --git a/admin/maintenance.php b/admin/maintenance.php index 0a5c3cd22..c7caf8e50 100644 --- a/admin/maintenance.php +++ b/admin/maintenance.php @@ -98,16 +98,32 @@ $template->set_filenames(array('maintenance'=>'admin/maintenance.tpl')); $start_url = PHPWG_ROOT_PATH.'admin.php?page=maintenance&action='; -$template->assign_vars( - array( - 'U_MAINT_CATEGORIES' => $start_url.'categories', - 'U_MAINT_IMAGES' => $start_url.'images', - 'U_MAINT_HISTORY' => $start_url.'history', - 'U_MAINT_SESSIONS' => $start_url.'sessions', - 'U_MAINT_FEEDS' => $start_url.'feeds', - 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=maintenance', - ) - ); +if (!is_adviser()) +{ + $template->assign_vars( + array( + 'U_MAINT_CATEGORIES' => $start_url.'categories', + 'U_MAINT_IMAGES' => $start_url.'images', + 'U_MAINT_HISTORY' => $start_url.'history', + 'U_MAINT_SESSIONS' => $start_url.'sessions', + 'U_MAINT_FEEDS' => $start_url.'feeds', + 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=maintenance', + ) + ); +} +else +{ + $template->assign_vars( + array( + 'U_MAINT_CATEGORIES' => $start_url, + 'U_MAINT_IMAGES' => $start_url, + 'U_MAINT_HISTORY' => $start_url, + 'U_MAINT_SESSIONS' => $start_url, + 'U_MAINT_FEEDS' => $start_url, + 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=maintenance', + ) + ); +} // +-----------------------------------------------------------------------+ // | sending html code | diff --git a/admin/picture_modify.php b/admin/picture_modify.php index 0e20f9290..05412492c 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -41,7 +41,7 @@ check_status(ACCESS_ADMINISTRATOR); // | synchronize metadata | // +-----------------------------------------------------------------------+ -if (isset($_GET['sync_metadata'])) +if (isset($_GET['sync_metadata']) and !is_adviser()) { $query = ' SELECT path diff --git a/admin/user_list.php b/admin/user_list.php index 6f1b11938..ed2fc77d2 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -97,6 +97,7 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, u.'.$conf['user_fields']['username'].' AS username, u.'.$conf['user_fields']['email'].' AS email, ui.status, + ui.adviser, ui.enabled_high FROM '.USERS_TABLE.' AS u INNER JOIN '.USER_INFOS_TABLE.' AS ui @@ -337,9 +338,9 @@ DELETE FROM '.USER_GROUP_TABLE.' $formfields = array('nb_image_line', 'nb_line_page', 'template', 'language', 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', - 'maxheight', 'status', 'enabled_high'); + 'maxheight', 'status', 'adviser', 'enabled_high'); - $true_false_fields = array('expand', 'show_nb_comments', 'enabled_high'); + $true_false_fields = array('expand', 'show_nb_comments', 'adviser', 'enabled_high'); foreach ($formfields as $formfield) { @@ -380,20 +381,22 @@ DELETE FROM '.USER_GROUP_TABLE.' $data[$dbfield] = $_POST[$dbfield]; } } - + // Webmaster status must not be changed if ($conf['webmaster_id'] == $user_id and isset($data['status'])) { $data['status'] = 'webmaster'; } - + + // Webmaster and guest adviser must not be changed + if ((($conf['webmaster_id'] == $user_id) or ($conf['guest_id'] == $user_id)) and isset($data['adviser'])) + { + $data['adviser'] = 'false'; + } + array_push($datas, $data); } -// echo '
';
-//       print_r($datas);
-//       echo '
'; - mass_updates(USER_INFOS_TABLE, $dbfields, $datas); } @@ -572,6 +575,8 @@ if (isset($_POST['pref_submit'])) // echo '
'; print_r($_POST); echo '
'; $template->assign_vars( array( + 'ADVISER_YES' => 'true' == $_POST['adviser'] ? 'checked="checked"' : '', + 'ADVISER_NO' => 'false' == $_POST['adviser'] ? 'checked="checked"' : '', 'NB_IMAGE_LINE' => $_POST['nb_image_line'], 'NB_LINE_PAGE' => $_POST['nb_line_page'], 'MAXWIDTH' => $_POST['maxwidth'], @@ -582,7 +587,9 @@ if (isset($_POST['pref_submit'])) 'SHOW_NB_COMMENTS_YES' => 'true' == $_POST['show_nb_comments'] ? 'checked="checked"' : '', 'SHOW_NB_COMMENTS_NO' => - 'false' == $_POST['show_nb_comments'] ? 'checked="checked"' : '' + 'false' == $_POST['show_nb_comments'] ? 'checked="checked"' : '', + 'ENABLED_HIGH_YES' => 'true' == $_POST['enabled_high'] ? 'checked="checked"' : '', + 'ENABLED_HIGH_NO' => 'false' == $_POST['enabled_high'] ? 'checked="checked"' : '', )); } else @@ -665,14 +672,18 @@ foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) { $selected = ''; } - - $template->assign_block_vars( - $blockname, - array( - 'VALUE' => $status, - 'CONTENT' => $lang['user_status_'.$status], - 'SELECTED' => $selected - )); + + // Only status <= can be assign + if (is_autorize_status(get_access_type_status($status))) + { + $template->assign_block_vars( + $blockname, + array( + 'VALUE' => $status, + 'CONTENT' => $lang['user_status_'.$status], + 'SELECTED' => $selected + )); + } } // associate @@ -800,7 +811,7 @@ foreach ($page['filtered_users'] as $num => $local_user) 'U_MOD' => $profile_url.$local_user['id'], 'U_PERM' => $perm_url.$local_user['id'], 'USERNAME' => $local_user['username'], - 'STATUS' => $lang['user_status_'.$local_user['status']], + 'STATUS' => $lang['user_status_'.$local_user['status']].(($local_user['adviser'] == 'true') ? ' ['.$lang['adviser'].']' : ''), 'EMAIL' => isset($local_user['email']) ? $local_user['email'] : '', 'GROUPS' => $groups_string, 'PROPERTIES' => (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) ? $lang['is_high_enabled'] : $lang['is_high_disabled'] diff --git a/include/common.inc.php b/include/common.inc.php index 86c5c7a70..27949fd17 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -232,6 +232,18 @@ include( .'/themeconf.inc.php' ); +if (is_adviser()) +{ + echo ' +
+

+
'.$lang['adviser_mode_enabled'].' +
+

+
+ '; +} + // template instance $template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']); ?> diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 44f1a1cf7..7af517980 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -548,11 +548,11 @@ function log_user($user_id, $remember_me) } /* - * Return if current user have access to access_type definition + * Return access_type definition of uuser * Test does with user status * @return bool */ -function is_autorize_status($access_type, $user_status = '') +function get_access_type_status($user_status = '') { global $user; @@ -587,11 +587,21 @@ function is_autorize_status($access_type, $user_status = '') } } - return ($access_type_status >= $access_type); + return $access_type_status; } /* - * Check if current user have access to access_type definition + * Return if user have access to access_type definition + * Test does with user status + * @return bool +*/ +function is_autorize_status($access_type, $user_status = '') +{ + return (get_access_type_status($user_status) >= $access_type); +} + +/* + * Check if user have access to access_type definition * Stop action if there are not access * Test does with user status * @return none @@ -609,7 +619,7 @@ function check_status($access_type, $user_status = '') } /* - * Return if current user is an administrator + * Return if user is an administrator * @return bool */ function is_admin($user_status = '') @@ -617,4 +627,15 @@ function is_admin($user_status = '') return is_autorize_status(ACCESS_ADMINISTRATOR, $user_status); } +/* + * Return if current user is an adviser + * @return bool +*/ +function is_adviser() +{ + global $user; + + return ($user['adviser'] == 'true'); +} + ?> \ No newline at end of file diff --git a/include/page_header.php b/include/page_header.php index d4c3b9e3d..778d5661c 100644 --- a/include/page_header.php +++ b/include/page_header.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $RCSfile$ @@ -52,7 +52,8 @@ $template->assign_vars( 'LANG'=>$lang_info['code'], 'DIR'=>$lang_info['direction'], - 'T_STYLE' => $css + 'T_STYLE' => $css, + 'TAG_INPUT_ENABLED' => ((is_adviser()) ? 'disabled' : '') )); // refresh diff --git a/install/db/16-database.php b/install/db/16-database.php new file mode 100644 index 000000000..4187b2cc4 --- /dev/null +++ b/install/db/16-database.php @@ -0,0 +1,54 @@ + diff --git a/install/phpwebgallery_structure.sql b/install/phpwebgallery_structure.sql index 9e5c4a49f..cf3068775 100644 --- a/install/phpwebgallery_structure.sql +++ b/install/phpwebgallery_structure.sql @@ -297,6 +297,7 @@ CREATE TABLE `phpwebgallery_user_infos` ( `nb_image_line` tinyint(1) unsigned NOT NULL default '5', `nb_line_page` tinyint(3) unsigned NOT NULL default '3', `status` enum('webmaster', 'admin', 'normal', 'generic', 'guest') NOT NULL default 'guest', + `adviser` enum('true','false') NOT NULL default 'false', `language` varchar(50) NOT NULL default 'english', `maxwidth` smallint(6) default NULL, `maxheight` smallint(6) default NULL, diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index 2597b7a3a..ab32c46f4 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -166,6 +166,7 @@ $lang['properties'] = 'Properties'; $lang['is_high_enabled'] = 'High definition'; $lang['is_high_disabled'] = ''; $lang['enabled_high'] = 'High definition enabled'; +$lang['adviser'] = 'Adviser'; $lang['add keywords'] = 'add keywords'; $lang['associate to category'] = 'associate to category'; $lang['associate to group'] = 'associate to group'; diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php index 71a28413e..4f583b5c6 100644 --- a/language/en_UK.iso-8859-1/common.lang.php +++ b/language/en_UK.iso-8859-1/common.lang.php @@ -331,4 +331,5 @@ $lang['upload_username'] = 'Username'; $lang['useful when password forgotten'] = 'useful when password forgotten'; $lang['w_month'] = 'Month'; $lang['yes'] = 'Yes'; +$lang['adviser_mode_enabled'] = 'Adviser mode enabled'; ?> diff --git a/language/en_UK.iso-8859-1/help/user_list.html b/language/en_UK.iso-8859-1/help/user_list.html index fb1874546..d9312b084 100644 --- a/language/en_UK.iso-8859-1/help/user_list.html +++ b/language/en_UK.iso-8859-1/help/user_list.html @@ -21,7 +21,9 @@ or descending order.

  • delete users (require a confirmation checkbox)
  • change status
  • - + +
  • set user like an adviser
  • +
  • associate or dissociate from groups
  • modify display properties
  • diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index 013f5829d..19185232c 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -166,6 +166,7 @@ $lang['properties'] = 'Propri $lang['is_high_enabled'] = 'Haute définition'; $lang['is_high_disabled'] = ''; $lang['enabled_high'] = 'Haute définition actif'; +$lang['adviser'] = 'Conseiller'; $lang['add keywords'] = 'ajouter des mots-clef'; $lang['associate to category'] = 'associer à la catégorie'; $lang['associate to group'] = 'associer au groupe'; diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php index 49adaee76..c9af1c218 100644 --- a/language/fr_FR.iso-8859-1/common.lang.php +++ b/language/fr_FR.iso-8859-1/common.lang.php @@ -331,4 +331,5 @@ $lang['upload_username'] = 'Nom d\'utilisateur'; $lang['useful when password forgotten'] = 'utile en cas d\'oubli de mot de passe'; $lang['w_month'] = 'Mois'; $lang['yes'] = 'Oui'; +$lang['adviser_mode_enabled'] = 'Mode conseiller actif'; ?> diff --git a/language/fr_FR.iso-8859-1/help/user_list.html b/language/fr_FR.iso-8859-1/help/user_list.html index 1ce294ca2..17321cda6 100644 --- a/language/fr_FR.iso-8859-1/help/user_list.html +++ b/language/fr_FR.iso-8859-1/help/user_list.html @@ -23,6 +23,8 @@ simultan
  • changer le status
  • +
  • définir l'utilisateur comme un conseiller
  • +
  • associer ou dissocier des groupes
  • modifier les propriétés d'affichage
  • diff --git a/picture.php b/picture.php index 432870611..c506d9d7e 100644 --- a/picture.php +++ b/picture.php @@ -169,7 +169,7 @@ DELETE FROM '.FAVORITES_TABLE.' } case 'set_as_representative' : { - if (is_admin() and isset($page['category'])) + if (is_admin() and isset($page['category']) and !is_adviser()) { $query = ' UPDATE '.CATEGORIES_TABLE.' @@ -189,7 +189,10 @@ UPDATE '.CATEGORIES_TABLE.' } case 'add_to_caddie' : { - fill_caddie(array($page['image_id'])); + if (!is_adviser()) + { + fill_caddie(array($page['image_id'])); + } redirect($url_self); break; } diff --git a/template/yoga/admin/cat_list.tpl b/template/yoga/admin/cat_list.tpl index 1124b1157..599270b6c 100644 --- a/template/yoga/admin/cat_list.tpl +++ b/template/yoga/admin/cat_list.tpl @@ -39,8 +39,8 @@

    - - + +

    @@ -48,6 +48,6 @@

    {L_ADD_VIRTUAL} : - +

    diff --git a/template/yoga/admin/cat_modify.tpl b/template/yoga/admin/cat_modify.tpl index 8e08baafd..8101e7ffa 100644 --- a/template/yoga/admin/cat_modify.tpl +++ b/template/yoga/admin/cat_modify.tpl @@ -103,7 +103,7 @@

    - +

    @@ -123,7 +123,7 @@ -

    +

    @@ -161,7 +161,7 @@

    - +

    @@ -179,7 +179,7 @@ -

    +

    @@ -189,7 +189,7 @@ -

    +

    @@ -203,7 +203,7 @@ -

    +

    @@ -213,7 +213,7 @@ -

    +

    diff --git a/template/yoga/admin/cat_move.tpl b/template/yoga/admin/cat_move.tpl index c0c3fa215..5d5247f2f 100644 --- a/template/yoga/admin/cat_move.tpl +++ b/template/yoga/admin/cat_move.tpl @@ -33,7 +33,7 @@

    - +

    diff --git a/template/yoga/admin/cat_perm.tpl b/template/yoga/admin/cat_perm.tpl index 1676ef57a..9c8fafa69 100644 --- a/template/yoga/admin/cat_perm.tpl +++ b/template/yoga/admin/cat_perm.tpl @@ -18,7 +18,7 @@
  • - +
    @@ -28,7 +28,7 @@
  • - +

    {lang:Users}

    @@ -40,7 +40,7 @@
  • - +
    @@ -59,7 +59,7 @@
  • - +
    diff --git a/template/yoga/admin/comments.tpl b/template/yoga/admin/comments.tpl index d903c332a..d7053200d 100644 --- a/template/yoga/admin/comments.tpl +++ b/template/yoga/admin/comments.tpl @@ -17,7 +17,7 @@

    - + diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl index 0c7c1817d..fb9b0f590 100644 --- a/template/yoga/admin/configuration.tpl +++ b/template/yoga/admin/configuration.tpl @@ -141,7 +141,7 @@

    - +

    diff --git a/template/yoga/admin/double_select.tpl b/template/yoga/admin/double_select.tpl index 1745c52d3..2bfa28072 100644 --- a/template/yoga/admin/double_select.tpl +++ b/template/yoga/admin/double_select.tpl @@ -7,7 +7,7 @@ -

    +

    @@ -17,7 +17,7 @@ -

    +

    diff --git a/template/yoga/admin/element_set_global.tpl b/template/yoga/admin/element_set_global.tpl index de15c637b..53c956d40 100644 --- a/template/yoga/admin/element_set_global.tpl +++ b/template/yoga/admin/element_set_global.tpl @@ -27,7 +27,7 @@ -

    +

    @@ -152,7 +152,7 @@

    -

    +

    diff --git a/template/yoga/admin/element_set_unit.tpl b/template/yoga/admin/element_set_unit.tpl index 7dba4a2bf..a5e718012 100644 --- a/template/yoga/admin/element_set_unit.tpl +++ b/template/yoga/admin/element_set_unit.tpl @@ -84,7 +84,7 @@

    - +

    diff --git a/template/yoga/admin/group_list.tpl b/template/yoga/admin/group_list.tpl index bafa87a71..389bc1071 100644 --- a/template/yoga/admin/group_list.tpl +++ b/template/yoga/admin/group_list.tpl @@ -5,7 +5,7 @@
    {lang:Add group} -

    +

    @@ -21,7 +21,7 @@ {group.MEMBERS} permissions - delete + delete diff --git a/template/yoga/admin/maintenance.tpl b/template/yoga/admin/maintenance.tpl index 0728d3ba3..63ba549c9 100644 --- a/template/yoga/admin/maintenance.tpl +++ b/template/yoga/admin/maintenance.tpl @@ -7,9 +7,9 @@ diff --git a/template/yoga/admin/picture_modify.tpl b/template/yoga/admin/picture_modify.tpl index 54cab455d..2be4547dd 100644 --- a/template/yoga/admin/picture_modify.tpl +++ b/template/yoga/admin/picture_modify.tpl @@ -7,7 +7,7 @@
  • {lang:jump to}
  • -
  • {lang:synchronize}
  • +
  • {lang:synchronize}
  • @@ -111,7 +111,7 @@

    - +

    @@ -132,7 +132,7 @@ -

    +

    @@ -142,7 +142,7 @@ -

    +

    @@ -163,7 +163,7 @@ -

    +

    @@ -173,7 +173,7 @@ -

    +

    diff --git a/template/yoga/admin/rating.tpl b/template/yoga/admin/rating.tpl index 37cf6e1c4..139723b4d 100644 --- a/template/yoga/admin/rating.tpl +++ b/template/yoga/admin/rating.tpl @@ -36,7 +36,7 @@

    - +

    diff --git a/template/yoga/admin/site_manager.tpl b/template/yoga/admin/site_manager.tpl index 9ceb369aa..924a910aa 100644 --- a/template/yoga/admin/site_manager.tpl +++ b/template/yoga/admin/site_manager.tpl @@ -44,6 +44,6 @@

    - +

    diff --git a/template/yoga/admin/site_update.tpl b/template/yoga/admin/site_update.tpl index 518975360..7aa60212b 100644 --- a/template/yoga/admin/site_update.tpl +++ b/template/yoga/admin/site_update.tpl @@ -80,7 +80,7 @@
    - +
    diff --git a/template/yoga/admin/thumbnail.tpl b/template/yoga/admin/thumbnail.tpl index 9fae9f9fd..25bb76b9d 100644 --- a/template/yoga/admin/thumbnail.tpl +++ b/template/yoga/admin/thumbnail.tpl @@ -90,7 +90,7 @@
    -

    +

    diff --git a/template/yoga/admin/user_list.tpl b/template/yoga/admin/user_list.tpl index d4a45aa63..81365b63b 100644 --- a/template/yoga/admin/user_list.tpl +++ b/template/yoga/admin/user_list.tpl @@ -10,7 +10,7 @@ {lang:Add a user} - + @@ -65,7 +65,7 @@ - + @@ -104,7 +104,7 @@
    {lang:Deletions} - +
    @@ -123,6 +123,16 @@ + + + {lang:adviser} + + + / {lang:set to} + + + +
    @@ -296,7 +306,7 @@

    - +

    diff --git a/template/yoga/admin/waiting.tpl b/template/yoga/admin/waiting.tpl index d011e9984..10e8e3ff7 100644 --- a/template/yoga/admin/waiting.tpl +++ b/template/yoga/admin/waiting.tpl @@ -38,9 +38,9 @@

    - - - + + +

    diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index d49f1d052..f89eadf64 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -17,7 +17,7 @@ {L_SLIDESHOW} {L_PICTURE_METADATA} - {lang:representative} + {lang:representative} {favorite.FAVORITE_ALT} @@ -152,7 +152,7 @@

    {rate.SENTENCE} : -{rate.rate_option.SEPARATOR} {rate.rate_option.OPTION} +{rate.rate_option.SEPARATOR} {rate.rate_option.OPTION}

    @@ -194,7 +194,7 @@ - +