summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@tinyboard.org>2011-11-19 03:40:23 +1100
committerSavetheinternet <savetheinternet@tinyboard.org>2011-11-19 03:40:23 +1100
commite8ad1643585d88b688ca2b7899861d603802c466 (patch)
tree94bcfcc1d65e15b4a59bbd827c175abca42c1a60
parentd8fe3ff8d82b5437fd83de3716728cdff0885d03 (diff)
"Shadow thread" automated reply with thread moving.
-rw-r--r--inc/config.php8
-rw-r--r--inc/functions.php4
-rw-r--r--mod.php33
3 files changed, 39 insertions, 6 deletions
diff --git a/inc/config.php b/inc/config.php
index 67158c5a..c85ca039 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -744,6 +744,14 @@
// What to append to the post for public bans ("%s" is the message)
$config['mod']['ban_message'] = '<span class="public_ban">(%s)</span>';
+ // When moving a thread to another board and choosing to keep a "shadow thread", an automated post (with a capcode) will
+ // be made, linking to the new location for the thread. "%s" will be replaced with a standard cross-board post citation (>>>/board/xxx)
+ $config['mod']['shadow_mesage'] = 'Moved to %s.';
+ // Capcode to use when posting the above message.
+ $config['mod']['shadow_capcode'] = 'Mod';
+ // Name to use when posting the above message.
+ $config['mod']['shadow_name'] = $config['anonymous'];
+
// Wait indefinitely when rebuilding everything
$config['mod']['rebuild_timelimit'] = 0;
diff --git a/inc/functions.php b/inc/functions.php
index c59f6036..e3f585e3 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -614,9 +614,9 @@
$query->bindValue(':name', $post['name']);
$query->bindValue(':trip', $post['trip']);
$query->bindValue(':body', $post['body']);
- $query->bindValue(':time', $post['time'] ? $post['time'] : time(), PDO::PARAM_INT);
+ $query->bindValue(':time', isset($post['time']) ? $post['time'] : time(), PDO::PARAM_INT);
$query->bindValue(':password', $post['password']);
- $query->bindValue(':ip', $post['ip'] ? $post['ip'] : $_SERVER['REMOTE_ADDR']);
+ $query->bindValue(':ip', isset($post['ip']) ? $post['ip'] : $_SERVER['REMOTE_ADDR']);
if($post['mod'] && $post['sticky']) {
$query->bindValue(':sticky', 1, PDO::PARAM_INT);
diff --git a/mod.php b/mod.php
index f25a0969..79cd394b 100644
--- a/mod.php
+++ b/mod.php
@@ -2255,15 +2255,40 @@
// trigger themes
rebuildThemes('post');
+ openBoard($boardName);
+
if($shadow) {
- // do something
+ // lock thread
+ $query = prepare(sprintf("UPDATE `posts_%s` SET `locked` = 1 WHERE `id` = :id", $board['uri']));
+ $query->bindValue(':id', $postID, PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+
+ $post = Array(
+ 'mod' => true,
+ 'subject' => '',
+ 'email' => '',
+ 'name' => $config['mod']['shadow_name'],
+ 'capcode' => $config['mod']['shadow_capcode'],
+ 'trip' => '',
+ 'body' => sprintf($config['mod']['shadow_mesage'], '>>>/' . $targetBoard . '/' . $newID),
+ 'password' => '',
+ 'has_file' => false,
+ // attach to original thread
+ 'thread' => $postID
+ );
+
+ markup($post['body']);
+
+ $botID = post($post, false);
+
+ header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['dir']['res'] . sprintf($config['file_page'], $postID) . '#' . $botID, true, $config['redirect_http']);
} else {
- openBoard($boardName);
deletePost($postID);
buildIndex();
+
+ openBoard($targetBoard);
+ header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['dir']['res'] . sprintf($config['file_page'], $newID), true, $config['redirect_http']);
}
-
- header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']);
} else {
$body = '<fieldset><legend>Move thread</legend>' .