mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 10:27:29 +00:00
correct use of Database use
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
parent
2c893fef25
commit
8e84a4ff44
101
admin_admins.php
101
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'];
|
||||
|
@ -18,7 +18,7 @@
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Settings as Settings;
|
||||
use Froxlor\Settings;
|
||||
|
||||
if ($userinfo['change_serversettings'] == '1') {
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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']."]<br />",
|
||||
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
|
||||
'value' => $row['id']
|
||||
);
|
||||
} else {
|
||||
$phpconfigs[] = array(
|
||||
'label' => $row['description']."<br />",
|
||||
'label' => $row['description'] . "<br />",
|
||||
'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']."]<br />",
|
||||
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
|
||||
'value' => $row['id']
|
||||
);
|
||||
} else {
|
||||
$phpconfigs[] = array(
|
||||
'label' => $row['description']."<br />",
|
||||
'label' => $row['description'] . "<br />",
|
||||
'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'];
|
||||
|
@ -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'] . '<br />',
|
||||
'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'] . '<br />',
|
||||
'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("<br>", $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 {
|
||||
|
176
admin_index.php
176
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';
|
||||
}
|
||||
|
@ -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'])) {
|
||||
|
@ -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'
|
||||
|
@ -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']);
|
||||
|
@ -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;
|
||||
|
||||
|
144
admin_plans.php
144
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();
|
||||
}
|
||||
}
|
||||
|
@ -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(
|
||||
'#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
|
||||
ob_get_clean(), $matches, PREG_SET_ORDER
|
||||
)
|
||||
) {
|
||||
$phpinfo = array(
|
||||
'phpinfo' => array()
|
||||
);
|
||||
if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$end = array_keys($phpinfo);
|
||||
$end = end($end);
|
||||
if (strlen($match[1])) {
|
||||
$phpinfo[$match[1]] = array();
|
||||
} elseif (isset($match[3])) {
|
||||
$phpinfo[$end][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
|
||||
$phpinfo[$end][$match[2]] = isset($match[4]) ? array(
|
||||
$match[3],
|
||||
$match[4]
|
||||
) : $match[3];
|
||||
} else {
|
||||
$phpinfo[$end][] = $match[2];
|
||||
}
|
||||
@ -142,7 +130,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
}
|
||||
// first header -> show actual php version
|
||||
if (strtolower($name) == "phpinfo") {
|
||||
$name = "PHP ".PHP_VERSION;
|
||||
$name = "PHP " . PHP_VERSION;
|
||||
}
|
||||
eval("\$phpinfohtml .= \"" . getTemplate("settings/phpinfo/phpinfo_table") . "\";");
|
||||
}
|
||||
@ -151,13 +139,8 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
standard_error($lng['error']['no_phpinfo']);
|
||||
}
|
||||
eval("echo \"" . getTemplate("settings/phpinfo") . "\";");
|
||||
|
||||
} elseif($page == 'rebuildconfigs'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
|
||||
inserttask('1');
|
||||
@ -167,19 +150,17 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
// cron.d file
|
||||
inserttask('99');
|
||||
|
||||
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php'));
|
||||
|
||||
standard_success('rebuildingconfigs', '', array(
|
||||
'filename' => 'admin_index.php'
|
||||
));
|
||||
} else {
|
||||
ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page));
|
||||
ask_yesno('admin_configs_reallyrebuild', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
} elseif ($page == 'updatecounters' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
} elseif($page == 'updatecounters'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
|
||||
$updatecounters = updateCounters(true);
|
||||
@ -194,53 +175,45 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
|
||||
|
||||
} else {
|
||||
ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page));
|
||||
ask_yesno('admin_counters_reallyupdate', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
} elseif ($page == 'wipecleartextmailpws' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
} elseif ($page == 'wipecleartextmailpws'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
|
||||
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';");
|
||||
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'");
|
||||
redirectTo($filename, array('s' => $s));
|
||||
|
||||
redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page));
|
||||
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
} elseif ($page == 'wipequotas' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
} elseif($page == 'wipequotas'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
|
||||
|
||||
// Set the quota to 0 which means unlimited
|
||||
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
|
||||
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
|
||||
redirectTo($filename, array('s' => $s));
|
||||
|
||||
redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page));
|
||||
ask_yesno('admin_quotas_reallywipe', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
|
||||
} elseif ($page == 'enforcequotas'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
} elseif ($page == 'enforcequotas' && $userinfo['change_serversettings'] == '1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// Fetch all accounts
|
||||
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
|
||||
|
||||
@ -254,7 +227,10 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$difference = Settings::Get('system.mail_quota') - $array['quota'];
|
||||
Database::pexecute($upd_stmt, array('diff' => $difference, 'customerid' => $customerid));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'diff' => $difference,
|
||||
'customerid' => $customerid
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,27 +238,29 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota
|
||||
");
|
||||
Database::pexecute($upd_stmt, array('quota' => Settings::Get('system.mail_quota')));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'quota' => Settings::Get('system.mail_quota')
|
||||
));
|
||||
|
||||
// Update the Customer, if the used quota is bigger than the allowed quota
|
||||
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
|
||||
redirectTo($filename, array('s' => $s));
|
||||
|
||||
redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
|
||||
ask_yesno('admin_quotas_reallyenforce', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
} elseif ($page == 'integritycheck'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
} elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') {
|
||||
$integrity = new IntegrityCheck();
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$integrity->fixAll();
|
||||
} elseif(isset($_GET['action'])
|
||||
&& $_GET['action'] == "fix") {
|
||||
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page));
|
||||
} elseif (isset($_GET['action']) && $_GET['action'] == "fix") {
|
||||
ask_yesno('admin_integritycheck_reallyfix', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
|
||||
$integritycheck = '';
|
||||
@ -293,9 +271,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
|
||||
}
|
||||
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
|
||||
}
|
||||
elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
} elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') {
|
||||
// check for json-stuff
|
||||
if (! extension_loaded('json')) {
|
||||
standard_error('jsonextensionnotfound');
|
||||
@ -306,13 +282,13 @@ elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1')
|
||||
try {
|
||||
$json_result = Froxlor::getLocal($userinfo)->exportSettings();
|
||||
$json_export = json_decode($json_result, true)['data'];
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
}
|
||||
header('Content-disposition: attachment; filename=Froxlor_settings-'.$version.'-'.$dbversion.'_'.date('d.m.Y').'.json');
|
||||
header('Content-disposition: attachment; filename=Froxlor_settings-' . $version . '-' . $dbversion . '_' . date('d.m.Y') . '.json');
|
||||
header('Content-type: application/json');
|
||||
echo $json_export;
|
||||
exit;
|
||||
exit();
|
||||
} elseif (isset($_GET['action']) && $_GET['action'] == "import") {
|
||||
// import
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
@ -320,82 +296,86 @@ elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1')
|
||||
if (isset($_FILES["import_file"]["tmp_name"])) {
|
||||
$imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]);
|
||||
try {
|
||||
Froxlor::getLocal($userinfo, array('json_str' => $imp_content))->importSettings();
|
||||
} catch(Exception $e) {
|
||||
Froxlor::getLocal($userinfo, array(
|
||||
'json_str' => $imp_content
|
||||
))->importSettings();
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
}
|
||||
standard_success('settingsimported', '', array('filename' => 'admin_settings.php'));
|
||||
standard_success('settingsimported', '', array(
|
||||
'filename' => 'admin_settings.php'
|
||||
));
|
||||
}
|
||||
dynamic_error("Upload failed");
|
||||
}
|
||||
} else {
|
||||
eval("echo \"" . getTemplate("settings/importexport/index") . "\";");
|
||||
}
|
||||
}
|
||||
elseif ($page == 'testmail')
|
||||
{
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send')
|
||||
{
|
||||
$test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null;
|
||||
} elseif ($page == 'testmail') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null;
|
||||
|
||||
/**
|
||||
* Initialize the mailingsystem
|
||||
*/
|
||||
$testmail = new \PHPMailer\PHPMailer\PHPMailer(true);
|
||||
$testmail->CharSet = "UTF-8";
|
||||
/**
|
||||
* Initialize the mailingsystem
|
||||
*/
|
||||
$testmail = new \PHPMailer\PHPMailer\PHPMailer(true);
|
||||
$testmail->CharSet = "UTF-8";
|
||||
|
||||
if (Settings::Get('system.mail_use_smtp')) {
|
||||
$testmail->isSMTP();
|
||||
$testmail->Host = Settings::Get('system.mail_smtp_host');
|
||||
$testmail->SMTPAuth = Settings::Get('system.mail_smtp_auth') == '1' ? true : false;
|
||||
$testmail->Username = Settings::Get('system.mail_smtp_user');
|
||||
$testmail->Password = Settings::Get('system.mail_smtp_passwd');
|
||||
if (Settings::Get('system.mail_smtp_usetls')) {
|
||||
$testmail->SMTPSecure = 'tls';
|
||||
} else {
|
||||
$testmail->SMTPAutoTLS = false;
|
||||
}
|
||||
$testmail->Port = Settings::Get('system.mail_smtp_port');
|
||||
}
|
||||
|
||||
$_mailerror = false;
|
||||
if (\PHPMailer\PHPMailer\PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
|
||||
// set return-to address and custom sender-name, see #76
|
||||
$testmail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
||||
if (Settings::Get('panel.adminmail_return') != '') {
|
||||
$testmail->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
|
||||
}
|
||||
|
||||
try {
|
||||
$testmail->Subject = "Froxlor Test-Mail";
|
||||
$mail_body = "Yay, this worked :)";
|
||||
$testmail->AltBody = $mail_body;
|
||||
$testmail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$testmail->AddAddress($test_addr);
|
||||
$testmail->Send();
|
||||
} catch(\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
$_mailerror = true;
|
||||
} catch (Exception $e) {
|
||||
$mailerr_msg = $e->getMessage();
|
||||
$_mailerror = true;
|
||||
}
|
||||
|
||||
if (!$_mailerror) {
|
||||
// success
|
||||
$mail->ClearAddresses();
|
||||
standard_success('testmailsent', '', array('filename' => 'admin_settings.php', 'page' => 'testmail'));
|
||||
}
|
||||
if (Settings::Get('system.mail_use_smtp')) {
|
||||
$testmail->isSMTP();
|
||||
$testmail->Host = Settings::Get('system.mail_smtp_host');
|
||||
$testmail->SMTPAuth = Settings::Get('system.mail_smtp_auth') == '1' ? true : false;
|
||||
$testmail->Username = Settings::Get('system.mail_smtp_user');
|
||||
$testmail->Password = Settings::Get('system.mail_smtp_passwd');
|
||||
if (Settings::Get('system.mail_smtp_usetls')) {
|
||||
$testmail->SMTPSecure = 'tls';
|
||||
} else {
|
||||
// invalid sender e-mail
|
||||
$mailerr_msg = "Invalid sender e-mail address: ".Settings::Get('panel.adminmail');
|
||||
$_mailerror = true;
|
||||
$testmail->SMTPAutoTLS = false;
|
||||
}
|
||||
$testmail->Port = Settings::Get('system.mail_smtp_port');
|
||||
}
|
||||
|
||||
$mail_smtp_user = Settings::Get('system.mail_smtp_user');
|
||||
$mail_smtp_host = Settings::Get('system.mail_smtp_host');
|
||||
$mail_smtp_port = Settings::Get('system.mail_smtp_port');
|
||||
$_mailerror = false;
|
||||
if (\PHPMailer\PHPMailer\PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
|
||||
// set return-to address and custom sender-name, see #76
|
||||
$testmail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
||||
if (Settings::Get('panel.adminmail_return') != '') {
|
||||
$testmail->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("settings/testmail") . "\";");
|
||||
try {
|
||||
$testmail->Subject = "Froxlor Test-Mail";
|
||||
$mail_body = "Yay, this worked :)";
|
||||
$testmail->AltBody = $mail_body;
|
||||
$testmail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$testmail->AddAddress($test_addr);
|
||||
$testmail->Send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
$_mailerror = true;
|
||||
} catch (Exception $e) {
|
||||
$mailerr_msg = $e->getMessage();
|
||||
$_mailerror = true;
|
||||
}
|
||||
|
||||
if (! $_mailerror) {
|
||||
// success
|
||||
$mail->ClearAddresses();
|
||||
standard_success('testmailsent', '', array(
|
||||
'filename' => 'admin_settings.php',
|
||||
'page' => 'testmail'
|
||||
));
|
||||
}
|
||||
} else {
|
||||
// invalid sender e-mail
|
||||
$mailerr_msg = "Invalid sender e-mail address: " . Settings::Get('panel.adminmail');
|
||||
$_mailerror = true;
|
||||
}
|
||||
}
|
||||
|
||||
$mail_smtp_user = Settings::Get('system.mail_smtp_user');
|
||||
$mail_smtp_host = Settings::Get('system.mail_smtp_host');
|
||||
$mail_smtp_port = Settings::Get('system.mail_smtp_port');
|
||||
|
||||
eval("echo \"" . getTemplate("settings/testmail") . "\";");
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
define('AREA', 'customer');
|
||||
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\SubDomains as SubDomains;
|
||||
use Froxlor\Api\Commands\Certificates as Certificates;
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
define('AREA', 'customer');
|
||||
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\Emails as Emails;
|
||||
use Froxlor\Api\Commands\EmailAccounts as EmailAccounts;
|
||||
use Froxlor\Api\Commands\EmailForwarders as EmailForwarders;
|
||||
|
@ -19,8 +19,8 @@
|
||||
define('AREA', 'customer');
|
||||
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\DirOptions as DirOptions;
|
||||
use Froxlor\Api\Commands\DirProtections as DirProtections;
|
||||
use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
|
||||
@ -72,7 +72,7 @@ if ($page == 'overview') {
|
||||
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
}
|
||||
$row['path'] = makeCorrectDir($row['path']);
|
||||
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
|
||||
$count ++;
|
||||
@ -214,7 +214,7 @@ if ($page == 'overview') {
|
||||
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
}
|
||||
$row['path'] = makeCorrectDir($row['path']);
|
||||
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
|
||||
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
|
||||
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
|
||||
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
|
||||
@ -374,7 +374,7 @@ if ($page == 'overview') {
|
||||
$action = "abort";
|
||||
$row = $existing_backupJob['data'];
|
||||
|
||||
$row['path'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
|
||||
$row['path'] = \Froxlor\FileDir::makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
|
||||
$row['backup_web'] = ($row['backup_web'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
$row['backup_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
$row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
|
@ -20,8 +20,8 @@
|
||||
define('AREA', 'customer');
|
||||
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\Ftps as Ftps;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
|
@ -20,8 +20,8 @@
|
||||
define('AREA', 'customer');
|
||||
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 ($action == 'logout') {
|
||||
|
@ -19,8 +19,8 @@
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database as Database;
|
||||
use Froxlor\Settings as Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
|
||||
|
@ -20,8 +20,8 @@
|
||||
define('AREA', 'customer');
|
||||
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\Mysqls as Mysqls;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
|
@ -21,8 +21,8 @@ define('AREA', 'customer');
|
||||
$intrafficpage = 1;
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database as Database;
|
||||
use Froxlor\Settings as Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
|
||||
|
@ -19,7 +19,7 @@ if (! defined('AREA')) {
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\Database as Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Api\Commands\DomainZones as DomainZones;
|
||||
|
||||
// This file is being included in admin_domains and customer_domains
|
||||
|
@ -19,9 +19,9 @@
|
||||
define('AREA', 'login');
|
||||
require './lib/init.php';
|
||||
|
||||
use \Froxlor\Database;
|
||||
use \Froxlor\Settings;
|
||||
use \Froxlor\FroxlorLogger;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\FroxlorLogger;
|
||||
|
||||
if ($action == '') {
|
||||
$action = 'login';
|
||||
@ -475,7 +475,7 @@ if ($action == 'forgotpwd') {
|
||||
// there can be only one script to handle this so we can use a fixed value here
|
||||
$script = "/index.php"; // $_SERVER['SCRIPT_NAME'];
|
||||
if (Settings::Get('system.froxlordirectlyviahostname') == 0) {
|
||||
$script = makeCorrectFile("/" . basename(__DIR__) . "/" . $script);
|
||||
$script = \Froxlor\FileDir::makeCorrectFile("/" . basename(__DIR__) . "/" . $script);
|
||||
}
|
||||
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use \Froxlor\Database;
|
||||
use \Froxlor\Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
@ -11,11 +10,11 @@ use \Froxlor\Settings;
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Install
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Install
|
||||
*
|
||||
*/
|
||||
if (! defined('_CRON_UPDATE')) {
|
||||
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
|
||||
@ -134,12 +133,30 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
|
||||
showUpdateStep("Updating cronjob table");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_CRONRUNS . "` ADD `cronclass` varchar(500) NOT NULL AFTER `cronfile`");
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `cronclass` = :cc WHERE `cronfile` = :cf");
|
||||
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\TasksCron', 'cf' => 'tasks'));
|
||||
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\Traffic\\TrafficCron', 'cf' => 'traffic'));
|
||||
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\Traffic\\ReportsCron', 'cf' => 'usage_report'));
|
||||
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\System\\MailboxsizeCron', 'cf' => 'mailboxsize'));
|
||||
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\LetsEncrypt\\LetsEncrypt', 'cf' => 'letsencrypt'));
|
||||
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\System\\BackupCron', 'cf' => 'backup'));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cc' => '\\Froxlor\\Cron\\TasksCron',
|
||||
'cf' => 'tasks'
|
||||
));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cc' => '\\Froxlor\\Cron\\Traffic\\TrafficCron',
|
||||
'cf' => 'traffic'
|
||||
));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cc' => '\\Froxlor\\Cron\\Traffic\\ReportsCron',
|
||||
'cf' => 'usage_report'
|
||||
));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cc' => '\\Froxlor\\Cron\\System\\MailboxsizeCron',
|
||||
'cf' => 'mailboxsize'
|
||||
));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cc' => '\\Froxlor\\Cron\\LetsEncrypt\\LetsEncrypt',
|
||||
'cf' => 'letsencrypt'
|
||||
));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cc' => '\\Froxlor\\Cron\\System\\BackupCron',
|
||||
'cf' => 'backup'
|
||||
));
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `module` = 'froxlor/ticket'");
|
||||
lastStepStatus(0);
|
||||
|
||||
@ -150,7 +167,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `tickets`");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` DROP `tickets_used`");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'ticket'");
|
||||
|
||||
|
||||
define('TABLE_PANEL_TICKETS', 'panel_tickets');
|
||||
define('TABLE_PANEL_TICKET_CATS', 'panel_ticket_categories');
|
||||
Database::query("DROP TABLE IF EXISTS `" . TABLE_PANEL_TICKETS . "`;");
|
||||
@ -163,7 +180,9 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
|
||||
$dns_target = 'PowerDNS';
|
||||
}
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :v WHERE `settinggroup` = 'system' AND `varname` = 'dns_server'");
|
||||
Database::pexecute($upd_stmt, array('v' => $dns_target));
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'v' => $dns_target
|
||||
));
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201812190');
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use \Froxlor\Database;
|
||||
use \Froxlor\Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
@ -11,13 +10,13 @@ use \Froxlor\Settings;
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Install
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Install
|
||||
*
|
||||
*/
|
||||
if (!defined('_CRON_UPDATE')) {
|
||||
if (! defined('_CRON_UPDATE')) {
|
||||
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
|
||||
header('Location: ../../../../index.php');
|
||||
exit();
|
||||
@ -983,7 +982,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.12-svn1')) {
|
||||
showUpdateStep("Updating from 0.9.12-svn1 to 0.9.12-svn2", false);
|
||||
|
||||
$update_perl_suexecworkaround = isset($_POST['update_perl_suexecworkaround']) ? (int) $_POST['update_perl_suexecworkaround'] : '0';
|
||||
$update_perl_suexecpath = isset($_POST['update_perl_suexecpath']) ? makeCorrectDir($_POST['update_perl_suexecpath']) : '/var/www/cgi-bin/';
|
||||
$update_perl_suexecpath = isset($_POST['update_perl_suexecpath']) ? \Froxlor\FileDir::makeCorrectDir($_POST['update_perl_suexecpath']) : '/var/www/cgi-bin/';
|
||||
|
||||
if ($update_perl_suexecpath == '') {
|
||||
$update_perl_suexecpath = '/var/www/cgi-bin/';
|
||||
@ -1023,7 +1022,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.12-svn3')) {
|
||||
|
||||
showUpdateStep("Updating from 0.9.12-svn3 to 0.9.12-svn4", false);
|
||||
|
||||
$update_awstats_awstatspath = isset($_POST['update_awstats_awstatspath']) ? makeCorrectDir($_POST['update_awstats_awstatspath']) : Settings::Get('system.awstats_path');
|
||||
$update_awstats_awstatspath = isset($_POST['update_awstats_awstatspath']) ? \Froxlor\FileDir::makeCorrectDir($_POST['update_awstats_awstatspath']) : Settings::Get('system.awstats_path');
|
||||
|
||||
showUpdateStep("Adding new settings for awstats");
|
||||
$stmt = Database::prepare("
|
||||
@ -1150,7 +1149,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.13.1')) {
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.9.14-svn2')) {
|
||||
showUpdateStep("Updating from 0.9.14-svn2 to 0.9.14-svn3", false);
|
||||
|
||||
$update_awstats_icons = isset($_POST['update_awstats_icons']) ? makeCorrectDir($_POST['update_awstats_icons']) : Settings::Get('system.awstats_icons');
|
||||
$update_awstats_icons = isset($_POST['update_awstats_icons']) ? \Froxlor\FileDir::makeCorrectDir($_POST['update_awstats_icons']) : Settings::Get('system.awstats_icons');
|
||||
|
||||
showUpdateStep("Adding AWStats icons path to the settings");
|
||||
$stmt = Database::prepare("
|
||||
@ -1173,7 +1172,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.14-svn3')) {
|
||||
$update_ssl_cert_chainfile = isset($_POST['update_ssl_cert_chainfile']) ? $_POST['update_ssl_cert_chainfile'] : '';
|
||||
|
||||
if ($update_ssl_cert_chainfile != '') {
|
||||
$update_ssl_cert_chainfile = makeCorrectFile($update_ssl_cert_chainfile);
|
||||
$update_ssl_cert_chainfile = \Froxlor\FileDir::makeCorrectFile($update_ssl_cert_chainfile);
|
||||
}
|
||||
|
||||
showUpdateStep("Adding SSLCertificateChainFile to the settings");
|
||||
@ -1337,9 +1336,9 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.15')) {
|
||||
showUpdateStep("Updating from 0.9.15 to 0.9.16-svn1", false);
|
||||
|
||||
$update_phpfpm_enabled = isset($_POST['update_phpfpm_enabled']) ? (int) $_POST['update_phpfpm_enabled'] : '0';
|
||||
$update_phpfpm_configdir = isset($_POST['update_phpfpm_configdir']) ? makeCorrectDir($_POST['update_phpfpm_configdir']) : '/etc/php-fpm.d/';
|
||||
$update_phpfpm_tmpdir = isset($_POST['update_phpfpm_tmpdir']) ? makeCorrectDir($_POST['update_phpfpm_tmpdir']) : '/var/customers/tmp';
|
||||
$update_phpfpm_peardir = isset($_POST['update_phpfpm_peardir']) ? makeCorrectDir($_POST['update_phpfpm_peardir']) : '/usr/share/php/:/usr/share/php5/';
|
||||
$update_phpfpm_configdir = isset($_POST['update_phpfpm_configdir']) ? \Froxlor\FileDir::makeCorrectDir($_POST['update_phpfpm_configdir']) : '/etc/php-fpm.d/';
|
||||
$update_phpfpm_tmpdir = isset($_POST['update_phpfpm_tmpdir']) ? \Froxlor\FileDir::makeCorrectDir($_POST['update_phpfpm_tmpdir']) : '/var/customers/tmp';
|
||||
$update_phpfpm_peardir = isset($_POST['update_phpfpm_peardir']) ? \Froxlor\FileDir::makeCorrectDir($_POST['update_phpfpm_peardir']) : '/usr/share/php/:/usr/share/php5/';
|
||||
$update_phpfpm_reload = isset($_POST['update_phpfpm_reload']) ? $_POST['update_phpfpm_reload'] : '/etc/init.d/php-fpm restart';
|
||||
|
||||
$update_phpfpm_pm = isset($_POST['update_phpfpm_pm']) ? $_POST['update_phpfpm_pm'] : 'static';
|
||||
@ -2164,7 +2163,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.28-svn5')) {
|
||||
showUpdateStep("Inserting settings for nginx fastcgi-params file", true);
|
||||
$fastcgiparams = '/etc/nginx/fastcgi_params';
|
||||
if (isset($_POST['nginx_fastcgi_params']) && $_POST['nginx_fastcgi_params'] != '') {
|
||||
$fastcgiparams = makeCorrectFile($_POST['nginx_fastcgi_params']);
|
||||
$fastcgiparams = \Froxlor\FileDir::makeCorrectFile($_POST['nginx_fastcgi_params']);
|
||||
}
|
||||
$stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET
|
||||
@ -2244,7 +2243,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.28.1')) {
|
||||
$fastcgiparams = Settings::Get('nginx.fastcgiparams');
|
||||
// check the faulty value explicitly
|
||||
if ($fastcgiparams == '/etc/nginx/fastcgi_params/') {
|
||||
$fastcgiparams = makeCorrectFile(substr($fastcgiparams, 0, - 1));
|
||||
$fastcgiparams = \Froxlor\FileDir::makeCorrectFile(substr($fastcgiparams, 0, - 1));
|
||||
$stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET
|
||||
`value` = :value
|
||||
@ -2329,7 +2328,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.29-dev3')) {
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;");
|
||||
lastStepStatus(0);
|
||||
|
||||
$system_customersslpath = isset($_POST['system_customersslpath']) ? makeCorrectDir($_POST['system_customersslpath']) : '/etc/ssl/froxlor-custom/';
|
||||
$system_customersslpath = isset($_POST['system_customersslpath']) ? \Froxlor\FileDir::makeCorrectDir($_POST['system_customersslpath']) : '/etc/ssl/froxlor-custom/';
|
||||
if (trim($system_customersslpath) == '/') {
|
||||
// prevent users from specifying nonsense here
|
||||
$system_customersslpath = '/etc/ssl/froxlor-custom/';
|
||||
@ -2411,7 +2410,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.29')) {
|
||||
Database::query("INSERT INTO `" . TABLE_DOMAINTOIP . "` SET
|
||||
`id_domain` = " . (int) $row['id'] . ",
|
||||
`id_ipandports` = " . (int) $row['ssl_ipandport']);
|
||||
} // Subdomains also have ssl ports if the parent has
|
||||
} // Subdomains also have ssl ports if the parent has
|
||||
elseif ((int) $row['ssl_ipandport'] == 0 && (int) $row['ssl_redirect'] != 0 && (int) $row['parentdomainid'] != 0) {
|
||||
Database::query("INSERT INTO `" . TABLE_DOMAINTOIP . "` SET
|
||||
`id_domain` = " . (int) $row['id'] . ",
|
||||
@ -2808,7 +2807,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.32-dev4')) {
|
||||
showUpdateStep("Adding new settings for cron");
|
||||
// get user-chosen value
|
||||
$crondfile = isset($_POST['crondfile']) ? $_POST['crondfile'] : "/etc/cron.d/froxlor";
|
||||
$crondfile = makeCorrectFile($crondfile);
|
||||
$crondfile = \Froxlor\FileDir::makeCorrectFile($crondfile);
|
||||
Settings::AddNew("system.cronconfig", $crondfile);
|
||||
// add task to generate cron.d-file
|
||||
inserttask('99');
|
||||
@ -3312,9 +3311,10 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.35.1') && \Froxlor\Froxlor::isDataba
|
||||
`interval` = '1 DAY',
|
||||
`desc_lng_key` = 'cron_backup',
|
||||
`lastrun` = 0,
|
||||
`isactive` = :isactive"
|
||||
);
|
||||
Database::pexecute($stmt, array('isactive' => $enable_backup));
|
||||
`isactive` = :isactive");
|
||||
Database::pexecute($stmt, array(
|
||||
'isactive' => $enable_backup
|
||||
));
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201604270');
|
||||
@ -3355,7 +3355,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201605090')) {
|
||||
|
||||
showUpdateStep("Adjusting SPF record setting");
|
||||
$current_spf = Settings::Get('spf.spf_entry');
|
||||
// @ IN TXT "v=spf1 a mx -all"
|
||||
// @ IN TXT "v=spf1 a mx -all"
|
||||
$new_spf = substr($current_spf, strpos($current_spf, '"'));
|
||||
Settings::Set('spf.spf_entry', $new_spf, true);
|
||||
lastStepStatus(0);
|
||||
@ -3376,7 +3376,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201605120')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201605170')) {
|
||||
|
||||
showUpdateStep("Adding new dns-editor setting for customers");
|
||||
Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `dnsenabled` tinyint(1) NOT NULL default '0' AFTER `perlenabled`;");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `dnsenabled` tinyint(1) NOT NULL default '0' AFTER `perlenabled`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201605180');
|
||||
@ -3385,9 +3385,9 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201605170')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201605180')) {
|
||||
|
||||
showUpdateStep("Changing tables to be more mysql strict-mode compatible");
|
||||
Database::query("ALTER TABLE `".TABLE_FTP_USERS."` CHANGE `last_login` `last_login` DATETIME NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `".TABLE_PANEL_IPSANDPORTS."` CHANGE `specialsettings` `specialsettings` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `".TABLE_PANEL_TASKS."` CHANGE `data` `data` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `" . TABLE_FTP_USERS . "` CHANGE `last_login` `last_login` DATETIME NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` CHANGE `specialsettings` `specialsettings` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_TASKS . "` CHANGE `data` `data` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201606190');
|
||||
@ -3452,7 +3452,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201609050')) {
|
||||
$websrv_default = "/etc/nginx/acme.conf";
|
||||
}
|
||||
$acmeconffile = isset($_POST['acmeconffile']) ? $_POST['acmeconffile'] : $websrv_default;
|
||||
$acmeconffile = makeCorrectFile($acmeconffile);
|
||||
$acmeconffile = \Froxlor\FileDir::makeCorrectFile($acmeconffile);
|
||||
Settings::AddNew("system.letsencryptacmeconf", $acmeconffile);
|
||||
lastStepStatus(0);
|
||||
|
||||
@ -3465,7 +3465,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201609120')) {
|
||||
// get user-chosen value
|
||||
$smtp_enable = isset($_POST['smtp_enable']) ? (int) $_POST['smtp_enable'] : 0;
|
||||
$smtp_host = isset($_POST['smtp_host']) ? $_POST['smtp_host'] : "localhost";
|
||||
$smtp_port = isset($_POST['smtp_port']) ? (int)$_POST['smtp_port'] : 25;
|
||||
$smtp_port = isset($_POST['smtp_port']) ? (int) $_POST['smtp_port'] : 25;
|
||||
$smtp_usetls = isset($_POST['smtp_usetls']) ? (int) $_POST['smtp_usetls'] : 1;
|
||||
$smtp_useauth = isset($_POST['smtp_auth']) ? (int) $_POST['smtp_auth'] : 1;
|
||||
$smtp_user = isset($_POST['smtp_user']) ? $_POST['smtp_user'] : "";
|
||||
@ -3486,9 +3486,9 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201609120')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201609200')) {
|
||||
|
||||
showUpdateStep("Changing tables to be more mysql strict-mode compatible");
|
||||
Database::query("ALTER TABLE `".TABLE_MAIL_VIRTUAL."` CHANGE `destination` `destination` TEXT NOT NULL DEFAULT '';");
|
||||
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` CHANGE `registration_date` `registration_date` DATE NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `".TABLE_PANEL_DOMAINS."` CHANGE `termination_date` `termination_date` DATE NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `" . TABLE_MAIL_VIRTUAL . "` CHANGE `destination` `destination` TEXT NOT NULL DEFAULT '';");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` CHANGE `registration_date` `registration_date` DATE NULL DEFAULT NULL;");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` CHANGE `termination_date` `termination_date` DATE NULL DEFAULT NULL;");
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201609240');
|
||||
@ -3503,7 +3503,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201609240')) {
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Settings HSTS default values for all domains (deactivated)");
|
||||
Database::query("UPDATE `".TABLE_PANEL_DOMAINS."` SET `hsts_sub` = '0', `hsts_preload` = '0';");
|
||||
Database::query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `hsts_sub` = '0', `hsts_preload` = '0';");
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201610070');
|
||||
@ -3567,14 +3567,14 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201611180')) {
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding field for let's-encrypt registration status");
|
||||
Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` add `leregistered` TINYINT(1) NOT NULL DEFAULT 0;");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` add `leregistered` TINYINT(1) NOT NULL DEFAULT 0;");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding system setting for let's-encrypt registration status");
|
||||
Settings::AddNew('system.leregistered', '0');
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding unique key to ipsandports table");
|
||||
showUpdateStep("Adding unique key to ipsandports table");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_IPSANDPORTS . "` ADD UNIQUE KEY `ip_port` (`ip`,`port`)");
|
||||
lastStepStatus(0);
|
||||
|
||||
@ -3602,8 +3602,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.38.6')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201612110')) {
|
||||
|
||||
showUpdateStep("Adding field for OCSP stapling");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS .
|
||||
"` ADD `ocsp_stapling` TINYINT(1) NOT NULL DEFAULT '0';");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `ocsp_stapling` TINYINT(1) NOT NULL DEFAULT '0';");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Adding default setting for Apache 2.4 OCSP cache path");
|
||||
@ -3616,7 +3615,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201612110')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201704100')) {
|
||||
|
||||
showUpdateStep("Adding new setting for libnss-extrausers");
|
||||
$system_nssextrausers= isset($_POST['system_nssextrausers']) ? (int) $_POST['system_nssextrausers'] : 0;
|
||||
$system_nssextrausers = isset($_POST['system_nssextrausers']) ? (int) $_POST['system_nssextrausers'] : 0;
|
||||
Settings::AddNew('system.nssextrausers', $system_nssextrausers);
|
||||
lastStepStatus(0);
|
||||
|
||||
@ -3640,7 +3639,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201705050')) {
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201708240')) {
|
||||
|
||||
|
||||
showUpdateStep("Adding new 'disable LE self-check' setting");
|
||||
$system_disable_le_selfcheck = isset($_POST['system_disable_le_selfcheck']) ? (int) $_POST['system_disable_le_selfcheck'] : 0;
|
||||
Settings::AddNew('system.disable_le_selfcheck', $system_disable_le_selfcheck);
|
||||
@ -3708,15 +3707,15 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201712310')) {
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Deleting unneeded settings");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'reload'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'configdir'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'pm'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_children'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'start_servers'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'min_spare_servers'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_spare_servers'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_requests'");
|
||||
Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'idle_timeout'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'reload'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'configdir'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'pm'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_children'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'start_servers'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'min_spare_servers'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_spare_servers'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'max_requests'");
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'phpfpm' AND `varname` = 'idle_timeout'");
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201801070');
|
||||
@ -3874,7 +3873,7 @@ opcache.interned_strings_buffer');
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201801110')) {
|
||||
|
||||
showUpdateStep("Adding php-fpm php PATH setting for envrironment");
|
||||
Settings::AddNew("phpfpm.envpath", '/usr/local/bin:/usr/bin:/bin');
|
||||
Settings::AddNew("phpfpm.envpath", '/usr/local/bin:/usr/bin:/bin');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201801260');
|
||||
@ -3957,9 +3956,9 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201802130')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201802250')) {
|
||||
|
||||
showUpdateStep("Adding webserver logfile settings");
|
||||
Settings::AddNew("system.logfiles_format", '');
|
||||
Settings::AddNew("system.logfiles_type", '1');
|
||||
Settings::AddNew("system.logfiles_piped", '0');
|
||||
Settings::AddNew("system.logfiles_format", '');
|
||||
Settings::AddNew("system.logfiles_type", '1');
|
||||
Settings::AddNew("system.logfiles_piped", '0');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201805240');
|
||||
@ -3968,7 +3967,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201802250')) {
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201805240')) {
|
||||
|
||||
showUpdateStep("Adding webserver logfile-script settings");
|
||||
Settings::AddNew("system.logfiles_script", '');
|
||||
Settings::AddNew("system.logfiles_script", '');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201805241');
|
||||
@ -4018,7 +4017,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201805290')) {
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201809180')) {
|
||||
|
||||
|
||||
showUpdateStep("Adding new fields for php configs");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0';");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `pm` varchar(15) NOT NULL DEFAULT 'static';");
|
||||
@ -4030,7 +4029,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201809180')) {
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `idle_timeout` int(4) NOT NULL DEFAULT '30';");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_PHPCONFIGS . "` ADD `limit_extensions` varchar(255) NOT NULL default '.php';");
|
||||
lastStepStatus(0);
|
||||
|
||||
|
||||
showUpdateStep("Synchronize fpm-daemon process manager settings with php-configs");
|
||||
// get all fpm-daemons
|
||||
$sel_stmt = Database::prepare("SELECT * FROM `panel_fpmdaemons`;");
|
||||
@ -4062,7 +4061,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201809180')) {
|
||||
));
|
||||
}
|
||||
lastStepStatus(0);
|
||||
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('201809280');
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* @package Language
|
||||
*
|
||||
*/
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use PHPMailer\PHPMailer;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cli\Action;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\SImExporter;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Cli\ConfigServicesCmd;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cli\Action;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Cli\SwitchServerIpCmd;
|
||||
|
||||
class SwitchServerIpAction extends \Froxlor\Cli\Action
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
class CronConfig
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Dns;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use \Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use \Froxlor\Settings;
|
||||
use Froxlor\Cron\Http\Php\Fpm;
|
||||
use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use \Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use \Froxlor\Settings;
|
||||
use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Cron\Http\Php\Fpm;
|
||||
use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Cron\Http\Php\Fpm;
|
||||
use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Http;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\FroxlorLogger;
|
||||
use Froxlor\Database\Database;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\System;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\FroxlorLogger;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\System;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\System;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ namespace Froxlor\Cron\Traffic;
|
||||
* @package Cron
|
||||
*
|
||||
*/
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
||||
|
@ -17,7 +17,7 @@ namespace Froxlor\Cron\Traffic;
|
||||
* @package Cron
|
||||
*
|
||||
*/
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
|
@ -302,7 +302,7 @@ class Database
|
||||
);
|
||||
|
||||
if ($socket != null) {
|
||||
$dbconf["dsn"]['unix_socket'] = makeCorrectFile($socket);
|
||||
$dbconf["dsn"]['unix_socket'] = \Froxlor\FileDir::makeCorrectFile($socket);
|
||||
} else {
|
||||
$dbconf["dsn"]['host'] = $host;
|
||||
$dbconf["dsn"]['port'] = $port;
|
||||
@ -390,7 +390,7 @@ class Database
|
||||
* log to a file, so we can actually ask people for the error
|
||||
* (no one seems to find the stuff in the syslog)
|
||||
*/
|
||||
$sl_dir = makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
|
||||
$sl_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
|
||||
if (! file_exists($sl_dir)) {
|
||||
@mkdir($sl_dir, 0755);
|
||||
}
|
||||
@ -403,7 +403,7 @@ class Database
|
||||
* log error for reporting
|
||||
*/
|
||||
$errid = substr(md5(microtime()), 5, 5);
|
||||
$err_file = makeCorrectFile($sl_dir . "/" . $errid . "_sql-error.log");
|
||||
$err_file = \Froxlor\FileDir::makeCorrectFile($sl_dir . "/" . $errid . "_sql-error.log");
|
||||
$errlog = @fopen($err_file, 'w');
|
||||
@fwrite($errlog, "|CODE " . $error->getCode() . "\n");
|
||||
@fwrite($errlog, "|MSG " . $error_message . "\n");
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Database\Manager;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Dns;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
class Dns
|
||||
|
@ -18,7 +18,7 @@ namespace Froxlor\Http;
|
||||
* @since 0.9.33
|
||||
*
|
||||
*/
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\FileDir;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Http\LetsEncrypt;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
// Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Froxlor\Http\LetsEncrypt;
|
||||
|
||||
use Froxlor\Database;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
// Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz>
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
namespace Froxlor;
|
||||
|
||||
use Froxlor\Database as Database;
|
||||
use Froxlor\Database\Database;
|
||||
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
|
156
lib/init.php
156
lib/init.php
@ -16,28 +16,27 @@
|
||||
* @package System
|
||||
*
|
||||
*/
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use \Froxlor\Database;
|
||||
use \Froxlor\Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
|
||||
// prevent Froxlor pages from being cached
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time()));
|
||||
header('Expires: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time()));
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
||||
|
||||
// Prevent inline - JS to be executed (i.e. XSS) in browsers which support this,
|
||||
// Inline-JS is no longer allowed and used
|
||||
// See: http://people.mozilla.org/~bsterne/content-security-policy/index.html
|
||||
// New stuff see: https://www.owasp.org/index.php/List_of_useful_HTTP_headers and https://www.owasp.org/index.php/Content_Security_Policy
|
||||
$csp_content = "default-src 'self'; script-src 'self'; connect-src 'self'; img-src 'self' data:; style-src 'self';";
|
||||
header("Content-Security-Policy: ".$csp_content);
|
||||
header("X-Content-Security-Policy: ".$csp_content);
|
||||
header("X-WebKit-CSP: ".$csp_content);
|
||||
header("Content-Security-Policy: " . $csp_content);
|
||||
header("X-Content-Security-Policy: " . $csp_content);
|
||||
header("X-WebKit-CSP: " . $csp_content);
|
||||
|
||||
header("X-XSS-Protection: 1; mode=block");
|
||||
|
||||
@ -73,19 +72,19 @@ $filename = htmlentities(basename($_SERVER['PHP_SELF']));
|
||||
$_deftheme = 'Sparkle';
|
||||
|
||||
// check whether the userdata file exists
|
||||
if (!file_exists(\Froxlor\Froxlor::getInstallDir().'/lib/userdata.inc.php')) {
|
||||
$config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir().'/templates/'.$_deftheme.'/misc/configurehint.tpl');
|
||||
if (! file_exists(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php')) {
|
||||
$config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $_deftheme . '/misc/configurehint.tpl');
|
||||
$config_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $config_hint);
|
||||
die($config_hint);
|
||||
}
|
||||
|
||||
// check whether we can read the userdata file
|
||||
if (!is_readable(\Froxlor\Froxlor::getInstallDir().'/lib/userdata.inc.php')) {
|
||||
if (! is_readable(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php')) {
|
||||
// get possible owner
|
||||
$posixusername = posix_getpwuid(posix_getuid());
|
||||
$posixgroup = posix_getgrgid(posix_getgid());
|
||||
// get hint-template
|
||||
$owner_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir().'/templates/'.$_deftheme.'/misc/ownershiphint.tpl');
|
||||
$owner_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $_deftheme . '/misc/ownershiphint.tpl');
|
||||
// replace values
|
||||
$owner_hint = str_replace("<USER>", $posixusername['name'], $owner_hint);
|
||||
$owner_hint = str_replace("<GROUP>", $posixgroup['name'], $owner_hint);
|
||||
@ -96,14 +95,13 @@ if (!is_readable(\Froxlor\Froxlor::getInstallDir().'/lib/userdata.inc.php')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
|
||||
* Includes the Usersettings eg.
|
||||
* MySQL-Username/Passwort etc.
|
||||
*/
|
||||
require \Froxlor\Froxlor::getInstallDir().'/lib/userdata.inc.php';
|
||||
require \Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php';
|
||||
|
||||
if (!isset($sql)
|
||||
|| !is_array($sql)
|
||||
) {
|
||||
$config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir().'/templates/'.$_deftheme.'/misc/configurehint.tpl');
|
||||
if (! isset($sql) || ! is_array($sql)) {
|
||||
$config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $_deftheme . '/misc/configurehint.tpl');
|
||||
$config_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $config_hint);
|
||||
die($config_hint);
|
||||
}
|
||||
@ -111,13 +109,13 @@ if (!isset($sql)
|
||||
/**
|
||||
* Includes the Functions
|
||||
*/
|
||||
require \Froxlor\Froxlor::getInstallDir().'/lib/functions.php';
|
||||
require \Froxlor\Froxlor::getInstallDir() . '/lib/functions.php';
|
||||
@set_error_handler('phpErrHandler');
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Tabledefinitions etc.
|
||||
*/
|
||||
require \Froxlor\Froxlor::getInstallDir().'/lib/tables.inc.php';
|
||||
require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php';
|
||||
|
||||
/**
|
||||
* Create a new idna converter
|
||||
@ -132,7 +130,7 @@ if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
|
||||
if (empty($maxage)) {
|
||||
$maxage = 0;
|
||||
}
|
||||
$hsts_header = "Strict-Transport-Security: max-age=".$maxage;
|
||||
$hsts_header = "Strict-Transport-Security: max-age=" . $maxage;
|
||||
if (Settings::Get('system.hsts_incsub') == '1') {
|
||||
$hsts_header .= "; includeSubDomains";
|
||||
}
|
||||
@ -173,14 +171,13 @@ $timediff = time() - Settings::Get('session.sessiontimeout');
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `lastactivity` < :timediff
|
||||
");
|
||||
Database::pexecute($del_stmt, array('timediff' => $timediff));
|
||||
Database::pexecute($del_stmt, array(
|
||||
'timediff' => $timediff
|
||||
));
|
||||
|
||||
$userinfo = array();
|
||||
|
||||
if (isset($s)
|
||||
&& $s != ""
|
||||
&& $nosession != 1
|
||||
) {
|
||||
if (isset($s) && $s != "" && $nosession != 1) {
|
||||
ini_set("session.name", "s");
|
||||
ini_set("url_rewriter.tags", "");
|
||||
ini_set("session.use_cookies", false);
|
||||
@ -189,14 +186,14 @@ if (isset($s)
|
||||
$query = "SELECT `s`.*, `u`.* FROM `" . TABLE_PANEL_SESSIONS . "` `s` LEFT JOIN `";
|
||||
|
||||
if (AREA == 'admin') {
|
||||
$query.= TABLE_PANEL_ADMINS . "` `u` ON (`s`.`userid` = `u`.`adminid`)";
|
||||
$query .= TABLE_PANEL_ADMINS . "` `u` ON (`s`.`userid` = `u`.`adminid`)";
|
||||
$adminsession = '1';
|
||||
} else {
|
||||
$query.= TABLE_PANEL_CUSTOMERS . "` `u` ON (`s`.`userid` = `u`.`customerid`)";
|
||||
$query .= TABLE_PANEL_CUSTOMERS . "` `u` ON (`s`.`userid` = `u`.`customerid`)";
|
||||
$adminsession = '0';
|
||||
}
|
||||
|
||||
$query.= " WHERE `s`.`hash` = :hash AND `s`.`ipaddress` = :ipaddr
|
||||
$query .= " WHERE `s`.`hash` = :hash AND `s`.`ipaddress` = :ipaddr
|
||||
AND `s`.`useragent` = :ua AND `s`.`lastactivity` > :timediff
|
||||
AND `s`.`adminsession` = :adminsession
|
||||
";
|
||||
@ -211,10 +208,7 @@ if (isset($s)
|
||||
$userinfo_stmt = Database::prepare($query);
|
||||
$userinfo = Database::pexecute_first($userinfo_stmt, $userinfo_data);
|
||||
|
||||
if ((($userinfo['adminsession'] == '1' && AREA == 'admin' && isset($userinfo['adminid']))
|
||||
|| ($userinfo['adminsession'] == '0' && (AREA == 'customer' || AREA == 'login') && isset($userinfo['customerid'])))
|
||||
&& (!isset($userinfo['deactivated']) || $userinfo['deactivated'] != '1')
|
||||
) {
|
||||
if ((($userinfo['adminsession'] == '1' && AREA == 'admin' && isset($userinfo['adminid'])) || ($userinfo['adminsession'] == '0' && (AREA == 'customer' || AREA == 'login') && isset($userinfo['customerid']))) && (! isset($userinfo['deactivated']) || $userinfo['deactivated'] != '1')) {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_SESSIONS . "` SET
|
||||
`lastactivity` = :lastactive
|
||||
@ -269,29 +263,26 @@ if (isset($userinfo['language']) && isset($languages[$userinfo['language']])) {
|
||||
// default: use language from session, #277
|
||||
$language = $userinfo['language'];
|
||||
} else {
|
||||
if (!isset($userinfo['def_language'])
|
||||
|| !isset($languages[$userinfo['def_language']]) // this will always evaluat true, since it is the above statement inverted. @todo remove
|
||||
) {
|
||||
if (isset($_GET['language'])
|
||||
&& isset($languages[$_GET['language']])
|
||||
) {
|
||||
if (! isset($userinfo['def_language']) || ! isset($languages[$userinfo['def_language']])) // this will always evaluat true, since it is the above statement inverted. @todo remove
|
||||
{
|
||||
if (isset($_GET['language']) && isset($languages[$_GET['language']])) {
|
||||
$language = $_GET['language'];
|
||||
} else {
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
$accept_langs = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
for($i = 0; $i<count($accept_langs); $i++) {
|
||||
// this only works for most common languages. some (uncommon) languages have a 3 letter iso-code.
|
||||
// to be able to use these also, we would have to depend on the intl extension for php (using Locale::lookup or similar)
|
||||
// as long as froxlor does not support any of these languages, we can leave it like that.
|
||||
if (isset($iso[substr($accept_langs[$i],0,2)])) {
|
||||
$language=$iso[substr($accept_langs[$i],0,2)];
|
||||
$accept_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
for ($i = 0; $i < count($accept_langs); $i ++) {
|
||||
// this only works for most common languages. some (uncommon) languages have a 3 letter iso-code.
|
||||
// to be able to use these also, we would have to depend on the intl extension for php (using Locale::lookup or similar)
|
||||
// as long as froxlor does not support any of these languages, we can leave it like that.
|
||||
if (isset($iso[substr($accept_langs[$i], 0, 2)])) {
|
||||
$language = $iso[substr($accept_langs[$i], 0, 2)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($iso);
|
||||
|
||||
// if HTTP_ACCEPT_LANGUAGES has no valid langs, use default (very unlikely)
|
||||
if (!strlen($language)>0) {
|
||||
if (! strlen($language) > 0) {
|
||||
$language = Settings::Get('panel.standardlanguage');
|
||||
}
|
||||
}
|
||||
@ -339,25 +330,24 @@ if (preg_match("/([a-z0-9\.\-]+)_([a-z0-9\.\-]+)/i", $theme, $matches)) {
|
||||
}
|
||||
|
||||
// check for existence of the theme
|
||||
if (!file_exists('templates/'.$theme.'/config.json')) {
|
||||
if (! file_exists('templates/' . $theme . '/config.json')) {
|
||||
// Fallback
|
||||
$theme = $_deftheme;
|
||||
}
|
||||
|
||||
$_themeoptions = json_decode(file_get_contents('templates/'.$theme.'/config.json'), true);
|
||||
$_themeoptions = json_decode(file_get_contents('templates/' . $theme . '/config.json'), true);
|
||||
|
||||
// check for existence of variant in theme
|
||||
if (!array_key_exists('variants', $_themeoptions) || !array_key_exists($themevariant, $_themeoptions['variants']))
|
||||
{
|
||||
if (! array_key_exists('variants', $_themeoptions) || ! array_key_exists($themevariant, $_themeoptions['variants'])) {
|
||||
$themevariant = "default";
|
||||
}
|
||||
|
||||
// check for custom header-graphic
|
||||
$hl_path = 'templates/'.$theme.'/assets/img';
|
||||
$header_logo = $hl_path.'/logo.png';
|
||||
$hl_path = 'templates/' . $theme . '/assets/img';
|
||||
$header_logo = $hl_path . '/logo.png';
|
||||
|
||||
if (file_exists($hl_path.'/logo_custom.png')) {
|
||||
$header_logo = $hl_path.'/logo_custom.png';
|
||||
if (file_exists($hl_path . '/logo_custom.png')) {
|
||||
$header_logo = $hl_path . '/logo_custom.png';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -370,7 +360,7 @@ if ($nosession == 1 && AREA != 'login') {
|
||||
"qrystr" => $_SERVER["QUERY_STRING"]
|
||||
);
|
||||
redirectTo('index.php', $params);
|
||||
exit;
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -381,11 +371,9 @@ $templatecache = array();
|
||||
/**
|
||||
* Logic moved out of lng-file
|
||||
*/
|
||||
if (isset($userinfo['loginname'])
|
||||
&& $userinfo['loginname'] != ''
|
||||
) {
|
||||
$lng['menue']['main']['username'].= $userinfo['loginname'];
|
||||
//Initialize logging
|
||||
if (isset($userinfo['loginname']) && $userinfo['loginname'] != '') {
|
||||
$lng['menue']['main']['username'] .= $userinfo['loginname'];
|
||||
// Initialize logging
|
||||
$log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo);
|
||||
}
|
||||
|
||||
@ -400,33 +388,33 @@ if (AREA == 'admin' || AREA == 'customer') {
|
||||
* but not yet configured by the admin
|
||||
* we only show logout and the update-page
|
||||
*/
|
||||
$navigation_data = array (
|
||||
'admin' => array (
|
||||
'index' => array (
|
||||
$navigation_data = array(
|
||||
'admin' => array(
|
||||
'index' => array(
|
||||
'url' => 'admin_index.php',
|
||||
'label' => $lng['admin']['overview'],
|
||||
'elements' => array (
|
||||
array (
|
||||
'label' => $lng['menue']['main']['username'],
|
||||
'elements' => array(
|
||||
array(
|
||||
'label' => $lng['menue']['main']['username']
|
||||
),
|
||||
array (
|
||||
array(
|
||||
'url' => 'admin_index.php?action=logout',
|
||||
'label' => $lng['login']['logout'],
|
||||
),
|
||||
),
|
||||
'label' => $lng['login']['logout']
|
||||
)
|
||||
)
|
||||
),
|
||||
'server' => array (
|
||||
'server' => array(
|
||||
'label' => $lng['admin']['server'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
'elements' => array (
|
||||
array (
|
||||
'elements' => array(
|
||||
array(
|
||||
'url' => 'admin_updates.php?page=overview',
|
||||
'label' => $lng['update']['update'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'required_resources' => 'change_serversettings'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$navigation = buildNavigation($navigation_data['admin'], $userinfo);
|
||||
} else {
|
||||
@ -439,7 +427,7 @@ if (AREA == 'admin' || AREA == 'customer') {
|
||||
$js = "";
|
||||
if (array_key_exists('js', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['js'])) {
|
||||
foreach ($_themeoptions['variants'][$themevariant]['js'] as $jsfile) {
|
||||
if (file_exists('templates/'.$theme.'/assets/js/'.$jsfile)) {
|
||||
if (file_exists('templates/' . $theme . '/assets/js/' . $jsfile)) {
|
||||
$js .= '<script type="text/javascript" src="templates/' . $theme . '/assets/js/' . $jsfile . '"></script>' . "\n";
|
||||
}
|
||||
}
|
||||
@ -448,7 +436,7 @@ if (array_key_exists('js', $_themeoptions['variants'][$themevariant]) && is_arra
|
||||
$css = "";
|
||||
if (array_key_exists('css', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['css'])) {
|
||||
foreach ($_themeoptions['variants'][$themevariant]['css'] as $cssfile) {
|
||||
if (file_exists('templates/'.$theme.'/assets/css/'.$cssfile)) {
|
||||
if (file_exists('templates/' . $theme . '/assets/css/' . $cssfile)) {
|
||||
$css .= '<link href="templates/' . $theme . '/assets/css/' . $cssfile . '" rel="stylesheet" type="text/css" />' . "\n";
|
||||
}
|
||||
}
|
||||
@ -463,7 +451,7 @@ unset($css);
|
||||
|
||||
if (isset($_POST['action'])) {
|
||||
$action = $_POST['action'];
|
||||
} elseif(isset($_GET['action'])) {
|
||||
} elseif (isset($_GET['action'])) {
|
||||
$action = $_GET['action'];
|
||||
} else {
|
||||
$action = '';
|
||||
@ -475,7 +463,7 @@ if (isset($_POST['action'])) {
|
||||
|
||||
if (isset($_POST['page'])) {
|
||||
$page = $_POST['page'];
|
||||
} elseif(isset($_GET['page'])) {
|
||||
} elseif (isset($_GET['page'])) {
|
||||
$page = $_GET['page'];
|
||||
} else {
|
||||
$page = '';
|
||||
|
@ -19,7 +19,7 @@ if (! defined('AREA')) {
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\Settings as Settings;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\SubDomains as SubDomains;
|
||||
|
||||
// This file is being included in admin_domains and customer_domains
|
||||
|
@ -19,8 +19,8 @@ if (! defined('AREA')) {
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\Database as Database;
|
||||
use Froxlor\Settings as Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Certificates as Certificates;
|
||||
|
||||
// This file is being included in admin_domains and customer_domains
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
if (file_exists('/etc/froxlor-test.pwd') && file_exists('/etc/froxlor-test.rpwd')) {
|
||||
// froxlor jenkins test-system
|
||||
$pwd = trim(file_get_contents('/etc/froxlor-test.pwd'));
|
||||
@ -33,8 +32,8 @@ file_put_contents($userdata, $userdata_content);
|
||||
// include autoloader / api / etc
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
use \Froxlor\Database;
|
||||
use \Froxlor\Settings;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
Database::needRoot(true);
|
||||
Database::query("DROP DATABASE IF EXISTS `test1sql1`;");
|
||||
@ -71,7 +70,7 @@ Database::query("ALTER TABLE `" . TABLE_PANEL_FPMDAEMONS . "` AUTO_INCREMENT=2;"
|
||||
// add superadmin
|
||||
Database::query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET
|
||||
`loginname` = 'admin',
|
||||
`password` = '".makeCryptPassword('admin')."',
|
||||
`password` = '" . makeCryptPassword('admin') . "',
|
||||
`name` = 'Froxlor-Administrator',
|
||||
`email` = 'admin@dev.froxlor.org',
|
||||
`def_language` = 'English',
|
||||
|
Loading…
Reference in New Issue
Block a user