forked from leftypol/leftypol
added "bumplocking" feature
This commit is contained in:
parent
851d8eaa9b
commit
ffb215eb47
6 changed files with 75 additions and 9 deletions
|
@ -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'] = ' <a class="capcode">## %s</a>';
|
||||
|
@ -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;
|
||||
|
|
|
@ -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 .= ' <a title="Make thread sticky" href="?/' . $board['uri'] . '/sticky/' . $this->id . '">' . $config['mod']['link_sticky'] . '</a>';
|
||||
|
||||
if(hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod))
|
||||
if($this->bumplocked)
|
||||
$built .= ' <a title="Allow thread to be bumped" href="?/' . $board['uri'] . '/bumpunlock/' . $this->id . '">' . $config['mod']['link_bumpunlock'] . '</a>';
|
||||
else
|
||||
$built .= ' <a title="Prevent thread from being bumped" href="?/' . $board['uri'] . '/bumplock/' . $this->id . '">' . $config['mod']['link_bumplock'] . '</a>';
|
||||
|
||||
// Lock
|
||||
if(hasPermission($config['mod']['lock'], $board['uri'], $this->mod))
|
||||
if($this->locked)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue