Completing transition to multi-board support.
This commit is contained in:
parent
6feb9cd284
commit
e66c1e7f8d
@ -124,13 +124,15 @@
|
|||||||
$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']);
|
$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']);
|
||||||
|
|
||||||
$newposts = mysql_query(sprintf(
|
$newposts = mysql_query(sprintf(
|
||||||
"SELECT `id`, `subject`, `email`, `name`, `trip`, `body`, `time`, `thumb`, `thumbwidth`, `thumbheight`, `file`, `filewidth`, `fileheight`, `filesize`, `filename` FROM `posts` 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` FROM `posts` WHERE `board` = '%d' AND `thread` = '%s' ORDER BY `time` DESC LIMIT %d",
|
||||||
|
$board['id'],
|
||||||
$th['id'],
|
$th['id'],
|
||||||
THREADS_PREVIEW
|
THREADS_PREVIEW
|
||||||
), $sql) or error(mysql_error($sql));
|
), $sql) or error(mysql_error($sql));
|
||||||
if(mysql_num_rows($newposts) == THREADS_PREVIEW) {
|
if(mysql_num_rows($newposts) == THREADS_PREVIEW) {
|
||||||
$count_query = mysql_query(sprintf(
|
$count_query = mysql_query(sprintf(
|
||||||
"SELECT COUNT(`id`) as `num` FROM `posts` WHERE `thread` = '%s'",
|
"SELECT COUNT(`id`) as `num` FROM `posts` WHERE `board` = '%d' AND `thread` = '%s'",
|
||||||
|
$board['id'],
|
||||||
$th['id']
|
$th['id']
|
||||||
), $sql) or error(mysql_error($sql));
|
), $sql) or error(mysql_error($sql));
|
||||||
$count = mysql_fetch_array($count_query);
|
$count = mysql_fetch_array($count_query);
|
||||||
@ -156,7 +158,10 @@
|
|||||||
global $sql, $board;
|
global $sql, $board;
|
||||||
sql_open();
|
sql_open();
|
||||||
|
|
||||||
$res = mysql_query("SELECT COUNT(`id`) as `num` FROM `posts` WHERE `thread` IS NULL", $sql) or error(mysql_error($sql));
|
$res = mysql_query(sprintf(
|
||||||
|
"SELECT COUNT(`id`) as `num` FROM `posts` WHERE `board` = '%d' AND `thread` IS NULL",
|
||||||
|
$board['id']
|
||||||
|
), $sql) or error(mysql_error($sql));
|
||||||
$arr = mysql_fetch_array($res);
|
$arr = mysql_fetch_array($res);
|
||||||
$count = floor((THREADS_PER_PAGE + $arr['num'] - 1) / THREADS_PER_PAGE);
|
$count = floor((THREADS_PER_PAGE + $arr['num'] - 1) / THREADS_PER_PAGE);
|
||||||
|
|
||||||
@ -218,7 +223,11 @@
|
|||||||
strlen($cites[3][$index]),
|
strlen($cites[3][$index]),
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = mysql_query(sprintf("SELECT `thread`,`id` FROM `posts` WHERE `id` = '%d'", $cite), $sql);
|
$result = mysql_query(sprintf(
|
||||||
|
"SELECT `thread`,`id` FROM `posts` WHERE `board` = '%d' AND `id` = '%d' LIMIT 1",
|
||||||
|
$board['id'],
|
||||||
|
$cite
|
||||||
|
), $sql) or error(mysql_error($sql));
|
||||||
if($post = mysql_fetch_array($result)) {
|
if($post = mysql_fetch_array($result)) {
|
||||||
$replacement = '<a onclick="highlightReply(\''.$cite.'\');" href="' . ROOT . $board['dir'] . DIR_RES . ($post['thread']?$post['thread']:$post['id']) . '.html#' . $cite . '">>>' . $cite . '</a>';
|
$replacement = '<a onclick="highlightReply(\''.$cite.'\');" href="' . ROOT . $board['dir'] . DIR_RES . ($post['thread']?$post['thread']:$post['id']) . '.html#' . $cite . '">>>' . $cite . '</a>';
|
||||||
} else {
|
} else {
|
||||||
@ -298,7 +307,8 @@
|
|||||||
$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` FROM `posts` WHERE (`thread` IS NULL AND `id` = '%s') OR `thread` = '%s' ORDER BY `thread`,`time`",
|
"SELECT `id`,`thread`,`subject`,`name`,`email`,`trip`,`body`,`time`,`thumb`,`thumbwidth`,`thumbheight`,`file`,`filewidth`,`fileheight`,`filesize`,`filename` FROM `posts` WHERE `board` = '%d' AND ((`thread` IS NULL AND `id` = '%s') OR `thread` = '%s') ORDER BY `thread`,`time`",
|
||||||
|
$board['id'],
|
||||||
$id,
|
$id,
|
||||||
$id
|
$id
|
||||||
), $sql) or error(mysql_error($sql));
|
), $sql) or error(mysql_error($sql));
|
||||||
|
Loading…
Reference in New Issue
Block a user