<?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';
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(); }