aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2020-07-30 21:22:52 -0400
committerLibravatar Renard 2020-07-30 21:22:52 -0400
commita9f0898128901b824aa339fccf4ccf8d691993ad (patch)
tree4add25d2e51b2969944b5acf35d637255f3bfbc0
parent7983c46e93fc1ee8ad5f89859f3cd13861f08737 (diff)
downloadweabot-a9f0898128901b824aa339fccf4ccf8d691993ad.tar.gz
weabot-a9f0898128901b824aa339fccf4ccf8d691993ad.tar.xz
weabot-a9f0898128901b824aa339fccf4ccf8d691993ad.zip
Mod API (Test): Fetch post
-rw-r--r--cgi/modapi.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/cgi/modapi.py b/cgi/modapi.py
index 81cb929..4c008de 100644
--- a/cgi/modapi.py
+++ b/cgi/modapi.py
@@ -75,6 +75,17 @@ def api_process(self, path_split):
news = FetchAll(
"SELECT * FROM `news` WHERE type = 1 ORDER BY `timestamp` DESC")
values['news'] = news
+ elif method == 'post':
+ if 'id' in formdata.keys():
+ id = formdata.get('id')
+ post = FetchOne("SELECT * FROM `posts` WHERE `id` = '" +
+ _mysql.escape_string(id) + "'")
+ values['post'] = post
+ if 'parentid' in formdata.keys():
+ id = formdata.get('id')
+ post = FetchAll("SELECT * FROM `posts` WHERE `parentid` = '" +
+ _mysql.escape_string(id) + "'")
+ values['posts'] = post
elif method == 'reports': # /cgi/manage/reports/ignore
if len(path_split) > 3:
if path_split[3] == 'ignore':