本文整理汇总了PHP中UserDB::getAuthUserById方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::getAuthUserById方法的具体用法?PHP UserDB::getAuthUserById怎么用?PHP UserDB::getAuthUserById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDB
的用法示例。
在下文中一共展示了UserDB::getAuthUserById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run(array $requestData)
{
//Make sure we have a session
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
/*
//Count hits
if (isset($_SESSION['Stippers']['hits']))
$_SESSION['Stippers']['hits']++;
else
$_SESSION['Stippers']['hits'] = 0;
echo $_SESSION['Stippers']['hits'];
*/
//If we have login in our post this means we are on the login page in and we must call the login controller.
//The login controller will load
if (isset($_POST['login'])) {
LoginController::post();
}
$errorGettingUser = false;
$errorGettingBrowser = false;
//Check if we have data about a user in session, in which case renew it.
//Also check if we're not logging in because then we already have fresh user data.
if (isset($_SESSION['Stippers']['user']) && !isset($_POST['login'])) {
try {
//Gets user from database. This gets the user only if he's a member this year or if it's the admin account.
$newUser = UserDB::getAuthUserById($_SESSION['Stippers']['user']->userId);
//If the user's password has changed we immediately log out!
if ($_SESSION['Stippers']['user']->passwordHash != $newUser->passwordHash) {
session_destroy();
ForcedLogoutController::get();
return false;
} else {
$_SESSION['Stippers']['user'] = $newUser;
}
} catch (Exception $ex) {
session_destroy();
ForcedLogoutController::get();
return false;
}
}
//Get the browser data for this browser
if (isset($_COOKIE['stippersAuthorization'])) {
try {
$_SESSION['Stippers']['browser'] = BrowserDB::getBasicBrowserByUuid($_COOKIE['stippersAuthorization']);
} catch (BrowserDBException $ex) {
//unset because we don't want to use old data
unset($_SESSION['Stippers']['browser']);
if ($ex->getCode() != BrowserDBException::NOBROWSERFORUUID) {
$errorGettingBrowser = true;
}
} catch (Exception $ex) {
//unset because we don't want to use old data
unset($_SESSION['Stippers']['browser']);
$errorGettingBrowser = true;
}
}
//We can now check the page access permissions.
require_once __DIR__ . '/../config/PageAccessPermissions.php';
//Default to inaccessible for everyone
$everyone = false;
$member = false;
$admin = false;
$userManager = false;
$hintManager = false;
$browserManager = false;
$moneyManager = false;
$addRenewUserBrowser = false;
$checkInBrowser = false;
$cashRegisterBrowser = false;
$apiKey = false;
//If permissions for the requested page are defined we override the
//defaults with these.
if (isset($_PERMISSIONS[$requestData['requestedPage']])) {
$permissions = $_PERMISSIONS[$requestData['requestedPage']];
if (isset($permissions['EVERYONE'])) {
$everyone = $permissions['EVERYONE'];
}
if (isset($permissions['MEMBER'])) {
$member = $permissions['MEMBER'];
}
if (isset($permissions['ADMIN'])) {
$admin = $permissions['ADMIN'];
}
if (isset($permissions['USERMANAGER'])) {
$userManager = $permissions['USERMANAGER'];
}
if (isset($permissions['HINTMANAGER'])) {
$hintManager = $permissions['HINTMANAGER'];
}
if (isset($permissions['BROWSERMANAGER'])) {
$browserManager = $permissions['BROWSERMANAGER'];
}
if (isset($permissions['MONEYMANAGER'])) {
$moneyManager = $permissions['MONEYMANAGER'];
}
if (isset($permissions['ADDRENEWUSERBROWSER'])) {
$addRenewUserBrowser = $permissions['ADDRENEWUSERBROWSER'];
}
if (isset($permissions['CHECKINBROWSER'])) {
//.........这里部分代码省略.........