Example #1
0
                message_backstage(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
            }
        }
        // Delete the threads and any redirect threads
        $db->query('DELETE FROM ' . $db->prefix . 'threads WHERE id IN(' . $threads . ') OR moved_to IN(' . $threads . ')') or error('Unable to delete thread', __FILE__, __LINE__, $db->error());
        // Delete any subscriptions
        $db->query('DELETE FROM ' . $db->prefix . 'thread_subscriptions WHERE thread_id IN(' . $threads . ')') or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
        // Create a list of the comment IDs in this thread and then strip the search index
        $result = $db->query('SELECT id FROM ' . $db->prefix . 'comments WHERE thread_id IN(' . $threads . ')') or error('Unable to fetch comments', __FILE__, __LINE__, $db->error());
        $comment_ids = '';
        while ($row = $db->fetch_row($result)) {
            $comment_ids .= $comment_ids != '' ? ',' . $row[0] : $row[0];
        }
        // We have to check that we actually have a list of comment IDs since we could be deleting just a redirect thread
        if ($comment_ids != '') {
            decrease_comment_counts($comment_ids);
            strip_search_index($comment_ids);
        }
        // Delete comments
        $db->query('DELETE FROM ' . $db->prefix . 'comments WHERE thread_id IN(' . $threads . ')') or error('Unable to delete comments', __FILE__, __LINE__, $db->error());
        update_forum($fid);
        redirect('viewforum.php?id=' . $fid);
    }
    $page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Admin', 'luna'), __('Moderate', 'luna'));
    define('LUNA_ACTIVE_PAGE', 'admin');
    require 'header.php';
    load_admin_nav('content', 'moderate');
    ?>

	<form method="post" action="moderate.php?fid=<?php 
    echo $fid;
Example #2
0
function delete_thread($thread_id, $type)
{
    global $db;
    // Delete the thread and any redirect threads
    if ($type == "hard") {
        $db->query('DELETE FROM ' . $db->prefix . 'threads WHERE id=' . $thread_id . ' OR moved_to=' . $thread_id) or error('Unable to delete thread', __FILE__, __LINE__, $db->error());
    } elseif ($type == "soft") {
        $db->query('UPDATE ' . $db->prefix . 'threads SET soft = 1 WHERE id=' . $thread_id . ' OR moved_to=' . $thread_id) or error('Unable to soft delete thread', __FILE__, __LINE__, $db->error());
    } else {
        $db->query('UPDATE ' . $db->prefix . 'threads SET soft = 0 WHERE id=' . $thread_id . ' OR moved_to=' . $thread_id) or error('Unable to soft delete thread', __FILE__, __LINE__, $db->error());
    }
    // Create a list of the comment IDs in this thread
    $comment_ids = '';
    $result = $db->query('SELECT id FROM ' . $db->prefix . 'comments WHERE thread_id=' . $thread_id) or error('Unable to fetch comments', __FILE__, __LINE__, $db->error());
    while ($row = $db->fetch_row($result)) {
        $comment_ids .= $comment_ids != '' ? ',' . $row[0] : $row[0];
    }
    // Make sure we have a list of comment IDs
    if ($comment_ids != '') {
        if ($type == "hard") {
            decrease_comment_counts($comment_ids);
            strip_search_index($comment_ids);
            // Delete comments in thread
            $db->query('DELETE FROM ' . $db->prefix . 'comments WHERE thread_id=' . $thread_id) or error('Unable to delete comments', __FILE__, __LINE__, $db->error());
        } else {
            if ($type == "soft") {
                $db->query('UPDATE ' . $db->prefix . 'comments SET soft = 1 WHERE thread_id=' . $thread_id) or error('Unable to soft delete comments', __FILE__, __LINE__, $db->error());
            } else {
                $db->query('UPDATE ' . $db->prefix . 'comments SET soft = 0 WHERE thread_id=' . $thread_id) or error('Unable to soft delete comments', __FILE__, __LINE__, $db->error());
            }
        }
    }
    if ($type != "reset") {
        // Delete any subscriptions for this thread
        $db->query('DELETE FROM ' . $db->prefix . 'thread_subscriptions WHERE thread_id=' . $thread_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
    }
}