diff --git a/admin/autounban.php b/admin/autounban.php index c5afbe6..6968da3 100644 --- a/admin/autounban.php +++ b/admin/autounban.php @@ -33,16 +33,15 @@ define('INSTALL' , false); define('IN_ADMIN', true); require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php'; - if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { - $lang['PHP_SELF'] = 'options.'.PHPEXT; - doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users'); - doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users'); - $parse = $gameConfig; - $parse['dpath'] = $dpath; - $parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":''; - } else { - message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); - } +if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { + doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users'); + doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users'); -?> + $response = Wootook::getResponse() + ->setRedirect(Wootook::getUrl('admin/overview.php')) + ->sendHeaders(); + exit(0); +} else { + message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); +} diff --git a/admin/mass_message.php b/admin/mass_message.php deleted file mode 100644 index 43998cf..0000000 --- a/admin/mass_message.php +++ /dev/null @@ -1,66 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -define('INSIDE' , true); -define('INSTALL' , false); -define('IN_ADMIN', true); - -function mass_message_run($parent){ - if($_POST["mode"] == "change"){ - if(isset($_POST["tresc"])&& $_POST["tresc"] != ''){ - $gameConfig['tresc'] = $parent->safe_get_post_var("tresc"); - } - if(isset($_POST["temat"])&& $_POST["temat"] != ''){ - $gameConfig['temat'] = $parent->safe_get_post_var("temat"); - } - $kolor = 'red'; - if($gameConfig['tresc'] !='' and $gameConfig['temat']){ - $sq = $parent->db->query("SELECT `id` FROM {{table}}","users"); - while($u = $parent->db->fetch_assoc($sq)){ - doquery("INSERT INTO {{table}} SET - `message_owner`='{$u['id']}', - `message_sender`='1' , - `message_time`='".time()."', - `message_type`='0', - `message_from`='Administracja', - `message_subject`='{$gameConfig['temat']}', - `message_text`='{$gameConfig['tresc']}' - ","messages"); - $parent->db->query("UPDATE {{table}} SET new_message=new_message+1 WHERE id='{$u['id']}'",'users'); - } - $parent->smarty->assign("message","Wys�a�e� wiadomo�� do wszystkich graczy"); - } - } - $parent->smarty->display("mass_message.tpl"); -} - -function mass_message_info(){ - return array("name" => "Send MassMessages","description"=>"Sends messagess to all players","default_weight"=>"0"); -} \ No newline at end of file diff --git a/admin/messall.php b/admin/messall.php index fb7b834..3997635 100644 --- a/admin/messall.php +++ b/admin/messall.php @@ -31,45 +31,45 @@ define('INSIDE' , true); define('INSTALL' , false); define('IN_ADMIN', true); + require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php'; - if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { - if ($_POST && $mode == "change") { - if (isset($_POST["tresc"]) && $_POST["tresc"] != '') { - $gameConfig['tresc'] = $_POST['tresc']; +if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + if (!empty($_POST)) { + if (isset($_POST["tresc"]) && $_POST["tresc"] != '') { + $tresc = $_POST['tresc']; + } + if (isset($_POST["temat"]) && $_POST["temat"] != '') { + $temat = $_POST['temat']; + } + if ($user['authlevel'] == LEVEL_ADMIN) { + $kolor = 'red'; + $ranga = 'Administrator'; + } elseif ($user['authlevel'] == LEVEL_OPERATOR) { + $kolor = 'skyblue'; + $ranga = 'Operator'; + } elseif ($user['authlevel'] == LEVEL_MODERATOR) { + $kolor = 'yellow'; + $ranga = 'Moderator'; + } + if (isset($tresc) && isset($temat)) { + $sq = doquery("SELECT `id` FROM {{table}}", "users"); + $Time = time(); + $From = "". $ranga ." ".$user['username'].""; + $Subject = "". $temat .""; + $Message = "". $tresc .""; + while ($u = $sq->fetch(PDO::FETCH_BOTH)) { + SendSimpleMessage($u['id'], $user['id'], $Time, 97, $From, $Subject, $Message); } - if (isset($_POST["temat"]) && $_POST["temat"] != '') { - $gameConfig['temat'] = $_POST['temat']; - } - if ($user['authlevel'] == LEVEL_ADMIN) { - $kolor = 'red'; - $ranga = 'Administrator'; - } elseif ($user['authlevel'] == LEVEL_OPERATOR) { - $kolor = 'skyblue'; - $ranga = 'Operator'; - } elseif ($user['authlevel'] == LEVEL_MODERATOR) { - $kolor = 'yellow'; - $ranga = 'Moderator'; - } - if ($gameConfig['tresc'] != '' and $gameConfig['temat']) { - $sq = doquery("SELECT `id` FROM {{table}}", "users"); - $Time = time(); - $From = "". $ranga ." ".$user['username'].""; - $Subject = "". $gameConfig['temat'] .""; - $Message = "". $gameConfig['tresc'] .""; - while ($u = $sq->fetch(PDO::FETCH_BOTH)) { - SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message); - } - message("Wys�a�e� wiadomo�� do wszystkich graczy", "Complete", "../overview." . PHPEXT, 3); - } - } else { - $parse = $gameConfig; - $parse['dpath'] = $dpath; - $parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":''; - $page .= parsetemplate(gettemplate('admin/messall_body'), $parse); - display($page, '', false,'', true); + message("Wys�a�e� wiadomo�� do wszystkich graczy", "Complete", "../overview." . PHPEXT, 3); } } else { - message($lang['sys_noalloaw'], $lang['sys_noaccess']); + $parse = array(); + $parse['dpath'] = $dpath; + $parse['debug'] = (defined('DEBUG')) ? " checked='checked'/":''; + $page .= parsetemplate(gettemplate('admin/messall_body'), $parse); + display($page, '', false,'', true); } -?> \ No newline at end of file +} else { + message($lang['sys_noalloaw'], $lang['sys_noaccess']); +} \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php index bd98595..d6e665f 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -34,8 +34,8 @@ define('IN_ADMIN', true); require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php'; -function DisplayGameSettingsPage ( $CurrentUser ) { - global $lang, $gameConfig; +function DisplayGameSettingsPage($CurrentUser) { + global $lang; includeLang('admin/settings'); @@ -43,208 +43,197 @@ function DisplayGameSettingsPage ( $CurrentUser ) { if (isset($_POST['opt_save']) && $_POST['opt_save'] == "1") { // Jeu Ouvert ou Ferm� ! if (isset($_POST['closed']) && $_POST['closed'] == 'on') { - $gameConfig['game_disable'] = "1"; - $gameConfig['close_reason'] = addslashes( $_POST['close_reason'] ); + Wootook::setConfig('game/general/active', true, 1, 1); } else { - $gameConfig['game_disable'] = "0"; - $gameConfig['close_reason'] = ""; + Wootook::setConfig('game/general/active', false, 1, 1); + } + + if (isset($_POST['close_reason'])) { + Wootook::setConfig('game/general/closing-message', $_POST['close_reason'], 1, 1); } // Y a un News Frame ? ! if (isset($_POST['newsframe']) && $_POST['newsframe'] == 'on') { - $gameConfig['OverviewNewsFrame'] = "1"; - $gameConfig['OverviewNewsText'] = addslashes( $_POST['NewsText'] ); + Wootook::setConfig('game/news/active', true, 1, 1); } else { - $gameConfig['OverviewNewsFrame'] = "0"; - $gameConfig['OverviewNewsText'] = ""; + Wootook::setConfig('game/news/active', false, 1, 1); + } + + if (isset($_POST['NewsText'])) { + Wootook::setConfig('game/news/content', $_POST['NewsText'], 1, 1); } // Y a un TCHAT externe ?? if (isset($_POST['chatframe']) && $_POST['chatframe'] == 'on') { - $gameConfig['OverviewExternChat'] = "1"; - $gameConfig['OverviewExternChatCmd'] = addslashes( $_POST['ExternChat'] ); + Wootook::setConfig('engine/options/chat', true, 1, 1); } else { - $gameConfig['OverviewExternChat'] = "0"; - $gameConfig['OverviewExternChatCmd'] = ""; + Wootook::setConfig('engine/options/chat', false, 1, 1); } - if (isset($_POST['googlead']) && $_POST['googlead'] == 'on') { - $gameConfig['OverviewBanner'] = "1"; - $gameConfig['OverviewClickBanner'] = addslashes( $_POST['GoogleAds'] ); + if (isset($_POST['ga']) && $_POST['ga'] == 'on') { + Wootook::setConfig('engine/options/ga', true, 1, 1); } else { - $gameConfig['OverviewBanner'] = "0"; - $gameConfig['OverviewClickBanner'] = ""; + Wootook::setConfig('engine/options/ga', false, 1, 1); + } + if (isset($_POST['ga_id']) && !empty($_POST['ga_id'])) { + Wootook::setConfig('engine/options/ga-id', $_POST['ga_id'], 1, 1); } // Y a un BANNER Frame ? if (isset($_POST['bannerframe']) && $_POST['bannerframe'] == 'on') { - $gameConfig['ForumBannerFrame'] = "1"; + Wootook::setConfig('engine/options/banner', true, 1, 1); } else { - $gameConfig['ForumBannerFrame'] = "0"; - } - - // Mode Debug ou pas ! - if (isset($_POST['debug']) && $_POST['debug'] == 'on') { - $gameConfig['debug'] = "1"; - } else { - $gameConfig['debug'] = "0"; + Wootook::setConfig('engine/options/banner', false, 1, 1); } // Nom du Jeu - if (isset($_POST['game_name']) && $_POST['game_name'] != '') { - $gameConfig['game_name'] = $_POST['game_name']; + if (isset($_POST['game_name']) && !empty($_POST['game_name'])) { + Wootook::setConfig('game/general/name', $_POST['game_name'], 1, 1); } // Adresse du Forum - if (isset($_POST['forum_url']) && $_POST['forum_url'] != '') { - $gameConfig['forum_url'] = $_POST['forum_url']; + if (isset($_POST['forum_url']) && !empty($_POST['forum_url'])) { + Wootook::setConfig('game/general/boards-url', $_POST['forum_url'], 1, 1); } // Vitesse du Jeu if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) { - $gameConfig['game_speed'] = $_POST['game_speed']; + Wootook::setConfig('game/speed/general', $_POST['game_speed'], 1, 1); } // Vitesse des Flottes if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) { - $gameConfig['fleet_speed'] = $_POST['fleet_speed']; + Wootook::setConfig('game/speed/fleet', $_POST['fleet_speed'], 1, 1); } // Multiplicateur de Production if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) { - $gameConfig['resource_multiplier'] = $_POST['resource_multiplier']; + Wootook::setConfig('game/resource/multiplier', $_POST['resource_multiplier'], 1, 1); } // Taille de la planete mère if (isset($_POST['initial_fields']) && is_numeric($_POST['initial_fields'])) { - $gameConfig['initial_fields'] = $_POST['initial_fields']; + Wootook::setConfig('resource/initial/fields', $_POST['initial_fields'], 1, 1); } // Revenu de base Metal if (isset($_POST['metal_basic_income']) && is_numeric($_POST['metal_basic_income'])) { - $gameConfig['metal_basic_income'] = $_POST['metal_basic_income']; + Wootook::setConfig('resource/initial/metal', $_POST['metal_basic_income'], 1, 1); } // Revenu de base Cristal if (isset($_POST['crystal_basic_income']) && is_numeric($_POST['crystal_basic_income'])) { - $gameConfig['crystal_basic_income'] = $_POST['crystal_basic_income']; + Wootook::setConfig('resource/initial/cristal', $_POST['crystal_basic_income'], 1, 1); } // Revenu de base Deuterium if (isset($_POST['deuterium_basic_income']) && is_numeric($_POST['deuterium_basic_income'])) { - $gameConfig['deuterium_basic_income'] = $_POST['deuterium_basic_income']; + Wootook::setConfig('resource/initial/deuterium', $_POST['deuterium_basic_income'], 1, 1); } // Revenu de base Energie if (isset($_POST['energy_basic_income']) && is_numeric($_POST['energy_basic_income'])) { - $gameConfig['energy_basic_income'] = $_POST['energy_basic_income']; + Wootook::setConfig('resource/initial/energy', $_POST['energy_basic_income'], 1, 1); } // Lien supplémentaire dans le menu - if (isset($_POST['enable_link_']) && is_numeric($_POST['enable_link_'])) { - $gameConfig['link_enable'] = $_POST['enable_link_']; + if (isset($_POST['url_link_']) && is_numeric($_POST['url_link_'])) { + Wootook::setConfig('game/general/boards-url', $_POST['url_link_'], 1, 1); } - // Texte de ce lien... -$gameConfig['link_name'] = addslashes( $_POST['name_link_']); - // URL de ce lien... -$gameConfig['link_url'] = $_POST['url_link_']; // Image de la bannière -$gameConfig['banner_source_post'] = $_POST['banner_source_post']; + if (isset($_POST['banner_source_post'])) { + Wootook::setConfig('engine/options/banner', $_POST['banner_source_post'], 1, 1); + } // 1 point = ??? Ressources ? - if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) { - $gameConfig['stat_settings'] = $_POST['stat_settings']; + if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) { + Wootook::setConfig('game/resource/multiplier', $_POST['stat_settings'], 1, 1); } - // Activation -ou non- des annonces - if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) { - $gameConfig['enable_announces'] = $_POST['enable_announces_']; + // Activation -ou non- des annonces + if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) { + Wootook::setConfig('engine/options/announces', $_POST['enable_announces_'], 1, 1); } - // Activation -ou non- du marchand - if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) { - $gameConfig['enable_marchand'] = $_POST['enable_marchand_']; + // Activation -ou non- du marchand + if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) { + Wootook::setConfig('engine/options/retailer', $_POST['enable_marchand_'], 1, 1); } - // Activation -ou non- des notes - if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) { - $gameConfig['enable_notes'] = $_POST['enable_notes_']; + // Activation -ou non- des notes + if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) { + Wootook::setConfig('engine/options/notes', $_POST['enable_notes_'], 1, 1); } - // Nom du bot antimulti - $gameConfig['bot_name'] = addslashes( $_POST['name_bot']); - - // email du bot antimulti - $gameConfig['bot_adress'] = addslashes( $_POST['adress_bot']); - - // Activation -ou non- des notes - if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) { - $gameConfig['ban_duration'] = $_POST['duration_ban']; + // Nom du bot antimulti + if (isset($_POST['name_bot'])) { + Wootook::setConfig('engine/bot/name', $_POST['name_bot'], 1, 1); + } + // email du bot antimulti + if (isset($_POST['adress_bot'])) { + Wootook::setConfig('engine/bot/email', $_POST['adress_bot'], 1, 1); } - // Activation -ou non- du bot - if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) { - $gameConfig['enable_bot'] = $_POST['bot_enable']; + // Activation -ou non- des notes + if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) { + Wootook::setConfig('engine/ban/duration', $_POST['duration_ban'], 1, 1); } - // BBCode ou pas ? - - if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) { - $gameConfig['enable_bbcode'] = $_POST['bbcode_field']; + // Activation -ou non- du bot + if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) { + Wootook::setConfig('engine/bot/active', $_POST['bot_enable'], 1, 1); } - $gameConfig->save(); + // BBCode ou pas ? + if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) { + Wootook::setConfig('engine/options/bbcode', $_POST['bbcode_field'], 1, 1); + } - AdminMessage ('Options changees avec succes !', 'Succes', '?'); + AdminMessage('Options changees avec succes !', 'Succes', '?'); } else { - $parse = $lang; - $parse['game_name'] = $gameConfig['game_name']; - $parse['game_speed'] = $gameConfig['game_speed']; - $parse['fleet_speed'] = $gameConfig['fleet_speed']; - $parse['resource_multiplier'] = $gameConfig['resource_multiplier']; - $parse['forum_url'] = $gameConfig['forum_url']; - $parse['initial_fields'] = $gameConfig['initial_fields']; - $parse['metal_basic_income'] = $gameConfig['metal_basic_income']; - $parse['crystal_basic_income'] = $gameConfig['crystal_basic_income']; - $parse['deuterium_basic_income'] = $gameConfig['deuterium_basic_income']; - $parse['energy_basic_income'] = $gameConfig['energy_basic_income']; - $parse['enable_link'] = $gameConfig['link_enable']; - $parse['name_link'] = $gameConfig['link_name']; - $parse['url_link'] = $gameConfig['link_url']; - $parse['enable_announces'] = $gameConfig['enable_announces']; - $parse['enable_marchand'] = $gameConfig['enable_marchand']; - $parse['enable_notes'] = $gameConfig['enable_notes']; - $parse['bot_name'] = stripslashes($gameConfig['bot_name']); - $parse['bot_adress'] = stripslashes($gameConfig['bot_adress']); - $parse['ban_duration'] = stripslashes($gameConfig['ban_duration']); - $parse['enable_bot'] = stripslashes($gameConfig['enable_bot']); - $parse['enable_bbcode'] = stripslashes($gameConfig['enable_bbcode']); + $parse['game_name'] = Wootook::getGameConfig('game/general/name'); + $parse['game_speed'] = Wootook::getGameConfig('game/speed/general'); + $parse['fleet_speed'] = Wootook::getGameConfig('game/speed/fleet'); + $parse['resource_multiplier'] = Wootook::getGameConfig('game/resource/multiplier'); + $parse['forum_url'] = Wootook::getGameConfig('game/general/boards-url'); + $parse['initial_fields'] = Wootook::getGameConfig('resource/initial/fields'); + $parse['metal_basic_income'] = Wootook::getGameConfig('resource/initial/metal'); + $parse['crystal_basic_income'] = Wootook::getGameConfig('resource/initial/cristal'); + $parse['deuterium_basic_income'] = Wootook::getGameConfig('resource/initial/deuterium'); + $parse['energy_basic_income'] = Wootook::getGameConfig('resource/initial/energy'); + $parse['enable_link'] = $gameConfig['link_enable']; + $parse['name_link'] = Wootook::getGameConfig('game/general/extra-url-title'); + $parse['url_link'] = Wootook::getGameConfig('game/general/extra-url'); + $parse['enable_announces'] = Wootook::getGameConfig('engine/options/announces'); + $parse['enable_marchand'] = Wootook::getGameConfig('engine/options/retailer'); + $parse['enable_notes'] = Wootook::getGameConfig('engine/options/notes'); + $parse['bot_name'] = Wootook::getGameConfig('engine/bot/name'); + $parse['bot_adress'] = Wootook::getGameConfig('engine/bot/email'); + $parse['ban_duration'] = Wootook::getGameConfig('engine/ban/duration'); + $parse['enable_bot'] = Wootook::getGameConfig('engine/bot/active'); + $parse['enable_bbcode'] = Wootook::getGameConfig('engine/options/bbcode'); - $parse['banner_source_post'] = $gameConfig['banner_source_post']; - $parse['stat_settings'] = stripslashes($gameConfig['stat_settings']); + $parse['banner_source_post'] = Wootook::getGameConfig('engine/options/banner'); + $parse['stat_settings'] = Wootook::getGameConfig('game/resource/multiplier'); + $parse['closed'] = (!Wootook::getGameConfig('game/general/active')) ? " checked = 'checked' ":""; + $parse['close_reason'] = Wootook::getGameConfig('game/general/closing-message'); - - $parse['closed'] = ($gameConfig['game_disable'] == 1) ? " checked = 'checked' ":""; - $parse['close_reason'] = stripslashes( $gameConfig['close_reason'] ); - - $parse['newsframe'] = ($gameConfig['OverviewNewsFrame'] == 1) ? " checked = 'checked' ":""; - $parse['NewsTextVal'] = stripslashes( $gameConfig['OverviewNewsText'] ); + $parse['newsframe'] = (Wootook::getGameConfig('game/news/active')) ? " checked = 'checked' ":""; + $parse['NewsTextVal'] = Wootook::getGameConfig('game/news/content'); $parse['chatframe'] = ($gameConfig['OverviewExternChat'] == 1) ? " checked = 'checked' ":""; $parse['ExtTchatVal'] = stripslashes( $gameConfig['OverviewExternChatCmd'] ); - $parse['googlead'] = ($gameConfig['OverviewBanner'] == 1) ? " checked = 'checked' ":""; - $parse['GoogleAdVal'] = stripslashes( $gameConfig['OverviewClickBanner'] ); - - $parse['debug'] = ($gameConfig['debug'] == 1) ? " checked = 'checked' ":""; + $parse['ga'] = (Wootook::getGameConfig('engine/options/ga')) ? " checked = 'checked' ":""; + $parse['ga_id'] = Wootook::getGameConfig('engine/options/ga-id'); $parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":""; $PageTPL = gettemplate('admin/options_body'); - $Page = parsetemplate( $PageTPL, $parse ); + $Page = parsetemplate($PageTPL, $parse); - display ( $Page, $lang['adm_opt_title'], false, '', true ); + display($Page, $lang['adm_opt_title'], false, '', true); } } else { - AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']); } return $Page; } diff --git a/admin/statbuilder.php b/admin/statbuilder.php index 28d13c4..a141504 100644 --- a/admin/statbuilder.php +++ b/admin/statbuilder.php @@ -47,6 +47,8 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'], $GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users'); + $resourceMultiplier = Wootook::getGameConfig('game/resource/multiplier'); + while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) { // Recuperation des anciennes statistiques $OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';", 'statpoints', true); @@ -69,7 +71,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'], // Total des unitées consommée pour la recherche $Points = GetTechnoPoints ( $CurUser ); $TTechCount = $Points['TechCount']; - $TTechPoints = ($Points['TechPoint'] / $gameConfig['stat_settings']); + $TTechPoints = ($Points['TechPoint'] / $resourceMultiplier); // Totalisation des points accumulés par planete $TBuildCount = 0; @@ -85,20 +87,20 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'], $Points = GetBuildPoints ( $CurPlanet ); $TBuildCount += $Points['BuildCount']; $GCount += $Points['BuildCount']; - $PlanetPoints = ($Points['BuildPoint'] / $gameConfig['stat_settings']); - $TBuildPoints += ($Points['BuildPoint'] / $gameConfig['stat_settings']); + $PlanetPoints = ($Points['BuildPoint'] / $resourceMultiplier); + $TBuildPoints += ($Points['BuildPoint'] / $resourceMultiplier); $Points = GetDefensePoints ( $CurPlanet ); $TDefsCount += $Points['DefenseCount'];; $GCount += $Points['DefenseCount']; - $PlanetPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']); - $TDefsPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']); + $PlanetPoints += ($Points['DefensePoint'] / $resourceMultiplier); + $TDefsPoints += ($Points['DefensePoint'] / $resourceMultiplier); $Points = GetFleetPoints ( $CurPlanet ); $TFleetCount += $Points['FleetCount']; $GCount += $Points['FleetCount']; - $PlanetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']); - $TFleetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']); + $PlanetPoints += ($Points['FleetPoint'] / $resourceMultiplier); + $TFleetPoints += ($Points['FleetPoint'] / $resourceMultiplier); $GPoints += $PlanetPoints; $QryUpdatePlanet = "UPDATE {{table}} SET "; diff --git a/application/bootstrap.php b/application/bootstrap.php index 1981347..e49c9b5 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -100,9 +100,9 @@ include(ROOT_PATH . 'includes/strings.' . PHPEXT); if (!defined('IN_INSTALL')) { - $gameConfig = Wootook_Core_Model_Config::getSingleton(); - if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) { - Wootook_Empire_Model_User::setCookieName($gameConfig['cookie_name']); + $cookieName = Wootook::getGameConfig('web/cookie/name'); + if ($cookieName !== null) { + Wootook_Empire_Model_User::setCookieName($cookieName); } $user = Wootook_Empire_Model_User::getSingleton(); @@ -112,8 +112,15 @@ if (!defined('IN_INSTALL')) { exit(0); } - if ($gameConfig->isEnabled() && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) { - message(stripslashes($gameConfig->getData('close_reason')), $gameConfig->getData('game_name')); + if (Wootook::getGameConfig('game/general/active') && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) { + $layout = new Wootook_Core_Layout(); + $layout->load('message'); + + $block = $layout->getBlock('message'); + $block['title'] = Wootook::__('Game is disabled.'); + $block['message'] = Wootook::getGameConfig('game/general/closing-message'); + + echo $layout->render(); exit(0); } } diff --git a/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php index 82777f1..89b0f0e 100644 --- a/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php @@ -108,13 +108,12 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder { $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); $types = Wootook_Empire_Model_Game_Types::getSingleton(); - $gameConfig = Wootook_Core_Model_Config::getSingleton(); Math::setPrecision(50); // FIXME: Resource dependency $totalCost = Math::mul(Math::add($prices[$technologyId][Legacies_Empire::RESOURCE_METAL], $prices[$technologyId][Legacies_Empire::RESOURCE_CRISTAL]), $level); - $speedFactor = $gameConfig->getData('game_speed'); + $speedFactor = Wootook::getGameConfig('game/speed/general'); // FIXME: Building & Technology dependency $extraLaboratoriesLevels = 0; diff --git a/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php index 37f5682..592a30c 100644 --- a/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php @@ -185,12 +185,11 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder public function getBuildingTime($shipId, $qty) { $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); - $gameConfig = Wootook_Core_Model_Config::getSingleton(); Math::setPrecision(50); $buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], $qty); - $speedFactor = $gameConfig->getData('game_speed'); + $speedFactor = Wootook::getGameConfig('game/speed/general'); $baseTime = Math::div($buildingTime, $speedFactor); Math::setPrecision(); diff --git a/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php b/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php index f64ed52..cdcba95 100644 --- a/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php +++ b/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php @@ -130,71 +130,206 @@ SQL_EOF; $this->query($sql); $sql = <<getTableName('config')} ( - `config_name` VARCHAR(64) NOT NULL, - `config_value` TEXT NOT NULL, - UNIQUE KEY (`config_name`) +CREATE TABLE IF NOT EXISTS {$this->getTableName('core_website')} ( + `website_id` TINYINT UNSIGNED NOT NULL, + `code` VARCHAR(64) NOT NULL, + `name` VARCHAR(255) NOT NULL, + `sort_order` TINYINT UNSIGNED NOT NULL, + `default_group_id` TINYINT UNSIGNED NOT NULL, + `is_default` BOOL NOT NULL, + `is_staging` BOOL NOT NULL, + `is_active` BOOL NOT NULL, + PRIMARY KEY (`webste_id`), + UNIQUE (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; SQL_EOF; $this->query($sql); $sql = <<getTableName('config')} (`config_name`, `config_value`) VALUES - -- ('game/1/resource/income/base/metal', '20'), - -- ('game/1/resource/income/base/cristal', '10'), - -- ('game/1/resource/income/base/deuterium', '0'), - -- ('game/1/resource/income/base/energy', '0'), - -- ('game/1/resource/multiplier', '1000'), +CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game_group')} ( + `group_id` TINYINT UNSIGNED NOT NULL, + `website_id` TINYINT UNSIGNED NOT NULL, + `code` VARCHAR(64) NOT NULL, + `name` VARCHAR(255) NOT NULL, + `sort_order` TINYINT UNSIGNED NOT NULL, + `is_default` BOOL NOT NULL, + PRIMARY KEY (`group_id`), + INDEX (`webste_id`), + UNIQUE (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SQL_EOF; - -- ('game/1/speed/general', '2500'), - -- ('game/1/speed/fleet', '2500'), +$this->query($sql); - ('game_speed', '2500'), - ('fleet_speed', '2500'), - ('resource_multiplier', '1000'), +$sql = <<getTableName('core_game')} ( + `game_id` SMALLINT UNSIGNED NOT NULL, + `group_id` TINYINT UNSIGNED NOT NULL, + `website_id` TINYINT UNSIGNED NOT NULL, + `code` VARCHAR(64) NOT NULL, + `name` VARCHAR(255) NOT NULL, + `sort_order` TINYINT UNSIGNED NOT NULL, + `is_default` BOOL NOT NULL, + `is_staging` BOOL NOT NULL, + `is_active` BOOL NOT NULL, + PRIMARY KEY (`group_id`), + INDEX (`webste_id`), + UNIQUE (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SQL_EOF; - ('metal_basic_income', '20'), - ('cristal_basic_income', '10'), - ('deuterium_basic_income', '0'), - ('energy_basic_income', '0'), +$this->query($sql); - ('Fleet_Cdr', '30'), - ('Defs_Cdr', '30'), - ('initial_fields', '5000'), - ('COOKIE_NAME', 'wootook'), - ('game_name', 'Wootook'), - ('game_disable', '1'), - ('close_reason', 'Le jeu est clos pour le moment!'), - ('BuildLabWhileRun', '0'), - ('urlaubs_modus_erz', '1'), - ('noobprotection', '1'), - ('noobprotectiontime', '5000'), - ('noobprotectionmulti', '5'), - ('forum_url', 'http://board.xnova-ng.org/'), - ('OverviewNewsFrame', '1'), - ('OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook'), - ('OverviewExternChat', '0'), - ('OverviewExternChatCmd', ''), - ('OverviewBanner', '0'), - ('OverviewClickBanner', ''), - ('ExtCopyFrame', '0'), - ('ExtCopyOwner', ''), - ('ExtCopyFunct', ''), - ('ForumBannerFrame', '0'), - ('stat_settings', '1000'), - ('link_enable', '0'), - ('link_name', ''), - ('link_url', ''), - ('enable_announces', '1'), - ('enable_marchand', '1'), - ('enable_notes', '1'), - ('bot_name', 'XNoviana Reali'), - ('bot_adress', 'contact@wootook.org'), - ('banner_source_post', '../images/bann.png'), - ('ban_duration', '30'), - ('enable_bot', '0'), - ('enable_bbcode', '1'); +$sql = <<getTableName('core_website')} (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `is_active`) +VALUES +(0, "admin", "Administration", 0, 0, 0, 0, 1), +(1, "default", "Default Website", 1, 1, 1, 0, 1); +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('core_game_group')} (`group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`) +VALUES +(0, 0, "admin", "Administration", 0, 0), +(1, 1, "default", "Default Group", 1, 1); +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('core_game')} (`game_id`, `group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`, `is_staging`, `is_active`) +VALUES +(0, 0, 0, "admin", "Administration", 0, 0, 0, 1), +(1, 1, 1, "default", "Default Game", 1, 1, 0, 1); +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('core_config')} ( + `website_id` TINYINT UNSIGNED NOT NULL, + `game_id` TINYINT UNSIGNED NOT NULL, + `config_path` VARCHAR(64) NOT NULL, + `config_value` VARCHAR(255) NOT NULL, + PRIMARY KEY (`website_id`, `game_id`, `config_path`), + INDEX (`website_id`), + INDEX (`game_id`), + INDEX (`config_path`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('core_config')} (`webste_id`, `game_id`, `config_path`, `config_value`) VALUES + (1, 1, 'resource/base-income/metal', '20'), + (1, 1, 'resource/base-income/cristal', '10'), + (1, 1, 'resource/base-income/deuterium', '0'), + (1, 1, 'resource/base-income/energy', '0'), + + (1, 1, 'resource/initial/fields', '163'), + (1, 1, 'resource/initial/metal', '500'), + (1, 1, 'resource/initial/cristal', '500'), + (1, 1, 'resource/initial/deuterium', '0'), + (1, 1, 'resource/initial/energy', '0'), + + (1, 1, 'game/general/name', 'Wootook'), + (1, 1, 'game/general/boards-url', 'http://wootook.org/board/'), + (1, 1, 'game/general/extra-url-title', 'Wootook!'), + (1, 1, 'game/general/extra-url', 'http://wootook.org/'), + (1, 1, 'game/general/active', '1'), + (1, 1, 'game/general/closing-message', 'Le jeu est clos pour le moment.'), + (1, 1, 'game/general/locale', 'fr_FR'), + + (1, 1, 'game/resource/multiplier', '1000'), + (1, 1, 'game/speed/general', '2500'), + (1, 1, 'game/speed/fleet', '2500'), + + (1, 1, 'game/debris/metal-percent', '30'), + (1, 1, 'game/debris/cristal-percent', '30'), + (1, 1, 'game/debris/deuterium-percent', '0'), + (1, 1, 'game/debris/energy-percent', '0'), + + (1, 1, 'game/debris/fleet', '1'), + (1, 1, 'game/debris/defense', '0'), + + (1, 1, 'game/noob-protection/active', '0'), + (1, 1, 'game/noob-protection/points-cap', '5000'), + (1, 1, 'game/noob-protection/multiplier', '5'), + + (0, 0, 'web/cookie/name', '__wtk'), + (0, 0, 'web/cookie/time', '2592000'), + (0, 0, 'web/cookie/domain', ''), + (0, 0, 'web/cookie/path', ''), + + (0, 0, 'engine/options/bbcode', '1'), + (0, 0, 'engine/options/ga', '1'), + (0, 0, 'engine/options/announces', '0'), + (0, 0, 'engine/options/retailer', '0'), + (0, 0, 'engine/options/notes', '0'), + (0, 0, 'engine/options/chat', '0'), + (0, 0, 'engine/options/banner', '0'), + (0, 0, 'engine/options/vacation-min-time', '172800'), + + (0, 0, 'game/news/active', '0'), + (0, 0, 'game/news/content', 'Bienvenue sur le nouveau serveur de jeu Wootook!'), + + (0, 0, 'engine/ban/duration', '86400'), + + (0, 0, 'engine/bot/active', '0'), + (0, 0, 'engine/bot/name', 'Woot'), + (0, 0, 'engine/bot/email', 'contact@wootook.org'), + +-------------------------------------------------------------------------------- + +-- (0, 0, 'game_speed', '2500'), +-- (0, 0, 'fleet_speed', '2500'), +-- (0, 0, 'resource_multiplier', '1000'), + +-- (0, 0, 'metal_basic_income', '20'), +-- (0, 0, 'cristal_basic_income', '10'), +-- (0, 0, 'deuterium_basic_income', '0'), +-- (0, 0, 'energy_basic_income', '0'), + +-- (0, 0, 'Fleet_Cdr', '30'), +-- (0, 0, 'Defs_Cdr', '30'), +-- (0, 0, 'initial_fields', '5000'), +-- (0, 0, 'COOKIE_NAME', 'wootook'), +-- (0, 0, 'game_name', 'Wootook'), +-- (0, 0, 'game_disable', '1'), +-- (0, 0, 'close_reason', 'Le jeu est clos pour le moment.'), + (0, 0, 'BuildLabWhileRun', '0'), +-- (0, 0, 'urlaubs_modus_erz', '1'), +-- (0, 0, 'noobprotection', '1'), +-- (0, 0, 'noobprotectiontime', '5000'), +-- (0, 0, 'noobprotectionmulti', '5'), +-- (0, 0, 'forum_url', 'http://wootook.org/board/'), +-- (0, 0, 'OverviewNewsFrame', '1'), +-- (0, 0, 'OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook'), +-- (0, 0, 'OverviewExternChat', '0'), +-- (0, 0, 'OverviewExternChatCmd', ''), +-- (0, 0, 'OverviewBanner', '0'), +-- (0, 0, 'OverviewClickBanner', ''), + (0, 0, 'ExtCopyFrame', '0'), + (0, 0, 'ExtCopyOwner', ''), + (0, 0, 'ExtCopyFunct', ''), +-- (0, 0, 'ForumBannerFrame', '0'), +-- (0, 0, 'stat_settings', '1000'), +-- (0, 0, 'link_enable', '0'), +-- (0, 0, 'link_name', ''), +-- (0, 0, 'link_url', ''), +-- (0, 0, 'enable_announces', '1'), +-- (0, 0, 'enable_marchand', '1'), +-- (0, 0, 'enable_notes', '1'), +-- (0, 0, 'bot_name', 'Isaac'), +-- (0, 0, 'bot_adress', 'contact@wootook.org'), +-- (0, 0, 'banner_source_post', '../images/bann.png'), +-- (0, 0, 'ban_duration', '30'), +-- (0, 0, 'enable_bot', '0'), +-- (0, 0, 'enable_bbcode', '1'); SQL_EOF; $this->query($sql); @@ -259,7 +394,7 @@ $this->query($sql); $sql = <<getTableName('galaxy')} ( - `galaxy` TINYINT UNSIGNED NOT NULL, + `galaxy` SMALLINT UNSIGNED NOT NULL, `system` SMALLINT UNSIGNED NOT NULL, `planet` TINYINT UNSIGNED NOT NULL, `id_planet` BIGINT UNSIGNED NOT NULL, @@ -617,3 +752,320 @@ SQL_EOF; $this->query($sql); +/* + * Galaxy positions generation + */ +$galaxyCount = Wootook::getConfig('default/engine/universe/galaxies'); +$systemCount = Wootook::getConfig('default/engine/universe/systems'); + +$sql = <<getTableName('galaxy')} + (`galaxy`, `system`, `planet`, `id_planet`, `metal`, `crystal`, `id_luna`, `luna`) + SELECT + _increment.galaxy AS `galaxy`, + _increment.system AS `system`, + 0 AS `planet`, + 0 AS `id_planet`, + 0 AS `metal`, + 0 AS `crystal`, + 0 AS `id_luna`, + 0 AS `luna` + FROM ( + SELECT + (1 + _galaxy_10e0.galaxy + _galaxy_10e1.galaxy + _galaxy_10e2.galaxy + _galaxy_10e3.galaxy + _galaxy_10e4.galaxy) AS galaxy, + (1 + _system_10e0.system + _system_10e1.system + _system_10e2.system + _system_10e3.system + _system_10e4.system) AS system + FROM ( + SELECT 0 AS system + UNION ALL + SELECT 1 AS system + UNION ALL + SELECT 2 AS system + UNION ALL + SELECT 3 AS system + UNION ALL + SELECT 4 AS system + UNION ALL + SELECT 5 AS system + UNION ALL + SELECT 6 AS system + UNION ALL + SELECT 7 AS system + UNION ALL + SELECT 8 AS system + UNION ALL + SELECT 9 AS system + ) AS _system_10e0 +SQL_EOF; + +if ($systemCount > 10) { + $sql .= << 100) { +$sql .= << 1000) { + $sql .= << 10000) { + $sql .= << 10) { + $sql .= << 100) { + $sql .= << 1000) { + $sql .= << 10000) { +$sql .= <<query($sql); diff --git a/application/code/core/Wootook.php b/application/code/core/Wootook.php index 1cb8439..9c8059e 100644 --- a/application/code/core/Wootook.php +++ b/application/code/core/Wootook.php @@ -81,10 +81,31 @@ class Wootook /** * * Enter description here ... - * @var array + * @var Wootook_Core_Config_Adapter_Abstract */ protected static $_config = null; + /** + * + * Enter description here ... + * @var Wootook_Core_Config_Adapter_Abstract + */ + protected static $_globalConfig = null; + + /** + * + * Enter description here ... + * @var array + */ + protected static $_websiteConfigs = array(); + + /** + * + * Enter description here ... + * @var array + */ + protected static $_gameConfigs = array(); + /** * Registers an event listener to be called later in the application. * @@ -179,7 +200,7 @@ class Wootook public static function getLocale() { - $availableLocales = self::getConfig('global/locales'); + $availableLocales = self::$_config->getConfig('global/locales'); return self::getPreferredLocale($availableLocales); } @@ -287,68 +308,172 @@ class Wootook self::$_response = $response; } - public static function loadConfig() + public static function loadConfig($filename = null) { - self::$_config = include ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php'; - - if (!is_array(self::$_config)) { - self::$_config = array(); + if ($filename === null) { + $filename = ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php'; } + self::$_config = new Wootook_Core_Config_Adapter_Array($filename); + + self::$_globalConfig = clone self::$_config['default']; + self::$_globalConfig->merge(self::$_config['global']); + + self::_appendDatabaseConfig(self::$_globalConfig); + + self::$_websiteConfigs = array(); + self::$_gameConfigs = array(); + return self::$_config; } + protected static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $id = 0) + { + $collection = new Wootook_Core_Collection('core_config', 'Wootook_Core_Model_Config'); + + switch ($type) { + case 'website': + $collection->where('website_id = :website_id'); + $collection->load(array('website_id' => $id)); + break; + + case 'game': + $collection->where('game_id = :game_id'); + $collection->load(array('game_id' => $id)); + break; + + default: + $collection->where('website_id = 0'); + $collection->where('game_id = 0'); + $collection->load(array()); + break; + } + + foreach ($collection as $row) { + $config->setConfig($row->getData('config_path'), $row->getData('config_value')); + } + + return $config; + } + + protected static function _initWebsiteConfig($websiteId) + { + if (self::$_config === null) { + self::loadConfig(); + } + + $websiteId = 1; + + if (!isset(self::$_websiteConfigs[$websiteId])) { + self::$_websiteConfigs[$websiteId] = clone self::$_globalConfig; + + $websiteConfig = self::$_config->getConfig("website/{$websiteId}"); + if ($websiteConfig !== null) { + self::$_websiteConfigs[$websiteId]->merge($websiteConfig); + } + + self::_appendDatabaseConfig(self::$_websiteConfigs[$websiteId], 'website', $websiteId); + } + + return self::$_websiteConfigs[$websiteId]; + } + + protected static function _initGameConfig($gameId) + { + if (self::$_config === null) { + self::loadConfig(); + } + + $websiteId = 1; + $gameId = 1; + + if (!isset(self::$_gameConfigs[$gameId])) { + self::_initWebsiteConfig($websiteId); + + self::$_gameConfigs[$gameId] = clone self::$_websiteConfigs[$websiteId]; + + $gameConfig = self::$_config->getConfig("game/{$gameId}"); + if ($gameConfig !== null) { + self::$_gameConfigs[$gameId]->merge($gameConfig); + } + + self::_appendDatabaseConfig(self::$_gameConfigs[$gameId], 'game', $gameId); + } + + return self::$_gameConfigs[$gameId]; + } + public static function getConfig($path = null) { if (self::$_config === null) { self::loadConfig(); } - if ($path === null || !is_string($path)) { - return self::$_config; + if ($path !== null) { + return self::$_globalConfig->getConfig($path); } - $config = self::$_config; - foreach (explode('/', $path) as $chunk) { - if (!isset($config[$chunk])) { - return null; - } - $config = $config[$chunk]; - } - return $config; + return self::$_globalConfig; } - public static function setConfig($path, $value) + public static function getWebsiteConfig($path = null, $websiteId = null) { if (self::$_config === null) { self::loadConfig(); } - if ($path === null || !is_string($path)) { - return self::$_config = $value; + $websiteId = 1; + + self::_initWebsiteConfig($websiteId); + + if ($path !== null) { + return self::$_websiteConfigs[$websiteId]->getConfig($path); } - $config = &self::$_config; - foreach (explode('/', $path) as $chunk) { - if (!isset($config[$chunk])) { - $config[$chunk] = array(); + return self::$_websiteConfigs[$websiteId]; + } + + public static function getGameConfig($path = null, $gameId = null) + { + if (self::$_config === null) { + self::loadConfig(); + } + + $gameId = 1; + + self::_initGameConfig($gameId); + + if ($path !== null) { + return self::$_gameConfigs[$gameId]->getConfig($path); + } + return self::$_gameConfigs[$gameId]; + } + + public static function setConfig($path, $value, $websiteId = null, $gameId = null) + { + if (self::$_config === null) { + self::loadConfig(); + } + + $updater = new Wootook_Core_Model_Config(); + $updater->setPath($path)->setValue($value); + if ($websiteId !== null) { + $updater->setWebsiteId($websiteId); + if ($gameId !== null) { + $updater->setGameId($gameId); + self::$_gameConfigs[$gameId]->setConfig($path, $value); + } else { + self::$_websiteConfigs[$websiteId]->setConfig($path, $value); } - $config = &$config[$chunk]; + } else { + self::$_globalConfig->setConfig($path, $value); } - $config = $value; + $updater->save(); return true; } - public static function writeConfig(Array $config) - { - file_put_contents(ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php', - '<' . '?p' . 'hp ' . var_export($config, true) . ';'); - - self::$_config = $config; - } - public static function getBaseUrl() { - return self::getConfig('global/web/base_url'); + return self::$_config->getConfig('global/web/base_url'); } public static function getSkinUrl($package, $theme, $uri, Array $params = array()) diff --git a/application/code/core/Wootook/Core/Block/Messages.php b/application/code/core/Wootook/Core/Block/Messages.php index a214dec..f7c704a 100644 --- a/application/code/core/Wootook/Core/Block/Messages.php +++ b/application/code/core/Wootook/Core/Block/Messages.php @@ -14,10 +14,14 @@ class Wootook_Core_Block_Messages { $messages = array(); + var_dump($this->_storages); foreach ($this->_storages as $namespace) { $session = Wootook::getSession($namespace); + var_dump($session); + + foreach ($session->getMessages() as $messageLevel => $messageList) { + var_dump(array($messageLevel => $messageList)); - foreach ($session->getData('messages') as $messageLevel => $messageList) { if (!isset($messages[$messageLevel])) { $messages[$messageLevel] = $messageList; } else { diff --git a/application/code/core/Wootook/Core/Collection.php b/application/code/core/Wootook/Core/Collection.php index 16ecde0..55f31c4 100644 --- a/application/code/core/Wootook/Core/Collection.php +++ b/application/code/core/Wootook/Core/Collection.php @@ -1,7 +1,7 @@ _prepareSql(); - $database = Wootook_Database::getSingleton(); + $database = $this->getReadConnection(); $statement = $database->prepare($sql); $args = func_get_args(); diff --git a/application/code/core/Wootook/Core/Config/Adapter/Abstract.php b/application/code/core/Wootook/Core/Config/Adapter/Abstract.php new file mode 100644 index 0000000..8913393 --- /dev/null +++ b/application/code/core/Wootook/Core/Config/Adapter/Abstract.php @@ -0,0 +1,6 @@ +load($filename); + } + } + + public function load($filename) + { + $data = include $filename; + + if (!is_array($data)) { + throw new Wootook_Core_Exception_DataAccessException( + Wootook::__('Configuration file could not be loaded.')); + } + + $this->_init($data); + + return $this; + } + + public function save($filename) + { + file_put_contents($filename, '<' . '?p' . 'hp return ' . var_export($this->toArray(), true) . ';'); + + return $this; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Config/Node.php b/application/code/core/Wootook/Core/Config/Node.php new file mode 100644 index 0000000..4ef0bbd --- /dev/null +++ b/application/code/core/Wootook/Core/Config/Node.php @@ -0,0 +1,204 @@ +_init($data, $parent); + } + + public function setData(Array $data = array()) + { + $this->_init($data); + + return $this; + } + + protected function _init(Array $data, $parent = null) + { + if ($parent !== null) { + $this->_parent = $parent; + } + + $this->_children = array(); + + foreach ($data as $key => $value) { + if (is_array($value)) { + $this->offsetSet($key, new self($value, $this)); + } else { + $this->offsetSet($key, $value); + } + } + + return $this; + } + + public function setConfig($path, $value) + { + $explodedPath = explode('/', $path); + + $length = count($explodedPath); + $currentNode = $this; + for ($i = 0; $i < $length; $i++) { + if (!$currentNode->offsetExists($explodedPath[$i])) { + $newNode = new Wootook_Core_Config_Node(array(), $currentNode); + $currentNode->offsetSet($explodedPath[$i], $newNode); + } + + $currentNode = $currentNode->offsetGet($explodedPath[$i]); + + if ($i >= ($length - 1)) { + if (is_array($value)) { + $currentNode->offsetSet($explodedPath[$i], new self($value, $this)); + } else { + $currentNode->offsetSet($explodedPath[$i], $value); + } + break; + } else if (!$currentNode instanceof Wootook_Core_Config_Node) { + throw new Wootook_Core_Exception_RuntimeException(); + } + } + + return $this; + } + + public function getConfig($path) + { + $explodedPath = explode('/', $path); + + $length = count($explodedPath); + $currentNode = $this; + for ($i = 0; $i < $length; $i++) { + if (!$currentNode instanceof Wootook_Core_Config_Node) { + throw new Wootook_Core_Exception_RuntimeException(); + } + if (!$currentNode->offsetExists($explodedPath[$i])) { + return null; + } + + $currentNode = $currentNode->offsetGet($explodedPath[$i]); + } + + return $currentNode; + } + + public function toArray() + { + $result = array(); + foreach ($this->_children as $key => $child) { + if ($child instanceof self) { + $result[$key] = $child->toArray(); + } else if ($child instanceof Wootook_Core_Config_Leaf) { + $result[$key] = $child->getValue(); + } else { + $result[$key] = $child; + } + } + return $result; + } + + public function reset() + { + $this->_children = array(); + $this->_parent = null; + + return $this; + } + + public function merge(self $node) + { + foreach ($node->_children as $offset => $value) { + if ($value instanceof self) { + if (!$this->offsetExists($offset)) { + $this->offsetSet($offset, new self(array(), $this)); + } + $this->offsetGet($offset)->merge($value); + } else { + $this->offsetSet($offset, $value); + } + } + + return $this; + } + + private function _resolveAttributeName($key) + { + if (!isset(self::$_attributeNameCache[$key])) { + self::$_attributeNameCache[$key] = str_replace(' ', '-', strtolower(preg_replace('#[A-Z]#', ' \\1', $key))); + } + return self::$_attributeNameCache[$key]; + } + + public function __get($offset) + { + return $this->offsetGet($this->_resolveAttributeName($offset)); + } + + public function __set($offset, $value) + { + return $this->offsetSet($this->_resolveAttributeName($offset), $value); + } + + public function __isset($offset) + { + return $this->offsetExists($this->_resolveAttributeName($offset)); + } + + public function __unset($offset) + { + return $this->offsetUnset($this->_resolveAttributeName($offset)); + } + + public function __clone() + { + $clone = new self(); + + foreach ($this->_children as $childName => $childNode) { + if ($childNode instanceof self) { + $childNode = clone $childNode; + $childNode->_parent = $clone; + } + + $clone->offsetSet($childName, $childNode); + } + + return $clone; + } + + public function offsetGet($offset) + { + if ($this->offsetExists($offset)) { + return $this->_children[$offset]; + } + return null; + } + + public function offsetSet($offset, $value) + { + $this->_children[$offset] = $value; + + return $value; + } + + public function offsetExists($offset) + { + if (isset($this->_children[$offset])) { + return true; + } + return false; + } + + public function offsetUnset($offset) + { + if ($this->offsetExists($offset)) { + unset($this->_children[$offset]); + } + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Database/Resource.php b/application/code/core/Wootook/Core/Database/Resource.php new file mode 100644 index 0000000..002f5bd --- /dev/null +++ b/application/code/core/Wootook/Core/Database/Resource.php @@ -0,0 +1,67 @@ +_tableName = $tableName; + + return $this; + } + + public function getTableName() + { + return $this->_tableName; + } + + public function getReadConnection() + { + if ($this->_readConnection === null) { + $this->_readConnection = Wootook_Database::getConnection('core_read'); + } + + return $this->_readConnection; + } + + public function setReadConnection($connection) + { + if ($connection instanceof Wootook_Database) { + $this->_readConnection = $connection; + } else if (is_string($connection)) { + $this->_readConnection = Wootook_Database::getConnection($connection); + } else { + throw new Wootook_Core_Exception_RuntimeException( + 'First parameter should be either a database connection object or a string identifier.'); + } + + return $this; + } + + public function getWriteConnection() + { + if ($this->_writeConnection === null) { + $this->_writeConnection = Wootook_Database::getConnection('core_write'); + } + return $this->_writeConnection; + } + + public function setWriteConnection($connection) + { + if ($connection instanceof Wootook_Database) { + $this->_readConnection = $connection; + } else if (is_string($connection)) { + $this->_readConnection = Wootook_Database::getConnection($connection); + } else { + throw new Wootook_Core_Exception_RuntimeException( + 'First parameter should be either a database connection object or a string identifier.'); + } + + return $this; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Entity.php b/application/code/core/Wootook/Core/Entity.php index 9c736ee..5f58cba 100644 --- a/application/code/core/Wootook/Core/Entity.php +++ b/application/code/core/Wootook/Core/Entity.php @@ -1,11 +1,10 @@ _idFieldName; } - public function setTableName($tableName) - { - $this->_tableName = $tableName; - - return $this; - } - - public function getTableName() - { - return $this->_tableName; - } - public function setId($id) { $this->setData($this->getIdFieldName(), $id); @@ -48,10 +35,10 @@ abstract class Wootook_Core_Entity $id = func_get_arg(0); $idFieldName = self::getIdFieldName(); - $database = Wootook_Database::getSingleton(); + $database = $this->getReadConnection(); $sql =<<getTable(self::getTableName())} +SELECT * FROM {$database->getTable($this->getTableName())} WHERE {$idFieldName}=:id LIMIT 1 SQL_EOF; @@ -89,9 +76,9 @@ SQL_EOF; $idFieldName = self::getIdFieldName(); $values[$idFieldName] = $this->getId(); - $database = Wootook_Database::getSingleton(); + $database = $this->getWriteConnection(); $sql =<<getTable(self::getTableName())} +UPDATE {$database->getTable($this->getTableName())} SET {$fieldsImploded} WHERE {$idFieldName}=:{$idFieldName} SQL_EOF; @@ -113,9 +100,9 @@ SQL_EOF; } $tokensImploded = implode(', ', $tokens); - $database = Wootook_Database::getSingleton(); + $database = $this->getWriteConnection(); $sql =<<getTable(self::getTableName())} ($fieldsImploded) +INSERT INTO {$database->getTable($this->getTableName())} ($fieldsImploded) VALUES ({$tokensImploded}) SQL_EOF; $statement = $database->prepare($sql); @@ -140,9 +127,9 @@ SQL_EOF; $fieldsImploded = implod(', ', $fields); $idFieldName = self::getIdFieldName(); - $database = Wootook_Database::getSingleton(); + $database = $this->getWriteConnection(); $sql =<<getTable(self::getTableName())} +DELETE {$database->getTable($this->getTableName())} WHERE {$idFieldName}=:{$idFieldName} SQL_EOF; diff --git a/application/code/core/Wootook/Core/Entity/SubTable.php b/application/code/core/Wootook/Core/Entity/SubTable.php index 470b89c..0eaa9bc 100644 --- a/application/code/core/Wootook/Core/Entity/SubTable.php +++ b/application/code/core/Wootook/Core/Entity/SubTable.php @@ -7,10 +7,9 @@ * @uses Wootook_Empire_Model_User */ abstract class Wootook_Core_Entity_SubTable - extends Wootook_Core_Model + extends Wootook_Core_Database_Resource { private $_isLoaded = false; - protected $_tableName = null; protected $_idFieldNames = array(); protected $_eventPrefix = 'entity.sub-table'; @@ -118,16 +117,4 @@ SQL_EOF; return $this; } - - public function setTableName($tableName) - { - $this->_tableName = $tableName; - - return $this; - } - - public function getTableName() - { - return $this->_tableName; - } } \ No newline at end of file diff --git a/application/code/core/Wootook/Core/ErrorProfiler.php b/application/code/core/Wootook/Core/ErrorProfiler.php index 8b3da28..a00e3b7 100644 --- a/application/code/core/Wootook/Core/ErrorProfiler.php +++ b/application/code/core/Wootook/Core/ErrorProfiler.php @@ -16,6 +16,10 @@ class Wootook_Core_ErrorProfiler private $_mute = false; + /** + * + * @return Wootook_Core_ErrorProfiler + */ public static function getSingleton() { if (self::$_singleton === null) { diff --git a/application/code/core/Wootook/Core/Model/Config.php b/application/code/core/Wootook/Core/Model/Config.php index 26dda47..792b6fe 100644 --- a/application/code/core/Wootook/Core/Model/Config.php +++ b/application/code/core/Wootook/Core/Model/Config.php @@ -8,81 +8,56 @@ * @uses Legacies_Empire */ class Wootook_Core_Model_Config - extends Wootook_Core_Model - implements Wootook_Core_Singleton + extends Wootook_Core_Entity_SubTable { private static $_singleton = null; protected $_eventPrefix = 'core.config'; protected $_eventObject = 'config'; - public static function getSingleton() - { - if (self::$_singleton === null) { - self::$_singleton = new self(); - } - return self::$_singleton; - } - protected function _init() { - $this->load(); + $this->_tableName = 'core_config'; + $this->_idFieldNames = array('config_path', 'website_id', 'game_id'); } - protected function _load() + public function setWebsiteId($websiteId) { - $database = Wootook_Database::getSingleton(); - - $sql =<<getTable('config')} AS config -SQL_EOF; - - $attributeName = null; - $attributeValue = null; - - $statement = $database->prepare($sql); - $statement->execute(); - - $statement->bindColumn('attribute', $attributeName, PDO::PARAM_STR); - $statement->bindColumn('value', $attributeValue, PDO::PARAM_STR); - - while ($statement->fetch(PDO::FETCH_BOUND)) { - $this->setData($attributeName, $attributeValue); - } - return $this; + return $this->setData('website_id', $websiteId); } - protected function _save() + public function getWebsiteId() { - $database = Wootook_Database::getSingleton(); - $fields = array(); - - $sql =<<prepare($sql); - - foreach ($this->getAllDatas() as $attributeName => $attributeValue) { - $statement->execute(array( - 'name' => $attributeName, - 'value' => $attributeValue - )); - } - - return $this; + return $this->getData('website_id'); } - protected function _delete() + public function setGameId($gameId) { - // NOP - return $this; + return $this->setData('game_id', $gameId); } - public function isEnabled() + public function getGameId() { - return (bool) $this->getData('game_disable'); + return $this->getData('game_id'); + } + + public function setPath($path) + { + return $this->setData('config_path', $path); + } + + public function getPath() + { + return $this->getData('config_path'); + } + + public function setValue($value) + { + return $this->setData('config_value', $value); + } + + public function getValue() + { + return $this->getData('config_value'); } } \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Model/Session.php b/application/code/core/Wootook/Core/Model/Session.php index 37f80ff..f30cd73 100644 --- a/application/code/core/Wootook/Core/Model/Session.php +++ b/application/code/core/Wootook/Core/Model/Session.php @@ -58,7 +58,8 @@ class Wootook_Core_Model_Session { $messages = $this->_data['messages']; if ($clear == true) { - $this->_data['messages'] = array(); + var_dump($this->_data['messages']); + //$this->_data['messages'] = array(); } return $messages; } diff --git a/application/code/core/Wootook/Database.php b/application/code/core/Wootook/Database.php index ce6fba8..735f669 100644 --- a/application/code/core/Wootook/Database.php +++ b/application/code/core/Wootook/Database.php @@ -33,8 +33,10 @@ class Wootook_Database return self::$_connectionAliases[$connectionName]; } - if ($alias = Wootook::getConfig("global/database/{$connectionName}/use")) { + if ($alias = Wootook::getConfig("database/{$connectionName}/use")) { self::$_connectionAliases[$connectionName] = self::getConnection($alias); + + return self::$_connectionAliases[$connectionName]; } self::$_connections[$connectionName] = self::_initConnection($connectionName); @@ -45,23 +47,23 @@ class Wootook_Database private static function _initConnection($connectionName) { - $hostname = Wootook::getConfig("global/database/{$connectionName}/params/hostname"); - $username = Wootook::getConfig("global/database/{$connectionName}/params/username"); - $password = Wootook::getConfig("global/database/{$connectionName}/params/password"); - $database = Wootook::getConfig("global/database/{$connectionName}/params/database"); + $hostname = Wootook::getConfig("database/{$connectionName}/params/hostname"); + $username = Wootook::getConfig("database/{$connectionName}/params/username"); + $password = Wootook::getConfig("database/{$connectionName}/params/password"); + $database = Wootook::getConfig("database/{$connectionName}/params/database"); if (empty($hostname) || empty($username) || empty($database)) { return null; } $dsn = "mysql:dbname={$database};host={$hostname}"; - if (($port = Wootook::getConfig("global/database/{$connectionName}/params/port")) && is_numeric($port)) { + if (($port = Wootook::getConfig("database/{$connectionName}/params/port")) && is_numeric($port)) { $dsn .= ";port={$port}"; } $event = Wootook::dispatchEvent('database.prepare-options', array( 'name' => $connectionName, - 'options' => array_merge(self::$options, Wootook::getConfig("global/database/{$connectionName}/options")) + 'options' => array_merge(self::$options, Wootook::getConfig("database/{$connectionName}/options")->toArray()) )); $options = $event->getData('options'); @@ -71,7 +73,7 @@ class Wootook_Database $connection->_username = $username; $connection->_password = $password; - if (($prefix = Wootook::getConfig("global/database/{$connectionName}/table_prefix")) !== null) { + if (($prefix = Wootook::getConfig("database/{$connectionName}/table_prefix")) !== null) { $connection->setTablePrefix($prefix); } diff --git a/application/code/core/Wootook/Empire/Model/BuilderAbstract.php b/application/code/core/Wootook/Empire/Model/BuilderAbstract.php index ee3c32e..c7fc81c 100644 --- a/application/code/core/Wootook/Empire/Model/BuilderAbstract.php +++ b/application/code/core/Wootook/Empire/Model/BuilderAbstract.php @@ -46,6 +46,10 @@ abstract class Wootook_Empire_Model_BuilderAbstract public function enqueue($params, $index = null) { + if ($this->_currentUser->getVacation()) { + return $this; + } + $item = $this->_initItem($params); if ($item === null) { return $this; diff --git a/application/code/core/Wootook/Empire/Model/Planet.php b/application/code/core/Wootook/Empire/Model/Planet.php index 7e06d19..cc1b0c0 100644 --- a/application/code/core/Wootook/Empire/Model/Planet.php +++ b/application/code/core/Wootook/Empire/Model/Planet.php @@ -260,6 +260,14 @@ class Wootook_Empire_Model_Planet return $this; } + if ($this->getUser()->isVacation()) { + $resourceConfig = Wootook::getGameConfig('resource/base-income'); + foreach ($resources->getAllDatas() as $resource => $resourceData) { + $this->setData($resourceData['production_field'], $resourceConfig[$resource]); + } + return $this; + } + /* * Compute resources consumers and resources producers */ @@ -952,22 +960,14 @@ class Wootook_Empire_Model_Planet $key = array_rand($positions, 1); $finalPosition = $positions[$key]; - $config = Wootook_Core_Model_Config::getSingleton(); - $planet = new self(); - $planet - ->setData('id_owner', $user->getId()) - ->setData('name', Wootook::getRequest()->getParam('planet')) - ->setData('galaxy', $systemInfo->getData('galaxy')) - ->setData('system', $systemInfo->getData('system')) - ->setData('planet', $finalPosition) - ->setData('planet_type', 1) - ->setData('field_max', $config->getData('initial_fields')) - ->setData('field_current', 0) - ->setData('metal', 500) // TODO: use config - ->setData('cristal', 500) // TODO: use config - ; - - $planet->save(); + $user->createNewPlanet( + $systemInfo->getData('galaxy'), + $systemInfo->getData('system'), + $finalPosition, + Wootook_Empire_Model_Planet::TYPE_PLANET, + Wootook::getRequest()->getParam('planet'), + Wootook::getGameConfig('resource/initial/fields') + ); $user ->setData('id_planet', $planet->getId()) @@ -976,13 +976,6 @@ class Wootook_Empire_Model_Planet ->setData('system', $planet->getSystem()) ->setData('planet', $planet->getPosition()) ; - - Wootook::dispatchEvent('planet.init', array( - 'planet' => $planet, - 'user' => $user - )); - - $planet->save(); } } diff --git a/application/code/core/Wootook/Empire/Model/Planet/Builder.php b/application/code/core/Wootook/Empire/Model/Planet/Builder.php index d696c8c..17f815c 100644 --- a/application/code/core/Wootook/Empire/Model/Planet/Builder.php +++ b/application/code/core/Wootook/Empire/Model/Planet/Builder.php @@ -68,14 +68,13 @@ class Wootook_Empire_Model_Planet_Builder public function getBuildingTime($buildingId, $level) { $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); - $gameConfig = Wootook_Core_Model_Config::getSingleton(); Math::setPrecision(50); $firstLevelTime = $prices[$buildingId][Legacies_Empire::BASE_BUILDING_TIME]; $partialLevelTime = Math::mul($firstLevelTime, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level)); $levelTime = Math::sub($partialLevelTime, $firstLevelTime); - $speedFactor = $gameConfig->getData('game_speed'); + $speedFactor = Wootook::getGameConfig('game/speed/general'); $baseTime = $levelTime / $speedFactor * 3600; Math::setPrecision(); diff --git a/application/code/core/Wootook/Empire/Model/User.php b/application/code/core/Wootook/Empire/Model/User.php index b7bb9e8..148796d 100644 --- a/application/code/core/Wootook/Empire/Model/User.php +++ b/application/code/core/Wootook/Empire/Model/User.php @@ -174,6 +174,7 @@ class Wootook_Empire_Model_User $user->setData('banaday', 0) ->setData('bana', 0) ->setData('urlaubs_modus', 0) + ->setData('urlaubs_until', null) ->save() ; } else { @@ -186,18 +187,25 @@ class Wootook_Empire_Model_User Wootook::getResponse()->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME); } - self::$_singleton = self::factory($login['id']); - self::$_singleton->_updateActivity(); - - $session->setData('user_id', intval($login['id'])); - - return self::$_singleton; + return self::setLoggedIn(self::factory($login['id'])); } $session->addError('Your username or credential is invalid, please check your input.'); return null; } + public static function setLoggedIn(self $user) + { + $session = Wootook::getSession(self::SESSION_KEY); + + self::$_singleton = $user; + self::$_singleton->_updateActivity(); + + $session->setData('user_id', intval(self::$_singleton->getId())); + + return self::$_singleton; + } + public static function register($username, $email, $password) { try { @@ -225,7 +233,7 @@ class Wootook_Empire_Model_User } catch (Wootook_Core_Exception_DataAccessException $e) { $session = Wootook_Core_Model_Session::factory(Wootook_Empire_Model_User::SESSION_KEY); - trigger_error($e->getMessage(), E_USER_ERROR); + Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); $session->addError($e->getMessage()); return null; } @@ -233,6 +241,44 @@ class Wootook_Empire_Model_User return $user; } + public function createNewPlanet($galaxy, $system, $position, $type, $name, $size = null) + { + if ($size === null) { + $baseSize = Wootook::getGameConfig('resource/initial/fields'); + + $factor = $position * 10 / (1 + log($position * 10)); + $fuzz = 2 * $factor * pow(sin($factor), 2) / 2 + $factor / 4; + + $size = mt_rand(floor($factor / 10), ceil($factor * 5 / 4)) + mt_rand(0, $fuzz); + } + + $planet = new self(); + $planet + ->setData('id_owner', $user->getId()) + ->setData('name', $name) + ->setData('galaxy', $galaxy) + ->setData('system', $system) + ->setData('planet', $position) + ->setData('planet_type', $type) + ->setData('field_max', $size) + ->setData('diameter', pow($size, 2) + mt_rand(0, $size * $position)) + ->setData('field_current', 0) + ; + + $resourceConfig = Wootook::getGameConfig('resource/initial'); + $resourceList = Wootook_Empire_Model_Game_Resources::getSingleton(); + foreach ($resourceList as $resource => $resourceData) { + $planet->setData($resourceData['production_field'], $resourceConfig[$resource]); + } + + Wootook::dispatchEvent('planet.init', array( + 'planet' => $planet, + 'user' => $user + )); + + $planet->save(); + } + /** * * Enter description here ... @@ -561,4 +607,34 @@ class Wootook_Empire_Model_User $navigation->addLink('tools/back', 'Go back to the game', 'Go back to the game', 'overview.php', array(), array('admin')); } } + + public function getVacation() + { + return $this->getData('urlaubs_modus') ? true : false; + } + + public function getVacationEndDate() + { + return $this->getData('urlaubs_until'); + } + + public function setVacation($active = true) + { + $this->setData('urlaubs_modus', $active); + + foreach ($this->getPlanetCollection() as $planet) { + $planet->updateResources(); + $planet->updateResourceProduction(); + $planet->save(); + } + + if ($active) { + $this->setData('urlaubs_until', time() + Wootook::getConfig('engine/options/vacation-min-time')); + } else { + $this->setData('urlaubs_until', null); + } + $this->save(); + + return $this; + } } \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/admin/messall_body.tpl b/application/design/base/default/scripts/deprecated/admin/messall_body.tpl index cf4b14e..b4b4fb8 100644 --- a/application/design/base/default/scripts/deprecated/admin/messall_body.tpl +++ b/application/design/base/default/scripts/deprecated/admin/messall_body.tpl @@ -3,13 +3,13 @@ - + - - + + diff --git a/application/design/base/default/scripts/deprecated/admin/options_body.tpl b/application/design/base/default/scripts/deprecated/admin/options_body.tpl index fb92f13..ecb278a 100644 --- a/application/design/base/default/scripts/deprecated/admin/options_body.tpl +++ b/application/design/base/default/scripts/deprecated/admin/options_body.tpl @@ -102,24 +102,17 @@ - - + + - - - - - - - - - - + + + - + diff --git a/application/design/install/default/layouts/install.php b/application/design/install/default/layouts/install.php index 14676bb..430f677 100644 --- a/application/design/install/default/layouts/install.php +++ b/application/design/install/default/layouts/install.php @@ -2,16 +2,6 @@ 'install' => array( 'update' => '2columns-left', 'reference' => array( - 'messages' => array( - 'actions' => array( - array( - 'method' => 'prepareMessages', - 'params' => array( - 'namespace' => 'install' - ) - ) - ) - ), 'content' => array( 'children' => array( 'navigation' => array( @@ -155,5 +145,19 @@ ) ) ) - ) + ), + + 'install.summary' => array( + 'update' => 'install', + 'reference' => array( + 'content' => array( + 'children' => array( + 'overview' => array( + 'type' => 'core/template', + 'template' => 'summary.phtml' + ), + ) + ) + ) + ), ); diff --git a/application/design/install/default/scripts/step/profile.phtml b/application/design/install/default/scripts/step/profile.phtml index 011796e..b8cccf4 100644 --- a/application/design/install/default/scripts/step/profile.phtml +++ b/application/design/install/default/scripts/step/profile.phtml @@ -3,7 +3,7 @@

__('Welcome to the Wootook! installer')?>

__('Admin Profile Config')?>

getLayout()->getMessagesblock()->renderGroupedHtml()?> - +

diff --git a/floten3.php b/floten3.php index 88889a3..dee1a08 100644 --- a/floten3.php +++ b/floten3.php @@ -50,10 +50,9 @@ $position = isset($session['position']) ? $session['position'] : 0; $type = isset($session['type']) ? $session['type'] : 0; $speed = isset($session['speed']) ? $session['speed'] : 10; - -$protection = $gameConfig['noobprotection']; -$protectiontime = $gameConfig['noobprotectiontime']; -$protectionmulti = $gameConfig['noobprotectionmulti']; +$protection = Wootook::getGameConfig('game/noob-protection/active'); +$protectiontime = Wootook::getGameConfig('game/noob-protection/points-cap'); +$protectionmulti = Wootook::getGameConfig('game/noob-protection/multiplier'); if ($protectiontime < 1) { $protectiontime = 9999999999999999; diff --git a/flotenajax.php b/flotenajax.php index f03b64b..d175221 100644 --- a/flotenajax.php +++ b/flotenajax.php @@ -70,9 +70,9 @@ require_once dirname(__FILE__) .'/application/bootstrap.php'; } } - $PrNoob = $gameConfig['noobprotection']; - $PrNoobTime = $gameConfig['noobprotectiontime']; - $PrNoobMulti = $gameConfig['noobprotectionmulti']; + $PrNoob = Wootook::getGameConfig('game/noob-protection/active'); + $PrNoobTime = Wootook::getGameConfig('game/noob-protection/points-cap'); + $PrNoobMulti = Wootook::getGameConfig('game/noob-protection/multiplier'); // Petit Test de coherance $galaxy = intval($_POST['galaxy']); diff --git a/includes/ataki.php b/includes/ataki.php index c8562f1..461ea05 100644 --- a/includes/ataki.php +++ b/includes/ataki.php @@ -29,7 +29,7 @@ */ function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) { - global $pricelist, $CombatCaps, $gameConfig; + global $pricelist, $CombatCaps; $runda = array(); $atakujacy_n = array(); $wrog_n = array(); @@ -259,11 +259,11 @@ function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) { $wygrana = "w"; } - $zlom['metal'] = ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * ($gameConfig['Fleet_Cdr'] / 100)); - $zlom['crystal'] = ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * ($gameConfig['Fleet_Cdr'] / 100)); + $zlom['metal'] = ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * (Wootook::getGameConfig('game/debris/fleet') ? (Wootook::getGameConfig('game/debris/metal-percent') / 100) : 0)); + $zlom['crystal'] = ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * (Wootook::getGameConfig('game/debris/fleet') ? (Wootook::getGameConfig('game/debris/cristal-percent') / 100) : 0)); - $zlom['metal'] += ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * ($gameConfig['Defs_Cdr'] / 100)); - $zlom['crystal'] += ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * ($gameConfig['Defs_Cdr'] / 100)); + $zlom['metal'] += ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * (Wootook::getGameConfig('game/debris/defense') ? (Wootook::getGameConfig('game/debris/metal-percent') / 100) : 0)); + $zlom['crystal'] += ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * (Wootook::getGameConfig('game/debris/defense') ? (Wootook::getGameConfig('game/debris/cristal-percent') / 100) : 0)); $zlom["atakujacy"] = (($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal'])); $zlom["wrog"] = (($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal']) + $straty_obrona_wrog); diff --git a/includes/constants.php b/includes/constants.php index 4e3ac62..75980b1 100644 --- a/includes/constants.php +++ b/includes/constants.php @@ -33,9 +33,9 @@ defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', E_USER_WARNING); // define('ADMINEMAIL', "no-reply@wootook.org"); // Definition du monde connu ! -defined('MAX_GALAXY_IN_WORLD') || define('MAX_GALAXY_IN_WORLD', Wootook::getConfig('default/engine/universe/galaxies')); -defined('MAX_SYSTEM_IN_GALAXY') || define('MAX_SYSTEM_IN_GALAXY', Wootook::getConfig('default/engine/universe/systems')); -defined('MAX_PLANET_IN_SYSTEM') || define('MAX_PLANET_IN_SYSTEM', Wootook::getConfig('default/engine/universe/positions')); +defined('MAX_GALAXY_IN_WORLD') || define('MAX_GALAXY_IN_WORLD', Wootook::getGameConfig('engine/universe/galaxies')); +defined('MAX_SYSTEM_IN_GALAXY') || define('MAX_SYSTEM_IN_GALAXY', Wootook::getGameConfig('engine/universe/systems')); +defined('MAX_PLANET_IN_SYSTEM') || define('MAX_PLANET_IN_SYSTEM', Wootook::getGameConfig('engine/universe/positions')); defined('BCNUMBERS') || define('BCNUMBERS', Wootook::getConfig('default/engine/core/use_large_numbers')); diff --git a/includes/debug.class.php b/includes/debug.class.php index 685dd4b..4b50f04 100644 --- a/includes/debug.class.php +++ b/includes/debug.class.php @@ -127,9 +127,7 @@ EOF; */ public function error($message, $title) { - $gameConfig = Legacies_Core_Model_Config::getSingleton(); - - if ($gameConfig['debug'] == 1) { + if (defined('DEBUG')) { echo "

$title


$message

"; echo "
Message Général__('General message')?>
Sujet
Texte (0 / 5000 Caractère)__('Content 0 / %1$d chars)', 5000)?>
getData('adm_opt_game_oth_chat')?>getData('chatframe')?> type="checkbox" />__('Enable Google Analytics')?>getData('ga')?> type="checkbox" />
getData('adm_opt_game_oth_adds')?>getData('googlead')?> type="checkbox" />
getData('adm_opt_game_debugmod')?>getData('debug')?> type="checkbox" />
__('Google Analytics Identifier')?>
getData('banner')?>
<?php echo $this->getData('banner_source_post')?>
".$this->log."
"; } diff --git a/includes/deprecated.php b/includes/deprecated.php index e89017b..7e60e09 100644 --- a/includes/deprecated.php +++ b/includes/deprecated.php @@ -657,4 +657,25 @@ function doquery($query, $table, $fetch = false) } else { return $statement; } +} + +/** + * + * @deprecated + * @param unknown_type $UserID + */ +function ResetThisFuckingCheater($userId) +{ + defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED); + + $user = Wootook_Empire_Model_User::factory($userId); + $username = $user->getData('username'); + $email = $user->getData('email'); + $password = $user->getData('password'); + $user->delete(); + + $user = Wootook_Empire_Model_User::register($TheUser['username'], $TheUser['email'], 'password'); + $user->setData('password', $password); + $user->save(); + return; } \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php index a0e7387..1d8982e 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -35,17 +35,15 @@ function check_urlaubmodus ($user) { } function check_urlaubmodus_time () { - global $user, $gameConfig; - if ($gameConfig['urlaubs_modus_erz'] == 1) { - $begrenzung = 86400; //24x60x60= 24h - $urlaub_modus_time = $user['urlaubs_modus_time']; - $urlaub_modus_time_soll = $urlaub_modus_time + $begrenzung; - $time_jetzt = time(); - if ($user['urlaubs_modus'] == 1 && $urlaub_modus_time_soll > $time_jetzt) { - $soll_datum = date("d.m.Y", $urlaub_modus_time_soll); - $soll_uhrzeit = date("H:i:s", $urlaub_modus_time_soll); - message("Vous �tes en mode vacances!
Le mode vacance dure jusque $soll_datum $soll_uhrzeit
Ce n'est qu'apr�s cette p�riode que vous pouvez changer vos options.", "Mode vacance"); - } + global $user; + $begrenzung = 86400; //24x60x60= 24h + $urlaub_modus_time = $user['urlaubs_modus_time']; + $urlaub_modus_time_soll = $urlaub_modus_time + $begrenzung; + $time_jetzt = time(); + if ($user['urlaubs_modus'] == 1 && $urlaub_modus_time_soll > $time_jetzt) { + $soll_datum = date("d.m.Y", $urlaub_modus_time_soll); + $soll_uhrzeit = date("H:i:s", $urlaub_modus_time_soll); + message("Vous �tes en mode vacances!
Le mode vacance dure jusque $soll_datum $soll_uhrzeit
Ce n'est qu'apr�s cette p�riode que vous pouvez changer vos options.", "Mode vacance"); } } diff --git a/includes/functions/CreateOneMoonRecord.php b/includes/functions/CreateOneMoonRecord.php deleted file mode 100644 index 1b4bf8b..0000000 --- a/includes/functions/CreateOneMoonRecord.php +++ /dev/null @@ -1,129 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -/** - * - * @deprecated - * @param unknown_type $Galaxy - * @param unknown_type $System - * @param unknown_type $Planet - * @param unknown_type $Owner - * @param unknown_type $MoonID - * @param unknown_type $MoonName - * @param unknown_type $Chance - */ -function CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, $Chance ) { - global $lang; - - $PlanetName = ""; - - $QryGetMoonPlanetData = "SELECT * FROM {{table}} "; - $QryGetMoonPlanetData .= "WHERE "; - $QryGetMoonPlanetData .= "`galaxy` = '". $Galaxy ."' AND "; - $QryGetMoonPlanetData .= "`system` = '". $System ."' AND "; - $QryGetMoonPlanetData .= "`planet` = '". $Planet ."';"; - $MoonPlanet = doquery ( $QryGetMoonPlanetData, 'planets', true); - - $QryGetMoonGalaxyData = "SELECT * FROM {{table}} "; - $QryGetMoonGalaxyData .= "WHERE "; - $QryGetMoonGalaxyData .= "`galaxy` = '". $Galaxy ."' AND "; - $QryGetMoonGalaxyData .= "`system` = '". $System ."' AND "; - $QryGetMoonGalaxyData .= "`planet` = '". $Planet ."';"; - $MoonGalaxy = doquery ( $QryGetMoonGalaxyData, 'galaxy', true); - - if ($MoonGalaxy['id_luna'] == 0) { - if ($MoonPlanet['id'] != 0) { - $SizeMin = 2000 + ( $Chance * 100 ); - $SizeMax = 6000 + ( $Chance * 200 ); - - $PlanetName = $MoonPlanet['name']; - - $maxtemp = $MoonPlanet['temp_max'] - rand(10, 45); - $mintemp = $MoonPlanet['temp_min'] - rand(10, 45); - $size = rand ($SizeMin, $SizeMax); - - $QryInsertMoonInLunas = "INSERT INTO {{table}} SET "; - $QryInsertMoonInLunas .= "`name` = '". ( ($MoonName == '') ? $lang['sys_moon'] : $MoonName ) ."', "; - $QryInsertMoonInLunas .= "`galaxy` = '". $Galaxy ."', "; - $QryInsertMoonInLunas .= "`system` = '". $System ."', "; - $QryInsertMoonInLunas .= "`lunapos` = '". $Planet ."', "; - $QryInsertMoonInLunas .= "`id_owner` = '". $Owner ."', "; - $QryInsertMoonInLunas .= "`temp_max` = '". $maxtemp ."', "; - $QryInsertMoonInLunas .= "`temp_min` = '". $mintemp ."', "; - $QryInsertMoonInLunas .= "`diameter` = '". $size ."', "; - $QryInsertMoonInLunas .= "`id_luna` = '". $MoonID ."';"; - doquery( $QryInsertMoonInLunas , 'lunas' ); - - $QryGetMoonIdFromLunas = "SELECT * FROM {{table}} "; - $QryGetMoonIdFromLunas .= "WHERE "; - $QryGetMoonIdFromLunas .= "`galaxy` = '". $Galaxy ."' AND "; - $QryGetMoonIdFromLunas .= "`system` = '". $System ."' AND "; - $QryGetMoonIdFromLunas .= "`lunapos` = '". $Planet ."';"; - $lunarow = doquery( $QryGetMoonIdFromLunas , 'lunas', true); - - $QryUpdateMoonInGalaxy = "UPDATE {{table}} SET "; - $QryUpdateMoonInGalaxy .= "`id_luna` = '". $lunarow['id'] ."', "; - $QryUpdateMoonInGalaxy .= "`luna` = '0' "; - $QryUpdateMoonInGalaxy .= "WHERE "; - $QryUpdateMoonInGalaxy .= "`galaxy` = '". $Galaxy ."' AND "; - $QryUpdateMoonInGalaxy .= "`system` = '". $System ."' AND "; - $QryUpdateMoonInGalaxy .= "`planet` = '". $Planet ."';"; - doquery( $QryUpdateMoonInGalaxy , 'galaxy'); - - $QryInsertMoonInPlanet = "INSERT INTO {{table}} SET "; - $QryInsertMoonInPlanet .= "`name` = '" .$lang['sys_moon'] ."', "; - $QryInsertMoonInPlanet .= "`id_owner` = '". $Owner ."', "; - $QryInsertMoonInPlanet .= "`galaxy` = '". $Galaxy ."', "; - $QryInsertMoonInPlanet .= "`system` = '". $System ."', "; - $QryInsertMoonInPlanet .= "`planet` = '". $Planet ."', "; - $QryInsertMoonInPlanet .= "`last_update` = '". time() ."', "; - $QryInsertMoonInPlanet .= "`planet_type` = '3', "; - $QryInsertMoonInPlanet .= "`image` = 'mond', "; - $QryInsertMoonInPlanet .= "`diameter` = '". $size ."', "; - $QryInsertMoonInPlanet .= "`field_max` = '1', "; - $QryInsertMoonInPlanet .= "`temp_min` = '". $maxtemp ."', "; - $QryInsertMoonInPlanet .= "`temp_max` = '". $mintemp ."', "; - $QryInsertMoonInPlanet .= "`metal` = '0', "; - $QryInsertMoonInPlanet .= "`metal_perhour` = '0', "; - $QryInsertMoonInPlanet .= "`metal_max` = '".BASE_STORAGE_SIZE."', "; - $QryInsertMoonInPlanet .= "`crystal` = '0', "; - $QryInsertMoonInPlanet .= "`crystal_perhour` = '0', "; - $QryInsertMoonInPlanet .= "`crystal_max` = '".BASE_STORAGE_SIZE."', "; - $QryInsertMoonInPlanet .= "`deuterium` = '0', "; - $QryInsertMoonInPlanet .= "`deuterium_perhour` = '0', "; - $QryInsertMoonInPlanet .= "`deuterium_max` = '".BASE_STORAGE_SIZE."';"; - doquery( $QryInsertMoonInPlanet , 'planets'); - } - } - - return $PlanetName; -} - -?> \ No newline at end of file diff --git a/includes/functions/CreateOnePlanetRecord.php b/includes/functions/CreateOnePlanetRecord.php deleted file mode 100644 index b54c2eb..0000000 --- a/includes/functions/CreateOnePlanetRecord.php +++ /dev/null @@ -1,227 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -/** - * - * @deprecated - * @param unknown_type $Position - * @param unknown_type $HomeWorld - */ -function PlanetSizeRandomiser ($Position, $HomeWorld = false) { - global $gameConfig; - - if (!$HomeWorld) { - $ClassicBase = 163; - $SettingSize = $gameConfig['initial_fields']; - $PlanetRatio = floor ( ($ClassicBase / $SettingSize) * 10000 ) / 100; - $RandomMin = array ( 40, 50, 55, 100, 95, 80, 115, 120, 125, 75, 80, 85, 60, 40, 50); - $RandomMax = array ( 90, 95, 95, 240, 240, 230, 180, 180, 190, 125, 120, 130, 160, 300, 150); - $CalculMin = floor ( $RandomMin[$Position - 1] + ( $RandomMin[$Position - 1] * $PlanetRatio ) / 100 ); - $CalculMax = floor ( $RandomMax[$Position - 1] + ( $RandomMax[$Position - 1] * $PlanetRatio ) / 100 ); - $RandomSize = mt_rand($CalculMin, $CalculMax); - $MaxAddon = mt_rand(0, 110); - $MinAddon = mt_rand(0, 100); - $Addon = ($MaxAddon - $MinAddon); - $PlanetFields = ($RandomSize + $abweichung); - } else { - $PlanetFields = $gameConfig['initial_fields']; - } - $PlanetSize = ($PlanetFields ^ (14 / 1.5)) * 75; - - $return['diameter'] = $PlanetSize; - $return['field_max'] = $PlanetFields; - return $return; -} - -/** - * - * @deprecated - * @param unknown_type $Galaxy - * @param unknown_type $System - * @param unknown_type $Position - * @param unknown_type $PlanetOwnerID - * @param unknown_type $PlanetName - * @param unknown_type $HomeWorld - */ -function CreateOnePlanetRecord($Galaxy, $System, $Position, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false) { - global $lang; - - // Avant tout, on verifie s'il existe deja une planete a cet endroit - $QrySelectPlanet = "SELECT `id` "; - $QrySelectPlanet .= "FROM {{table}} "; - $QrySelectPlanet .= "WHERE "; - $QrySelectPlanet .= "`galaxy` = '". $Galaxy ."' AND "; - $QrySelectPlanet .= "`system` = '". $System ."' AND "; - $QrySelectPlanet .= "`planet` = '". $Position ."';"; - $PlanetExist = doquery( $QrySelectPlanet, 'planets', true); - - // Si $PlanetExist est autre chose que false ... c'est qu'il y a quelque chose l� bas ... - // C'est donc aussi que je ne peux pas m'y poser !! - if (!$PlanetExist) { - $planet = PlanetSizeRandomiser ($Position, $HomeWorld); - $planet['diameter'] = ($planet['field_max'] ^ (14 / 1.5)) * 75 ; - $planet['metal'] = BUILD_METAL; - $planet['crystal'] = BUILD_CRISTAL; - $planet['deuterium'] = BUILD_DEUTERIUM; - $planet['metal_perhour'] = $gameConfig['metal_basic_income']; - $planet['crystal_perhour'] = $gameConfig['crystal_basic_income']; - $planet['deuterium_perhour'] = $gameConfig['deuterium_basic_income']; - $planet['metal_max'] = BASE_STORAGE_SIZE; - $planet['crystal_max'] = BASE_STORAGE_SIZE; - $planet['deuterium_max'] = BASE_STORAGE_SIZE; - - // Posistion 1 - 3: 80% entre 40 et 70 Cases ( 55+ / -15 ) - // Posistion 4 - 6: 80% entre 120 et 310 Cases ( 215+ / -95 ) - // Posistion 7 - 9: 80% entre 105 et 195 Cases ( 150+ / -45 ) - // Posistion 10 - 12: 80% entre 75 et 125 Cases ( 100+ / -25 ) - // Posistion 13 - 15: 80% entre 60 et 190 Cases ( 125+ / -65 ) - - $planet['galaxy'] = $Galaxy; - $planet['system'] = $System; - $planet['planet'] = $Position; - - if ($Position == 1 || $Position == 2 || $Position == 3) { - $PlanetType = array('trocken'); - $PlanetClass = array('planet'); - $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); - $planet['temp_min'] = rand(0, 100); - $planet['temp_max'] = $planet['temp_min'] + 40; - } elseif ($Position == 4 || $Position == 5 || $Position == 6) { - $PlanetType = array('dschjungel'); - $PlanetClass = array('planet'); - $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); - $planet['temp_min'] = rand(-25, 75); - $planet['temp_max'] = $planet['temp_min'] + 40; - } elseif ($Position == 7 || $Position == 8 || $Position == 9) { - $PlanetType = array('normaltemp'); - $PlanetClass = array('planet'); - $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07'); - $planet['temp_min'] = rand(-50, 50); - $planet['temp_max'] = $planet['temp_min'] + 40; - } elseif ($Position == 10 || $Position == 11 || $Position == 12) { - $PlanetType = array('wasser'); - $PlanetClass = array('planet'); - $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09'); - $planet['temp_min'] = rand(-75, 25); - $planet['temp_max'] = $planet['temp_min'] + 40; - } elseif ($Position == 13 || $Position == 14 || $Position == 15) { - $PlanetType = array('eis'); - $PlanetClass = array('planet'); - $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); - $planet['temp_min'] = rand(-100, 10); - $planet['temp_max'] = $planet['temp_min'] + 40; - } else { - $PlanetType = array('dschjungel', 'gas', 'normaltemp', 'trocken', 'wasser', 'wuesten', 'eis'); - $PlanetClass = array('planet'); - $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '00',); - $planet['temp_min'] = rand(-120, 10); - $planet['temp_max'] = $planet['temp_min'] + 40; - } - - $planet['image'] = $PlanetType[ rand( 0, count( $PlanetType ) -1 ) ]; - $planet['image'] .= $PlanetClass[ rand( 0, count( $PlanetClass ) - 1 ) ]; - $planet['image'] .= $PlanetDesign[ rand( 0, count( $PlanetDesign ) - 1 ) ]; - $planet['planet_type'] = 1; - $planet['id_owner'] = $PlanetOwnerID; - $planet['last_update'] = time(); - $planet['name'] = ($PlanetName == '') ? $lang['sys_colo_defaultname'] : $PlanetName; - - $QryInsertPlanet = "INSERT INTO {{table}} SET "; - $QryInsertPlanet .= "`name` = '". $planet['name'] ."', "; - $QryInsertPlanet .= "`id_owner` = '". $planet['id_owner'] ."', "; - $QryInsertPlanet .= "`galaxy` = '". $planet['galaxy'] ."', "; - $QryInsertPlanet .= "`system` = '". $planet['system'] ."', "; - $QryInsertPlanet .= "`planet` = '". $planet['planet'] ."', "; - $QryInsertPlanet .= "`last_update` = '". $planet['last_update'] ."', "; - $QryInsertPlanet .= "`planet_type` = '". $planet['planet_type'] ."', "; - $QryInsertPlanet .= "`image` = '". $planet['image'] ."', "; - $QryInsertPlanet .= "`diameter` = '". $planet['diameter'] ."', "; - $QryInsertPlanet .= "`field_max` = '". $planet['field_max'] ."', "; - $QryInsertPlanet .= "`temp_min` = '". $planet['temp_min'] ."', "; - $QryInsertPlanet .= "`temp_max` = '". $planet['temp_max'] ."', "; - $QryInsertPlanet .= "`metal` = '". $planet['metal'] ."', "; - $QryInsertPlanet .= "`metal_perhour` = '". $planet['metal_perhour'] ."', "; - $QryInsertPlanet .= "`metal_max` = '". $planet['metal_max'] ."', "; - $QryInsertPlanet .= "`crystal` = '". $planet['crystal'] ."', "; - $QryInsertPlanet .= "`crystal_perhour` = '". $planet['crystal_perhour'] ."', "; - $QryInsertPlanet .= "`crystal_max` = '". $planet['crystal_max'] ."', "; - $QryInsertPlanet .= "`deuterium` = '". $planet['deuterium'] ."', "; - $QryInsertPlanet .= "`deuterium_perhour` = '". $planet['deuterium_perhour'] ."', "; - $QryInsertPlanet .= "`deuterium_max` = '". $planet['deuterium_max'] ."';"; - doquery( $QryInsertPlanet, 'planets'); - - // On recupere l'id de planete nouvellement cr�� - $QrySelectPlanet = "SELECT `id` "; - $QrySelectPlanet .= "FROM {{table}} "; - $QrySelectPlanet .= "WHERE "; - $QrySelectPlanet .= "`galaxy` = '". $planet['galaxy'] ."' AND "; - $QrySelectPlanet .= "`system` = '". $planet['system'] ."' AND "; - $QrySelectPlanet .= "`planet` = '". $planet['planet'] ."' AND "; - $QrySelectPlanet .= "`id_owner` = '". $planet['id_owner'] ."';"; - $GetPlanetID = doquery( $QrySelectPlanet , 'planets', true); - - // Testons s'il y a deja eu une planete ici - $QrySelectGalaxy = "SELECT * "; - $QrySelectGalaxy .= "FROM {{table}} "; - $QrySelectGalaxy .= "WHERE "; - $QrySelectGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND "; - $QrySelectGalaxy .= "`system` = '". $planet['system'] ."' AND "; - $QrySelectGalaxy .= "`planet` = '". $planet['planet'] ."';"; - $GetGalaxyID = doquery( $QrySelectGalaxy, 'galaxy', true); - - if ($GetGalaxyID) { - // Ah ... Ce secteur de ce vaste monde a deja ete occup� - $QryUpdateGalaxy = "UPDATE {{table}} SET "; - $QryUpdateGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."' "; - $QryUpdateGalaxy .= "WHERE "; - $QryUpdateGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND "; - $QryUpdateGalaxy .= "`system` = '". $planet['system'] ."' AND "; - $QryUpdateGalaxy .= "`planet` = '". $planet['planet'] ."';"; - doquery( $QryUpdateGalaxy, 'galaxy'); - } else { - // C'est tout vide ... y a que dalle ... j'm'y pose !! - $QryInsertGalaxy = "INSERT INTO {{table}} SET "; - $QryInsertGalaxy .= "`galaxy` = '". $planet['galaxy'] ."', "; - $QryInsertGalaxy .= "`system` = '". $planet['system'] ."', "; - $QryInsertGalaxy .= "`planet` = '". $planet['planet'] ."', "; - $QryInsertGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."';"; - doquery( $QryInsertGalaxy, 'galaxy'); - } - - $RetValue = true; - } else { - - $RetValue = false; - } - - return $RetValue; -} - -?> \ No newline at end of file diff --git a/includes/functions/IsElementBuyable.php b/includes/functions/IsElementBuyable.php deleted file mode 100644 index 8588ce3..0000000 --- a/includes/functions/IsElementBuyable.php +++ /dev/null @@ -1,78 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -/** - * - * @deprecated - * @param unknown_type $CurrentUser - * @param unknown_type $CurrentPlanet - * @param unknown_type $Element - * @param unknown_type $Incremental - * @param unknown_type $ForDestroy - */ -function IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, $Incremental = true, $ForDestroy = false) { - global $pricelist, $resource; - trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED); - - if (IsVacationMode($CurrentUser)) { - return false; - } - - if ($Incremental) { - $level = ($CurrentPlanet[$resource[$Element]]) ? $CurrentPlanet[$resource[$Element]] : $CurrentUser[$resource[$Element]]; - } - - $array = array( - Legacies_Empire::RESOURCE_METAL, - Legacies_Empire::RESOURCE_CRISTAL, - Legacies_Empire::RESOURCE_DEUTERIUM, - 'energy_max' - ); - - $cost = array(); - foreach ($array as $ResType) { - if ($pricelist[$Element][$ResType] != 0) { - if ($Incremental) { - $cost[$ResType] = bcmul($pricelist[$Element][$ResType], bcpow($pricelist[$Element]['factor'], $level), 0); - } else { - $cost[$ResType] = $pricelist[$Element][$ResType]; - } - - if ($ForDestroy) { - $cost[$ResType] = bcdiv($cost[$ResType], 2, 0); - } - - if (bccomp($cost[$ResType], $CurrentPlanet[$ResType]) > 0) { - return false; - } - } - } - return true; -} diff --git a/includes/functions/IsVacationMode.php b/includes/functions/IsVacationMode.php deleted file mode 100644 index 8a53a69..0000000 --- a/includes/functions/IsVacationMode.php +++ /dev/null @@ -1,59 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -/** - * - * @deprecated - * @param unknown_type $CurrentUser - */ - function IsVacationMode($CurrentUser){ - global $gameConfig; - trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED); - - if($CurrentUser['urlaubs_modus'] == 1){ - $query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$CurrentUser['id']}'", 'planets'); - while ($id = $query->fetch(PDO::FETCH_BOTH)){ - doquery("UPDATE {{table}} SET - metal_perhour = '".$gameConfig['metal_basic_income']."', - crystal_perhour = '".$gameConfig['crystal_basic_income']."', - deuterium_perhour = '".$gameConfig['deuterium_basic_income']."', - metal_mine_porcent = '0', - crystal_mine_porcent = '0', - deuterium_sintetizer_porcent = '0', - solar_plant_porcent = '0', - fusion_plant_porcent = '0', - solar_satelit_porcent = '0' - WHERE id = '{$id['id']}' AND `planet_type` = '1' ", 'planets'); - } - return true; - } - return false; - } - ?> diff --git a/includes/functions/MissionCaseAttack.php b/includes/functions/MissionCaseAttack.php index 172e914..9d679ee 100644 --- a/includes/functions/MissionCaseAttack.php +++ b/includes/functions/MissionCaseAttack.php @@ -214,8 +214,15 @@ function MissionCaseAttack($FleetRow) } if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) { - $targetPlanetName = CreateOneMoonRecord ($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance); - $GottenMoon = sprintf ($lang['sys_moonbuilt'], $targetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); + $user = Wootook_Empire_Model_User::factory($TargetUserID); + $user->createNewPlanet( + intval($FleetRow['fleet_end_galaxy']), + intval($FleetRow['fleet_end_system']), + intval($FleetRow['fleet_end_planet']), + Wootook_Empire_Model_Planet::TYPE_MOON, + Wootook::__('Moon') + ); + $GottenMoon = Wootook::_('A moon has been created!'); } elseif ($UserChance = 0 or $UserChance > $MoonChance) { $GottenMoon = ""; } diff --git a/includes/functions/MissionCaseColonisation.php b/includes/functions/MissionCaseColonisation.php index 8f85bff..0ef6a78 100644 --- a/includes/functions/MissionCaseColonisation.php +++ b/includes/functions/MissionCaseColonisation.php @@ -50,7 +50,15 @@ function MissionCaseColonisation ( $FleetRow ) { SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets'); } else { - $NewOwnerPlanet = CreateOnePlanetRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $FleetRow['fleet_owner'], $lang['sys_colo_defaultname'], false); + $user = Wootook_Empire_Model_User::factory($FleetRow['fleet_owner']); + $user->createNewPlanet( + intval($FleetRow['fleet_end_galaxy']), + intval($FleetRow['fleet_end_system']), + intval($FleetRow['fleet_end_planet']), + Wootook_Empire_Model_Planet::TYPE_PLANET, + Wootook::__('Colony') + ); + if ( $NewOwnerPlanet == true ) { $TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok']; SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage); diff --git a/includes/functions/MissionCaseDestruction.php b/includes/functions/MissionCaseDestruction.php index 75d2147..729ee6c 100644 --- a/includes/functions/MissionCaseDestruction.php +++ b/includes/functions/MissionCaseDestruction.php @@ -35,7 +35,7 @@ */ function MissionCaseDestruction($FleetRow) { - global $user, $pricelist, $lang, $resource, $CombatCaps, $gameConfig; + global $user, $pricelist, $lang, $resource, $CombatCaps; includeLang('system'); @@ -156,7 +156,7 @@ function MissionCaseDestruction($FleetRow) $gravitonPower = 1 + pow(1 - $gravitonLevel, 2); $rawChances = pow(sqrt(1 / floatval($TargetPlanet['diameter'])) * $destructionPower * $gravitonPower, 2); - $chances = (1 - (1 / ((2500 / floatval($gameConfig['game_speed'])) * pow(1 + $rawChances, 2)))) * .5; + $chances = (1 - (1 / ((2500 / floatval(Wootook::getGameConfig('game/speed/general'))) * pow(1 + $rawChances, 2)))) * .5; $tirage = mt_rand(0, 100000000); $probalune = sprintf($lang['sys_destruc_lune'], (int) ($chances * 100)); @@ -252,266 +252,143 @@ function MissionCaseDestruction($FleetRow) $introdestruc = sprintf ($lang['sys_destruc_mess'], $DepName , $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); // Mise a jour de l'enregistrement de la planete attaqu�e - $QryUpdateTarget = "UPDATE {{table}} SET "; - $QryUpdateTarget .= $TargetPlanetUpd; - $QryUpdateTarget .= "`metal` = `metal` - '". $Mining['metal'] ."', "; - $QryUpdateTarget .= "`crystal` = `crystal` - '". $Mining['crystal'] ."', "; - $QryUpdateTarget .= "`deuterium` = `deuterium` - '". $Mining['deuter'] ."' "; - $QryUpdateTarget .= "WHERE "; - $QryUpdateTarget .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND "; - $QryUpdateTarget .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND "; - $QryUpdateTarget .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND "; - $QryUpdateTarget .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' "; - $QryUpdateTarget .= "LIMIT 1;"; - doquery( $QryUpdateTarget , 'planets'); - - // Mise a jour du champ de ruine devant la planete attaqu�e - $QryUpdateGalaxy = "UPDATE {{table}} SET "; - $QryUpdateGalaxy .= "`metal` = `metal` + '". $zlom['metal'] ."', "; - $QryUpdateGalaxy .= "`crystal` = `crystal` + '". $zlom['crystal'] ."' "; - $QryUpdateGalaxy .= "WHERE "; - $QryUpdateGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND "; - $QryUpdateGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND "; - $QryUpdateGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' "; - $QryUpdateGalaxy .= "LIMIT 1;"; - doquery( $QryUpdateGalaxy , 'galaxy'); - - // L� on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune ! - $FleetDebris = $zlom['metal'] + $zlom['crystal']; - $StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], $zlom["atakujacy"]); - $StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], $zlom["wrog"]); - $StrRuins = sprintf ($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']); - $DebrisField = $StrAttackerUnits ."
". $StrDefenderUnits ."
". $StrRuins; - $MoonChance = $FleetDebris / 100000; - if ($FleetDebris > 2000000) { - $MoonChance = 20; - } - if ($FleetDebris < 100000) { - $UserChance = 0; - $ChanceMoon = ""; - } elseif ($FleetDebris >= 100000) { - $UserChance = mt_rand(1, 100); - $ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance); - } - - if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) { - - $TargetPlanetName = CreateOneMoonRecord ( $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance ); - - $GottenMoon = sprintf ($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); - + $user = Wootook_Empire_Model_User::factory($TargetUserID); + $user->createNewPlanet( + intval($FleetRow['fleet_end_galaxy']), + intval($FleetRow['fleet_end_system']), + intval($FleetRow['fleet_end_planet']), + Wootook_Empire_Model_Planet::TYPE_MOON, + Wootook::__('Moon') + ); + $GottenMoon = Wootook::_('A moon has been created!'); } elseif ($UserChance = 0 or $UserChance > $MoonChance) { - $GottenMoon = ""; - } - - $AttackDate = date("r", $FleetRow["fleet_start_time"]); - $title = sprintf ($lang['sys_destruc_title'], $AttackDate); - $raport = "
- - "; - } else { - $parse['ADMIN_LINK'] = ""; - } - //Lien suppl�mentaire d�termin� dans le panel admin - if ($gameConfig['link_enable'] == 1) { - $parse['added_link'] = " - - - "; - } else { - $parse['added_link'] = ""; - } - - //Maintenant on v�rifie si les annonces sont activ�es ou non - if ($gameConfig['enable_announces'] == 1) { - $parse['announce_link'] = " - - - "; - } else { - $parse['announce_link'] = ""; - } - - //Maintenant le marchand - if ($gameConfig['enable_marchand'] == 1) { - $parse['marchand_link'] = " - "; - } else { - $parse['marchand_link'] = ""; - } - //Maintenant les notes - if ($gameConfig['enable_notes'] == 1) { - $parse['notes_link'] = " - - - "; - } else { - $parse['notes_link'] = ""; - } - $parse['servername'] = $gameConfig['game_name']; - $Menu = parsetemplate( $MenuTPL, $parse); - - return $Menu; -} - $Menu = ShowLeftMenu ( $user['authlevel'] ); - display ( $Menu, "Menu", '', false ); - -// ----------------------------------------------------------------------------------------------------------- -// History version -// 1.0 - Passage en fonction pour Wootook version future -// 1.1 - Modification pour gestion Admin / Game OP / Modo -?> diff --git a/login.php b/login.php index 09260e8..5db7787 100644 --- a/login.php +++ b/login.php @@ -77,8 +77,8 @@ $block['user_count'] = $userCount; $block['latest_player'] = $latestPlayer; $block['online_players'] = $onlinePlayers; -$block['server_name'] = $gameConfig['game_name']; -$block['board_url'] = $gameConfig['forum_url']; +$block['server_name'] = Wootook::getWebsiteConfig('game/general/name'); +$block['board_url'] = Wootook::getWebsiteConfig('game/general/boards-url'); echo $layout->render(); diff --git a/messages.php b/messages.php index 56e57dd..a8c4dd3 100644 --- a/messages.php +++ b/messages.php @@ -107,7 +107,7 @@ while ($CurMess = $UsrMess->fetch(PDO::FETCH_BOTH)) { $Sender = $user['id']; $From = $user['username'] ." [".$user['galaxy'].":".$user['system'].":".$user['planet']."]"; $Subject = $_POST['subject']; - if($gameConfig['enable_bbcode'] == 1) { + if (Wootook::getGameConfig('engine/options/bbcode')) { $Message = trim ( nl2br (bbcode ( image ( strip_tags ( $_POST['text'], '
' ) ) ) ) ); } else { @@ -128,7 +128,7 @@ $Message = trim ( nl2br ( strip_tags ( $_POST['text'], '
' ) ) ); } $parse['to'] = $OwnerRecord['username'] ." [".$OwnerHome['galaxy'].":".$OwnerHome['system'].":".$OwnerHome['planet']."]"; $parse['subject'] = (!isset($subject)) ? $lang['mess_no_subject'] : $subject ; $parse['text'] = $text; - if($gameConfig['enable_bbcode'] == 1) { + if(Wootook::getGameConfig('engine/options/bbcode')) { $page .= parsetemplate(gettemplate('messages_pm_form_bb'), $parse); } else { $page .= parsetemplate(gettemplate('messages_pm_form'), $parse); } diff --git a/options.php b/options.php index 5ae8563..a78fa47 100644 --- a/options.php +++ b/options.php @@ -30,46 +30,26 @@ define('INSIDE' , true); define('INSTALL' , false); + require_once dirname(__FILE__) .'/application/bootstrap.php'; - includeLang('options'); +$user = Wootook_Empire_Model_User::getSingleton(); - $lang['PHP_SELF'] = 'options.' . PHPEXT; +includeLang('options'); - $dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; - $mode = $_GET['mode']; +$lang['PHP_SELF'] = 'options.' . PHPEXT; - if ($_POST && $mode == "exit") { // Array ( [db_character] - if (isset($_POST["exit_modus"]) && $_POST["exit_modus"] == 'on' and $user['urlaubs_until'] <= time()){ - $urlaubs_modus = "0"; - doquery("UPDATE {{table}} SET - `urlaubs_modus` = '0', - `urlaubs_until` = '0' - WHERE `id` = '".$user['id']."' LIMIT 1", "users"); +$mode = isset($_GET['mode']) ? $_GET['mode'] : null; -//Remise des mines au retour du mod vacance - - $query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$user['id']}'", 'planets'); - while ($id = $query->fetch(PDO::FETCH_BOTH)){ - doquery("UPDATE {{table}} SET - energy_used = '10', - energy_max = '10', - metal_mine_porcent = '10', - crystal_mine_porcent = '10', - deuterium_sintetizer_porcent = '10', - solar_plant_porcent = '10', - fusion_plant_porcent = '10', - solar_satelit_porcent = '10' - WHERE id = '{$id['id']}' AND `planet_type` = 1 ", 'planets');} - - $dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; - message($lang['succeful_save'], $lang['Options'],"options.php",1); - }else{ - $urlaubs_modus = "1"; - $dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; - message($lang['You_cant_exit_vmode'], $lan['Error'] ,"options.php",1); + if (!empty($_POST) && $mode == "exit") { // Array ( [db_character] + if (isset($_POST["exit_modus"]) && !empty($_POST["exit_modus"]) && $user->getVacation() && $user->getVacationEndDate() <= time()) { + $user->setVacation(false); + message($lang['succeful_save'], $lang['Options'],"options.php",1); + } else { + message($lang['You_cant_exit_vmode'], $lan['Error'] ,"options.php",1); } } + if ($_POST && $mode == "change") { // Array ( [db_character] $iduser = $user["id"]; $avatar = $_POST["avatar"]; @@ -167,44 +147,22 @@ require_once dirname(__FILE__) .'/application/bootstrap.php'; $settings_rep = "0"; } // Modo vacaciones - if (isset($_POST["urlaubs_modus"]) && $_POST["urlaubs_modus"] == 'on') { - //Selectionne si le joueur a des flottes en vol - $fleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true); - //Selectionne si le joueur a des batiments en construction - $build = doquery("SELECT COUNT(id_owner) AS `building` FROM {{table}} WHERE `id_owner` = '".$user['id']."' and `b_building`!=0;", 'planets', true); - //Selectionne si le joueur a des techno en cours - $tech = doquery("SELECT COUNT(id) AS `tech` FROM {{table}} WHERE `id` = '".$user['id']."' and `b_tech_planet`!=0;", 'users', true); - //Selectionne si le joueur est en train de se faire attaquer - $attack = doquery("SELECT COUNT(fleet_taget_owner) AS `attack` FROM {{table}} WHERE `fleet_taget_owner` = '".$user['id']."';", 'fleets', true); - if($fleet['actcnt']=='0' && $build['building']=='0' && $tech['tech']=='0' && $attack['attack']=='0') { - $urlaubs_modus = "1"; - $time = time() + 172800; - doquery("UPDATE {{table}} SET - `urlaubs_modus` = '$urlaubs_modus', - `urlaubs_until` = '$time' - WHERE `id` = '$iduser' LIMIT 1", "users"); - } else { - message ( 'Verifiez vos flottes, technologies et batiments','
Vous avez des actions en cours
' ); - } + if (isset($_POST["urlaubs_modus"]) && !empty($_POST["urlaubs_modus"]) && !$user->getVacation()) { + //Selectionne si le joueur a des flottes en vol + $fleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true); + //Selectionne si le joueur a des batiments en construction + $build = doquery("SELECT COUNT(id_owner) AS `building` FROM {{table}} WHERE `id_owner` = '".$user['id']."' and `b_building`!=0;", 'planets', true); + //Selectionne si le joueur a des techno en cours + $tech = doquery("SELECT COUNT(id) AS `tech` FROM {{table}} WHERE `id` = '".$user['id']."' and `b_tech_planet`!=0;", 'users', true); + //Selectionne si le joueur est en train de se faire attaquer + $attack = doquery("SELECT COUNT(fleet_taget_owner) AS `attack` FROM {{table}} WHERE `fleet_taget_owner` = '".$user['id']."';", 'fleets', true); - $query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$user['id']}'", 'planets'); - while ($id = $query->fetch(PDO::FETCH_BOTH)){ - doquery("UPDATE {{table}} SET - metal_perhour = '".$gameConfig['metal_basic_income']."', - crystal_perhour = '".$gameConfig['metal_basic_income']."', - deuterium_perhour = '".$gameConfig['metal_basic_income']."', - energy_used = '0', - energy_max = '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' - WHERE id = '{$id['id']}' AND `planet_type` = 1 ", 'planets'); - } - } else { - $urlaubs_modus = "0"; + if ($fleet['actcnt'] == 0 && $build['building'] == 0 && $tech['tech'] == 0 && $attack['attack'] == 0) { + $user->setVacation(); + } else { + message(Wootook::__('Could not set to vacation mode.'), + Wootook::__("You currently can't get to vacation mode, please check your flying fleets, and building queues.")); + } } // Borrar cuenta @@ -233,7 +191,6 @@ require_once dirname(__FILE__) .'/application/bootstrap.php'; `settings_bud` = '$settings_bud', `settings_mis` = '$settings_mis', `settings_rep` = '$settings_rep', - `urlaubs_modus` = '$urlaubs_modus', `db_deaktjava` = '$db_deaktjava', `kolorminus` = '$kolorminus', `kolorplus` = '$kolorplus', diff --git a/overview.php b/overview.php index f0310b2..7e6cd21 100644 --- a/overview.php +++ b/overview.php @@ -211,20 +211,16 @@ if (isset($_POST) && !empty($_POST)) { // News Frame ... // External Chat Frame ... // Banner ADS Google (meme si je suis contre cela) - if ($gameConfig['OverviewNewsFrame'] == '1') { - $parse['NewsFrame'] = ""; + if (Wootook::getGameConfig('game/news/active')) { + $parse['NewsFrame'] = ""; } - if ($gameConfig['OverviewExternChat'] == '1') { - $parse['ExternalTchatFrame'] = ""; + if (Wootook::getGameConfig('engine/options/chat')) { + $parse['ExternalTchatFrame'] = ""; } - if ($gameConfig['OverviewClickBanner'] != '') { - $parse['ClickBanner'] = stripslashes($gameConfig['OverviewClickBanner']); - } - if ($gameConfig['ForumBannerFrame'] == '1') { + if (Wootook::getGameConfig('engine/options/banner')) { + $bannerUrl = Wootook::getUrl('scripts/createbanner.php', array('id' => $user['id'])); - $BannerURL = Wootook::getUrl('scripts/createbanner.php', array('id' => $user['id'])); - - $parse['bannerframe'] = ""; + $parse['bannerframe'] = ""; } // --- Gestion de l'affichage d'une lune --------------------------------------------------------- if ($moon['id']) { @@ -276,7 +272,18 @@ if (isset($_POST) && !empty($_POST)) { $parse['time'] = "
"; $parse['planet_image'] = $planet['image']; $parse['anothers_planets'] = $planetBlock->render(); - $parse['max_users'] = $gameConfig['users_amount']; + + $db = Wootook_Database::getConnection('default'); + $displayedPlayerLevels = implode(',', array( + //LEVEL_ADMIN, + LEVEL_OPERATOR, + LEVEL_MODERATOR, + LEVEL_PLAYER + )); + $userCountStatement = $db->prepare("SELECT COUNT(DISTINCT user.id) AS `user_count` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels})"); + $userCountStatement->execute(); + $userCount = $userCountStatement->fetch(Wootook_Database::FETCH_COLUMN, 0); + $parse['max_users'] = $userCount; $galaxyData = $planet->getGalaxyData(); $parse['metal_debris'] = Math::render($galaxyData['metal']); @@ -287,12 +294,19 @@ if (isset($_POST) && !empty($_POST)) { $parse['get_link'] = ''; } + $latestPlayerStatement = $db->prepare("SELECT user.username AS `latest_player` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels}) ORDER BY user.`register_time` DESC LIMIT 1"); + $latestPlayerStatement->execute(); + $latestPlayer = $latestPlayerStatement->fetch(Wootook_Database::FETCH_COLUMN, 0); + + $onlinePlayersStatement = $db->prepare("SELECT COUNT(DISTINCT user.id) AS `online_players` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels}) AND user.`onlinetime` > (UNIX_TIMESTAMP() - 900)"); + $onlinePlayersStatement->execute(); + $onlinePlayers = $onlinePlayersStatement->fetch(Wootook_Database::FETCH_COLUMN, 0); + $query = doquery('SELECT username FROM {{table}} ORDER BY register_time DESC', 'users', true); - $parse['last_user'] = $query['username']; + $parse['last_user'] = $latestPlayer; $query = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE onlinetime>" . (time()-900), 'users', true); - $parse['online_users'] = $query[0]; - // $count = doquery(","users",true); - $parse['users_amount'] = $gameConfig['users_amount']; + $parse['online_users'] = $onlinePlayers; + $parse['users_amount'] = $userCount; // Rajout d'une barre pourcentage // Calcul du pourcentage de remplissage diff --git a/quickfleet.php b/quickfleet.php index 64ed81b..f5d9655 100644 --- a/quickfleet.php +++ b/quickfleet.php @@ -76,7 +76,7 @@ includeLang('fleet'); } $distance = GetTargetDistance ( $planetrow['galaxy'], $Galaxy, $planetrow['system'], $System, $planetrow['planet'], $Planet ); - $SpeedFactor = $gameConfig['fleet_speed'] / 2500; + $SpeedFactor = Wootook::getGameConfig('game/speed/fleet') / 2500; $GenFleetSpeed = 10; // a 100% $duration = GetMissionDuration ( $GenFleetSpeed, $RecyclerSpeed, $distance, $SpeedFactor ); diff --git a/raketenangriff.php b/raketenangriff.php index 30d9bec..d2049f2 100644 --- a/raketenangriff.php +++ b/raketenangriff.php @@ -144,7 +144,7 @@ $select = doquery("SELECT * FROM {{table}} WHERE id = ".$ziel_id, 'users', true) -$flugzeit = round(((30 + (60 * $tempvar1)) * 2500) / $gameConfig['game_speed']); +$flugzeit = round(((30 + (60 * $tempvar1)) * 2500) / Wootook::getGameConfig('game/speed/general')); diff --git a/resources.php b/resources.php index b7de741..7a4cdee 100644 --- a/resources.php +++ b/resources.php @@ -33,20 +33,13 @@ define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; function BuildRessourcePage($CurrentUser, $CurrentPlanet ) { - global $lang, $gameConfig; + global $lang; includeLang('resources'); $RessBodyTPL = gettemplate('resources'); $RessRowTPL = gettemplate('resources_row'); - // Si c'est une lune ... pas de ressources produites - if ($CurrentPlanet['planet_type'] == 3) { - $gameConfig['metal_basic_income'] = 0; - $gameConfig['crystal_basic_income'] = 0; - $gameConfig['deuterium_basic_income'] = 0; - } - $request = Wootook::getRequest(); if ($request->isPost()) { foreach ($request->getPost() as $buildingField => $value) { @@ -142,10 +135,18 @@ function BuildRessourcePage($CurrentUser, $CurrentPlanet ) { $parse['production_level'] = 100; } - $parse['metal_basic_income'] = $gameConfig['metal_basic_income'] * $gameConfig['resource_multiplier']; - $parse['crystal_basic_income'] = $gameConfig['crystal_basic_income'] * $gameConfig['resource_multiplier']; - $parse['deuterium_basic_income'] = $gameConfig['deuterium_basic_income'] * $gameConfig['resource_multiplier']; - $parse['energy_basic_income'] = $gameConfig['energy_basic_income'] * $gameConfig['resource_multiplier']; + if ($CurrentPlanet['planet_type'] == Wootook_Empire_Model_Planet::TYPE_PLANET) { + $multiplier = Wootook::getGameConfig('game/resource/multiplier'); + $parse['metal_basic_income'] = Wootook::getGameConfig('resource/base-income/metal') * $multiplier; + $parse['crystal_basic_income'] = Wootook::getGameConfig('resource/base-income/cristal') * $multiplier; + $parse['deuterium_basic_income'] = Wootook::getGameConfig('resource/base-income/deuterium') * $multiplier; + $parse['energy_basic_income'] = Wootook::getGameConfig('resource/base-income/energy') * $multiplier; + } else { + $parse['metal_basic_income'] = 0; + $parse['crystal_basic_income'] = 0; + $parse['deuterium_basic_income'] = 0; + $parse['energy_basic_income'] = 0; + } if ($CurrentPlanet['metal_max'] < $CurrentPlanet['metal']) { $parse['metal_max'] = ""; diff --git a/rules.php b/rules.php index c3bd002..bad0cc7 100644 --- a/rules.php +++ b/rules.php @@ -32,15 +32,12 @@ define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; - includeLang('rules'); +includeLang('rules'); - $parse = $lang; - $parse['servername'] = $gameConfig['game_name']; +$parse = $lang; +$parse['servername'] = Wootook::getGameConfig('game/general/name'); - $PageTPL = gettemplate('rules_body'); - $page = parsetemplate( $PageTPL, $parse); +$PageTPL = gettemplate('rules_body'); +$page = parsetemplate( $PageTPL, $parse); - display($page, $lang['rules'], false); - - -?> \ No newline at end of file +display($page, $lang['rules'], false);
". $title ."
"; - $zniszczony = false; - $a_zestrzelona = 0; - $AttackTechon['A'] = $CurrentTechno["military_tech"] * 10; - $AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10; - $AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10; - $AttackerData = sprintf ($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'] ); - $AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']); - - $DefendTechon['A'] = $TargetTechno["military_tech"] * 10; - $DefendTechon['B'] = $TargetTechno["defence_tech"] * 10; - $DefendTechon['C'] = $TargetTechno["shield_tech"] * 10; - $DefenderData = sprintf ($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'] ); - $DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']); - - foreach ($dane_do_rw as $a => $b) { - $raport .= "

