From 60ab15c63b815d8cdf29d7a3cb806daccdc02d06 Mon Sep 17 00:00:00 2001 From: Choom Date: Sat, 17 Dec 2022 20:17:36 -0300 Subject: Fix goto --- cgi/manage.py | 16 +++++++--------- cgi/post.py | 4 ++-- cgi/templates/manage/recent.html | 12 ++++++++++-- 3 files changed, 19 insertions(+), 13 deletions(-) (limited to 'cgi') diff --git a/cgi/manage.py b/cgi/manage.py index ca1ace6..37546dc 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -193,8 +193,8 @@ def manage(self, path_split): threads = FetchAll("SELECT * FROM `posts` WHERE boardid = %s AND parentid = 0 ORDER BY `bumped` DESC" % board["id"]) template_filename = "mod.html" template_values = {"mode": 2, "dir": board["dir"], "threads": threads} - elif path_split[2] == "recent": - posts = FetchAll("SELECT posts.id, posts.subject, dir, boards.board_type, CASE parentid WHEN '0' THEN posts.id ELSE parentid END AS parentid, file, thumb, timestamp_formatted, timestamp, posts.message, INET6_NTOA(ip) AS ip, posts.name, email, tripcode, boards.name AS board_name FROM posts INNER JOIN boards ON posts.boardid = boards.id WHERE posts.timestamp > UNIX_TIMESTAMP() - 86400 ORDER BY timestamp DESC") + elif path_split[2] == 'recent': + posts = FetchAll("SELECT posts.id, posts.subject, dir, boards.board_type, CASE parentid WHEN '0' THEN posts.id ELSE parentid END AS parentid, file, thumb, timestamp_formatted, timestamp, posts.message, INET6_NTOA(ip) AS ip, posts.name, email, tripcode, posts.IS_DELETED, boards.name AS board_name FROM posts INNER JOIN boards ON posts.boardid = boards.id WHERE posts.timestamp > UNIX_TIMESTAMP() - 86400 ORDER BY timestamp DESC") template_filename = "recent.html" template_values = {"posts": posts} elif path_split[2] == 'staff': @@ -1581,8 +1581,7 @@ def manage(self, path_split): 'submit': submit} elif len(path_split) > 4 and path_split[3] == 'delete': delid = int(path_split[4]) - UpdateDb( - "DELETE FROM `filters` WHERE id = '%s' LIMIT 1" % str(delid)) + UpdateDb("DELETE FROM `filters` WHERE id = '%s' LIMIT 1", str(delid)) message = _('Deleted filter %s.') % str(delid) template_filename = "message.html" action_taken = True @@ -1991,19 +1990,18 @@ def manage(self, path_split): template_values = {'boards': boardlist()} elif path_split[2] == 'goto': board = setBoard(path_split[3]) - board_type = board['board_type'] try: pid = int(path_split[4]) except ValueError: raise UserError("ID no vĂ¡lida.") - if board_type == '1': + if board['board_type'] == 1: first = get_parent_post(pid, board['id']) - url = "/" + board['dir'] + "/read/" + first['timestamp'] + "/" + url = "/%s/read/%s/" % (board['dir'], first['timestamp']) else: - url = "/" + board['dir'] + "/res/" + str(pid) + ".html" - + url = "/%s/res/%s.html" % (board['dir'], pid) + self.output = '' % url elif path_split[2] == 'fixquote': # when a mod deletes a post permanently messing with quote numbers diff --git a/cgi/post.py b/cgi/post.py index ff5596f..bc502e5 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -1116,7 +1116,7 @@ def regenerateNews(): f.close() def regenerateTrash(): - posts = FetchAll("SELECT posts.id AS id, timestamp_formatted, posts.message AS message, boards.name AS board FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE IS_DELETED = 2 AND timestamp > %s ORDER BY `timestamp` DESC", (int(time.time()) - 31557600*3) ) + posts = FetchAll("SELECT posts.id AS id, timestamp_formatted, posts.message AS message, boards.name AS board FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE IS_DELETED = 2 AND timestamp > %s ORDER BY `timestamp` DESC", (int(time.time()) - 31557600*3,) ) for i in range(len(posts)): posts[i]["timestamp_formatted"] = posts[i]["timestamp_formatted"].split()[0] @@ -1186,7 +1186,7 @@ def regenerateAccess(): def regenerateKako(): board = Settings._.BOARD - threads = FetchAll("SELECT * FROM archive WHERE boardid = %s ORDER BY timestamp DESC", board['id']) + threads = FetchAll("SELECT * FROM archive WHERE boardid = %s ORDER BY timestamp DESC", (board['id'],) ) page = renderTemplate('kako.html', {'threads': threads}) with open(Settings.ROOT_DIR + board["dir"] + "/kako/index.html", "w") as f: f.write(page) diff --git a/cgi/templates/manage/recent.html b/cgi/templates/manage/recent.html index 006da56..d6040e5 100644 --- a/cgi/templates/manage/recent.html +++ b/cgi/templates/manage/recent.html @@ -23,14 +23,14 @@ : #{post['subject']} - : #{post['name']}#{post['tripcode']} + : #{post['name']}#{post['tripcode']} [#{post['email']}] : Hace #{post['timestamp_formatted']} @ #{post['board_name']}
#{post['message']}
Ver hilo completo - + Ver hilo en BaI Ver hilo en BaI @@ -41,9 +41,17 @@ #{post['ip']} + + Eliminado por usuario
+ Recuperar + + Eliminado por staff
+ Recuperar + Eliminar & Ban + -- cgit v1.2.1-18-gbd029