Esempio n. 1
0
$board->load();
$rslt = false;
// Edit calls
// Set locked or sticky
if (isset($_REQUEST['is_locked']) || isset($_REQUEST['is_sticky'])) {
    // Check permissions to edit this topic
    $board->verifyUpdatePermission();
    if (isset($_REQUEST['is_locked']) && is_numeric($_REQUEST['is_locked'])) {
        $rslt = $gContent->lock($_REQUEST['is_locked']);
    } elseif (isset($_REQUEST['is_sticky']) && is_numeric($_REQUEST['is_sticky'])) {
        $rslt = $gContent->sticky($_REQUEST['is_sticky']);
    }
    // Remove a topic
} elseif (isset($_REQUEST['remove'])) {
    // Check permissions to edit this topic if the root object is the board check its perms, otherwise check general comment admin perms
    if (!($gContent->mInfo['root_id'] == $gContent->mInfo['board_content_id'] && $board->hasAdminPermission() || $gBitUser->hasPermission('p_liberty_admin_comments'))) {
        $gBitSystem->fatalError(tra('You do not have permission to delete this topic.'));
    }
    if (!empty($_REQUEST['cancel'])) {
        // user cancelled - just continue on, doing nothing
    } elseif (empty($_REQUEST['confirm'])) {
        $formHash['remove'] = TRUE;
        $formHash['t'] = $_REQUEST['t'];
        $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete this topic?') . ' ' . $gContent->getTitle(), 'error' => tra('This cannot be undone!')));
    } else {
        // @TODO Topic should extend LibertyComment - but until that day we load it up a second time
        $topicAsComment = new LibertyComment($_REQUEST['t']);
        if (!$topicAsComment->expunge()) {
            $gBitSmarty->assignByRef('errors', $topicAsComment->mErrors);
        }
        // send us back to the baord - http_referer won't work with confirm process
Esempio n. 2
0
// Is package installed and enabled
$gBitSystem->verifyPackage('boards');
// Look up Topic (lookup_inc is universal, gContent == BitBoardTopic)
require_once BOARDS_PKG_PATH . 'lookup_inc.php';
// Make sure topic exists since we only run through here for existing topics. New topics are created via comment system.
if (!$gContent->isValid()) {
    $gBitSystem->fatalError('No topic specified');
}
// Load up the Topic's board - we'll respect its permissions
$board = new BitBoard($gContent->mInfo['board_id']);
$board->load();
$board->verifyAdminPermission();
if (isset($_REQUEST["target"])) {
    // Check the user's ticket
    $gBitUser->verifyTicket();
    $targetBoard = new BitBoard(null, $_REQUEST["target"]);
    $targetBoard->load();
    if (!$targetBoard->hasAdminPermission()) {
        $gBitSystem->fatalError('You do not have permission to move topics to the Board' . $targetBoard->mInfo['title']);
    }
    if ($gContent->moveTo($_REQUEST["target"])) {
        bit_redirect($gContent->getDisplayUrl());
    } else {
        $gBitSystem->fatalError("There was an error moving the topic: " . vc($gContent->mErrors));
    }
}
// get list of boards we can move the topic to
$boards = $board->getBoardSelectList();
$gBitSmarty->assignByRef('boards', $boards);
$gBitSmarty->assign('fromBoardId', $board->mContentId);
$gBitSystem->display('bitpackage:boards/topic_move.tpl', tra('Move Topic') . ':' . $gContent->getTitle(), array('display_mode' => 'display'));