Ejemplo n.º 1
0
     display_error_page($smarty, new BoardNotFoundError($board_name));
     exit(1);
 }
 $threads_count = threads_get_visible_count($_SESSION['user'], $board['id']);
 $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']);
Ejemplo n.º 2
0
 }
 // Calculate maximum page number.
 $threads_count = threads_get_visible_count($_SESSION['user'], $board['id']);
 $page_max = ceil($threads_count / 100);
 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);
 }
 // Get threads, original posts and attachments.
 $threads = threads_get_visible_by_page($_SESSION['user'], $board['id'], $page, 100);
 $posts = posts_get_original_by_threads($threads);
 $posts_attachments = array();
 $attachments = array();
 if (is_attachments_enabled($board)) {
     $posts_attachments = posts_attachments_get_by_posts($posts);
     $attachments = attachments_get_by_posts($posts);
 }
 // Generate html code of page 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('show_control', is_admin() || is_mod());
 $smarty->assign('categories', $categories);
 $smarty->assign('boards', $boards);