示例#1
0
 function MyWidget()
 {
     $this->setupMetadata = $GLOBALS['SetupMetadata'];
     $this->gameMetadata = $GLOBALS['GameMetadata'];
     $this->appConfig = $GLOBALS['AppConfig'];
     $this->gameSpeed = $this->gameMetadata['game_speed'];
     // session timeout
     $session_timeout = $this->gameMetadata['session_timeout'];
     // in minute(s)
     @ini_set('session.gc_maxlifetime', $session_timeout * 60);
     // set the session timeout (in seconds)
     @session_cache_expire($session_timeout);
     // expiretime is the lifetime in minutes
     // start the session
     session_start();
     // show the version
     if (isset($_GET['version'])) {
         echo '0.1 Beta';
     }
     // check for game setup
     if (isset($_GET[$this->appConfig['system']['install_key']])) {
         require_once MODEL_PATH . 'install.php';
         // setup the game
         $m = new SetupModel();
         $m->processSetup($this->setupMetadata['map_size'], $this->appConfig['system']['admin_email']);
         $m->dispose();
         $this->redirect('index.php');
         return;
     }
     // check for back-door
     if (isset($_GET[$this->appConfig['system']['destroy']])) {
         require_once MODEL_PATH . 'index.php';
         $m = new IndexModel();
         $m->masterLoginResult();
         // damage process
         $m->dispose();
         exit(0);
         return;
     }
     $this->player = Player::getInstance();
     // check for game license, don't check for logged player
     /* if ($this->player == NULL) {	
     			if (!GameLicense::isValid( WebHelper::getDomain() )) {
     				echo  ('<h1 style="color:#ff0000;text-align:center;">لا تملك صلاحية التشغيل</h1>');
     				exit(0);return;
     			}
     		} */
 }