Exemple #1
0
include_once '../../includes/easyparliament/init.php';
include_once INCLUDESPATH . "easyparliament/commentreport.php";
$this_page = "admin_commentreport";
$PAGE->page_start();
$PAGE->stripe_start();
$menu = $PAGE->admin_menu();
//////////////////////////////////////////////////////////////////////////////////
// Set up the variables and objects we'll need on this page.
$report_id = get_http_var('rid');
$comment_id = get_http_var('cid');
if (!is_numeric($report_id) || !is_numeric($comment_id)) {
    // Exit.
    trigger_error("We need valid comment and report IDs.", E_USER_ERROR);
}
$COMMENT = new COMMENT($comment_id);
if ($COMMENT->exists() == false) {
    // Exit.
    trigger_error("This is an invalid comment ID", E_USER_ERROR);
}
$REPORT = new COMMENTREPORT($report_id);
$FORMURL = new URL($this_page);
//////////////////////////////////////////////////////////////////////////////////
// Check that the user is allowed to take action, and this report isn't locked.
if ($REPORT->locked() && $REPORT->lockedby() != $THEUSER->user_id()) {
    print "<p><strong>Someone else was examining this report at " . $REPORT->locked() . " so you can only look at it, not take any action. You could try again in a few minutes.</strong></p>\n";
    $COMMENT->display();
    $REPORT->display();
    $PAGE->stripe_end(array(array('type' => 'html', 'content' => $menu)));
    $PAGE->page_end();
    exit;
} elseif ($THEUSER->is_able_to('deletecomment')) {
Exemple #2
0
<?php

// For when a user reports a comment.
$this_page = "commentreport";
include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/commentreport.php";
$PAGE->page_start();
$PAGE->stripe_start();
if (is_numeric(get_http_var('id'))) {
    // We have the id of a comment to report.
    $comment_id = get_http_var('id');
    $COMMENT = new COMMENT($comment_id);
    if ($COMMENT->exists() == false || !$COMMENT->visible()) {
        // This comment id didn't exist in the DB.
        trigger_error("There is no comment with an ID of '" . htmlentities($comment_id) . "'.", E_USER_NOTICE);
    }
    // OK, we've got a valid comment ID.
    if (get_http_var('submitted') == true) {
        // The form has been submitted.
        $errors = array();
        if (get_http_var('body') == '') {
            $errors['body'] = "Please enter a reason why you think this comment is not appropriate.";
        }
        if (preg_match('#http://|\\[url#', get_http_var('body'))) {
            $errors['body'] = 'Please do not give any web links in the report body.';
        }
        if (!$THEUSER->isloggedin()) {
            if (get_http_var('firstname') == '' || get_http_var('lastname') == '') {
                $errors['name'] = "Please let us know who you are!";
            }
            if (get_http_var('em') == '') {