FILE_PAGE was being ignored

This commit is contained in:
Savetheinternet 2010-12-16 16:36:14 +11:00
parent 5adfff925b
commit fe1ca57ff5

View File

@ -332,12 +332,12 @@
return $result; return $result;
} }
function buildThread($id, $return=false) { function buildThread($id, $return=false, $mod=false) {
global $sql, $board; global $sql, $board;
$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` = '%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`,`ip` 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
@ -345,10 +345,11 @@
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']); $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);
} 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'])); $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));
} }
}
$body = Element('thread.html', Array( $body = Element('thread.html', Array(
'button'=>BUTTON_REPLY, 'button'=>BUTTON_REPLY,
'board'=>$board, 'board'=>$board,
@ -358,11 +359,10 @@
'id' => $id 'id' => $id
)); ));
if($return) if($return)
return $body; return $body;
else else
@file_put_contents($board['dir'] . DIR_RES . $id . '.html', $body) or error("Couldn't write to file."); @file_put_contents($board['dir'] . DIR_RES . sprintf(FILE_PAGE, $id), $body) or error("Couldn't write to file.");
}
mysql_free_result($query); mysql_free_result($query);
} }