verify() static public method

static public verify ( )
示例#1
0
<?php

/**
 * Takes care of removing comments.
 * 
 * Events:
 * 
 * - "did-remove-comment", $comment
 *   Posted after a comment was removed, but before the response is sent.
 * 
 */
require '../../gitblog.php';
ini_set('html_errors', '0');
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: no-cache');
gb::verify();
gb::authenticate();
gb::load_plugins('admin');
static $fields = array('object' => FILTER_REQUIRE_SCALAR, 'comment' => FILTER_REQUIRE_SCALAR);
static $required_fields = array('object', 'comment');
# sanitize and validate input
$input = filter_input_array($_SERVER['REQUEST_METHOD'] === 'POST' ? INPUT_POST : INPUT_GET, $fields);
function exit2($msg, $status = '400 Bad Request')
{
    header('Status: ' . $status);
    exit($status . "\n" . $msg . "\n");
}
# Optimally only allow the DELETE method, but as we live with HTML that's not
# gonna happen very soon unfortunately.
# assure required fields are OK
$fields_missing = array();