예제 #1
0
 public static function CatchOperations(&$loaded)
 {
     // Perform log in (if required)
     if (isset($_GET['login']) || preg_match('/\\?login/', $_SERVER['REQUEST_URI'])) {
         // $_SERVER['REQUEST_URI'] check is required for mod_rewrited URL cases.
         header('Location: ' . WoW::GetWoWPath() . '/login/');
         exit;
     }
     // Perform logout (if required)
     if (isset($_GET['logout']) || preg_match('/\\?logout/', $_SERVER['REQUEST_URI'])) {
         // $_SERVER['REQUEST_URI'] check is required for mod_rewrited URL cases.
         WoW_Account::PerformLogout();
         header('Location: ' . WoW::GetWoWPath() . '/');
         exit;
     }
     // Locale
     if (isset($_GET['locale']) && !preg_match('/lookup/', $_SERVER['REQUEST_URI'])) {
         if (WoW_Locale::IsLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']))) {
             WoW_Locale::SetLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']));
             $loaded = true;
             setcookie('wow_locale', WoW_Locale::GetLocale(), strtotime('NEXT YEAR'), '/');
             if (isset($_SERVER['HTTP_REFERER'])) {
                 header('Location: ' . $_SERVER['HTTP_REFERER']);
                 exit;
             } else {
                 header('Location: ' . WoW::GetWoWPath() . '/');
                 exit;
             }
         }
     }
 }