Example #1
0
function discussion_forum_parse_request($url)
{
    $url = strtolower($url);
    $url_query_parts = explode('?', $url);
    $url_anchor_parts = explode('#', $url_query_parts[0]);
    $url = $url_anchor_parts[0];
    if (substr($url, -1) == '/') {
        $url = substr($url, 0, -1);
    }
    if ($url == '/diskussionsforum') {
        $request['action'] = 'index';
    } elseif ($url == '/diskussionsforum/flytta_traad.php' && is_numeric($_POST['new_category'])) {
        $request['action'] = 'move_thread';
        $request['thread'] = array_pop(discussion_forum_post_fetch(array('post_id' => $_POST['thread_id'])));
        $request['new_category'] = array_pop(discussion_forum_categories_fetch(array('id' => $_POST['new_category'])));
    } elseif ($url == '/diskussionsforum/nytt_inlaegg.php') {
        $request['action'] = 'new_post';
    } elseif ($url == '/diskussionsforum/soek.php') {
        $request['action'] = 'search';
        $request['freetext'] = substr($url_query_parts[1], 9);
    } elseif ($url == '/diskussionsforum/nya_traadar.php') {
        $request['action'] = 'latest_threads';
    } elseif ($url == '/diskussionsforum/dina_traadar.php') {
        $request['action'] = 'threads_by_user';
        $request['user_id'] = $_SESSION['login']['id'];
    } elseif ($url == '/diskussionsforum/notiser.php') {
        $request['action'] = 'view_notices';
    } elseif ($url == '/diskussionsforum/notiser.new.php') {
        $request['action'] = 'view_new_notices';
    } elseif (substr($url, -4) == '.php' && substr($url, strrpos($url, '/'), 11) != '/traadsida_') {
        // Note: This does NOT have to be a thread, it could also be a help-page such as regler.php
        // AND, the url might be fomatted like this: /discussionsforum/traad_handtag/sida_1.php
        $explosion = explode('/', $url);
        $page_count_start = strrpos($url, '/sida_') + 6;
        $page_count_end = strrpos($url, '.');
        $page_count_length = $page_count_end - $page_count_start;
        $request['page_num'] = substr($url, $page_count_start, $page_count_length);
        $request['action'] = 'view_thread';
        $request['thread_handle'] = $explosion[count($explosion) - 2];
        /*//trace('datamirk', print_r($explosion, true));
        		$request['category'] = array_pop(discussion_forum_categories_fetch(array('handle' => $explosion[count($explosion)-3])));
        		if(!in_array($explosion[count($explosion)-3], array('hamsterpaj', 'nyheter', 'buggar_och_fel', 'spel_och_film', 'mellan_himmel_och_jord', 'mat', 'klaeder_och_utseende', 'djur_och_husdjur', 'historier_och_skaemt', 'mobiltelefoner', 'tonaaring', 'relationer', 'kropp_och_pubertet', 'sex', 'familjen', 'vaenner', 'skola', 'pengar', 'fritid', 'sport', 'traening', 'foereningsliv', 'motor', 'musik', 'film_och_tv', 'foto', 'litteratur', 'spel', 'datorspel', 'counter_strike', 'world_of_warcraft', 'xbox', 'playstation', 'nintendo', 'retrokonsoller', 'lajv_och_rollspel', 'datorer', 'support_och_hjaelp', 'haardvara', 'mjukvara', 'operativsystem', 'lan_och_naetverk', 'programmering', 'php_scripting', 'webbdesign', 'min_hemsida', 'vetenskap', 'fysik', 'kemi', 'biologi', 'matematik', 'teknik', 'elektronik', 'astronomi', 'psykologi', 'debatt', 'politik', 'religion', 'jaemstaelldhet', 'miljoe', 'filosofi', 'alkohol_tobak_droger', 'historia', 'oevrigt', 'koep_och_saelj', 'efterlysningar', 'forumlekar', 'listor_omroestningar', 'skraep_och_spam', 'teknik', 'kaerlek', 'open_source', 'presentationsteman', 'forum_error', 'ordningsvaktsforum')))
        		{
        			if($explosion[count($explosion)-3] != 'diskussionsforum')
        			{
        				trace('extreme_datamirk', $_SESSION['login']['username'] . ':' . $explosion[count($explosion)-3] . ' = ' . print_r($explosion, true));
        			}
        		}*/
    } else {
        $request['action'] = 'view_category';
        $explosion = explode('/', $url);
        $last_piece = $explosion[count($explosion) - 1];
        if (substr($last_piece, 0, 10) == 'traadsida_' && substr($last_piece, -4) == '.php' && is_numeric(substr($last_piece, 10, -4)) && intval(substr($last_piece, 10, -4)) > 0) {
            $request['page_offset'] = intval(substr(array_pop($explosion), 10, -4)) - 1;
        } else {
            $request['page_offset'] = 0;
        }
        $handle = array_pop($explosion);
        if ($handle == url_secure_string($handle)) {
            $viewers_userlevel = login_checklogin() ? $_SESSION['login']['userlevel'] : 0;
            $request['category'] = array_pop(discussion_forum_categories_fetch(array('handle' => $handle, 'viewers_userlevel' => $viewers_userlevel, 'disable_query_caching' => true)));
            $request['category_handle'] = $handle;
            if (count($request['category']) < 1) {
                $request['action'] = 'forum_not_found';
            }
        } else {
            $request['action'] = 'forum_not_found';
        }
    }
    return $request;
}
Example #2
0
    echo $admincontrol_out;
    $output .= rounded_corners_tabs_bottom();
}
if (is_privilegied('user_management_admin')) {
    //$out = '<h2 style="margin: 0px;">Varningar</h2>';
    //$query = 'SELECT
    $out .= '<h2 style="margin-top: 0px; margin-bottom: 0px;">Abuse log</h2>';
    $query = 'SELECT * FROM user_abuse WHERE user = "******" ORDER BY id DESC';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    $out .= '<ul style="margin: 0px;">' . "\n";
    while ($data = mysql_fetch_assoc($result)) {
        $out .= '<li>' . "\n";
        $out .= date('Y-m-d H:i', $data['timestamp']) . ' <strong>' . $data['admin'] . '</strong> ' . $data['freetext'];
        $out .= '</li>' . "\n";
    }
    $out .= '</ul>' . "\n";
    echo rounded_corners($out, $void, true);
    echo '<h2>De senaste inläggen i forumet och gästboken</h2>' . "\n";
    echo '<p>Inga knappar funkar, men det ska ändå inte visas publikt.</p>' . "\n";
    $forum_posts = discussion_forum_post_fetch(array('disable_forum_lookup' => true, 'author' => $params['user_id'], 'limit' => 7, 'order-direction' => 'DESC'));
    foreach ($forum_posts as $post) {
        echo '<a href="' . forum_get_url_by_post($post['id']) . '"><h2>Goto goto! Jalla Jalla! Jihad! Jihad! Go fetch it!</h2></a>' . "\n";
        echo discussion_forum_post_render($post, array(), array('show_post_controls' => false));
    }
}
if (is_privilegied('use_ghosting_tools')) {
    $guestbook_posts = guestbook_fetch(array('sender' => $params['user_id'], 'is_private' => 0, 'limit' => 5));
    echo guestbook_list($guestbook_posts);
}
echo $output;
ui_bottom();
Example #3
0
     $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'];
         }
     }
     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));
         foreach ($categories as $category) {
             $options['show_new_threads'] = true;
             $options['forum_id'] = $category['id'];
             $threads = discussion_forum_post_fetch($options);
             $output .= '<h2><a href="' . $category['url'] . '">' . $category['title'] . '</a></h2>' . "\n";
             if (count($threads) > 0) {
                 // next row gave lef a lot of spokenotices, so that has to be checked before release!
                 // $output .= '<a href="/ajax_gateways/discussion_forum.php?action=set_category_read&category=' . $category['id'] . '&return=' . $_SERVER['REQUEST_URI'] . '">Markera kategori som läst</a>' . "\n";
                 $options['notice_listing'] = false;
                 $output .= discussion_forum_thread_list($threads, $options);
             } else {
                 $output .= '<p>Inga nya trådar i kategorin :(</p>' . "\n";
             }
         }
     }
     break;
 default:
     $output = '<h1>Fel!</h1>' . "\n";
     $output .= '<p>Forumet kunde inte förstå din förfrågan, sidladdningen har avrbrutits!</p>' . "\n";
