Reports refactor #1

-Removed 29 files from the "Templates/Notice" folder, there were a lot
of duplicated/very similar kinds of report. Now, there are only 6 kinds
of report (9.tpl isn't counted)
+Changed a lot of codes in some .tpl reports, into a foreach

Automation.php:

+Modified report data, for the refactored report system
+Some clean-up

Battle.php:

+Fixed catapults and rams, they weren't able to destroy completely a building
+Fixed a possible division by 0 error
This commit is contained in:
iopietro
2018-04-19 20:14:54 +02:00
parent 06fc62752a
commit 882215cd2a
41 changed files with 426 additions and 9017 deletions
+7 -6
View File
@@ -897,7 +897,7 @@ class MYSQLi_DB implements IDbConnection {
if ($result) {
// will return the result
} elseif($field=="username") {
$result = "??";
$result = "[?]";
} else {
$result = 0;
}
@@ -2030,7 +2030,7 @@ class MYSQLi_DB implements IDbConnection {
if($result){
// will return the result
}elseif($field=="name"){
$result = "??";
$result = "[?]";
}else $result = 0;
return $result;
@@ -4235,10 +4235,11 @@ References: User ID/Message ID, Mode
function addNotice($uid, $toWref, $ally, $type, $topic, $data, $time = 0) {
list($uid, $toWref, $ally, $type, $topic, $data, $time) = $this->escape_input((int) $uid, (int) $toWref, (int) $ally, (int) $type, $topic, $data, (int) $time);
if($time == 0) {
$time = time();
}
//We don't need to send reports to Nature or Natars
if($uid == 2 || $uid == 3) return;
if($time == 0) $time = time();
$q = "INSERT INTO " . TB_PREFIX . "ndata (id, uid, toWref, ally, topic, ntype, data, time, viewed) values (0,'$uid','$toWref','$ally','$topic',$type,'$data',$time,0)";
return mysqli_query($this->dblink,$q);
}