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 /profile.php | |
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-- | profile.php | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/profile.php b/profile.php index e83eac010..d612038d0 100644 --- a/profile.php +++ b/profile.php @@ -79,7 +79,7 @@ function save_profile_from_post(&$userdata, &$errors) if (!isset($_POST['validate'])) { - return; + return false; } $int_pattern = '/^\d+$/'; @@ -114,10 +114,13 @@ function save_profile_from_post(&$userdata, &$errors) $errors[] = l10n('periods_error') ; } - $mail_error = validate_mail_address($_POST['mail_address']); - if (!empty($mail_error)) + if (isset($_POST['mail_address'])) { - $errors[] = $mail_error; + $mail_error = validate_mail_address($_POST['mail_address']); + if (!empty($mail_error)) + { + $errors[] = $mail_error; + } } if (!empty($_POST['use_new_pwd'])) @@ -149,25 +152,28 @@ function save_profile_from_post(&$userdata, &$errors) // mass_updates function include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); - // update common user informations - $fields = array($conf['user_fields']['email']); + if (isset($_POST['mail_address'])) + { + // update common user informations + $fields = array($conf['user_fields']['email']); - $data = array(); - $data{$conf['user_fields']['id']} = $_POST['userid']; - $data{$conf['user_fields']['email']} = $_POST['mail_address']; + $data = array(); + $data{$conf['user_fields']['id']} = $_POST['userid']; + $data{$conf['user_fields']['email']} = $_POST['mail_address']; - // password is updated only if filled - if (!empty($_POST['use_new_pwd'])) - { - array_push($fields, $conf['user_fields']['password']); - // password is encrpyted with function $conf['pass_convert'] - $data{$conf['user_fields']['password']} = - $conf['pass_convert']($_POST['use_new_pwd']); + // password is updated only if filled + if (!empty($_POST['use_new_pwd'])) + { + array_push($fields, $conf['user_fields']['password']); + // password is encrpyted with function $conf['pass_convert'] + $data{$conf['user_fields']['password']} = + $conf['pass_convert']($_POST['use_new_pwd']); + } + mass_updates(USERS_TABLE, + array('primary' => array($conf['user_fields']['id']), + 'update' => $fields), + array($data)); } - mass_updates(USERS_TABLE, - array('primary' => array($conf['user_fields']['id']), - 'update' => $fields), - array($data)); // update user "additional" informations (specific to PhpWebGallery) $fields = array( @@ -190,8 +196,12 @@ function save_profile_from_post(&$userdata, &$errors) array($data)); // redirection - redirect($_POST['redirect']); + if (!empty($_POST['redirect'])) + { + redirect($_POST['redirect']); + } } + return true; } @@ -283,10 +293,16 @@ function load_profile_in_template($url_action, $url_redirect, $userdata) 'SELECTED' => $selected )); } - if ( !defined('IN_ADMIN') ) + + if (!($userdata['is_the_guest'] or $userdata['is_the_default'])) { - $template->assign_block_vars( 'not_admin', array() ); + $template->assign_block_vars('not_special_user', array()); + if ( !defined('IN_ADMIN') ) + { + $template->assign_block_vars( 'not_special_user.not_admin', array() ); + } } + $template->assign_var_from_handle('PROFILE_CONTENT', 'profile_content'); } ?> |