From 74c4f31f7f7c9b2d15cb1719c4d0be2201fe0aaa Mon Sep 17 00:00:00 2001 From: Mandalorien Date: Tue, 22 Jan 2013 17:21:24 +0100 Subject: [PATCH 1/5] Update src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php correction --- .../core/Legacies/Empire/install/mysql5/install-1.5.0.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php b/src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php index c4fc32e..ba30531 100644 --- a/src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php +++ b/src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php @@ -351,8 +351,8 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('planets')} ( `gauss_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0, `ionic_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0, `buster_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0, - `small_protection_shield` ENUM('0','1') NOT NULL DEFAULT 0, - `big_protection_shield` ENUM('0','1') NOT NULL DEFAULT 0, + `small_protection_shield` ENUM('0','1') NOT NULL DEFAULT '0', + `big_protection_shield` ENUM('0','1') NOT NULL DEFAULT '0', `interceptor_misil` SMALLINT NOT NULL DEFAULT 0, `interplanetary_misil` SMALLINT NOT NULL DEFAULT 0, `metal_mine_porcent` TINYINT NOT NULL DEFAULT 10, From 4b92511baecccb576fae091aedab691eb9f75121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20TALON?= Date: Sun, 24 Feb 2013 17:56:44 +0100 Subject: [PATCH 2/5] Fix second parameter of function date (options.php) --- .gitignore | 1 + src/options.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c40f034..24b99ed 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ config.php .idea/ coverage/ src/application/cache/* +src/application/configs/local.php diff --git a/src/options.php b/src/options.php index a33c7bb..34c5b1e 100644 --- a/src/options.php +++ b/src/options.php @@ -250,7 +250,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null; $parse['opt_modev_data'] = ($user['urlaubs_modus'] == 1)?" checked='checked'/":''; $parse['opt_modev_exit'] = ($user['urlaubs_modus'] == 0)?" checked='1'/":''; $parse['Vaccation_mode'] = $lang['Vaccation_mode']; - $parse['vacation_until'] = date("d.m.Y G:i:s",$user['urlaubs_until']); + $parse['vacation_until'] = date("d.m.Y G:i:s",$user['urlaubs_until']->getTimestamp()); $parse['user_settings_rep'] = ($user['settings_rep'] == 1) ? " checked='checked'/":''; $parse['user_settings_esp'] = ($user['settings_esp'] == 1) ? " checked='checked'/":''; $parse['user_settings_wri'] = ($user['settings_wri'] == 1) ? " checked='checked'/":''; From 8ebc4cd91f744a5c836df7c4e06599a7918132cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20TALON?= Date: Sun, 24 Feb 2013 18:11:09 +0100 Subject: [PATCH 3/5] Fix undefined dpath (options.php) --- src/options.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/options.php b/src/options.php index 34c5b1e..dfe2ea2 100644 --- a/src/options.php +++ b/src/options.php @@ -49,15 +49,15 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null; message($lang['You_cant_exit_vmode'], $lan['Error'] ,"options.php",1); } } + + $dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; if ($_POST && $mode == "change") { // Array ( [db_character] - $iduser = $user["id"]; - $avatar = $_POST["avatar"]; + $iduser = $user["id"]; + $avatar = $_POST["avatar"]; - if ($_POST["dpath"] != "") - $dpath = $_POST["dpath"]; - else - $dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; + if ($_POST["dpath"] != "") + $dpath = $_POST["dpath"]; // Gestion des options speciales pour les admins if ($user['authlevel'] != LEVEL_PLAYER) { From 6f1e5e4467e1bfc44167f2ab57f8d2b64a1c21ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20TALON?= Date: Sun, 24 Feb 2013 19:01:04 +0100 Subject: [PATCH 4/5] Fix Marchand Fix undefined value in options.php --- src/marchand.php | 23 +++++++++++------------ src/options.php | 7 ++----- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/marchand.php b/src/marchand.php index 6f6876e..ed76401 100644 --- a/src/marchand.php +++ b/src/marchand.php @@ -39,13 +39,13 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) { $parse = $lang; - if ($_POST['ress'] != '') { + if (isset($_POST['ress']) && $_POST['ress'] != '') { $PageTPL = gettemplate('message_body'); $Error = false; $CheatTry = false; - $Metal = $_POST['metal']; - $Crystal = $_POST['cristal']; - $Deuterium = $_POST['deut']; + $Metal = isset($_POST['metal']) ? $_POST['metal'] : 0; + $Crystal = isset($_POST['cristal']) ? $_POST['cristal'] : 0; + $Deuterium = isset($_POST['deut']) ? $_POST['deut'] : 0; if ($Metal < 0) { $Metal *= -1; $CheatTry = true; @@ -72,8 +72,8 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) { case 'cristal': $Necessaire = (( $Metal * 0.5) + ( $Deuterium * 2)); - if ($CurrentPlanet['crystal'] > $Necessaire) { - $CurrentPlanet['crystal'] -= $Necessaire; + if ($CurrentPlanet['cristal'] > $Necessaire) { + $CurrentPlanet['cristal'] -= $Necessaire; } else { $Message = $lang['mod_ma_noten'] ." ". $lang['Crystal'] ."! "; $Error = true; @@ -94,17 +94,17 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) { if ($Error == false) { if ($CheatTry == true) { $CurrentPlanet['metal'] = 0; - $CurrentPlanet['crystal'] = 0; + $CurrentPlanet['cristal'] = 0; $CurrentPlanet['deuterium'] = 0; } else { $CurrentPlanet['metal'] += $Metal; - $CurrentPlanet['crystal'] += $Crystal; + $CurrentPlanet['cristal'] += $Crystal; $CurrentPlanet['deuterium'] += $Deuterium; } $QryUpdatePlanet = "UPDATE {{table}} SET "; $QryUpdatePlanet .= "`metal` = '". $CurrentPlanet['metal'] ."', "; - $QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet['crystal'] ."', "; + $QryUpdatePlanet .= "`cristal` = '". $CurrentPlanet['cristal'] ."', "; $QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet['deuterium'] ."' "; $QryUpdatePlanet .= "WHERE "; $QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."';"; @@ -118,7 +118,7 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) { } $parse['mes'] = $Message; } else { - if ($_POST['action'] != 2) { + if (!isset($_POST['action']) || $_POST['action'] != 2) { $PageTPL = gettemplate('marchand_main'); } else { $parse['mod_ma_res'] = "1"; @@ -145,8 +145,7 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) { $Page = parsetemplate ( $PageTPL, $parse ); return $Page; } - - $Page = ModuleMarchand ( $user, $planetrow ); + $Page = ModuleMarchand ( $user, $planet ); display ( $Page, $lang['mod_marchand'], true, '', false ); // ----------------------------------------------------------------------------------------------------------- diff --git a/src/options.php b/src/options.php index dfe2ea2..8490b7a 100644 --- a/src/options.php +++ b/src/options.php @@ -61,7 +61,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null; // Gestion des options speciales pour les admins if ($user['authlevel'] != LEVEL_PLAYER) { - if ($_POST['adm_pl_prot'] == 'on') { + if (isset($_POST['adm_pl_prot']) && $_POST['adm_pl_prot'] == 'on') { doquery ("UPDATE {{table}} SET `id_level` = '".$user['authlevel']."' WHERE `id_owner` = '".$user['id']."';", 'planets'); } else { doquery ("UPDATE {{table}} SET `id_level` = '0' WHERE `id_owner` = '".$user['id']."';", 'planets'); @@ -191,10 +191,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null; `settings_bud` = '$settings_bud', `settings_mis` = '$settings_mis', `settings_rep` = '$settings_rep', - `db_deaktjava` = '$db_deaktjava', - `kolorminus` = '$kolorminus', - `kolorplus` = '$kolorplus', - `kolorpoziom` = '$kolorpoziom' + `db_deaktjava` = '$db_deaktjava' WHERE `id` = '$iduser' LIMIT 1", "users"); if (isset($_POST["db_password"]) && md5($_POST["db_password"]) == $user["password"]) { From 5797328adcf7065b6c446b0c42b97f1c1a262e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20TALON?= Date: Sun, 24 Feb 2013 20:45:07 +0100 Subject: [PATCH 5/5] Fix date of messages and undefined var --- src/includes/functions/SendSimpleMessage.php | 2 +- src/messages.php | 19 ++++++++------- src/resources.php | 2 +- src/search.php | 25 ++++++++++---------- src/stat.php | 8 ++++--- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/includes/functions/SendSimpleMessage.php b/src/includes/functions/SendSimpleMessage.php index 3e19e1c..3d2b0ab 100644 --- a/src/includes/functions/SendSimpleMessage.php +++ b/src/includes/functions/SendSimpleMessage.php @@ -49,7 +49,7 @@ function SendSimpleMessage ( $Owner, $Sender, $Time, $Type, $From, $Subject, $Me $QryInsertMessage = "INSERT INTO {{table}} SET "; $QryInsertMessage .= "`message_owner` = '". $Owner ."', "; $QryInsertMessage .= "`message_sender` = '". $Sender ."', "; - $QryInsertMessage .= "`message_time` = '" . $Time . "', "; +// $QryInsertMessage .= "`message_time` = '" . $Time . "', "; $QryInsertMessage .= "`message_type` = '". $Type ."', "; $QryInsertMessage .= "`message_from` = '". addslashes( $From ) ."', "; $QryInsertMessage .= "`message_subject` = '". addslashes( $Subject ) ."', "; diff --git a/src/messages.php b/src/messages.php index bb8bb1d..9d080e5 100644 --- a/src/messages.php +++ b/src/messages.php @@ -40,11 +40,11 @@ if(!isset($user['authlevel'])) { includeLang('messages'); -$OwnerID = $_GET['id']; -$MessCategory = $_GET['messcat']; -$MessPageMode = (string) $_GET['mode']; -$DeleteWhat = $_POST['deletemessages']; -if (isset ($DeleteWhat)) { +$OwnerID = isset($_GET['id']) ? $_GET['id'] : null; +$MessCategory = isset($_GET['messcat']) ? $_GET['messcat'] : null; +$MessPageMode = isset($_GET['mode']) ? (string) $_GET['mode'] : null; +$DeleteWhat = isset($_POST['deletemessages']) ? $_POST['deletemessages'] : null; +if (!empty($DeleteWhat)) { $MessPageMode = "delete"; } @@ -55,6 +55,9 @@ $MessageType = array (0, 1, 2, 3, 4, 5, 15, 99, 100 ); $TitleColor = array (0 => '#FFFF00', 1 => '#FF6699', 2 => '#FF3300', 3 => '#FF9900', 4 => '#773399', 5 => '#009933', 15 => '#030070', 99 => '#007070', 100 => '#ABABAB'); $BackGndColor = array (0 => '#663366', 1 => '#336666', 2 => '#000099', 3 => '#666666', 4 => '#999999', 5 => '#999999', 15 => '#999999', 99 => '#999999', 100 => '#999999'); +$page = null; +$text = null; + for ($MessType = 0; $MessType < 101; $MessType++) { if (in_array($MessType, $MessageType) ) { $WaitingMess[$MessType] = $UnRead[$messfields[$MessType]]; @@ -230,7 +233,7 @@ $Message = trim ( nl2br ( strip_tags ( $_POST['text'], '
' ) ) ); } $page .= "". stripslashes( $CurMess['message_subject'] ) ." "; if ($CurMess['message_type'] == 1) { $page .= ""; - $page .= "\"".$lang['mess_answer']."\""; + $page .= "\"".$lang['mess_answer']."\""; } else { $page .= ""; } @@ -254,12 +257,12 @@ $Message = trim ( nl2br ( strip_tags ( $_POST['text'], '
' ) ) ); } $page .= "\n"; $page .= ""; $page .= ""; - $page .= "". date("m-d H:i:s O", $CurMess['message_time']) .""; + $page .= "". date("d-m-Y H:i:s", strtotime($CurMess['message_time'])) .""; $page .= "". stripslashes( $CurMess['message_from'] ) .""; $page .= "". stripslashes( $CurMess['message_subject'] ) ." "; if ($CurMess['message_type'] == 1) { $page .= ""; - $page .= "\"".$lang['mess_answer']."\""; + $page .= "\"".$lang['mess_answer']."\""; } else { $page .= ""; } diff --git a/src/resources.php b/src/resources.php index 222c86d..0d0ff77 100644 --- a/src/resources.php +++ b/src/resources.php @@ -252,7 +252,7 @@ $user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); $planet = $user->getCurrentPlanet(); $Page = BuildRessourcePage($user, $planet); -display($Page, $lang['Resources']); +display($Page, 'Resources', false); // ----------------------------------------------------------------------------------------------------------- // History version diff --git a/src/search.php b/src/search.php index 7a90a53..5b469f5 100644 --- a/src/search.php +++ b/src/search.php @@ -32,15 +32,15 @@ define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; -$searchtext = mysql_escape_string($_POST['searchtext']); -$type = $_POST['type']; +$searchtext = isset($_POST['searchtext']) ? mysql_escape_string($_POST['searchtext']) : null; +$type = isset($_POST['type']) ? $_POST['type'] : null; -$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; +$dpath = (empty($user["dpath"])) ? DEFAULT_SKINPATH : $user["dpath"]; includeLang('search'); +$search_results = null; +$result_list = null; $i = 0; -//creamos la query -$searchtext = mysql_escape_string($_POST["searchtext"]); switch($type){ case "playername": $table = gettemplate('search_user_table'); @@ -89,7 +89,7 @@ if(isset($searchtext) && isset($type)){ }else{ $pquery = doquery("SELECT name FROM {{table}} WHERE id = {$s['id_planet']}","planets",true); $s['planet_name'] = $pquery['name']; - $s['ally_name'] = ($aquery['ally_name']!='')?"{$aquery['ally_name']}":''; + $s['ally_name'] = (!empty($aquery['ally_name']))?"{$aquery['ally_name']}":''; } //ahora la alianza if($s['ally_id']!=0&&$s['ally_request']==0){ @@ -99,8 +99,9 @@ if(isset($searchtext) && isset($type)){ } - - $s['position'] = "".$s['rank'].""; + if (!empty($s['rank'])) { + $s['position'] = "".$s['rank'].""; + } $s['dpath'] = $dpath; $s['coordinated'] = "{$s['galaxy']}:{$s['system']}:{$s['planet']}"; $s['buddy_request'] = $lang['buddy_request']; @@ -122,10 +123,10 @@ if(isset($searchtext) && isset($type)){ } //el resto... -$lang['type_playername'] = ($_POST["type"] == "playername") ? " SELECTED" : ""; -$lang['type_planetname'] = ($_POST["type"] == "planetname") ? " SELECTED" : ""; -$lang['type_allytag'] = ($_POST["type"] == "allytag") ? " SELECTED" : ""; -$lang['type_allyname'] = ($_POST["type"] == "allyname") ? " SELECTED" : ""; +$lang['type_playername'] = (isset($_POST["type"]) && $_POST["type"] == "playername") ? " SELECTED" : ""; +$lang['type_planetname'] = (isset($_POST["type"]) && $_POST["type"] == "planetname") ? " SELECTED" : ""; +$lang['type_allytag'] = (isset($_POST["type"]) && $_POST["type"] == "allytag") ? " SELECTED" : ""; +$lang['type_allyname'] = (isset($_POST["type"]) && $_POST["type"] == "allyname") ? " SELECTED" : ""; $lang['searchtext'] = $searchtext; $lang['search_results'] = $search_results; //esto es algo repetitivo ... w diff --git a/src/stat.php b/src/stat.php index c623527..e99027e 100644 --- a/src/stat.php +++ b/src/stat.php @@ -35,19 +35,20 @@ require_once dirname(__FILE__) .'/application/bootstrap.php'; includeLang('stat'); $parse = $lang; -$who = (isset($_POST['who'])) ? $_POST['who'] : $_GET['who']; +$who = (isset($_POST['who'])) ? $_POST['who'] : isset($_GET['who']) ? $_GET['who'] : null; if (!isset($who)) { $who = 1; } -$type = (isset($_POST['type'])) ? $_POST['type'] : $_GET['type']; +$type = (isset($_POST['type'])) ? $_POST['type'] : isset($_GET['type']) ? $_GET['type'] : null; if (!isset($type)) { $type = 1; } -$range = (isset($_POST['range'])) ? $_POST['range'] : $_GET['range']; +$range = (isset($_POST['range'])) ? $_POST['range'] : isset($_GET['range']) ? $_GET['range'] : null; if (!isset($range)) { $range = 1; } +$start = 0; $parse['who'] = ""; $parse['who'] .= ""; @@ -144,6 +145,7 @@ if ($who == 2) { } } else { $MaxUsers = doquery ("SELECT COUNT(*) AS `count` FROM {{table}} WHERE `db_deaktjava` = '0';", 'users', true); + $LastPage = 0; if ($MaxUsers['count'] > 100) { $LastPage = floor($MaxUsers['count'] / 100); }