mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 10:37:39 -07:00
Integrated new api interface.
This commit is contained in:
parent
4a9bfc94ad
commit
4306a4fb4f
116 changed files with 10371 additions and 0 deletions
47
web/api/v1/list/ip/index.php
Normal file
47
web/api/v1/list/ip/index.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$TAB = 'IP';
|
||||
|
||||
// Main include
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB);
|
||||
|
||||
// Check user
|
||||
if ($_SESSION['user'] != 'admin') {
|
||||
header('Location: /list/user');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Data
|
||||
exec (VESTA_CMD."v-list-sys-ips json", $output, $return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
++$i;
|
||||
if ( $i == 1) {
|
||||
$total_amount = __('1 IP address');
|
||||
} else {
|
||||
$total_amount = __('%s IP addresses',$i);
|
||||
}
|
||||
|
||||
$data[$key]['delete_conf'] = __('DELETE_IP_CONFIRMATION', $key);
|
||||
}
|
||||
|
||||
// Render page
|
||||
// render_page($user, $TAB, 'list_ip');
|
||||
|
||||
// Back uri
|
||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$object = (object)[];
|
||||
$object->data = $data;
|
||||
$object->user = $user;
|
||||
$object->panel = $panel;
|
||||
$object->totalAmount = $total_amount;
|
||||
$object->ipFav = $_SESSION['favourites']['IP'];
|
||||
|
||||
print json_encode($object);
|
Loading…
Add table
Add a link
Reference in a new issue