diff --git a/admin_admins.php b/admin_admins.php
index 66c4b573..cf46ec7c 100644
--- a/admin_admins.php
+++ b/admin_admins.php
@@ -16,23 +16,20 @@
* @package Panel
*
*/
-
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
-use Froxlor\Settings as Settings;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
use Froxlor\Api\Commands\Admins as Admins;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
-} elseif(isset($_GET['id'])) {
+} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
-if ($page == 'admins'
- && $userinfo['change_serversettings'] == '1'
-) {
+if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
if ($action == '') {
@@ -72,16 +69,16 @@ if ($page == 'admins'
// percent-values for progressbar
// For Disk usage
if ($row['diskspace'] > 0) {
- $disk_percent = round(($row['diskspace_used']*100)/$row['diskspace'], 0);
- $disk_doublepercent = round($disk_percent*2, 2);
+ $disk_percent = round(($row['diskspace_used'] * 100) / $row['diskspace'], 0);
+ $disk_doublepercent = round($disk_percent * 2, 2);
} else {
$disk_percent = 0;
$disk_doublepercent = 0;
}
// For Traffic usage
if ($row['traffic'] > 0) {
- $traffic_percent = round(($row['traffic_used']*100)/$row['traffic'], 0);
- $traffic_doublepercent = round($traffic_percent*2, 2);
+ $traffic_percent = round(($row['traffic_used'] * 100) / $row['traffic'], 0);
+ $traffic_doublepercent = round($traffic_percent * 2, 2);
} else {
$traffic_percent = 0;
$traffic_doublepercent = 0;
@@ -101,15 +98,14 @@ if ($page == 'admins'
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";");
- $count++;
+ $count ++;
}
- $i++;
+ $i ++;
}
$admincount = $numrows_admins;
eval("echo \"" . getTemplate("admins/admins") . "\";");
-
- } elseif($action == 'su') {
+ } elseif ($action == 'su') {
try {
$json_result = Admins::getLocal($userinfo, array(
@@ -121,13 +117,13 @@ if ($page == 'admins'
$result = json_decode($json_result, true)['data'];
$destination_admin = $result['loginname'];
- if ($destination_admin != ''
- && $result['adminid'] != $userinfo['userid']
- ) {
+ if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = :userid
");
- $result = Database::pexecute_first($result_stmt, array('userid' => $userinfo['userid']));
+ $result = Database::pexecute_first($result_stmt, array(
+ 'userid' => $userinfo['userid']
+ ));
$s = md5(uniqid(microtime(), 1));
$ins_stmt = Database::prepare("
@@ -146,15 +142,15 @@ if ($page == 'admins'
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
- redirectTo('admin_index.php', array('s' => $s));
-
+ redirectTo('admin_index.php', array(
+ 's' => $s
+ ));
} else {
- redirectTo('index.php', array('action' => 'login'));
+ redirectTo('index.php', array(
+ 'action' => 'login'
+ ));
}
-
- } elseif ($action == 'delete'
- && $id != 0
- ) {
+ } elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Admins::getLocal($userinfo, array(
'id' => $id
@@ -169,34 +165,39 @@ if ($page == 'admins'
standard_error('youcantdeleteyourself');
}
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
Admins::getLocal($this->getUserData(), array(
'id' => $id
))->delete();
- redirectTo($filename, array('page' => $page, 's' => $s));
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
- ask_yesno('admin_admin_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
+ ask_yesno('admin_admin_reallydelete', $filename, array(
+ 'id' => $id,
+ 'page' => $page,
+ 'action' => $action
+ ), $result['loginname']);
}
}
+ } elseif ($action == 'add') {
- } elseif($action == 'add') {
-
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Admins::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
- redirectTo($filename, array('page' => $page, 's' => $s));
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
$language_options = '';
foreach ($languages as $language_file => $language_name) {
- $language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
+ $language_options .= makeoption($language_name, $language_file, $userinfo['language'], true);
}
$ipaddress = makeoption($lng['admin']['allips'], "-1");
@@ -205,7 +206,7 @@ if ($page == 'admins'
");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
- $ipaddress.= makeoption($row['ip'], $row['id']);
+ $ipaddress .= makeoption($row['ip'], $row['id']);
}
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
@@ -221,7 +222,7 @@ if ($page == 'admins'
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $admin_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/admin/formfield.admin_add.php';
+ $admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php';
$admin_add_form = htmlform::genHTMLForm($admin_add_data);
$title = $admin_add_data['admin_add']['title'];
@@ -229,10 +230,7 @@ if ($page == 'admins'
eval("echo \"" . getTemplate("admins/admins_add") . "\";");
}
-
- } elseif($action == 'edit'
- && $id != 0
- ) {
+ } elseif ($action == 'edit' && $id != 0) {
try {
$json_result = Admins::getLocal($userinfo, array(
'id' => $id
@@ -244,15 +242,16 @@ if ($page == 'admins'
if ($result['loginname'] != '') {
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Admins::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
- redirectTo($filename, array('page' => $page, 's' => $s));
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
$dec_places = Settings::Get('panel.decimal_places');
@@ -322,7 +321,7 @@ if ($page == 'admins'
$language_options = '';
foreach ($languages as $language_file => $language_name) {
- $language_options.= makeoption($language_name, $language_file, $result['def_language'], true);
+ $language_options .= makeoption($language_name, $language_file, $result['def_language'], true);
}
$ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']);
@@ -331,12 +330,12 @@ if ($page == 'admins'
");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
- $ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
+ $ipaddress .= makeoption($row['ip'], $row['id'], $result['ip']);
}
$result = htmlentities_array($result);
- $admin_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/admin/formfield.admin_edit.php';
+ $admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
$admin_edit_form = htmlform::genHTMLForm($admin_edit_data);
$title = $admin_edit_data['admin_edit']['title'];
diff --git a/admin_configfiles.php b/admin_configfiles.php
index e43ae2e8..e271668f 100644
--- a/admin_configfiles.php
+++ b/admin_configfiles.php
@@ -18,7 +18,7 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Settings as Settings;
+use Froxlor\Settings;
if ($userinfo['change_serversettings'] == '1') {
diff --git a/admin_cronjobs.php b/admin_cronjobs.php
index 079eb321..8d1161f4 100644
--- a/admin_cronjobs.php
+++ b/admin_cronjobs.php
@@ -14,16 +14,15 @@
* @package Panel
*
*/
-
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
+use Froxlor\Database\Database;
use Froxlor\Api\Commands\Cronjobs as Cronjobs;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
-} elseif(isset($_GET['id'])) {
+} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
@@ -62,19 +61,18 @@ if ($page == 'cronjobs' || $page == 'overview') {
$row = htmlentities_array($row);
$row['lastrun'] = date('d.m.Y H:i', $row['lastrun']);
- $row['isactive'] = ((int)$row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
+ $row['isactive'] = ((int) $row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
$description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjob') . "\";");
- $count++;
+ $count ++;
}
- $i++;
+ $i ++;
}
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";");
-
} elseif ($action == 'new') {
/*
* @TODO later
@@ -95,7 +93,10 @@ if ($page == 'cronjobs' || $page == 'overview') {
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
- redirectTo($filename, array('page' => $page, 's' => $s));
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
// interval
@@ -115,7 +116,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
$change_cronfile = true;
}
- $cronjobs_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
+ $cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
$cronjobs_edit_form = htmlform::genHTMLForm($cronjobs_edit_data);
$title = $cronjobs_edit_data['cronjobs_edit']['title'];
@@ -124,8 +125,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";");
}
}
- }
- elseif ($action == 'delete' && $id != 0) {
+ } elseif ($action == 'delete' && $id != 0) {
/*
* @TODO later
*/
diff --git a/admin_customers.php b/admin_customers.php
index a9c0bcd1..2aa75934 100644
--- a/admin_customers.php
+++ b/admin_customers.php
@@ -16,23 +16,20 @@
* @package Panel
*
*/
-
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
-use Froxlor\Settings as Settings;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
use Froxlor\Api\Commands\Customers as Customers;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
-} elseif(isset($_GET['id'])) {
+} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
-if ($page == 'customers'
- && $userinfo['customers'] != '0'
-) {
+if ($page == 'customers' && $userinfo['customers'] != '0') {
if ($action == '') {
// clear request data
unset($_SESSION['requestData']);
@@ -56,14 +53,11 @@ if ($page == 'customers'
$result_stmt = Database::prepare("
SELECT `c`.*, `a`.`loginname` AS `adminname`
FROM `" . TABLE_PANEL_CUSTOMERS . "` `c`, `" . TABLE_PANEL_ADMINS . "` `a`
- WHERE " .
- ($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = :adminid AND ") . "
- `c`.`adminid` = `a`.`adminid` " .
- $paging->getSqlWhere(true) . " " .
- $paging->getSqlOrderBy() . " " .
- $paging->getSqlLimit()
- );
- Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
+ WHERE " . ($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = :adminid AND ") . "
+ `c`.`adminid` = `a`.`adminid` " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
+ Database::pexecute($result_stmt, array(
+ 'adminid' => $userinfo['adminid']
+ ));
$num_rows = Database::num_rows();
$paging->setEntries($num_rows);
$sortcode = $paging->getHtmlSortCode($lng, true);
@@ -82,16 +76,20 @@ if ($page == 'customers'
FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :cid
AND `parentdomainid` = '0'
- AND `id`<> :stdd"
- );
- Database::pexecute($domains_stmt, array('cid' => $row['customerid'], 'stdd' => $row['standardsubdomain']));
+ AND `id`<> :stdd");
+ Database::pexecute($domains_stmt, array(
+ 'cid' => $row['customerid'],
+ 'stdd' => $row['standardsubdomain']
+ ));
$domains = $domains_stmt->fetch(PDO::FETCH_ASSOC);
$row['domains'] = intval($domains['domains']);
$dec_places = Settings::Get('panel.decimal_places');
// get disk-space usages for web, mysql and mail
- $usages_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_DISKSPACE."` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
- $usages = Database::pexecute_first($usages_stmt, array('cid' => $row['customerid']));
+ $usages_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
+ $usages = Database::pexecute_first($usages_stmt, array(
+ 'cid' => $row['customerid']
+ ));
$row['webspace_used'] = round($usages['webspace'] / 1024, $dec_places);
$row['mailspace_used'] = round($usages['mail'] / 1024, $dec_places);
@@ -101,32 +99,30 @@ if ($page == 'customers'
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $dec_places);
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $dec_places);
$row['diskspace'] = round($row['diskspace'] / 1024, $dec_places);
- $last_login = ((int)$row['lastlogin_succ'] == 0) ? $lng['panel']['neverloggedin'] : date('d.m.Y', $row['lastlogin_succ']);
+ $last_login = ((int) $row['lastlogin_succ'] == 0) ? $lng['panel']['neverloggedin'] : date('d.m.Y', $row['lastlogin_succ']);
/**
* percent-values for progressbar
*/
- //For Disk usage
+ // For Disk usage
if ($row['diskspace'] > 0) {
- $disk_percent = round(($row['diskspace_used']*100)/$row['diskspace'], 0);
- $disk_doublepercent = round($disk_percent*2, 2);
+ $disk_percent = round(($row['diskspace_used'] * 100) / $row['diskspace'], 0);
+ $disk_doublepercent = round($disk_percent * 2, 2);
} else {
$disk_percent = 0;
$disk_doublepercent = 0;
}
if ($row['traffic'] > 0) {
- $traffic_percent = round(($row['traffic_used']*100)/$row['traffic'], 0);
- $traffic_doublepercent = round($traffic_percent*2, 2);
+ $traffic_percent = round(($row['traffic_used'] * 100) / $row['traffic'], 0);
+ $traffic_doublepercent = round($traffic_percent * 2, 2);
} else {
$traffic_percent = 0;
$traffic_doublepercent = 0;
}
$islocked = 0;
- if ($row['loginfail_count'] >= Settings::Get('login.maxloginattempts')
- && $row['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))
- ) {
+ if ($row['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $row['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) {
$islocked = 1;
}
@@ -144,18 +140,15 @@ if ($page == 'customers'
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$customers.=\"" . getTemplate("customers/customers_customer") . "\";");
- $count++;
+ $count ++;
}
- $i++;
+ $i ++;
}
$customercount = $num_rows;
eval("echo \"" . getTemplate("customers/customers") . "\";");
-
- } elseif($action == 'su'
- && $id != 0
- ) {
+ } elseif ($action == 'su' && $id != 0) {
try {
$json_result = Customers::getLocal($userinfo, array(
'id' => $id
@@ -175,9 +168,11 @@ if ($page == 'customers'
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :id
- AND `hash` = :hash"
- );
- $result = Database::pexecute_first($result_stmt, array('id' => $userinfo['userid'], 'hash' => $s));
+ AND `hash` = :hash");
+ $result = Database::pexecute_first($result_stmt, array(
+ 'id' => $userinfo['userid'],
+ 'hash' => $s
+ ));
$s = md5(uniqid(microtime(), 1));
$insert = Database::prepare("
@@ -188,8 +183,7 @@ if ($page == 'customers'
`useragent` = :ua,
`lastactivity` = :lastact,
`language` = :lang,
- `adminsession` = '0'"
- );
+ `adminsession` = '0'");
Database::pexecute($insert, array(
'hash' => $s,
'id' => $id,
@@ -201,19 +195,19 @@ if ($page == 'customers'
$log->logAction(ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'");
$target = (isset($_GET['target']) ? $_GET['target'] : 'index');
- $redirect = "customer_".$target.".php";
- if (!file_exists(FROXLOR_INSTALL_DIR."/".$redirect)) {
+ $redirect = "customer_" . $target . ".php";
+ if (! file_exists(FROXLOR_INSTALL_DIR . "/" . $redirect)) {
$redirect = "customer_index.php";
}
- redirectTo($redirect, array('s' => $s), true);
-
+ redirectTo($redirect, array(
+ 's' => $s
+ ), true);
} else {
- redirectTo('index.php', array('action' => 'login'));
+ redirectTo('index.php', array(
+ 'action' => 'login'
+ ));
}
-
- } elseif($action == 'unlock'
- && $id != 0
- ) {
+ } elseif ($action == 'unlock' && $id != 0) {
try {
$json_result = Customers::getLocal($userinfo, array(
'id' => $id
@@ -223,9 +217,7 @@ if ($page == 'customers'
}
$result = json_decode($json_result, true)['data'];
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
$json_result = Customers::getLocal($userinfo, array(
'id' => $id
@@ -233,14 +225,18 @@ if ($page == 'customers'
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
- redirectTo($filename, array('page' => $page, 's' => $s));
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
- ask_yesno('customer_reallyunlock', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
+ ask_yesno('customer_reallyunlock', $filename, array(
+ 'id' => $id,
+ 'page' => $page,
+ 'action' => $action
+ ), $result['loginname']);
}
-
- } elseif ($action == 'delete'
- && $id != 0
- ) {
+ } elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Customers::getLocal($userinfo, array(
'id' => $id
@@ -250,39 +246,43 @@ if ($page == 'customers'
}
$result = json_decode($json_result, true)['data'];
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
$json_result = Customers::getLocal($userinfo, array(
'id' => $id,
- 'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int)$_POST['delete_userfiles'] : 0)
+ 'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int) $_POST['delete_userfiles'] : 0)
))->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
- redirectTo($filename, array('page' => $page, 's' => $s));
-
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
- ask_yesno_withcheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
+ ask_yesno_withcheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, array(
+ 'id' => $id,
+ 'page' => $page,
+ 'action' => $action
+ ), $result['loginname']);
}
+ } elseif ($action == 'add') {
- } elseif($action == 'add') {
-
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Customers::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
- redirectTo($filename, array('page' => $page, 's' => $s));
+ redirectTo($filename, array(
+ 'page' => $page,
+ 's' => $s
+ ));
} else {
$language_options = '';
foreach ($languages as $language_file => $language_name) {
- $language_options.= makeoption($language_name, $language_file, Settings::Get('panel.standardlanguage'), true);
+ $language_options .= makeoption($language_name, $language_file, Settings::Get('panel.standardlanguage'), true);
}
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
@@ -309,12 +309,12 @@ if ($page == 'customers'
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
- 'label' => $row['description'] . " [".$row['interpreter']."]
",
+ 'label' => $row['description'] . " [" . $row['interpreter'] . "]
",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
- 'label' => $row['description']."
",
+ 'label' => $row['description'] . "
",
'value' => $row['id']
);
}
@@ -327,14 +327,14 @@ if ($page == 'customers'
FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC
");
- if (Database::num_rows() > 0){
+ if (Database::num_rows() > 0) {
$hosting_plans .= makeoption("---", 0, 0, true, true);
}
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
$hosting_plans .= makeoption($row['name'], $row['id'], 0, true, true);
}
- $customer_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/customer/formfield.customer_add.php';
+ $customer_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
$customer_add_form = htmlform::genHTMLForm($customer_add_data);
$title = $customer_add_data['customer_add']['title'];
@@ -342,10 +342,7 @@ if ($page == 'customers'
eval("echo \"" . getTemplate("customers/customers_add") . "\";");
}
-
- } elseif($action == 'edit'
- && $id != 0
- ) {
+ } elseif ($action == 'edit' && $id != 0) {
try {
$json_result = Customers::getLocal($userinfo, array(
@@ -361,14 +358,13 @@ if ($page == 'customers'
*/
$available_admins_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
- WHERE (`customers` = '-1' OR `customers` > `customers_used`)"
- );
+ WHERE (`customers` = '-1' OR `customers` > `customers_used`)");
Database::pexecute($available_admins_stmt);
$admin_select = makeoption("-----", 0, true, true, true);
$admin_select_cnt = 0;
while ($available_admin = $available_admins_stmt->fetch()) {
- $admin_select .= makeoption($available_admin['name']." (".$available_admin['loginname'].")", $available_admin['adminid'], null, true, true);
- $admin_select_cnt++;
+ $admin_select .= makeoption($available_admin['name'] . " (" . $available_admin['loginname'] . ")", $available_admin['adminid'], null, true, true);
+ $admin_select_cnt ++;
}
/*
* end of moving customer stuff
@@ -376,9 +372,7 @@ if ($page == 'customers'
if ($result['loginname'] != '') {
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Customers::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
@@ -392,7 +386,7 @@ if ($page == 'customers'
$language_options = '';
foreach ($languages as $language_file => $language_name) {
- $language_options.= makeoption($language_name, $language_file, $result['def_language'], true);
+ $language_options .= makeoption($language_name, $language_file, $result['def_language'], true);
}
$dec_places = Settings::Get('panel.decimal_places');
@@ -465,12 +459,12 @@ if ($page == 'customers'
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
- 'label' => $row['description'] . " [".$row['interpreter']."]
",
+ 'label' => $row['description'] . " [" . $row['interpreter'] . "]
",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
- 'label' => $row['description']."
",
+ 'label' => $row['description'] . "
",
'value' => $row['id']
);
}
@@ -483,14 +477,14 @@ if ($page == 'customers'
FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC
");
- if (Database::num_rows() > 0){
+ if (Database::num_rows() > 0) {
$hosting_plans .= makeoption("---", 0, 0, true, true);
}
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
$hosting_plans .= makeoption($row['name'], $row['id'], 0, true, true);
}
- $customer_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/customer/formfield.customer_edit.php';
+ $customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
$customer_edit_form = htmlform::genHTMLForm($customer_edit_data);
$title = $customer_edit_data['customer_edit']['title'];
diff --git a/admin_domains.php b/admin_domains.php
index c3aec573..83bd351b 100644
--- a/admin_domains.php
+++ b/admin_domains.php
@@ -19,8 +19,8 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
-use Froxlor\Settings as Settings;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
use Froxlor\Api\Commands\Domains as Domains;
if (isset($_POST['id'])) {
@@ -39,9 +39,9 @@ if ($page == 'domains' || $page == 'overview') {
}
$countcustomers = Database::pexecute_first($stmt, $params);
$countcustomers = (int) $countcustomers['countcustomers'];
-
+
if ($action == '') {
-
+
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
$fields = array(
'd.domain' => $lng['domains']['domainname'],
@@ -71,17 +71,17 @@ if ($page == 'domains' || $page == 'overview') {
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$domain_array = array();
-
+
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
-
+
formatDomainEntry($row, $idna_convert);
-
+
if (! isset($domain_array[$row['domain']])) {
$domain_array[$row['domain']] = $row;
} else {
$domain_array[$row['domain']] = array_merge($row, $domain_array[$row['domain']]);
}
-
+
if (isset($row['aliasdomainid']) && $row['aliasdomainid'] != null && isset($row['aliasdomain']) && $row['aliasdomain'] != '') {
if (! isset($domain_array[$row['aliasdomain']])) {
$domain_array[$row['aliasdomain']] = array();
@@ -90,7 +90,7 @@ if ($page == 'domains' || $page == 'overview') {
$domain_array[$row['aliasdomain']]['domainalias'] = $row['domain'];
}
}
-
+
/**
* We need ksort/krsort here to make sure idna-domains are also sorted correctly
*/
@@ -99,11 +99,11 @@ if ($page == 'domains' || $page == 'overview') {
} elseif ($paging->sortfield == 'd.domain' && $paging->sortorder == 'desc') {
krsort($domain_array);
}
-
+
$i = 0;
$count = 0;
foreach ($domain_array as $row) {
-
+
if (isset($row['domain']) && $row['domain'] != '' && $paging->checkDisplay($i)) {
$row['customername'] = getCorrectFullUserDetails($row);
$row = htmlentities_array($row);
@@ -114,13 +114,13 @@ if ($page == 'domains' || $page == 'overview') {
}
$i ++;
}
-
+
$domainscount = $numrows_domains;
-
+
// Display the list
eval("echo \"" . getTemplate("domains/domains") . "\";");
} elseif ($action == 'delete' && $id != 0) {
-
+
try {
$json_result = Domains::getLocal($userinfo, array(
'id' => $id,
@@ -130,23 +130,23 @@ if ($page == 'domains' || $page == 'overview') {
dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
-
+
$alias_check_stmt = Database::prepare("
SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `aliasdomain`= :id");
$alias_check = Database::pexecute_first($alias_check_stmt, array(
'id' => $id
));
-
+
if ($result['domain'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send' && $alias_check['count'] == 0) {
-
+
try {
Domains::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
-
+
redirectTo($filename, array(
'page' => $page,
's' => $s
@@ -154,7 +154,7 @@ if ($page == 'domains' || $page == 'overview') {
} elseif ($alias_check['count'] > 0) {
standard_error('domains_cantdeletedomainwithaliases');
} else {
-
+
$showcheck = false;
if (domainHasMainSubDomains($id)) {
$showcheck = true;
@@ -167,7 +167,7 @@ if ($page == 'domains' || $page == 'overview') {
}
}
} elseif ($action == 'add') {
-
+
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Domains::getLocal($userinfo, $_POST)->add();
@@ -179,7 +179,7 @@ if ($page == 'domains' || $page == 'overview') {
's' => $s
));
} else {
-
+
$customers = makeoption($lng['panel']['please_choose'], 0, 0, true);
$result_customers_stmt = Database::prepare("
SELECT `customerid`, `loginname`, `name`, `firstname`, `company`
@@ -189,24 +189,24 @@ if ($page == 'domains' || $page == 'overview') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_customers_stmt, $params);
-
+
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers .= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
}
-
+
$admins = '';
if ($userinfo['customers_see_all'] == '1') {
-
+
$result_admins_stmt = Database::query("
SELECT `adminid`, `loginname`, `name`
FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `domains_used` < `domains` OR `domains` = '-1' ORDER BY `name` ASC");
-
+
while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) {
$admins .= makeoption(getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $userinfo['adminid']);
}
}
-
+
if ($userinfo['ip'] == "-1") {
$result_ipsandports_stmt = Database::query("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='0' ORDER BY `ip`, `port` ASC
@@ -221,14 +221,14 @@ if ($page == 'domains' || $page == 'overview') {
$admin_ip = Database::pexecute_first($admin_ip_stmt, array(
'ipid' => $userinfo['ip']
));
-
+
$result_ipsandports_stmt = Database::prepare("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='0' AND `ip` = :ipid ORDER BY `ip`, `port` ASC
");
Database::pexecute($result_ipsandports_stmt, array(
'ipid' => $admin_ip['ip']
));
-
+
$result_ssl_ipsandports_stmt = Database::prepare("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='1' AND `ip` = :ipid ORDER BY `ip`, `port` ASC
");
@@ -236,49 +236,49 @@ if ($page == 'domains' || $page == 'overview') {
'ipid' => $admin_ip['ip']
));
}
-
+
// Build array holding all IPs and Ports available to this admin
$ipsandports = array();
while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
-
+
if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row_ipandport['ip'] = '[' . $row_ipandport['ip'] . ']';
}
-
+
$ipsandports[] = array(
'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'] . '
',
'value' => $row_ipandport['id']
);
}
-
+
$ssl_ipsandports = array();
while ($row_ssl_ipandport = $result_ssl_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
-
+
if (filter_var($row_ssl_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row_ssl_ipandport['ip'] = '[' . $row_ssl_ipandport['ip'] . ']';
}
-
+
$ssl_ipsandports[] = array(
'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'] . '
',
'value' => $row_ssl_ipandport['id']
);
}
-
+
$standardsubdomains = array();
$result_standardsubdomains_stmt = Database::query("
SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`id` = `c`.`standardsubdomain`
");
-
+
while ($row_standardsubdomain = $result_standardsubdomains_stmt->fetch(PDO::FETCH_ASSOC)) {
$standardsubdomains[] = $row_standardsubdomain['id'];
}
-
+
if (count($standardsubdomains) > 0) {
$standardsubdomains = " AND `d`.`id` NOT IN (" . join(',', $standardsubdomains) . ") ";
} else {
$standardsubdomains = '';
}
-
+
$domains = makeoption($lng['domains']['noaliasdomain'], 0, NULL, true);
$result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
@@ -290,11 +290,11 @@ if ($page == 'domains' || $page == 'overview') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_domains_stmt, $params);
-
+
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= makeoption($idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')', $row_domain['id']);
}
-
+
$subtodomains = makeoption($lng['domains']['nosubtomaindomain'], 0, NULL, true);
$result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
@@ -303,18 +303,18 @@ if ($page == 'domains' || $page == 'overview') {
");
// params from above still valid
Database::pexecute($result_domains_stmt, $params);
-
+
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$subtodomains .= makeoption($idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')', $row_domain['id']);
}
-
+
$phpconfigs = '';
$configs = Database::query("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
");
-
+
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs .= makeoption($row['description'] . " [" . $row['interpreter'] . "]", $row['id'], Settings::Get('phpfpm.defaultini'), true, true);
@@ -322,30 +322,30 @@ if ($page == 'domains' || $page == 'overview') {
$phpconfigs .= makeoption($row['description'], $row['id'], Settings::Get('system.mod_fcgid_defaultini'), true, true);
}
}
-
+
// create serveralias options
$serveraliasoptions = "";
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', '0', true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_www'], '1', '0', true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_none'], '2', '0', true, true);
-
+
$subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true);
$subcanemaildomain .= makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true);
$subcanemaildomain .= makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', '0', true, true);
$subcanemaildomain .= makeoption($lng['admin']['subcanemaildomain']['always'], '3', '0', true, true);
-
+
$add_date = date('Y-m-d');
-
+
$domain_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_add.php';
$domain_add_form = htmlform::genHTMLForm($domain_add_data);
-
+
$title = $domain_add_data['domain_add']['title'];
$image = $domain_add_data['domain_add']['image'];
-
+
eval("echo \"" . getTemplate("domains/domains_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
-
+
try {
$json_result = Domains::getLocal($userinfo, array(
'id' => $id
@@ -354,9 +354,9 @@ if ($page == 'domains' || $page == 'overview') {
dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
-
+
if ($result['domain'] != '') {
-
+
$subdomains_stmt = Database::prepare("
SELECT COUNT(`id`) AS count FROM `" . TABLE_PANEL_DOMAINS . "` WHERE
`parentdomainid` = :resultid
@@ -365,7 +365,7 @@ if ($page == 'domains' || $page == 'overview') {
'resultid' => $result['id']
));
$subdomains = $subdomains['count'];
-
+
$alias_check_stmt = Database::prepare("
SELECT COUNT(`id`) AS count FROM `" . TABLE_PANEL_DOMAINS . "` WHERE
`aliasdomain` = :resultid
@@ -374,7 +374,7 @@ if ($page == 'domains' || $page == 'overview') {
'resultid' => $result['id']
));
$alias_check = $alias_check['count'];
-
+
$domain_emails_result_stmt = Database::prepare("
SELECT `email`, `email_full`, `destination`, `popaccountid` AS `number_email_forwarders`
FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid` = :customerid AND `domainid` = :id
@@ -383,37 +383,37 @@ if ($page == 'domains' || $page == 'overview') {
'customerid' => $result['customerid'],
'id' => $result['id']
));
-
+
$emails = Database::num_rows();
$email_forwarders = 0;
$email_accounts = 0;
-
+
while ($domain_emails_row = $domain_emails_result_stmt->fetch(PDO::FETCH_ASSOC)) {
-
+
if ($domain_emails_row['destination'] != '') {
-
+
$domain_emails_row['destination'] = explode(' ', makeCorrectDestination($domain_emails_row['destination']));
$email_forwarders += count($domain_emails_row['destination']);
-
+
if (in_array($domain_emails_row['email_full'], $domain_emails_row['destination'])) {
$email_forwarders -= 1;
$email_accounts ++;
}
}
}
-
+
$ipsresult_stmt = Database::prepare("
SELECT `id_ipandports` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_domain` = :id
");
Database::pexecute($ipsresult_stmt, array(
'id' => $result['id']
));
-
+
$usedips = array();
while ($ipsresultrow = $ipsresult_stmt->fetch(PDO::FETCH_ASSOC)) {
$usedips[] = $ipsresultrow['id_ipandports'];
}
-
+
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Domains::getLocal($userinfo, $_POST)->update();
@@ -425,7 +425,7 @@ if ($page == 'domains' || $page == 'overview') {
's' => $s
));
} else {
-
+
if (Settings::Get('panel.allow_domain_change_customer') == '1') {
$customers = '';
$result_customers_stmt = Database::prepare("
@@ -447,7 +447,7 @@ if ($page == 'domains' || $page == 'overview') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_customers_stmt, $params);
-
+
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers .= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid'], $result['customerid']);
}
@@ -461,10 +461,10 @@ if ($page == 'domains' || $page == 'overview') {
));
$result['customername'] = getCorrectFullUserDetails($customer) . ' (' . $customer['loginname'] . ')';
}
-
+
if ($userinfo['customers_see_all'] == '1') {
if (Settings::Get('panel.allow_domain_change_admin') == '1') {
-
+
$admins = '';
$result_admins_stmt = Database::prepare("
SELECT `adminid`, `loginname`, `name` FROM `" . TABLE_PANEL_ADMINS . "`
@@ -473,7 +473,7 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_admins_stmt, array(
'adminid' => $result['adminid']
));
-
+
while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) {
$admins .= makeoption(getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $result['adminid']);
}
@@ -487,10 +487,10 @@ if ($page == 'domains' || $page == 'overview') {
$result['adminname'] = getCorrectFullUserDetails($admin) . ' (' . $admin['loginname'] . ')';
}
}
-
+
$result['domain'] = $idna_convert->decode($result['domain']);
$domains = makeoption($lng['domains']['noaliasdomain'], 0, null, true);
-
+
$result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = '0' AND `d`.`id` <> :id
@@ -501,11 +501,11 @@ if ($page == 'domains' || $page == 'overview') {
'id' => $result['id'],
'customerid' => $result['customerid']
));
-
+
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']);
}
-
+
$subtodomains = makeoption($lng['domains']['nosubtomaindomain'], 0, null, true);
$result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
@@ -520,11 +520,11 @@ if ($page == 'domains' || $page == 'overview') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_domains_stmt, $params);
-
+
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$subtodomains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['ismainbutsubto']);
}
-
+
if ($userinfo['ip'] == "-1") {
$result_ipsandports_stmt = Database::query("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='0' ORDER BY `ip`, `port` ASC
@@ -539,14 +539,14 @@ if ($page == 'domains' || $page == 'overview') {
$admin_ip = Database::pexecute_first($admin_ip_stmt, array(
'ipid' => $userinfo['ip']
));
-
+
$result_ipsandports_stmt = Database::prepare("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='0' AND `ip` = :ipid ORDER BY `ip`, `port` ASC
");
Database::pexecute($result_ipsandports_stmt, array(
'ipid' => $admin_ip['ip']
));
-
+
$result_ssl_ipsandports_stmt = Database::prepare("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='1' AND `ip` = :ipid ORDER BY `ip`, `port` ASC
");
@@ -554,7 +554,7 @@ if ($page == 'domains' || $page == 'overview') {
'ipid' => $admin_ip['ip']
));
}
-
+
$ipsandports = array();
while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
@@ -565,7 +565,7 @@ if ($page == 'domains' || $page == 'overview') {
'value' => $row_ipandport['id']
);
}
-
+
$ssl_ipsandports = array();
while ($row_ssl_ipandport = $result_ssl_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ssl_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
@@ -576,7 +576,7 @@ if ($page == 'domains' || $page == 'overview') {
'value' => $row_ssl_ipandport['id']
);
}
-
+
// create serveralias options
$serveraliasoptions = "";
$_value = '2';
@@ -586,22 +586,22 @@ if ($page == 'domains' || $page == 'overview') {
} elseif ($result['wwwserveralias'] == '1') {
$_value = '1';
}
-
+
// Fudge the result for ssl_redirect to hide the Let's Encrypt steps
$result['temporary_ssl_redirect'] = $result['ssl_redirect'];
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
-
+
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $_value, true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_www'], '1', $_value, true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_none'], '2', $_value, true, true);
-
+
$subcanemaildomain = makeoption($lng['admin']['subcanemaildomain']['never'], '0', $result['subcanemaildomain'], true, true);
$subcanemaildomain .= makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', $result['subcanemaildomain'], true, true);
$subcanemaildomain .= makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', $result['subcanemaildomain'], true, true);
$subcanemaildomain .= makeoption($lng['admin']['subcanemaildomain']['always'], '3', $result['subcanemaildomain'], true, true);
$speciallogfile = ($result['speciallogfile'] == 1 ? $lng['panel']['yes'] : $lng['panel']['no']);
$result['add_date'] = date('Y-m-d', $result['add_date']);
-
+
$phpconfigs = '';
$phpconfigs_result_stmt = Database::query("
SELECT c.*, fc.description as interpreter
@@ -614,7 +614,7 @@ if ($page == 'domains' || $page == 'overview') {
} else {
$c_allowed_configs = array();
}
-
+
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
$disabled = ! empty($c_allowed_configs) && ! in_array($phpconfigs_row['id'], $c_allowed_configs);
if ((int) Settings::Get('phpfpm.enabled') == 1) {
@@ -623,46 +623,46 @@ if ($page == 'domains' || $page == 'overview') {
$phpconfigs .= makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled);
}
}
-
+
$result = htmlentities_array($result);
-
+
$domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php';
$domain_edit_form = htmlform::genHTMLForm($domain_edit_data);
-
+
$title = $domain_edit_data['domain_edit']['title'];
$image = $domain_edit_data['domain_edit']['image'];
-
+
$speciallogwarning = sprintf($lng['admin']['speciallogwarning'], $lng['admin']['delete_statistics']);
-
+
eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
}
}
} elseif ($action == 'jqGetCustomerPHPConfigs') {
-
+
$customerid = intval($_POST['customerid']);
$allowed_phpconfigs = getCustomerDetail($customerid, 'allowed_phpconfigs');
echo ! empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode(array());
exit();
} elseif ($action == 'import') {
-
+
if (isset($_POST['send']) && $_POST['send'] == 'send') {
-
+
$customerid = intval($_POST['customerid']);
$separator = validate($_POST['separator'], 'separator');
$offset = (int) validate($_POST['offset'], 'offset', "/[0-9]/i");
-
+
$file_name = $_FILES['file']['tmp_name'];
-
+
$result = array();
-
+
try {
$bulk = new DomainBulkAction($file_name, $customerid);
$result = $bulk->doImport($separator, $offset);
} catch (Exception $e) {
standard_error('domain_import_error', $e->getMessage());
}
-
- if (!empty($bulk->getErrors())) {
+
+ if (! empty($bulk->getErrors())) {
dynamic_error(implode("
", $bulk->getErrors()));
}
@@ -670,8 +670,8 @@ if ($page == 'domains' || $page == 'overview') {
updateCounters(false);
inserttask('1');
inserttask('4');
-
- $result_str = $result['imported'] . ' / ' . $result['all'] . (!empty($result['note']) ? ' ('.$result['note'].')' : '');
+
+ $result_str = $result['imported'] . ' / ' . $result['all'] . (! empty($result['note']) ? ' (' . $result['note'] . ')' : '');
standard_success('domain_import_successfully', $result_str, array(
'filename' => $filename,
'action' => '',
@@ -687,50 +687,48 @@ if ($page == 'domains' || $page == 'overview') {
$params['adminid'] = $userinfo['adminid'];
}
Database::pexecute($result_customers_stmt, $params);
-
+
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers .= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
}
-
+
$domain_import_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_import.php';
$domain_import_form = htmlform::genHTMLForm($domain_import_data);
-
+
$title = $domain_import_data['domain_import']['title'];
$image = $domain_import_data['domain_import']['image'];
-
+
eval("echo \"" . getTemplate("domains/domains_import") . "\";");
}
}
} elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') {
-
- require_once __DIR__ . '/dns_editor.php';
+ require_once __DIR__ . '/dns_editor.php';
} elseif ($page == 'sslcertificates') {
require_once __DIR__ . '/ssl_certificates.php';
-
} elseif ($page == 'logfiles') {
- require_once __DIR__.'/logfiles_viewer.php';
+ require_once __DIR__ . '/logfiles_viewer.php';
}
function formatDomainEntry(&$row, &$idna_convert)
{
$row['domain'] = $idna_convert->decode($row['domain']);
$row['aliasdomain'] = $idna_convert->decode($row['aliasdomain']);
-
+
$resultips_stmt = Database::prepare("
SELECT `ips`.* FROM `" . TABLE_DOMAINTOIP . "` AS `dti`, `" . TABLE_PANEL_IPSANDPORTS . "` AS `ips`
WHERE `dti`.`id_ipandports` = `ips`.`id` AND `dti`.`id_domain` = :domainid
");
-
+
Database::pexecute($resultips_stmt, array(
'domainid' => $row['id']
));
-
+
$row['ipandport'] = '';
while ($rowip = $resultips_stmt->fetch(PDO::FETCH_ASSOC)) {
-
+
if (filter_var($rowip['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ipandport'] .= '[' . $rowip['ip'] . ']:' . $rowip['port'] . "\n";
} else {
@@ -739,12 +737,12 @@ function formatDomainEntry(&$row, &$idna_convert)
}
$row['ipandport'] = substr($row['ipandport'], 0, - 1);
$row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']);
-
+
$row['termination_css'] = "";
if ($row['termination_date'] != "") {
$cdate = strtotime($row['termination_date'] . " 23:59:59");
$today = time();
-
+
if ($cdate < $today) {
$row['termination_css'] = 'domain-expired';
} else {
diff --git a/admin_index.php b/admin_index.php
index 087eef50..095af330 100644
--- a/admin_index.php
+++ b/admin_index.php
@@ -16,33 +16,32 @@
* @package Panel
*
*/
-
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
-use Froxlor\Settings as Settings;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
use Froxlor\Api\Commands\Froxlor as Froxlor;
use Froxlor\Api\Commands\Admins as Admins;
-if ($action == 'logout') {
+if ($action == 'logout') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
- $params = array('adminid' => (int)$userinfo['adminid']);
+ $params = array(
+ 'adminid' => (int) $userinfo['adminid']
+ );
if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'
- AND `hash` = :hash"
- );
+ AND `hash` = :hash");
$params['hash'] = $s;
} else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
- AND `adminsession` = '1'"
- );
+ AND `adminsession` = '1'");
}
Database::pexecute($stmt, $params);
@@ -51,7 +50,7 @@ if ($action == 'logout') {
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
-} elseif(isset($_GET['id'])) {
+} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
@@ -70,7 +69,9 @@ if ($page == 'overview') {
SUM(`subdomains_used`) AS `subdomains_used`,
SUM(`traffic_used`) AS `traffic_used`
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
- $overview = Database::pexecute_first($overview_stmt, array('adminid' => $userinfo['adminid']));
+ $overview = Database::pexecute_first($overview_stmt, array(
+ 'adminid' => $userinfo['adminid']
+ ));
$dec_places = Settings::Get('panel.decimal_places');
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
@@ -78,9 +79,10 @@ if ($page == 'overview') {
$number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
- WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
- );
- $number_domains = Database::pexecute_first($number_domains_stmt, array('adminid' => $userinfo['adminid']));
+ WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
+ $number_domains = Database::pexecute_first($number_domains_stmt, array(
+ 'adminid' => $userinfo['adminid']
+ ));
$overview['number_domains'] = $number_domains['number_domains'];
@@ -88,9 +90,7 @@ if ($page == 'overview') {
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION);
$webserverinterface = strtoupper(@php_sapi_name());
- if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
- || (isset($lookfornewversion) && $lookfornewversion == 'yes')
- ) {
+ if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
try {
$json_result = Froxlor::getLocal($userinfo)->checkUpdate();
} catch (Exception $e) {
@@ -124,11 +124,11 @@ if ($page == 'overview') {
$outstanding_tasks = getOutstandingTasks();
$system_hostname = gethostname();
- $meminfo= explode("\n", @file_get_contents("/proc/meminfo"));
+ $meminfo = explode("\n", @file_get_contents("/proc/meminfo"));
$memory = "";
- for ($i = 0; $i < sizeof($meminfo); ++$i) {
+ for ($i = 0; $i < sizeof($meminfo); ++ $i) {
if (substr($meminfo[$i], 0, 3) === "Mem") {
- $memory.= $meminfo[$i] . PHP_EOL;
+ $memory .= $meminfo[$i] . PHP_EOL;
}
}
@@ -138,7 +138,7 @@ if ($page == 'overview') {
} else {
$load = @file_get_contents('/proc/loadavg');
- if (!$load) {
+ if (! $load) {
$load = $lng['admin']['noloadavailable'];
}
}
@@ -156,10 +156,7 @@ if ($page == 'overview') {
// First: With exec (let's hope it's enabled for the Froxlor - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
- if (is_array($uptime_array)
- && isset($uptime_array[0])
- && is_numeric($uptime_array[0])
- ) {
+ if (is_array($uptime_array) && isset($uptime_array[0]) && is_numeric($uptime_array[0])) {
// Some calculatioon to get a nicly formatted display
$seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60;
@@ -178,15 +175,12 @@ if ($page == 'overview') {
}
eval("echo \"" . getTemplate("index/index") . "\";");
+} elseif ($page == 'change_password') {
-} elseif($page == 'change_password') {
-
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = validate($_POST['old_password'], 'old password');
- if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_ADMINS,'adminid')) {
+ if (! validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
standard_error('oldpasswordnotcorrect');
}
@@ -194,36 +188,50 @@ if ($page == 'overview') {
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') {
- standard_error(array('stringisempty', 'oldpassword'));
- } elseif($new_password == '') {
- standard_error(array('stringisempty', 'newpassword'));
- } elseif($new_password_confirm == '') {
- standard_error(array('stringisempty', 'newpasswordconfirm'));
- } elseif($new_password != $new_password_confirm) {
+ standard_error(array(
+ 'stringisempty',
+ 'oldpassword'
+ ));
+ } elseif ($new_password == '') {
+ standard_error(array(
+ 'stringisempty',
+ 'newpassword'
+ ));
+ } elseif ($new_password_confirm == '') {
+ standard_error(array(
+ 'stringisempty',
+ 'newpasswordconfirm'
+ ));
+ } elseif ($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror');
} else {
try {
- Admins::getLocal($userinfo, array('id' => $userinfo['adminid'], 'admin_password' => $new_password))->update();
+ Admins::getLocal($userinfo, array(
+ 'id' => $userinfo['adminid'],
+ 'admin_password' => $new_password
+ ))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
- redirectTo($filename, Array('s' => $s));
+ redirectTo($filename, Array(
+ 's' => $s
+ ));
}
} else {
eval("echo \"" . getTemplate("index/change_password") . "\";");
}
+} elseif ($page == 'change_language') {
-} elseif($page == 'change_language') {
-
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
$def_language = validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) {
try {
- Admins::getLocal($userinfo, array('id' => $userinfo['adminid'], 'def_language' => $def_language))->update();
+ Admins::getLocal($userinfo, array(
+ 'id' => $userinfo['adminid'],
+ 'def_language' => $def_language
+ ))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
@@ -232,16 +240,16 @@ if ($page == 'overview') {
$lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng
- WHERE `hash`= :hash"
- );
+ WHERE `hash`= :hash");
Database::pexecute($lng_stmt, array(
'lng' => $def_language,
'hash' => $s
));
}
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
- redirectTo($filename, array('s' => $s));
-
+ redirectTo($filename, array(
+ 's' => $s
+ ));
} else {
$language_options = '';
@@ -252,20 +260,20 @@ if ($page == 'overview') {
}
foreach ($languages as $language_file => $language_name) {
- $language_options.= makeoption($language_name, $language_file, $default_lang, true);
+ $language_options .= makeoption($language_name, $language_file, $default_lang, true);
}
eval("echo \"" . getTemplate("index/change_language") . "\";");
}
-
} elseif ($page == 'change_theme') {
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = validate($_POST['theme'], 'theme');
try {
- Admins::getLocal($userinfo, array('id' => $userinfo['adminid'], 'theme' => $theme))->update();
+ Admins::getLocal($userinfo, array(
+ 'id' => $userinfo['adminid'],
+ 'theme' => $theme
+ ))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
}
@@ -274,16 +282,16 @@ if ($page == 'overview') {
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme
- WHERE `hash`= :hash"
- );
+ WHERE `hash`= :hash");
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'hash' => $s
));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
- redirectTo($filename, array('s' => $s));
-
+ redirectTo($filename, array(
+ 's' => $s
+ ));
} else {
$theme_options = '';
@@ -295,25 +303,20 @@ if ($page == 'overview') {
$themes_avail = getThemes();
foreach ($themes_avail as $t => $d) {
- $theme_options.= makeoption($d, $t, $default_theme, true);
+ $theme_options .= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate("index/change_theme") . "\";");
}
-
-} elseif ($page == 'send_error_report'
- && Settings::Get('system.allow_error_report_admin') == '1'
-) {
+} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') {
// only show this if we really have an exception to report
- if (isset($_GET['errorid'])
- && $_GET['errorid'] != ''
- ) {
+ if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
$errid = $_GET['errorid'];
// read error file
- $err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
- $err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
+ $err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR . "/logs/");
+ $err_file = makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
if (file_exists($err_file)) {
@@ -332,19 +335,17 @@ if ($page == 'overview') {
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
- $mail_body .= $_error['code'].' '.$_error['message']."\n\n";
- $mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
- $mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
+ $mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
+ $mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
+ $mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
$mail_body .= "-------------------------------------------------------------\n\n";
- $mail_body .= "Froxlor-version: ".$version."\n";
- $mail_body .= "DB-version: ".$dbversion."\n\n";
+ $mail_body .= "Froxlor-version: " . $version . "\n";
+ $mail_body .= "DB-version: " . $dbversion . "\n\n";
$mail_body .= "End of report";
$mail_html = nl2br($mail_body);
// send actual report to dev-team
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
// send mail and say thanks
$_mailerror = false;
try {
@@ -353,7 +354,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
- } catch(\PHPMailer\PHPMailer\Exception $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -368,22 +369,25 @@ if ($page == 'overview') {
// finally remove error from fs
@unlink($err_file);
- redirectTo($filename, array('s' => $s));
+ redirectTo($filename, array(
+ 's' => $s
+ ));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
-
} else {
- redirectTo($filename, array('s' => $s));
+ redirectTo($filename, array(
+ 's' => $s
+ ));
}
} else {
- redirectTo($filename, array('s' => $s));
+ redirectTo($filename, array(
+ 's' => $s
+ ));
}
-}
-elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
+} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/api_keys.php';
-}
-elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
+} elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/apihelp.php';
}
diff --git a/admin_ipsandports.php b/admin_ipsandports.php
index bc70a9ba..4dc9d996 100644
--- a/admin_ipsandports.php
+++ b/admin_ipsandports.php
@@ -19,8 +19,8 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
-use Froxlor\Settings as Settings;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts;
if (isset($_POST['id'])) {
diff --git a/admin_logger.php b/admin_logger.php
index 84c73109..a2c4c83a 100644
--- a/admin_logger.php
+++ b/admin_logger.php
@@ -20,7 +20,7 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
+use Froxlor\Database\Database;
if ($page == 'log'
&& $userinfo['change_serversettings'] == '1'
diff --git a/admin_message.php b/admin_message.php
index 44331eba..52761492 100644
--- a/admin_message.php
+++ b/admin_message.php
@@ -20,7 +20,7 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
+use Froxlor\Database\Database;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
diff --git a/admin_phpsettings.php b/admin_phpsettings.php
index 71b77007..9cfff7c6 100644
--- a/admin_phpsettings.php
+++ b/admin_phpsettings.php
@@ -19,7 +19,7 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
+use Froxlor\Database\Database;
use Froxlor\Api\Commands\PhpSettings as PhpSettings;
use Froxlor\Api\Commands\FpmDaemons as FpmDaemons;
diff --git a/admin_plans.php b/admin_plans.php
index bdcc767b..f4e8be2c 100644
--- a/admin_plans.php
+++ b/admin_plans.php
@@ -17,8 +17,8 @@
define('AREA', 'admin');
require './lib/init.php';
-use Froxlor\Database as Database;
-use Froxlor\Settings as Settings;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
@@ -27,9 +27,9 @@ if (isset($_POST['id'])) {
}
if ($page == '' || $page == 'overview') {
-
+
if ($action == '') {
-
+
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_plans");
$fields = array(
'p.name' => $lng['admin']['plans']['name'],
@@ -54,9 +54,9 @@ if ($page == '' || $page == 'overview') {
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
-
+
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
-
+
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['ts_format'] = date("d.m.Y H:i", $row['ts']);
@@ -65,25 +65,25 @@ if ($page == '' || $page == 'overview') {
}
$i ++;
}
-
+
eval("echo \"" . getTemplate("plans/plans") . "\";");
} elseif ($action == 'delete' && $id != 0) {
-
+
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
$result = Database::pexecute_first($result_stmt, array(
'id' => $id
));
-
+
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['adminid'] == $result['adminid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
-
+
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
Database::pexecute($del_stmt, array(
'id' => $id
));
-
+
$log->logAction(ADM_ACTION, LOG_INFO, "Plan '" . $result['name'] . "' has been deleted by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array(
'page' => $page,
@@ -100,43 +100,43 @@ if ($page == '' || $page == 'overview') {
standard_error('nopermissionsorinvalidid');
}
} elseif ($action == 'add') {
-
+
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$name = validate($_POST['name'], 'name');
$description = validate(str_replace("\r\n", "\n", $_POST['description']), 'description', '/^[^\0]*$/');
-
+
$value_arr = array();
-
+
$value_arr['diskspace'] = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$value_arr['diskspace'] = - 1;
}
-
+
$value_arr['traffic'] = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$value_arr['traffic'] = - 1;
}
-
+
$value_arr['subdomains'] = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$value_arr['subdomains'] = - 1;
}
-
+
$value_arr['emails'] = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$value_arr['emails'] = - 1;
}
-
+
$value_arr['email_accounts'] = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$value_arr['email_accounts'] = - 1;
}
-
+
$value_arr['email_forwarders'] = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$value_arr['email_forwarders'] = - 1;
}
-
+
if (Settings::Get('system.mail_quota_enabled') == '1') {
$value_arr['email_quota'] = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array(
'0',
@@ -148,37 +148,37 @@ if ($page == '' || $page == 'overview') {
} else {
$value_arr['email_quota'] = - 1;
}
-
+
$value_arr['email_imap'] = 0;
if (isset($_POST['email_imap'])) {
$value_arr['email_imap'] = intval_ressource($_POST['email_imap']);
}
-
+
$value_arr['email_pop3'] = 0;
if (isset($_POST['email_pop3'])) {
$value_arr['email_pop3'] = intval_ressource($_POST['email_pop3']);
}
-
+
$value_arr['ftps'] = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$value_arr['ftps'] = - 1;
}
-
+
$value_arr['tickets'] = (Settings::Get('ticket.enabled') == 1 ? intval_ressource($_POST['tickets']) : 0);
if (isset($_POST['tickets_ul']) && Settings::Get('ticket.enabled') == '1') {
$value_arr['tickets'] = - 1;
}
-
+
$value_arr['mysqls'] = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
$value_arr['mysqls'] = - 1;
}
-
+
$value_arr['phpenabled'] = 0;
if (isset($_POST['phpenabled'])) {
$value_arr['phpenabled'] = intval($_POST['phpenabled']);
}
-
+
$value_arr['allowed_phpconfigs'] = array();
if (isset($_POST['allowed_phpconfigs']) && is_array($_POST['allowed_phpconfigs'])) {
foreach ($_POST['allowed_phpconfigs'] as $allowed_phpconfig) {
@@ -186,17 +186,17 @@ if ($page == '' || $page == 'overview') {
$value_arr['allowed_phpconfigs'][] = $allowed_phpconfig;
}
}
-
+
$value_arr['perlenabled'] = 0;
if (isset($_POST['perlenabled'])) {
$value_arr['perlenabled'] = intval($_POST['perlenabled']);
}
-
+
$value_arr['dnsenabled'] = 0;
if (isset($_POST['dnsenabled'])) {
$value_arr['dnsenabled'] = intval($_POST['dnsenabled']);
}
-
+
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_PLANS . "`
SET `adminid` = :adminid, `name` = :name, `description` = :desc, `value` = :valuearr, `ts` = UNIX_TIMESTAMP();
@@ -208,14 +208,14 @@ if ($page == '' || $page == 'overview') {
'valuearr' => json_encode($value_arr)
);
Database::pexecute($ins_stmt, $ins_data);
-
+
$log->logAction(ADM_ACTION, LOG_WARNING, "added plan '" . $name . "'");
redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
-
+
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
@@ -226,7 +226,7 @@ if ($page == '' || $page == 'overview') {
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
-
+
$phpconfigs = array();
$configs = Database::query("
SELECT c.*, fc.description as interpreter
@@ -246,7 +246,7 @@ if ($page == '' || $page == 'overview') {
);
}
}
-
+
// dummy to avoid unknown variables
$language_options = null;
$gender_options = null;
@@ -261,10 +261,10 @@ if ($page == '' || $page == 'overview') {
// merge
$plans_add_data['plans_add']['sections'] = array_merge($plans_add_data['plans_add']['sections'], $cust_add_data['customer_add']['sections']);
$plans_add_form = htmlform::genHTMLForm($plans_add_data);
-
+
$title = $plans_add_data['plans_add']['title'];
$image = $plans_add_data['plans_add']['image'];
-
+
eval("echo \"" . getTemplate("plans/plans_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
@@ -273,54 +273,54 @@ if ($page == '' || $page == 'overview') {
$result = Database::pexecute_first($result_stmt, array(
'id' => $id
));
-
+
if ($result['name'] != '') {
-
+
$result['value'] = json_decode($result['value'], true);
$result = htmlentities_array($result);
-
+
foreach ($result['value'] as $index => $value) {
$result[$index] = $value;
}
$result['allowed_phpconfigs'] = json_encode($result['allowed_phpconfigs']);
-
+
if (isset($_POST['send']) && $_POST['send'] == 'send') {
-
+
$name = validate($_POST['name'], 'name');
$description = validate(str_replace("\r\n", "\n", $_POST['description']), 'description', '/^[^\0]*$/');
-
+
$value_arr = array();
-
+
$value_arr['diskspace'] = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$value_arr['diskspace'] = - 1;
}
-
+
$value_arr['traffic'] = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$value_arr['traffic'] = - 1;
}
-
+
$value_arr['subdomains'] = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$value_arr['subdomains'] = - 1;
}
-
+
$value_arr['emails'] = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$value_arr['emails'] = - 1;
}
-
+
$value_arr['email_accounts'] = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$value_arr['email_accounts'] = - 1;
}
-
+
$value_arr['email_forwarders'] = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$value_arr['email_forwarders'] = - 1;
}
-
+
if (Settings::Get('system.mail_quota_enabled') == '1') {
$value_arr['email_quota'] = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array(
'0',
@@ -332,37 +332,37 @@ if ($page == '' || $page == 'overview') {
} else {
$value_arr['email_quota'] = - 1;
}
-
+
$value_arr['email_imap'] = 0;
if (isset($_POST['email_imap'])) {
$value_arr['email_imap'] = intval_ressource($_POST['email_imap']);
}
-
+
$value_arr['email_pop3'] = 0;
if (isset($_POST['email_pop3'])) {
$value_arr['email_pop3'] = intval_ressource($_POST['email_pop3']);
}
-
+
$value_arr['ftps'] = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$value_arr['ftps'] = - 1;
}
-
+
$value_arr['tickets'] = (Settings::Get('ticket.enabled') == 1 ? intval_ressource($_POST['tickets']) : 0);
if (isset($_POST['tickets_ul']) && Settings::Get('ticket.enabled') == '1') {
$value_arr['tickets'] = - 1;
}
-
+
$value_arr['mysqls'] = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
$value_arr['mysqls'] = - 1;
}
-
+
$value_arr['phpenabled'] = 0;
if (isset($_POST['phpenabled'])) {
$value_arr['phpenabled'] = intval($_POST['phpenabled']);
}
-
+
$value_arr['allowed_phpconfigs'] = array();
if (isset($_POST['allowed_phpconfigs']) && is_array($_POST['allowed_phpconfigs'])) {
foreach ($_POST['allowed_phpconfigs'] as $allowed_phpconfig) {
@@ -370,17 +370,17 @@ if ($page == '' || $page == 'overview') {
$value_arr['allowed_phpconfigs'][] = $allowed_phpconfig;
}
}
-
+
$value_arr['perlenabled'] = 0;
if (isset($_POST['perlenabled'])) {
$value_arr['perlenabled'] = intval($_POST['perlenabled']);
}
-
+
$value_arr['dnsenabled'] = 0;
if (isset($_POST['dnsenabled'])) {
$value_arr['dnsenabled'] = intval($_POST['dnsenabled']);
}
-
+
$ins_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_PLANS . "`
SET `name` = :name, `description` = :desc, `value` = :valuearr, `ts` = UNIX_TIMESTAMP()
@@ -393,7 +393,7 @@ if ($page == '' || $page == 'overview') {
'id' => $id
);
Database::pexecute($ins_stmt, $ins_data);
-
+
$log->logAction(ADM_ACTION, LOG_WARNING, "updated plan '" . $name . "'");
redirectTo($filename, array(
'page' => $page,
@@ -415,42 +415,42 @@ if ($page == '' || $page == 'overview') {
if ($result['subdomains'] == '-1') {
$result['subdomains'] = '';
}
-
+
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
if ($result['emails'] == '-1') {
$result['emails'] = '';
}
-
+
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
if ($result['email_accounts'] == '-1') {
$result['email_accounts'] = '';
}
-
+
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
if ($result['email_forwarders'] == '-1') {
$result['email_forwarders'] = '';
}
-
+
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
if ($result['email_quota'] == '-1') {
$result['email_quota'] = '';
}
-
+
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if ($result['ftps'] == '-1') {
$result['ftps'] = '';
}
-
+
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, $result['tickets'], true, true);
if ($result['tickets'] == '-1') {
$result['tickets'] = '';
}
-
+
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
if ($result['mysqls'] == '-1') {
$result['mysqls'] = '';
}
-
+
$phpconfigs = array();
$configs = Database::query("
SELECT c.*, fc.description as interpreter
@@ -505,21 +505,21 @@ if ($page == '' || $page == 'overview') {
// merge
$plans_edit_data['plans_edit']['sections'] = array_merge($plans_edit_data['plans_edit']['sections'], $cust_edit_data['customer_edit']['sections']);
$plans_edit_form = htmlform::genHTMLForm($plans_edit_data);
-
+
$title = $plans_edit_data['plans_edit']['title'];
$image = $plans_edit_data['plans_edit']['image'];
-
+
eval("echo \"" . getTemplate("plans/plans_edit") . "\";");
}
}
} elseif ($action == 'jqGetPlanValues') {
- $planid = isset($_POST['planid']) ? (int)$_POST['planid'] : 0;
+ $planid = isset($_POST['planid']) ? (int) $_POST['planid'] : 0;
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PLANS . "` WHERE `id` = :id");
$result = Database::pexecute_first($result_stmt, array(
'id' => $planid
));
echo $result['value'];
- exit;
+ exit();
}
}
diff --git a/admin_settings.php b/admin_settings.php
index d6101db8..31a9bb5e 100644
--- a/admin_settings.php
+++ b/admin_settings.php
@@ -16,15 +16,13 @@
* @package Panel
*
*/
-
-use \Froxlor\Database;
-use \Froxlor\Settings;
-use \Froxlor\Api\Commands\Froxlor;
+use Froxlor\Database\Database;
+use Froxlor\Settings;
+use Froxlor\Api\Commands\Froxlor;
define('AREA', 'admin');
require './lib/init.php';
-
// get sql-root access data
Database::needRoot(true);
Database::needSqlData();
@@ -34,9 +32,7 @@ Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
- if (isset($_POST['send'])
- && $_POST['send'] == 'send'
- ) {
+ if (isset($_POST['send']) && $_POST['send'] == 'send') {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') {
@@ -52,7 +48,6 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_part = true;
}
$only_enabledisable = false;
-
} else {
$settings_all = false;
$settings_part = false;
@@ -60,30 +55,26 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
}
// check if the session timeout is too low #815
- if (isset($_POST['session_sessiontimeout'])
- && $_POST['session_sessiontimeout'] < 60
- ) {
+ if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
}
- if (processFormEx(
- $settings_data,
- $_POST,
- array('filename' => $filename, 'action' => $action, 'page' => $page),
- $_part,
- $settings_all,
- $settings_part,
- $only_enabledisable
- )
- ) {
+ if (processFormEx($settings_data, $_POST, array(
+ 'filename' => $filename,
+ 'action' => $action,
+ 'page' => $page
+ ), $_part, $settings_all, $settings_part, $only_enabledisable)) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
- standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
+ standard_success('settingssaved', '', array(
+ 'filename' => $filename,
+ 'action' => $action,
+ 'page' => $page
+ ));
}
-
} else {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
@@ -103,27 +94,24 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;");
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
-
}
-
-} elseif($page == 'phpinfo'
- && $userinfo['change_serversettings'] == '1'
-) {
+} elseif ($page == 'phpinfo' && $userinfo['change_serversettings'] == '1') {
ob_start();
phpinfo();
- $phpinfo = array('phpinfo' => array());
- if (preg_match_all(
- '#(?: