From 859e65647fdb20cf57d2caa808707442d8e6b4ba Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 31 Oct 2021 23:24:42 +0200 Subject: [PATCH] Updated and improved API respones. --- web/api/v1/add/db/index.php | 4 +- web/api/v1/add/dns/index.php | 5 + web/api/v1/add/firewall/index.php | 2 + web/api/v1/add/mail/index.php | 12 +++ web/api/v1/add/package/index.php | 3 + web/api/v1/add/web/index.php | 6 ++ web/api/v1/edit/backup/exclusions/index.php | 4 + web/api/v1/edit/cron/index.php | 3 + web/api/v1/edit/db/index.php | 3 + web/api/v1/edit/firewall/index.php | 2 - web/api/v1/edit/mail/index.php | 2 +- web/api/v1/edit/server/index.php | 7 ++ web/api/v1/edit/web/index.php | 10 +- web/api/v1/generate/ssl/index.php | 106 ++++++++++++++++++++ web/api/v1/list/backup/exclusions/index.php | 3 + web/api/v1/list/backup/index.php | 4 + web/api/v1/list/cron/index.php | 3 + web/api/v1/list/db/index.php | 3 + web/api/v1/list/dns/index.php | 4 + web/api/v1/list/firewall/index.php | 3 + web/api/v1/list/ip/index.php | 3 + web/api/v1/list/log/index.php | 3 + web/api/v1/list/mail/index.php | 4 + web/api/v1/list/package/index.php | 3 + web/api/v1/list/rrd/index.php | 3 + web/api/v1/list/server/index.php | 3 + web/api/v1/list/stats/index.php | 3 + web/api/v1/list/updates/index.php | 3 + web/api/v1/list/user/index.php | 2 + web/api/v1/list/web/index.php | 18 +++- web/api/v1/schedule/backup/index.php | 32 ++++++ web/api/v1/search/index.php | 4 + web/api/v1/stop/service/index.php | 2 +- 33 files changed, 254 insertions(+), 18 deletions(-) create mode 100644 web/api/v1/generate/ssl/index.php create mode 100644 web/api/v1/schedule/backup/index.php diff --git a/web/api/v1/add/db/index.php b/web/api/v1/add/db/index.php index e633d6b97..8d54acbe3 100644 --- a/web/api/v1/add/db/index.php +++ b/web/api/v1/add/db/index.php @@ -123,13 +123,13 @@ unset($output); unset($db_hosts_tmp1); unset($db_hosts_tmp2); -$prefixI18N = __('Prefix will be automaticaly added to database name and database user', "".$_SESSION['user']."_"); +$prefixI18N = __('Prefix will be automaticaly added to database name and database user', "".$user."_"); $maxCharLength = __('maximum characters length, including prefix', 16); $result = array( 'dbHosts' => $db_hosts, 'dbTypes' => $db_types, - 'user' => $_SESSION['user'], + 'user' => $user, 'prefixI18N' => $prefixI18N, 'maxCharLength' => $maxCharLength, 'error_msg' => $_SESSION['error_msg'], diff --git a/web/api/v1/add/dns/index.php b/web/api/v1/add/dns/index.php index b924c484f..bb39939bc 100644 --- a/web/api/v1/add/dns/index.php +++ b/web/api/v1/add/dns/index.php @@ -165,8 +165,13 @@ if (empty($_GET['domain'])) { $v_ns8 = str_replace("'", "", $nameservers[7]); unset($output); } + + // render_page($user, $TAB, 'add_dns'); } else { + // Display body for dns record + $v_domain = $_GET['domain']; + // render_page($user, $TAB, 'add_dns_rec'); } $result = array( diff --git a/web/api/v1/add/firewall/index.php b/web/api/v1/add/firewall/index.php index d2537e5ea..0f6e69e27 100644 --- a/web/api/v1/add/firewall/index.php +++ b/web/api/v1/add/firewall/index.php @@ -63,6 +63,8 @@ if (!empty($_POST['ok'])) { } } +// Render +// render_page($user, $TAB, 'add_firewall'); $result = array( 'ok_msg' => $_SESSION['ok_msg'], 'error_msg' => $_SESSION['error_msg'] diff --git a/web/api/v1/add/mail/index.php b/web/api/v1/add/mail/index.php index 4c830fb7a..8f5899587 100644 --- a/web/api/v1/add/mail/index.php +++ b/web/api/v1/add/mail/index.php @@ -195,6 +195,18 @@ if (!empty($_POST['ok_acc'])) { } } +// Render page +if (empty($_GET['domain'])) { + // Display body for mail domain + + // render_page($user, $TAB, 'add_mail'); +} else { + // Display body for mail account + + $v_domain = $_GET['domain']; + // render_page($user, $TAB, 'add_mail_acc'); +} + $result = array( 'error_msg' => $_SESSION['error_msg'], 'ok_msg' => $_SESSION['ok_msg'] diff --git a/web/api/v1/add/package/index.php b/web/api/v1/add/package/index.php index fc8da1dec..055d0e9c1 100644 --- a/web/api/v1/add/package/index.php +++ b/web/api/v1/add/package/index.php @@ -200,6 +200,9 @@ if (empty($v_bandwidth)) $v_bandwidth = "'1000'"; if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd'; if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd'; +// Render page +// render_page($user, $TAB, 'add_package'); + $result = array( 'web_system' => $_SESSION['WEB_SYSTEM'], 'web_templates' => $web_templates, diff --git a/web/api/v1/add/web/index.php b/web/api/v1/add/web/index.php index 182d1081e..a0036367f 100644 --- a/web/api/v1/add/web/index.php +++ b/web/api/v1/add/web/index.php @@ -360,6 +360,12 @@ $stats = json_decode(implode('', $output), true); unset($output); $result = array( + 'prefix' => __('Prefix will be automaticaly added to username',$user."_"), + 'ftp_pre_path' => $v_ftp_user_prepath, + 'ftp_email' => $v_ftp_email, + 'stats' => $stats, + 'proxy_ext' => 'jpeg, jpg, png, gif, bmp, ico, svg, tif, tiff, css, js, htm, html, ttf, otf, webp, woff, txt, csv, rtf, doc, docx, xls, xlsx, ppt, pptx, odf, odp, ods, odt, pdf, psd, ai, eot, eps, ps, zip, tar, tgz, gz, rar, bz2, 7z, aac, m4a, mp3, mp4, ogg, wav, wma, 3gp, avi, flv, m4v, mkv, mov, mp4, mpeg, mpg, wmv, exe, iso, dmg, swf', + 'ips' => $ips, 'error_msg' => $_SESSION['error_msg'], 'ok_msg' => $_SESSION['ok_msg'] ); diff --git a/web/api/v1/edit/backup/exclusions/index.php b/web/api/v1/edit/backup/exclusions/index.php index 6723490c9..13bd32c97 100644 --- a/web/api/v1/edit/backup/exclusions/index.php +++ b/web/api/v1/edit/backup/exclusions/index.php @@ -122,6 +122,10 @@ if (!empty($_POST['save'])) { } } + +// Render page +// render_page($user, $TAB, 'edit_backup_exclusions'); + $result = array( 'web' => $v_web, 'dns' => $v_dns, diff --git a/web/api/v1/edit/cron/index.php b/web/api/v1/edit/cron/index.php index ec800f1c2..697c04922 100644 --- a/web/api/v1/edit/cron/index.php +++ b/web/api/v1/edit/cron/index.php @@ -75,6 +75,9 @@ if (!empty($_POST['save'])) { } } +// Render page +// render_page($user, $TAB, 'edit_cron'); + $result = array( 'username' => $user, 'job' => $_GET['job'], diff --git a/web/api/v1/edit/db/index.php b/web/api/v1/edit/db/index.php index a4f62e5fd..7aaced147 100644 --- a/web/api/v1/edit/db/index.php +++ b/web/api/v1/edit/db/index.php @@ -83,6 +83,9 @@ if (!empty($_POST['save'])) { } } +// Render page +// render_page($user, $TAB, 'edit_db'); + $result = array( 'username' => $user, 'database' => $_GET['database'], diff --git a/web/api/v1/edit/firewall/index.php b/web/api/v1/edit/firewall/index.php index 37c9e9cc3..19ac2bbed 100644 --- a/web/api/v1/edit/firewall/index.php +++ b/web/api/v1/edit/firewall/index.php @@ -90,8 +90,6 @@ $result = array( 'time' => $data[$v_rule]['TIME'], 'suspended' => $data[$v_rule]['SUSPENDED'], 'status' => $v_status, - 'actions' => [ __('DROP'), __('ACCEPT') ], - 'protocols' => [ __('TCP'), __('UDP'), __('ICMP') ], 'error_msg' => $_SESSION['error_msg'], 'ok_msg' => $_SESSION['ok_msg'] ); diff --git a/web/api/v1/edit/mail/index.php b/web/api/v1/edit/mail/index.php index 47de71b33..a886b203f 100644 --- a/web/api/v1/edit/mail/index.php +++ b/web/api/v1/edit/mail/index.php @@ -327,7 +327,7 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco } list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":"); -$webmail = "http://".$http_host."/webmail/"; +$webmail = "/webmail/"; if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL']; if (empty($hostname)) { diff --git a/web/api/v1/edit/server/index.php b/web/api/v1/edit/server/index.php index c63dba793..b9edd765e 100644 --- a/web/api/v1/edit/server/index.php +++ b/web/api/v1/edit/server/index.php @@ -607,6 +607,10 @@ foreach ($sys_arr as $key => $value) { $_SESSION[$key] = $value; } + +// Render page +// render_page($user, $TAB, 'edit_server'); + $result = array( 'hostname' => $v_hostname, 'timezones' => $v_timezones, @@ -636,6 +640,9 @@ $result = array( 'web_backend_pool' => $_SESSION['WEB_BACKEND_POOL'], 'sftpjail_key' => $_SESSION['SFTPJAIL_KEY'], 'lead' => $_GET['lead'] == 'sftp', + 'softaculous_lead' => $_GET['lead'] == 'softaculous', + 'fm_lead' => $_GET['lead'] == 'filemanager', + 'sftp_licence_key' => $_GET['sftp_licence_key'], 'licence_key' => $_GET['sftp_licence_key'] != '' ? $_GET['sftp_licence_key'] : $_SESSION['SFTPJAIL_KEY'], 'fm_licence_key_option' => $_GET['filemanager_licence_key'] != '' ? $_GET['filemanager_licence_key'] : $_SESSION['FILEMANAGER_KEY'], 'vesta_certificate' => $_SESSION['VESTA_CERTIFICATE'], diff --git a/web/api/v1/edit/web/index.php b/web/api/v1/edit/web/index.php index 884fd3f35..858b411a0 100644 --- a/web/api/v1/edit/web/index.php +++ b/web/api/v1/edit/web/index.php @@ -1,10 +1,4 @@ $v_backend_template, 'proxy' => $v_proxy, 'proxy_template' => $v_proxy_template, - 'proxy_ext' => $v_proxy_ext, + 'proxy_ext' => !empty($v_proxy_ext) ? $v_proxy_ext : 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, mpeg, flv, html, htm', 'v_stats' => $v_stats, 'stats_user' => $v_stats_user, 'ftp_user' => $v_ftp_user, diff --git a/web/api/v1/generate/ssl/index.php b/web/api/v1/generate/ssl/index.php new file mode 100644 index 000000000..4ecdf4255 --- /dev/null +++ b/web/api/v1/generate/ssl/index.php @@ -0,0 +1,106 @@ + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + unset($_SESSION['error_msg']); + exit; + } + + // Protect input + $v_domain = escapeshellarg($_POST['v_domain']); + $v_email = escapeshellarg($_POST['v_email']); + $v_country = escapeshellarg($_POST['v_country']); + $v_state = escapeshellarg($_POST['v_state']); + $v_locality = escapeshellarg($_POST['v_locality']); + $v_org = escapeshellarg($_POST['v_org']); + + exec (VESTA_CMD."v-generate-ssl-cert ".$v_domain." ".$v_email." ".$v_country." ".$v_state." ".$v_locality." ".$v_org." IT '' json", $output, $return_var); + + // Revert to raw values + $v_domain = $_POST['v_domain']; + $v_email = $_POST['v_email']; + $v_country = $_POST['v_country']; + $v_state = $_POST['v_state']; + $v_locality = $_POST['v_locality']; + $v_org = $_POST['v_org']; + + // Check return code + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = __('Error code:',$return_var); + $_SESSION['error_msg'] = $error; + unset($_SESSION['error_msg']); + exit; + } + + // OK message + $_SESSION['ok_msg'] = __('SSL_GENERATED_OK'); + + // Parse output + $data = json_decode(implode('', $output), true); + unset($output); + $v_crt = $data[$v_domain]['CRT']; + $v_key = $data[$v_domain]['KEY']; + $v_csr = $data[$v_domain]['CSR']; +} + +$result = array( + 'domain' => $v_domain, + 'email' => $v_email, + 'country' => $v_country, + 'state' => $v_state, + 'locality' => $v_locality, + 'org' => $v_org, + 'org_unit' => $v_org_unit, + 'crt' => $v_crt, + 'key' => $v_key, + 'csr' => $v_csr, + 'ok_msg' => $_SESSION['ok_msg'], + 'error_msg' => $_SESSION['error_msg'] +); + +echo json_encode($result); +unset($_SESSION['ok_msg']); +unset($_SESSION['error_msg']); diff --git a/web/api/v1/list/backup/exclusions/index.php b/web/api/v1/list/backup/exclusions/index.php index 96fe901c9..f1f350f01 100644 --- a/web/api/v1/list/backup/exclusions/index.php +++ b/web/api/v1/list/backup/exclusions/index.php @@ -12,6 +12,9 @@ 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']; diff --git a/web/api/v1/list/backup/index.php b/web/api/v1/list/backup/index.php index 9c82d7fe2..54e515202 100644 --- a/web/api/v1/list/backup/index.php +++ b/web/api/v1/list/backup/index.php @@ -13,11 +13,15 @@ if (empty($_GET['backup'])){ $data = json_decode(implode('', $output), true); $data = array_reverse($data,true); unset($output); + + // render_page($user, $TAB, 'list_backup'); } else { exec (VESTA_CMD."v-list-user-backup $user ".escapeshellarg($_GET['backup'])." json", $output, $return_var); $data = json_decode(implode('', $output), true); $data = array_reverse($data,true); unset($output); + + // render_page($user, $TAB, 'list_backup_detail'); } $backup = $_GET['backup']; diff --git a/web/api/v1/list/cron/index.php b/web/api/v1/list/cron/index.php index 283e9c970..8502aaff4 100644 --- a/web/api/v1/list/cron/index.php +++ b/web/api/v1/list/cron/index.php @@ -14,6 +14,9 @@ $data = json_decode(implode('', $output), true); $data = array_reverse($data,true); unset($output); +// Render page +// render_page($user, $TAB, 'list_cron'); + if($panel[$user]['CRON_REPORTS'] == 'yes') { $cron_reports = __('turn off notifications'); } else { diff --git a/web/api/v1/list/db/index.php b/web/api/v1/list/db/index.php index 3f2604fb1..f9e327a2c 100644 --- a/web/api/v1/list/db/index.php +++ b/web/api/v1/list/db/index.php @@ -15,6 +15,9 @@ 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']; diff --git a/web/api/v1/list/dns/index.php b/web/api/v1/list/dns/index.php index 07c70d79b..766258aab 100644 --- a/web/api/v1/list/dns/index.php +++ b/web/api/v1/list/dns/index.php @@ -13,11 +13,15 @@ if (empty($_GET['domain'])){ $data = json_decode(implode('', $output), true); $data = array_reverse($data, true); unset($output); + + // render_page($user, $TAB, 'list_dns'); } else { exec (VESTA_CMD."v-list-dns-records ".$user." ".escapeshellarg($_GET['domain'])." json", $output, $return_var); $data = json_decode(implode('', $output), true); $data = array_reverse($data, true); unset($output); + + // render_page($user, $TAB, 'list_dns_rec'); } foreach ($data as $key => $value) { diff --git a/web/api/v1/list/firewall/index.php b/web/api/v1/list/firewall/index.php index f3681002f..35d6ecbdf 100644 --- a/web/api/v1/list/firewall/index.php +++ b/web/api/v1/list/firewall/index.php @@ -41,6 +41,9 @@ foreach ($data as $key => $value) { } } +// Render page +// render_page($user, $TAB, 'list_firewall'); + // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/ip/index.php b/web/api/v1/list/ip/index.php index 63269aa4e..899e57e5b 100644 --- a/web/api/v1/list/ip/index.php +++ b/web/api/v1/list/ip/index.php @@ -31,6 +31,9 @@ foreach ($data as $key => $value) { $data[$key]['delete_conf'] = __('DELETE_IP_CONFIRMATION', $key); } +// Render page +// render_page($user, $TAB, 'list_ip'); + // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/log/index.php b/web/api/v1/list/log/index.php index 11d562c0d..4eb96b0fd 100644 --- a/web/api/v1/list/log/index.php +++ b/web/api/v1/list/log/index.php @@ -24,6 +24,9 @@ foreach ($data as $key => $value) { } } +// Render page +// render_page($user, $TAB, 'list_log'); + $object = (object)[]; $object->data = $data; $object->user = $user; diff --git a/web/api/v1/list/mail/index.php b/web/api/v1/list/mail/index.php index f37e689ff..8d6c59126 100644 --- a/web/api/v1/list/mail/index.php +++ b/web/api/v1/list/mail/index.php @@ -14,6 +14,8 @@ if (empty($_GET['domain'])){ unset($output); $favorites = $_SESSION['favourites']['MAIL']; + + // render_page($user, $TAB, 'list_mail'); } else { exec (VESTA_CMD."v-list-mail-accounts ".$user." ".escapeshellarg($_GET['domain'])." json", $output, $return_var); $data = json_decode(implode('', $output), true); @@ -21,6 +23,8 @@ if (empty($_GET['domain'])){ unset($output); $favorites = $_SESSION['favourites']['MAIL_ACC']; + + // render_page($user, $TAB, 'list_mail_acc'); } $uname_arr=posix_uname(); diff --git a/web/api/v1/list/package/index.php b/web/api/v1/list/package/index.php index 51a521d68..2fe581232 100644 --- a/web/api/v1/list/package/index.php +++ b/web/api/v1/list/package/index.php @@ -29,6 +29,9 @@ foreach ($data as $key => $value) { $data[$key]['delete_conf'] = __('DELETE_PACKAGE_CONFIRMATION', $key); } +// Render page +// render_page($user, $TAB, 'list_packages'); + // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/rrd/index.php b/web/api/v1/list/rrd/index.php index 79af2e447..2ba6b4dc5 100644 --- a/web/api/v1/list/rrd/index.php +++ b/web/api/v1/list/rrd/index.php @@ -18,6 +18,9 @@ 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']; diff --git a/web/api/v1/list/server/index.php b/web/api/v1/list/server/index.php index f6159b018..47363fcae 100644 --- a/web/api/v1/list/server/index.php +++ b/web/api/v1/list/server/index.php @@ -97,6 +97,9 @@ foreach ($sys as $key => $value) { $sys[$key]['UPTIME'] = humanize_time($sys[$key]['UPTIME']); } +// Render page +// render_page($user, $TAB, 'list_services'); + // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/stats/index.php b/web/api/v1/list/stats/index.php index 03e69fa96..9053d9227 100644 --- a/web/api/v1/list/stats/index.php +++ b/web/api/v1/list/stats/index.php @@ -42,6 +42,9 @@ foreach ($data as $key => $value) { } } +// Render page +// render_page($user, $TAB, 'list_stats'); + // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/updates/index.php b/web/api/v1/list/updates/index.php index 379abf6c6..7a4c7bdc3 100644 --- a/web/api/v1/list/updates/index.php +++ b/web/api/v1/list/updates/index.php @@ -21,6 +21,9 @@ exec (VESTA_CMD."v-list-sys-vesta-autoupdate plain", $output, $return_var); $autoupdate = $output[0]; unset($output); +// Render page +// render_page($user, $TAB, 'list_updates'); + // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/user/index.php b/web/api/v1/list/user/index.php index 17199a502..eb202cd80 100644 --- a/web/api/v1/list/user/index.php +++ b/web/api/v1/list/user/index.php @@ -14,7 +14,9 @@ if ($user == 'admin') { } $data = json_decode(implode('', $output), true); $data = array_reverse($data,true); +// Render page top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB); +// render_page($user, $TAB, 'list_user'); $_SESSION['back'] = $_SERVER['REQUEST_URI']; diff --git a/web/api/v1/list/web/index.php b/web/api/v1/list/web/index.php index abc5b1aa1..642d77e55 100644 --- a/web/api/v1/list/web/index.php +++ b/web/api/v1/list/web/index.php @@ -13,7 +13,9 @@ $data = json_decode(implode('', $output), true); $data = array_reverse($data,true); $ips = json_decode(shell_exec(VESTA_CMD.'v-list-sys-ips json'), true); +// Render page top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB); +// render_page($user, $TAB, 'list_web'); // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; @@ -77,15 +79,23 @@ foreach ($data as $key => $value) { $data[$key]['FTP'] = $data[$key]['FTP_USER']; } + $data[$key]['PROXY_SYSTEM'] = !empty($_SESSION['PROXY_SYSTEM']); + $data[$key]['PROXY_SUPPORT'] = 'no'; + if (!empty($data[$key]['PROXY'])) { + $data[$key]['PROXY_SUPPORT'] = 'yes'; + } + + $data[$key]['WEB_BACKEND'] = !empty($_SESSION['WEB_BACKEND']); $data[$key]['BACKEND_SUPPORT'] = 'no'; if (!empty($data[$key]['BACKEND'])) { $data[$key]['BACKEND_SUPPORT'] = 'yes'; } - $data[$key]['PROXY_SUPPORT'] = 'no'; - if (!empty($data[$key]['PROXY'])) { - $data[$key]['PROXY_SUPPORT'] = 'yes'; - } + $data[$key]['U_BANDWIDTH_SIZE'] = humanize_usage_size($data[$key]['U_BANDWIDTH']); + $data[$key]['U_BANDWIDTH_MEASURE'] = humanize_usage_measure($data[$key]['U_BANDWIDTH']); + + $data[$key]['U_DISK_SIZE'] = humanize_usage_size($data[$key]['U_DISK']); + $data[$key]['U_DISK_MEASURE'] = humanize_usage_measure($data[$key]['U_DISK']); $data[$key]['delete_confirmation'] = __('DELETE_DOMAIN_CONFIRMATION', $key); diff --git a/web/api/v1/schedule/backup/index.php b/web/api/v1/schedule/backup/index.php new file mode 100644 index 000000000..6e334918e --- /dev/null +++ b/web/api/v1/schedule/backup/index.php @@ -0,0 +1,32 @@ + +', $output); + if (empty($_SESSION['error_msg'])) { + $_SESSION['error_msg'] = __('Error: vesta did not return any output.'); + } + + if ($return_var == 4) { + $_SESSION['error_msg'] = __('BACKUP_EXISTS'); + } + +} + +$result = array( + 'ok' => $_SESSION['ok_msg'], + 'error' => $_SESSION['error_msg'], +); + +echo json_encode($result); +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); diff --git a/web/api/v1/search/index.php b/web/api/v1/search/index.php index d268ec1b1..e13e12ee4 100644 --- a/web/api/v1/search/index.php +++ b/web/api/v1/search/index.php @@ -30,6 +30,10 @@ $command = $_SESSION['user'] == 'admin' exec (VESTA_CMD . $command, $output, $return_var); $data = json_decode(implode('', $output), true); + +// Render page +// render_page($user, $TAB, 'list_search'); + foreach ($data as $key => $value) { ++$i; diff --git a/web/api/v1/stop/service/index.php b/web/api/v1/stop/service/index.php index cc0308eb0..5a9b224f4 100644 --- a/web/api/v1/stop/service/index.php +++ b/web/api/v1/stop/service/index.php @@ -27,5 +27,5 @@ if ($_SESSION['user'] == 'admin') { unset($output); } -echo json_encode(array('error' => $_SESSION['error_msg'])); +echo json_encode(array('error' => $_SESSION['error_srv'], 'ok' => $_SESSION['ok_msg'])); unset($_SESSION['error_msg']);