Separate scripts from html & New rendering function

This commit is contained in:
Flat 2016-07-02 19:51:56 +09:00
commit e16e92278b
84 changed files with 848 additions and 1280 deletions

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'CRON';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check POST request
@ -62,18 +61,9 @@ if (!empty($_POST['ok'])) {
}
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_cron.html');
// Render
render_page($user, $TAB, 'admin/add_cron');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,9 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'DB';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check POST request
@ -107,17 +107,11 @@ if (!empty($_POST['ok'])) {
}
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// Get user email
$v_db_email = $panel[$user]['CONTACT'];
// List avaiable database types
$db_types = split(",",$_SESSION['DB_SYSTEM']);
$db_types = split(',', $_SESSION['DB_SYSTEM']);
// List available database servers
$db_hosts = array();
@ -127,13 +121,8 @@ $db_hosts = array_merge($db_hosts, $db_hosts_tmp);
unset($db_hosts_tmp);
unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html');
render_page($user, $TAB, 'admin/add_db');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
?>

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'DNS';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check POST request for dns domain
@ -138,12 +137,6 @@ if (!empty($_POST['ok_rec'])) {
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
$v_ns1 = str_replace("'", "", $v_ns1);
$v_ns2 = str_replace("'", "", $v_ns2);
$v_ns3 = str_replace("'", "", $v_ns3);
@ -154,8 +147,9 @@ $v_ns7 = str_replace("'", "", $v_ns7);
$v_ns8 = str_replace("'", "", $v_ns8);
// Display body for dns domain
if (empty($_GET['domain'])) {
// Display body for dns domain
if (empty($v_ttl)) $v_ttl = 14400;
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
if (empty($v_ns1)) {
@ -171,18 +165,16 @@ if (empty($_GET['domain'])) {
$v_ns8 = str_replace("'", "", $nameservers[7]);
unset($output);
}
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
render_page($user, $TAB, 'admin/add_dns');
} else {
// Display body for dns record
$v_domain = $_GET['domain'];
render_page($user, $TAB, 'admin/add_dns_rec');
}
// Display body for dns record
if (!empty($_GET['domain'])) {
$v_domain = $_GET['domain'];
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html');
}
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,8 +1,6 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'FIREWALL';
// Main include
@ -49,18 +47,9 @@ if (!empty($_POST['ok'])) {
}
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_firewall_banlist.html');
// Render
render_page($user, $TAB, 'admin/add_firewall_banlist');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,8 +1,6 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'FIREWALL';
// Main include
@ -65,18 +63,9 @@ if (!empty($_POST['ok'])) {
}
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_firewall.html');
// Render
render_page($user, $TAB, 'admin/add_firewall');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'IP';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
@ -75,12 +74,6 @@ if (!empty($_POST['ok'])) {
}
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// List network interfaces
exec (VESTA_CMD."v-list-sys-interfaces 'json'", $output, $return_var);
$interfaces = json_decode(implode('', $output), true);
@ -91,12 +84,9 @@ exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
$users = json_decode(implode('', $output), true);
unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_ip.html');
// Render
render_page($user, $TAB, 'admin/add_ip');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'MAIL';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
@ -179,26 +178,18 @@ if (!empty($_POST['ok_acc'])) {
}
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Render page
if (empty($_GET['domain'])) {
// Display body for mail domain
// Panel
top_panel($user,$TAB);
render_page($user, $TAB, 'admin/add_mail');
} else {
// Display body for mail account
// Display body for mail domain
if (empty($_GET['domain'])) {
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html');
}
// Display body for mail account
if (!empty($_GET['domain'])) {
$v_domain = $_GET['domain'];
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail_acc.html');
render_page($user, $TAB, 'admin/add_mail_acc');
}
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'PACKAGE';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
@ -140,7 +139,7 @@ if (!empty($_POST['ok'])) {
unset($output);
}
// Remove tmpdir
// Remove tmpdir
exec ('rm -rf '.$tmpdir, $output, $return_var);
unset($output);
@ -153,12 +152,6 @@ if (!empty($_POST['ok'])) {
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// List web temmplates
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
$web_templates = json_decode(implode('', $output), true);
@ -208,12 +201,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';
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_package.html');
// Render page
render_page($user, $TAB, 'admin/add_package');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'USER';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
@ -111,12 +110,6 @@ if (!empty($_POST['ok'])) {
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// List hosting packages
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
check_error($return_var);
@ -128,12 +121,9 @@ exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
$languages = json_decode(implode('', $output), true);
unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html');
// Render page
render_page($user, $TAB, 'admin/add_user');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -1,10 +1,9 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'WEB';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check POST request
@ -272,7 +271,7 @@ if (!empty($_POST['ok'])) {
$fp = fopen($v_ftp_password, "w");
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unlink($v_ftp_password);
@ -333,12 +332,6 @@ if (!empty($_POST['ok'])) {
}
// Header
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel
top_panel($user,$TAB);
// Define user variables
$v_ftp_user_prepath = $panel[$user]['HOME'] . "/web";
$v_ftp_email = $panel[$user]['CONTACT'];
@ -353,12 +346,9 @@ exec (VESTA_CMD."v-list-web-stats json", $output, $return_var);
$stats = json_decode(implode('', $output), true);
unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html');
// Render page
render_page($user, $TAB, 'admin/add_web');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');