mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 20:55:28 +00:00
49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
include('data.php');
|
|
header('Content-type: application/json');
|
|
|
|
$data = array();
|
|
|
|
if (isset($_GET['summaryRaw'])) {
|
|
$data = array_merge($data, getSummaryData());
|
|
}
|
|
|
|
if (isset($_GET['summary'])) {
|
|
$sum = getSummaryData();
|
|
$sum['ads_blocked_today'] = number_format( $sum['ads_blocked_today']);
|
|
$sum['dns_queries_today'] = number_format( $sum['dns_queries_today']);
|
|
$sum['ads_percentage_today'] = number_format( $sum['ads_percentage_today'], 1, '.', '');
|
|
$sum['domains_being_blocked'] = number_format( $sum['domains_being_blocked']);
|
|
$data = array_merge($data, $sum);
|
|
}
|
|
|
|
if (isset($_GET['overTimeData'])) {
|
|
$data = array_merge($data, getOverTimeData());
|
|
}
|
|
|
|
if (isset($_GET['topItems'])) {
|
|
$data = array_merge($data, getTopItems());
|
|
}
|
|
|
|
if (isset($_GET['recentItems'])) {
|
|
if (is_numeric($_GET['recentItems'])) {
|
|
$data = array_merge($data, getRecentItems($_GET['recentItems']));
|
|
}
|
|
}
|
|
|
|
if (isset($_GET['getQueryTypes'])) {
|
|
$data = array_merge($data, getIpvType());
|
|
}
|
|
|
|
if (isset($_GET['getForwardDestinations'])) {
|
|
$data = array_merge($data, getForwardDestinations());
|
|
}
|
|
|
|
if (isset($_GET['getQuerySources'])) {
|
|
$data = array_merge($data, getQuerySources());
|
|
}
|
|
|
|
|
|
echo json_encode($data);
|
|
?>
|