new improved template scheme

This commit is contained in:
Serghey Rodin 2013-05-10 11:04:40 +03:00
commit fd4e68bb8c
96 changed files with 1395 additions and 1425 deletions

View file

@ -21,7 +21,9 @@ if ($_SESSION['user'] == 'admin') {
if (!empty($_POST['ok'])) {
// Check input
if (empty($_POST['v_package'])) $errors[] = __('package');
if (empty($_POST['v_template'])) $errors[] = __('template');
if (empty($_POST['v_web_template'])) $errors[] = __('web template');
if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template');
if (empty($_POST['v_dns_template'])) $errors[] = __('dns template');
if (empty($_POST['v_shell'])) $errrors[] = __('shell');
if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains');
if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases');
@ -40,7 +42,9 @@ if ($_SESSION['user'] == 'admin') {
// Protect input
$v_package = escapeshellarg($_POST['v_package']);
$v_template = escapeshellarg($_POST['v_template']);
$v_web_template = escapeshellarg($_POST['v_web_template']);
$v_proxy_template = escapeshellarg($_POST['v_proxy_template']);
$v_dns_template = escapeshellarg($_POST['v_dns_template']);
$v_shell = escapeshellarg($_POST['v_shell']);
$v_web_domains = escapeshellarg($_POST['v_web_domains']);
$v_web_aliases = escapeshellarg($_POST['v_web_aliases']);
@ -80,7 +84,9 @@ if ($_SESSION['user'] == 'admin') {
unset($output);
// Create package
$pkg = "TEMPLATE=".$v_template."\n";
$pkg = "WEB_TEMPLATE=".$v_web_template."\n";
$pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n";
$pkg .= "DNS_TEMPLATE=".$v_dns_template."\n";
$pkg .= "WEB_DOMAINS=".$v_web_domains."\n";
$pkg .= "WEB_ALIASES=".$v_web_aliases."\n";
$pkg .= "DNS_DOMAINS=".$v_dns_domains."\n";
@ -129,7 +135,17 @@ if ($_SESSION['user'] == 'admin') {
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
check_error($return_var);
$templates = json_decode(implode('', $output), true);
$web_templates = json_decode(implode('', $output), true);
unset($output);
exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var);
check_error($return_var);
$proxy_templates = json_decode(implode('', $output), true);
unset($output);
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
check_error($return_var);
$dns_templates = json_decode(implode('', $output), true);
unset($output);
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
@ -138,7 +154,9 @@ if ($_SESSION['user'] == 'admin') {
unset($output);
// Set default values
if (empty($v_template)) $v_template = 'default';
if (empty($v_web_template)) $v_web_template = 'default';
if (empty($v_proxy_template)) $v_proxy_template = 'default';
if (empty($v_dns_template)) $v_dns_template = 'default';
if (empty($v_shell)) $v_shell = 'nologin';
if (empty($v_web_domains)) $v_web_domains = "'0'";
if (empty($v_web_aliases)) $v_web_aliases = "'0'";