$post_options['mode'] = 'thread'; $first_post = discussion_forum_post_fetch($post_options); // if the request doesn't end with .php (has no set page) if (substr($_SERVER['REQUEST_URI'], -4) != '.php' && login_checklogin()) { discussion_forum_goto_latest_read($_SERVER['REQUEST_URI'], $first_post[0]['id']); } $forum_security = forum_security(array('action' => 'view_thread', 'forum_id' => $first_post[0]['forum_id'])); if ($forum_security !== true) { $output .= $forum_security; break; } $ui_options['title'] = $first_post[0]['title'] . ' - Hamsterpajs forum'; if ($first_post[0]['forum_id'] == 102) { $output .= '<a href="/sex_och_sinne/"><img style="margin-top: 4px;" src="http://images.hamsterpaj.net/sex_and_sense/sex_and_sense_top.png" /></a>' . "\n"; } $locator_options['categories'] = discussion_forum_path_to_category(array('id' => $first_post[0]['forum_id'])); $locator_options['thread_handle'] = $first_post[0]['handle']; $locator_options['thread_title'] = $first_post[0]['title']; $locator_options['post_count'] = $first_post[0]['child_count']; $locator_options['current_page'] = 'test' . $request['page_num']; $output .= discussion_forum_locator($locator_options); $output .= discussion_forum_thread_info($first_post[0]); unset($post_options); $post_options['thread_id'] = $first_post[0]['id']; $post_options['mode'] = 'thread'; //$post_options['disable_forum_lookup'] = true; $post_options['offset'] = ($request['page_num'] - 1) * FORUM_POSTS_PER_PAGE; if ($_SESSION['login']['id'] == 774586) { // echo '<strong>Posts fetch</strong> '; // preint_r($request); }
function discussion_forum_list_notices() { if (count($_SESSION['forum']['notices']) > 0) { $output .= '<h2>Svar till dig</h2>' . "\n"; $output .= '<table>' . "\n"; foreach ($_SESSION['forum']['notices'] as $notice) { /* Find out how many posts that exists before the one we're looking at */ $query = 'SELECT COUNT(*) AS posts FROM forum_posts WHERE parent_post = "' . $notice['thread_id'] . '" AND id < "' . $notice['post_id'] . '"'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); $data = mysql_fetch_assoc($result); $output .= '<tr>' . "\n"; $category_path = discussion_forum_path_to_category(array('id' => $notice['forum_id'])); $category = array_pop($category_path); $url = $category['url'] . $notice['handle'] . '/sida_' . (floor($data['posts'] / FORUM_POSTS_PER_PAGE) + 1) . '.php#post_' . $notice['post_id']; $output .= '<td class="remove_answer_notice_listed"><a id="' . $notice['post_id'] . '" class="remove_answer_notice_listed" href="/ajax_gateways/discussion_forum.php?action=remove_answer_notice&post_id=' . $notice['post_id'] . '" title="Flagga inlägget som läst"><img src="' . IMAGE_URL . 'famfamfam_icons/eye.png" alt="x" /></a></td>' . "\n"; $output .= '<td>' . fix_time($notice['timestamp']) . '</td>' . "\n"; $output .= '<td><a href="' . $url . '">' . $notice['title'] . '</a></td>'; $output .= '<td><a href="/traffa/profile.php?id=' . $notice['author'] . '">' . $notice['username'] . '</a></td>'; } $output .= '</table>' . "\n"; } return $output; }
function render_full_article($article) { if (empty($article)) { $out .= rounded_corners_top(array('color' => 'red')); $out .= '<h1>Den här artikeln kunde tyvärr inte hittas</h1>' . "\n"; $out .= '<a href="?action=list"><< Gå till listan över artiklar</a>' . "\n"; $out .= rounded_corners_bottom(array('color' => 'red')); } else { $out .= render_article($article); if ($article['photo_category_id'] > 0) { $options['category'] = $article['photo_category_id']; $photos = photos_fetch($options); $out .= '<h2>Tillhörande bilder</h2>' . "\n"; $out .= photos_list($photos); } if ($article['showauthor'] == 1) { $out .= render_author($article['author']); } if (isset($article['forum_category_id']) && $article['forum_category_id'] != 0) { $all_categories_list = discussion_forum_categories_fetch(array('id' => $article['forum_category_id'])); $category = array_pop($all_categories_list); $forum_security = forum_security(array('action' => 'view_category', 'category' => $category)); if ($forum_security == true) { $path_to_category = discussion_forum_path_to_category(array('id' => $category['id'])); $locator_options['categories'] = $path_to_category; unset($options); $options['max_levels'] = 0; $options['parent'] = $category['id']; $categories = discussion_forum_categories_fetch($options); $out .= discussion_forum_categories_list($categories); $out .= '<h2>Trådar</h2>' . "\n"; $post_options['forum_id'] = $category['id']; $post_options['threads_only'] = true; $post_options['order_by_sticky'] = true; $post_options['page_offset'] = $request['page_offset']; $post_options['url_lookup'] = true; $threads = discussion_forum_post_fetch($post_options); //$threads['url'] = $path_to_trailing_category = array_pop($path_to_category) . '/' . $thread['handle'] . '/sida_1.php'; $out .= discussion_forum_thread_list($threads); $path_to_trailing_category = array_pop($path_to_category); $out .= '<a href="' . $path_to_trailing_category['url'] . '">Skapa en egen tråd länkad till artikeln</a>' . '<br style="clear: both;" />'; forum_update_category_session(array('category' => $category, 'threads' => $threads)); } } if ($article['commentable'] == 1) { $out .= rounded_corners_top(array('color' => 'blue_deluxe')); if ($article['rankable'] == 1) { $out .= rank_input_draw($article['id'], 'articles'); } $out .= comments_input_draw($article['id'], 'articles'); $out .= '<div style="clear: both;"></div>' . "\n"; $out .= rounded_corners_bottom(); $out .= comments_list($article['id'], 'articles'); } } if (is_privilegied('articles_admin')) { $out .= '<a href="/artiklar/index.php?action=admin&article=edit&id=' . $article['id'] . '">Ändra i artikeln</a>' . "\n"; } return $out; }