/** * Logs in an user * * @static * * @param callback $redirectCallback * @return mixed Array on success */ function login($redirectCallback = null) { $aConf = $GLOBALS['_MAX']['CONF']; if (!is_callable($redirectCallback)) { // Set the default callback $redirectCallback = array('OA_Auth', 'checkRedirect'); } if (call_user_func($redirectCallback)) { header('location: http://' . $aConf['webpath']['admin']); exit; } if (defined('OA_SKIP_LOGIN')) { return OA_Auth::getFakeSessionData(); } if (OA_Auth::suppliedCredentials()) { $doUser = OA_Auth::authenticateUser(); if (!$doUser) { sleep(3); OA_Auth::restart($GLOBALS['strUsernameOrPasswordWrong']); } return OA_Auth::getSessionData($doUser); } OA_Auth::restart(); }
/** * Check if the user is allowed to see the password recovery tools * */ function checkAccess() { return !OA_Auth::isLoggedIn() && !OA_Auth::suppliedCredentials(); }
/** * Starts or continue existing session * * @param unknown_type $checkRedirectFunc */ function OA_Start($checkRedirectFunc = null) { $conf = $GLOBALS['_MAX']['CONF']; global $session; // XXX: Why not try loading session data when OpenX is not installed? //if ($conf['openads']['installed']) if (OA_INSTALLATION_STATUS == OA_INSTALLATION_STATUS_INSTALLED) { phpAds_SessionDataFetch(); } if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) { // Required files include_once MAX_PATH . '/lib/max/language/Loader.php'; // Load the required language files Language_Loader::load('default'); phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc)); $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin'); foreach ($aPlugins as $i => $id) { if ($obj = OX_Component::factoryByComponentIdentifier($id)) { $obj->afterLogin(); } } } // Overwrite certain preset preferences if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) { $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language']; } // Check if manual account switch has happened and migrate to new global variable if (isset($session['accountSwitch'])) { $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch']; unset($session['accountSwitch']); phpAds_SessionDataStore(); } }
/** * Starts or continue existing session * * @param unknown_type $checkRedirectFunc */ function OA_Start($checkRedirectFunc = null) { $conf = $GLOBALS['_MAX']['CONF']; global $session; // Send no cache headers MAX_header('Pragma: no-cache'); MAX_header('Cache-Control: no-cache, no-store, must-revalidate'); MAX_header('Expires: 0'); if (RV_INSTALLATION_STATUS == RV_INSTALLATION_STATUS_INSTALLED) { phpAds_SessionDataFetch(); } if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) { // Required files include_once MAX_PATH . '/lib/max/language/Loader.php'; // Load the required language files Language_Loader::load('default'); phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc)); $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin'); foreach ($aPlugins as $i => $id) { if ($obj = OX_Component::factoryByComponentIdentifier($id)) { $obj->afterLogin(); } } } // Overwrite certain preset preferences if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) { $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language']; } // Check if manual account switch has happened and migrate to new global variable if (isset($session['accountSwitch'])) { $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch']; unset($session['accountSwitch']); phpAds_SessionDataStore(); } }