Example #1
0
 public static function login($name, $pass)
 {
     $conexion = new MySQL(0);
     $result = $conexion->start($name);
     $query = "select id_rol,id_pais from usuario where usuario = '{$name}'";
     $result1 = $conexion->consulta($query);
     $row = $conexion->fetch_row($result1);
     $value = $row[0];
     $value2 = $row[1];
     echo $result[0] . " " . $result[1];
     //$result[0] == $name
     if ($result[0] == $pass and $result[1] == 'Activo') {
         //$pass
         $query = "update usuario set logged = 1, date_logged = now(), session_id = '" . $_SESSION['sid'] . "_" . $name . "' where usuario = '{$name}'";
         $result1 = $conexion->consulta($query);
         $conexion->MySQLClose();
         Session::load("login." . $name, $value, $value2);
         //esto lo puedo cambiar(metodo)
         return true;
     } else {
         //Session::destroy();
         $conexion->MySQLClose();
         return false;
     }
 }
Example #2
0
	function theme() {
		$theme = Session::load(APU_SCOPE, "theme");
		if (empty($theme)) {
			$theme = $GLOBALS["CFG_APU"]->THEME;
			Session::save(APU_SCOPE, $theme, "theme");
		}
		return Apu::base().'/themes/'.$theme;
	}
Example #3
0
 public static function setEmulated($universeId)
 {
     if (!self::exists($universeId)) {
         throw new Exception('Unknown universe ID: ' . $universeId);
     }
     $session = Session::load();
     $session->emulatedUniverse = $universeId;
     $session->save();
     self::$emulatedUniverse = $universeId;
     return true;
 }
Example #4
0
	function lang($lang = null) {
		if ($lang == null) {
			$sessionLang = Session::load(MSG_SCOPE, "lang");
			if (empty($sessionLang)) {
				Session::save(MSG_SCOPE, Locale::_defaultBrowserLang(), "lang");
			}
			return Session::load(MSG_SCOPE, "lang");
		} else {
			Session::save(MSG_SCOPE, $lang, "lang");
		}
	}
Example #5
0
	function message($key = "message.defaultMessage", $scope = "global") {
		$retval = "";
		$sessionMsg = Session::load(MSG_SCOPE, $scope);
		if (!empty($sessionMsg)) {
			reset($sessionMsg);
			$retval .= Msg::get("message.extra.warning");
			foreach ($sessionMsg as $message) {
				$retval .= "<div>".$message["string"]."</div>\n";
			}
			
		} else {
			$retval = Msg::get("message.extra.tooltip").Msg::get($key);
		}
		return $retval;
	}
Example #6
0
function http_session()
{
    global $php;
    if (empty($_COOKIE[Session::$sess_name])) {
        $sess_id = uniqid(RandomKey::string(Session::$sess_size - 13));
        $php->response->setcookie(Session::$sess_name, $sess_id, time() + $php->protocol->config['session']['cookie_life']);
    } else {
        $sess_id = trim($_COOKIE[Session::$sess_name]);
    }
    $session_cache = new Cache($php->protocol->config['session']['cache_url']);
    Session::$cache_life = $php->protocol->config['session']['session_life'];
    Session::$cache_prefix = Session::$sess_name;
    $sess = new Session($session_cache);
    $_SESSION = $php->request->session = $sess->load($sess_id);
    $php->session_open = true;
    $php->session = $sess;
}
Example #7
0
 public function create_user($data, $is_admin)
 {
     Session::load();
     Bundle::start('sentry');
     try {
         $user_id = Sentry::user()->create($data);
         if ($user_id) {
             if ($is_admin) {
                 $permissions = array('is_admin' => 1);
                 if (Sentry::user($data['email'])->update_permissions($permissions)) {
                     // all good
                 } else {
                     throw new \Exception('Error updation permission.');
                 }
             }
         } else {
             throw new \Exception('Error creating user.');
         }
     } catch (Sentry\SentryException $e) {
         throw $e;
     }
 }
