diff options
Diffstat (limited to 'cgi/manage.py')
-rw-r--r-- | cgi/manage.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/cgi/manage.py b/cgi/manage.py index b98ae06..ca1ace6 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -995,32 +995,29 @@ def manage(self, path_split): if path_split[4] == 'restore': board = setBoard(path_split[5]) - post = FetchOne('SELECT `parentid` FROM `posts` WHERE `boardid` = %s AND `id` = %s LIMIT 1', - (board['id'], path_split[6])) + post = FetchOne('SELECT `parentid`, `IS_DELETED` FROM `posts` WHERE `boardid` = %s AND `id` = %s LIMIT 1', (board['id'], path_split[6])) if not post: - message = _( - 'Unable to locate a post with that ID.') + '<br />' + message = _('Unable to locate a post with that ID.') + '<br />' template_filename = "message.html" else: - UpdateDb('UPDATE `posts` SET `IS_DELETED` = 0 WHERE `boardid` = %s AND `id` = %s LIMIT 1', - (board['id'], path_split[6])) + UpdateDb('UPDATE `posts` SET `IS_DELETED` = 0 WHERE `boardid` = %s AND `id` = %s LIMIT 1', (board['id'], path_split[6])) if post['parentid'] != 0: threadUpdated(post['parentid']) else: regenerateFrontPages() - regenerateTrash() + if post['IS_DELETED'] == 2: + regenerateTrash() + message = _('Post successfully restored.') - logAction(staff_account['username'], _('Restored post %s') % ( - '/' + path_split[5] + '/' + path_split[6])) + logAction(staff_account['username'], _('Restored post %s') % ('/' + path_split[5] + '/' + path_split[6]) ) if path_split[4] == 'delete': board = setBoard(path_split[5]) post = FetchOne('SELECT id, parentid, message, INET6_NTOA(ip) AS ip FROM `posts` WHERE `boardid` = %s AND `id` = %s LIMIT 1', (board['id'], path_split[6])) if not post: - message = _( - 'Unable to locate a post with that ID.') + message = _('Unable to locate a post with that ID.') else: deletePost(post['id'], None) |