function Users_account_post() { Q_Session::start(); Q_Valid::nonce(true); extract($_REQUEST); // Implement the action $user = Users::loggedInUser(true); }
/** * Get the logged-in user's information * @method loggedInUser * @static * @param {boolean} [$throwIfNotLoggedIn=false] * Whether to throw a Users_Exception_NotLoggedIn if no user is logged in. * @param {boolean} [$startSession=true] * Whether to start a PHP session if one doesn't already exist. * @return {Users_User|null} * @throws {Users_Exception_NotLoggedIn} If user is not logged in and * $throwIfNotLoggedIn is true */ static function loggedInUser($throwIfNotLoggedIn = false, $startSession = true) { if ($startSession === false and !Q_Session::id()) { return null; } Q_Session::start(); $nonce = Q_Session::$nonceWasSet or Q_Valid::nonce($throwIfNotLoggedIn, true); if (!$nonce or !isset($_SESSION['Users']['loggedInUser']['id'])) { if ($throwIfNotLoggedIn) { throw new Users_Exception_NotLoggedIn(); } return null; } $id = $_SESSION['Users']['loggedInUser']['id']; $user = Users_User::fetch($id); if (!$user and $throwIfNotLoggedIn) { throw new Users_Exception_NotLoggedIn(); } return $user; }
function Users_identifier_response_content() { Q_Session::start(); return Q::tool('Users/identifier'); }
function Users_account_response_content() { Q_Session::start(); return Q::tool('Users/account'); }