$data = mysql_fetch_assoc($result); if ($data['thread_id'] > 0) { $module['thread_id'] = $data['thread_id']; } else { $thread_options['forum_id'] = 114; $thread_options['title'] = $module['name']; $thread_options['content'] = 'Det h채r 채r en kommenteringstr책d f철r modulen \\"' . $module['name'] . '\\" p책 f철rstasidan. Egentligen skall sj채lva modulen visas h채r i forumet, typ ovanf철r tr책den. Men det 채r vi inte klara med 채n, s책 tillsvidare f책r man kommentera utan att se modulen :)'; $thread_options['mode'] = 'new_thread'; $thread_options['author'] = 57100; $thread_options['fp_module_id'] = $module['id']; $module['thread_id'] = discussion_forum_post_create($thread_options); $query = 'UPDATE fp_modules SET thread_id = "' . $module['thread_id'] . '" WHERE id = "' . $module['id'] . '"'; mysql_query($query); } } $out .= '<p style="margin-top: 2px;"><a style="color: #565656; text-decoration: underline;" href="' . forum_get_url_by_post($module['thread_id']) . '" class="fp_moudle_commenting">Kommentera i forumet</a></p>' . "\n"; } if ($module['piraja'] == 'true') { $out .= '<p style="margin-top: 2px;"><a style="color: #565656; text-decoration: underline;" href="/piraja/prylar.php">Flera prylar</a></p>' . "\n"; } $out .= '<br style="font-size: 0px; height: 0px; clear: both; line-height: 0px;" />' . "\n"; if ($module['commenting'] == 'true' || $module['published'] == 'true' || $module['grading'] == 'true') { $out .= '<div class="controls">' . "\n"; if ($module['published'] == 'true') { $out .= '<p class="fp_module_published">Upplagd ' . date('Y-m-d', $module['launch']) . '</p>' . "\n"; } if ($module['grading'] == 'true') { if (login_checklogin() && !in_array($module['id'], $_SESSION['fp_module_votes'])) { $out .= '<img src="http://images.hamsterpaj.net/discussion_forum/thread_voting_plus.png" class="fp_vote" id="fp_vote_plus_' . $module['id'] . '" />' . "\n"; $out .= '<img src="http://images.hamsterpaj.net/discussion_forum/thread_voting_minus.png" class="fp_vote" id="fp_vote_minu_' . $module['id'] . '" />' . "\n"; }
echo '<input type="hidden" name="reference_id" value="' . $_GET['reference_id'] . '" />' . "\n"; foreach ($abuse_alternatives_by_type[$_GET['report_type']] as $handle) { echo '<input type="radio" name="abuse_type" class="abuse_radio" value="' . $handle . '" id="abuse_' . $handle . '" />' . "\n"; echo '<label for="abuse_' . $handle . '">' . $abuse_types[$handle]['label'] . '</label>' . "\n"; echo '<p>' . $abuse_types[$handle]['description'] . '</p>' . "\n"; } echo '<label for="abuse_freetext">Fritextbeskrivning</label>' . "\n"; echo '<textarea name="freetext" id="abuse_freetext"></textarea>' . "\n"; echo '<input type="submit" class="button_70" value="Nästa »" />' . "\n"; echo '</form>' . "\n"; } } elseif (login_checklogin() && isset($_POST['reference_id']) && is_numeric($_POST['reference_id'])) { $query = 'INSERT INTO abuse (timestamp, reporter, report_type, reference_id, abuse_type, freetext)'; $query .= ' VALUES("' . time() . '", "' . $_SESSION['login']['id'] . '", "' . $_POST['report_type'] . '", "' . $_POST['reference_id'] . '", "' . $_POST['abuse_type'] . '", "' . $_POST['freetext'] . '")'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $url = forum_get_url_by_post($_POST['reference_id']); echo '<h1>Din rapport har sparats</h1>' . "\n"; echo '<p>Vi kommer att granska din rapport och återkomma till dig med ett personligt svar inom 24 timmar.</p>' . "\n"; echo '<h2>Ärende-id: #' . mysql_insert_id() . '</h2>' . "\n"; echo '<br /> <a href="' . $url . '">Gå tillbaka till forumet</a>'; if ($_POST['report_type'] == 'guestbook_entry') { $query = 'UPDATE traffa_guestbooks SET is_private = 0, deleted = 0 WHERE id = "' . $_POST['reference_id'] . '" AND recipient = "' . $_SESSION['login']['id'] . '" LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); echo '<h1>OBS! Viktigt om rapporterade gästboksinlägg</h1>' . "\n"; echo '<p>För att våra ordningsvakter ska kunna granska ett inlägg får det inte vara privat eller borttaget. Privatisera inte och ta inte bort inlägget!</p>' . "\n"; } } else { ?> <h1>Rapportfunktionen för ett säkert Hamsterpaj</h1> <p> Vid varje gästboksinlägg, forumsinlägg, privat meddelande och vid darje användare finns en röd liten knapp med ett utropstecken på.
echo '</form></div>'; } else { if (isset($_GET['update']) && is_privilegied('news_admin')) { $query = 'UPDATE nyheter SET title="' . $_POST['title'] . '",body="' . $_POST['body'] . '",who="'; $query .= $_POST['who'] . '" WHERE id="' . $_GET['update'] . '" LIMIT 1'; mysql_query($query) or die('Error while updating data, used query:<br />' . $query); echo 'Nyheten har redigerats.<br />'; echo '<a href="' . $_SERVER['PHP_SELF'] . '"><<Tillbaka</a>'; } else { if (isset($_GET['add']) && is_privilegied('news_admin')) { $thread_options['forum_id'] = 2; $thread_options['content'] = $_POST['body']; $thread_options['title'] = $_POST['title']; $thread_options['mode'] = 'new_thread'; $thread_id = discussion_forum_post_create($thread_options); $thread_url = forum_get_url_by_post($thread_id); $query = 'INSERT INTO nyheter (who, tstamp, title, body, thread_url) VALUES ("' . $_SESSION['login']['username'] . '",'; $query .= 'UNIX_TIMESTAMP(),"' . $_POST['title'] . '","' . nl2br($_POST['body']) . '","' . $thread_url . '")'; mysql_query($query) or die(report_sql_error($query)); echo 'Nyheten har lagts in i databasen.<br />'; echo '<a href="' . $_SERVER['PHP_SELF'] . '"><<Tillbaka</a>'; // write_cache(); $query = 'INSERT INTO recent_updates (type, timestamp, url, label) VALUES ("text_news", "' . time() . '", "' . $thread_url . '", "' . $_POST['title'] . '")'; mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); msnbot_queue_add_everyone(array('message' => 'Nyhet på www.hamsterpaj.net!' . "\r\n\r\n" . $_POST['body'] . "\r\n\r\n" . 'Klicka på den här länken för att kommentera nyheten:' . "\r\n" . 'http://www.hamsterpaj.net/' . $thread_url)); } else { if (is_privilegied('news_admin')) { echo '<div id="contentPostbox">'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?add" method="post">'; echo 'Titel:<input type="text" name="title" length="40" cols="40" class="textbox"><br />'; echo 'Text:<br /><textarea name="body" rows="5" cols="70 class="textbox" class="textbox"></textarea><br />';
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();
$out .= '<div class="controls">' . "\n"; if ($module['published'] == 'true') { $out .= '<p class="fp_module_published">Upplagd ' . date('Y-m-d', $module['launch']) . '</p>' . "\n"; } if ($module['commenting'] == 'true') { if ($module['thread_id'] == 0) { $thread_options['forum_id'] = 114; $thread_options['title'] = $module['name']; $thread_options['content'] = 'Eric Jerlin är lite rund om magen'; $thread_options['mode'] = 'new_thread'; $thread_options['author'] = 57100; $module['thread_id'] = discussion_forum_post_create($thread_options); $query = 'UPDATE fp_modules SET thread_id = "' . $module['thread_id'] . '" WHERE id = "' . $module['id'] . '"'; mysql_query($query); } $out .= '<a href="' . forum_get_url_by_post($module['thread_id']) . '" class="fp_moudle_commenting">Kommentera i forumet</a>' . "\n"; } if ($module['grading'] == 'true') { if (login_checklogin() && !in_array($module['id'], $_SESSION['fp_module_votes'])) { $out .= '<img src="http://images.hamsterpaj.net/discussion_forum/thread_voting_plus.png" class="fp_vote" id="fp_vote_plus_' . $module['id'] . '" />' . "\n"; $out .= '<img src="http://images.hamsterpaj.net/discussion_forum/thread_voting_minus.png" class="fp_vote" id="fp_vote_minu_' . $module['id'] . '" />' . "\n"; } $out .= '<p class="fp_module_score"><span id="fp_module_score_' . $module['id'] . '">' . $module['score'] . '</span>p</p>' . "\n"; } if ($module['clicks'] > 0) { $out .= '<p>' . cute_number($module['clicks']) . ' klick</p>' . "\n"; } $out .= '</div>' . "\n"; } $out .= '</li>' . "\n"; }
function sex_sense_render_posts($posts, $options = array()) { foreach ($posts as $post) { $out .= sex_sense_bright_container_top(); $out .= sex_sense_dark_container_top(); $out .= '<h3 class="sex_sense_post_header" id="header_' . $post['id'] . '">' . $post['title'] . '</h3>' . "\n"; $out .= sex_sense_dark_container_bottom(); $out .= '<div class="' . (isset($options['unhide_content']) && $options['unhide_content'] == true ? 'content' : 'hidden_content') . '" id="content_' . $post['id'] . '">'; $out .= '<p>' . nl2br($post['question']) . '</p>' . "\n"; foreach ($post['answers'] as $answer) { $out .= ui_avatar($answer['user_id']); $out .= sex_sense_bubble_top(); $out .= '<h4>' . $answer['username'] . ' svarar:</h4>' . "\n"; $out .= '<p>' . nl2br($answer['answer']); $out .= is_privilegied('sex_sense_admin') ? '<br /><a href="/sex_och_sinne/aendra_svar.php?id=' . $answer['id'] . '">Ändra svar.</a>' : ''; $out .= '</p>' . "\n"; $out .= sex_sense_bubble_bottom(); } $direct_link = '/sex_och_sinne/'; $categories = sex_sense_fetch_categories(array('category_id' => $post['category_id'])); foreach ($categories as $category_tree) { $category = array_pop($category_tree); $direct_link .= $category['category_handle'] . '/'; } $direct_link .= $post['handle'] . '.html'; $out .= '<button class="button_80" onclick="window.location=\'' . $direct_link . '\';">Direktlänk</button>' . "\n"; if ($post['forum_post_id'] != 0) { $thread_url = forum_get_url_by_post($post['forum_post_id']); $out .= '<button class="button_140" onclick="window.location=\'' . $thread_url . '\';">Diskutera i forumet</button>' . "\n"; } $out .= is_privilegied('sex_sense_admin') ? '<br /><a href="/sex_och_sinne/admin.php?id=' . $post['id'] . '">Ändra fråga/lägg till svar »</a>' : ''; $out .= '<div style="clear: both; height: 5px;"></div>' . "\n"; $out .= '</div>'; $out .= sex_sense_bright_container_bottom(); $closed_content++; } return $out; }
function discussion_forum_post_list_search($posts) { $o = '<ul class="forum_search_results">' . "\n"; foreach ($posts as $post) { $o .= '<li><h3>Av: ' . $post['username'] . ' i: <a href="' . forum_get_url_by_post($post['id']) . '">tråden ' . $post['title'] . '</a> vid:' . date('Y-m-d H:i', $post['timestamp']) . '</h3>'; $o .= '<p>' . substr($post['content'], 0, 250) . '</p>' . "\n"; $o .= '</li>'; } $o .= '</ul>' . "\n"; return $o; }
<?php require '../include/core/common.php'; include PATHS_INCLUDE . 'libraries/discussion_forum.lib.php'; if ($_GET['action'] == 'direct_link_fetch' && isset($_GET['post_id']) && is_numeric($_GET['post_id'])) { $link = forum_get_url_by_post($_GET['post_id']); if ($link === false) { die('Länkfel, meddela SysOP. Rad ' . __LINE__ . ' fil ' . __FILE__); } else { die('http://www.hamsterpaj.net' . $link); } } if ($_GET['action'] == 'remove_post' && forum_security(array('action' => 'remove_post', 'post_id' => $_GET['post_id']))) { echo 'Removing post'; $posts = discussion_forum_post_fetch(array('post_id' => $_GET['post_id'])); if (count($posts) != 1) { trace('forum_remove_error', __FILE__ . ':' . __LINE__ . ' data: ' . print_r($_GET, true)); exit; } $post = array_pop($posts); discussion_forum_remove_post(array('post_id' => $_GET['post_id'], 'removal_comment' => $_GET['removal_comment'])); $message = 'Hej, ditt inlägg i forumet med titeln "%TITLE%" har tagits bort.' . "\n"; $message .= 'Ordningsvakten som tog bort ditt inlägg heter %REMOVERS_USERNAME% och gjorde följande notering:' . "\n\n"; $message .= '-----' . "\n"; $message .= '%REMOVAL_COMMENT%' . "\n"; $message .= '-----' . "\n\n"; $message .= 'Här är ditt inlägg:' . "\n"; $message .= '-----' . "\n"; $message .= '%CONTENT%' . "\n"; $message .= '-----' . "\n\n"; $message .= 'Har du några frågor så ta det med någon ordningsvakt, du hittar sådana i modulen "Inloggade Ordningsvakter" till höger.' . "\n";
if ($forum_security !== true) { $output .= $forum_security; break; } $post['content'] = $_POST['content']; $post['parent_post'] = $_POST['parent']; $post['forum_id'] = $_POST['forum_id']; $post['mode'] = 'new_post'; $post_id = discussion_forum_post_create($post); if ($_SESSION['preferences']['forum_subscribe_on_post'] == 1) { $query = 'UPDATE forum_read_posts SET subscribing = "true" WHERE user_id = "' . $_SESSION['login']['id'] . '" AND thread_id = "' . $_POST['parent'] . '" LIMIT 1'; mysql_query($query); $thread = array_pop(discussion_forum_post_fetch(array('post_id' => $_POST['parent']))); $_SESSION['forum']['subscriptions'][$_POST['parent']] = $thread; } $redirect_url = forum_get_url_by_post($post_id); } header('Location: ' . $redirect_url); break; case 'threads_by_user': $ui_options['menu_path'][] = 'user_threads'; $output .= '<h2>Dina 50 senaste trådar</h2>' . "\n"; $post_options['threads_only'] = true; $post_options['order-by'] = 'p.id'; $post_options['order-direction'] = 'DESC'; $post_options['limit'] = 50; $post_options['author'] = $request['user_id']; $post_options['max_userlevel'] = login_checklogin() ? $_SESSION['login']['userlevel'] : 0; $threads = discussion_forum_post_fetch($post_options); $output .= discussion_forum_thread_list($threads); break;
while ($data = mysql_fetch_assoc($result)) { $out .= '<div id="abuse_report_' . $data['id'] . '">'; $options['color'] = 'blue_deluxe'; $out .= rounded_corners_top($options); switch ($data['report_type']) { case 'forum_post': $post_query = 'SELECT content, author FROM forum_posts WHERE id = "' . $data['reference_id'] . '" LIMIT 1'; $post_result = mysql_query($post_query) or report_sql_error($post_query, __FILE__, __LINE__); $post = mysql_fetch_assoc($post_result); $post_poster_query = 'SELECT username, id FROM login WHERE id = ' . $post['author'] . ' LIMIT 1'; $post_poster_result = mysql_query($post_poster_query) or report_sql_error($post_poster_query, __FILE__, __LINE__); $post_poster = mysql_fetch_assoc($post_poster_result); $out .= '<strong>Forumpost av <a href="/traffa/user_facts.php?user_id=' . $post['author'] . '">' . $post_poster['username'] . '</a> - Rapporterad av <a href="/traffa/profile.php?id=' . $data['reporter'] . '">' . $data['report_username'] . '</a> <a href="/admin/user_management.php?username='******'report_username'] . '">[UA]</a> ' . fix_time($data['timestamp']) . '</strong>: ' . $abuse_types[$data['abuse_type']]['label'] . '<br />' . "\n"; $out .= '<p style="font-style: italic">' . $data['freetext'] . '</p>' . "\n"; $out .= discussion_forum_parse_output(strlen($post['content']) > 1000 ? substr($post['content'], 0, 1000) . ' [b][INLÄGGET HAR KAPATS AV][/b]' : $post['content']); $url = forum_get_url_by_post($data['reference_id']); $out .= '<br /><a href="' . $url . '">Gå till inlägget</a>' . "\n"; break; case 'guestbook_entry': $entry_query = 'SELECT message, sender FROM traffa_guestbooks WHERE id = "' . $data['reference_id'] . '" LIMIT 1'; $entry_result = mysql_query($entry_query) or report_sql_error($entry_query, __FILE__, __LINE__); $entry = mysql_fetch_assoc($entry_result); $entry_poster_query = 'SELECT username, id FROM login WHERE id = ' . $entry['sender'] . ' LIMIT 1'; $entry_poster_result = mysql_query($entry_poster_query) or report_sql_error($entry_poster_query, __FILE__, __LINE__); $entry_poster = mysql_fetch_assoc($entry_poster_result); $out .= '<strong>Gästboksinlägg av <a href="/traffa/user_facts.php?user_id=' . $entry['sender'] . '">' . $entry_poster['username'] . '</a> - Rapporterat av <a href="/traffa/guestbook.php?view=' . $data['reporter'] . '">' . $data['report_username'] . '</a> <a href="/admin/user_management.php?username='******'report_username'] . '">[UA]</a> ' . fix_time($data['timestamp']) . '</strong>: ' . $abuse_types[$data['abuse_type']]['label'] . '<br />' . "\n"; $out .= '<p style="font-style: italic">' . $data['freetext'] . '</p>' . "\n"; $out .= '<p>' . (strlen($entry['message']) > 1000 ? substr($entry['message'], 0, 1000) . ' [INLÄGGET HAR KAPATS AV]' : $entry['message']) . '</p>' . "\n"; break; case 'photo': $photo_query = 'SELECT user FROM user_photos WHERE id = ' . $data['reference_id'] . ' LIMIT 1';
function schedule_releases_do($options) { /* option array support comment item_id yes type yes release_after no */ //trace('schedule', 'Init'); $options['release_before'] = time(); $options['released'] = 0; $events = schedule_event_fetch($options); foreach ($events as $event) { //trace('schedule', 'Releasing ' . $event['type']); $data = unserialize($event['data']); switch ($event['type']) { case 'todays_discussion': trace('todays_discussion_break', 'Tried to release todays_discussion in ' . __FILE__ . ' on line ' . __LINE__); break; case 'contest': contests_create($data); $url = '/taevlingar/'; $label = $data['title']; break; case 'poll': $poll_handle = poll_create($data); $poll = poll_fetch(array('handle' => $poll_handle)); $post['content'] = '[poll:' . $poll[0]['id'] . ']'; $post['forum_id'] = 78; $post['title'] = 'Undersökning: ' . $poll[0]['question']; $post['mode'] = 'new_thread'; $post['author'] = 2348; // Webmaster $thread_id = discussion_forum_post_create($post); $comment_url = forum_get_url_by_post($thread_id); $query = 'UPDATE poll SET comment_url = "' . $comment_url . '" WHERE id = "' . $poll[0]['id'] . '"'; mysql_query($query); $url = '/index.php#poll'; $label = $data['question']; break; /* Old sex and sense case 'sex_sense': $entry_id = sex_sense_create($data); $entry = sex_sense_fetch(array('id' => $entry_id)); $url = '/sex_och_sinne/' . $entry[0]['category'] . '/' . $entry[0]['handle'] . '.html'; $label = $entry[0]['title']; break;*/ /* Old sex and sense case 'sex_sense': $entry_id = sex_sense_create($data); $entry = sex_sense_fetch(array('id' => $entry_id)); $url = '/sex_och_sinne/' . $entry[0]['category'] . '/' . $entry[0]['handle'] . '.html'; $label = $entry[0]['title']; break;*/ case 'sex_sense': try { $entries = sex_sense_fetch_posts($data['fetch_item_options']); if (count($entries) != 1) { throw new Exception('Fel 1 i schedule_releae! Base64(serialize): ' . base64_encode(serialize($data))); } $entry = array_pop($entries); $query = 'UPDATE sex_questions SET is_released = 1 WHERE id = ' . $entry['id']; $label = $entry['title']; $url = '/sex_och_sinne/'; $categories = sex_sense_fetch_categories(array('category_id' => $entry['category_id'])); foreach ($categories as $category_tree) { $category = array_pop($category_tree); $url .= $category['category_handle'] . '/'; } $url .= $entry['handle'] . '.html'; // Forum thread creation (main thread) unset($thread); $thread['author'] = '876354'; $thread['title'] = $entry['title']; $thread['mode'] = 'new_thread'; $thread['forum_id'] = '102'; $thread['content'] = $entry['question']; $thread_id = discussion_forum_post_create($thread); $query = 'UPDATE sex_questions SET forum_post_id = ' . $thread_id . ', is_released = 1 WHERE id = ' . $entry['id']; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); // Create forum posts and guestbook notifications for all answers. sex_sense_answer_distribute(array('post_id' => $entry['id'])); } catch (Exception $error) { trace('sex_sense_schedule', $error->getMessage()); } break; case 'music_guess': $query = 'INSERT INTO music_guess_songs (secret_id, artist, song, alternate_spellings, timestamp, artist_score, song_score)' . "\n"; $query .= ' VALUES("' . $data['secret_id'] . '", "' . $data['artist'] . '", "' . $data['song'] . '", "' . addslashes(serialize($data['alternate_spellings'])) . '", "' . time() . '", "' . $data['artist_score'] . '", "' . $data['song_score'] . '")'; mysql_query($query) or trace('sql_error', $query . ' ' . mysql_error()); $url = '/mattan/gissa_laaten.php'; $label = 'Ny låt!'; break; case 'survey': survey_create($data); $survey = survey_fetch(array('type' => 'front_page')); cache_save('fp_survey', $survey); $url = '/index.php#survey'; $label = $data['question']; break; case 'new_image': case 'new_clip': case 'new_flash': case 'new_background': case 'new_software': case 'new_prank': case 'new_music': case 'new_game': $url = $data['url']; $label = $data['title']; break; } $query = 'INSERT INTO recent_updates (type, label, timestamp, url)' . ' VALUES("' . $event['type'] . '", "' . $label . '", "' . $event['release'] . '", "' . $url . '")'; $query . '<br />'; if (!mysql_query($query)) { report_sql_error($query, __FILE__, __LINE__); } else { $query = 'UPDATE scheduled_events SET released = 1 WHERE id="' . $event['id'] . '"'; if (!mysql_query($query)) { report_sql_error($query, __FILE__, __LINE__); } else { log_to_file('scheduled_events', LOGLEVEL_INFO, __FILE__, __LINE__, 'released ' . $event['type'] . ' id: ' . $event['id'] . ' ' . date('Y-m-d H:i', $release)); } } } }
<?php require '../include/core/common.php'; require_once PATHS_INCLUDE . 'libraries/discussion_forum.lib.php'; if (isset($_GET['post_id']) && is_numeric($_GET['post_id']) && intval($_GET['post_id']) > 0) { $post_id = intval($_GET['post_id']); $url_to_post = forum_get_url_by_post($post_id); if (trim($url_to_post) == '') { jscript_alert('Kunde inte hitta forumposten.'); jscript_go_back(); } else { header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $url_to_post); die($url_to_post); } } else { die('Död'); }
$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"; $out .= '</div>' . "\n"; //$out .= discussion_forum_post_render($post, array(), array('show_post_controls' => false, 'search_highlight' => $search_keywords)); //$out .= '<a style="margin-left: 20px;" href="' . forum_get_url_by_post($post['id']) . '">Gå till inlägget »</a>' . "\n"; } } } ui_top($ui_options); echo $out; ui_bottom();
$out .= '<h1>Här kan du söka i Hamsterpajs forum</h1>' . "\n"; $out .= '<div class="discussionforum_searchbox">' . "\n"; $out .= '<form action="" method="get">' . "\n"; $out .= '<input type="text" id="discussionforum_search" class="discussionforum_search" name="discussionforum_search" value="' . $_GET['discussionforum_search'] . '" />' . "\n"; $out .= '<input type="submit" value="Sök" class="search_button" />' . "\n"; $out .= '</form>' . "\n"; $out .= '</div><br style="clear: both;" />' . "\n"; if (isset($_GET['discussionforum_search'])) { $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['discussionforum_search'], '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"; foreach ($posts as $post) { $out .= discussion_forum_post_render($post, array(), array('show_post_controls' => false, 'search_highlight' => $search_keywords)); $out .= '<a style="margin-left: 20px;" href="' . forum_get_url_by_post($post['id']) . '">Gå till inlägget »</a>' . "\n"; } } } ui_top($ui_options); echo $out; ui_bottom();