コード例 #1
0
ファイル: Login.php プロジェクト: villos/tree_admin
 /**
  * Check administrator login during the upgrade steps
  *
  * @return boolean True if login succeded
  */
 function checkLogin()
 {
     if (empty($_COOKIE['oat']) || $_COOKIE['oat'] != OA_UPGRADE_UPGRADE) {
         return true;
     }
     // Clean up session
     $GLOBALS['session'] = array();
     // Detection needs to happen every time to make sure that database parameters are
     $oUpgrader = new OA_Upgrade();
     $openadsDetected = $oUpgrader->detectOpenads(true) || $oUpgrader->existing_installation_status == OA_STATUS_CURRENT_VERSION;
     // Sequentially check, to avoid useless work
     if (!$openadsDetected) {
         if (!($panDetected = $oUpgrader->detectPAN(true))) {
             if (!($maxDetected = $oUpgrader->detectMAX(true))) {
                 if (!($max01Detected = $oUpgrader->detectMAX01(true))) {
                     // No upgrade-able version detected, return
                     return false;
                 }
             }
         }
     }
     phpAds_SessionStart();
     OA_Upgrade_Login::readSession($panDetected);
     $oPlugin = new Plugins_Authentication();
     if ($oPlugin->suppliedCredentials()) {
         // The new Users, Account, Permissions & Preference feature was introduced in OpenX 2.5.46-dev
         $newLogin = $openadsDetected && version_compare($oUpgrader->versionInitialApplication, '2.5.46-dev', '>=') == -1;
         if ($newLogin) {
             OA_Upgrade_Login::_checkLoginNew();
         } else {
             if ($openadsDetected || $maxDetected) {
                 OA_Upgrade_Login::_checkLoginOld('preference', true);
             } elseif ($max01Detected) {
                 OA_Upgrade_Login::_checkLoginOld('config', true);
             } elseif ($panDetected) {
                 OA_Upgrade_Login::_checkLoginOld('config', false);
             } else {
                 return false;
             }
         }
     }
     return OA_Permission::isAccount(OA_ACCOUNT_ADMIN) || OA_Permission::isUserLinkedToAdmin();
 }