diff options
Diffstat (limited to 'cgi/weabot.py')
-rwxr-xr-x | cgi/weabot.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cgi/weabot.py b/cgi/weabot.py index ff6debc..f032e20 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -931,7 +931,7 @@ class weabot(object): # if there's not a reason, show the report page if reason is None: self.output += renderTemplate("report.html", - {'finished': False, 'postshow': postshow, 'txt': txt}) + {'finished': False, 'postshow': postshow, 'txt': txt}) return # check reason @@ -951,19 +951,20 @@ class weabot(object): raise UserError(_("You're banned.")) # check if post exists - post = FetchOne("SELECT `id`, `parentid`, `ip` FROM `posts` WHERE `id` = %s AND `boardid` = %s", - (postid, board['id'])) + post = FetchOne("SELECT `id`, `parentid`, `ip`, `timestamp` FROM `posts` WHERE `id` = %s AND `boardid` = %s LIMIT 1", (postid, board['id']) ) if not post: - raise UserError(_("Post doesn't exist.")) + raise UserError(_("Post doesn't exist.")) # generate link if board["board_type"] == 1: - parent_post = get_parent_post(post["parentid"], board["id"]) - link = "/%s/read/%s/%s" % (board["dir"], - parent_post["timestamp"], postshow) + if post['parentid']: + parent_post = FetchOne("SELECT id, timestamp FROM posts WHERE id = %s AND boardid = %s LIMIT 1", (post["parentid"], board["id"]) ) + else: + parent_post = post + + link = "/%s/read/%s/%s" % (board["dir"], parent_post["timestamp"], postshow) else: - link = "/%s/res/%d.html#%d" % (board["dir"], int( - post["parentid"]) or int(post["id"]), int(post["id"])) + link = "/%s/res/%s.html#%s" % (board["dir"], post["parentid"] or post["id"], post["id"]) # insert report t = time.time() |