mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Processed with phpcbf
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
require_once '../../includes/config.php';
|
||||
require_once RASPI_CONFIG.'/raspap.php';
|
||||
@@ -30,10 +30,12 @@ if (strlen($interface) > IFNAMSIZ) {
|
||||
|
||||
require_once './get_bandwidth_hourly.php';
|
||||
|
||||
exec(sprintf('vnstat -i %s --json ', escapeshellarg($interface)), $jsonstdoutvnstat,
|
||||
$exitcodedaily);
|
||||
exec(
|
||||
sprintf('vnstat -i %s --json ', escapeshellarg($interface)), $jsonstdoutvnstat,
|
||||
$exitcodedaily
|
||||
);
|
||||
if ($exitcodedaily !== 0) {
|
||||
exit('vnstat error');
|
||||
exit('vnstat error');
|
||||
}
|
||||
|
||||
$jsonobj = json_decode($jsonstdoutvnstat[0], true);
|
||||
@@ -53,12 +55,16 @@ echo '[ ';
|
||||
$firstelm = true;
|
||||
for ($i = count($jsonData) - 1; $i >= 0; --$i) {
|
||||
if ($timeunits === 'm') {
|
||||
$dt = DateTime::createFromFormat('Y n', $jsonData[$i]['date']['year'].' '.
|
||||
$jsonData[$i]['date']['month']);
|
||||
$dt = DateTime::createFromFormat(
|
||||
'Y n', $jsonData[$i]['date']['year'].' '.
|
||||
$jsonData[$i]['date']['month']
|
||||
);
|
||||
} else {
|
||||
$dt = DateTime::createFromFormat('Y n j', $jsonData[$i]['date']['year'].' '.
|
||||
$dt = DateTime::createFromFormat(
|
||||
'Y n j', $jsonData[$i]['date']['year'].' '.
|
||||
$jsonData[$i]['date']['month'].' '.
|
||||
$jsonData[$i]['date']['day']);
|
||||
$jsonData[$i]['date']['day']
|
||||
);
|
||||
}
|
||||
|
||||
if ($firstelm) {
|
||||
|
@@ -1,66 +1,66 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
|
||||
if (filter_input(INPUT_GET, 'tu') == 'h') {
|
||||
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$data_template = array(
|
||||
0 => array('date' => '00:00', 'rx' => 0, 'tx' => 0),
|
||||
1 => array('date' => '01:00', 'rx' => 0, 'tx' => 0),
|
||||
2 => array('date' => '02:00', 'rx' => 0, 'tx' => 0),
|
||||
3 => array('date' => '03:00', 'rx' => 0, 'tx' => 0),
|
||||
4 => array('date' => '04:00', 'rx' => 0, 'tx' => 0),
|
||||
5 => array('date' => '05:00', 'rx' => 0, 'tx' => 0),
|
||||
6 => array('date' => '06:00', 'rx' => 0, 'tx' => 0),
|
||||
7 => array('date' => '07:00', 'rx' => 0, 'tx' => 0),
|
||||
8 => array('date' => '08:00', 'rx' => 0, 'tx' => 0),
|
||||
9 => array('date' => '09:00', 'rx' => 0, 'tx' => 0),
|
||||
10 => array('date' => '10:00', 'rx' => 0, 'tx' => 0),
|
||||
11 => array('date' => '11:00', 'rx' => 0, 'tx' => 0),
|
||||
12 => array('date' => '12:00', 'rx' => 0, 'tx' => 0),
|
||||
13 => array('date' => '13:00', 'rx' => 0, 'tx' => 0),
|
||||
14 => array('date' => '14:00', 'rx' => 0, 'tx' => 0),
|
||||
15 => array('date' => '15:00', 'rx' => 0, 'tx' => 0),
|
||||
16 => array('date' => '16:00', 'rx' => 0, 'tx' => 0),
|
||||
17 => array('date' => '17:00', 'rx' => 0, 'tx' => 0),
|
||||
18 => array('date' => '18:00', 'rx' => 0, 'tx' => 0),
|
||||
19 => array('date' => '19:00', 'rx' => 0, 'tx' => 0),
|
||||
20 => array('date' => '20:00', 'rx' => 0, 'tx' => 0),
|
||||
21 => array('date' => '21:00', 'rx' => 0, 'tx' => 0),
|
||||
22 => array('date' => '22:00', 'rx' => 0, 'tx' => 0),
|
||||
23 => array('date' => '23:00', 'rx' => 0, 'tx' => 0)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
exec(sprintf('vnstat -i %s --json h', escapeshellarg($interface)), $jsonstdoutvnstat, $exitcodedaily);
|
||||
if ($exitcodedaily !== 0) {
|
||||
exit('vnstat error');
|
||||
}
|
||||
|
||||
$jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0];
|
||||
$jsonData = $jsonobj['traffic']['hours'];
|
||||
for ($i = count($jsonData) - 1; $i >= 0; --$i) {
|
||||
$data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0);
|
||||
$data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$hour = $jsonobj['updated']['time']['hour'];
|
||||
foreach ($data_template as $key => $value) {
|
||||
if ($key > $hour) {
|
||||
array_push($data, $value);
|
||||
}
|
||||
}
|
||||
foreach ($data_template as $key => $value) {
|
||||
if ($key <= $hour) {
|
||||
array_push($data, $value);
|
||||
}
|
||||
}
|
||||
echo json_encode($data);
|
||||
exit(0);
|
||||
}
|
||||
<?php
|
||||
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
if (filter_input(INPUT_GET, 'tu') == 'h') {
|
||||
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$data_template = array(
|
||||
0 => array('date' => '00:00', 'rx' => 0, 'tx' => 0),
|
||||
1 => array('date' => '01:00', 'rx' => 0, 'tx' => 0),
|
||||
2 => array('date' => '02:00', 'rx' => 0, 'tx' => 0),
|
||||
3 => array('date' => '03:00', 'rx' => 0, 'tx' => 0),
|
||||
4 => array('date' => '04:00', 'rx' => 0, 'tx' => 0),
|
||||
5 => array('date' => '05:00', 'rx' => 0, 'tx' => 0),
|
||||
6 => array('date' => '06:00', 'rx' => 0, 'tx' => 0),
|
||||
7 => array('date' => '07:00', 'rx' => 0, 'tx' => 0),
|
||||
8 => array('date' => '08:00', 'rx' => 0, 'tx' => 0),
|
||||
9 => array('date' => '09:00', 'rx' => 0, 'tx' => 0),
|
||||
10 => array('date' => '10:00', 'rx' => 0, 'tx' => 0),
|
||||
11 => array('date' => '11:00', 'rx' => 0, 'tx' => 0),
|
||||
12 => array('date' => '12:00', 'rx' => 0, 'tx' => 0),
|
||||
13 => array('date' => '13:00', 'rx' => 0, 'tx' => 0),
|
||||
14 => array('date' => '14:00', 'rx' => 0, 'tx' => 0),
|
||||
15 => array('date' => '15:00', 'rx' => 0, 'tx' => 0),
|
||||
16 => array('date' => '16:00', 'rx' => 0, 'tx' => 0),
|
||||
17 => array('date' => '17:00', 'rx' => 0, 'tx' => 0),
|
||||
18 => array('date' => '18:00', 'rx' => 0, 'tx' => 0),
|
||||
19 => array('date' => '19:00', 'rx' => 0, 'tx' => 0),
|
||||
20 => array('date' => '20:00', 'rx' => 0, 'tx' => 0),
|
||||
21 => array('date' => '21:00', 'rx' => 0, 'tx' => 0),
|
||||
22 => array('date' => '22:00', 'rx' => 0, 'tx' => 0),
|
||||
23 => array('date' => '23:00', 'rx' => 0, 'tx' => 0)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
exec(sprintf('vnstat -i %s --json h', escapeshellarg($interface)), $jsonstdoutvnstat, $exitcodedaily);
|
||||
if ($exitcodedaily !== 0) {
|
||||
exit('vnstat error');
|
||||
}
|
||||
|
||||
$jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0];
|
||||
$jsonData = $jsonobj['traffic']['hours'];
|
||||
for ($i = count($jsonData) - 1; $i >= 0; --$i) {
|
||||
$data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0);
|
||||
$data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$hour = $jsonobj['updated']['time']['hour'];
|
||||
foreach ($data_template as $key => $value) {
|
||||
if ($key > $hour) {
|
||||
array_push($data, $value);
|
||||
}
|
||||
}
|
||||
foreach ($data_template as $key => $value) {
|
||||
if ($key <= $hour) {
|
||||
array_push($data, $value);
|
||||
}
|
||||
}
|
||||
echo json_encode($data);
|
||||
exit(0);
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
include_once('../../includes/config.php');
|
||||
include_once('../../includes/functions.php');
|
||||
require_once '../../includes/config.php';
|
||||
require_once '../../includes/functions.php';
|
||||
|
||||
if (isset($_POST['generate'])) {
|
||||
$cnfNetworking = array_diff(scandir(RASPI_CONFIG_NETWORKING, 1), array('..','.','dhcpcd.conf'));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
exec("ls /sys/class/net | grep -v lo", $interfaces);
|
||||
echo json_encode($interfaces);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
include_once('../../includes/config.php');
|
||||
require '../../includes/csrf.php';
|
||||
require_once '../../includes/config.php';
|
||||
|
||||
exec('cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig);
|
||||
$arrConfig = array();
|
||||
@@ -10,7 +10,7 @@ foreach ($hostapdconfig as $hostapdconfigline) {
|
||||
if (strlen($hostapdconfigline) === 0) {
|
||||
continue;
|
||||
}
|
||||
$arrLine = explode("=", $hostapdconfigline) ;
|
||||
$arrLine = explode("=", $hostapdconfigline);
|
||||
$arrConfig[$arrLine[0]]=$arrLine[1];
|
||||
};
|
||||
$channel = intval($arrConfig['channel']);
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
include_once('../../includes/config.php');
|
||||
include_once('../../includes/functions.php');
|
||||
require_once '../../includes/config.php';
|
||||
require_once '../../includes/functions.php';
|
||||
|
||||
|
||||
if (isset($_POST['interface'])) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
include_once('../../includes/functions.php');
|
||||
require_once '../../includes/functions.php';
|
||||
|
||||
if (isset($_POST['interface'])) {
|
||||
$int = preg_replace('/[^a-z0-9]/', '', $_POST['interface']);
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
include_once('../../includes/config.php');
|
||||
include_once('../../includes/functions.php');
|
||||
require_once '../../includes/config.php';
|
||||
require_once '../../includes/functions.php';
|
||||
|
||||
if (isset($_POST['interface'])) {
|
||||
$int = $_POST['interface'];
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
require('../../includes/csrf.php');
|
||||
include_once('../../includes/config.php');
|
||||
include_once('../../includes/defaults.php');
|
||||
include_once('../../includes/functions.php');
|
||||
include_once('../../includes/wifi_functions.php');
|
||||
require '../../includes/csrf.php';
|
||||
require_once '../../includes/config.php';
|
||||
require_once '../../includes/defaults.php';
|
||||
require_once '../../includes/functions.php';
|
||||
require_once '../../includes/wifi_functions.php';
|
||||
|
||||
$networks = [];
|
||||
$network = null;
|
||||
|
Reference in New Issue
Block a user