Example #1
1
/**
 *  2Moons
 *  Copyright (C) 2012 Jan Kröpke
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Jan Kröpke <*****@*****.**>
 * @copyright 2012 Jan Kröpke <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.7.3 (2013-05-19)
 * @info $Id: CreateOnePlanetRecord.php 2640 2013-03-23 19:23:26Z slaver7 $
 * @link http://2moons.cc/
 */
function CreateOnePlanetRecord($Galaxy, $System, $Position, $Universe, $PlanetOwnerID, $PlanetName, $HomeWorld = false, $AuthLevel = 0, $Iron, $Gold, $Crystal, $Elyrium, $iPlanetCount)
{
    global $LNG;
    $CONF = Config::getAll(NULL, $Universe);
    if (Config::get('max_galaxy') < $Galaxy || 1 > $Galaxy) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (Config::get('max_system') < $System || 1 > $System) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (Config::get('max_planets') < $Position || 1 > $Position) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (CheckPlanetIfExist($Galaxy, $System, $Position, $Universe)) {
        return false;
    }
    $tp = 0;
    if ($iPlanetCount >= 3) {
        $tp = 1;
    }
    $FieldFactor = Config::get('planet_factor');
    require 'includes/PlanetData.php';
    $Pos = ceil($Position / (Config::get('max_planets') / count($PlanetData)));
    $TMax = $PlanetData[$Pos]['temp'];
    $TMin = $TMax - 40;
    $Fields = $PlanetData[$Pos]['fields'] * Config::get('planet_factor');
    $Types = $PlanetData[$Pos]['image'];
    $Name = !empty($PlanetName) ? $GLOBALS['DATABASE']->sql_escape($PlanetName) : $LNG['type_planet'][1];
    $GLOBALS['DATABASE']->query("INSERT INTO " . PLANETS . " SET\n\t\t\t\tname = '" . $Name . "',\n\t\t\t\tuniverse = " . $Universe . ",\n\t\t\t\tid_owner = " . $PlanetOwnerID . ",\n\t\t\t\tgalaxy = " . $Galaxy . ",\n\t\t\t\tsystem = " . $System . ",\n\t\t\t\tplanet = " . $Position . ",\n\t\t\t\tlast_update = " . TIMESTAMP . ",\n\t\t\t\tplanet_type = '1',\n\t\t\t\tcolo_metal = " . $Iron . ",\n\t\t\t\tcolo_crystal = " . $Gold . ",\n\t\t\t\tcolo_deut = " . $Crystal . ",\n\t\t\t\tcolo_elyrium = " . $Elyrium . ",\n\t\t\t\tteleport_portal = " . $tp . ",\n\t\t\t\timage = '" . $Types . "',\n\t\t\t\tdiameter = " . floor(1000 * sqrt($Fields)) . ",\n\t\t\t\tfield_max = " . ($HomeWorld ? Config::get('initial_fields') : floor($Fields)) . ",\n\t\t\t\ttemp_min = " . $TMin . ",\n\t\t\t\ttemp_max = " . $TMax . ",\n\t\t\t\tmetal = " . Config::get('metal_start') . ",\n\t\t\t\tmetal_perhour = " . Config::get('metal_basic_income') . ",\n\t\t\t\tcrystal = " . Config::get('crystal_start') . ",\n\t\t\t\tcrystal_perhour = " . Config::get('crystal_basic_income') . ",\n\t\t\t\tdeuterium = " . Config::get('deuterium_start') . ",\n\t\t\t\tdeuterium_perhour = " . Config::get('deuterium_basic_income') . ",\n\t\t\t\telyrium = " . Config::get('deuterium_start') . ",\n\t\t\t\telyrium_perhour = " . Config::get('deuterium_basic_income') . ";");
    return $GLOBALS['DATABASE']->GetInsertID();
}
function ShowFleetsConfPage()
{
    global $LNG;
    $CONF = Config::getAll(NULL, 1);
    if (!empty($_POST)) {
        $pay_before = array('fleetconf' => $CONF['fleetconf']);
        $fleetconf = TIMESTAMP + $_POST['days'] * 24 * 60 * 60;
        $pay_after = array('fleetconf' => $fleetconf);
        Config::update($pay_after, 1);
        $CONF = Config::getAll(NULL, 1);
        $LOG = new Log(3);
        $LOG->target = 1;
        $LOG->old = $pay_before;
        $LOG->new = $pay_after;
        $LOG->save();
        require_once 'includes/functions/BBCode.php';
        $Time = TIMESTAMP;
        $Message = '<span class="admin">All promotional fleets and defence have been unlocked until ' . date("d.m.Y - H:i:s", $CONF['fleetconf']) . '. - <a href="?page=shipyard&mode=fleet">Fleet</a> - <a href="?page=shipyard&mode=defence">Defence</a>';
        $From = '<span class="admin">"Antimatter"</span>';
        $pmSubject = '<span class="admin">"Purchase Bonus"</span>';
        $pmMessage = '<span class="admin">' . bbcode($Message) . '</span>';
        $USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '1';");
        while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
            $sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
            SendSimpleMessage($UserData['id'], $USER['id'], TIMESTAMP, 50, $From, $pmSubject, $sendMessage);
        }
    }
    $template = new template();
    $template->assign_vars(array('fleetconf' => $CONF['fleetconf'], 'bonus_next_active' => $CONF['fleetconf'] > TIMESTAMP ? $CONF['fleetconf'] - TIMESTAMP : 0, 'bonus_next_active_timer' => $CONF['fleetconf'] > TIMESTAMP ? date("d.m.Y H:i:s", $CONF['fleetconf']) : 0));
    $template->show('fleetconf.tpl');
}
Example #3
0
function ShowDisclamerPage()
{
    global $LNG, $USER;
    $CONF = Config::getAll(NULL, $_SESSION['adminuni']);
    if (!empty($_POST)) {
        $config_before = array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice']);
        $disclamerAddress = HTTP::_GP('disclamerAddress', '', true);
        $disclamerPhone = HTTP::_GP('disclamerPhone', '', true);
        $disclamerMail = HTTP::_GP('disclamerMail', '', true);
        $disclamerNotice = HTTP::_GP('disclamerNotice', '', true);
        $config_after = array('disclamerAddress' => $disclamerAddress, 'disclamerPhone' => $disclamerPhone, 'disclamerMail' => $disclamerMail, 'disclamerNotice' => $disclamerNotice);
        Config::update($config_after);
        $CONF = Config::getAll(NULL, $_SESSION['adminuni']);
        $LOG = new Log(3);
        $LOG->target = 5;
        $LOG->old = $config_before;
        $LOG->new = $config_after;
        $LOG->save();
    }
    $template = new template();
    $template->loadscript('../base/jquery.autosize-min.js');
    $template->execscript('$(\'textarea\').autosize();');
    $template->assign_vars(array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice'], 'se_server_parameters' => $LNG['mu_disclamer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclamerAddress' => $LNG['se_disclamerAddress'], 'se_disclamerPhone' => $LNG['se_disclamerPhone'], 'se_disclamerMail' => $LNG['se_disclamerMail'], 'se_disclamerNotice' => $LNG['se_disclamerNotice']));
    $template->show('DisclamerConfigBody.tpl');
}
Example #4
0
 function run()
 {
     $CONF = Config::getAll(NULL, ROOT_UNI);
     if ($CONF['birthday_event'] < TIMESTAMP) {
         $totalPremiums = $GLOBALS['DATABASE']->query("SELECT `id`, `lang` FROM " . USERS . " WHERE date_of_birth < " . TIMESTAMP . " AND date_of_birth != '0' AND year = '2015';");
         $langObjects = array();
         while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) {
             if (!isset($langObjects[$xy['lang']])) {
                 $langObjects[$xy['lang']] = new Language($xy['lang']);
                 $langObjects[$xy['lang']]->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
             }
             $LNG = $langObjects[$xy['lang']];
             $message = '<div class="citation">
     <div class="guillemet ouvrir">«</div>
     <div class="guillemet fermer">»</div>
     <ul style="text-align : left;">
     ' . $LNG['ls_eventcron_12'] . '
     </ul>
 </div>';
             SendSimpleMessage($xy['id'], 0, TIMESTAMP, 7, sprintf($LNG['ls_eventcron_10'], $this->getUsernames($xy['id'])), $LNG['ls_eventcron_11'], $message);
             $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET year = '2016' where `id` = '" . $xy['id'] . "';");
         }
         $newevkaka = TIMESTAMP + 5 * 60;
         $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET birthday_event = '" . $newevkaka . "' where `uni` = '" . $UNI . "';");
     }
 }
