<?php use PluginDatabreakdown\Utils; require "../../../inc/includes.php"; // close session as soon as possible since we don't need it session_write_close(); $utils = new Utils(); $errors = array(); $response = array(); if (!isset($_GET['date_start'])) { // $errors[] = "no 'date_start' parameter"; $query_date_start = null; } else { $query_date_start = $_GET['date_start']; } if (!isset($_GET['date_end'])) { $errors[] = "no 'date_end' parameter"; } else { $query_date_end = $_GET['date_end']; } if (!isset($_GET['date_fmt'])) { $errors[] = "no 'date_fmt' parameter"; } else { // check for valid date format $query_date_format = $_GET['date_fmt']; if (!in_array($query_date_format, $utils->allowed_date_formats)) { $errors[] = "date_fmt='" . $query_date_format . "' is not allowed." . "(Allowed formats: " . implode(', ', $utils->allowed_date_formats) . ")"; } } if (count($errors)) { http_response_code(400);
<?php require_once "../../../inc/includes.php"; use PluginDatabreakdown\Charts; use PluginDatabreakdown\Utils; // close session as soon as possible since we don't need it session_write_close(); $utils = new Utils(); $response = array(); $charts = new Charts(); $response['result'] = $charts->get_list(); $utils->reply($response);