pieRequireUser(); pieHead("edit"); if (@$_REQUEST['user']) { // A user has been specified. $_REQUEST['user'] = pieGetOption($_REQUEST['user']); $user = new User(); if (!$user->isValidName($_REQUEST['user'])) { pieError("BadUser"); } if (!$user->exists($_REQUEST['user'])) { pieError("BadUser"); } } elseif ($_SESSION['user']) { // No user has been specified: // display information about myself. $_REQUEST['user'] = $_SESSION['user']; } if (!@$_REQUEST['user']) { pieError("NoUser"); } $map = new MapFile(); $data = array('user' => htmlspecialchars($_REQUEST['user']), 'realname' => "—", 'lastlogin' => date($GLOBALS['pie']['time_format'], $map->read($GLOBALS['pie']['run_path'] . "/user/login.map", $_REQUEST['user']))); $pref = new UserPref(); if (($val = $pref->read(@$_REQUEST['user'], 'realname')) !== false) { $data['realname'] = $val; } if (($val = $pref->read(@$_REQUEST['user'], 'registered')) !== false) { $data['registered'] = date($GLOBALS['pie']['time_format'], $val); } pieNotice("UserData", $data); pieTail();
$preview = pieTempName("_preview"); // Check validity. if (!$page->isValidName($page->name)) { pieError("PageNameInvalid"); } if (!$page->lock($GLOBALS['pie']['user'])) { pieError("PageLockError"); } // Prepare editing environment. if ($GLOBALS['pie']['edit_timeout']) { pieExpireDirectory($GLOBALS['pie']['run_path'] . "/temp", $GLOBALS['pie']['edit_timeout']); } $_REQUEST['cols'] = 80; $_REQUEST['rows'] = 20; $_REQUEST['author'] = $GLOBALS['pie']['user']; $pref = new UserPref(); if (($t = $pref->read($GLOBALS['pie']['user'], "cols")) !== false) { $_REQUEST['cols'] = $t; } if (($t = $pref->read($GLOBALS['pie']['user'], "rows")) !== false) { $_REQUEST['rows'] = $t; } // Determine the source of the source (so to speak). if ($_POST['source']) { // User provided input via HTTP request. $_REQUEST['source'] = pieCleanString($_REQUEST['source']); $_REQUEST['title'] = pieGetOption($_REQUEST['title']); $_REQUEST['comment'] = pieGetOption($_REQUEST['comment']); } elseif (file_exists($preview)) { // Read source and meta data from temporary preview file. if (!($dump = file_get_contents($preview))) {
include_once "{$lib}/share/stdio.php"; include_once "{$lib}/share/string.php"; include_once "{$lib}/share/log.php"; pieRequireSuperuser(); pieHead("edit"); if (@$_REQUEST['username'] && @$_REQUEST['password']) { // A user has been specified. $user = new User(); if (!$user->isValidName($_REQUEST['username'])) { pieError("InvalidUsername"); } if ($user->exists($_REQUEST['username'])) { pieError("UserExists"); } if ($_REQUEST['password'] != $_REQUEST['retype']) { pieError("PasswordMismatch"); } // Userdata acceptable. Create new user. if (!$user->write($_REQUEST['username'], $user->encrypt($_REQUEST['password']))) { pieError("FailureForm"); } $pref = new UserPref(); $pref->write($_REQUEST['username'], "registered", time()); $GLOBALS['pie']['user'] = $_REQUEST['username']; pieLog("user"); pieNotice("SuccessForm"); } else { // Print the form. pieNotice('RegisterForm'); } pieTail();
<?php /* * Change user information. */ include_once "{$lib}/class/mapfile.php"; include_once "{$lib}/class/session.php"; include_once "{$lib}/class/user.php"; include_once "{$lib}/class/userpref.php"; include_once "{$lib}/share/auth.php"; include_once "{$lib}/share/log.php"; include_once "{$lib}/share/string.php"; pieRequireUser(); pieHead("edit"); $user = $_SESSION['user']; $pref = new UserPref(); if (@$_REQUEST['form'] == "useredit") { if ($_REQUEST['realname']) { $pref->write($user, 'realname', pieGetOption(@$_REQUEST['realname'])); } if ($_REQUEST['mail']) { $pref->write($user, 'mail', pieGetOption(@$_REQUEST['mail'])); } if ($_REQUEST['cols']) { $pref->write($user, 'cols', intval(@$_REQUEST['cols'])); } if ($_REQUEST['rows']) { $pref->write($user, 'rows', intval(@$_REQUEST['rows'])); } pieLog("user"); pieNotice("UpdateSuccessful");
*/ include_once "{$lib}/class/mapfile.php"; include_once "{$lib}/class/user.php"; include_once "{$lib}/class/userpref.php"; include_once "{$lib}/share/auth.php"; include_once "{$lib}/share/link.php"; include_once "{$lib}/share/stdio.php"; include_once "{$lib}/share/string.php"; include_once "{$lib}/class/locale.php"; pieLoadLocale(); pieHead("edit"); pieRequireSuperuser(); if (@$_REQUEST['user'] && @$_REQUEST['approve']) { // A user has been specified. $user = new User(); $pref = new UserPref(); $map = new MapFile(); if (!$user->exists($_REQUEST['user'])) { pieError('UserNotFound'); } if (!$user->write($_REQUEST['user'], '')) { pieError('UserNotDeletable'); } if (!$pref->write($_REQUEST['user'], '', '')) { pieError('UserNotDeletable'); } pieNotice('UserDeleted'); } elseif (@$_REQUEST['user']) { // Ask for approval to delete user. pieNotice('AskApproval'); } else {
/** * Get a user friendly timezone representation returned in string. * If userTZ is empty, will use current user timezone * @param string $userTZ (can be null) */ public static function displayUserFriendlyTimeZone($userTZ = null) { if ($userTZ == null) { $userTZ = UserPref::getValue(UserPref::PREF_USER_TIME_ZONE); } $res = $userTZ . ' UTC'; $this_tz = new DateTimeZone($userTZ); $offset = $this_tz->getOffset(new DateTime("now", $this_tz)); if ($offset == 0) { $res .= '±'; } else { if ($offset > 0) { $res .= '+'; } } $res .= self::getTimezoneOffset($userTZ); return $res; }