Example #5
0
 function run()
 {
     $CONF = Config::getAll(NULL, ROOT_UNI);
     $unis = array_keys(Config::getAll(NULL));
     $GLOBALS['DATABASE']->query("LOCK TABLES " . ALLIANCE . " WRITE, " . ALLIANCE_REQUEST . " WRITE,\n\t\t\t\t\t\t\t\t\t" . BUDDY . " WRITE, " . CONFIG . " WRITE, " . FLEETS . " WRITE, " . FLEETS_EVENT . " WRITE, \n\t\t\t\t\t\t\t\t\t" . NOTES . " WRITE, " . MESSAGES . " WRITE, " . PLANETS . " WRITE, \n\t\t\t\t\t\t\t\t\t" . RW . " WRITE, " . SESSION . " WRITE, " . STATPOINTS . " WRITE, \n\t\t\t\t\t\t\t\t\t" . TOPKB . " WRITE, " . TOPKB_USERS . " WRITE, " . USERS . " WRITE;");
     //Delete old messages
     $del_before = TIMESTAMP - $CONF['del_oldstuff'] * 86400;
     $del_inactive = TIMESTAMP - $CONF['del_user_automatic'] * 86400;
     $del_deleted = TIMESTAMP - $CONF['del_user_manually'] * 86400;
     $GLOBALS['DATABASE']->multi_query("DELETE FROM " . MESSAGES . " WHERE `message_time` < '" . $del_before . "';\n\t\t\t\t\t\t  DELETE FROM " . ALLIANCE . " WHERE `ally_members` = '0';\n\t\t\t\t\t\t  DELETE FROM " . PLANETS . " WHERE `destruyed` < " . TIMESTAMP . " AND `destruyed` != 0;\n\t\t\t\t\t\t  DELETE FROM " . SESSION . " WHERE `lastonline` < '" . (TIMESTAMP - SESSION_LIFETIME) . "';\n\t\t\t\t\t\t  DELETE FROM " . FLEETS_EVENT . " WHERE fleetID NOT IN (SELECT fleet_id FROM " . FLEETS . ");\n\t\t\t\t\t\t  UPDATE " . USERS . " SET `email_2` = `email` WHERE `setmail` < '" . TIMESTAMP . "';");
     $ChooseToDelete = $GLOBALS['DATABASE']->query("SELECT `id` FROM `" . USERS . "` WHERE `authlevel` = '" . AUTH_USR . "' AND ((`db_deaktjava` != 0 AND `db_deaktjava` < '" . $del_deleted . "')" . ($del_inactive == TIMESTAMP ? "" : " OR `onlinetime` < '" . $del_inactive . "'") . ");");
     if (isset($ChooseToDelete)) {
         include_once 'includes/functions/DeleteSelectedUser.php';
         while ($delete = $GLOBALS['DATABASE']->fetch_array($ChooseToDelete)) {
             DeleteSelectedUser($delete['id']);
         }
     }
     $GLOBALS['DATABASE']->free_result($ChooseToDelete);
     foreach ($unis as $uni) {
         $battleHallLowest = $GLOBALS['DATABASE']->getFirstCell("SELECT units FROM " . TOPKB . " WHERE `universe` = " . $uni . " ORDER BY units DESC LIMIT 99,1;");
         if (isset($battleHallLowest)) {
             $GLOBALS['DATABASE']->query("DELETE " . TOPKB . ", " . TOPKB_USERS . " FROM " . TOPKB . " INNER JOIN " . TOPKB_USERS . " USING (rid) WHERE `universe` = " . $uni . " AND `units` < " . $battleHallLowest . ";");
         }
     }
     $GLOBALS['DATABASE']->query("DELETE FROM " . RW . " WHERE `time` < " . $del_before . " AND `rid` NOT IN (SELECT `rid` FROM " . TOPKB . ");");
     $GLOBALS['DATABASE']->query("UNLOCK TABLES;");
 }
function ShowChatConfigPage()
{
    global $LNG, $USER;
    $CONF = Config::getAll(NULL, 1);
    if (!empty($_POST)) {
        $config_before = array('chat_closed' => $CONF['chat_closed'], 'chat_allowchan' => $CONF['chat_allowchan'], 'chat_allowmes' => $CONF['chat_allowmes'], 'chat_allowdelmes' => $CONF['chat_allowdelmes'], 'chat_logmessage' => $CONF['chat_logmessage'], 'chat_nickchange' => $CONF['chat_nickchange'], 'chat_botname' => $CONF['chat_botname'], 'chat_channelname' => $CONF['chat_channelname']);
        $chat_allowchan = isset($_POST['chat_allowchan']) && $_POST['chat_allowchan'] == 'on' ? 1 : 0;
        $chat_allowmes = isset($_POST['chat_allowmes']) && $_POST['chat_allowmes'] == 'on' ? 1 : 0;
        $chat_allowdelmes = isset($_POST['chat_allowdelmes']) && $_POST['chat_allowdelmes'] == 'on' ? 1 : 0;
        $chat_logmessage = isset($_POST['chat_logmessage']) && $_POST['chat_logmessage'] == 'on' ? 1 : 0;
        $chat_nickchange = isset($_POST['chat_nickchange']) && $_POST['chat_nickchange'] == 'on' ? 1 : 0;
        $chat_closed = isset($_POST['chat_closed']) && $_POST['chat_closed'] == 'on' ? 1 : 0;
        $chat_channelname = HTTP::_GP('chat_channelname', '', true);
        $chat_botname = HTTP::_GP('chat_botname', '', true);
        $config_after = array('chat_closed' => $chat_closed, 'chat_allowchan' => $chat_allowchan, 'chat_allowmes' => $chat_allowmes, 'chat_allowdelmes' => $chat_allowdelmes, 'chat_logmessage' => $chat_logmessage, 'chat_nickchange' => $chat_nickchange, 'chat_botname' => $chat_botname, 'chat_channelname' => $chat_channelname);
        Config::update($config_after);
        $CONF = Config::getAll(NULL, 1);
        $LOG = new Log(3);
        $LOG->target = 3;
        $LOG->old = $config_before;
        $LOG->new = $config_after;
        $LOG->save();
    }
    $template = new template();
    $template->assign_vars(array('chat_closed' => $CONF['chat_closed'], 'chat_allowchan' => $CONF['chat_allowchan'], 'chat_allowmes' => $CONF['chat_allowmes'], 'chat_logmessage' => $CONF['chat_logmessage'], 'chat_nickchange' => $CONF['chat_nickchange'], 'chat_botname' => $CONF['chat_botname'], 'chat_channelname' => $CONF['chat_channelname'], 'se_server_parameters' => $LNG['se_server_parameters'], 'se_save_parameters' => $LNG['se_save_parameters'], 'ch_closed' => $LNG['ch_closed'], 'ch_allowchan' => $LNG['ch_allowchan'], 'ch_allowmes' => $LNG['ch_allowmes'], 'ch_allowdelmes' => $LNG['ch_allowdelmes'], 'ch_logmessage' => $LNG['ch_logmessage'], 'ch_nickchange' => $LNG['ch_nickchange'], 'ch_botname' => $LNG['ch_botname'], 'ch_channelname' => $LNG['ch_channelname']));
    $template->show('ChatConfigBody.tpl');
}
/**
 *  2Moons
 *  Copyright (C) 2012 Jan Kröpke
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Jan Kröpke <*****@*****.**>
 * @copyright 2012 Jan Kröpke <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.7.3 (2013-05-19)
 * @info $Id: CreateOnePlanetRecord.php 2640 2013-03-23 19:23:26Z slaver7 $
 * @link http://2moons.cc/
 */
