Ejemplo n.º 1
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') == '') {