From f70b47226f07d430ba67d0ff3d8583c10c2ecad6 Mon Sep 17 00:00:00 2001 From: Renard Date: Fri, 31 Jul 2020 20:19:48 -0400 Subject: Formateo de datos --- cgi/modapi.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'cgi') 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': -- cgit v1.2.1-18-gbd029