function CreateOnePlanetRecord($Galaxy, $System, $Position, $Universe, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false, $AuthLevel = 0)
{
    global $LNG;
    $CONF = Config::getAll(NULL, $Universe);
    if (Config::get('max_galaxy') < $Galaxy || 1 > $Galaxy) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (Config::get('max_system') < $System || 1 > $System) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (Config::get('max_planets') < $Position || 1 > $Position) {
        throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:" . $Galaxy . ":" . $System . ":" . $Position);
    }
    if (CheckPlanetIfExist($Galaxy, $System, $Position, $Universe)) {
        return false;
    }
    $FieldFactor = Config::get('planet_factor');
    require_once 'includes/PlanetDataBis.php';
    // teste
    $PlanetData = array(1 => array('temp' => mt_rand(220, 260), 'fields' => mt_rand(385, 498), 'image' => array('trocken' => mt_rand(1, 10), 'wuesten' => mt_rand(1, 4))), 2 => array('temp' => mt_rand(170, 210), 'fields' => mt_rand(387, 500), 'image' => array('trocken' => mt_rand(1, 10), 'wuesten' => mt_rand(1, 4))), 3 => array('temp' => mt_rand(120, 160), 'fields' => mt_rand(488, 527), 'image' => array('trocken' => mt_rand(1, 10), 'wuesten' => mt_rand(1, 4))), 4 => array('temp' => mt_rand(70, 110), 'fields' => mt_rand(513, 593), 'image' => array('dschjungel' => mt_rand(1, 10))), 5 => array('temp' => mt_rand(60, 100), 'fields' => mt_rand(538, 600), 'image' => array('dschjungel' => mt_rand(1, 10))), 6 => array('temp' => mt_rand(50, 90), 'fields' => mt_rand(538, 616), 'image' => array('dschjungel' => mt_rand(1, 10))), 7 => array('temp' => mt_rand(40, 80), 'fields' => mt_rand(531, 663), 'image' => array('normaltemp' => mt_rand(1, 7))), 8 => array('temp' => mt_rand(30, 70), 'fields' => mt_rand(559, 636), 'image' => array('normaltemp' => mt_rand(1, 7))), 9 => array('temp' => mt_rand(20, 60), 'fields' => mt_rand(551, 628), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))), 10 => array('temp' => mt_rand(10, 50), 'fields' => mt_rand(544, 614), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))), 11 => array('temp' => mt_rand(0, 40), 'fields' => mt_rand(538, 594), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))), 12 => array('temp' => mt_rand(-10, 30), 'fields' => mt_rand(526, 561), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))), 13 => array('temp' => mt_rand(-50, -10), 'fields' => mt_rand(499, 511), 'image' => array('eis' => mt_rand(1, 10))), 14 => array('temp' => mt_rand(-90, -50), 'fields' => mt_rand(471, 483), 'image' => array('eis' => mt_rand(1, 10))), 15 => array('temp' => mt_rand(-130, -90), 'fields' => mt_rand(445, 464), 'image' => array('eis' => mt_rand(1, 10))));
    // fim teste
    $Pos = ceil($Position / (Config::get('max_planets') / count($PlanetData)));
    $TMax = $PlanetData[$Pos]['temp'];
    $TMin = $TMax - 40;
    $Fields = $PlanetData[$Pos]['fields'] * Config::get('planet_factor');
    $Types = array_keys($PlanetData[$Pos]['image']);
    $Type = $Types[array_rand($Types)];
    $Class = $Type . 'planet' . ($PlanetData[$Pos]['image'][$Type] < 10 ? '0' : '') . $PlanetData[$Pos]['image'][$Type];
    $Name = !empty($PlanetName) ? $GLOBALS['DATABASE']->sql_escape($PlanetName) : $LNG['type_planet'][1];
    $GLOBALS['DATABASE']->query("INSERT INTO " . PLANETS . " SET\n\t\t\t\tname = '" . $Name . "',\n\t\t\t\tuniverse = " . $Universe . ",\n\t\t\t\tid_owner = " . $PlanetOwnerID . ",\n\t\t\t\tgalaxy = " . $Galaxy . ",\n\t\t\t\tsystem = " . $System . ",\n\t\t\t\tplanet = " . $Position . ",\n\t\t\t\tlast_update = " . TIMESTAMP . ",\n\t\t\t\tplanet_type = '1',\n\t\t\t\timage = '" . $Class . "',\n\t\t\t\tdiameter = " . floor(1000 * sqrt($Fields)) . ",\n\t\t\t\tfield_max = " . ($HomeWorld ? Config::get('initial_fields') : floor($Fields)) . ",\n\t\t\t\ttemp_min = " . $TMin . ",\n\t\t\t\ttemp_max = " . $TMax . ",\n\t\t\t\tplanet_protection = '0',\n\t\t\t\tmetal = " . Config::get('metal_start') . ",\n\t\t\t\tmetal_perhour = " . Config::get('metal_basic_income') . ",\n\t\t\t\tcrystal = " . Config::get('crystal_start') . ",\n\t\t\t\tcrystal_perhour = " . Config::get('crystal_basic_income') . ",\n\t\t\t\tdeuterium = " . Config::get('deuterium_start') . ",\n\t\t\t\tdeuterium_perhour = " . Config::get('deuterium_basic_income') . ";");
    return $GLOBALS['DATABASE']->GetInsertID();
}
Example #8
0
 /**
  * {@inheritdoc}
  */
 public function getItems()
 {
     $output = [];
     foreach ($this->config->getAll() as $option) {
         foreach ($option['types'] as $type) {
             if ($type['disabled']) {
                 continue;
             }
             /** @var \Magento\Catalog\Api\Data\ProductCustomOptionTypeInterface $optionType */
             $optionType = $this->factory->create();
             $optionType->setLabel(__($type['label']))->setCode($type['name'])->setGroup(__($option['label']));
             $output[] = $optionType;
         }
     }
     return $output;
 }
 function run()
 {
     $CONF = Config::getAll(NULL, ROOT_UNI);
     if ($CONF['asteroid_event'] < TIMESTAMP) {
         $GLOBALS['DATABASE']->query("DELETE FROM " . PLANETS . " where `id_owner` = '" . Asteroid_Id . "' AND `id` != '706' ;");
         $galaxy = 1;
         $system = $this->randRange(1, 500, 50);
         foreach ($system as $System_Element) {
             $planets = rand(1, 10);
             $cautare = $GLOBALS['DATABASE']->query("SELECT *FROM " . PLANETS . " where `galaxy` = '" . $galaxy . "' and `system` = '" . $System_Element . "' and `planet` = '" . $planets . "' AND `universe` = '1';");
             if ($GLOBALS['DATABASE']->numRows($cautare) == 0) {
                 $metal_rand = rand(1, Config::get('asteroid_metal'));
                 $crystal_rand = rand(1, Config::get('asteroid_crystal'));
                 $deuterium_rand = rand(1, Config::get('asteroid_deuterium'));
                 $GLOBALS['DATABASE']->query("INSERT INTO " . PLANETS . "(`name`,`id_owner`,`universe`,`galaxy`,`system`,`planet`,`planet_type`,`image`,`diameter`,`der_metal`,`der_crystal`,`der_deuterium`,`last_update`) \n\t\tVALUES('Asteroid','" . Asteroid_Id . "','1','" . $galaxy . "','" . $System_Element . "','" . $planets . "','1','asteroid','9800','" . $metal_rand . "','" . $crystal_rand . "','" . $deuterium_rand . "','" . TIMESTAMP . "');");
             }
         }
         $totalPremiums = $GLOBALS['DATABASE']->query("SELECT `id`, `lang` FROM " . USERS . ";");
         $langObjects = array();
         while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) {
             if (!isset($langObjects[$xy['lang']])) {
                 $langObjects[$xy['lang']] = new Language($xy['lang']);
                 $langObjects[$xy['lang']]->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
             }
             $LNG = $langObjects[$xy['lang']];
             $message = '<div style="text-align:justify;">' . $LNG['sys_asteroid_3'] . '</div><div class="citation"><div class="guillemet ouvrir"></div><div class="guillemet fermer"></div><ul style="text-align : left;">' . $LNG['sys_asteroid_4'] . '</ul></div><div class="explication_utilisateur">' . $LNG['ls_fts_colo_9'] . '</div>';
             SendSimpleMessage($xy['id'], 0, TIMESTAMP, 7, $LNG['sys_asteroid_1'], $LNG['sys_asteroid_2'], $message);
         }
         $newevkaka = TIMESTAMP + 5 * 60;
         $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET asteroid_event = '" . $newevkaka . "' where `uni` = '1';");
     }
 }
