diff --git a/inc/config.php b/inc/config.php
index 2a511c04..fc5b1b56 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -630,6 +630,7 @@
// These can be URLs OR base64 (data URI scheme)
//$config['image_sticky'] = $config['dir']['static'] . 'sticky.gif';
//$config['image_locked'] = $config['dir']['static'] . 'locked.gif';
+ //$config['image_bumplocked'] = $config['dir']['static'] . 'sage.gif';
//$config['image_deleted'] = $config['dir']['static'] . 'deleted.';
//$config['image_zip'] = $config['dir']['static'] . 'zip.';
@@ -675,6 +676,8 @@
$config['mod']['link_desticky'] = '[-Sticky]';
$config['mod']['link_lock'] = '[Lock]';
$config['mod']['link_unlock'] = '[-Lock]';
+ $config['mod']['link_bumplock'] = '[Sage]';
+ $config['mod']['link_bumpunlock'] = '[-Sage]';
// Moderator capcodes
$config['capcode'] = ' ## %s';
@@ -770,7 +773,11 @@
$config['mod']['lock'] = MOD;
// Post in a locked thread
$config['mod']['postinlocked'] = MOD;
- // Post bypass unoriginal content check
+ // Prevent a thread from being bumped
+ $config['mod']['bumplock'] = MOD;
+ // View whether a thread has been bumplocked ("-1" to allow non-mods to see too)
+ $config['mod']['view_bumplock'] = MOD;
+ // Post bypass unoriginal content check on robot-enabled boards
$config['mod']['postunoriginal'] = ADMIN;
// Bypass flood check
$config['mod']['flood'] = ADMIN;
diff --git a/inc/display.php b/inc/display.php
index 4377ea3c..655aaf22 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -276,7 +276,7 @@
};
class Thread {
- public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $embed, $root=null, $mod=false, $hr=true) {
+ public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $bumplocked, $embed, $root=null, $mod=false, $hr=true) {
global $config;
if(!isset($root)) $root = &$config['root'];
@@ -302,6 +302,7 @@
$this->ip = $ip;
$this->sticky = $sticky;
$this->locked = $locked;
+ $this->bumplocked = $bumplocked;
$this->embed = $embed;
$this->root = $root;
$this->mod = $mod;
@@ -357,6 +358,12 @@
else
$built .= ' ' . $config['mod']['link_sticky'] . '';
+ if(hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod))
+ if($this->bumplocked)
+ $built .= ' ' . $config['mod']['link_bumpunlock'] . '';
+ else
+ $built .= ' ' . $config['mod']['link_bumplock'] . '';
+
// Lock
if(hasPermission($config['mod']['lock'], $board['uri'], $this->mod))
if($this->locked)
diff --git a/inc/functions.php b/inc/functions.php
index 464d22da..8b90a22f 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -62,6 +62,8 @@
$config['image_sticky'] = $config['dir']['static'] . 'sticky.gif';
if(!isset($config['image_locked']))
$config['image_locked'] = $config['dir']['static'] . 'locked.gif';
+ if(!isset($config['image_bumplocked']))
+ $config['image_bumplocked'] = $config['dir']['static'] . 'sage.gif';
if(!isset($config['image_deleted']))
$config['image_deleted'] = $config['dir']['static'] . 'deleted.png';
if(!isset($config['image_zip']))
@@ -543,6 +545,21 @@
return (bool) $post['locked'];
}
+ function threadSageLocked($id) {
+ global $board;
+
+ $query = prepare(sprintf("SELECT `sage` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri']));
+ $query->bindValue(':id', $id, PDO::PARAM_INT);
+ $query->execute() or error(db_error());
+
+ if(!$post = $query->fetch()) {
+ // Non-existant, so it can't be locked...
+ return false;
+ }
+
+ return (bool) $post['sage'];
+ }
+
function threadExists($id) {
global $board;
@@ -557,7 +574,7 @@
function post($post, $OP) {
global $pdo, $board;
- $query = prepare(sprintf("INSERT INTO `posts_%s` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, :embed)", $board['uri']));
+ $query = prepare(sprintf("INSERT INTO `posts_%s` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri']));
// Basic stuff
$query->bindValue(':subject', $post['subject']);
@@ -754,7 +771,7 @@
}
}
- $thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $th['sticky'], $th['locked'], $th['embed'], $mod ? '?/' : $config['root'], $mod);
+ $thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $th['sticky'], $th['locked'], $th['sage'], $th['embed'], $mod ? '?/' : $config['root'], $mod);
$posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri']));
$posts->bindValue(':id', $th['id']);
@@ -1372,7 +1389,7 @@
while($post = $query->fetch()) {
if(!isset($thread)) {
- $thread = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['embed'], $mod ? '?/' : $config['root'], $mod);
+ $thread = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], $mod ? '?/' : $config['root'], $mod);
} else {
$thread->add(new Post($post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], $mod ? '?/' : $config['root'], $mod));
}
diff --git a/mod.php b/mod.php
index e4b10cce..e3f7cc9b 100644
--- a/mod.php
+++ b/mod.php
@@ -951,7 +951,7 @@
$temp = '';
while($post = $query->fetch()) {
if(!$post['thread']) {
- $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['embed'], '?/', $mod, false);
+ $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], '?/', $mod, false);
} else {
$po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod);
}
@@ -1310,7 +1310,7 @@
openBoard($report['uri']);
if(!$post['thread']) {
- $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['embed'], '?/', $mod, false);
+ $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], '?/', $mod, false);
} else {
$po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod);
}
@@ -1935,6 +1935,38 @@
buildThread($post);
+ // Redirect
+ header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']);
+ } elseif(preg_match('/^\/' . $regex['board'] . 'bump(un)?lock\/(\d+)$/', $query, $matches)) {
+ // Lock/Unlock
+
+ $boardName = &$matches[1];
+ if(!hasPermission($config['mod']['bumplock'], $boardName)) error($config['error']['noaccess']);
+
+ $post = &$matches[3];
+ // Open board
+ if(!openBoard($boardName))
+ error($config['error']['noboard']);
+
+ $query = prepare(sprintf("UPDATE `posts_%s` SET `sage` = :bumplocked WHERE `id` = :id AND `thread` IS NULL", $board['uri']));
+ $query->bindValue(':id', $post, PDO::PARAM_INT);
+
+ if($matches[2] == 'un') {
+ // Record the action
+ modLog("Unbumplocked post #{$post}");
+ $query->bindValue(':bumplocked', 0, PDO::PARAM_INT);
+ } else {
+ // Record the action
+ modLog("Bumplocked post #{$post}");
+ $query->bindValue(':bumplocked', 1, PDO::PARAM_INT);
+ }
+
+ $query->execute() or error(db_error($query));
+
+ buildIndex();
+ buildThread($post);
+
+
// Redirect
header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']);
} elseif(preg_match('/^\/' . $regex['board'] . 'deletebyip\/(\d+)$/', $query, $matches)) {
@@ -2197,7 +2229,7 @@
while($post = $query->fetch()) {
if(!$post['thread']) {
- $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['embed'], '?/', $mod, false);
+ $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], '?/', $mod, false);
} else {
$po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod);
}
diff --git a/post.php b/post.php
index 06857daa..6c932c3e 100644
--- a/post.php
+++ b/post.php
@@ -545,7 +545,7 @@
buildThread(($OP?$id:$post['thread']));
- if(!$OP && strtolower($post['email']) != 'sage' && ($config['reply_limit'] == 0 || numPosts($post['thread']) < $config['reply_limit'])) {
+ if(!$OP && strtolower($post['email']) != 'sage' && !threadSageLocked($post['thread']) && ($config['reply_limit'] == 0 || numPosts($post['thread']) < $config['reply_limit'])) {
bumpThread($post['thread']);
}
diff --git a/templates/post_thread.html b/templates/post_thread.html
index 0e7dd1a4..2e477e7b 100644
--- a/templates/post_thread.html
+++ b/templates/post_thread.html
@@ -92,6 +92,9 @@
{% if post.locked %}
{% endif %}
+ {% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %}
+
+ {% endif %}
{% if index %}
[Reply]
{% endif %}