Example #1
0
if (!AmpConfig::get('statistical_graphs')) {
    debug_event('graph', 'Access denied, statistical graph disabled.', 1);
    exit;
}
$type = $_REQUEST['type'];
$user_id = intval($_REQUEST['user_id']);
$object_type = (string) scrub_in($_REQUEST['object_type']);
if (!Core::is_library_item($object_type)) {
    $object_type = null;
}
$object_id = intval($_REQUEST['object_id']);
$start_date = scrub_in($_REQUEST['start_date']);
$end_date = scrub_in($_REQUEST['end_date']);
$zoom = (string) scrub_in($_REQUEST['zoom']);
$width = intval($_REQUEST['width']);
$height = intval($_REQUEST['height']);
$graph = new Graph();
switch ($type) {
    case 'user_hits':
        $graph->render_user_hits($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
        break;
    case 'user_bandwidth':
        $graph->render_user_bandwidth($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
        break;
    case 'catalog_files':
        $graph->render_catalog_files($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
        break;
    case 'catalog_size':
        $graph->render_catalog_size($user_id, $object_type, $object_id, $start_date, $end_date, $zoom, $width, $height);
        break;
}