diff options
Diffstat (limited to 'cgi/manage.py')
-rw-r--r-- | cgi/manage.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/cgi/manage.py b/cgi/manage.py index 690c807..5fb38d7 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -381,13 +381,13 @@ def manage(self, path_split): # Nos vamos al board y ubicamos el post board = setBoard(path_split[3]) - postid = int(path_split[4]) - post = FetchOne('SELECT `parentid`, `locked` FROM `posts` WHERE `boardid` = %s AND `id` = %s LIMIT 1', (board['id'], pid) ) + pid = int(path_split[4]) + post = FetchOne('SELECT id, parentid, locked FROM posts WHERE boardid = %s AND id = %s LIMIT 1', (board['id'], pid) ) if not post: message = _('Unable to locate a post with that ID.') template_filename = "message.html" else: - if not post['parentid']: + if post['parentid'] != 0: message = _('Post is not a thread opener.') template_filename = "message.html" else: @@ -401,13 +401,14 @@ def manage(self, path_split): UpdateDb("UPDATE `posts` SET `locked` = %s WHERE `boardid` = %s AND `id` = %s LIMIT 1", (setLocked, board["id"], post["id"])) threadUpdated(pid) - if setLocked == 1: - message = _('Thread successfully closed.') - logAction(staff_account['username'], _('Closed thread %s') % ('/' + board['dir'] + '/' + pid) ) - else: - message = _('Thread successfully opened.') - logAction(staff_account['username'], _('Opened thread %s') % ('/' + board['dir'] + '/' + pid) ) - template_filename = "message.html" + + if setLocked == 1: + message = _('Thread successfully closed.') + logAction(staff_account['username'], _('Closed thread %s') % ('/' + board['dir'] + '/' + str(pid)) ) + else: + message = _('Thread successfully opened.') + logAction(staff_account['username'], _('Opened thread %s') % ('/' + board['dir'] + '/' + str(pid)) ) + template_filename = "message.html" elif path_split[2] == 'permasage': setPermasaged = 0 |