Beispiel #1
0
     break;
 case validateRoute('POST', 'forums/\\d+/topics/\\d+/posts'):
     $mailbox = new Mailbox($db, $user);
     $forum = new Forum($db, $user, $mailbox);
     $user->updateLastForumAccess();
     $forum->addPost((int) $params[3], $postdata);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('PATCH', 'forums/\\d+/topics/\\d+/posts/\\d+'):
     $forum = new Forum($db, $user);
     $forum->updatePost((int) $params[1], (int) $params[3], (int) $params[5], $postdata["postData"]);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('DELETE', 'forums/\\d+/topics/\\d+/posts/\\d+'):
     $forum = new Forum($db, $user);
     $forum->deletePost((int) $params[1], (int) $params[3], (int) $params[5]);
     httpResponse();
     break;
 case validateRoute('GET', 'forums/users-online'):
     httpResponse($user->getForumOnline());
     break;
 case validateRoute('GET', 'forums/mark-all-topics-as-read'):
     $forum = new Forum($db, $user);
     httpResponse($forum->markAllTopicsAsRead());
     break;
 case validateRoute('GET', 'forums/unread-topics'):
     $forum = new Forum($db, $user);
     list($result, $totalCount) = $forum->getUnreadTopics((int) $_GET["limit"] ?: 10, (int) $_GET["index"] ?: 0);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('GET', 'forums/posts'):
Beispiel #2
0
<?php

require_once "config.php";
$page = new AdminPage();
if (isset($_GET['id'])) {
    $forum = new Forum();
    $forum->deletePost($_GET['id']);
}
if (isset($_GET['from'])) {
    $referrer = $_GET['from'];
} else {
    $referrer = $_SERVER['HTTP_REFERER'];
}
header("Location: " . $referrer);