Basic stickies
This commit is contained in:
parent
a261dca0a5
commit
22641bdc58
@ -85,7 +85,7 @@
|
|||||||
global $sql, $board;
|
global $sql, $board;
|
||||||
if($OP) {
|
if($OP) {
|
||||||
mysql_query(
|
mysql_query(
|
||||||
sprintf("INSERT INTO `posts_%s` VALUES ( NULL, NULL, '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s' )",
|
sprintf("INSERT INTO `posts_%s` VALUES ( NULL, NULL, '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '0')",
|
||||||
mysql_real_escape_string($board['uri']),
|
mysql_real_escape_string($board['uri']),
|
||||||
$post['subject'],
|
$post['subject'],
|
||||||
$post['email'],
|
$post['email'],
|
||||||
@ -109,7 +109,7 @@
|
|||||||
return mysql_insert_id($sql);
|
return mysql_insert_id($sql);
|
||||||
} else {
|
} else {
|
||||||
mysql_query(
|
mysql_query(
|
||||||
sprintf("INSERT INTO `posts_%s` VALUES ( NULL, '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s' )",
|
sprintf("INSERT INTO `posts_%s` VALUES ( NULL, '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '0')",
|
||||||
mysql_real_escape_string($board['uri']),
|
mysql_real_escape_string($board['uri']),
|
||||||
$post['thread'],
|
$post['thread'],
|
||||||
$post['subject'],
|
$post['subject'],
|
||||||
@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
sql_open();
|
sql_open();
|
||||||
$query = mysql_query(sprintf(
|
$query = mysql_query(sprintf(
|
||||||
"SELECT * FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC LIMIT %d,%d",
|
"SELECT * FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT %d,%d",
|
||||||
mysql_real_escape_string($board['uri']),
|
mysql_real_escape_string($board['uri']),
|
||||||
$offset,
|
$offset,
|
||||||
THREADS_PER_PAGE
|
THREADS_PER_PAGE
|
||||||
@ -184,9 +184,8 @@
|
|||||||
return Array('button'=>BUTTON_NEWTOPIC, 'board'=>$board, 'body'=>$body, 'post_url' => POST_URL, 'index' => ROOT);
|
return Array('button'=>BUTTON_NEWTOPIC, 'board'=>$board, 'body'=>$body, 'post_url' => POST_URL, 'index' => ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildIndex() {
|
function getPages($mod=false) {
|
||||||
global $sql, $board;
|
global $sql, $board;
|
||||||
sql_open();
|
|
||||||
|
|
||||||
$res = mysql_query(sprintf(
|
$res = mysql_query(sprintf(
|
||||||
"SELECT COUNT(`id`) as `num` FROM `posts_%s` WHERE `thread` IS NULL",
|
"SELECT COUNT(`id`) as `num` FROM `posts_%s` WHERE `thread` IS NULL",
|
||||||
@ -197,12 +196,17 @@
|
|||||||
|
|
||||||
$pages = Array();
|
$pages = Array();
|
||||||
for($x=0;$x<$count && $x<MAX_PAGES;$x++) {
|
for($x=0;$x<$count && $x<MAX_PAGES;$x++) {
|
||||||
$pages[] = Array('num' => $x+1, 'link' => $x==0 ? ROOT . $board['dir'] . FILE_INDEX : ROOT . $board['dir'] . sprintf(FILE_PAGE, $x+1));
|
$pages[] = Array('num' => $x+1, 'link' => $x==0 ? ($mod ? '?/' : ROOT) . $board['dir'] . FILE_INDEX : ($mod ? '?/' : ROOT) . $board['dir'] . sprintf(FILE_PAGE, $x+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result($res);
|
return $pages;
|
||||||
unset($arr);
|
}
|
||||||
unset($count);
|
|
||||||
|
function buildIndex() {
|
||||||
|
global $sql, $board;
|
||||||
|
sql_open();
|
||||||
|
|
||||||
|
$pages = getPages();
|
||||||
|
|
||||||
$page = 1;
|
$page = 1;
|
||||||
while($page <= MAX_PAGES && $content = index($page)) {
|
while($page <= MAX_PAGES && $content = index($page)) {
|
||||||
@ -356,7 +360,8 @@
|
|||||||
'body'=>$thread->build(),
|
'body'=>$thread->build(),
|
||||||
'post_url' => POST_URL,
|
'post_url' => POST_URL,
|
||||||
'index' => ROOT,
|
'index' => ROOT,
|
||||||
'id' => $id
|
'id' => $id,
|
||||||
|
'mod' => $mod
|
||||||
));
|
));
|
||||||
|
|
||||||
if($return)
|
if($return)
|
||||||
|
@ -69,6 +69,7 @@ CREATE TABLE IF NOT EXISTS `posts_b` (
|
|||||||
`filehash` varchar(32) DEFAULT NULL,
|
`filehash` varchar(32) DEFAULT NULL,
|
||||||
`password` varchar(20) DEFAULT NULL,
|
`password` varchar(20) DEFAULT NULL,
|
||||||
`ip` varchar(15) NOT NULL,
|
`ip` varchar(15) NOT NULL,
|
||||||
|
`sticky` int(1) NOT NULL,
|
||||||
UNIQUE KEY `id` (`id`)
|
UNIQUE KEY `id` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
|
@ -19,5 +19,6 @@ CREATE TABLE IF NOT EXISTS `posts_{board}` (
|
|||||||
`filehash` varchar(32) DEFAULT NULL,
|
`filehash` varchar(32) DEFAULT NULL,
|
||||||
`password` varchar(20) DEFAULT NULL,
|
`password` varchar(20) DEFAULT NULL,
|
||||||
`ip` varchar(15) NOT NULL,
|
`ip` varchar(15) NOT NULL,
|
||||||
|
`sticky` int(1) NOT NULL,
|
||||||
UNIQUE KEY `id` (`id`)
|
UNIQUE KEY `id` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
Loading…
Reference in New Issue
Block a user