From 8a7f12268c14a700cbbe0f1793663944283f688e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Tue, 7 Nov 2017 10:34:50 +0100 Subject: [PATCH] fix: logging works, tech log link added to Admin --- Admin/Templates/techlog.tpl | 39 ++++++++++++++++++++++++ Admin/Templates/troopUpgrades.tpl | 2 +- Admin/Templates/villagelog.tpl | 8 +++-- Admin/admin.php | 10 ++++++ GameEngine/Admin/Mods/addABTroops.php | 3 +- GameEngine/Admin/Mods/addTroops.php | 2 +- GameEngine/Admin/Mods/editAdminInfo.php | 2 +- GameEngine/Admin/Mods/editExtraSet.php | 2 +- GameEngine/Admin/Mods/editLogSet.php | 2 +- GameEngine/Admin/Mods/editNewsboxSet.php | 2 +- GameEngine/Admin/Mods/editPlusSet.php | 2 +- GameEngine/Admin/Mods/editServerSet.php | 2 +- GameEngine/Logging.php | 16 +++++----- Templates/multivillage.tpl | 2 +- Templates/text.tpl | 29 +++++++++++++++++- 15 files changed, 100 insertions(+), 23 deletions(-) create mode 100644 Admin/Templates/techlog.tpl diff --git a/Admin/Templates/techlog.tpl b/Admin/Templates/techlog.tpl new file mode 100644 index 00000000..f3245533 --- /dev/null +++ b/Admin/Templates/techlog.tpl @@ -0,0 +1,39 @@ + +