".$AttackerData."
".$AttackerTech.""; - if ($b["atakujacy"]['count'] > 0) { - $raport1 = ""; - $raport2 = ""; - $raport3 = ""; - $raport4 = ""; - $raport5 = ""; - foreach ($b["atakujacy"] as $Ship => $Data) { - if (is_numeric($Ship)) { - if ($Data['count'] > 0) { - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - } - } - } - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - $raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5; - } else { - if ($a == 2) { - $a_zestrzelona = 1; - } - $zniszczony = true; - $raport .= "
". $lang['sys_destroyed']; - } - - $raport .= "
".$lang['sys_ship_type']."
".$lang['sys_ship_count']."
".$lang['sys_ship_weapon']."
".$lang['sys_ship_shield']."
".$lang['sys_ship_armour']."". $lang["tech_rc"][$Ship] ."". $Data['count'] ."". round($Data["atak"] / $Data['count']) ."". round($Data["tarcza"] / $Data['count']) ."". round($Data["obrona"] / $Data['count']) ."
"; - $raport .= "

".$DefenderData."
".$DefenderTech.""; - if ($b["wrog"]['count'] > 0) { - $raport1 = ""; - $raport2 = ""; - $raport3 = ""; - $raport4 = ""; - $raport5 = ""; - foreach ($b["wrog"] as $Ship => $Data) { - if (is_numeric($Ship)) { - if ($Data['count'] > 0) { - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - } - } - } - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - $raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5; - } else { - $zniszczony = true; - $raport .= "
". $lang['sys_destroyed']; - } $raport .= "
".$lang['sys_ship_type']."
".$lang['sys_ship_count']."
".$lang['sys_ship_weapon']."
".$lang['sys_ship_shield']."
".$lang['sys_ship_armour']."". $lang["tech_rc"][$Ship] ."". $Data['count'] ."". round($Data["atak"] / $Data['count']) ."". round($Data["tarcza"] / $Data['count']) ."". round($Data["obrona"] / $Data['count']) ."
"; - - if (($zniszczony == false) and !($a == 8)) { $AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], floor($b["atakujacy"]["atak"]), floor($b["wrog"]["tarcza"])); $DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], floor($b["wrog"]["atak"]), floor($b["atakujacy"]["tarcza"])); diff --git a/includes/functions/ResetThisFuckingCheater.php b/includes/functions/ResetThisFuckingCheater.php deleted file mode 100644 index 63944db..0000000 --- a/includes/functions/ResetThisFuckingCheater.php +++ /dev/null @@ -1,78 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -/** - * - * @deprecated - * @param unknown_type $UserID - */ -function ResetThisFuckingCheater ( $UserID ) { - trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED); - $TheUser = doquery ("SELECT * FROM {{table}} WHERE `id` = '". $UserID ."';", 'users', true); - $UserPlanet = doquery ("SELECT `name` FROM {{table}} WHERE `id` = '". $TheUser['id_planet']."';", 'planets', true); - DeleteSelectedUser ( $UserID ); - if ($UserPlanet['name'] != "") { - // Creation de l'utilisateur - $QryInsertUser = "INSERT INTO {{table}} SET "; - $QryInsertUser .= "`id` = '". $TheUser['id'] ."', "; - $QryInsertUser .= "`username` = '". $TheUser['username'] ."', "; - $QryInsertUser .= "`email` = '". $TheUser['email'] ."', "; - $QryInsertUser .= "`email_2` = '". $TheUser['email_2'] ."', "; - $QryInsertUser .= "`sex` = '". $TheUser['sex'] ."', "; - $QryInsertUser .= "`id_planet` = '0', "; - $QryInsertUser .= "`authlevel` = '". $TheUser['authlevel'] ."', "; - $QryInsertUser .= "`dpath` = '". $TheUser['dpath'] ."', "; - $QryInsertUser .= "`galaxy` = '". $TheUser['galaxy'] ."', "; - $QryInsertUser .= "`system` = '". $TheUser['system'] ."', "; - $QryInsertUser .= "`planet` = '". $TheUser['planet'] ."', "; - $QryInsertUser .= "`register_time` = '". $TheUser['register_time'] ."', "; - $QryInsertUser .= "`password` = '". $TheUser['password'] ."';"; - doquery( $QryInsertUser, 'users'); - - // On cherche le numero d'enregistrement de l'utilisateur fraichement cr?? - $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '". $TheUser['username'] ."' LIMIT 1;", 'users', true); - - CreateOnePlanetRecord ($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); - // Recherche de la reference de la nouvelle planete (qui est unique normalement ! - $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '". $NewUser['id'] ."' LIMIT 1;", 'planets', true); - - // Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere - $QryUpdateUser = "UPDATE {{table}} SET "; - $QryUpdateUser .= "`id_planet` = '". $PlanetID['id'] ."', "; - $QryUpdateUser .= "`current_planet` = '". $PlanetID['id'] ."' "; - $QryUpdateUser .= "WHERE "; - $QryUpdateUser .= "`id` = '". $NewUser['id'] ."';"; - doquery( $QryUpdateUser, 'users'); - } - - return; -} - -?> \ No newline at end of file diff --git a/includes/todofleetcontrol.php b/includes/todofleetcontrol.php index 1809389..8603dd7 100644 --- a/includes/todofleetcontrol.php +++ b/includes/todofleetcontrol.php @@ -48,12 +48,9 @@ include(ROOT_PATH . 'includes/functions/SendSimpleMessage.'.PHPEXT); include(ROOT_PATH . 'includes/functions/SpyTarget.'.PHPEXT); include(ROOT_PATH . 'includes/functions/RestoreFleetToPlanet.'.PHPEXT); include(ROOT_PATH . 'includes/functions/StoreGoodsToPlanet.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/CreateOneMoonRecord.'.PHPEXT); // <- TODO: delete -include(ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.'.PHPEXT); // <- TODO: delete include(ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.'.PHPEXT); include(ROOT_PATH . 'includes/functions/IsTechnologieAccessible.'.PHPEXT); // <- TODO: delete include(ROOT_PATH . 'includes/functions/GetRestPrice.'.PHPEXT); // <- TODO: delete -include(ROOT_PATH . 'includes/functions/IsElementBuyable.'.PHPEXT); include(ROOT_PATH . 'includes/functions/InsertGalaxyScripts.'.PHPEXT); include(ROOT_PATH . 'includes/functions/GalaxyCheckFunctions.'.PHPEXT); include(ROOT_PATH . 'includes/functions/ShowGalaxyRows.'.PHPEXT); @@ -80,8 +77,6 @@ include(ROOT_PATH . 'includes/functions/MipCombatEngine.'.PHPEXT); include(ROOT_PATH . 'includes/functions/DeleteSelectedUser.'.PHPEXT); include(ROOT_PATH . 'includes/functions/SortUserPlanets.'.PHPEXT); include(ROOT_PATH . 'includes/functions/BuildFleetEventTable.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/ResetThisFuckingCheater.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/IsVacationMode.'.PHPEXT); /** * }}} */ \ No newline at end of file diff --git a/includes/unlocalised.php b/includes/unlocalised.php index 8217028..7e3ac6c 100644 --- a/includes/unlocalised.php +++ b/includes/unlocalised.php @@ -54,9 +54,7 @@ function GetMissionDuration ($GameSpeed, $MaxFleetSpeed, $Distance, $SpeedFactor // Retourne la valeur ajustée de vitesse des flottes function GetGameSpeedFactor () { - global $gameConfig; - - return $gameConfig['fleet_speed'] / 2500; + return Wootook::getGameConfig('game/speed/fleet') / 2500; } /** diff --git a/infos.php b/infos.php index 00988ef..583ec10 100644 --- a/infos.php +++ b/infos.php @@ -82,17 +82,18 @@ function BuildJumpableMoonCombo ( $CurrentUser, $CurrentPlanet ) { // Tient compte aussi du multiplicateur de ressources // function ShowProductionTable ($CurrentUser, $CurrentPlanet, $BuildID, $Template) { - global $ProdGrid, $resource, $gameConfig; + global $ProdGrid, $resource; $BuildLevelFactor = $CurrentPlanet[ $resource[$BuildID]."_porcent" ]; $BuildTemp = $CurrentPlanet[ 'temp_max' ]; $CurrentBuildtLvl = $CurrentPlanet[ $resource[$BuildID] ]; $BuildLevel = ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1; - $Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); - $Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); - $Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); - $Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05))); + $multiplier = Wootook::getGameConfig('game/resource/multiplier'); + $Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); + $Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); + $Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); + $Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $multiplier) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05))); $BuildLevel = ""; $ActualProd = floor($Prod[$BuildID]); @@ -110,10 +111,10 @@ function ShowProductionTable ($CurrentUser, $CurrentPlanet, $BuildID, $Template) $ProdFirst = 0; for ( $BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++ ) { if ($BuildID != 42) { - $Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); - $Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); - $Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); - $Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05))); + $Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); + $Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); + $Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05))); + $Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $multiplier) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05))); $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "".$BuildLevel."" : $BuildLevel; if ($ProdFirst > 0) { diff --git a/install/index.php b/install/index.php index f1e4f09..cd71a60 100644 --- a/install/index.php +++ b/install/index.php @@ -64,16 +64,14 @@ if (isset($_SERVER['REQUEST_URI'])) { } } -if (count(Wootook::getConfig()) == 0) { - Wootook::setConfig('global/web/base_url', $baseUrl); +Wootook::setConfig('global/web/base_url', $baseUrl); - Wootook::setConfig('global/package', 'install'); - Wootook::setConfig('global/theme', 'default'); - Wootook::setconfig('global/layout', array( - 'page' => 'page.php', - 'install' => 'install.php' - )); -} +Wootook::setConfig('global/package', 'install'); +Wootook::setConfig('global/theme', 'default'); +Wootook::setconfig('global/layout', array( + 'page' => 'page.php', + 'install' => 'install.php' + )); $session = Wootook::getSession('install'); $layout = new Wootook_Core_Layout(); @@ -82,8 +80,8 @@ $response = new Wootook_Core_Controller_Response_Http(); switch ($mode) { case 'intro': - $layout->getMessagesBlock()->prepareMessages('install'); $layout->load('install.intro'); + $layout->getMessagesBlock()->prepareMessages('install'); $session->setData('step', 1); break; @@ -113,8 +111,6 @@ case 'install': exit(0); } - $layout->getMessagesblock()->prepareMessages('install'); - $config = array( 'global' => array( 'storyline' => array( @@ -142,28 +138,28 @@ case 'install': ); $session->setData('config', serialize($config)); - Wootook::writeConfig($config); - $session->setData('step', STEP_DATABASE); $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_DATABASE))); $response->sendHeaders(); exit(0); } - $layout->getMessagesBlock()->prepareMessages('install'); $layout->load('install.step.system'); + $layout->getMessagesBlock()->prepareMessages('install'); break; case STEP_DATABASE: $config = unserialize($session->getData('config')); - $session->setFormData(array( - 'host' => $config['global']['database']['default']['params']['hostname'], - 'port' => $config['global']['database']['default']['params']['port'], - 'user' => $config['global']['database']['default']['params']['username'], - 'password' => $config['global']['database']['default']['params']['password'], - 'dbname' => $config['global']['database']['default']['params']['database'], - 'prefix' => $config['global']['database']['default']['table_prefix'], - )); + if (isset($config['global']['database'])) { + $session->setFormData(array( + 'host' => $config['global']['database']['default']['params']['hostname'], + 'port' => $config['global']['database']['default']['params']['port'], + 'user' => $config['global']['database']['default']['params']['username'], + 'password' => $config['global']['database']['default']['params']['password'], + 'dbname' => $config['global']['database']['default']['params']['database'], + 'prefix' => $config['global']['database']['default']['table_prefix'], + )); + } if ($request->isPost()) { $form = new Wootook_Core_Form($session, array( @@ -214,8 +210,6 @@ case 'install': exit(0); } - $layout->getMessagesblock()->prepareMessages('install'); - $config = unserialize($session->getData('config')); $config['global']['database'] = array( 'default' => array( @@ -249,8 +243,8 @@ case 'install': exit(0); } - $layout->getMessagesBlock()->prepareMessages('install'); $layout->load('install.step.database'); + $layout->getMessagesBlock()->prepareMessages('install'); break; case STEP_UNIVERSE: @@ -319,12 +313,27 @@ case 'install': } } catch (Wootook_Core_Setup_Exception_VersionStageError $e) { Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); + + $session->addError($e->getMessage()); + $session->setData('step', STEP_UNIVERSE); + $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE))); + $response->sendHeaders(); continue; } catch (Wootook_Core_Setup_Exception_VersionValueError $e) { Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); + + $session->addError($e->getMessage()); + $session->setData('step', STEP_UNIVERSE); + $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE))); + $response->sendHeaders(); continue; } catch (Wootook_Core_Setup_Exception_RuntimeException $e) { Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); + + $session->addError($e->getMessage()); + $session->setData('step', STEP_UNIVERSE); + $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE))); + $response->sendHeaders(); continue; } } @@ -339,8 +348,8 @@ case 'install': exit(0); } - $layout->getMessagesBlock()->prepareMessages('install'); $layout->load('install.step.universe'); + $layout->getMessagesBlock()->prepareMessages('install'); break; case STEP_PROFILE: @@ -358,6 +367,7 @@ case 'install': if (!$form->validate()) { $session->setData('step', STEP_PROFILE); $session->setFormData($request->getData()); + $session->addError(Wootook::__('Form data error.')); $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); $response->sendHeaders(); exit(0); @@ -375,26 +385,48 @@ case 'install': if ($request->getPost('email') != $request->getPost('email_confirm')) { $session->setData('step', STEP_PROFILE); $session->setFormData($request->getData()); - $session->addError(Wootook::__('e-mails does not match.')); + $session->addError(Wootook::__('Both e-mails does not match.')); $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); $response->sendHeaders(); exit(0); } - Wootook_Empire_Model_User::register($request->getPost('username'), $request->getPost('email'), $request->getPost('password')); + try { + $user = Wootook_Empire_Model_User::register($request->getPost('username'), $request->getPost('email'), $request->getPost('password')); + } catch (Wootook_Empire_Exception_RuntimeException $e) { + } + $layout->getMessagesBlock()->prepareMessages('user'); + if (!$user->getId()) { + $session->setData('step', STEP_PROFILE); + $session->setFormData($request->getData()); + $session->addError(Wootook::__('Could not create user.')); + $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); + $response->sendHeaders(); + exit(0); + } else { + Wootook_Empire_Model_User::setLoggedIn($user); + + $user->setData('authlevel', LEVEL_ADMIN)->save(); + } $session->setData('step', STEP_CONFIG); - $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_CONFIG))); + //$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_CONFIG))); + $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'summary'))); $response->sendHeaders(); exit(0); } - $layout->getMessagesBlock()->prepareMessages('install'); $layout->load('install.step.profile'); + $layout->getMessagesBlock()->prepareMessages('install'); break; case STEP_CONFIG: - if (empty($_POST)) { + //* + $response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'summary'))); + $response->sendHeaders(); + exit(0); + /*/ + if ($request->isPost()) { $session->setData('step', $step); $response->setRedirect("?mode=install&step={$nextStep}"); $response->sendHeaders(); @@ -402,197 +434,15 @@ case 'install': } $layout->getMessagesBlock()->prepareMessages('install'); - $layout->load('install.config'); + $layout->load('install.step.config'); + //*/ break; } break; - - case 'ins': - if ($page == 1) { - if (isset($_GET['error']) && intval($_GET['error']) == 1) { - adminMessage ($lang['ins_error1'], $lang['ins_error']); - } - elseif (isset($_GET['error']) && intval($_GET['error']) == 2) { - adminMessage ($lang['ins_error2'], $lang['ins_error']); - } - - $subTpl = gettemplate('install/ins_form'); - $bloc = $lang; - $bloc['dpath'] = $dpath; - $frame = parsetemplate($subTpl, $bloc); - } else if ($page == 2) { - $host = $_POST['host']; - $user = $_POST['user']; - $pass = $_POST['passwort']; - $prefix = $_POST['prefix']; - $db = $_POST['db']; - - $connection = @mysql_connect($host, $user, $pass); - if (!$connection) { - header("Location: ?mode=ins&page=1&error=1"); - exit(); - } - - $dbselect = @mysql_select_db($db); - if (!$dbselect) { - header("Location: ?mode=ins&page=1&error=1"); - exit(); - } - - $dz = fopen("../config.php", "w"); - if (!$dz) { - header("Location: ?mode=ins&page=1&error=2"); - exit(); - } - $fileData =<< array( - 'database' => array( - 'engine' => 'mysql', - 'options' => array( - 'hostname' => '{$host}', - 'username' => '{$user}', - 'password' => '{$pass}', - 'database' => '{$db}' - ), - 'table_prefix' => '{$prefix}', - ) - ) - ); -EOF; - fwrite($dz, $fileData); - fclose($dz); - - doquery ( $QryTableAks , 'aks' ); - doquery ( $QryTableAnnonce , 'annonce' ); - doquery ( $QryTableAlliance , 'alliance' ); - doquery ( $QryTableBanned , 'banned' ); - doquery ( $QryTableBuddy , 'buddy' ); - doquery ( $QryTableChat , 'chat' ); - doquery ( $QryTableConfig , 'config' ); - doquery ( $QryInsertConfig , 'config' ); - doquery ( $QryTabledeclared , 'declared' ); - doquery ( $QryTableErrors , 'errors' ); - doquery ( $QryTableFleets , 'fleets' ); - doquery ( $QryTableGalaxy , 'galaxy' ); - doquery ( $QryTableIraks , 'iraks' ); - doquery ( $QryTableLunas , 'lunas' ); - doquery ( $QryTableMessages , 'messages' ); - doquery ( $QryTableNotes , 'notes' ); - doquery ( $QryTablePlanets , 'planets' ); - doquery ( $QryTableRw , 'rw' ); - doquery ( $QryTableStatPoints , 'statpoints' ); - doquery ( $QryTableUsers , 'users' ); - doquery ( $QryTableMulti , 'multi' ); - - $subTpl = gettemplate ('install/ins_form_done'); - $bloc = $lang; - $bloc['dpath'] = $dpath; - $frame = parsetemplate ( $subTpl, $bloc ); - } elseif ($page == 3) { - if (isset($_GET['error']) && intval($_GET['error']) == 3) { - adminMessage($lang['ins_error3'], $lang['ins_error']); - } - - $subTpl = gettemplate ('install/ins_acc'); - $bloc = $lang; - $bloc['dpath'] = $dpath; - $frame = parsetemplate ( $subTpl, $bloc ); - } elseif ($page == 4) { - $adm_user = $_POST['adm_user']; - $adm_pass = $_POST['adm_pass']; - $adm_email = $_POST['adm_email']; - $adm_planet = $_POST['adm_planet']; - $adm_sex = $_POST['adm_sex']; - $md5pass = md5($adm_pass); - - if (!isset($_POST['adm_user'])) { - header("Location: ?mode=ins&page=3&error=3"); - exit(); - } - if (!isset($_POST['adm_pass'])) { - header("Location: ?mode=ins&page=3&error=3"); - exit(); - } - if (!isset($_POST['adm_email'])) { - header("Location: ?mode=ins&page=3&error=3"); - exit(); - } - if (!isset($_POST['adm_planet'])) { - header("Location: ?mode=ins&page=3&error=3"); - exit(); - } - - $config = include(ROOT_PATH . 'config.php'); - $db_host = $config['global']['database']['options']['hostname']; - $db_user = $config['global']['database']['options']['username']; - $db_pass = $config['global']['database']['options']['password']; - $db_db = $config['global']['database']['options']['database']; - $db_prefix = $config['global']['database']['table_prefix']; - - $connection = @mysql_connect($db_host, $db_user, $db_pass); - if (!$connection) { - header("Location: ?mode=ins&page=1&error=1"); - exit(); - } - - $dbselect = @mysql_select_db($db_db); - if (!$dbselect) { - header("Location: ?mode=ins&page=1&error=1"); - exit(); - } - - $QryInsertAdm = "INSERT INTO {{table}} SET "; - $QryInsertAdm .= "`id` = '1', "; - $QryInsertAdm .= "`username` = '". $adm_user ."', "; - $QryInsertAdm .= "`email` = '". $adm_email ."', "; - $QryInsertAdm .= "`email_2` = '". $adm_email ."', "; - $QryInsertAdm .= "`authlevel` = '3', "; - $QryInsertAdm .= "`sex` = '". $adm_sex ."', "; - $QryInsertAdm .= "`id_planet` = '1', "; - $QryInsertAdm .= "`galaxy` = '1', "; - $QryInsertAdm .= "`system` = '1', "; - $QryInsertAdm .= "`planet` = '1', "; - $QryInsertAdm .= "`current_planet` = '1', "; - $QryInsertAdm .= "`register_time` = '". time() ."', "; - $QryInsertAdm .= "`password` = '". $md5pass ."';"; - doquery($QryInsertAdm, 'users'); - - $QryAddAdmPlt = "INSERT INTO {{table}} SET "; - $QryAddAdmPlt .= "`name` = '". $adm_planet ."', "; - $QryAddAdmPlt .= "`id_owner` = '1', "; - $QryAddAdmPlt .= "`galaxy` = '1', "; - $QryAddAdmPlt .= "`system` = '1', "; - $QryAddAdmPlt .= "`planet` = '1', "; - $QryAddAdmPlt .= "`last_update` = '". time() ."', "; - $QryAddAdmPlt .= "`planet_type` = '1', "; - $QryAddAdmPlt .= "`image` = 'normaltempplanet02', "; - $QryAddAdmPlt .= "`diameter` = '12750', "; - $QryAddAdmPlt .= "`field_max` = '163', "; - $QryAddAdmPlt .= "`temp_min` = '47', "; - $QryAddAdmPlt .= "`temp_max` = '87', "; - $QryAddAdmPlt .= "`metal` = '500', "; - $QryAddAdmPlt .= "`metal_perhour` = '0', "; - $QryAddAdmPlt .= "`metal_max` = '1000000', "; - $QryAddAdmPlt .= "`crystal` = '500', "; - $QryAddAdmPlt .= "`crystal_perhour` = '0', "; - $QryAddAdmPlt .= "`crystal_max` = '1000000', "; - $QryAddAdmPlt .= "`deuterium` = '500', "; - $QryAddAdmPlt .= "`deuterium_perhour` = '0', "; - $QryAddAdmPlt .= "`deuterium_max` = '1000000';"; - doquery($QryAddAdmPlt, 'planets'); - - $QryAddAdmGlx = "INSERT INTO {{table}} SET "; - $QryAddAdmGlx .= "`galaxy` = '1', "; - $QryAddAdmGlx .= "`system` = '1', "; - $QryAddAdmGlx .= "`planet` = '1', "; - $QryAddAdmGlx .= "`id_planet` = '1'; "; - doquery($QryAddAdmGlx, 'galaxy'); - - $subTpl = gettemplate ('install/ins_acc_done'); - $frame = parsetemplate ( $subTpl, $lang ); - } - break; +case 'summary': + $layout->load('install.summary'); + $layout->getMessagesBlock()->prepareMessages('install'); + break; } echo $layout->render(); diff --git a/leftmenu.php b/leftmenu.php deleted file mode 100644 index cbed2b5..0000000 --- a/leftmenu.php +++ /dev/null @@ -1,111 +0,0 @@ - - * All rights reserved. - * - * 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 . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ - -define('INSIDE' , true); -define('INSTALL' , false); -require_once dirname(__FILE__) .'/application/bootstrap.php'; - -function ShowLeftMenu ( $Level , $Template = 'left_menu') { - global $lang, $user, $dpath, $gameConfig; - - includeLang('leftmenu'); - - $MenuTPL = gettemplate( $Template ); - $InfoTPL = gettemplate( 'serv_infos' ); - $parse = $lang; - $parse['lm_tx_serv'] = $gameConfig['resource_multiplier']; - $parse['lm_tx_game'] = $gameConfig['game_speed'] / 2500; - $parse['lm_tx_fleet'] = $gameConfig['fleet_speed'] / 2500; - $parse['lm_tx_queue'] = MAX_FLEET_OR_DEFS_PER_ROW; - $SubFrame = parsetemplate( $InfoTPL, $parse ); - $parse['server_info'] = $SubFrame; - $parse['WootookRelease'] = VERSION; - $parse['dpath'] = $dpath; - $parse['forum_url'] = $gameConfig['forum_url']; - $parse['mf'] = "Hauptframe"; - $rank = doquery("SELECT `total_rank` FROM {{table}} WHERE `stat_code` = '1' AND `stat_type` = '1' AND `id_owner` = '". $user['id'] ."';",'statpoints',true); - $parse['user_rank'] = $rank['total_rank']; - if ($Level > 0) { - $parse['ADMIN_LINK'] = " -
" . $lang['ov_news_title'] . "" . stripslashes($gameConfig['OverviewNewsText']) . "
" . $lang['ov_news_title'] . "" . htmlentities(Wootook::getGameConfig('game/news/content'), ENT_QUOTES, 'UTF-8') . "
" . stripslashes($gameConfig['OverviewExternChatCmd']) . "
" . Wootook::__('Open the chat.') . "

".$lang['InfoBanner']."

".$lang['InfoBanner']."