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] 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"]) {