aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Choom 2022-12-17 20:17:36 -0300
committerLibravatar Choom 2022-12-18 02:54:53 -0300
commit60ab15c63b815d8cdf29d7a3cb806daccdc02d06 (patch)
treef25b903a8c9cc52a0dd23efe595f70677f2789e9
parent109634fcea1a558be5da5bb607a2d5d5083d2b4f (diff)
downloadweabot-60ab15c63b815d8cdf29d7a3cb806daccdc02d06.tar.gz
weabot-60ab15c63b815d8cdf29d7a3cb806daccdc02d06.tar.xz
weabot-60ab15c63b815d8cdf29d7a3cb806daccdc02d06.zip
Fix goto
-rw-r--r--cgi/manage.py16
-rw-r--r--cgi/post.py4
-rw-r--r--cgi/templates/manage/recent.html12
3 files changed, 19 insertions, 13 deletions
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 = '<meta http-equiv="refresh" content="0;url=%s" />' % 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 @@
<?py if post['subject']: ?>
: <b><i>#{post['subject']}</i></b>
<?py #endif ?>
- : <b>#{post['name']}</b>#{post['tripcode']}
+ : <b>#{post['name']}</b>#{post['tripcode']} [#{post['email']}]
: Hace <span name="timestamp" data-ts="#{post['timestamp']}">#{post['timestamp_formatted']}</span>
@ #{post['board_name']}
</div>
<div class="recentmsg">#{post['message']}</div>
<div class="actions">
<a href="#{cgi_url}manage/mod/${post['dir']}/#{post['parentid']}">Ver hilo completo</a>
- <?py if post['board_type'] == '1': ?>
+ <?py if post['board_type'] == 1: ?>
<a href="#{cgi_url}manage/goto/${post['dir']}/#{post['parentid']}">Ver hilo en BaI</a>
<?py else: ?>
<a href="/${post['dir']}/res/#{post['parentid'] if post['parentid'] != '0' else post['id']}.html">Ver hilo en BaI</a>
@@ -41,9 +41,17 @@
<a href="#{cgi_url}manage/ipshow?ip=#{post['ip']}">#{post['ip']}</a>
</td>
<td style="white-space:nowrap;">
+ <?py if post['IS_DELETED'] == 1: ?>
+ <small>Eliminado por usuario</small><br />
+ <a href="#{cgi_url}manage/recyclebin/0/restore/#{post['dir']}/#{post['id']}">Recuperar</a>
+ <?py elif post['IS_DELETED'] == 2: ?>
+ <small>Eliminado por staff</small><br />
+ <a href="#{cgi_url}manage/recyclebin/0/restore/#{post['dir']}/#{post['id']}">Recuperar</a>
+ <?py else: ?>
<a href="#{cgi_url}manage/delete/#{post['dir']}/#{post['id']}">Eliminar</a>
<a href="#{cgi_url}manage/delete/#{post['dir']}/#{post['id']}?ban=true">&</a>
<a href="#{cgi_url}manage/ban?ip=#{post['ip']}">Ban</a>
+ <?py #endif ?>
</td>
</tr>
<?py #endfor ?>