From dcd6e1d63a46ff957ce6eb519915b4a9e8fe625b Mon Sep 17 00:00:00 2001 From: Choom Date: Wed, 14 Dec 2022 18:05:09 -0300 Subject: Mejor pantalla de borrado Fix imágenes en BBS --- cgi/manage.py | 21 +++++++++++---------- cgi/template.py | 2 +- cgi/templates/base_top.html | 2 +- cgi/templates/manage/delete.html | 40 +++++++++++++++++++++++++++++++--------- cgi/templates/manage/recent.html | 2 +- static/css/txt/bbs.css | 8 ++++++-- 6 files changed, 51 insertions(+), 24 deletions(-) diff --git a/cgi/manage.py b/cgi/manage.py index 93a9921..0cf2f66 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -317,9 +317,15 @@ def manage(self, path_split): do_ban = True except: pass + + + board = setBoard(path_split[3]) + post = FetchOne('SELECT id, message, thumb, name, tripcode FROM posts WHERE boardid = %s AND id = %s LIMIT 1' % (board['id'], path_split[4])) template_filename = "delete.html" - template_values = {'do_ban': do_ban, 'curboard': path_split[3], 'postid': path_split[4]} + template_values = {'do_ban': do_ban, + 'curboard': board, + 'post': post } elif path_split[2] == 'delete_confirmed': if not moderator: return @@ -330,8 +336,7 @@ def manage(self, path_split): board = setBoard(path_split[3]) postid = int(path_split[4]) - post = FetchOne('SELECT id, message, parentid, INET6_NTOA(ip) AS ip FROM posts WHERE boardid = %s AND id = %s' % ( - board['id'], postid)) + post = FetchOne('SELECT id, message, parentid, INET6_NTOA(ip) AS ip FROM posts WHERE boardid = %s AND id = %s' % (board['id'], postid)) if not permanently: deletePost(path_split[4], None, 2, imageonly) @@ -342,8 +347,7 @@ def manage(self, path_split): # Borrar denuncias UpdateDb("DELETE FROM `reports` WHERE `postid` = %s", (int(path_split[4]),)) - boards = FetchAll( - 'SELECT `name`, `dir` FROM `boards` ORDER BY `dir`') + boards = FetchAll('SELECT `name`, `dir` FROM `boards` ORDER BY `dir`') if imageonly: message = 'Archivo de post /%s/%s eliminado.' % ( @@ -1189,9 +1193,7 @@ def manage(self, path_split): if board_dir != '': action_taken = True - board_exists = FetchOne( - "SELECT * FROM `boards` WHERE `dir` = %s LIMIT 1", - (board_dir,)) + board_exists = FetchOne("SELECT * FROM `boards` WHERE `dir` = %s LIMIT 1", (board_dir,)) if not board_exists: os.mkdir(Settings.ROOT_DIR + board_dir) os.mkdir(Settings.ROOT_DIR + board_dir + '/res') @@ -2173,8 +2175,7 @@ def verifyPasswd(username, passwd): import argon2 ph = argon2.PasswordHasher() - staff_account = FetchOne( - "SELECT * FROM staff WHERE username = %s", (username,)) + staff_account = FetchOne("SELECT * FROM staff WHERE username = %s", (username,)) if not staff_account: return None diff --git a/cgi/template.py b/cgi/template.py index 62f62a9..ca47db8 100644 --- a/cgi/template.py +++ b/cgi/template.py @@ -46,7 +46,7 @@ def renderTemplate(template, template_values={}, mobile=False, noindex=False): # if board: if template in ["board.html", "threadlist.html", "catalog.html", "kako.html", "paint.html"] or template[0:3] == "txt": # TODO HACK - if board['dir'] == 'world' and not mobile and (template == 'txt_board.html'): + if board['dir'] == 'world' and not mobile and template == 'txt_board.html': template = template[:-4] + 'en.html' elif board['dir'] == '2d' and template == 'board.html' and not mobile: template = template[:-4] + 'jp.html' diff --git a/cgi/templates/base_top.html b/cgi/templates/base_top.html index d6a30e8..2dc079e 100644 --- a/cgi/templates/base_top.html +++ b/cgi/templates/base_top.html @@ -44,4 +44,4 @@ -