Example #10
0
function ShowTeamspeakPage()
{
    global $LNG, $USER;
    $CONF = Config::getAll(NULL, $_SESSION['adminuni']);
    if ($_POST) {
        $config_before = array('ts_timeout' => $CONF['ts_timeout'], 'ts_modon' => $CONF['ts_modon'], 'ts_server' => $CONF['ts_server'], 'ts_tcpport' => $CONF['ts_tcpport'], 'ts_udpport' => $CONF['ts_udpport'], 'ts_version' => $CONF['ts_version'], 'ts_login' => $CONF['ts_login'], 'ts_password' => $CONF['ts_password'], 'ts_cron_interval' => $CONF['ts_cron_interval']);
        $ts_modon = isset($_POST['ts_on']) && $_POST['ts_on'] == 'on' ? 1 : 0;
        $ts_server = HTTP::_GP('ts_ip', '');
        $ts_tcpport = HTTP::_GP('ts_tcp', 0);
        $ts_udpport = HTTP::_GP('ts_udp', 0);
        $ts_timeout = HTTP::_GP('ts_to', 0);
        $ts_version = HTTP::_GP('ts_v', 0);
        $ts_login = HTTP::_GP('ts_login', '');
        $ts_password = HTTP::_GP('ts_password', '', true);
        $ts_cron_interval = HTTP::_GP('ts_cron', 0);
        $config_after = array('ts_timeout' => $ts_timeout, 'ts_modon' => $ts_modon, 'ts_server' => $ts_server, 'ts_tcpport' => $ts_tcpport, 'ts_udpport' => $ts_udpport, 'ts_version' => $ts_version, 'ts_login' => $ts_login, 'ts_password' => $ts_password, 'ts_cron_interval' => $ts_cron_interval);
        Config::update($config_after);
        $GLOBALS['DATABASE']->query("UPDATE " . CRONJOBS . " SET isActive = " . $ts_modon . ", `lock` = NULL, nextTime = 0 WHERE name = 'teamspeak';");
        $CONF = Config::getAll(NULL, $_SESSION['adminuni']);
        $LOG = new Log(3);
        $LOG->target = 4;
        $LOG->old = $config_before;
        $LOG->new = $config_after;
        $LOG->save();
    }
    $template = new template();
    $template->assign_vars(array('se_save_parameters' => $LNG['se_save_parameters'], 'ts_tcpport' => $LNG['ts_tcpport'], 'ts_serverip' => $LNG['ts_serverip'], 'ts_version' => $LNG['ts_version'], 'ts_active' => $LNG['ts_active'], 'ts_settings' => $LNG['ts_settings'], 'ts_udpport' => $LNG['ts_udpport'], 'ts_timeout' => $LNG['ts_timeout'], 'ts_server_query' => $LNG['ts_server_query'], 'ts_sq_login' => $LNG['ts_login'], 'ts_sq_pass' => $LNG['ts_pass'], 'ts_lng_cron' => $LNG['ts_cron'], 'ts_to' => $CONF['ts_timeout'], 'ts_on' => $CONF['ts_modon'], 'ts_ip' => $CONF['ts_server'], 'ts_tcp' => $CONF['ts_tcpport'], 'ts_udp' => $CONF['ts_udpport'], 'ts_v' => $CONF['ts_version'], 'ts_login' => $CONF['ts_login'], 'ts_password' => $CONF['ts_password'], 'ts_cron' => $CONF['ts_cron_interval']));
    $template->show('TeamspeakPage.tpl');
}
Example #11
0
function ShowPaybonusPage()
{
    global $LNG;
    $CONF = Config::getAll(NULL, 1);
    if (!empty($_POST)) {
        $pay_before = array('bonus_button' => $CONF['bonus_button'], 'academy_bonus' => $CONF['academy_bonus'], 'premium' => $CONF['premium'], 'stardust_bonus' => $CONF['stardust_bonus'], 'purchase_bonus' => $CONF['purchase_bonus'], 'purchase_bonus_timer' => $CONF['purchase_bonus_timer'], 'cosmonaute' => $CONF['cosmonaute'], 'fleetconf' => $CONF['fleetconf'], 'new_year' => $CONF['new_year']);
        $purchase_bonus = $_POST['percent'];
        $academy_bonus = $_POST['academy_bonus'];
        $bonus_button = $_POST['bonus_button'];
        $premium = $_POST['premium'];
        $stardust_bonus = $_POST['stardust_bonus'];
        $stardust_bonus = $_POST['stardust_bonus'];
        $fleetconf = isset($_POST['fleetconf']) && $_POST['fleetconf'] == 'on' ? 1 : 0;
        $cosmonaute = isset($_POST['cosmonaute']) && $_POST['cosmonaute'] == 'on' ? 1 : 0;
        $new_year = isset($_POST['new_year']) && $_POST['new_year'] == 'on' ? 1 : 0;
        $purchase_bonus_timer = TIMESTAMP + $_POST['days'] * 24 * 60 * 60;
        $pay_after = array('bonus_button' => $bonus_button, 'academy_bonus' => $academy_bonus, 'premium' => $premium, 'stardust_bonus' => $stardust_bonus, 'purchase_bonus' => $purchase_bonus, 'purchase_bonus_timer' => $purchase_bonus_timer, 'fleetconf' => $fleetconf, 'cosmonaute' => $cosmonaute, 'new_year' => $new_year);
        Config::update($pay_after, 1);
        $CONF = Config::getAll(NULL, 1);
        $LOG = new Log(3);
        $LOG->target = 1;
        $LOG->old = $pay_before;
        $LOG->new = $pay_after;
        $LOG->save();
    }
    $template = new template();
    $template->assign_vars(array('academy_bonus' => $CONF['academy_bonus'], 'cosmonaute' => $CONF['cosmonaute'], 'new_year' => $CONF['new_year'], 'bonus_button' => $CONF['bonus_button'], 'fleetconf' => $CONF['fleetconf'], 'premium' => $CONF['premium'], 'stardust_bonus' => $CONF['stardust_bonus'], 'purchase_bonus' => $CONF['purchase_bonus'], 'purchase_bonus_timer' => $CONF['purchase_bonus_timer'], 'bonus_next_active' => $CONF['purchase_bonus_timer'] > TIMESTAMP ? $CONF['purchase_bonus_timer'] - TIMESTAMP : 0, 'bonus_next_active_timer' => $CONF['purchase_bonus_timer'] > TIMESTAMP ? date("d.m.Y H:i:s", $CONF['purchase_bonus_timer']) : 0));
    $template->show('paybonus.tpl');
}
 public function onChat(PlayerChatEvent $event)
 {
     $this->plugin->event = $event;
     $extensions = $this->getAllExtensions();
     foreach ($extensions as $get) {
         if ($this->plugin->getServer()->getPluginManager()->getPlugin($get) && method_exists($this->plugin->getServer()->getPluginManager()->getPlugin($get), "onRegisterPrefix")) {
             $this->plugin->getServer()->getPluginManager()->getPlugin($get)->onRegisterPrefix();
         }
     }
     // ===========
     //	Format
     // ===========
     $this->plugin->replaceTag("{WORLD}", $event->getPlayer()->getLevel()->getName());
     //Level Tag
     $this->plugin->replaceTag("{PLAYER}", $event->getPlayer()->getName());
     //Player Tag
     $this->plugin->replaceTag("{PREFIX}", $this->plugin->getConfig()->get("prefix"));
     //Prefix Tag
     $this->plugin->replaceTag("{SUFFIX}", $this->plugin->getConfig()->get("suffix"));
     //Suffix Tag
     $this->plugin->replaceTag("{MESSAGE}", $event->getMessage());
     //Message Tag
     //Custom tags
     $tags = new Config($this->plugin->getDataFolder() . "tags.yml", Config::YAML);
     foreach ($tags->getAll() as $tag => $value) {
         $this->plugin->replaceTag("{" . strtoupper($tag) . "}", $value);
     }
     $event->setFormat($this->getFormattedMessage($this->plugin->getConfig()->get("chat-format")));
     // ===========
     //	Player Mute
     // ===========
     $mhut = $event->getRecipients();
     for ($lol = 0; $i < count($mhut); $lol++) {
         if (isset($this->leave[$mhut[$lol]->getName()])) {
             unset($mhut[$lol]);
         }
     }
     $event->setRecipients($mhut);
     $allowChat = $this->plugin->getConfig()->get("disablechat");
     if ($allowChat) {
         $event->setCancelled(true);
         return;
     }
     if (!$allowChat || $allowChat == null) {
         $player = $event->getPlayer();
         $perm = "chatmute";
         if ($player->isPermissionSet($perm)) {
             $event->setCancelled(true);
             return;
         }
         $format = $this->getFormattedMessage($player, $event->getMessage());
         $config_node = $this->plugin->getConfig()->get("enable-formatter");
         if (isset($config_node) and $config_node === true) {
             $event->setFormat($format);
         }
         return;
     }
 }
 function show()
 {
     global $LNG;
     $referralID = HTTP::_GP('ref', 0);
     if (!empty($referralID)) {
         $this->redirectTo('promo.php?referralID=' . $referralID);
     }
     $universeSelect = array();
     $uniAllConfig = Config::getAll('universe');
     foreach ($uniAllConfig as $uniID => $uniConfig) {
         $universeSelect[$uniID] = $uniConfig['uni_name'] . ($uniConfig['game_disable'] == 0 ? t('uni_closed') : '');
     }
     $Code = HTTP::_GP('code', 0);
     $loginCode = false;
     if (isset($LNG['login_error_' . $Code])) {
         $loginCode = $LNG['login_error_' . $Code];
     }
     $referralUniversum = 0;
     $referralUserID = 0;
     if (Config::get('ref_active')) {
         $referralUserID = HTTP::_GP('ref', 0);
         if (!empty($referralUserID)) {
             $referralUniversum = $GLOBALS['DATABASE']->getFirstRow("SELECT universe FROM " . USERS . " WHERE id = " . $referralUserID . ";");
             if (!isset($referralUniversum)) {
                 $referralUniversum = 0;
                 $referralUserID = 0;
             }
         }
     }
     $newsResult = $GLOBALS['DATABASE']->query("SELECT id, date, title, text, user, catID FROM " . NEWS . " ORDER BY id DESC;");
     $newsList = array();
     while ($newsRow = $GLOBALS['DATABASE']->fetchArray($newsResult)) {
         $newsList[] = array('id' => $newsRow['id'], 'title' => $newsRow['title'], 'from' => t('news_from', _date(t('php_tdformat'), $newsRow['date']), $newsRow['user']), 'text' => substr($newsRow['text'], 0, 160) . "...", 'date' => _date($LNG['php_tdformat'], $newsRow['date'], $newsRow['user']), 'image' => 'images/' . $newsRow['catID'] . '.jpg');
     }
     $topicsResult = $GLOBALS['DATABASE']->query("SELECT tid, title, last_post, topic_firstpost, title_seo FROM forum_topics WHERE tdelete_time = '0' ORDER BY last_post DESC LIMIT 5;");
     $topicsList = array();
     while ($topicsRow = $GLOBALS['DATABASE']->fetchArray($topicsResult)) {
         $topicsList[] = array('id' => $topicsRow['tid'], 'title' => $topicsRow['title'], 'topic_firstpost' => $topicsRow['topic_firstpost'], 'title_seo' => $topicsRow['title_seo'], 'date' => _date($LNG['php_tdformat'], $topicsRow['last_post'], 1));
     }
     $uniResult = $GLOBALS['DATABASE']->query("SELECT users_amount, COUNT(DISTINCT inac.id) as inactive, COUNT(planet.id) as planet\n\tFROM " . CONFIG . " conf\n\tLEFT JOIN " . USERS . " as inac ON uni = inac.universe AND inac.onlinetime < " . (TIMESTAMP - INACTIVE) . "\n\tLEFT JOIN " . PLANETS . " as planet ON uni = planet.universe\n\tGROUP BY conf.uni, inac.universe, planet.universe\n\tORDER BY uni ASC;");
     while ($uniRow = $GLOBALS['DATABASE']->fetch_array($uniResult)) {
         $users_amount = $uniRow['users_amount'];
         $active = $uniRow['users_amount'] - $uniRow['inactive'];
     }
     $uniInfo = $GLOBALS['DATABASE']->query("SELECT users_amount, COUNT(DISTINCT inac.id) as inactive, COUNT(planet.id) as planet\n\tFROM " . CONFIG . " conf\n\tLEFT JOIN " . USERS . " as inac ON uni = inac.universe AND inac.register_time > " . (TIMESTAMP - 30 * 24 * 60 * 60) . "\n\tLEFT JOIN " . PLANETS . " as planet ON uni = planet.universe\n\tGROUP BY conf.uni, inac.universe, planet.universe\n\tORDER BY uni ASC;");
     while ($uniRaw = $GLOBALS['DATABASE']->fetch_array($uniInfo)) {
         $users_amount = $uniRaw['users_amount'];
         $new_member = $uniRaw['inactive'];
     }
     $uniHof = $GLOBALS['DATABASE']->query("SELECT COUNT(rid) as inactive\n\tFROM " . TOPKB . " WHERE time > " . (TIMESTAMP - 24 * 60 * 60) . "\n\tORDER BY units DESC LIMIT 100;");
     while ($uniHaf = $GLOBALS['DATABASE']->fetch_array($uniHof)) {
         $total_hof = $uniHaf['inactive'];
     }
     $this->assign(array('referralUserID' => $referralUserID, 'referralUniversum' => $referralUniversum, 'universeSelect' => $universeSelect, 'topicsList' => $topicsList, 'code' => $loginCode, 'descHeader' => t('loginWelcome', Config::get('game_name')), 'descText' => t('loginServerDesc', Config::get('game_name')), 'newsList' => $newsList, 'users_amount' => $users_amount, 'active' => $active, 'new_member' => $new_member, 'total_hof' => $total_hof, 'loginInfo' => t('loginInfo', '<a href="index.php?page=rules">' . t('menu_rules') . '</a>')));
     $this->render('page.index.default.tpl');
 }
 function show()
 {
     $universeSelect = array();
     $uniAllConfig = Config::getAll('universe');
     foreach ($uniAllConfig as $uniID => $uniConfig) {
         $universeSelect[$uniID] = $uniConfig['uni_name'];
     }
     $this->assign(array('universeSelect' => $universeSelect));
     $this->render('page.lostPassword.default.tpl');
 }
