示例#1
0
 * required setup
 */
require_once LIBERTY_PKG_PATH . 'LibertyComment.php';
global $commentsLib, $gBitSmarty, $gBitSystem, $gBitThemes;
$postComment = array();
$formfeedback = array('error' => array());
$gBitSmarty->assign_by_ref('formfeedback', $formfeedback);
// make sure that we don't feed ajax comments if we don't have javascript enabled
if (!$gBitThemes->isJavascriptEnabled()) {
    $gBitSystem->setConfig('comments_ajax', 'n');
}
if (@BitBase::verifyId($_REQUEST['delete_comment_id'])) {
    $deleteComment = new LibertyComment($_REQUEST['delete_comment_id']);
    // make sure we're loaded up before we delete
    $deleteComment->loadComment();
    if ($deleteComment->isValid() && $gContent->hasUserPermission('p_liberty_admin_comments')) {
        // delete entire thread
        $deleteComment->expunge();
    }
}
if (@BitBase::verifyId($_REQUEST['post_comment_id']) && $gContent->hasUserPermission('p_liberty_post_comments')) {
    $post_comment_id = $_REQUEST['post_comment_id'];
    $editComment = new LibertyComment($post_comment_id);
    //if we are passed a comment id but not going to store it then turn off ajax
    if (!isset($_REQUEST['post_comment_submit']) && !isset($_REQUEST['post_comment_cancel'])) {
        //even if ajax is on - we force it off in this case
        $gBitSmarty->assign('comments_ajax', FALSE);
    }
    if ($editComment->mInfo['content_id']) {
        if ($editComment->userCanUpdate($gContent)) {
            $postComment['data'] = $editComment->mInfo['data'];
示例#2
0
then we check permission to delete boards.
if so, we call histlib's method remove_all_versions for all the checked boards.
*/
if (isset($_REQUEST["submit_mult"]) && isset($_REQUEST["checked"]) && $_REQUEST["submit_mult"] == "remove_boards") {
    // Now check permissions to remove the selected bitboard
    $gContent->verifyUserPermission('p_boards_remove');
    $gBitUser->verifyTicket();
    if (!empty($_REQUEST['cancel'])) {
        // user cancelled - just continue on, doing nothing
    } elseif (empty($_REQUEST['confirm'])) {
        $formHash['b'] = $_REQUEST['b'];
        $formHash['delete'] = TRUE;
        $formHash['submit_mult'] = 'remove_boards';
        foreach ($_REQUEST["checked"] as $del) {
            $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>';
        }
        $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete these topics?') . ' (' . tra('Count: ') . count($_REQUEST["checked"]) . ')', 'error' => tra('This cannot be undone!')));
    } else {
        foreach ($_REQUEST["checked"] as $deleteId) {
            $deleteComment = new LibertyComment($deleteId);
            if ($deleteComment->isValid() && $gBitUser->hasPermission('p_liberty_admin_comments')) {
                if (!$deleteComment->expunge()) {
                    $gBitSmarty->assignByRef('errors', $deleteComment->mErrors);
                }
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assignByRef('errors', $errors);
        }
    }
}