Stickies
This commit is contained in:
parent
b0bee3556f
commit
627c6ac91a
@ -72,6 +72,7 @@
|
|||||||
define('ERROR_INVALIDFIELD', 'The %s field was invalid.', true);
|
define('ERROR_INVALIDFIELD', 'The %s field was invalid.', true);
|
||||||
define('ERROR_NOACCESS', 'You don\'t have permission to do that.', true);
|
define('ERROR_NOACCESS', 'You don\'t have permission to do that.', true);
|
||||||
define('ERROR_INVALIDPOST', 'That post doesn\'t exist…', true);
|
define('ERROR_INVALIDPOST', 'That post doesn\'t exist…', true);
|
||||||
|
define('ERROR_404', 'Page not found.', true);
|
||||||
|
|
||||||
// For resizing, max values
|
// For resizing, max values
|
||||||
define('THUMB_WIDTH', 200, true);
|
define('THUMB_WIDTH', 200, true);
|
||||||
@ -129,6 +130,10 @@
|
|||||||
// "302" is recommended.
|
// "302" is recommended.
|
||||||
define('REDIRECT_HTTP', 302, true);
|
define('REDIRECT_HTTP', 302, true);
|
||||||
|
|
||||||
|
// Static images
|
||||||
|
// These can be URLs OR base64 (data URI scheme)
|
||||||
|
define('IMAGE_STICKY', 'data:image/gif;base64,R0lGODlhEgASAIcAACM8mR5BnAFPowNVpwBZqQBerhNPpRpLoxhSqABgrwBksgFvughltA5ttwBwuwR0vyN2vDdosDJ9tQB6wkJqtGN2tgODyweR1QCZ3gGc3wiR1ROr6SGGyCqJyDqEwjaX0Das4j256GaFu22Fs0qFwkyNx1mLxEun2k264lO76V+45WSezW2Vx2+fzGCrxWW30X6/5oaIvo+rvqidtr29vo+RwIWj0ISp1KSn0aG337euxbGwxry71KW84LbMvJLLzZDK1ZDI2Y3S76fJ5qbK6KrP6K3U7aDd8bzI6Mu6vMC/z83NwtDO39PW2drd0cPO7tXW5tje7MXk9t7u4+LJw+bX1ezhz+Hg8uDr9Obw+PHo6v//7gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAMAAFsALAAAAAASABIAAAieALcIHEiwoMGDRT6ckHLQYJYhRixcENKQIBYiUmBowHCkYRQWLVZ0AJFCBYYNB6FUiGCixAILFjRkCHEwxhUbAxI4mHCAA4opB2vk6EGigIMHB4JUVEIBwg0PCxYYAFJxywgBBBo4YBDgRVUtIgYoWAAAwY+qSHDIkHAAgIuqT3ZYEejDR1UmM5xUJZhEx5K9A6nwoAF4YJUmhRMXDAgAOw==', true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Mod stuff
|
Mod stuff
|
||||||
*/
|
*/
|
||||||
|
@ -180,7 +180,7 @@
|
|||||||
|
|
||||||
class Thread {
|
class Thread {
|
||||||
public $omitted = 0;
|
public $omitted = 0;
|
||||||
public function __construct($id, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=ROOT) {
|
public function __construct($id, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $root=ROOT) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->subject = utf8tohtml($subject);
|
$this->subject = utf8tohtml($subject);
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
@ -199,13 +199,13 @@
|
|||||||
$this->omitted = 0;
|
$this->omitted = 0;
|
||||||
$this->posts = Array();
|
$this->posts = Array();
|
||||||
$this->ip = $ip;
|
$this->ip = $ip;
|
||||||
|
$this->sticky = $sticky;
|
||||||
$this->root = $root;
|
$this->root = $root;
|
||||||
}
|
}
|
||||||
public function add(Post $post) {
|
public function add(Post $post) {
|
||||||
$this->posts[] = $post;
|
$this->posts[] = $post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function build($index=false) {
|
public function build($index=false) {
|
||||||
global $board, $mod;
|
global $board, $mod;
|
||||||
|
|
||||||
@ -255,8 +255,11 @@
|
|||||||
' href="' . $this->root . $board['dir'] . DIR_RES . $this->id . '.html' . '#' . $this->id . '">No.</a>' .
|
' href="' . $this->root . $board['dir'] . DIR_RES . $this->id . '.html' . '#' . $this->id . '">No.</a>' .
|
||||||
// JavaScript cite
|
// JavaScript cite
|
||||||
'<a class="post_no"' . ($index?'':'onclick="citeReply(' . $this->id . ');"') . 'href="' . ($index?$this->root . $board['dir'] . DIR_RES . $this->id . '.html' . '#q' . $this->id:'javascript:void(0);') . '">'.$this->id.'</a>' .
|
'<a class="post_no"' . ($index?'':'onclick="citeReply(' . $this->id . ');"') . 'href="' . ($index?$this->root . $board['dir'] . DIR_RES . $this->id . '.html' . '#q' . $this->id:'javascript:void(0);') . '">'.$this->id.'</a>' .
|
||||||
|
// Sticky
|
||||||
|
($this->sticky ? '<img class="icon" title="Sticky" src="' . IMAGE_STICKY . '" />' : '') .
|
||||||
// [Reply]
|
// [Reply]
|
||||||
($index ? '<a href="' . $this->root . $board['dir'] . DIR_RES . $this->id . '.html">[Reply]</a>' : '') .
|
($index ? '<a href="' . $this->root . $board['dir'] . DIR_RES . $this->id . '.html">[Reply]</a>' : '') .
|
||||||
|
|
||||||
// Mod controls
|
// Mod controls
|
||||||
postControls($this->id, true) .
|
postControls($this->id, true) .
|
||||||
'</p>';
|
'</p>';
|
||||||
|
@ -151,7 +151,7 @@
|
|||||||
|
|
||||||
if(mysql_num_rows($query) < 1 && $page > 1) return false;
|
if(mysql_num_rows($query) < 1 && $page > 1) return false;
|
||||||
while($th = mysql_fetch_array($query)) {
|
while($th = mysql_fetch_array($query)) {
|
||||||
$thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $mod ? '?/' : ROOT);
|
$thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $th['sticky'], $mod ? '?/' : ROOT);
|
||||||
|
|
||||||
$newposts = mysql_query(sprintf(
|
$newposts = mysql_query(sprintf(
|
||||||
"SELECT `id`, `subject`, `email`, `name`, `trip`, `body`, `time`, `thumb`, `thumbwidth`, `thumbheight`, `file`, `filewidth`, `fileheight`, `filesize`, `filename`,`ip` FROM `posts_%s` WHERE `thread` = '%s' ORDER BY `time` DESC LIMIT %d",
|
"SELECT `id`, `subject`, `email`, `name`, `trip`, `body`, `time`, `thumb`, `thumbwidth`, `thumbheight`, `file`, `filewidth`, `fileheight`, `filesize`, `filename`,`ip` FROM `posts_%s` WHERE `thread` = '%s' ORDER BY `time` DESC LIMIT %d",
|
||||||
@ -341,7 +341,7 @@
|
|||||||
$id = round($id);
|
$id = round($id);
|
||||||
|
|
||||||
$query = mysql_query(sprintf(
|
$query = mysql_query(sprintf(
|
||||||
"SELECT `id`,`thread`,`subject`,`name`,`email`,`trip`,`body`,`time`,`thumb`,`thumbwidth`,`thumbheight`,`file`,`filewidth`,`fileheight`,`filesize`,`filename`,`ip` FROM `posts_%s` WHERE (`thread` IS NULL AND `id` = '%d') OR `thread` = '%d' ORDER BY `thread`,`time`",
|
"SELECT `id`,`thread`,`subject`,`name`,`email`,`trip`,`body`,`time`,`thumb`,`thumbwidth`,`thumbheight`,`file`,`filewidth`,`fileheight`,`filesize`,`filename`,`ip`,`sticky` FROM `posts_%s` WHERE (`thread` IS NULL AND `id` = '%d') OR `thread` = '%d' ORDER BY `thread`,`time`",
|
||||||
mysql_real_escape_string($board['uri']),
|
mysql_real_escape_string($board['uri']),
|
||||||
$id,
|
$id,
|
||||||
$id
|
$id
|
||||||
@ -349,7 +349,7 @@
|
|||||||
|
|
||||||
while($post = mysql_fetch_array($query)) {
|
while($post = mysql_fetch_array($query)) {
|
||||||
if(!isset($thread)) {
|
if(!isset($thread)) {
|
||||||
$thread = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $mod ? '?/' : ROOT);
|
$thread = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $mod ? '?/' : ROOT);
|
||||||
} else {
|
} else {
|
||||||
$thread->add(new Post($post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $mod ? '?/' : ROOT));
|
$thread->add(new Post($post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $mod ? '?/' : ROOT));
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,12 @@ div.post img {
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin: 5px 20px 0 0;
|
margin: 5px 20px 0 0;
|
||||||
}
|
}
|
||||||
|
div.post img.icon {
|
||||||
|
display: inline;
|
||||||
|
float: none;
|
||||||
|
margin: 0 5px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
div.post.op {
|
div.post.op {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
Loading…
Reference in New Issue
Block a user