Example #15
0
 /**
  * @return void
  */
 protected function initializeConfig()
 {
     Config::importFile('init.php');
     $path = ConfigFileFullPathBuilder::build('env.php');
     if (file_exists($path)) {
         Config::importFile($path);
     }
     foreach (Config::getAll('php') as $key => $value) {
         ini_set($key, $value);
     }
 }
Example #16
0
 protected function getPageData()
 {
     global $USER, $CONF, $LNG, $UNI;
     $dateTimeServer = new DateTime("now");
     $dateTimeUser = $dateTimeServer;
     $universeSelect = array();
     $uniAllConfig = Config::getAll('universe');
     foreach ($uniAllConfig as $uniID => $uniConfig) {
         $universeSelect[$uniID] = $uniConfig['uni_name'] . ($uniConfig['game_disable'] == 0 ? t('uni_closed') : '');
     }
     $this->tplObj->assign_vars(array('recaptchaEnable' => Config::get('capaktiv'), 'recaptchaPublicKey' => Config::get('cappublic'), 'gameName' => Config::get('game_name'), 'facebookEnable' => Config::get('fb_on'), 'fb_key' => Config::get('fb_apikey'), 'mailEnable' => Config::get('mail_active'), 'reg_close' => Config::get('reg_closed'), 'referralEnable' => Config::get('ref_active'), 'analyticsEnable' => Config::get('ga_active'), 'analyticsUID' => Config::get('ga_key'), 'lang' => $LNG->getLanguage(), 'UNI' => $UNI, 'VERSION' => Config::get('VERSION'), 'REV' => substr(Config::get('VERSION'), -4), 'languages' => Language::getAllowedLangs(false), 'universeSelect' => $universeSelect, 'copyright' => t($LNG['footer_copy'], Config::get('game_name'))));
 }
Example #17
0
 public static function showPage($template_name, $args = array())
 {
     extract(Config::getAll());
     extract($args);
     if (!($template_full_name = self::templateExists($template_name))) {
         $message = _(sprintf('Template "%s" not found', $template_name));
         $template_full_name = self::templateExists('internal_error');
     }
     include $template_full_name;
     $action = array_pop(self::$process);
     is_array($action) and array_key_exists('template', $action) and self::showPage($action['template'], self::$block);
 }
    function run()
    {
        $CONF = Config::getAll(NULL, ROOT_UNI);
        if ($CONF['globaleventsocial'] < TIMESTAMP) {
            $getEvent = rand(1, 2);
            $langObjects = array();
            switch ($getEvent) {
                case '1':
                    $query = $GLOBALS['DATABASE']->query("SELECT id, lang FROM uni1_users;");
                    while ($x = $GLOBALS['DATABASE']->fetch_array($query)) {
                        if (!isset($langObjects[$x['lang']])) {
                            $langObjects[$x['lang']] = new Language($x['lang']);
                            $langObjects[$x['lang']]->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
                        }
                        $LNG = $langObjects[$x['lang']];
                        $message = '<div class="citation">
        <div class="guillemet ouvrir">«</div>
        <div class="guillemet fermer">»</div>
        <ul style="text-align : left;">
        ' . $LNG['ls_eventcron_1'] . '
        </ul>
    </div>';
                        SendSimpleMessage($x['id'], 0, TIMESTAMP, 7, $LNG['ls_eventcron_2'], $LNG['sys_asteroid_2'], $message);
                    }
                    break;
                case '2':
                    $query = $GLOBALS['DATABASE']->query("SELECT id, lang FROM uni1_users;");
                    while ($x = $GLOBALS['DATABASE']->fetch_array($query)) {
                        if (!isset($langObjects[$x['lang']])) {
                            $langObjects[$x['lang']] = new Language($x['lang']);
                            $langObjects[$x['lang']]->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
                        }
                        $LNG = $langObjects[$x['lang']];
                        $message = '<div class="citation">
        <div class="guillemet ouvrir">«</div>
        <div class="guillemet fermer">»</div>
        <ul style="text-align : left;">
        ' . $LNG['ls_eventcron_7'] . '
        </ul>
    </div>
	<div class="explication_utilisateur">
        ' . $LNG['ls_eventcron_8'] . '
            </div>
	';
                        SendSimpleMessage($x['id'], 0, TIMESTAMP, 7, $LNG['ls_eventcron_9'], $LNG['sys_asteroid_2'], $message);
                    }
                    break;
            }
            $newevkaka = TIMESTAMP + 5 * 60;
            $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET globaleventsocial = '" . $newevkaka . "' where `uni` = '1';");
        }
    }