Example #8
0
| the typical PHP control structures. We'll simply enable it here.
|
*/
Blade::sharpen();
/*
|--------------------------------------------------------------------------
| Set The Default Timezone
|--------------------------------------------------------------------------
|
| We need to set the default timezone for the application. This controls
| the timezone that will be used by any of the date methods and classes
| utilized by Laravel or your application. The timezone may be set in
| your application configuration file.
|
*/
date_default_timezone_set(Config::get('application.timezone'));
/*
|--------------------------------------------------------------------------
| Start / Load The User Session
|--------------------------------------------------------------------------
|
| Sessions allow the web, which is stateless, to simulate state. In other
| words, sessions allow you to store information about the current user
| and state of your application. Here we'll just fire up the session
| if a session driver has been configured.
|
*/
if (!Request::cli() and Config::get('session.driver') !== '') {
    Session::load();
}
include 'helpers.php';
Example #9
0
            HTTP::redirectToUniverse($USER['universe']);
        }
        $session->selectActivePlanet();
        $sql = "SELECT * FROM %%PLANETS%% WHERE id = :planetId;";
        $PLANET = $db->selectSingle($sql, array(':planetId' => $session->planetId));
        if (empty($PLANET)) {
            $sql = "SELECT * FROM %%PLANETS%% WHERE id = :planetId;";
            $PLANET = $db->selectSingle($sql, array(':planetId' => $USER['id_planet']));
            if (empty($PLANET)) {
                throw new Exception("Main Planet does not exist!");
            } else {
                $session->planetId = $USER['id_planet'];
            }
        }
        $USER['factor'] = getFactors($USER);
        $USER['PLANETS'] = getPlanets($USER);
    } elseif (MODE === 'ADMIN') {
        error_reporting(E_ERROR | E_WARNING | E_PARSE);
        $USER['rights'] = unserialize($USER['rights']);
        $LNG->includeData(array('ADMIN', 'CUSTOM'));
    }
} elseif (MODE === 'LOGIN') {
    $LNG = new Language();
    $LNG->getUserAgentLanguage();
    $LNG->includeData(array('L18N', 'INGAME', 'PUBLIC', 'CUSTOM'));
} elseif (MODE === 'CHAT') {
    $session = Session::load();
    if (!$session->isValidSession()) {
        HTTP::redirectTo('index.php?code=3');
    }
}
Example #10
0
 * on for the server environment.
 */
if (magic_quotes()) {
    $magics = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    foreach ($magics as &$magic) {
        $magic = array_strip_slashes($magic);
    }
}
/**
 * Load the session using the session manager. The payload will
 * be registered in the IoC container as an instance so it can
 * be easily access throughout the framework.
 */
if (Config::get('session.driver') !== '') {
    Session::start(Config::get('session.driver'));
    Session::load(Cookie::get(Config::get('session.cookie')));
    IoC::instance('laravel.session', Session::$instance);
}
/**
 * Gather the input to the application based on the global input
 * variables for the current request. The input will be gathered
 * based on the current request method and will be set on the
 * Input manager class' static $input property.
 */
