Esempio n. 1
0
<?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';
Esempio n. 2
0
<?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';
Esempio n. 3
0
function forumEdit($itemId)
{
    global $h, $config;
    $item = getForumItem($itemId);
    if (!$item || $item['locked'] || !$h->session->isAdmin && $item['authorId'] != $h->session->id) {
        header('Location: ' . $config['start_page']);
        die;
    }
    $subject = '';
    $body = '';
    if (!empty($_POST['subject'])) {
        $subject = $_POST['subject'];
    }
    if (!empty($_POST['body'])) {
        $body = $_POST['body'];
    }
    if ($subject || $body) {
        $sticky = 0;
        if ($h->session->isAdmin && !empty($_POST['sticky'])) {
            $sticky = 1;
        }
        forumUpdateItem($itemId, $subject, $body, $sticky);
        if (forumItemIsMessage($itemId)) {
            header('Location: forum.php?id=' . $item['parentId'] . '#post' . $itemId);
        } else {
            header('Location: forum.php?id=' . $itemId);
        }
        die;
    }
    echo 'Title: ' . getForumDepthHTML(FORUM_FOLDER, $itemId) . '<br/>';
    if (forumItemIsMessage($itemId)) {
        echo 'Edit post:';
    } else {
        echo 'Edit thread:';
    }
    echo '<br/><br/>';
    echo '<form name="change" method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $itemId . '">';
    echo 'Subject:<br/>';
    echo '<input name="subject" size="60" value="' . $item['itemSubject'] . '"/><br/><br/>';
    if ($item['parentId'] && forumItemIsFolder($itemId)) {
        echo 'Description:<br/>';
        echo '<input type="text" name="body" size="60" value="' . $item['itemBody'] . '"/><br/><br/>';
    } else {
        if ($item['parentId']) {
            echo '<textarea name="body" cols="60" rows="14">' . $item['itemBody'] . '</textarea><br/><br/>';
        }
    }
    if ($h->session->isAdmin && forumItemIsDiscussion($itemId)) {
        echo '<input type="checkbox" class="checkbox" value="1" name="sticky"' . ($item['sticky'] ? ' checked="checked"' : '') . '/>';
        echo ' The thread is a sticky<br/><br/>';
    }
    echo '<input type="submit" class="button" value="Save"/>';
    echo '</form><br/><br/>';
}