From 00bd5e8d2033c14fe1fd7b15a0db1b1827d549b9 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Fri, 18 Jan 2013 23:13:08 -0600 Subject: Remove buildThread() call from mod_deletefile because deleteFile() already calls it. --- inc/mod/pages.php | 7 ------- 1 file changed, 7 deletions(-) (limited to 'inc/mod/pages.php') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 4f1ab73c..6261d4af 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1019,13 +1019,6 @@ function mod_deletefile($board, $post) { // Record the action modLog("Deleted file from post #{$post}"); - $query = prepare(sprintf('SELECT `thread` FROM `posts_%s` WHERE `id` = :id', $board)); - $query->bindValue(':id', $post); - $query->execute() or error(db_error($query)); - $thread = $query->fetchColumn(); - - // Rebuild thread - buildThread($thread ? $thread : $post); // Rebuild board buildIndex(); -- cgit v1.3 From fda99305aee1adbf8d57dc73b46565471fac4c4d Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Fri, 18 Jan 2013 23:16:42 -0600 Subject: Global missing from mod_logout --- inc/mod/pages.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/mod/pages.php') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 6261d4af..7baaa3d9 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -64,6 +64,7 @@ function mod_confirm($request) { } function mod_logout() { + global $config; destroyCookies(); header('Location: ?/', true, $config['redirect_http']); -- cgit v1.3 From 322b902c8a316c4c64cb81cd5db0974817ca57f5 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Thu, 12 Jul 2012 07:43:43 -0600 Subject: Fix incorrect log message when bumplocking and stickying threads. --- inc/mod/pages.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/mod/pages.php') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 7baaa3d9..9526a7df 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -707,7 +707,7 @@ function mod_sticky($board, $unsticky, $post) { $query->bindValue(':sticky', $unsticky ? 0 : 1); $query->execute() or error(db_error($query)); if ($query->rowCount()) { - modLog(($unlock ? 'Unstickied' : 'Stickied') . " thread #{$post}"); + modLog(($unsticky ? 'Unstickied' : 'Stickied') . " thread #{$post}"); buildThread($post); buildIndex(); } @@ -729,7 +729,7 @@ function mod_bumplock($board, $unbumplock, $post) { $query->bindValue(':bumplock', $unbumplock ? 0 : 1); $query->execute() or error(db_error($query)); if ($query->rowCount()) { - modLog(($unlock ? 'Unbumplocked' : 'Bumplocked') . " thread #{$post}"); + modLog(($unbumplock ? 'Unbumplocked' : 'Bumplocked') . " thread #{$post}"); buildThread($post); buildIndex(); } -- cgit v1.3 From 0092fc62ab48bb9abc84a9f0641f253e5e9f1d35 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Tue, 24 Jul 2012 11:51:59 -0600 Subject: Extend timelimit when rebuilding from mod interface. The rebuild_timelimit config option was not used anywhere since the mod interface rewrite. --- inc/mod/pages.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/mod/pages.php') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 9526a7df..91ae8046 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1406,6 +1406,8 @@ function mod_rebuild() { error($config['error']['noaccess']); if (isset($_POST['rebuild'])) { + set_time_limit($config['mod']['rebuild_timelimit']); + $log = array(); $boards = listBoards(); $rebuilt_scripts = array(); -- cgit v1.3 From 5628f789702d9bdbd573f1833f6258b4f26a47b4 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Tue, 4 Sep 2012 00:21:04 -0600 Subject: Made deleting posts by IP more efficient. No longer rebuilds same thread multiple times. --- inc/mod/pages.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'inc/mod/pages.php') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 91ae8046..e90e9ff0 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1052,7 +1052,7 @@ function mod_deletebyip($boardName, $post, $global = false) { $query = ''; foreach ($boards as $_board) { - $query .= sprintf("SELECT `id`, '%s' AS `board` FROM `posts_%s` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); + $query .= sprintf("SELECT `thread`, `id`, '%s' AS `board` FROM `posts_%s` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', '', $query); @@ -1063,18 +1063,27 @@ function mod_deletebyip($boardName, $post, $global = false) { if ($query->rowCount() < 1) error($config['error']['invalidpost']); - $boards = array(); + set_time_limit($config['mod']['rebuild_timelimit']); + + $threads_to_rebuild = array(); + $threads_deleted = array(); while ($post = $query->fetch()) { openBoard($post['board']); - $boards[] = $post['board']; - deletePost($post['id'], false); + deletePost($post['id'], false, false); + + if ($post['thread']) + $threads_to_rebuild[$post['board']][$post['thread']] = true; + else + $threads_deleted[$post['board']][$post['id']] = true; } - $boards = array_unique($boards); - - foreach ($boards as $_board) { + foreach ($threads_to_rebuild as $_board => $_threads) { openBoard($_board); + foreach ($_threads as $_thread => $_dummy) { + if ($_dummy && !isset($threads_deleted[$_board][$_thread])) + buildThread($_thread); + } buildIndex(); } -- cgit v1.3