Example #4
0
    discussion_forum_remove_post(array('post_id' => $_GET['post_id'], 'mode' => 'unremove'));
}
if ($_GET['action'] == 'vote' && login_checklogin() && is_numeric($_GET['thread_id'])) {
    $query = 'UPDATE forum_read_posts SET has_voted = 1 WHERE thread_id = "' . $_GET['thread_id'] . '" AND user_id = "' . $_SESSION['login']['id'] . '" AND has_voted = 0';
    mysql_query($query);
    if (mysql_affected_rows() == 1) {
        $operand = $_GET['vote'] == 'positive' ? '+' : '-';
        $query = 'UPDATE forum_posts SET score = score ' . $operand . ' 1 WHERE id = "' . $_GET['thread_id'] . '"';
        mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    }
}
/* Thread subscriptions */
if ($_GET['action'] == 'add_thread_subscription') {
    $query = 'UPDATE forum_read_posts SET subscribing = "true" WHERE user_id = "' . $_SESSION['login']['id'] . '" AND thread_id = "' . $_GET['thread_id'] . '" LIMIT 1';
    mysql_query($query);
    $thread = array_pop(discussion_forum_post_fetch(array('post_id' => $_GET['thread_id'])));
    $_SESSION['forum']['subscriptions'][$_GET['thread_id']] = $thread;
}
if ($_GET['action'] == 'remove_thread_subscription') {
    $query = 'UPDATE forum_read_posts SET subscribing = "false" WHERE user_id = "' . $_SESSION['login']['id'] . '" AND thread_id = "' . $_GET['thread_id'] . '" LIMIT 1';
    mysql_query($query);
    unset($_SESSION['forum']['subscriptions'][$_GET['thread_id']]);
}
/* Category subscriptions */
if ($_GET['action'] == 'add_category_subscription') {
    $query = 'UPDATE forum_category_visits SET subscribing = 1 WHERE user_id = "' . $_SESSION['login']['id'] . '" AND category_id = "' . $_GET['category_id'] . '" LIMIT 1';
    mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    $_SESSION['forum']['categories'][$_GET['category_id']]['subscribing'] = 1;
    discussion_forum_reload_category_subscriptions();
}
if ($_GET['action'] == 'remove_category_subscription') {
Example #5
0
        $post = array_pop($post);
        $query = 'UPDATE forum_posts SET content = ';
        if (forum_security(array('action' => 'post_addition', 'post' => $post)) && strlen($_POST['addition']) > 0) {
            $addition = "\n\n" . '[tillagg:' . $_SESSION['login']['username'] . ':' . time() . ']' . "\n" . $_POST['addition'] . '[/tillagg]';
        }
        if (forum_security(array('action' => 'edit_post', 'post' => $post))) {
            $query .= '"' . $_POST['content'] . $addition . '"';
        } else {
            $query .= '"' . $post['content'] . $addition . '"';
        }
        $query .= ' WHERE id = "' . $_POST['post_id'] . '" LIMIT 1';
        mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    }
    echo '<h1>Ändring och tillägg sparat!</h1>' . "\n";
} elseif (isset($_GET['post_id']) && is_numeric($_GET['post_id'])) {
    $post = discussion_forum_post_fetch(array('post_id' => $_GET['post_id']));
    if (count($post) == 1) {
        $post = array_pop($post);
        $disabled = forum_security(array('action' => 'edit_post', 'post' => $post)) == true ? '' : ' disabled="disabled"';
        echo '<form method="post">' . "\n";
        echo '<input type="hidden" name="post_id" value="' . $_GET['post_id'] . '" />' . "\n";
        echo '<h5>Inläggstext</h5>' . "\n";
        echo '<textarea name="content"' . $disabled . ' class="content_editor">' . $post['content'] . '</textarea>' . "\n";
        if (forum_security(array('action' => 'post_addition', 'post' => $post)) == true) {
            echo '<h5>Tillägg</h5>' . "\n";
            echo '<textarea name="addition"></textarea>' . "\n";
        }
        // Edit av Joar
        echo '<input type="submit" value="Spara" />' . "\n";
        // Gamla:			echo '<input type="submit" value="Spara" />' . "\n";
    }
Example #6
0
$out .= '<th><label for="keywords">Sökfras</label></th>' . "\n";
$out .= '<td><input type="text" name="keywords" value="' . $_GET['keywords'] . '" /></td>' . "\n";
$out .= '</tr>' . "\n";
$out .= '</table>' . "\n";
$out .= '<input type="submit" id="submit" value="Sök" />' . "\n";
$out .= '</form>';
$out .= '</fieldset>' . "\n";
if (isset($_GET['keywords'])) {
    $page = isset($_GET['page']) && is_numeric($_GET['page']) && intval($_GET['page']) > 0 ? intval($page) : 1;
    $post_options['page_offset'] = $page - 1;
    $post_options['min_quality_level'] = 2;
    $post_options['limit'] = 15;
    $post_options['order-direction'] = 'DESC';
    $post_options['threads_only'] = true;
    $post_options['match'] = array('against' => $_GET['keywords'], 'in_columns' => 'p.content');
    $posts = discussion_forum_post_fetch($post_options);
    $search_keywords = explode(' ', $_GET['discussionforum_search']);
    //$out .= '<h1>Using ' . count($search_keywords) . ' keyword(s), query executed in ' . $query_execution_time . ' secounds</h1>';
    if (empty($posts)) {
        $out .= '<h2>Tyvärr, inga trådar med den beskrivningen kunde hittas. Kanske skulle ett annat sökord kunna fungera</h2>' . "\n";
    } else {
        $out .= '<h2>Din sökning genererade ' . count($posts) . ' träffar</h2>' . "\n";
        // List all threads
        $out .= '<h2>Trådar</h2>' . "\n";
        foreach ($posts as $post) {
            $out .= '<div>' . "\n";
            $out .= '<a href="' . forum_get_url_by_post($post['id']) . '" title="Gå till inlägget"><h3>' . $post['title'] . '</h3></a>' . "\n";
            $out .= '<p>' . (strlen($post['content']) > 400 ? substr($post['content'], 0, 400) . '...<a href="' . forum_get_url_by_post($post['id']) . '">[Läs mer]</a>' : $post['content']) . '</p>' . "\n";
            $out .= '<span>Skapad av <a href="">' . $post['author'] . '</a>' . "\n";
            $out .= ' i kategorin <a href="">' . $post['forum_id'] . '</a> - ' . "\n";
            $out .= 'den ' . $post['timestamp'] . '</span>' . "\n";
Example #7
0
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;
}