auth->getInfo('user_name'); $user_firstname = $core->auth->getInfo('user_firstname'); $user_displayname = $core->auth->getInfo('user_displayname'); $user_email = $core->auth->getInfo('user_email'); $user_url = $core->auth->getInfo('user_url'); $user_lang = $core->auth->getInfo('user_lang'); $user_tz = $core->auth->getInfo('user_tz'); $user_post_status = $core->auth->getInfo('user_post_status'); $user_options = $core->auth->getOptions(); foreach ($core->getFormaters() as $v) { $formaters_combo[$v] = $v; } foreach ($core->blog->getAllPostStatus() as $k => $v) { $status_combo[$v] = $k; } # Language codes $langs = l10n::getISOcodes(1,1); foreach ($langs as $k => $v) { $lang_avail = $v == 'en' || is_dir(DC_L10N_ROOT.'/'.$v); $lang_combo[] = new formSelectOption($k,$v,$lang_avail ? 'avail10n' : ''); } # Add or update user if (isset($_POST['user_name'])) { try { $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['cur_pwd'])); if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) { throw new Exception(__('If you want to change your email or password you must provide your current password.')); } $cur = $core->con->openCursor($core->prefix.'user'); $cur->user_name = $user_name = $_POST['user_name']; $cur->user_firstname = $user_firstname = $_POST['user_firstname']; $cur->user_displayname = $user_displayname = $_POST['user_displayname']; $cur->user_email = $user_email = $_POST['user_email']; $cur->user_url = $user_url = $_POST['user_url']; $cur->user_lang = $user_lang = $_POST['user_lang']; $cur->user_tz = $user_tz = $_POST['user_tz']; $cur->user_post_status = $user_post_status = $_POST['user_post_status']; $user_options['edit_size'] = (integer) $_POST['user_edit_size']; if ($user_options['edit_size'] < 1) { $user_options['edit_size'] = 10; } $user_options['post_format'] = $_POST['user_post_format']; $user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']); $cur->user_options = new ArrayObject($user_options); if ($core->auth->allowPassChange() && !empty($_POST['new_pwd'])) { if (!$pwd_check) { throw new Exception(__('If you want to change your email or password you must provide your current password.')); } if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { throw new Exception(__("Passwords don't match")); } $cur->user_pwd = $_POST['new_pwd']; } # --BEHAVIOR-- adminBeforeUserUpdate $core->callBehavior('adminBeforeUserUpdate',$cur,$core->auth->userID()); # Udate user $core->updUser($core->auth->userID(),$cur); # --BEHAVIOR-- adminAfterUserUpdate $core->callBehavior('adminAfterUserUpdate',$cur,$core->auth->userID()); http::redirect('preferences.php?upd=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } /* DISPLAY -------------------------------------------------------- */ dcPage::open($page_title, dcPage::jsLoad('js/_preferences.js'). dcPage::jsConfirmClose('user-form'). # --BEHAVIOR-- adminPreferencesHeaders $core->callBehavior('adminPreferencesHeaders') ); if (!empty($_GET['upd'])) { echo '
'; } echo '