Fixed some bugs

+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
This commit is contained in:
iopietro
2018-04-08 18:28:24 +02:00
parent b5037e1c33
commit 6ea4430372
27 changed files with 65 additions and 56 deletions
+2 -3
View File
@@ -56,8 +56,7 @@ class Automation {
{
$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) {
@@ -2571,7 +2570,7 @@ class Automation {
} 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.";
+5 -11
View File
@@ -98,17 +98,11 @@ class Logging {
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>';
}
};
+10 -8
View File
@@ -19,9 +19,10 @@
}
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;
@@ -220,7 +221,7 @@
}
public function procRankArray() {
global $multisort;
global $multisort, $database;
if($GLOBALS['db']->countUser() > 0){
$holder = array();
if(SHOW_NATARS == True){
@@ -273,7 +274,7 @@
$datas = array();
$result = (mysqli_query($GLOBALS['link'],$q));
$result = (mysqli_query($database->dblink,$q));
while($row = mysqli_fetch_assoc($result)) {
$datas[] = $row;
}
@@ -300,7 +301,7 @@
}
public function procRankRaceArray($race) {
global $multisort,$database;
global $multisort, $database;
$race = $database->escape((int) $race);
//$array = $GLOBALS['db']->getRanking();
$holder = array();
@@ -331,7 +332,7 @@
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;
}
@@ -367,7 +368,7 @@
}
public function procAttRankArray() {
global $multisort;
global $multisort, $database;
//$array = $GLOBALS['db']->getRanking();
$holder = array();
@@ -388,7 +389,7 @@
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;
}
@@ -413,6 +414,7 @@
}
public function procDefRankArray() {
global $database;
//global $GLOBALS['db'], $multisort;
//$array = $GLOBALS['db']->getRanking();
$holder = array();
@@ -431,7 +433,7 @@
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;
}