function CheckForFatalMgException($exception) { if ($exception instanceof MgAuthenticationFailedException || $exception instanceof MgConnectionFailedException || $exception instanceof MgConnectionNotOpenException || $exception instanceof MgDuplicateSessionException || $exception instanceof MgLicenseException || $exception instanceof MgLicenseExpiredException || $exception instanceof MgSessionExpiredException) { LogoutWithFatalException(); } }
function LoadSessionVars() { global $webConfigFile; global $adminSession; global $selectedUser; global $selectedGroup; global $selectedRole; global $selectedServer; global $selectedService; global $selectedLog; global $selectedPackage; global $selectedMapping; global $packageLoadErrorMsg; global $packageMakeErrorMsg; global $packageLoadConfirmationMsg; global $packageMakeConfirmationMsg; global $confirmationMsg; global $userInfo; global $clientAgent; global $clientIp; global $site; global $autoRefresh; global $autoRefreshFrequency; global $limitRefresh; global $numRecsToRefresh; global $popups; try { if (!array_key_exists('webConfigFile', $_SESSION)) { // if the user attempts to access a php page without logging in, // webConfigFile does not exist on the first load throw new AuthenticationFailedException("webConfigFile does not exist"); } // Load the current vals of session vars. $webConfigFile = $_SESSION['webConfigFile']; $adminSession = $_SESSION['adminSession']; $selectedUser = $_SESSION['selectedUser']; $selectedGroup = $_SESSION['selectedGroup']; $selectedRole = $_SESSION['selectedRole']; $selectedServer = $_SESSION['selectedServer']; $selectedService = $_SESSION['selectedService']; $selectedLog = $_SESSION['selectedLog']; $selectedPackage = $_SESSION['selectedPackage']; $selectedMapping = $_SESSION['selectedMapping']; $packageLoadErrorMsg = $_SESSION['packageLoadErrorMsg']; $packageMakeErrorMsg = $_SESSION['packageMakeErrorMsg']; $packageLoadConfirmationMsg = $_SESSION['packageLoadConfirmationMsg']; $packageMakeConfirmationMsg = $_SESSION['packageMakeConfirmationMsg']; $confirmationMsg = $_SESSION['confirmationMsg']; $clientAgent = $_SESSION['clientAgent']; $clientIp = $_SESSION['clientIp']; $autoRefresh = $_SESSION['autoRefresh']; $autoRefreshFrequency = $_SESSION['autoRefreshFrequency']; $limitRefresh = $_SESSION['limitRefresh']; $numRecsToRefresh = $_SESSION['numRecsToRefresh']; $popups = $_SESSION['popups']; if (empty($webConfigFile)) { // if the user attempts to access a php page without logging in, // webConfigFile is empty (on all loads after the first one) throw new AuthenticationFailedException("webConfigFile is empty"); } // Initialize web tier with the site configuration file. MgInitializeWebTier($webConfigFile); // Set up user info $userInfo = new MgUserInformation(); $userInfo->SetMgSessionId($adminSession); $userInfo->SetClientAgent($clientAgent); $userInfo->SetClientIp($clientIp); // Create a Site object and open the Site Server. $site = new MgSite(); $site->Open($userInfo); } catch (AuthenticationFailedException $e) { LogoutWithAuthenticationFailedException(); } catch (Exception $e) { LogoutWithFatalException(); } }