From 6b3e6b9968a18d6fac24bb2ac332d1bafbbc3ae3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 May 2012 02:32:09 +0300 Subject: [PATCH] fix reports --- GameEngine/Database/db_MYSQL.php | 6 ++++++ GameEngine/Message.php | 4 +++- Templates/Notice/all.tpl | 6 ++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 60420cf2..35b46da3 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -1507,6 +1507,12 @@ $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } + + function getDelNotice($uid) { + $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid and del = 1 ORDER BY time DESC"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } function getNotice2($id, $field) { $q = "SELECT ".$field." FROM " . TB_PREFIX . "ndata where `id` = '$id'"; diff --git a/GameEngine/Message.php b/GameEngine/Message.php index d12f5b9c..80a38868 100644 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -13,7 +13,7 @@ public $unread, $nunread = false; public $note; - public $inbox, $sent, $reading, $reply, $archived, $noticearray, $readingNotice = array(); + public $inbox, $sent, $reading, $reply, $archived, $noticearray, $delnoticearray, $readingNotice = array(); private $totalMessage, $totalNotice; private $allNotice = array(); @@ -112,6 +112,7 @@ } if (!is_array($type)) { $type = array($type); } $this->noticearray = $this->filter_by_value($database->getNotice($session->uid), "ntype", $type); + $this->delnoticearray = $this->filter_by_value($database->getDelNotice($session->uid), "ntype", $type); } if(isset($get['id'])) { $this->readingNotice = $this->getReadNotice($get['id']); @@ -214,6 +215,7 @@ global $database, $session; $this->allNotice = $database->getNotice($session->uid); $this->noticearray = $this->filter_by_value_except($this->allNotice, "ntype", 9); + $this->delnoticearray = $this->filter_by_value_except($database->getDelNotice($session->uid), "ntype", 9); $this->totalNotice = count($this->allNotice); } diff --git a/Templates/Notice/all.tpl b/Templates/Notice/all.tpl index 7e450c95..b9a9856e 100644 --- a/Templates/Notice/all.tpl +++ b/Templates/Notice/all.tpl @@ -84,12 +84,10 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att } $date = $generator->procMtime($message->noticearray[$i-1]['time']); echo "".$date[0]." ".$date[1].""; - }else{ - $count =+ 1; - }} + }} $name++; } - if(count($message->noticearray) == $count) { + if(count($message->noticearray)-count($message->delnoticearray) == 0) { echo "There are no reports available."; } ?>