当前位置: 首页>>代码示例>>PHP>>正文


PHP UserDB::getAuthUserById方法代码示例

本文整理汇总了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'])) {
//.........这里部分代码省略.........
开发者ID:JHDeStip,项目名称:Stippers,代码行数:101,代码来源:Authorization.php


注:本文中的UserDB::getAuthUserById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。