コード例 #1
0
ファイル: index.php プロジェクト: KuBe-zz/hamsterpaj
     $ui_options['menu_path'][] = 'notices';
     $ui_options['title'] = 'Bevakade trådar - Hamsterpaj.net';
     $output .= discussion_forum_locator(array('page' => 'notices'));
     $output .= discussion_forum_list_notices();
     $output .= '<h1>Bevakade trådar</h1>' . "\n";
     $output .= discussion_forum_thread_list($_SESSION['forum']['subscriptions']);
     foreach ($_SESSION['forum']['categories'] as $category) {
         if ($category['subscribing'] == 1) {
             $subscribing_categories[] = $category['category_id'];
         }
     }
     if (count($subscribing_categories) > 0) {
         $output .= '<h1 style="margin-top: 20px;">Kategorier du prenumererar på</h1>' . "\n";
         $viewers_userlevel = login_checklogin() ? $_SESSION['login']['userlevel'] : 0;
         $categories = discussion_forum_categories_fetch(array('id' => $subscribing_categories, 'max_levels' => 0, 'viewers_userlevel' => $viewers_userlevel));
         $output .= discussion_forum_categories_list($categories);
     }
     break;
 case 'view_notices':
     discussion_forum_reload_all();
     $ui_options['menu_path'][] = 'notices';
     $ui_options['title'] = 'Bevakade trådar - Hamsterpaj.net';
     $output .= discussion_forum_locator(array('page' => 'notices'));
     $output .= discussion_forum_list_notices();
     $output .= '<h1>Bevakade trådar</h1>' . "\n";
     $options['notice_listing'] = true;
     $output .= discussion_forum_thread_list($_SESSION['forum']['subscriptions'], $options);
     foreach ($_SESSION['forum']['categories'] as $category) {
         if ($category['subscribing'] == 1) {
             $subscribing_categories[] = $category['category_id'];
         }
コード例 #2
0
function discussion_forum_categories_list($categories)
{
    $zebra = 'even';
    $table_open = false;
    foreach ($categories as $category) {
        if (is_array($category['children']) && count($category['children']) > 0) {
            if ($table_open == true) {
                $output .= '</table>' . "\n";
                $table_open = false;
            }
            $output .= '<h2 class="forum_category_list_parent_heading"><a href="' . $category['url'] . '">' . $category['title'] . '</a></h2>' . "\n";
            $temp = $category;
            unset($temp['children']);
            $temp['title'] = 'Övrigt, ' . strtolower($temp['title']);
            $category['children'][] = $temp;
            $output .= discussion_forum_categories_list($category['children']);
        } else {
            if ($table_open == false) {
                $output .= '<table class="forum_category_list">' . "\n";
                $table_open = true;
            }
            $output .= '<tr class="' . $zebra . '">' . "\n";
            $output .= '	<td class="name"><a href="' . $category['url'] . '" class="category_name">' . $category['title'] . '</a><br />' . "\n";
            $category['last_thread_title'] = strlen($category['last_thread_title']) > 45 ? substr($category['last_thread_title'], 0, 35) . '...' : $category['last_thread_title'];
            $output .= '	Senaste tråden <a href="' . $category['url'] . $category['last_thread_handle'] . '/sida_1.php">' . $category['last_thread_title'] . '</a> av <a href="/traffa/profile.php?id=' . $category['last_thread_author'] . '">' . $category['last_thread_username'] . '</a><br />' . "\n";
            // Listing moderators in forum category
            if (isset($category['ovs'])) {
                $output .= '<em>Ansvariga ordningsvakter:</em> ' . "\n";
                foreach ($category['ovs'] as $ov) {
                    if ($ov['lastaction'] > time() - 600) {
                        $output .= '<a href="/traffa/profile.php?user_id=' . $ov['id'] . '><strong>' . $ov['username'] . '</strong></a> ' . "\n";
                    } else {
                        $output .= '<a href="/traffa/profile.php?user_id=' . $ov['id'] . '><span>' . $ov['username'] . '</span></a> ' . "\n";
                    }
                }
                $output .= '</td>' . "\n";
            }
            $output .= '	<td class="thread_count">' . $category['thread_count'] . ' trådar</td>' . "\n";
            if (login_checklogin()) {
                $new_threads = $category['thread_count'] - $_SESSION['forum']['categories'][$category['id']]['last_thread_count'];
                $text = $new_threads < 1 ? '' : '<strong>' . $new_threads . '</strong> nya';
                $text = $new_threads == 1 ? '<strong>1</strong> ny' : $text;
                $output .= '	<td class="new_threads">' . $text . '</td>' . "\n";
            }
            $output .= '</tr>' . "\n";
            $zebra = $zebra == 'even' ? 'uneven' : 'even';
        }
    }
    if ($table_open == true) {
        $output .= '</table>' . "\n";
    }
    return $output;
}
コード例 #3
0
ファイル: articles.lib.php プロジェクト: Rambutan/hamsterpaj
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;
}