+ + + + + + + + + + + + + + + + '; + } + ?> + +
's Research Log
#EventDate
'.++$j.''.$row['log'].''.$row['date'].'
\ No newline at end of file diff --git a/Admin/Templates/troopUpgrades.tpl b/Admin/Templates/troopUpgrades.tpl index 48967188..c6b61c99 100644 --- a/Admin/Templates/troopUpgrades.tpl +++ b/Admin/Templates/troopUpgrades.tpl @@ -54,7 +54,7 @@ if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!"); if($_SESSION['access'] == ADMIN) { if($tribe==5) { echo 'Upgrades Troops';} - else { echo 'Upgrades Troops';} + else { echo 'Upgrades TroopsResearch Log';} } if(isset($_GET['ab'])){ echo '
AB Tech Troops upgrades
'; diff --git a/Admin/Templates/villagelog.tpl b/Admin/Templates/villagelog.tpl index 244e51c7..68f1c4bb 100644 --- a/Admin/Templates/villagelog.tpl +++ b/Admin/Templates/villagelog.tpl @@ -10,20 +10,22 @@ if(isset($id)) 's Build Log - # + # Event + Date - '.$j.' + '.++$j.' '.$row['log'].' + '.$row['date'].' '; } ?> diff --git a/Admin/admin.php b/Admin/admin.php index 06abc531..1069e6d7 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -351,6 +351,16 @@ if (!empty($_GET['p'])) { $subpage = 'Build Log (no village)'; } break; + + case 'techlog': + if (!empty($_GET['did'])) { + $village = $database->getVillage($_GET['did']); + $user = $database->getUserArray($village['owner'],1); + $subpage = 'Research Log ('.$village['name'].' » '.$user['username'].')'; + } else { + $subpage = 'Research Log (no village)'; + } + break; } } diff --git a/GameEngine/Admin/Mods/addABTroops.php b/GameEngine/Admin/Mods/addABTroops.php index 94d84a18..d3477fdd 100755 --- a/GameEngine/Admin/Mods/addABTroops.php +++ b/GameEngine/Admin/Mods/addABTroops.php @@ -8,7 +8,6 @@ ## Copyright: TravianZ (c) 2010-2014. All rights reserved. ## ## ## ################################################################################# - if(!isset($_SESSION)) session_start(); if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!"); include_once("../../Database.php"); @@ -25,7 +24,7 @@ for($i=1; $i<9; $i++) { $q = "UPDATE ".TB_PREFIX."abdata SET ".$atech.$btech." WHERE vref = $id"; $database->query($q); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop anmount in village $id ',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop upgrade levels in village $id ',".time().")"); header("Location: ../../../Admin/admin.php?p=village&did=".$id."&ab"); diff --git a/GameEngine/Admin/Mods/addTroops.php b/GameEngine/Admin/Mods/addTroops.php index 5265222e..a52ccafa 100755 --- a/GameEngine/Admin/Mods/addTroops.php +++ b/GameEngine/Admin/Mods/addTroops.php @@ -31,7 +31,7 @@ for($i=1; $i<11; $i++) { } $q = "UPDATE ".TB_PREFIX."units SET ".$units." WHERE vref = ".(int) $id; $database->query($q); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop anmount in village $id ',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop amounts in village $id ',".time().")"); header("Location: ../../../Admin/admin.php?p=village&did=".$id."&d"); ?> \ No newline at end of file diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 4cb12b81..7180b8cc 100755 --- a/GameEngine/Admin/Mods/editAdminInfo.php +++ b/GameEngine/Admin/Mods/editAdminInfo.php @@ -126,7 +126,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con fwrite($fh, $text); fclose($fh); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed server setting',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed Admin Info',".time().")"); header("Location: ../../../Admin/admin.php?p=config"); diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php index 0593e3b4..c9c52aba 100755 --- a/GameEngine/Admin/Mods/editExtraSet.php +++ b/GameEngine/Admin/Mods/editExtraSet.php @@ -123,7 +123,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con fwrite($fh, $text); fclose($fh); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed server setting',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed Extra server settings',".time().")"); header("Location: ../../../Admin/admin.php?p=config"); diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php index 713fd6c6..da8bc74f 100755 --- a/GameEngine/Admin/Mods/editLogSet.php +++ b/GameEngine/Admin/Mods/editLogSet.php @@ -123,7 +123,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con fwrite($fh, $text); fclose($fh); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed server setting',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed Log Settings',".time().")"); header("Location: ../../../Admin/admin.php?p=config"); diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php index 63bd6f4c..ca895b95 100755 --- a/GameEngine/Admin/Mods/editNewsboxSet.php +++ b/GameEngine/Admin/Mods/editNewsboxSet.php @@ -130,7 +130,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con fwrite($fh, $text); fclose($fh); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed server setting',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed NewsBox Settings',".time().")"); header("Location: ../../../Admin/admin.php?p=config"); diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php index 6bb63030..c1438ed8 100644 --- a/GameEngine/Admin/Mods/editPlusSet.php +++ b/GameEngine/Admin/Mods/editPlusSet.php @@ -107,7 +107,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con fwrite($fh, $text); fclose($fh); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed PLUS setting',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed PLUS Settings',".time().")"); header("Location: ../../../Admin/admin.php?p=config"); diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index f35fef2b..f064a3e0 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -118,7 +118,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con fwrite($fh, $text); fclose($fh); -$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed server setting',".time().")"); +$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$id.",'Changed General Server Settings',".time().")"); header("Location: ../../../Admin/admin.php?p=config"); diff --git a/GameEngine/Logging.php b/GameEngine/Logging.php index 43054577..2e9f8e4d 100755 --- a/GameEngine/Logging.php +++ b/GameEngine/Logging.php @@ -21,7 +21,7 @@ class Logging { $log .= "access village $ref"; break; } - $q = "Insert into ".TB_PREFIX."illegal_log values (0,$uid,'$log')"; + $q = "Insert into ".TB_PREFIX."illegal_log SET user = $uid, log = '$log'"; $database->query($q); } } @@ -30,7 +30,7 @@ class Logging { global $database; list($id,$ip) = $database->escape_input((int) $id,$ip); if(LOG_LOGIN) { - $q = "Insert into ".TB_PREFIX."login_log values (0,$id,'$ip')"; + $q = "Insert into ".TB_PREFIX."login_log SET uid = $id, ip = '".$_SERVER['REMOTE_ADDR']."'"; $database->query($q); } } @@ -45,8 +45,8 @@ class Logging { else { $log = "Start Upgrade of "; } - $log .= $building." at level ".$level; - $q = "Insert into ".TB_PREFIX."build_log values (0,$wid,'$log')"; + $log .= $building." to level ".$level; + $q = "Insert into ".TB_PREFIX."build_log SET wid = $wid, log = '$log'"; $database->query($q); } } @@ -56,7 +56,7 @@ class Logging { list($wid,$tech,$level) = $database->escape_input((int) $wid,$tech,$level); if(LOG_TECH) { $log = "Upgrading of tech ".$tech." to level ".$level; - $q = "Insert into ".TB_PREFIX."tech_log values (0,$wid,'$log')"; + $q = "Insert into ".TB_PREFIX."tech_log SET wid = $wid, log = '$log'"; $database->query($q); } } @@ -85,7 +85,7 @@ class Logging { else if($type == 2) { $log = "Traded resource between ".$wid." and ".$data[0]." market ref is ".$data[1]; } - $q = "Insert into ".TB_PREFIX."market_log values (0,$wid,'$log')"; + $q = "Insert into ".TB_PREFIX."market_log SET wid = $wid, log = '$log'"; $database->query($q); } } @@ -107,8 +107,8 @@ class Logging { //fwrite($fh,"\n".date("Y-m-d H:i:s")." : ".$time.",".$uid.",".$debug_info."\n"); //fclose($fh); - $q = "INSERT INTO ".TB_PREFIX."debug_log (time,uid,debug_info) VALUES ($time,$uid,'$debug_info')"; - $database->query($q); + //$q = "INSERT INTO ".TB_PREFIX."debug_log (time,uid,debug_info) VALUES ($time,$uid,'$debug_info')"; + //$database->query($q); } }; diff --git a/Templates/multivillage.tpl b/Templates/multivillage.tpl index c855b823..f251e627 100644 --- a/Templates/multivillage.tpl +++ b/Templates/multivillage.tpl @@ -63,7 +63,7 @@ else if(isset($_GET['c'])) { for($i=1;$i<=count($session->villages);++$i){echo' ● - '.$returnVillageArray[$i-1]['name'].' + '.$returnVillageArray[$i-1]['name'].'
('.$returnVillageArray[$i-1]['x'].'
|
'.$returnVillageArray[$i-1]['y'].')
'; } } diff --git a/Templates/text.tpl b/Templates/text.tpl index 200b79df..3efb5a41 100644 --- a/Templates/text.tpl +++ b/Templates/text.tpl @@ -10,7 +10,34 @@ ################################################################################# -$txt="sdsad"; +$txt="World Wonder Construction Plans + + +Many moons ago the tribes of Travian were surprised by the unforeseen return of the Natars. This tribe from immemorial times surpassing all in wisdom, might and glory was about to trouble the free ones again. Thus they put all their efforts in preparing a last war against the Natars and vanquishing them forever. Many thought about the so-called 'Wonders of the World', a construction of many legends, as the only solution. It was told that it would render anyone invincible once completed. Ultimately making the constructors the rulers and conquerors of all known Travian. + +However, it was also told that one would need construction plans to construct such a building. Due to this fact, the architects devised cunning plans about how to store these safely. After a while, one could see temple-like buildings in many a city and metropolis - the Treasure Chambers (Treasuries). + +Sadly, no one - not even the wise and well versed - knew where to find these construction plans. The harder people tried to locate them, the more it seemed as if they where only legends. + +Today, however, this last secret will be revealed. Deprivations and endeavors of the past will not have been in vain, as today scouts of several tribes have successfully obtained the whereabouts of the construction plans. Well guarded by the Natars, they lie hidden in several oases to be found all over Travian. Only the most valiant heroes will be able to secure such a plan and bring it home safely so that the construction can begin. + +In the end, we will see whether the free tribes of Travian can once again outwit the Natars and vanquish them once and for all. Do not be so foolish as to assume that the Natars will leave without a fight, though! + + + +To steal a set of Construction Plans from the Natars, the following things must happen: +- You must Attack the village (NOT Raid!) +- You must WIN the Attack +- You must DESTROY the Treasure Chamber (Treasury) +- Your Hero MUST be in that attack, as he is the only one who may carry the Construction Plans +- An empty level 10 Treasure Chamber (Treasury) MUST be in the village where that attack came from +NOTE: If the above criteria is not met during the attack, the next attack on that village which does meet the above criteria will take the Construction Plans. + + + +To build a Treasure Chamber (Treasury), you will need a Main Building level 10 and the village MUST NOT be contain a World Wonder. + +To build a World Wonder, you must own the Construction Plans yourself (you = the World Wonder Village Owner) from level 0 to 50, and then from level 51 to 100 you will need an additional set of Construction Plans in your Alliance! Two sets of Construction Plans in the World Wonder Village Account will not work!"; //bbcode = html code $txt = preg_replace("/\[b\]/is",'', $txt);