aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2020-07-30 21:10:13 -0400
committerLibravatar Renard 2020-07-30 21:10:13 -0400
commit7983c46e93fc1ee8ad5f89859f3cd13861f08737 (patch)
treece438ec8d16b3467c4d25026ff60fd37bb50956d
parent47638cc804c084821b2db69e3a2f044da3043d33 (diff)
downloadweabot-7983c46e93fc1ee8ad5f89859f3cd13861f08737.tar.gz
weabot-7983c46e93fc1ee8ad5f89859f3cd13861f08737.tar.xz
weabot-7983c46e93fc1ee8ad5f89859f3cd13861f08737.zip
Mod API: Ignore reports
-rw-r--r--cgi/modapi.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/cgi/modapi.py b/cgi/modapi.py
index c2301ab..81cb929 100644
--- a/cgi/modapi.py
+++ b/cgi/modapi.py
@@ -75,10 +75,18 @@ def api_process(self, path_split):
news = FetchAll(
"SELECT * FROM `news` WHERE type = 1 ORDER BY `timestamp` DESC")
values['news'] = news
- elif method == 'reports':
- reports = FetchAll(
- "SELECT id, timestamp, timestamp_formatted, postid, parentid, link, board, INET6_NTOA(ip) AS ip, reason, INET6_NTOA(repip) AS repip FROM `reports` ORDER BY `timestamp` DESC")
- values['reports'] = reports
+ elif method == 'reports': # /cgi/manage/reports/ignore
+ if len(path_split) > 3:
+ if path_split[3] == 'ignore':
+ report_id = formdata.get("id")
+ UpdateDb("DELETE FROM `reports` WHERE `id` = '" +
+ _mysql.escape_string(report_id)+"'")
+ else:
+ values['state']: "error"
+ else:
+ reports = FetchAll(
+ "SELECT id, timestamp, timestamp_formatted, postid, parentid, link, board, INET6_NTOA(ip) AS ip, reason, INET6_NTOA(repip) AS repip FROM `reports` ORDER BY `timestamp` DESC")
+ values['reports'] = reports
elif method == 'logs':
logs = FetchAll("SELECT * FROM `logs` ORDER BY `timestamp` DESC")
values['logs'] = logs