Esempio n. 1
0
 $page_max = ceil($threads_count / $_SESSION['threads_per_page']);
 if ($page_max == 0) {
     $page_max = 1;
     // Important for empty boards.
 }
 if ($page > $page_max) {
     // Cleanup.
     DataExchange::releaseResources();
     display_error_page($smarty, new MaxPageError($page));
     exit(1);
 }
 $threads = threads_get_visible_by_page($_SESSION['user'], $board['id'], $page, $_SESSION['threads_per_page']);
 $posts = posts_get_visible_by_threads_preview($board['id'], $threads, $_SESSION['user'], $_SESSION['posts_per_thread']);
 $posts_attachments = array();
 $attachments = array();
 if (is_attachments_enabled($board)) {
     $posts_attachments = posts_attachments_get_by_posts($posts);
     $attachments = attachments_get_by_posts($posts);
 }
 $htfilter = function ($hidden_thread, $user) {
     if ($hidden_thread['user'] == $user) {
         return true;
     }
     return false;
 };
 $hidden_threads = hidden_threads_get_filtred_by_boards(array($board), $htfilter, $_SESSION['user']);
 $upload_types = upload_types_get_by_board($board['id']);
 if (is_macrochan_enabled($board)) {
     $macrochan_tags = macrochan_tags_get_all();
 } else {
     $macrochan_tags = array();
Esempio n. 2
0
 }
 // Check board name.
 $board_name = boards_check_name($_REQUEST['board']);
 if ($board_name === FALSE) {
     // Cleanup.
     DataExchange::releaseResources();
     display_error_page($smarty, kotoba_last_error());
     exit(1);
 }
 // Get post, board, thread and attachment.
 $post = posts_get_visible_by_number($board_name, posts_check_number($_REQUEST['post']), $_SESSION['user']);
 $board = $post['board'];
 $thread = $post['thread'];
 $posts_attachments = array();
 $attachments = array();
 if (is_attachments_enabled($board) || $thread['with_attachments']) {
     $posts_attachments = posts_attachments_get_by_posts(array($post));
     $attachments = attachments_get_by_posts(array($post));
 }
 // Find if author of this post is admin.
 $author_admin = posts_is_author_admin($post['user']);
 //
 // Create html-code and display it.
 //
 $smarty->assign('ATTACHMENT_TYPE_FILE', Config::ATTACHMENT_TYPE_FILE);
 $smarty->assign('ATTACHMENT_TYPE_LINK', Config::ATTACHMENT_TYPE_LINK);
 $smarty->assign('ATTACHMENT_TYPE_VIDEO', Config::ATTACHMENT_TYPE_VIDEO);
 $smarty->assign('ATTACHMENT_TYPE_IMAGE', Config::ATTACHMENT_TYPE_IMAGE);
 $smarty->assign('page_title', NULL);
 $post_html = $smarty->fetch('header.tpl');
 // Set default post author name if enabled.