diff options
author | rub <rub@piwigo.org> | 2007-03-28 19:57:00 +0000 |
---|---|---|
committer | rub <rub@piwigo.org> | 2007-03-28 19:57:00 +0000 |
commit | 7c43a3c62d28162ee70e960f51e048727725cb31 (patch) | |
tree | 1b967195f4edf6db91bf25a6facda55ad08a8935 /admin | |
parent | b86d4ac0b89e167bedbd03805e7c7024da5cef03 (diff) |
Issue 578
User guest must be real user
Step 1: guest is a real user
On next commit, I finish installation and use of guest of user list and group
git-svn-id: http://piwigo.org/svn/trunk@1926 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/configuration.php | 130 | ||||
-rw-r--r-- | admin/include/functions.php | 31 | ||||
-rw-r--r-- | admin/profile.php | 4 | ||||
-rw-r--r-- | admin/user_list.php | 31 |
4 files changed, 41 insertions, 155 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 4a7a39d66..26be50b8a 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -73,6 +73,7 @@ $comments_checkboxes = array( if (isset($_POST['submit']) and !is_adviser()) { $int_pattern = '/^\d+$/'; + switch ($page['section']) { case 'main' : @@ -113,28 +114,7 @@ if (isset($_POST['submit']) and !is_adviser()) } case 'default' : { - // periods must be integer values, they represents number of days - if (!preg_match($int_pattern, $_POST['recent_period']) - or $_POST['recent_period'] <= 0) - { - array_push($page['errors'], $lang['periods_error']); - } - // maxwidth - if (isset($_POST['default_maxwidth']) - and !empty($_POST['default_maxwidth']) - and (!preg_match($int_pattern, $_POST['default_maxwidth']) - or $_POST['default_maxwidth'] < 50)) - { - array_push($page['errors'], $lang['maxwidth_error']); - } - // maxheight - if (isset($_POST['default_maxheight']) - and !empty($_POST['default_maxheight']) - and (!preg_match($int_pattern, $_POST['default_maxheight']) - or $_POST['default_maxheight'] < 50)) - { - array_push($page['errors'], $lang['maxheight_error']); - } + // Never go here break; } } @@ -160,8 +140,8 @@ if (isset($_POST['submit']) and !is_adviser()) $query = ' UPDATE '.CONFIG_TABLE.' - SET value = \''. str_replace("\'", "''", $value).'\' - WHERE param = \''.$row['param'].'\' +SET value = \''. str_replace("\'", "''", $value).'\' +WHERE param = \''.$row['param'].'\' ;'; pwg_query($query); } @@ -223,6 +203,8 @@ $template->assign_vars( $html_check='checked="checked"'; +$include_submit_buttons = true; + switch ($page['section']) { case 'main' : @@ -288,91 +270,37 @@ switch ($page['section']) } case 'default' : { - $show_yes = ($conf['show_nb_comments']==true)?'checked="checked"':''; - $show_no = ($conf['show_nb_comments']==false)?'checked="checked"':''; - $hits_yes = ($conf['show_nb_hits']==true)?'checked="checked"':''; - $hits_no = ($conf['show_nb_hits']==false)?'checked="checked"':''; - $expand_yes = ($conf['auto_expand']==true)?'checked="checked"':''; - $expand_no = ($conf['auto_expand']==false)?'checked="checked"':''; + $edit_user = build_user($conf['default_user_id'], false); + include_once(PHPWG_ROOT_PATH.'profile.php'); - $template->assign_block_vars( - 'default', - array( - 'NB_IMAGE_LINE'=>$conf['nb_image_line'], - 'NB_ROW_PAGE'=>$conf['nb_line_page'], - 'CONF_RECENT'=>$conf['recent_period'], - 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], - 'MAXWIDTH'=>$conf['default_maxwidth'], - 'MAXHEIGHT'=>$conf['default_maxheight'], - 'EXPAND_YES'=>$expand_yes, - 'EXPAND_NO'=>$expand_no, - 'SHOW_COMMENTS_YES'=>$show_yes, - 'SHOW_COMMENTS_NO'=>$show_no, - 'SHOW_HITS_YES'=>$hits_yes, - 'SHOW_HITS_NO'=>$hits_no, - )); - - $blockname = 'default.language_option'; - - foreach (get_languages() as $language_code => $language_name) + $errors = array(); + if ( !is_adviser() ) { - if (isset($_POST['submit'])) + if (save_profile_from_post($edit_user, $errors)) { - $selected = - $_POST['default_language'] == $language_code - ? 'selected="selected"' : ''; + // Reload user + $edit_user = build_user($conf['default_user_id'], false); + array_push($page['infos'], $lang['conf_confirmation']); } - else if ($conf['default_language'] == $language_code) - { - $selected = 'selected="selected"'; - } - else - { - $selected = ''; - } - - $template->assign_block_vars( - $blockname, - array( - 'VALUE'=> $language_code, - 'CONTENT' => $language_name, - 'SELECTED' => $selected - )); } - - $blockname = 'default.template_option'; - - foreach (get_pwg_themes() as $pwg_template) - { - if (isset($_POST['submit'])) - { - $selected = - $_POST['default_template'] == $pwg_template - ? 'selected="selected"' : ''; - } - else if ($conf['default_template'] == $pwg_template) - { - $selected = 'selected="selected"'; - } - else - { - $selected = ''; - } - - $template->assign_block_vars( - $blockname, - array( - 'VALUE'=> $pwg_template, - 'CONTENT' => $pwg_template, - 'SELECTED' => $selected - ) - ); - } - - + $page['errors'] = array_merge($page['errors'], $errors); + + load_profile_in_template( + $action, + '', + $edit_user + ); + $template->assign_block_vars('default', array()); + $include_submit_buttons = false; break; } } + +if ($include_submit_buttons) +{ + $template->assign_block_vars('include_submit_buttons', array()); +} + //----------------------------------------------------------- sending html code $template->assign_var_from_handle('ADMIN_CONTENT', 'config'); ?> diff --git a/admin/include/functions.php b/admin/include/functions.php index 1395282ad..ac99539d6 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -4,7 +4,6 @@ // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) // | file : $Id$ // | last update : $Date$ // | last modifier : $Author$ @@ -1142,35 +1141,7 @@ SELECT user_id if (count($to_create) > 0) { - $inserts = array(); - - list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); - - foreach ($to_create as $user_id) - { - $insert = array(); - $insert['user_id'] = $user_id; - $insert['status'] = 'normal'; - $insert['template'] = $conf['default_template']; - $insert['nb_image_line'] = $conf['nb_image_line']; - $insert['nb_line_page'] = $conf['nb_line_page']; - $insert['language'] = $conf['default_language']; - $insert['recent_period'] = $conf['recent_period']; - $insert['expand'] = boolean_to_string($conf['auto_expand']); - $insert['show_nb_comments'] = - boolean_to_string($conf['show_nb_comments']); - $insert['show_nb_hits'] = - boolean_to_string($conf['show_nb_hits']); - $insert['maxwidth'] = $conf['default_maxwidth']; - $insert['maxheight'] = $conf['default_maxheight']; - $insert['registration_date'] = $dbnow; - - array_push($inserts, $insert); - } - - mass_inserts(USER_INFOS_TABLE, - array_keys($inserts[0]), - $inserts); + create_user_infos($to_create); } // users present in user related tables must be present in the base user diff --git a/admin/profile.php b/admin/profile.php index 2263a6fff..9643aaf79 100644 --- a/admin/profile.php +++ b/admin/profile.php @@ -35,7 +35,7 @@ include_once(PHPWG_ROOT_PATH.'profile.php'); $errors = array(); if ( !is_adviser() ) { - save_profile_from_post( $edit_user, $errors); + save_profile_from_post($edit_user, $errors); } load_profile_in_template( @@ -43,7 +43,7 @@ load_profile_in_template( get_root_url().'admin.php?page=user_list', $edit_user ); -$page['errors'] = array_merge($page['errors'], $errors ); +$page['errors'] = array_merge($page['errors'], $errors); $template->set_filename('profile', 'admin/profile.tpl'); $template->assign_var_from_handle('ADMIN_CONTENT', 'profile'); diff --git a/admin/user_list.php b/admin/user_list.php index 3f663509b..15b009290 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -4,8 +4,7 @@ // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ +// | file : $Id$ // | last update : $Date$ // | last modifier : $Author$ // | revision : $Revision$ @@ -547,19 +546,6 @@ foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) )); } -// --- -// $user['template'] = $conf['default_template']; -// $user['nb_image_line'] = $conf['nb_image_line']; -// $user['nb_line_page'] = $conf['nb_line_page']; -// $user['language'] = $conf['default_language']; -// $user['maxwidth'] = $conf['default_maxwidth']; -// $user['maxheight'] = $conf['default_maxheight']; -// $user['recent_period'] = $conf['recent_period']; -// $user['expand'] = $conf['auto_expand']; -// $user['show_nb_comments'] = $conf['show_nb_comments']; -// $user['show_nb_hits'] = $conf['show_nb_hits']; -// --- - if (isset($_POST['pref_submit'])) { // echo '<pre>'; print_r($_POST); echo '</pre>'; @@ -588,13 +574,14 @@ if (isset($_POST['pref_submit'])) } else { + $default_user = get_default_user_info(true); $template->assign_vars( array( - 'NB_IMAGE_LINE' => $conf['nb_image_line'], - 'NB_LINE_PAGE' => $conf['nb_line_page'], - 'MAXWIDTH' => @$conf['default_maxwidth'], - 'MAXHEIGHT' => @$conf['default_maxheight'], - 'RECENT_PERIOD' => $conf['recent_period'], + 'NB_IMAGE_LINE' => $default_user['nb_image_line'], + 'NB_LINE_PAGE' => $default_user['nb_line_page'], + 'MAXWIDTH' => $default_user['maxwidth'], + 'MAXHEIGHT' => $default_user['maxheight'], + 'RECENT_PERIOD' => $default_user['recent_period'], )); } @@ -606,7 +593,7 @@ foreach (get_pwg_themes() as $pwg_template) { $selected = $_POST['template']==$pwg_template ? 'selected="selected"' : ''; } - else if ($conf['default_template'] == $pwg_template) + else if (get_default_template() == $pwg_template) { $selected = 'selected="selected"'; } @@ -632,7 +619,7 @@ foreach (get_languages() as $language_code => $language_name) { $selected = $_POST['language']==$language_code ? 'selected="selected"':''; } - else if ($conf['default_language'] == $language_code) + else if (get_default_language() == $language_code) { $selected = 'selected="selected"'; } |