aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2020-07-31 20:19:48 -0400
committerLibravatar Renard 2020-07-31 20:19:48 -0400
commitf70b47226f07d430ba67d0ff3d8583c10c2ecad6 (patch)
tree73953f19f72f3be7312879c7a32ac825fefdd970
parent0225f28f7da8774e788b7991e1342bba12e62e39 (diff)
downloadweabot-f70b47226f07d430ba67d0ff3d8583c10c2ecad6.tar.gz
weabot-f70b47226f07d430ba67d0ff3d8583c10c2ecad6.tar.xz
weabot-f70b47226f07d430ba67d0ff3d8583c10c2ecad6.zip
Formateo de datos
-rw-r--r--cgi/modapi.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/cgi/modapi.py b/cgi/modapi.py
index 6350b35..c6fca39 100644
--- a/cgi/modapi.py
+++ b/cgi/modapi.py
@@ -81,12 +81,27 @@ def api_process(self, path_split):
id = formdata.get('id')
post = FetchOne("SELECT `id`, `boardid`, `parentid`,`timestamp`, `name`, `tripcode`, `email` ,`subject`,`message`,`file`,`thumb`, INET6_NTOA(`ip`) as ip,`IS_DELETED` AS `deleted`, `bumped`, `last`, `locked` FROM `posts` WHERE `id` = '" +
_mysql.escape_string(id) + "' AND `boardid` = '" + _mysql.escape_string(board["id"]) + "'")
+ post['id'] = int(post['id'])
+ post['bumped'] = int(post['bumped'])
+ post['deleted'] = int(post['deleted'])
+ post['last'] = int(post['last'])
+ post['locked'] = int(post['locked'])
+ post['parentid'] = int(post['parentid'])
+ post['timestamp'] = int(post['timestamp'])
values['post'] = post
if 'parentid' in formdata.keys():
id = formdata.get('parentid')
- post = FetchAll("SELECT `id`, `boardid`, `parentid`,`timestamp`, `name`, `tripcode`, `email` ,`subject`,`message`,`file`,`thumb`, INET6_NTOA(`ip`) as ip,`IS_DELETED` AS `deleted`, `bumped`, `last`, `locked` FROM `posts` WHERE `parentid` = '" +
- _mysql.escape_string(id) + "' AND `boardid` = '" + _mysql.escape_string(board["id"]) + "'")
- values['posts'] = post
+ posts = FetchAll("SELECT `id`, `boardid`, `parentid`,`timestamp`, `name`, `tripcode`, `email` ,`subject`,`message`,`file`,`thumb`, INET6_NTOA(`ip`) as ip,`IS_DELETED` AS `deleted`, `bumped`, `last`, `locked` FROM `posts` WHERE `parentid` = '" +
+ _mysql.escape_string(id) + "' AND `boardid` = '" + _mysql.escape_string(board["id"]) + "'")
+ for post in posts:
+ post['id'] = int(post['id'])
+ post['bumped'] = int(post['bumped'])
+ post['deleted'] = int(post['deleted'])
+ post['last'] = int(post['last'])
+ post['locked'] = int(post['locked'])
+ post['parentid'] = int(post['parentid'])
+ post['timestamp'] = int(post['timestamp'])
+ values['posts'] = posts
elif method == 'reports':
if len(path_split) > 3:
if path_split[3] == 'ignore':