private function showIndexPage()
 {
     // A little overwrite
     $output = $this->objGame->getCustomOutput();
     if ($output) {
         echo $output;
         exit;
     }
     if (!$this->getRidOfSessionID()) {
         return;
     }
     // Check for cache dir
     if (!file_exists(CACHE_DIR) || !is_writable(CACHE_DIR)) {
         if (!mkdir(CACHE_DIR)) {
             echo CACHE_DIR . ' should be writeable';
             exit;
         }
     }
     // Cache for memcache
     if (defined('MEMCACHE_IP') && MEMCACHE_IP && !class_exists('Memcache')) {
         echo 'Memcache php module must be installed.';
         exit;
     }
     $page = new Neuron_Core_Template();
     $page->set('server', $this);
     $page->set('static_client_url', GAMESERVER_ASSET_URL);
     if (defined('IS_TESTSERVER') && IS_TESTSERVER) {
         $page->set('application_version', time());
     } else {
         $page->set('application_version', APP_VERSION);
     }
     // Plugins
     $header = '';
     if (Neuron_Core_Template::hasTemplate('gameserver/index/header.phpt')) {
         $header = $page->parse('gameserver/index/header.phpt');
     }
     $body = '';
     if (Neuron_Core_Template::hasTemplate('gameserver/index/body.phpt')) {
         $body = $page->parse('gameserver/index/body.phpt');
     }
     $jssettings = '';
     if (Neuron_Core_Template::hasTemplate('gameserver/index/jssettings.phpt')) {
         $jssettings = $page->parse('gameserver/index/jssettings.phpt');
     }
     $page->set('header', $header);
     $page->set('body', $body);
     $page->set('jssettings', $jssettings);
     $page->set('dispatch_url', $this->getDispatchURL());
     $size = $this->getMap()->getBackgroundManager()->getTileSize();
     $page->set('map_tile_size', json_encode($size));
     $premium = false;
     // Load start location
     if (!isset($_GET['x']) || !isset($_GET['y'])) {
         $location = $this->getInitialLocation();
         if (isset($location)) {
             $_GET['x'] = $location[0];
             $_GET['y'] = $location[1];
         }
     }
     // IS premium
     $player = Neuron_GameServer::getPlayer();
     if ($player) {
         $page->set('premium', $player->isPremium());
     } else {
         $page->set('premium', false);
     }
     echo $page->parse('gameserver/index.phpt');
 }
예제 #2
0
 protected function getHelpFile($sFile)
 {
     $sFile = substr($sFile, strlen($this->prefix) + 1);
     $page = new Neuron_Core_Template();
     $filename = 'tutorial/' . $sFile . '.phpt';
     if ($page->hasTemplate($filename)) {
         return $page->parse($filename);
     } else {
         return null;
     }
 }