". $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 = "| ".$lang['sys_ship_type']." | ";
-
$raport2 = "
|---|
| ".$lang['sys_ship_count']." | ";
-
$raport3 = "
|---|
| ".$lang['sys_ship_weapon']." | ";
-
$raport4 = "
|---|
| ".$lang['sys_ship_shield']." | ";
-
$raport5 = "
|---|
| ".$lang['sys_ship_armour']." | ";
-
foreach ($b["atakujacy"] as $Ship => $Data) {
-
if (is_numeric($Ship)) {
-
if ($Data['count'] > 0) {
-
$raport1 .= "". $lang["tech_rc"][$Ship] ." | ";
-
$raport2 .= "". $Data['count'] ." | ";
-
$raport3 .= "". round($Data["atak"] / $Data['count']) ." | ";
-
$raport4 .= "". round($Data["tarcza"] / $Data['count']) ." | ";
-
$raport5 .= "". round($Data["obrona"] / $Data['count']) ." | ";
-
}
-
}
-
}
-
$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 .= " |
|---|
";
-
$raport .= " ".$DefenderData." ".$DefenderTech."";
-
if ($b["wrog"]['count'] > 0) {
-
$raport1 = "| ".$lang['sys_ship_type']." | ";
-
$raport2 = "
|---|
| ".$lang['sys_ship_count']." | ";
-
$raport3 = "
|---|
| ".$lang['sys_ship_weapon']." | ";
-
$raport4 = "
|---|
| ".$lang['sys_ship_shield']." | ";
-
$raport5 = "
|---|
| ".$lang['sys_ship_armour']." | ";
-
foreach ($b["wrog"] as $Ship => $Data) {
-
if (is_numeric($Ship)) {
-
if ($Data['count'] > 0) {
-
$raport1 .= "". $lang["tech_rc"][$Ship] ." | ";
-
$raport2 .= "". $Data['count'] ." | ";
-
$raport3 .= "". round($Data["atak"] / $Data['count']) ." | ";
-
$raport4 .= "". round($Data["tarcza"] / $Data['count']) ." | ";
-
$raport5 .= "". round($Data["obrona"] / $Data['count']) ." | ";
-
}
-
}
-
}
-
$raport1 .= " ";
-
$raport2 .= "";
-
$raport3 .= "";
-
$raport4 .= "";
-
$raport5 .= "";
-
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
-
} else {
-
$zniszczony = true;
-
$raport .= " ". $lang['sys_destroyed'];
-
}
$raport .= " |
|---|
";
-
-
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'] = "
-
- |
- ";
- } 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'] = "| " . $lang['ov_news_title'] . " | " . stripslashes($gameConfig['OverviewNewsText']) . " | ";
+ if (Wootook::getGameConfig('game/news/active')) {
+ $parse['NewsFrame'] = "| " . $lang['ov_news_title'] . " | " . htmlentities(Wootook::getGameConfig('game/news/content'), ENT_QUOTES, 'UTF-8') . " | ";
}
- if ($gameConfig['OverviewExternChat'] == '1') {
- $parse['ExternalTchatFrame'] = "| " . stripslashes($gameConfig['OverviewExternChatCmd']) . " | ";
+ if (Wootook::getGameConfig('engine/options/chat')) {
+ $parse['ExternalTchatFrame'] = "| " . Wootook::__('Open the chat.') . " | ";
}
- 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'] = " ".$lang['InfoBanner']."
| |
";
+ $parse['bannerframe'] = "