GetOne("SELECT `name` FROM `" . KU_DBPREFIX . "boards` WHERE `name` = " . $tc_db->qstr($_GET['board']) . "");
if ($board_name != '') {
$board_class = new Board($board_name);
if ($board_class->board['locale'] != '') {
changeLocale($board_class->board['locale']);
}
} else {
die('Invalid board.');
}
$board_class->InitializeDwoo();
$board_class->dwoo_data->assign('isexpand', true);
$board_class->dwoo_data->assign('board', $board_class->board);
$board_class->dwoo_data->assign('file_path', getCLBoardPath($board_class->board['name'], $board_class->board['loadbalanceurl_formatted'], ''));
if (isset($_GET['preview'])) {
require KU_ROOTDIR . 'inc/classes/parse.class.php';
$parse_class = new Parse();
if (isset($_GET['board']) && isset($_GET['parentid']) && isset($_GET['message'])) {
die('' . _gettext('Post preview') . ':
' . $parse_class->ParsePost($_GET['message'], $board_class->board['name'], $_GET['parentid'], $board_class->board['id']) . '
');
}
die('Error');
}
if( isset($_GET['after']) && (int)$_GET['after']!=0 ) {
$refreshq = ' AND `id` > ' . $tc_db->qstr((int)$_GET['after']);
$getnewposts = true;
} else {
$refreshq ='';
$getnewposts = false;
}
$posts = $tc_db->GetAll('SELECT * FROM `'.KU_DBPREFIX.'posts` WHERE `boardid` = ' . $board_class->board['id'] . ' AND `IS_DELETED` = 0 AND `parentid` = '.$tc_db->qstr($_GET['threadid']) . $refreshq . ' ORDER BY `id` ASC');
if( count($posts)==0 ) die();
global $expandjavascript;
$output = '';
$expandjavascript = '';
$numimages = 0;
$embeds = $tc_db->GetAll("SELECT filetype FROM `" . KU_DBPREFIX . "embeds`");
foreach ($embeds as $embed) {
$board_class->board['filetypes'][] .= $embed['filetype'];
}
$board_class->dwoo_data->assign('filetypes', $board_class->board['filetypes']);
foreach ($posts as $key=>$post) {
if ($post['file_type'] == 'jpg' || $post['file_type'] == 'gif' || $post['file_type'] == 'png') {
$numimages++;
}
$posts[$key] = $board_class->BuildPost($post, false);
$newlastid = $post['id'];
}
$board_class->dwoo_data->assign('numimages', $numimages);
$board_class->dwoo_data->assign('posts', $posts);
$board_class->dwoo_data->assign('getnewposts', $getnewposts);
$output = $board_class->dwoo->get(KU_TEMPLATEDIR . '/board_thread.tpl', $board_class->dwoo_data);
if ($expandjavascript != '') {
$output = '' . _gettext('Expand all images') . '' . $output;
}
echo $output;
?>