Example #19
0
function ShowFacebookPage()
{
    global $LNG;
    if ($_POST) {
        $fb_on = isset($_POST['fb_on']) && $_POST['fb_on'] == 'on' && !empty($_POST['fb_skey']) && !empty($_POST['fb_apikey']) ? 1 : 0;
        $fb_apikey = HTTP::_GP('fb_apikey', '');
        $fb_skey = HTTP::_GP('fb_skey', '');
        Config::update(array('fb_on' => $fb_on, 'fb_apikey' => $fb_apikey, 'fb_skey' => $fb_skey));
    }
    $CONF = Config::getAll(NULL, $_SESSION['adminuni']);
    $template = new template();
    $template->assign_vars(array('se_save_parameters' => $LNG['se_save_parameters'], 'fb_info' => $LNG['fb_info'], 'fb_secrectkey' => $LNG['fb_secrectkey'], 'fb_api_key' => $LNG['fb_api_key'], 'fb_active' => $LNG['fb_active'], 'fb_settings' => $LNG['fb_settings'], 'fb_on' => $CONF['fb_on'], 'fb_apikey' => $CONF['fb_apikey'], 'fb_skey' => $CONF['fb_skey'], 'fb_curl' => function_exists('curl_init') ? 1 : 0, 'fb_curl_info' => function_exists('curl_init') ? $LNG['fb_curl_yes'] : $LNG['fb_curl_no']));
    $template->show('FacebookPage.tpl');
}
 public function tickHandler($data, $event)
 {
     $data = array();
     $data['time'] = date("Y-m-d H:i:s");
     $data['online'] = "Online: " . count($this->api->player->getAll());
     $info = $this->server->debugInfo();
     $data['tps'] = $info["tps"];
     $data['mem'] = $info["memory_usage"];
     $data['peakmem'] = $info["memory_peak_usage"];
     $data['entities'] = $info["entities"];
     $data['players'] = $info["players"];
     $data['events'] = $info["events"];
     $data['handlers'] = $info["handlers"];
     $data['actions'] = $info["actions"];
     $data['garbage'] = $info["garbage"];
     $misc = $this->mysqli->real_escape_string(json_encode($data));
     $playersA = array();
     $clients = $this->api->player->getAll();
     foreach ($clients as $c) {
         if ($c->username === "") {
             continue;
         }
         if ($c instanceof Player) {
             $playersA[] = array('name' => $c->username, 'x' => $c->entity->x, 'y' => $c->entity->y, 'z' => $c->entity->z, 'level' => $c->level->getName());
         }
     }
     $online = $this->mysqli->real_escape_string(json_encode($playersA));
     $ops = new Config(DATA_PATH . "ops.txt", CONFIG_LIST);
     //Open list of OPs
     $data['ops'][] = $ops->getAll(true);
     $ops = $this->mysqli->real_escape_string(json_encode($data['ops']));
     $banned = new Config(DATA_PATH . "banned.txt", CONFIG_LIST);
     //Open Banned Usernames list file
     $data['banned'][] = $banned->getAll(true);
     $banned = $this->mysqli->real_escape_string(json_encode($data['banned']));
     $bannedIPs = new Config(DATA_PATH . "banned-ips.txt", CONFIG_LIST);
     //Open Banned IPs list file
     $data['bannedIPs'][] = $bannedIPs->getAll(true);
     $bannedips = $this->mysqli->real_escape_string(json_encode($data['bannedIPs']));
     $misc_q = "UPDATE misc SET ops='{$ops}', banned='{$banned}', bannedips='{$bannedips}', misc='{$misc}', online='{$online}' WHERE id=1;";
     preg_match_all('!\\d+\\.*\\d*!', $info['tps'], $matches);
     $tps = $matches[0][0];
     $time = date('Y-m-d H:i:s');
     $query = "INSERT INTO main (tps,online,timestamp) VALUES ('{$tps}','{$info["players"]}','{$time}');" . $misc_q;
     foreach ($playersA as $key => $player) {
         $query .= "INSERT INTO online (user,cnt,level,x,y,z,timestamp) VALUES ('{$player['name']}',0,'{$player['level']}','{$player['x']}','{$player['y']}','{$player['z']}','{$time}') ON DUPLICATE KEY UPDATE cnt = cnt+1,level='{$player['level']}',x='{$player['x']}',y='{$player['y']}',z='{$player['z']}',timestamp='{$time}';";
     }
     $data = array('query' => $query);
     $this->api->handle("db.query.exec", $data);
 }
Example #21
0
 function run()
 {
     global $LNG;
     $CONF = Config::getAll(NULL, ROOT_UNI);
     $GLOBALS['DATABASE']->query("UPDATE `uni1_transport_player` SET `legal` = 0 WHERE `delete` > 0 ;");
     $query = $GLOBALS['DATABASE']->query("SELECT `senderID`, `receiverID` FROM `uni1_transport_player` WHERE `time` < " . (TIMESTAMP - 72 * 3600) . " AND `delete` = 0 AND `legal` = 1;");
     while ($x = $GLOBALS['DATABASE']->fetch_array($query)) {
         $xD = $GLOBALS['DATABASE']->query("SELECT * FROM uni1_banned WHERE longer > " . TIMESTAMP . " AND who = '" . $this->getUsernames($x['senderID']) . "';");
         $xDs = $GLOBALS['DATABASE']->query("SELECT * FROM uni1_banned WHERE longer > " . TIMESTAMP . " AND who = '" . $this->getUsernames($x['receiverID']) . "';");
         if ($GLOBALS['DATABASE']->numRows($xD) == 0) {
             $SQL = "INSERT INTO uni1_banned SET ";
             $SQL .= "`who` = '" . $this->getUsernames($x['senderID']) . "', ";
             $SQL .= "`theme` = '2.2. The rate of trade / Push', ";
             $SQL .= "`time` = '" . TIMESTAMP . "', ";
             $SQL .= "`longer` = '" . (TIMESTAMP + 72 * 3600) . "', ";
             $SQL .= "`author` = 'Antaris-Bot', ";
             $SQL .= "`universe` = '1', ";
             $SQL .= "`email` = '(EMAIL)';";
             $SQ = "UPDATE uni1_users SET ";
             $SQ .= "`bana` = '1', ";
             $SQ .= "`banaday` = '" . (TIMESTAMP + 72 * 3600) . "', ";
             $SQ .= "`urlaubs_modus` = '1'";
             $SQ .= "WHERE ";
             $SQ .= "`id` = '" . $x['senderID'] . "';";
             $GLOBALS['DATABASE']->query($SQL);
             $GLOBALS['DATABASE']->query($SQ);
             SendSimpleMessage(1, 0, TIMESTAMP, 7, 'Overide Push rule [' . $this->getUsernames($x['senderID']) . '-' . $this->getUsernames($x['receiverID']) . ']', 'Automatic sentence', $message);
         }
         if ($GLOBALS['DATABASE']->numRows($xDs) == 0) {
             $SQL = "INSERT INTO uni1_banned SET ";
             $SQL .= "`who` = '" . $this->getUsernames($x['receiverID']) . "', ";
             $SQL .= "`theme` = '2.2. The rate of trade / Push', ";
             $SQL .= "`time` = '" . TIMESTAMP . "', ";
             $SQL .= "`longer` = '" . (TIMESTAMP + 72 * 3600) . "', ";
             $SQL .= "`author` = 'Antaris-Bot', ";
             $SQL .= "`universe` = '1', ";
             $SQL .= "`email` = '(EMAIL)';";
             $SQ = "UPDATE uni1_users SET ";
             $SQ .= "`bana` = '1', ";
             $SQ .= "`banaday` = '" . (TIMESTAMP + 72 * 3600) . "', ";
             $SQ .= "`urlaubs_modus` = '1'";
             $SQ .= "WHERE ";
             $SQ .= "`id` = '" . $x['receiverID'] . "';";
             $GLOBALS['DATABASE']->query($SQL);
             $GLOBALS['DATABASE']->query($SQ);
         }
     }
 }
 function show()
 {
     $hallRaw = $GLOBALS['DATABASE']->query("SELECT *, (\n\t\t\tSELECT DISTINCT\n\t\t\tIF(" . TOPKB_USERS . ".username = '', GROUP_CONCAT(" . USERS . ".username SEPARATOR ' & '), GROUP_CONCAT(" . TOPKB_USERS . ".username SEPARATOR ' & '))\n\t\t\tFROM " . TOPKB_USERS . "\n\t\t\tLEFT JOIN " . USERS . " ON uid = " . USERS . ".id\n\t\t\tWHERE " . TOPKB_USERS . ".`rid` = " . TOPKB . ".`rid` AND `role` = 1\n\t\t) as `attacker`,\n\t\t(\n\t\t\tSELECT DISTINCT\n\t\t\tIF(" . TOPKB_USERS . ".username = '', GROUP_CONCAT(" . USERS . ".username SEPARATOR ' & '), GROUP_CONCAT(" . TOPKB_USERS . ".username SEPARATOR ' & '))\n\t\t\tFROM " . TOPKB_USERS . " INNER JOIN " . USERS . " ON uid = id\n\t\t\tWHERE " . TOPKB_USERS . ".`rid` = " . TOPKB . ".`rid` AND `role` = 2\n\t\t) as `defender`  \n\t\tFROM " . TOPKB . " WHERE `universe` = '" . $GLOBALS['UNI'] . "' ORDER BY units DESC LIMIT 100;");
     $hallList = array();
     while ($hallRow = $GLOBALS['DATABASE']->fetch_array($hallRaw)) {
         $hallList[] = array('result' => $hallRow['result'], 'time' => _date(t('php_tdformat'), $hallRow['time']), 'units' => $hallRow['units'], 'rid' => $hallRow['rid'], 'attacker' => $hallRow['attacker'], 'defender' => $hallRow['defender']);
     }
     $GLOBALS['DATABASE']->free_result($hallRaw);
     $universeSelect = array();
     $uniAllConfig = Config::getAll('universe');
     foreach ($uniAllConfig as $uniID => $uniConfig) {
         $universeSelect[$uniID] = $uniConfig['uni_name'];
     }
     $this->assign(array('universeSelect' => $universeSelect, 'hallList' => $hallList));
     $this->render('page.battleHall.default.tpl');
 }
