$post_options['threads_only'] = true; $post_options['order_by_sticky'] = true; $post_options['page_offset'] = $request['page_offset']; $threads = discussion_forum_post_fetch($post_options); $output .= discussion_forum_thread_list($threads); $path_to_trailing_category = array_pop($path_to_category); $output .= '<a href="' . $path_to_trailing_category['url'] . 'traadsida_' . ($request['page_offset'] + 2) . '.php">Nästa sida »</a>'; if (forum_security(array('action' => 'discussion_create', 'forum_id' => $category['id'])) === true) { $form_options['forum_id'] = $request['category']['id']; $form_options['mode'] = 'create_thread'; $output .= discussion_forum_post_form($form_options); } else { $output .= '<h2>Du får inte starta diskussioner här</h2>' . "\n"; $output .= 'I den här kategorin får du inte starta några diskussioner, men kanske finns det några underkategorier du får det i?'; } forum_update_category_session(array('category' => $category, 'threads' => $threads)); break; case 'move_thread': if (forum_security(array('action' => 'move_thread', 'thread' => $request['thread']))) { $query = 'UPDATE forum_posts SET forum_id = "' . $request['new_category']['id'] . '" WHERE id = "' . $request['thread']['id'] . '" LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $message = 'Hej, din tråd i forumet med titeln "%TITLE%" har flyttats till %NEW_CATEGORY%.' . "\n"; $message .= 'Har du några frågor om varför tråden flyttades så kan du ta dem med %MOVERS_USERNAME%'; $message .= 'eller med någon annan ordningsvakt, du hittar sådana i modulen "Inloggade Ordningsvakter" till höger.' . "\n"; $message .= '/Webmaster'; $guestbook_message = array('sender' => 2348, 'recipient' => intval($request['thread']['author']), 'message' => mysql_real_escape_string(str_replace(array('%TITLE%', '%NEW_CATEGORY%', '%MOVERS_USERNAME%'), array($request['thread']['title'], $request['new_category']['title'], $_SESSION['login']['username']), $message))); guestbook_insert($guestbook_message); header('Location: ' . $request['new_category']['url']); exit; } break;
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; }