示例#1
0
文件: rest.php 项目: stof/pearweb
<?php

if (!isset($_GET['start']) or !isset($_GET['end']) or !is_numeric($_GET['start']) or !is_numeric($_GET['end'])) {
    response_header('ERROR');
    report_error('You must send a start and end time in timestamp format');
    response_footer();
    exit;
}
$start = (int) $_GET['start'];
$end = (int) $_GET['end'];
$allowed_types = array('pecl', 'pear');
if (!isset($_GET['type']) or !in_array(strtolower($_GET['type']), $allowed_types)) {
    $type = 'pear';
} else {
    $type = htmlspecialchars(strtolower($_GET['type']), ENT_QUOTES);
}
include_once 'pear-database-release.php';
$releases = release::getDateRange($start, $end, $type);
var_export(serialize($releases));