<?php require_once 'config.php'; $session->requireAdmin(); if (empty($_GET['id']) || !is_numeric($_GET['id'])) { die; } //invalid request $itemId = $_GET['id']; require 'design_head.php'; echo xhtmlMenu($forum_menu, 'blog_menu'); echo getForumDepthHTML(FORUM_FOLDER, $itemId); $item = getForumItem($itemId); if ($item) { echo showForumPost($item, '', false); } if (confirmed('Are you sure you want to delete this forum post?', 'id', $itemId)) { deleteForumItemRecursive($itemId); echo 'The forum and all subforums has been deleted'; } require 'design_foot.php';
<?php require 'config.php'; require 'design_head.php'; echo xhtmlMenu($forum_menu, 'blog_menu'); echo '<div class="forum_overview_group">'; echo 'The 5 last posts in the forum:<br/><br/>'; $list = getLastForumPosts(5); for ($i = 0; $i < count($list); $i++) { echo getForumDepthHTML(FORUM_FOLDER, $list[$i]['itemId']); echo showForumPost($list[$i], '#' . ($i + 1)); } echo '</div>'; require 'design_foot.php';
switch ($method) { case 'oldfirst': echo 'oldest first.'; break; case 'newfirst': echo 'newest first.'; break; case 'mostread': default: echo 'most read first.'; break; } echo '<br/><br/>'; for ($i = 0; $i < count($list); $i++) { //echo showForumPost($list[$i], 'Search result #'.($i+1), false, $criteria).'<br/>'; echo showForumPost($list[$i], 'Search result #' . ($i + 1), false) . '<br/>'; } $criteria = urlencode($criteria); echo 'Order search result by:<br/>'; if ($method == 'newfirst') { echo '<b>'; } echo '<a href="' . $_SERVER['PHP_SELF'] . '?c=' . $criteria . '&m=newfirst">Newest first</a><br/>'; if ($method == 'newfirst') { echo '</b>'; } if ($method == 'oldfirst') { echo '<b>'; } echo '<a href="' . $_SERVER['PHP_SELF'] . '?c=' . $criteria . '&m=oldfirst">Oldest first</a><br/>'; if ($method == 'oldfirst') {
function shareForumItem($itemId) { global $h; if (!$h->session->id || !is_numeric($itemId)) { return false; } if (!empty($_POST['fshare_mail'])) { if (is_email($_POST['fshare_mail'])) { $item = getForumItem($itemId); if (!empty($_POST['fshare_name'])) { $mail = "Hej " . $_POST['fshare_name'] . "!\n\n"; } else { $mail = "Hej!\n\n"; } $mail .= $h->session->username . " har skickat dig den här länken till dig från communityt\n"; $mail .= "på vår sajt, " . xhtmlGetUrl('/') . ".\n\n"; if ($item['authorId']) { $mail .= $item['itemSubject'] . ' av ' . $item['authorName'] . ', ' . formatTime($item['timeCreated']) . ":\n"; } else { $mail .= $item['itemSubject'] . ' av gäst, ' . formatTime($item['timeCreated']) . "\n"; } $mail .= "För att läsa inlägget i sin helhet, klicka på länken nedan:\n"; $mail .= xhtmlGetUrl('forum.php?id=' . $itemId . '#' . $itemId) . "\n\n"; if (!empty($_POST['fshare_comment'])) { $mail .= "\n"; $mail .= "Din kompis lämnade även följande hälsning:\n"; $mail .= $_POST['fshare_comment'] . "\n\n"; } $subject = 'Meddelande från communityt'; if (smtp_mail($_POST['fshare_mail'], $subject, $mail) == true) { echo 'Tipset ivägskickat<br/>'; } else { echo 'Problem med utskicket<br/>'; } } else { echo 'Ogiltig mailaddress!'; } return; } $data = getForumItem($itemId); echo showForumPost($data) . '<br/>'; echo xhtmlForm('forum_share', $_SERVER['PHP_SELF'] . '?id=' . $itemId); echo 'Din kompis namn: ' . xhtmlInput('fshare_name', '', 20, 30) . '<br/>'; echo t('E-mail') . ': ' . xhtmlInput('fshare_mail', '', 40, 50) . '<br/>'; echo '<br/>'; echo 'Hälsning:<br/>'; echo xhtmlTextarea('fshare_comment', '', 40, 6) . '<br/>'; echo xhtmlSubmit('Share'); echo xhtmlFormClose(); }