diff --git a/LUA/TFS_10/talkaction report system/adminreport.lua b/LUA/TFS_10/talkaction report system/adminreport.lua
index c4262c5..ce45712 100644
--- a/LUA/TFS_10/talkaction report system/adminreport.lua
+++ b/LUA/TFS_10/talkaction report system/adminreport.lua
@@ -1,4 +1,5 @@
--
+-- Coded by Dark ShaoOz, modified by Znote
function onSay(cid, words, param, channel)
local storage = 6708 -- (You can change the storage if its already in use)
local delaytime = 30 -- (Exhaust In Seconds.)
@@ -11,10 +12,10 @@ function onSay(cid, words, param, channel)
end
if (getPlayerStorageValue(cid, storage) <= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your report has been received successfully!")
- db.query("INSERT INTO `player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`)VALUES (NULL , '" .. getPlayerName(cid) .. "', '" .. x .. "', '" .. y .. "', '" .. z .. "', '" .. string.gsub(param, "'", "\\'") .. "', '" .. os.time() .. "')")
+ db.query("INSERT INTO `znote_player_reports` (`id` ,`name` ,`posx` ,`posy` ,`posz` ,`report_description` ,`date`)VALUES (NULL , '" .. getPlayerName(cid) .. "', '" .. x .. "', '" .. y .. "', '" .. z .. "', " .. db.escapeString(param) .. ", '" .. os.time() .. "')")
setPlayerStorageValue(cid,storage,os.time()+delaytime)
else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have to wait 30 seconds to report again.")
+ doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have to wait "..getPlayerStorageValue(cid, storage) - os.time().." seconds to report again.")
end
return TRUE
end
\ No newline at end of file
diff --git a/admin_reports.php b/admin_reports.php
index 3080f07..77d7017 100644
--- a/admin_reports.php
+++ b/admin_reports.php
@@ -12,6 +12,8 @@ $statusTypes = array(
4 => 'Rejected',
5 => 'Fixed'
);
+// Autohide rows that have these status IDs:
+$hideStatus = array(3, 4, 5);
// Fetch data from SQL
$reportsData = mysql_select_multi("SELECT id, name, posx, posy, posz, report_description, date, status FROM znote_player_reports ORDER BY id DESC;");
@@ -19,7 +21,11 @@ $reportsData = mysql_select_multi("SELECT id, name, posx, posy, posz, report_des
if ($reportsData !== false) {
// Order reports array by ID for easy reference later on.
$reports = array();
- for ($i = 0; $i < count($reportsData); $i++) $reports[$reportsData[$i]['id']] = $reportsData[$i];
+ for ($i = 0; $i < count($reportsData); $i++) {
+ foreach ($statusTypes as $key => $value) {
+ if ($key == $reportsData[$i]['status']) $reports[$key][$reportsData[$i]['id']] = $reportsData[$i];
+ }
+ }
}
// POST logic (Update report and give player points)
@@ -36,7 +42,13 @@ if (!empty($_POST)) {
// Update SQL
mysql_update("UPDATE `znote_player_reports` SET `status`='$status' WHERE `id`='$reportId' LIMIT 1;");
// Update local array representation
- $reports[$reportId]['status'] = $status;
+ foreach ($reports as $sid => $sa)
+ foreach ($sa as $rid => $ra)
+ if ($reportId == $rid) {
+ $reports[$status][$reportId] = $reports[$sid][$rid];
+ $reports[$status][$reportId]['status'] = $status;
+ unset($reports[$sid][$rid]);
+ }
// If we should give user price
if ($price > 0) {
@@ -66,8 +78,8 @@ if (!empty($_POST)) {
$reportId = getValue($_GET['id']);
// Fetch the report we intend to modify
- $report = $reports[$reportId];
-
+ foreach ($reports as $sid => $sa) foreach ($sa as $rid => $ra) if ($rid == $reportId) $report = $reports[$sid][$reportId];
+
// Create html form
?>
@@ -103,34 +115,78 @@ if (!empty($_POST)) {
if ($reportsData !== false) {
// Render HTML
+ //data_dump($reports);
?>
- Reports List
-
+ (Visible)
+
No reports submitted.";
-include 'layout/overall/footer.php';
-?>
\ No newline at end of file
+?>
+
+
\ No newline at end of file