public static function jeux($class)
 {
     global $LNG;
     if (file_exists("includes/pages/game/" . ucfirst($class) . ".class.php")) {
         require "includes/pages/game/" . ucfirst($class) . ".class.php";
     } else {
         if (!file_exists($class) && DEBUG_CLASS == false) {
             ShowErrorPage::printError($LNG['page_doesnt_exist']);
         }
     }
 }
Example #2
0
 * @link http://2moons.cc/
 */
define('MODE', 'INGAME');
define('ROOT_PATH', str_replace('\\', '/', dirname(__FILE__)) . '/');
set_include_path(ROOT_PATH);
require 'includes/pages/game/class.AbstractPage.php';
require 'includes/pages/game/class.ShowErrorPage.php';
require 'includes/common.php';
$page = HTTP::_GP('page', 'overview');
$mode = HTTP::_GP('mode', 'show');
$page = str_replace(array('_', '\\', '/', '.', ""), '', $page);
$pageClass = 'Show' . ucwords($page) . 'Page';
if (!file_exists('includes/pages/game/class.' . $pageClass . '.php')) {
    ShowErrorPage::printError($LNG['page_doesnt_exist']);
}
// Added Autoload in feature Versions
require 'includes/pages/game/class.' . $pageClass . '.php';
$pageObj = new $pageClass();
// PHP 5.2 FIX
// can't use $pageObj::$requireModule
$pageProps = get_class_vars(get_class($pageObj));
if (isset($pageProps['requireModule']) && $pageProps['requireModule'] !== 0 && !isModulAvalible($pageProps['requireModule'])) {
    ShowErrorPage::printError($LNG['sys_module_inactive']);
}
if (!is_callable(array($pageObj, $mode))) {
    if (!isset($pageProps['defaultController']) || !is_callable(array($pageObj, $pageProps['defaultController']))) {
        ShowErrorPage::printError($LNG['page_doesnt_exist']);
    }
    $mode = $pageProps['defaultController'];
}
$pageObj->{$mode}();
Example #3
0
     require 'includes/FleetHandler.php';
 }
 $db = Database::get();
 $sql = "SELECT \n\tuser.*,\n\tCOUNT(message.message_id) as messages\n\tFROM %%USERS%% as user\n\tLEFT JOIN %%MESSAGES%% as message ON message.message_owner = user.id AND message.message_unread = :unread\n\tWHERE user.id = :userId\n\tGROUP BY message.message_owner;";
 $USER = $db->selectSingle($sql, array(':unread' => 1, ':userId' => $session->userId));
 if (empty($USER)) {
     HTTP::redirectTo('index.php?code=3');
 }
 $LNG = new Language($USER['lang']);
 $LNG->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
 $THEME->setUserTheme($USER['dpath']);
 if ($config->game_disable == 0 && $USER['authlevel'] == AUTH_USR) {
     ShowErrorPage::printError($LNG['sys_closed_game'] . '<br><br>' . $config->close_reason, false);
 }
 if ($USER['bana'] == 1) {
     ShowErrorPage::printError("<font size=\"6px\">" . $LNG['css_account_banned_message'] . "</font><br><br>" . sprintf($LNG['css_account_banned_expire'], _date($LNG['php_tdformat'], $USER['banaday'], $USER['timezone'])) . "<br><br>" . $LNG['css_goto_homeside'], false);
 }
 if (MODE === 'INGAME') {
     $universeAmount = count(Universe::availableUniverses());
     if (Universe::current() != $USER['universe'] && $universeAmount > 1) {
         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 {
Example #4
0
<?php

/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @copyright (c) Sebastian Tschan
 * @license GNU Affero General Public License
 * @link https://blueimp.net/ajax/
 */
// Include custom libraries and initialization code here
define('MODE', 'CHAT');
define('ROOT_PATH', str_replace('\\', '/', dirname(AJAX_CHAT_PATH)) . '/');
set_include_path(ROOT_PATH);
chdir(ROOT_PATH);
require 'includes/pages/game/AbstractPage.class.php';
require 'includes/pages/game/ShowErrorPage.class.php';
require 'includes/common.php';
$session = Session::load();
if (!$session->isValidSession() || Config::get()->game_disable == 0 && isset($USER['authlevel']) && $USER['authlevel'] == AUTH_USR) {
    HTTP::redirectTo('index.php?code=3');
}
if (!isModulAvalible(MODULE_CHAT)) {
    /** @var $LNG array */
    ShowErrorPage::printError($LNG['sys_module_inactive']);
}
 function admin()
 {
     global $LNG;
     $action = HTTP::_GP('action', 'overview');
     $methodName = 'admin' . ucwords($action);
     if (!is_callable(array($this, $methodName))) {
         ShowErrorPage::printError($LNG['page_doesnt_exist']);
     }
     $this->{$methodName}();
 }