mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
Updated services and fixed minor bugs.
This commit is contained in:
parent
4306a4fb4f
commit
2a12fec5ea
90 changed files with 1706 additions and 3 deletions
23
web/api/v1/list/backup/exclusions/index.php
Normal file
23
web/api/v1/list/backup/exclusions/index.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
$TAB = 'BACKUP';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Main include
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
|
||||
|
||||
// Data
|
||||
exec (VESTA_CMD."v-list-user-backup-exclusions $user json", $output, $return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
// render_page($user, $TAB, 'list_backup_exclusions');
|
||||
|
||||
// Back uri
|
||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$result = array('data' => $data);
|
||||
|
||||
echo json_encode($result);
|
79
web/api/v1/list/db/index.php
Normal file
79
web/api/v1/list/db/index.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
$TAB = 'DB';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Main include
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Data
|
||||
exec (VESTA_CMD."v-list-databases $user json", $output, $return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
|
||||
top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB);
|
||||
|
||||
// Render page
|
||||
// render_page($user, $TAB, 'list_db');
|
||||
|
||||
// Back uri
|
||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
|
||||
foreach ($data as $key => $value) {
|
||||
++$i;
|
||||
|
||||
if ( $i == 1) {
|
||||
$total_amount = __('1 database');
|
||||
} else {
|
||||
$total_amount = __('%s databases',$i);
|
||||
}
|
||||
|
||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||
$data[$key]['status'] = 'suspended';
|
||||
$data[$key]['suspend_action'] = 'unsuspend' ;
|
||||
$data[$key]['suspend_conf'] = __('UNSUSPEND_DATABASE_CONFIRMATION', $key);
|
||||
} else {
|
||||
$data[$key]['status'] = 'active';
|
||||
$data[$key]['suspend_action'] = 'suspend';
|
||||
$data[$key]['suspend_conf'] = __('SUSPEND_DATABASE_CONFIRMATION', $key);
|
||||
}
|
||||
|
||||
if ($data[$key]['TYPE'] == 'mysql'){
|
||||
$mysql = 1;
|
||||
|
||||
$db_myadmin_link = "http://".$http_host."/phpmyadmin/";
|
||||
if (!empty($_SESSION['DB_PMA_URL']))
|
||||
$db_myadmin_link = $_SESSION['DB_PMA_URL'];
|
||||
}
|
||||
if ($data[$key]['TYPE'] == 'pgsql'){
|
||||
$pgsql = 1;
|
||||
$db_pgadmin_link = "http://".$http_host."/phppgadmin/";
|
||||
if (!empty($_SESSION['DB_PGA_URL']))
|
||||
$db_pgadmin_link = $_SESSION['DB_PGA_URL'];
|
||||
}
|
||||
|
||||
if ($data[$key]['HOST'] != 'localhost' ) $http_host = $data[$key]['HOST'];
|
||||
if ($data[$key]['TYPE'] == 'mysql') $db_admin = "phpMyAdmin";
|
||||
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
|
||||
if (($data[$key]['TYPE'] == 'mysql') && (!empty($_SESSION['DB_PMA_URL']))) $db_admin_link = $_SESSION['DB_PMA_URL'];
|
||||
if ($data[$key]['TYPE'] == 'pgsql') $db_admin = "phpPgAdmin";
|
||||
if ($data[$key]['TYPE'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/";
|
||||
if (($data[$key]['TYPE'] == 'pgsql') && (!empty($_SESSION['DB_PGA_URL']))) $db_admin_link = $_SESSION['DB_PGA_URL'];
|
||||
|
||||
$data[$key]['delete_conf'] = __('DELETE_DATABASE_CONFIRMATION', $key);
|
||||
}
|
||||
|
||||
$object = (object)[];
|
||||
$object->data = $data;
|
||||
$object->user = $user;
|
||||
$object->panel = $panel;
|
||||
$object->db_admin = $db_admin;
|
||||
$object->db_admin_link = $db_admin_link;
|
||||
$object->totalAmount = $total_amount;
|
||||
$object->databases = $databases;
|
||||
$object->dbFav = $_SESSION['favourites']['DB'];
|
||||
|
||||
print json_encode($object);
|
35
web/api/v1/list/directory/preview/index.php
Normal file
35
web/api/v1/list/directory/preview/index.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'] . "/inc/main.php");
|
||||
|
||||
|
||||
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
|
||||
header("Location: /filemanager-not-purchased/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check login_as feature
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||
$user=$_SESSION['look'];
|
||||
}
|
||||
|
||||
if (empty($panel)) {
|
||||
$command = VESTA_CMD."v-list-user '".$user."' 'json'";
|
||||
exec ($command, $output, $return_var);
|
||||
if ( $return_var > 0 ) {
|
||||
header("Location: /error/");
|
||||
exit;
|
||||
}
|
||||
$panel = json_decode(implode('', $output), true);
|
||||
}
|
||||
|
||||
$path_a = !empty($_REQUEST['dir_a']) ? $_REQUEST['dir_a'] : '';
|
||||
$path_b = !empty($_REQUEST['dir_b']) ? $_REQUEST['dir_b'] : '';
|
||||
$GLOBAL_JS = '<script type="text/javascript">GLOBAL.START_DIR_A = "' . $path_a . '";</script>';
|
||||
$GLOBAL_JS .= '<script type="text/javascript">GLOBAL.START_DIR_B = "' . $path_b . '";</script>';
|
||||
$GLOBAL_JS .= '<script type="text/javascript">GLOBAL.ROOT_DIR = "' . $panel[$user]['HOME'] . '";</script>';
|
||||
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/main.php');
|
59
web/api/v1/list/firewall/banlist/index.php
Normal file
59
web/api/v1/list/firewall/banlist/index.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
$TAB = 'FIREWALL';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Main include
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Check user
|
||||
if ($_SESSION['user'] != 'admin') {
|
||||
header("Location: /list/user");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Data
|
||||
exec (VESTA_CMD."v-list-firewall-ban json", $output, $return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
$data = array_reverse($data, true);
|
||||
unset($output);
|
||||
$i = 0;
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||
$data[$key]['status'] = 'suspended';
|
||||
$data[$key]['suspend_action'] = 'unsuspend' ;
|
||||
$data[$key]['suspend_conf'] = 'UNSUSPEND_RULE_CONFIRMATION' ;
|
||||
} else {
|
||||
$data[$key]['status'] = 'active';
|
||||
$data[$key]['suspend_action'] = 'suspend' ;
|
||||
$data[$key]['suspend_conf'] = 'SUSPEND_RULE_CONFIRMATION' ;
|
||||
}
|
||||
|
||||
$data[$key]['delete_url'] = '/delete/firewall/banlist/?ip='.$data[$key]['ip'].'&chain='.$data[$key]['CHAIN'].'&token='.$_SESSION['token'];
|
||||
|
||||
if ( $i == 1) {
|
||||
$total_amount = __('1 rule');
|
||||
} else {
|
||||
$total_amount = __('%s rules',$i);
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
$total_amount = __('There are no currently banned IP');
|
||||
}
|
||||
|
||||
// Render page
|
||||
// render_page($user, $TAB, 'list_firewall_banlist');
|
||||
|
||||
// Back uri
|
||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$result = array(
|
||||
'data' => $data,
|
||||
'total_amount' => $total_amount
|
||||
);
|
||||
|
||||
echo json_encode($result);
|
13
web/api/v1/list/rrd/image.php
Normal file
13
web/api/v1/list/rrd/image.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
session_start();
|
||||
if ($_SESSION['user'] != 'admin') exit;
|
||||
$real_path = realpath($_SERVER["DOCUMENT_ROOT"].$_SERVER['QUERY_STRING']);
|
||||
if (empty($real_path)) exit;
|
||||
$dir_name = dirname($real_path);
|
||||
$dir_name = dirname($dir_name);
|
||||
if ($dir_name != $_SERVER["DOCUMENT_ROOT"].'/rrd') exit;
|
||||
header("X-Accel-Redirect: ".$_SERVER['QUERY_STRING']);
|
||||
header("Content-Type: image/png");
|
||||
|
||||
?>
|
32
web/api/v1/list/rrd/index.php
Normal file
32
web/api/v1/list/rrd/index.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
error_reporting(NULL);
|
||||
$TAB = 'RRD';
|
||||
|
||||
// Main include
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB);
|
||||
header("Content-Type: application/json");
|
||||
|
||||
// Check user
|
||||
if ($_SESSION['user'] != 'admin') {
|
||||
header('Location: /list/user');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Data
|
||||
exec (VESTA_CMD."v-list-sys-rrd json", $output, $return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Render page
|
||||
// render_page($user, $TAB, 'list_rrd');
|
||||
|
||||
// Back uri
|
||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$object = (object)[];
|
||||
$object->data = $data;
|
||||
$object->user = $user;
|
||||
$object->panel = $panel;
|
||||
|
||||
print json_encode($object);
|
|
@ -84,6 +84,17 @@ foreach ($data as $key => $value) {
|
|||
} else {
|
||||
$data[$key]['action_url'] = '/start/service/?srv='.$key;
|
||||
}
|
||||
|
||||
$data[$key]['SYSTEM'] = __($data[$key]['SYSTEM']);
|
||||
$data[$key]['RTIME'] = humanize_time($data[$key]['RTIME']);
|
||||
|
||||
$cpu = $data[$key]['CPU'] / 10;
|
||||
$data[$key]['CPU'] = number_format($cpu, 1);
|
||||
if ($cpu == '0.0') $data[$key]['CPU'] = 0;
|
||||
}
|
||||
|
||||
foreach ($sys as $key => $value) {
|
||||
$sys[$key]['UPTIME'] = humanize_time($sys[$key]['UPTIME']);
|
||||
}
|
||||
|
||||
// Render page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue