示例#1
0
$payPalDonationButtonId = Constants::$isPayPalTest ? Constants::$payPalTestDonationButtonId : Constants::$payPalProdDonationButtonId;
$payPalPixelImgUrl = Constants::$isPayPalTest ? Constants::$payPalTestPixelImgUrl : Constants::$payPalProdPixelImgUrl;
$customSessionVars = [];
if ($sessionAllowed) {
    $dataAccess = new DataAccess();
    $logger = new Logger($dataAccess);
    $securityHandler = new SecurityHandler();
    $sessionDataAccess = new DataAccess();
    $sessionHandler = new DBSessionHandler($sessionDataAccess);
    session_set_save_handler($sessionHandler, true);
    session_start();
}
if ($sessionRequired || $sessionAllowed && isset($_SESSION['WebUser'])) {
    $justCreatedSession = false;
    // If user not logged in or unauthorized to view this page, redirect to login page
    if ($securityHandler->UserCanAccessThisPage($dataAccess, $logger, $curPageName, Constants::$authFailureRedirectPage)) {
        $objUser = $_SESSION['WebUser'];
        $_SESSION['lastActivity'] = time();
        if (isset($_SESSION['JustCreatedAccount'])) {
            if ($_SESSION['JustCreatedAccount'] == true) {
                $justCreatedSession = true;
                $_SESSION['JustCreatedAccount'] = false;
            }
        }
        // Retrieve any custom session variables requested by the current including page
        if (isset($customSessionVarsToRetrieve)) {
            if (count($customSessionVarsToRetrieve) > 0) {
                foreach ($customSessionVarsToRetrieve as $customSessionVarToRetrieve) {
                    if (isset($_SESSION[$customSessionVarToRetrieve])) {
                        $customSessionVars[$customSessionVarToRetrieve] = $_SESSION[$customSessionVarToRetrieve];
                    }