function getUniverse()
{
    $gameConfig = Config::getAll(NULL);
    if (MODE == 'ADMIN' && isset($_SESSION['adminuni'])) {
        $UNI = (int) $_SESSION['adminuni'];
    } elseif (MODE == 'LOGIN') {
        if (isset($_COOKIE['uni'])) {
            $UNI = (int) $_COOKIE['uni'];
        }
        if (isset($_REQUEST['uni'])) {
            $UNI = (int) $_REQUEST['uni'];
        }
    }
    if (!isset($UNI)) {
        if (UNIS_WILDCAST === true) {
            $UNI = explode('.', $_SERVER['HTTP_HOST']);
            $UNI = substr($UNI[0], 3);
            if (!is_numeric($UNI)) {
                $UNI = ROOT_UNI;
            }
        } else {
            if (count($gameConfig) == 1) {
                if (HTTP_ROOT != HTTP_BASE) {
                    HTTP::redirectTo(PROTOCOL . HTTP_HOST . HTTP_BASE . HTTP_FILE, true);
                }
                $UNI = ROOT_UNI;
            } else {
                if (isset($_SERVER['REDIRECT_UNI'])) {
                    // Apache - faster then preg_match
                    $UNI = $_SERVER["REDIRECT_UNI"];
                } elseif (isset($_SERVER['REDIRECT_REDIRECT_UNI'])) {
                    // Patch for www.top-hoster.de - Hoster
                    $UNI = $_SERVER["REDIRECT_REDIRECT_UNI"];
                } elseif (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache/') === false) {
                    preg_match('!/uni([0-9]+)/!', HTTP_PATH, $match);
                    if (isset($match[1])) {
                        $UNI = $match[1];
                    }
                }
                if (!isset($UNI) || !isset($gameConfig[$UNI])) {
                    HTTP::redirectTo(PROTOCOL . HTTP_HOST . HTTP_BASE . "uni" . ROOT_UNI . "/" . HTTP_FILE, true);
                }
            }
        }
    }
    return $UNI;
}
function ShowConfigBasicPage()
{
    global $LNG, $USER;
    $CONF = Config::getAll(NULL, 1);
    if (!empty($_POST)) {
        $config_before = array('ttf_file' => $CONF['ttf_file'], 'game_name' => $CONF['game_name'], 'mail_active' => $CONF['mail_active'], 'mail_use' => $CONF['mail_use'], 'smail_path' => $CONF['smail_path'], 'smtp_host' => $CONF['smtp_host'], 'smtp_port' => $CONF['smtp_port'], 'smtp_user' => $CONF['smtp_user'], 'smtp_pass' => $CONF['smtp_pass'], 'smtp_ssl' => $CONF['smtp_ssl'], 'smtp_sendmail' => $CONF['smtp_sendmail'], 'ga_active' => $CONF['ga_active'], 'ga_key' => $CONF['ga_key'], 'capaktiv' => $CONF['capaktiv'], 'cappublic' => $CONF['cappublic'], 'capprivate' => $CONF['capprivate'], 'del_oldstuff' => $CONF['del_oldstuff'], 'del_user_manually' => $CONF['del_user_manually'], 'del_user_automatic' => $CONF['del_user_automatic'], 'del_user_sendmail' => $CONF['del_user_sendmail'], 'sendmail_inactive' => $CONF['sendmail_inactive'], 'timezone' => $CONF['timezone'], 'dst' => $CONF['dst']);
        $capaktiv = isset($_POST['capaktiv']) && $_POST['capaktiv'] == 'on' ? 1 : 0;
        $ga_active = isset($_POST['ga_active']) && $_POST['ga_active'] == 'on' ? 1 : 0;
        $sendmail_inactive = isset($_POST['sendmail_inactive']) && $_POST['sendmail_inactive'] == 'on' ? 1 : 0;
        $mail_active = isset($_POST['mail_active']) && $_POST['mail_active'] == 'on' ? 1 : 0;
        $ttf_file = HTTP::_GP('ttf_file', '');
        $close_reason = HTTP::_GP('close_reason', '', true);
        $game_name = HTTP::_GP('game_name', '', true);
        $capprivate = HTTP::_GP('capprivate', '');
        $cappublic = HTTP::_GP('cappublic', '');
        $ga_key = HTTP::_GP('ga_key', '', true);
        $mail_use = HTTP::_GP('mail_use', 0);
        $smail_path = HTTP::_GP('smail_path', '');
        $smtp_host = HTTP::_GP('smtp_host', '', true);
        $smtp_port = HTTP::_GP('smtp_port', 0);
        $smtp_user = HTTP::_GP('smtp_user', '', true);
        $smtp_sendmail = HTTP::_GP('smtp_sendmail', '', true);
        $smtp_pass = HTTP::_GP('smtp_pass', '', true);
        $smtp_ssl = HTTP::_GP('smtp_ssl', '');
        $del_oldstuff = HTTP::_GP('del_oldstuff', 0);
        $del_user_manually = HTTP::_GP('del_user_manually', 0);
        $del_user_automatic = HTTP::_GP('del_user_automatic', 0);
        $del_user_sendmail = HTTP::_GP('del_user_sendmail', 0);
        $timezone = HTTP::_GP('timezone', '');
        $dst = HTTP::_GP('dst', 0);
        $config_after = array('ttf_file' => $ttf_file, 'game_name' => $game_name, 'mail_active' => $mail_active, 'mail_use' => $mail_use, 'smail_path' => $smail_path, 'smtp_host' => $smtp_host, 'smtp_port' => $smtp_port, 'smtp_user' => $smtp_user, 'smtp_pass' => $smtp_pass, 'smtp_ssl' => $smtp_ssl, 'smtp_sendmail' => $smtp_sendmail, 'ga_active' => $ga_active, 'ga_key' => $ga_key, 'capaktiv' => $capaktiv, 'cappublic' => $cappublic, 'capprivate' => $capprivate, 'del_oldstuff' => $del_oldstuff, 'del_user_manually' => $del_user_manually, 'del_user_automatic' => $del_user_automatic, 'del_user_sendmail' => $del_user_sendmail, 'sendmail_inactive' => $sendmail_inactive, 'timezone' => $timezone, 'dst' => $dst);
        Config::update($config_after, 1);
        $CONF = Config::getAll(NULL, 1);
        $LOG = new Log(3);
        $LOG->target = 0;
        $LOG->old = $config_before;
        $LOG->new = $config_after;
        $LOG->save();
    }
    $TimeZones = get_timezone_selector();
    $template = new template();
    $template->assign_vars(array('del_oldstuff' => $CONF['del_oldstuff'], 'del_user_manually' => $CONF['del_user_manually'], 'del_user_automatic' => $CONF['del_user_automatic'], 'del_user_sendmail' => $CONF['del_user_sendmail'], 'sendmail_inactive' => $CONF['sendmail_inactive'], 'ttf_file' => $CONF['ttf_file'], 'game_name' => $CONF['game_name'], 'mail_active' => $CONF['mail_active'], 'mail_use' => $CONF['mail_use'], 'smail_path' => $CONF['smail_path'], 'smtp_host' => $CONF['smtp_host'], 'smtp_port' => $CONF['smtp_port'], 'smtp_user' => $CONF['smtp_user'], 'smtp_pass' => $CONF['smtp_pass'], 'smtp_sendmail' => $CONF['smtp_sendmail'], 'smtp_ssl' => $CONF['smtp_ssl'], 'capprivate' => $CONF['capprivate'], 'cappublic' => $CONF['cappublic'], 'capaktiv' => $CONF['capaktiv'], 'ga_active' => $CONF['ga_active'], 'ga_key' => $CONF['ga_key'], 'timezone' => $CONF['timezone'], 'dst' => $CONF['dst'], 'Selector' => array('timezone' => $TimeZones, 'mail' => $LNG['se_mail_sel'], 'encry' => array('' => $LNG['se_smtp_ssl_1'], 'ssl' => $LNG['se_smtp_ssl_2'], 'tls' => $LNG['se_smtp_ssl_3']))));
    $template->show('ConfigBasicBody.tpl');
}
 function show()
 {
     $universeSelect = array();
     $raceSelect = array();
     $raceAllConfig = $GLOBALS['DATABASE']->query('SELECT race_id, race_name FROM ' . RACES);
     $referralData = array('id' => 0, 'name' => '');
     $accountName = "";
     $externalAuth = HTTP::_GP('externalAuth', array());
     $referralID = HTTP::_GP('referralID', 0);
     $uniAllConfig = Config::getAll('universe');
     foreach ($uniAllConfig as $uniID => $uniConfig) {
         $universeSelect[$uniID] = $uniConfig['uni_name'] . ($uniConfig['game_disable'] == 0 || $uniConfig['reg_closed'] == 1 ? t('uni_closed') : '');
     }
     while ($raceWhile = $GLOBALS['DATABASE']->FetchArray($raceAllConfig)) {
         $raceSelect[$raceWhile['race_id']] = $raceWhile['race_name'];
     }
     if (!isset($externalAuth['account'], $externalAuth['method'])) {
         $externalAuth['account'] = 0;
         $externalAuth['method'] = '';
     } else {
         $externalAuth['method'] = strtolower(str_replace(array('_', '\\', '/', '.', ""), '', $externalAuth['method']));
     }
     if (!empty($externalAuth['account']) && file_exists('includes/extauth/' . $externalAuth['method'] . '.class.php')) {
         require 'includes/extauth/' . $externalAuth['method'] . '.class.php';
         $methodClass = ucwords($externalAuth['method']) . 'Auth';
         $authObj = new $methodClass();
         if (!$authObj->isActiveMode()) {
             $this->redirectTo('index.php?code=5');
         }
         if (!$authObj->isVaild()) {
             $this->redirectTo('index.php?code=4');
         }
         $accountData = $authObj->getAccountData();
         $accountName = $accountData['name'];
     }
     if (Config::get('ref_active') == 1 && !empty($referralID)) {
         $referralAccountName = $GLOBALS['DATABASE']->getFirstCell("SELECT username FROM " . USERS . " WHERE id = " . $referralID . " AND universe = " . $GLOBALS['UNI'] . ";");
         if (!empty($referralAccountName)) {
             $referralData = array('id' => $referralID, 'name' => $referralAccountName);
         }
     }
     $this->assign(array('referralData' => $referralData, 'accountName' => $accountName, 'externalAuth' => $externalAuth, 'universeSelect' => $universeSelect, 'raceSelect' => $raceSelect, 'registerRulesDesc' => t('registerRulesDesc', '<a href="index.php?page=rules">' . t('menu_rules') . '</a>')));
     $this->render('page.register.default.tpl');
 }
 function show()
 {
     $universeSelect = array();
     $page = HTTP::_GP('side', 1);
     $banCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . BANNED . " WHERE universe = " . $GLOBALS['UNI'] . " ORDER BY time DESC;");
     $maxPage = ceil($banCount / BANNED_USERS_PER_PAGE);
     $page = max(1, min($page, $maxPage));
     $banResult = $GLOBALS['DATABASE']->query("SELECT * FROM " . BANNED . " WHERE universe = " . $GLOBALS['UNI'] . " ORDER BY time DESC LIMIT " . ($page - 1) * BANNED_USERS_PER_PAGE . ", " . BANNED_USERS_PER_PAGE . ";");
     $banList = array();
     while ($banRow = $GLOBALS['DATABASE']->fetchArray($banResult)) {
         $banList[] = array('player' => $banRow['who'], 'theme' => $banRow['theme'], 'from' => _date(t('php_tdformat'), $banRow['time'], Config::get('timezone')), 'to' => _date(t('php_tdformat'), $banRow['longer'], Config::get('timezone')), 'admin' => $banRow['author'], 'mail' => $banRow['email'], 'info' => t('bn_writemail', $banRow['author']));
     }
     $uniAllConfig = Config::getAll('universe');
     foreach ($uniAllConfig as $uniID => $uniConfig) {
         $universeSelect[$uniID] = $uniConfig['uni_name'];
     }
     $this->assign(array('universeSelect' => $universeSelect, 'banList' => $banList, 'banCount' => $banCount, 'page' => $page, 'maxPage' => $maxPage));
     $this->render('page.banList.default.tpl');
 }