$input = array();
switch (Request::method()) {
    case 'GET':
        $input = $_GET;
        break;
    case 'POST':
        $input = $_POST;
Example #11
0
 protected function getNavigationData()
 {
     global $PLANET, $LNG, $USER, $THEME, $resource, $reslist;
     $config = Config::get();
     $PlanetSelect = array();
     if (isset($USER['PLANETS'])) {
         $USER['PLANETS'] = getPlanets($USER);
     }
     foreach ($USER['PLANETS'] as $PlanetQuery) {
         $PlanetSelect[$PlanetQuery['id']] = $PlanetQuery['name'] . ($PlanetQuery['planet_type'] == 3 ? " (" . $LNG['fcm_moon'] . ")" : "") . " [" . $PlanetQuery['galaxy'] . ":" . $PlanetQuery['system'] . ":" . $PlanetQuery['planet'] . "]";
     }
     $resourceTable = array();
     $resourceSpeed = $config->resource_multiplier;
     foreach ($reslist['resstype'][1] as $resourceID) {
         $resourceTable[$resourceID]['name'] = $resource[$resourceID];
         $resourceTable[$resourceID]['current'] = $PLANET[$resource[$resourceID]];
         $resourceTable[$resourceID]['max'] = $PLANET[$resource[$resourceID] . '_max'];
         if ($USER['urlaubs_modus'] == 1 || $PLANET['planet_type'] != 1) {
             $resourceTable[$resourceID]['production'] = $PLANET[$resource[$resourceID] . '_perhour'];
         } else {
             $resourceTable[$resourceID]['production'] = $PLANET[$resource[$resourceID] . '_perhour'] + $config->{$resource[$resourceID] . '_basic_income'} * $resourceSpeed;
         }
     }
     foreach ($reslist['resstype'][2] as $resourceID) {
         $resourceTable[$resourceID]['name'] = $resource[$resourceID];
         $resourceTable[$resourceID]['used'] = $PLANET[$resource[$resourceID] . '_used'];
         $resourceTable[$resourceID]['max'] = $PLANET[$resource[$resourceID]];
     }
     foreach ($reslist['resstype'][3] as $resourceID) {
         $resourceTable[$resourceID]['name'] = $resource[$resourceID];
         $resourceTable[$resourceID]['current'] = $USER[$resource[$resourceID]];
     }
     $themeSettings = $THEME->getStyleSettings();
     $this->assign(array('PlanetSelect' => $PlanetSelect, 'new_message' => $USER['messages'], 'vacation' => $USER['urlaubs_modus'] ? _date($LNG['php_tdformat'], $USER['urlaubs_until'], $USER['timezone']) : false, 'delete' => $USER['db_deaktjava'] ? sprintf($LNG['tn_delete_mode'], _date($LNG['php_tdformat'], $USER['db_deaktjava'] + $config->del_user_manually * 86400), $USER['timezone']) : false, 'darkmatter' => $USER['darkmatter'], 'current_pid' => $PLANET['id'], 'image' => $PLANET['image'], 'resourceTable' => $resourceTable, 'shortlyNumber' => $themeSettings['TOPNAV_SHORTLY_NUMBER'], 'closed' => !$config->game_disable, 'hasBoard' => filter_var($config->forum_url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED), 'hasAdminAccess' => !empty(Session::load()->adminAccess), 'hasGate' => $PLANET[$resource[43]] > 0));
 }
Example #12
0
        require_once SYS_PATH . 'exception/handler' . EXT;
        require_once SYS_PATH . 'exception/examiner' . EXT;
        require_once SYS_PATH . 'file' . EXT;
        extract($error);
        Exception\Handler::make(new \ErrorException($message, $type, 0, $file, $line))->handle();
    }
});
// --------------------------------------------------------------
// Set the default timezone.
// --------------------------------------------------------------
date_default_timezone_set(Config::get('application.timezone'));
// --------------------------------------------------------------
// Load the session.
// --------------------------------------------------------------
if (Config::get('session.driver') != '') {
    Session::load(Cookie::get('laravel_session'));
}
// --------------------------------------------------------------
// Load all of the core routing classes.
// --------------------------------------------------------------
require SYS_PATH . 'request' . EXT;
require SYS_PATH . 'response' . EXT;
require SYS_PATH . 'routing/route' . EXT;
require SYS_PATH . 'routing/router' . EXT;
require SYS_PATH . 'routing/loader' . EXT;
require SYS_PATH . 'routing/filter' . EXT;
// --------------------------------------------------------------
// Load the packages that are in the auto-loaded packages array.
// --------------------------------------------------------------
if (count(Config::get('application.packages')) > 0) {
    require SYS_PATH . 'package' . EXT;
Example #13
0
	function loginFullName() {
		$user = Session::load(LOGIN_SCOPE, "user");
		$name[] = $user["firstName"];
		$name[] = $user["lastName"]; 
		return implode(' ',$name);
	}
Example #14
0
 function getAllChannels()
 {
     if ($this->_allChannels === NULL) {
         $this->_allChannels = array($this->trimChannelName($this->getConfig('defaultChannelName')) => $this->getConfig('defaultChannelID'));
         $db = Database::get();
         $sql = 'SELECT ally_id FROM %%USERS%% WHERE id = :userId AND id NOT IN (SELECT userid FROM %%ALLIANCE_REQUEST%%);';
         $allianceId = $db->selectSingle($sql, array(':userId' => Session::load()->userId), 'ally_id');
         $sql = 'SELECT id, ally_name FROM %%ALLIANCE%% WHERE id = :allianceId';
         $channels = $db->select($sql, array(':allianceId' => $allianceId));
         $defaultChannelFound = false;
         foreach ($channels as $channel) {
             $channel['id'] = $channel['id'] + 100;
             $this->_allChannels[$this->trimChannelName('+' . $channel['ally_name'])] = $channel['id'];
             if (!$defaultChannelFound && $this->getRequestVar('action') == 'alliance' && $allianceId + 100 == $channel['id']) {
                 $this->setConfig('defaultChannelName', false, $this->trimChannelName('+' . $channel['ally_name']));
                 $this->setConfig('defaultChannelID', false, $channel['id']);
                 $defaultChannelFound = true;
             }
         }
     }
     return $this->_allChannels;
 }
Example #15
0
 function show()
 {
     Session::load()->delete();
     $this->display('page.logout.default.tpl');
 }
 private function sendDefault()
 {
     global $USER, $LNG, $THEME;
     $adminprotection = HTTP::_GP('adminprotection', 0);
     $username = HTTP::_GP('username', $USER['username'], UTF8_SUPPORT);
     $password = HTTP::_GP('password', '');
     $newpassword = HTTP::_GP('newpassword', '');
     $newpassword2 = HTTP::_GP('newpassword2', '');
     $email = HTTP::_GP('email', $USER['email']);
     $timezone = HTTP::_GP('timezone', '');
     $language = HTTP::_GP('language', '');
     $planetSort = HTTP::_GP('planetSort', 0);
     $planetOrder = HTTP::_GP('planetOrder', 0);
     $theme = HTTP::_GP('theme', $THEME->getThemeName());
     $queueMessages = HTTP::_GP('queueMessages', 0);
     $spyMessagesMode = HTTP::_GP('spyMessagesMode', 0);
     $spycount = HTTP::_GP('spycount', 1.0);
     $fleetactions = HTTP::_GP('fleetactions', 5);
     $galaxySpy = HTTP::_GP('galaxySpy', 0);
     $galaxyMessage = HTTP::_GP('galaxyMessage', 0);
     $galaxyBuddyList = HTTP::_GP('galaxyBuddyList', 0);
     $galaxyMissle = HTTP::_GP('galaxyMissle', 0);
     $blockPM = HTTP::_GP('blockPM', 0);
     $vacation = HTTP::_GP('vacation', 0);
     $delete = HTTP::_GP('delete', 0);
     // Vertify
     $adminprotection = $adminprotection == 1 && $USER['authlevel'] != AUTH_USR ? $USER['authlevel'] : 0;
     $spycount = min(max(round($spycount), 1), 4294967295);
     $fleetactions = min(max($fleetactions, 1), 99);
     $language = array_key_exists($language, $LNG->getAllowedLangs(false)) ? $language : $LNG->getLanguage();
     $theme = array_key_exists($theme, Theme::getAvalibleSkins()) ? $theme : $THEME->getThemeName();
     $db = Database::get();
     if (!empty($username) && $USER['username'] != $username) {
         if (PlayerUtil::isNameValid($username)) {
             $this->printMessage($LNG['op_user_name_no_alphanumeric'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
         } elseif ($USER['uctime'] >= TIMESTAMP - USERNAME_CHANGETIME) {
             $this->printMessage($LNG['op_change_name_pro_week'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
         } else {
             $sql = "SELECT\n\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS%% WHERE universe = :universe AND username = :username) +\n\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS_VALID%% WHERE universe = :universe AND username = :username)\n\t\t\t\tAS count";
             $Count = $db->selectSingle($sql, array(':universe' => Universe::current(), ':username' => $username), 'count');
             if (!empty($Count)) {
                 $this->printMessage(sprintf($LNG['op_change_name_exist'], $username), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
             } else {
                 $sql = "UPDATE %%USERS%% SET username = :username, uctime = :timestampt WHERE id = :userID;";
                 $db->update($sql, array(':username' => $username, ':userID' => $USER['id'], ':timestamp' => TIMESTAMP));
                 Session::load()->delete();
             }
         }
     }
     if (!empty($newpassword) && PlayerUtil::cryptPassword($password) == $USER["password"] && $newpassword == $newpassword2) {
         $newpass = PlayerUtil::cryptPassword($newpassword);
         $sql = "UPDATE %%USERS%% SET password = :newpass WHERE id = :userID;";
         $db->update($sql, array(':newpass' => $newpass, ':userID' => $USER['id']));
         Session::load()->delete();
     }
     if (!empty($email) && $email != $USER['email']) {
         if (PlayerUtil::cryptPassword($password) != $USER['password']) {
             $this->printMessage($LNG['op_need_pass_mail'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
         } elseif (!ValidateAddress($email)) {
             $this->printMessage($LNG['op_not_vaild_mail'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
         } else {
             $sql = "SELECT\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS%% WHERE id != :userID AND universe = :universe AND (email = :email OR email_2 = :email)) +\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM %%USERS_VALID%% WHERE universe = :universe AND email = :email)\n\t\t\t\t\t\tas COUNT";
             $Count = $db->selectSingle($sql, array(':universe' => Universe::current(), ':userID' => $USER['id'], ':email' => $email), 'count');
             if (!empty($Count)) {
                 $this->printMessage(sprintf($LNG['op_change_mail_exist'], $email), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
             } else {
                 $sql = "UPDATE %%USERS%% SET email = :email, setmail = :time WHERE id = :userID;";
                 $db->update($sql, array(':email' => $email, ':time' => TIMESTAMP + 604800, ':userID' => $USER['id']));
             }
         }
     }
     if ($vacation == 1) {
         if (!$this->CheckVMode()) {
             $this->printMessage($LNG['op_cant_activate_vacation_mode'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=settings')));
         } else {
             $sql = "UPDATE %%USERS%% SET urlaubs_modus = '1', urlaubs_until = :time WHERE id = :userID";
             $db->update($sql, array(':userID' => $USER['id'], ':time' => TIMESTAMP + Config::get()->vmode_min_time));
             $sql = "UPDATE %%PLANETS%% SET energy_used = '0', energy = '0', metal_mine_porcent = '0', crystal_mine_porcent = '0', deuterium_sintetizer_porcent = '0', solar_plant_porcent = '0', fusion_plant_porcent = '0', solar_satelit_porcent = '0', metal_perhour = '0', crystal_perhour = '0', deuterium_perhour = '0' WHERE id_owner = :userID;";
             $db->update($sql, array(':userID' => $USER['id']));
         }
     }
     if ($delete == 1) {
         $sql = "UPDATE %%USERS%% SET db_deaktjava = :timestamp WHERE id = :userID;";
         $db->update($sql, array(':userID' => $USER['id'], ':timestamp' => TIMESTAMP));
     } else {
         $sql = "UPDATE %%USERS%% SET db_deaktjava = 0 WHERE id = :userID;";
         $db->update($sql, array(':userID' => $USER['id']));
     }
     $sql = "UPDATE %%USERS%% SET\n\t\tdpath\t\t\t\t\t= :theme,\n\t\ttimezone\t\t\t\t= :timezone,\n\t\tplanet_sort\t\t\t\t= :planetSort,\n\t\tplanet_sort_order\t\t= :planetOrder,\n\t\tspio_anz\t\t\t\t= :spyCount,\n\t\tsettings_fleetactions\t= :fleetActions,\n\t\tsettings_esp\t\t\t= :galaxySpy,\n\t\tsettings_wri\t\t\t= :galaxyMessage,\n\t\tsettings_bud\t\t\t= :galaxyBuddyList,\n\t\tsettings_mis\t\t\t= :galaxyMissle,\n\t\tsettings_blockPM\t\t= :blockPM,\n\t\tauthattack\t\t\t\t= :adminProtection,\n\t\tlang\t\t\t\t\t= :language,\n\t\thof\t\t\t\t\t\t= :queueMessages,\n\t\tspyMessagesMode\t\t\t= :spyMessagesMode\n\t\tWHERE id = :userID;";
     $db->update($sql, array(':theme' => $theme, ':timezone' => $timezone, ':planetSort' => $planetSort, ':planetOrder' => $planetOrder, ':spyCount' => $spycount, ':fleetActions' => $fleetactions, ':galaxySpy' => $galaxySpy, ':galaxyMessage' => $galaxyMessage, ':galaxyBuddyList' => $galaxyBuddyList, ':galaxyMissle' => $galaxyMissle, ':blockPM' => $blockPM, ':adminProtection' => $adminprotection, ':language' => $language, ':queueMessages' => $queueMessages, ':spyMessagesMode' => $spyMessagesMode, ':userID' => $USER['id']));
     $this->printMessage($LNG['op_options_changed'], array(array('label' => $LNG['sys_forward'], 'url' => 'game.php?page=settings')));
 }
Example #17
0
$Cache->load('config');
$Cache->load('groups');
$Cache->load('member');
$Cache->load('modules');
$Cache->load('themes');
$Cache->load('langs');
define('DIR', $CONFIG['server_path']);
define('HOST', $CONFIG['server_name']);
define('TPL_PATH_TO_ROOT', !empty($CONFIG['server_path']) ? $CONFIG['server_path'] : '');
$Session = new Session();
if ($CONFIG['ob_gzhandler'] == 1) {
    ob_start('ob_gzhandler');
} else {
    ob_start();
}
$Session->load();
$Session->act();
$Group = new Group($_array_groups_auth);
$User = new User($Session->data, $_array_groups_auth);
if ($Session->session_mod) {
    define('SID', 'sid=' . $User->get_attribute('session_id') . '&amp;suid=' . $User->get_attribute('user_id'));
    define('SID2', 'sid=' . $User->get_attribute('session_id') . '&suid=' . $User->get_attribute('user_id'));
} else {
    define('SID', '');
    define('SID2', '');
}
$user_theme = $User->get_attribute('user_theme');
if ($CONFIG_USER['force_theme'] == 1 || !isset($THEME_CONFIG[$user_theme]['secure']) || !$User->check_level($THEME_CONFIG[$user_theme]['secure'])) {
    $user_theme = $CONFIG['theme'];
}
$User->set_user_theme(find_require_dir(PATH_TO_ROOT . '/templates/', $user_theme));
 function write()
 {
     global $LNG, $USER;
     $this->setWindow('popup');
     $this->initTemplate();
     $db = Database::get();
     $receiverID = HTTP::_GP('id', 0);
     $Subject = HTTP::_GP('subject', $LNG['mg_no_subject'], true);
     $sql = "SELECT a.galaxy, a.system, a.planet, b.username, b.id_planet, b.settings_blockPM\n        FROM %%PLANETS%% as a, %%USERS%% as b WHERE b.id = :receiverId AND a.id = b.id_planet;";
     $receiverRecord = $db->selectSingle($sql, array(':receiverId' => $receiverID));
     if (!$receiverRecord) {
         $this->printMessage($LNG['mg_error']);
     }
     if ($receiverRecord['settings_blockPM'] == 1) {
         $this->printMessage($LNG['mg_receiver_block_pm']);
     }
     Session::load()->messageToken = md5($USER['id'] . '|' . $receiverID);
     $this->assign(array('subject' => $Subject, 'id' => $receiverID, 'OwnerRecord' => $receiverRecord));
     $this->display('page.messages.write.tpl');
 }
Example #19
0
 function __construct($mode)
 {
     $this->data['mode'] = $mode;
     $this->data['admin'] = Session::load()->userId;
     $this->data['uni'] = Universe::getEmulated();
 }
Example #20
0
 protected function getUniqueSessionId()
 {
     $testSession = new Session();
     do {
         $id = \OC_Util::generateRandomBytes(30);
     } while ($testSession->load($id)->hasData());
     return $id;
 }
Example #21
0
	function fetch($key) {
		$value = Session::load(ACTION_SCOPE, get_class($this).".$key");
		Bean::set($this, $key, $value);
		return $value;
	}
Example #22
0
 function __construct()
 {
     //Établir la connexion MySQL (Temps: 0.002 sec)
     try {
         $dbMan = DbManager::getInstance();
         $this->db = $dbMan->newConn('game', DB_HOST, DB_USER, DB_PASS, DB_BASE);
     } catch (Exception $e) {
         die('Impossible d\'établir la connexion: ' . $e->getMessage());
     }
     //Instancier le compte (Temps: 0.0002 sec)
     $this->account = new Account();
     //Démarrer la session (Temps: 0.0161 sec)
     $this->session = Session::load();
     //Si un utilisateur est défini dans la session, charger le compte associé
     $userId = $this->session->getVar('userId');
     if ($userId !== NULL) {
         $this->account->loadAccount($userId, $this->session->getVar('logged'), __FILE__, __LINE__);
     }
     //Démarrer le système de template (Temps: 0.0008 sec)
     $this->tpl = new Template($this->account);
     $this->tpl->set('SKIN_VIRTUAL_PATH', $this->account->getSkinRemoteVirtualPath());
     //Chemin root du skin
     $this->tpl->set('SKIN_ONLINEOFFLINE', $this->account->skinOnlineOffline());
     $this->tpl->set('GAME_SESSION_LENGHT', SESSION_TIMEOUT * 60);
     //Durée en secondes de la session pour le countdown javascript
     $this->tpl->set('GAME_TIME', fctToGameTime(time()));
     //Temps affiché dans le jeu
     $this->tpl->set('GAME_DEVISE', GAME_DEVISE);
     $this->tpl->set('SITE_CHARSET', SITE_CHARSET);
     $this->tpl->set('IS_LOGGED', $userId !== NULL ? true : 0);
     //True si connecté
     //Trouver le # de la révision SVN
     $rev = $this->getSvnRevision('revision.txt');
     if ($rev !== false) {
         $this->tpl->set('SITE_REVISION', $rev);
     }
     //Charger le contenu demandé
     $this->tpl->set('PAGE_SOURCE', $this->generatePage());
     if (!isset($_GET['popup'])) {
         //Générer des données de la zone de gauche
         $this->generateStat();
         $this->generateMenu();
         //Créer la liste des liens sur les sujets récents du forum
         if (DB_FORUM_HOST !== NULL) {
             $arrForumTopic = array();
             $LEFTBAR_FORUM = $this->generateForumLink($arrForumTopic);
             $this->tpl->set('LEFTBAR_FORUM', $LEFTBAR_FORUM);
             $this->tpl->set('FORUM_RECENT_TOPIC', $arrForumTopic);
         }
         $page = $this->account->getSkinRemotePhysicalPath() . 'html/index_full.htm';
     } else {
         $page = $this->account->getSkinRemotePhysicalPath() . 'html/index_lite.htm';
     }
     //Afficher la page
     global $timerTotal, $memStart;
     //Afficher la page.
     $this->tpl->set('QUERY_COUNT', $this->db->getQueryCount());
     $this->tpl->set('SQL_GEN_TIME', $this->db->getQueryTime());
     $this->tpl->set('MEMORY_USAGE', fctFormatBytes(memory_get_peak_usage()));
     $this->tpl->set('PAGE_GEN_TIME', round($timerTotal->finish(), 5));
     echo $this->tpl->fetch($page, __FILE__, __LINE__);
 }