mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
The New Desing
This commit is contained in:
parent
def9cc4ea6
commit
067a2c862a
305 changed files with 22231 additions and 7576 deletions
160
web/edit/server/index.php
Normal file
160
web/edit/server/index.php
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
$TAB = 'SERVER';
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Check user
|
||||
if ($_SESSION['user'] != 'admin') {
|
||||
header("Location: /list/user");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get server hostname
|
||||
$v_hostname = exec('hostname');
|
||||
|
||||
// List available timezones and get current one
|
||||
$v_timezones = list_timezones();
|
||||
exec (VESTA_CMD."v-get-sys-timezone", $output, $return_var);
|
||||
$v_timezone = $output[0];
|
||||
unset($output);
|
||||
if ($v_timezone == 'Etc/UTC' ) $v_timezone = 'UTC';
|
||||
if ($v_timezone == 'Pacific/Honolulu' ) $v_timezone = 'HAST';
|
||||
if ($v_timezone == 'US/Aleutian' ) $v_timezone = 'HADT';
|
||||
if ($v_timezone == 'Etc/GMT+9' ) $v_timezone = 'AKST';
|
||||
if ($v_timezone == 'America/Anchorage' ) $v_timezone = 'AKDT';
|
||||
if ($v_timezone == 'America/Dawson_Creek' ) $v_timezone = 'PST';
|
||||
if ($v_timezone == 'PST8PDT' ) $v_timezone = 'PDT';
|
||||
if ($v_timezone == 'MST7MDT' ) $v_timezone = 'MDT';
|
||||
if ($v_timezone == 'Canada/Saskatchewan' ) $v_timezone = 'CST';
|
||||
if ($v_timezone == 'CST6CDT' ) $v_timezone = 'CDT';
|
||||
if ($v_timezone == 'EST5EDT' ) $v_timezone = 'EDT';
|
||||
if ($v_timezone == 'America/Puerto_Rico' ) $v_timezone = 'AST';
|
||||
if ($v_timezone == 'America/Halifax' ) $v_timezone = 'ADT';
|
||||
|
||||
// List supported languages
|
||||
exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
|
||||
$languages = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// List backup settings
|
||||
$v_backup_dir = "/backup";
|
||||
if (!empty($_SESSION['BACKUP'])) $v_backup_dir = $_SESSION['BACKUP'];
|
||||
$v_backup_gzip = '5';
|
||||
if (!empty($_SESSION['BACKUP_GZIP'])) $v_backup_gzip = $_SESSION['BACKUP_GZIP'];
|
||||
$backup_types = split(",",$_SESSION['BACKUP_SYSTEM']);
|
||||
foreach ($backup_types as $backup_type) {
|
||||
if ($backup_type == 'local') {
|
||||
$v_backup = 'yes';
|
||||
} else {
|
||||
exec (VESTA_CMD."v-list-backup-host ".$backup_type. " json", $output, $return_var);
|
||||
$v_remote_backup = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_backup_host = $v_remote_backup[$backup_type]['HOST'];
|
||||
$v_backup_type = $v_remote_backup[$backup_type]['TYPE'];
|
||||
$v_backup_username = $v_remote_backup[$backup_type]['USERNAME'];
|
||||
$v_backup_password = "••••••••";
|
||||
$v_backup_port = $v_remote_backup[$backup_type]['PORT'];
|
||||
$v_backup_bpath = $v_remote_backup[$backup_type]['BPATH'];
|
||||
}
|
||||
}
|
||||
|
||||
// Check POST request
|
||||
if (!empty($_POST['save'])) {
|
||||
|
||||
// Change hostname
|
||||
if ((!empty($_POST['v_hostname'])) && ($v_hostname != $_POST['v_hostname'])) {
|
||||
exec (VESTA_CMD."v-change-sys-hostname ".escapeshellarg($_POST['v_hostname']), $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
$v_hostname = $_POST['v_hostname'];
|
||||
}
|
||||
|
||||
// Change timezone
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
if (!empty($_POST['v_timezone'])) {
|
||||
$v_tz = $_POST['v_timezone'];
|
||||
if ($v_tz == 'UTC' ) $v_tz = 'Etc/UTC';
|
||||
if ($v_tz == 'HAST' ) $v_tz = 'Pacific/Honolulu';
|
||||
if ($v_tz == 'HADT' ) $v_tz = 'US/Aleutian';
|
||||
if ($v_tz == 'AKST' ) $v_tz = 'Etc/GMT+9';
|
||||
if ($v_tz == 'AKDT' ) $v_tz = 'America/Anchorage';
|
||||
if ($v_tz == 'PST' ) $v_tz = 'America/Dawson_Creek';
|
||||
if ($v_tz == 'PDT' ) $v_tz = 'PST8PDT';
|
||||
if ($v_tz == 'MDT' ) $v_tz = 'MST7MDT';
|
||||
if ($v_tz == 'CST' ) $v_tz = 'Canada/Saskatchewan';
|
||||
if ($v_tz == 'CDT' ) $v_tz = 'CST6CDT';
|
||||
if ($v_tz == 'EDT' ) $v_tz = 'EST5EDT';
|
||||
if ($v_tz == 'AST' ) $v_tz = 'America/Puerto_Rico';
|
||||
if ($v_tz == 'ADT' ) $v_tz = 'America/Halifax';
|
||||
|
||||
if ($v_timezone != $v_tz) {
|
||||
exec (VESTA_CMD."v-change-sys-timezone ".escapeshellarg($v_tz), $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
$v_timezone = $v_tz;
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Change default language
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
if ((!empty($_POST['v_language'])) && ($_SESSION['LANGUAGE'] != $_POST['v_language'])) {
|
||||
exec (VESTA_CMD."v-change-sys-language ".escapeshellarg($_POST['v_language']), $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
if (empty($_SESSION['error_msg'])) $_SESSION['LANGUAGE'] = $_POST['v_language'];
|
||||
}
|
||||
}
|
||||
|
||||
// Set disk_quota support
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
if ((!empty($_POST['v_quota'])) && ($_SESSION['DISK_QUOTA'] != $_POST['v_quota'])) {
|
||||
if($_POST['v_quota'] == 'yes') {
|
||||
exec (VESTA_CMD."v-add-sys-quota", $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
if (empty($_SESSION['error_msg'])) $_SESSION['DISK_QUOTA'] = 'yes';
|
||||
} else {
|
||||
exec (VESTA_CMD."v-delete-sys-quota", $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
if (empty($_SESSION['error_msg'])) $_SESSION['DISK_QUOTA'] = 'no';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Disable local backup
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
if (($_POST['v_backup'] == 'no') && ($v_backup == 'yes' )) {
|
||||
exec (VESTA_CMD."v-delete-backup-quota", $output, $return_var);
|
||||
check_return_code($return_var,$output);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
// Flush field values on success
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = __('Changes has been saved.');
|
||||
}
|
||||
}
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Display body
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_server.html');
|
||||
|
||||
// Flush session messages
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
Loading…
Add table
Add a link
Reference in a new issue