Example #27
0
 static function init()
 {
     self::$theSmarty = new Smarty();
     self::$theSmarty->template_dir = util_getRootPath() . 'templates';
     self::$theSmarty->compile_dir = util_getRootPath() . 'templates_c';
     self::$theSmarty->inheritance_merge_compiled_includes = false;
     // This allows variable names in {include} tags
     self::assign('wwwRoot', util_getWwwRoot());
     self::assign('imgRoot', util_getImgRoot());
     self::assign('sources', Model::factory('Source')->order_by_desc('isOfficial')->order_by_asc('displayOrder')->find_many());
     self::assign('sUser', session_getUser());
     self::assign('nick', session_getUserNick());
     self::assign('currentYear', date("Y"));
     self::assign('isMobile', util_isMobile());
     self::assign('suggestNoBanner', util_suggestNoBanner());
     self::assign('cfg', Config::getAll());
     self::assign('GLOBALS', $GLOBALS);
     self::$theSmarty->registerPlugin('function', 'getDebugInfo', array('SmartyWrap', 'getDebugInfo'));
 }
 function run()
 {
     $CONF = Config::getAll(NULL, ROOT_UNI);
     if ($CONF['ref_active'] != 1) {
         return;
     }
     $Users = $GLOBALS['DATABASE']->query("SELECT user.`username`, user.`ref_id`, user.`id`, user.`lang` \n\t\t\t\t\t\t\t  FROM " . USERS . " user\n\t\t\t\t\t\t\t  INNER JOIN " . STATPOINTS . " as stats\n\t\t\t\t\t\t\t  ON stats.`id_owner` = user.`id` AND stats.`stat_type` = '1' AND stats.`total_points` >= " . $CONF['ref_minpoints'] . "\n\t\t\t\t\t\t\t  WHERE user.`ref_bonus` = 1 AND user.`experience_peace_level` >= 5;");
     $langObjects = array();
     while ($User = $GLOBALS['DATABASE']->fetch_array($Users)) {
         if (!isset($langObjects[$User['lang']])) {
             $langObjects[$User['lang']] = new Language($User['lang']);
             $langObjects[$User['lang']]->includeData(array('L18N', 'INGAME', 'TECH', 'CUSTOM'));
         }
         $LNG = $langObjects[$User['lang']];
         $GLOBALS['DATABASE']->multi_query("UPDATE " . USERS . " SET `antimatter` = `antimatter` + '10000', `tot_ref` = `tot_ref` + '1', `darkmatter` = `darkmatter` + " . $CONF['ref_bonus'] . " WHERE `id` = " . $User['ref_id'] . ";\n\t\t\t\t\t\t\t\t\t\t\t   UPDATE " . USERS . " SET `ref_bonus` = `ref_bonus` = '0' WHERE `id` = " . $User['id'] . ";");
         $Message = sprintf($LNG['sys_refferal_text'], $User['username'], pretty_number($CONF['ref_minpoints']), pretty_number($CONF['ref_bonus']), $LNG['tech'][921], 10000, $LNG['tech'][922]);
         SendSimpleMessage($User['ref_id'], '', TIMESTAMP, 4, $LNG['sys_refferal_from'], sprintf($LNG['sys_refferal_title'], $User['username']), $Message);
     }
 }
Example #29
0
function ShowTimebonusPage()
{
    global $LNG;
    $CONF = Config::getAll(NULL, 1);
    if (!empty($_POST)) {
        $pay_before = array('timeReward' => $CONF['timeReward'], 'timeRewardFrom' => $CONF['timeRewardFrom'], 'timeRewardTo' => $CONF['timeRewardTo']);
        $timeReward = $_POST['timeReward'];
        $timeRewardFrom = $_POST['timeRewardFrom'];
        $timeRewardTo = $_POST['timeRewardTo'];
        $pay_after = array('timeReward' => $timeReward, 'timeRewardFrom' => $timeRewardFrom, 'timeRewardTo' => $timeRewardTo);
        Config::update($pay_after, 1);
        $CONF = Config::getAll(NULL, 1);
        $LOG = new Log(3);
        $LOG->target = 1;
        $LOG->old = $pay_before;
        $LOG->new = $pay_after;
        $LOG->save();
    }
    $template = new template();
    $template->assign_vars(array('timeReward' => $CONF['timeReward'], 'timeRewardFrom' => $CONF['timeRewardFrom'], 'timeRewardTo' => $CONF['timeRewardTo']));
    $template->show('timebonus.tpl');
}
Example #30
0
 public function render($controller)
 {
     $tpl = $this->templateLite;
     $templateName = $this->templateName;
     $tpl->template_dir = Config::get('TEMPLATES_PATH') . $templateName;
     if (!is_dir($tpl->template_dir)) {
         $templateName = Config::get("DEFAULT_TEMPLATE_NAME");
         $tpl->template_dir = Config::get('TEMPLATES_PATH') . $templateName;
     }
     $tpl->compile_dir = CODE_ROOT_DIR . "compiled/" . $controller->localDir . $templateName . "_template" . "/" . Config::get("language");
     if (!is_dir($tpl->compile_dir)) {
         $currentPath = CODE_ROOT_DIR . "compiled/";
         $dirs = explode("/", substr($tpl->compile_dir, strlen($currentPath)));
         foreach ($dirs as $dir) {
             $currentPath .= $dir . "/";
             if (!is_dir($currentPath)) {
                 $oldMask = umask(0);
                 mkdir($currentPath, 0777);
                 umask($oldMask);
             }
         }
     }
     $tpl->assign("setting", Config::getAll());
     $tpl->assign("display", Display::getAll());
     $tpl->assign("templateName", $templateName);
     $tpl->assign("controllerAction", $controller->action);
     $tpl->assign("controllerName", $controller->name);
     $tpl->assign(array_map_recursive("htmlspecialchars", $controller->viewVars));
     $tpl->assign("action", $controller->action);
     $tpl->assign("sessionLifeTime", ini_get('session.gc_maxlifetime'));
     if ($controller->viewFile) {
         $viewFile = NameTool::getTemplateFileName($controller->niceName . "/" . $controller->viewFile);
     } else {
         $viewFile = NameTool::getTemplateFileName($controller->niceName . "/" . $controller->action);
     }
     $tpl->encode_file_name = false;
     return $tpl->fetch($viewFile);
 }