Skip to content

Commit

Permalink
Fixed some bugs
Browse files Browse the repository at this point in the history
+If you conquer a village with an artifact inside, the new owner will be
changed correctly
+Moved plus links under the menu
+Renewed the "debug" function in Logging.php
+Fixed some errors that could have shown in Ranking.php
  • Loading branch information
iopietro committed Apr 8, 2018
1 parent b5037e1 commit 6ea4430
Show file tree
Hide file tree
Showing 27 changed files with 65 additions and 56 deletions.
5 changes: 2 additions & 3 deletions GameEngine/Automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public function __construct() {
{
$this->demolitionComplete();
}
// TODO: check if commenting-out this next line affected anything (it shouldn't) and should improve performance
//$this->updateStore();

$this->delTradeRoute();
$this->TradeRoute();
if(!file_exists("GameEngine/Prevention/market.txt") or time()-filemtime("GameEngine/Prevention/market.txt")>50) {
Expand Down Expand Up @@ -2571,7 +2570,7 @@ private function sendunitsComplete() {
} else if (!$village_destroyed) {
// you took over the village
$villname = addslashes($database->getVillageField($data['to'],"name"));
$artifact = $database->getOwnArtefactInfo($data['to']);
$artifact = reset($database->getOwnArtefactInfo($data['to']));

$info_chief = "".$chief_pic.",Inhabitants of ".$villname." village decided to join your empire.";

Expand Down
16 changes: 5 additions & 11 deletions GameEngine/Logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,11 @@ public function clearLogs() {
global $database;
}

public function debug($time,$uid,$debug_info) {
global $database;
list($time,$uid,$debug_info) = $database->escape_input((int) $time,(int) $uid,$debug_info);

//$debugFile = "/tmp/debug";
//$fh = fopen($debugFile, 'a') or die('No debug file');
//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);
public function debug($debug_info, $time = 0) {
global $database, $generator;
list($debug_info) = $database->escape_input($debug_info);

echo '<script>console.log('.json_encode(($time > 0 ? "[".$generator->procMtime($time)[1]."] " : "").$debug_info).')</script>';
}
};

Expand Down
18 changes: 10 additions & 8 deletions GameEngine/Ranking.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ public function getRank() {
}

public function getUserRank($id) {
global $database;
$ranking = $this->getRank();
$users = "SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8");
$users2 = mysqli_fetch_array(mysqli_query($GLOBALS['link'],$users), MYSQLI_ASSOC);
$users2 = mysqli_fetch_array(mysqli_query($database->dblink,$users), MYSQLI_ASSOC);
$users2 = $users2['Total'];
$users3 = $users2+1;
$myrank = 0;
Expand Down Expand Up @@ -220,7 +221,7 @@ public function searchRank($name, $field) {
}

public function procRankArray() {
global $multisort;
global $multisort, $database;
if($GLOBALS['db']->countUser() > 0){
$holder = array();
if(SHOW_NATARS == True){
Expand Down Expand Up @@ -273,7 +274,7 @@ public function procRankArray() {

$datas = array();

$result = (mysqli_query($GLOBALS['link'],$q));
$result = (mysqli_query($database->dblink,$q));
while($row = mysqli_fetch_assoc($result)) {
$datas[] = $row;
}
Expand All @@ -300,7 +301,7 @@ public function procRankArray() {
}

public function procRankRaceArray($race) {
global $multisort,$database;
global $multisort, $database;
$race = $database->escape((int) $race);
//$array = $GLOBALS['db']->getRanking();
$holder = array();
Expand Down Expand Up @@ -331,7 +332,7 @@ public function procRankRaceArray($race) {
ORDER BY totalpop DESC, totalvillages DESC, userid DESC";


$result = (mysqli_query($GLOBALS['link'],$q));
$result = (mysqli_query($database->dblink,$q));
while($row = mysqli_fetch_assoc($result)) {
$datas[] = $row;
}
Expand Down Expand Up @@ -367,7 +368,7 @@ public function procRankRaceArray($race) {
}

public function procAttRankArray() {
global $multisort;
global $multisort, $database;
//$array = $GLOBALS['db']->getRanking();
$holder = array();

Expand All @@ -388,7 +389,7 @@ public function procAttRankArray() {
WHERE " . TB_PREFIX . "users.apall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3
AND " . TB_PREFIX . "users.id > 5
ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC, userid DESC";
$result = mysqli_query($GLOBALS['link'],$q) or die(mysqli_error($database->dblink));
$result = mysqli_query($database->dblink,$q) or die(mysqli_error($database->dblink));
while($row = mysqli_Fetch_assoc($result)) {
$datas[] = $row;
}
Expand All @@ -413,6 +414,7 @@ public function procAttRankArray() {
}

public function procDefRankArray() {
global $database;
//global $GLOBALS['db'], $multisort;
//$array = $GLOBALS['db']->getRanking();
$holder = array();
Expand All @@ -431,7 +433,7 @@ public function procDefRankArray() {
WHERE " . TB_PREFIX . "users.dpall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3
AND " . TB_PREFIX . "users.id > 5
ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC, userid DESC";
$result = mysqli_query($GLOBALS['link'],$q) or die(mysqli_error($database->dblink));
$result = mysqli_query($database->dblink,$q) or die(mysqli_error($database->dblink));
while($row = mysqli_Fetch_assoc($result)) {
$datas[] = $row;
}
Expand Down
2 changes: 1 addition & 1 deletion Templates/links.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ while($data = mysqli_fetch_assoc($query)) {
$links[] = $data;
}

print '<br /><br /><table id="vlist" cellpadding="1" cellspacing="1"><thead><tr><td colspan="3"><a href="spieler.php?s=2">Links:</a></td></tr></thead><tbody>';
print '<table cellpadding="1" cellspacing="1"><thead><tr><td colspan="3"><a href="spieler.php?s=2">Links:</a></td></tr></thead><tbody>';
foreach($links as $link) {
// Check, if the url is extern
if(substr($link['url'], -1, 1) == '*') {
Expand Down
11 changes: 6 additions & 5 deletions Templates/menu.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,21 @@ div.c1 {text-align: center}
<a href="support.php"><b><?php echo SUPPORT;?></b></a>
<?php
}
include("Templates/links.tpl");
?>
<br></p>
</p>
<?php
$timestamp = $database->isDeleting($session->uid);
if($timestamp) {
echo "<td colspan=\"2\" class=\"count\">";
echo "<br /><td colspan=\"2\" class=\"count\">";
if($timestamp > time()+48*3600) {
echo "<a href=\"spieler.php?s=3&id=".$session->uid."&a=1&e=4\"><img
class=\"del\" src=\"img/x.gif\" alt=\"Cancel process\"
title=\"Cancel process\" /> </a>";
}
$time=$generator->getTimeFormat(($timestamp-time()));
echo "<a href=\"spieler.php?s=3\"> The account will be deleted in <span
id=\"timer1\">".$time."</span> .</a></td>";
id=\"timer1\">".$time."</span> .</a></td><br />";
}
?>
</div><?php
Expand All @@ -88,11 +89,11 @@ div.c1 {text-align: center}
<div id="content" class="village1">
<h1><?php echo ANNOUNCEMENT; ?></h1>
</br>
<br />
<h3>Hi <?php echo $session->username; ?>,</h3>
<?php include("Templates/text.tpl"); ?>
<div class="c1">
</br>
<br />
<h3><a href="dorf1.php?ok">&raquo; <?php echo GO2MY_VILLAGE; ?></a></h3>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion a2b.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion a2b2.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion banned.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion berichte.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion create_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ function Artefact($uid, $type, $size, $art_name, $village_name, $desc, $effect,
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion crop_finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ function getDistance($coorx1, $coory1, $coorx2, $coory2) {
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion dorf1.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion dorf2.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion dorf3.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
<?php
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
32 changes: 32 additions & 0 deletions gpack/travian_default/lang/en/compact.css
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,28 @@ div#side_navi p.deltimer a {
padding: 0;
text-align: center;
}
div#side_navi table {
background-color: #FFFFFF;
width: auto;
padding-left: 12px;
}
div#side_navi table td {
line-height: 18px;
padding: 0;
text-align: left;
white-space: nowrap;
}
div#side_navi table thead td {
background-color: #FFFFFF;
height: 22px;
}
div#side_navi td.dot {
padding: 0 6px;
width: 10px;
}
div#side_navi td.link {
padding-right: 10px;
}
div#side_info {
float: left;
padding-left: 10px;
Expand Down Expand Up @@ -5908,6 +5930,16 @@ div#side_navi p.deltimer a {
div#side_navi p.deltimer a span {
color: #FF8000;
}
div#side_navi table thead td a {
color: black;
font-weight: bold;
}
div#side_navi table tbody td {
font-size: 11px;
}
div#side_navi td.link {
font-size: 13px;
}
div#side_info h6 {
color: #FF8000;
font-size: 13px;
Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<script src="mt-more.js?0faab" type="text/javascript"></script>
<script src="unx.js?f4b7h" type="text/javascript"></script>
<script src="new.js?0faab" type="text/javascript"></script>
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7i" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7h" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7d" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE ?>travian.css?f4b7d" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE ?>lang/en/lang.css" rel="stylesheet" type="text/css" />
Expand Down
1 change: 0 additions & 1 deletion nachrichten.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion spieler.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ function med_showDescription(coords, desc_string){
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion statistiken.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
1 change: 0 additions & 1 deletion support.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ function chkFormular () {
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");
include("Templates/news.tpl");
include("Templates/links.tpl");
?>
</div>
<div class="clear"></div>
Expand Down
6 changes: 3 additions & 3 deletions sysmsg.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
AccessLogger::logRequest();

$max_per_pass = 1000;
if (mysqli_num_rows(mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users WHERE access = 9 AND id = ".$session->uid)) != '1') die("Hacking attempt!");
if (mysqli_num_rows(mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE access = 9 AND id = ".$session->uid)) != '1') die("Hacking attempt!");

if(isset($_GET['del'])){
mysqli_query($GLOBALS['link'], "UPDATE ".TB_PREFIX."users SET ok = 0");
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."users SET ok = 0");
}

if (@$_POST['submit'] == "Send")
Expand All @@ -44,7 +44,7 @@
// $text = utf8_encode($text);
fwrite($fh, $text);

mysqli_query($GLOBALS['link'], "UPDATE ".TB_PREFIX."users SET ok = 1");
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."users SET ok = 1");

$done = true;
} else { die("<br/><br/><br/>wrong"); }
Expand Down
Loading

0 comments on commit 6ea4430

Please sign in to comment.