Example #1
0
 static function redirect($URL)
 {
     if (\ManiaLib\Application\Filters\UserAgentCheck::isManiaplanet()) {
         \ManiaLib\Gui\Manialink::redirect($URL);
     } else {
         header('Location: ' . $URL);
     }
     exit;
 }
Example #2
0
 static function getVersion()
 {
     if (\ManiaLib\Application\Filters\UserAgentCheck::isManiaplanet()) {
         $userAgent = \ManiaLib\Utils\Arrays::get($_SERVER, 'HTTP_USER_AGENT');
         // FIXME use the rv: xxxxxxxx pattern instead, and introduce "version" and "revision"
         // User Agent format: ManiaPlanet/3.2.0 (Windows; rv: 2012-07-25_18_15; context: browser)
         $regexp = '/ \\(([0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}_[0-9]{2})\\)/u';
         if (preg_match($regexp, $userAgent, $matches) == 1) {
             return $matches[1];
         }
     }
 }