correct use of Database use

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-19 16:57:03 +01:00
parent 2c893fef25
commit 8e84a4ff44
55 changed files with 795 additions and 816 deletions

View File

@@ -16,12 +16,11 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Admins as Admins; use Froxlor\Api\Commands\Admins as Admins;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
@@ -30,9 +29,7 @@ if (isset($_POST['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'admins' if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
&& $userinfo['change_serversettings'] == '1'
) {
if ($action == '') { if ($action == '') {
@@ -108,7 +105,6 @@ if ($page == 'admins'
$admincount = $numrows_admins; $admincount = $numrows_admins;
eval("echo \"" . getTemplate("admins/admins") . "\";"); eval("echo \"" . getTemplate("admins/admins") . "\";");
} elseif ($action == 'su') { } elseif ($action == 'su') {
try { try {
@@ -121,13 +117,13 @@ if ($page == 'admins'
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$destination_admin = $result['loginname']; $destination_admin = $result['loginname'];
if ($destination_admin != '' if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) {
&& $result['adminid'] != $userinfo['userid']
) {
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = :userid 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)); $s = md5(uniqid(microtime(), 1));
$ins_stmt = Database::prepare(" $ins_stmt = Database::prepare("
@@ -146,15 +142,15 @@ if ($page == 'admins'
); );
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'"); $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 { } else {
redirectTo('index.php', array('action' => 'login')); redirectTo('index.php', array(
'action' => 'login'
));
} }
} elseif ($action == 'delete' && $id != 0) {
} elseif ($action == 'delete'
&& $id != 0
) {
try { try {
$json_result = Admins::getLocal($userinfo, array( $json_result = Admins::getLocal($userinfo, array(
'id' => $id 'id' => $id
@@ -169,29 +165,34 @@ if ($page == 'admins'
standard_error('youcantdeleteyourself'); standard_error('youcantdeleteyourself');
} }
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
Admins::getLocal($this->getUserData(), array( Admins::getLocal($this->getUserData(), array(
'id' => $id 'id' => $id
))->delete(); ))->delete();
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
try { try {
Admins::getLocal($userinfo, $_POST)->add(); Admins::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
$language_options = ''; $language_options = '';
@@ -229,10 +230,7 @@ if ($page == 'admins'
eval("echo \"" . getTemplate("admins/admins_add") . "\";"); eval("echo \"" . getTemplate("admins/admins_add") . "\";");
} }
} elseif ($action == 'edit' && $id != 0) {
} elseif($action == 'edit'
&& $id != 0
) {
try { try {
$json_result = Admins::getLocal($userinfo, array( $json_result = Admins::getLocal($userinfo, array(
'id' => $id 'id' => $id
@@ -244,15 +242,16 @@ if ($page == 'admins'
if ($result['loginname'] != '') { if ($result['loginname'] != '') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
try { try {
Admins::getLocal($userinfo, $_POST)->update(); Admins::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
$dec_places = Settings::Get('panel.decimal_places'); $dec_places = Settings::Get('panel.decimal_places');

View File

@@ -18,7 +18,7 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Settings as Settings; use Froxlor\Settings;
if ($userinfo['change_serversettings'] == '1') { if ($userinfo['change_serversettings'] == '1') {

View File

@@ -14,11 +14,10 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Api\Commands\Cronjobs as Cronjobs; use Froxlor\Api\Commands\Cronjobs as Cronjobs;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
@@ -74,7 +73,6 @@ if ($page == 'cronjobs' || $page == 'overview') {
} }
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";"); eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";");
} elseif ($action == 'new') { } elseif ($action == 'new') {
/* /*
* @TODO later * @TODO later
@@ -95,7 +93,10 @@ if ($page == 'cronjobs' || $page == 'overview') {
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
// interval // interval
@@ -124,8 +125,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";"); eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";");
} }
} }
} } elseif ($action == 'delete' && $id != 0) {
elseif ($action == 'delete' && $id != 0) {
/* /*
* @TODO later * @TODO later
*/ */

View File

@@ -16,12 +16,11 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Customers as Customers; use Froxlor\Api\Commands\Customers as Customers;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
@@ -30,9 +29,7 @@ if (isset($_POST['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'customers' if ($page == 'customers' && $userinfo['customers'] != '0') {
&& $userinfo['customers'] != '0'
) {
if ($action == '') { if ($action == '') {
// clear request data // clear request data
unset($_SESSION['requestData']); unset($_SESSION['requestData']);
@@ -56,14 +53,11 @@ if ($page == 'customers'
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `c`.*, `a`.`loginname` AS `adminname` SELECT `c`.*, `a`.`loginname` AS `adminname`
FROM `" . TABLE_PANEL_CUSTOMERS . "` `c`, `" . TABLE_PANEL_ADMINS . "` `a` FROM `" . TABLE_PANEL_CUSTOMERS . "` `c`, `" . TABLE_PANEL_ADMINS . "` `a`
WHERE " . WHERE " . ($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = :adminid AND ") . "
($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = :adminid AND ") . " `c`.`adminid` = `a`.`adminid` " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
`c`.`adminid` = `a`.`adminid` " . Database::pexecute($result_stmt, array(
$paging->getSqlWhere(true) . " " . 'adminid' => $userinfo['adminid']
$paging->getSqlOrderBy() . " " . ));
$paging->getSqlLimit()
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
$num_rows = Database::num_rows(); $num_rows = Database::num_rows();
$paging->setEntries($num_rows); $paging->setEntries($num_rows);
$sortcode = $paging->getHtmlSortCode($lng, true); $sortcode = $paging->getHtmlSortCode($lng, true);
@@ -82,16 +76,20 @@ if ($page == 'customers'
FROM `" . TABLE_PANEL_DOMAINS . "` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :cid WHERE `customerid` = :cid
AND `parentdomainid` = '0' AND `parentdomainid` = '0'
AND `id`<> :stdd" AND `id`<> :stdd");
); Database::pexecute($domains_stmt, array(
Database::pexecute($domains_stmt, array('cid' => $row['customerid'], 'stdd' => $row['standardsubdomain'])); 'cid' => $row['customerid'],
'stdd' => $row['standardsubdomain']
));
$domains = $domains_stmt->fetch(PDO::FETCH_ASSOC); $domains = $domains_stmt->fetch(PDO::FETCH_ASSOC);
$row['domains'] = intval($domains['domains']); $row['domains'] = intval($domains['domains']);
$dec_places = Settings::Get('panel.decimal_places'); $dec_places = Settings::Get('panel.decimal_places');
// get disk-space usages for web, mysql and mail // 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_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 = Database::pexecute_first($usages_stmt, array(
'cid' => $row['customerid']
));
$row['webspace_used'] = round($usages['webspace'] / 1024, $dec_places); $row['webspace_used'] = round($usages['webspace'] / 1024, $dec_places);
$row['mailspace_used'] = round($usages['mail'] / 1024, $dec_places); $row['mailspace_used'] = round($usages['mail'] / 1024, $dec_places);
@@ -124,9 +122,7 @@ if ($page == 'customers'
} }
$islocked = 0; $islocked = 0;
if ($row['loginfail_count'] >= Settings::Get('login.maxloginattempts') if ($row['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $row['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) {
&& $row['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))
) {
$islocked = 1; $islocked = 1;
} }
@@ -152,10 +148,7 @@ if ($page == 'customers'
$customercount = $num_rows; $customercount = $num_rows;
eval("echo \"" . getTemplate("customers/customers") . "\";"); eval("echo \"" . getTemplate("customers/customers") . "\";");
} elseif ($action == 'su' && $id != 0) {
} elseif($action == 'su'
&& $id != 0
) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, array(
'id' => $id 'id' => $id
@@ -175,9 +168,11 @@ if ($page == 'customers'
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` SELECT * FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :id WHERE `userid` = :id
AND `hash` = :hash" AND `hash` = :hash");
); $result = Database::pexecute_first($result_stmt, array(
$result = Database::pexecute_first($result_stmt, array('id' => $userinfo['userid'], 'hash' => $s)); 'id' => $userinfo['userid'],
'hash' => $s
));
$s = md5(uniqid(microtime(), 1)); $s = md5(uniqid(microtime(), 1));
$insert = Database::prepare(" $insert = Database::prepare("
@@ -188,8 +183,7 @@ if ($page == 'customers'
`useragent` = :ua, `useragent` = :ua,
`lastactivity` = :lastact, `lastactivity` = :lastact,
`language` = :lang, `language` = :lang,
`adminsession` = '0'" `adminsession` = '0'");
);
Database::pexecute($insert, array( Database::pexecute($insert, array(
'hash' => $s, 'hash' => $s,
'id' => $id, 'id' => $id,
@@ -205,15 +199,15 @@ if ($page == 'customers'
if (! file_exists(FROXLOR_INSTALL_DIR . "/" . $redirect)) { if (! file_exists(FROXLOR_INSTALL_DIR . "/" . $redirect)) {
$redirect = "customer_index.php"; $redirect = "customer_index.php";
} }
redirectTo($redirect, array('s' => $s), true); redirectTo($redirect, array(
's' => $s
), true);
} else { } else {
redirectTo('index.php', array('action' => 'login')); redirectTo('index.php', array(
'action' => 'login'
));
} }
} elseif ($action == 'unlock' && $id != 0) {
} elseif($action == 'unlock'
&& $id != 0
) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, array(
'id' => $id 'id' => $id
@@ -223,9 +217,7 @@ if ($page == 'customers'
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, array(
'id' => $id 'id' => $id
@@ -233,14 +225,18 @@ if ($page == 'customers'
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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 { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, array(
'id' => $id 'id' => $id
@@ -250,9 +246,7 @@ if ($page == 'customers'
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, array(
'id' => $id, 'id' => $id,
@@ -261,23 +255,29 @@ if ($page == 'customers'
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
try { try {
Customers::getLocal($userinfo, $_POST)->add(); Customers::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
$language_options = ''; $language_options = '';
@@ -342,10 +342,7 @@ if ($page == 'customers'
eval("echo \"" . getTemplate("customers/customers_add") . "\";"); eval("echo \"" . getTemplate("customers/customers_add") . "\";");
} }
} elseif ($action == 'edit' && $id != 0) {
} elseif($action == 'edit'
&& $id != 0
) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, array(
@@ -361,8 +358,7 @@ if ($page == 'customers'
*/ */
$available_admins_stmt = Database::prepare(" $available_admins_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "` SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
WHERE (`customers` = '-1' OR `customers` > `customers_used`)" WHERE (`customers` = '-1' OR `customers` > `customers_used`)");
);
Database::pexecute($available_admins_stmt); Database::pexecute($available_admins_stmt);
$admin_select = makeoption("-----", 0, true, true, true); $admin_select = makeoption("-----", 0, true, true, true);
$admin_select_cnt = 0; $admin_select_cnt = 0;
@@ -376,9 +372,7 @@ if ($page == 'customers'
if ($result['loginname'] != '') { if ($result['loginname'] != '') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
try { try {
Customers::getLocal($userinfo, $_POST)->update(); Customers::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {

View File

@@ -19,8 +19,8 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Domains as Domains; use Froxlor\Api\Commands\Domains as Domains;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
@@ -704,11 +704,9 @@ if ($page == 'domains' || $page == 'overview') {
} elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') { } elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') {
require_once __DIR__ . '/dns_editor.php'; require_once __DIR__ . '/dns_editor.php';
} elseif ($page == 'sslcertificates') { } elseif ($page == 'sslcertificates') {
require_once __DIR__ . '/ssl_certificates.php'; require_once __DIR__ . '/ssl_certificates.php';
} elseif ($page == 'logfiles') { } elseif ($page == 'logfiles') {
require_once __DIR__ . '/logfiles_viewer.php'; require_once __DIR__ . '/logfiles_viewer.php';

View File

@@ -16,12 +16,11 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Froxlor as Froxlor; use Froxlor\Api\Commands\Froxlor as Froxlor;
use Froxlor\Api\Commands\Admins as Admins; use Froxlor\Api\Commands\Admins as Admins;
@@ -29,20 +28,20 @@ if ($action == 'logout') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out"); $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') { if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid WHERE `userid` = :adminid
AND `adminsession` = '1' AND `adminsession` = '1'
AND `hash` = :hash" AND `hash` = :hash");
);
$params['hash'] = $s; $params['hash'] = $s;
} else { } else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid WHERE `userid` = :adminid
AND `adminsession` = '1'" AND `adminsession` = '1'");
);
} }
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
@@ -70,7 +69,9 @@ if ($page == 'overview') {
SUM(`subdomains_used`) AS `subdomains_used`, SUM(`subdomains_used`) AS `subdomains_used`,
SUM(`traffic_used`) AS `traffic_used` SUM(`traffic_used`) AS `traffic_used`
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid ")); 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'); $dec_places = Settings::Get('panel.decimal_places');
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places); $overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
@@ -78,9 +79,10 @@ if ($page == 'overview') {
$number_domains_stmt = Database::prepare(" $number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid") WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
); $number_domains = Database::pexecute_first($number_domains_stmt, array(
$number_domains = Database::pexecute_first($number_domains_stmt, array('adminid' => $userinfo['adminid'])); 'adminid' => $userinfo['adminid']
));
$overview['number_domains'] = $number_domains['number_domains']; $overview['number_domains'] = $number_domains['number_domains'];
@@ -88,9 +90,7 @@ if ($page == 'overview') {
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION); $mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION);
$webserverinterface = strtoupper(@php_sapi_name()); $webserverinterface = strtoupper(@php_sapi_name());
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
|| (isset($lookfornewversion) && $lookfornewversion == 'yes')
) {
try { try {
$json_result = Froxlor::getLocal($userinfo)->checkUpdate(); $json_result = Froxlor::getLocal($userinfo)->checkUpdate();
} catch (Exception $e) { } catch (Exception $e) {
@@ -156,10 +156,7 @@ if ($page == 'overview') {
// First: With exec (let's hope it's enabled for the Froxlor - vHost) // First: With exec (let's hope it's enabled for the Froxlor - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime")); $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
if (is_array($uptime_array) if (is_array($uptime_array) && isset($uptime_array[0]) && is_numeric($uptime_array[0])) {
&& isset($uptime_array[0])
&& is_numeric($uptime_array[0])
) {
// Some calculatioon to get a nicly formatted display // Some calculatioon to get a nicly formatted display
$seconds = round($uptime_array[0], 0); $seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60; $minutes = $seconds / 60;
@@ -178,12 +175,9 @@ if ($page == 'overview') {
} }
eval("echo \"" . getTemplate("index/index") . "\";"); eval("echo \"" . getTemplate("index/index") . "\";");
} elseif ($page == 'change_password') { } elseif ($page == 'change_password') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$old_password = validate($_POST['old_password'], 'old password'); $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')) {
@@ -194,36 +188,50 @@ if ($page == 'overview') {
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') { if ($old_password == '') {
standard_error(array('stringisempty', 'oldpassword')); standard_error(array(
'stringisempty',
'oldpassword'
));
} elseif ($new_password == '') { } elseif ($new_password == '') {
standard_error(array('stringisempty', 'newpassword')); standard_error(array(
'stringisempty',
'newpassword'
));
} elseif ($new_password_confirm == '') { } elseif ($new_password_confirm == '') {
standard_error(array('stringisempty', 'newpasswordconfirm')); standard_error(array(
'stringisempty',
'newpasswordconfirm'
));
} elseif ($new_password != $new_password_confirm) { } elseif ($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror'); standard_error('newpasswordconfirmerror');
} else { } else {
try { 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) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array(
's' => $s
));
} }
} else { } else {
eval("echo \"" . getTemplate("index/change_password") . "\";"); eval("echo \"" . getTemplate("index/change_password") . "\";");
} }
} elseif ($page == 'change_language') { } elseif ($page == 'change_language') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if (isset($languages[$def_language])) {
try { 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) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
@@ -232,16 +240,16 @@ if ($page == 'overview') {
$lng_stmt = Database::prepare(" $lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "` UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng SET `language`= :lng
WHERE `hash`= :hash" WHERE `hash`= :hash");
);
Database::pexecute($lng_stmt, array( Database::pexecute($lng_stmt, array(
'lng' => $def_language, 'lng' => $def_language,
'hash' => $s 'hash' => $s
)); ));
} }
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'"); $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 { } else {
$language_options = ''; $language_options = '';
@@ -257,15 +265,15 @@ if ($page == 'overview') {
eval("echo \"" . getTemplate("index/change_language") . "\";"); eval("echo \"" . getTemplate("index/change_language") . "\";");
} }
} elseif ($page == 'change_theme') { } elseif ($page == 'change_theme') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$theme = validate($_POST['theme'], 'theme'); $theme = validate($_POST['theme'], 'theme');
try { try {
Admins::getLocal($userinfo, array('id' => $userinfo['adminid'], 'theme' => $theme))->update(); Admins::getLocal($userinfo, array(
'id' => $userinfo['adminid'],
'theme' => $theme
))->update();
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
@@ -274,16 +282,16 @@ if ($page == 'overview') {
$theme_stmt = Database::prepare(" $theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "` UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme SET `theme`= :theme
WHERE `hash`= :hash" WHERE `hash`= :hash");
);
Database::pexecute($theme_stmt, array( Database::pexecute($theme_stmt, array(
'theme' => $theme, 'theme' => $theme,
'hash' => $s 'hash' => $s
)); ));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s)); redirectTo($filename, array(
's' => $s
));
} else { } else {
$theme_options = ''; $theme_options = '';
@@ -300,15 +308,10 @@ if ($page == 'overview') {
eval("echo \"" . getTemplate("index/change_theme") . "\";"); 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 // only show this if we really have an exception to report
if (isset($_GET['errorid']) if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
&& $_GET['errorid'] != ''
) {
$errid = $_GET['errorid']; $errid = $_GET['errorid'];
// read error file // read error file
@@ -342,9 +345,7 @@ if ($page == 'overview') {
$mail_html = nl2br($mail_body); $mail_html = nl2br($mail_body);
// send actual report to dev-team // send actual report to dev-team
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
// send mail and say thanks // send mail and say thanks
$_mailerror = false; $_mailerror = false;
try { try {
@@ -368,22 +369,25 @@ if ($page == 'overview') {
// finally remove error from fs // finally remove error from fs
@unlink($err_file); @unlink($err_file);
redirectTo($filename, array('s' => $s)); redirectTo($filename, array(
's' => $s
));
} }
// show a nice summary of the error-report // show a nice summary of the error-report
// before actually sending anything // before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";"); eval("echo \"" . getTemplate("index/send_error_report") . "\";");
} else { } else {
redirectTo($filename, array('s' => $s)); redirectTo($filename, array(
's' => $s
));
} }
} else { } 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'; 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'; require_once __DIR__ . '/apihelp.php';
} }

View File

@@ -19,8 +19,8 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts; use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {

View File

@@ -20,7 +20,7 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
if ($page == 'log' if ($page == 'log'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1'

View File

@@ -20,7 +20,7 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);

View File

@@ -19,7 +19,7 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Api\Commands\PhpSettings as PhpSettings; use Froxlor\Api\Commands\PhpSettings as PhpSettings;
use Froxlor\Api\Commands\FpmDaemons as FpmDaemons; use Froxlor\Api\Commands\FpmDaemons as FpmDaemons;

View File

@@ -17,8 +17,8 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
@@ -520,6 +520,6 @@ if ($page == '' || $page == 'overview') {
'id' => $planid 'id' => $planid
)); ));
echo $result['value']; echo $result['value'];
exit; exit();
} }
} }

View File

@@ -16,15 +16,13 @@
* @package Panel * @package Panel
* *
*/ */
use Froxlor\Database\Database;
use \Froxlor\Database; use Froxlor\Settings;
use \Froxlor\Settings; use Froxlor\Api\Commands\Froxlor;
use \Froxlor\Api\Commands\Froxlor;
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
// get sql-root access data // get sql-root access data
Database::needRoot(true); Database::needRoot(true);
Database::needSqlData(); Database::needSqlData();
@@ -34,9 +32,7 @@ Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_data = loadConfigArrayDir('./actions/admin/settings/'); $settings_data = loadConfigArrayDir('./actions/admin/settings/');
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') { if ($_part == '') {
@@ -52,7 +48,6 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_part = true; $settings_part = true;
} }
$only_enabledisable = false; $only_enabledisable = false;
} else { } else {
$settings_all = false; $settings_all = false;
$settings_part = false; $settings_part = false;
@@ -60,30 +55,26 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
} }
// check if the session timeout is too low #815 // check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout']) if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
&& $_POST['session_sessiontimeout'] < 60
) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']); standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
} }
if (processFormEx( if (processFormEx($settings_data, $_POST, array(
$settings_data, 'filename' => $filename,
$_POST, 'action' => $action,
array('filename' => $filename, 'action' => $action, 'page' => $page), 'page' => $page
$_part, ), $_part, $settings_all, $settings_part, $only_enabledisable)) {
$settings_all,
$settings_part,
$only_enabledisable
)
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting"); $log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config // Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page)); standard_success('settingssaved', '', array(
'filename' => $filename,
'action' => $action,
'page' => $page
));
} }
} else { } else {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_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 \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;"); eval("echo \$settings_page;");
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";"); eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
} }
} elseif ($page == 'phpinfo' && $userinfo['change_serversettings'] == '1') {
} elseif($page == 'phpinfo'
&& $userinfo['change_serversettings'] == '1'
) {
ob_start(); ob_start();
phpinfo(); phpinfo();
$phpinfo = array('phpinfo' => array()); $phpinfo = array(
if (preg_match_all( 'phpinfo' => array()
'#(?:<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 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) { foreach ($matches as $match) {
$end = array_keys($phpinfo); $end = array_keys($phpinfo);
$end = end($end); $end = end($end);
if (strlen($match[1])) { if (strlen($match[1])) {
$phpinfo[$match[1]] = array(); $phpinfo[$match[1]] = array();
} elseif (isset($match[3])) { } 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 { } else {
$phpinfo[$end][] = $match[2]; $phpinfo[$end][] = $match[2];
} }
@@ -151,13 +139,8 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
standard_error($lng['error']['no_phpinfo']); standard_error($lng['error']['no_phpinfo']);
} }
eval("echo \"" . getTemplate("settings/phpinfo") . "\";"); eval("echo \"" . getTemplate("settings/phpinfo") . "\";");
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
} elseif($page == 'rebuildconfigs' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles"); $log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
inserttask('1'); inserttask('1');
@@ -167,19 +150,17 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// cron.d file // cron.d file
inserttask('99'); inserttask('99');
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php')); standard_success('rebuildingconfigs', '', array(
'filename' => 'admin_index.php'
));
} else { } 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' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters"); $log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
$updatecounters = updateCounters(true); $updatecounters = updateCounters(true);
@@ -194,53 +175,45 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
} }
eval("echo \"" . getTemplate("settings/updatecounters") . "\";"); eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
} else { } 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' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords"); $log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';"); Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';");
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'"); 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 { } 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' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas"); $log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
// Set the quota to 0 which means unlimited // Set the quota to 0 which means unlimited
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';"); Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'"); Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
redirectTo($filename, array('s' => $s)); redirectTo($filename, array(
's' => $s
));
} else { } 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') {
} elseif ($page == 'enforcequotas' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// Fetch all accounts // Fetch all accounts
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`"); $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)) { while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$difference = Settings::Get('system.mail_quota') - $array['quota']; $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(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota 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 // 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`"); 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'); $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 { } else {
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page)); ask_yesno('admin_quotas_reallyenforce', $filename, array(
'page' => $page
));
} }
} elseif ($page == 'integritycheck' } elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') {
&& $userinfo['change_serversettings'] == '1'
) {
$integrity = new IntegrityCheck(); $integrity = new IntegrityCheck();
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$integrity->fixAll(); $integrity->fixAll();
} elseif(isset($_GET['action']) } elseif (isset($_GET['action']) && $_GET['action'] == "fix") {
&& $_GET['action'] == "fix") { ask_yesno('admin_integritycheck_reallyfix', $filename, array(
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page)); 'page' => $page
));
} }
$integritycheck = ''; $integritycheck = '';
@@ -293,9 +271,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";"); eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
} }
eval("echo \"" . getTemplate("settings/integritycheck") . "\";"); eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
} } elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') {
elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1')
{
// check for json-stuff // check for json-stuff
if (! extension_loaded('json')) { if (! extension_loaded('json')) {
standard_error('jsonextensionnotfound'); standard_error('jsonextensionnotfound');
@@ -312,7 +288,7 @@ elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1')
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'); header('Content-type: application/json');
echo $json_export; echo $json_export;
exit; exit();
} elseif (isset($_GET['action']) && $_GET['action'] == "import") { } elseif (isset($_GET['action']) && $_GET['action'] == "import") {
// import // import
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -320,22 +296,23 @@ elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1')
if (isset($_FILES["import_file"]["tmp_name"])) { if (isset($_FILES["import_file"]["tmp_name"])) {
$imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]); $imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]);
try { try {
Froxlor::getLocal($userinfo, array('json_str' => $imp_content))->importSettings(); Froxlor::getLocal($userinfo, array(
'json_str' => $imp_content
))->importSettings();
} catch (Exception $e) { } catch (Exception $e) {
dynamic_error($e->getMessage()); dynamic_error($e->getMessage());
} }
standard_success('settingsimported', '', array('filename' => 'admin_settings.php')); standard_success('settingsimported', '', array(
'filename' => 'admin_settings.php'
));
} }
dynamic_error("Upload failed"); dynamic_error("Upload failed");
} }
} else { } else {
eval("echo \"" . getTemplate("settings/importexport/index") . "\";"); eval("echo \"" . getTemplate("settings/importexport/index") . "\";");
} }
} } elseif ($page == 'testmail') {
elseif ($page == 'testmail') if (isset($_POST['send']) && $_POST['send'] == 'send') {
{
if (isset($_POST['send']) && $_POST['send'] == 'send')
{
$test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null; $test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null;
/** /**
@@ -384,7 +361,10 @@ elseif ($page == 'testmail')
if (! $_mailerror) { if (! $_mailerror) {
// success // success
$mail->ClearAddresses(); $mail->ClearAddresses();
standard_success('testmailsent', '', array('filename' => 'admin_settings.php', 'page' => 'testmail')); standard_success('testmailsent', '', array(
'filename' => 'admin_settings.php',
'page' => 'testmail'
));
} }
} else { } else {
// invalid sender e-mail // invalid sender e-mail

View File

@@ -20,8 +20,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\SubDomains as SubDomains; use Froxlor\Api\Commands\SubDomains as SubDomains;
use Froxlor\Api\Commands\Certificates as Certificates; use Froxlor\Api\Commands\Certificates as Certificates;

View File

@@ -20,8 +20,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Emails as Emails; use Froxlor\Api\Commands\Emails as Emails;
use Froxlor\Api\Commands\EmailAccounts as EmailAccounts; use Froxlor\Api\Commands\EmailAccounts as EmailAccounts;
use Froxlor\Api\Commands\EmailForwarders as EmailForwarders; use Froxlor\Api\Commands\EmailForwarders as EmailForwarders;

View File

@@ -19,8 +19,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\DirOptions as DirOptions; use Froxlor\Api\Commands\DirOptions as DirOptions;
use Froxlor\Api\Commands\DirProtections as DirProtections; use Froxlor\Api\Commands\DirProtections as DirProtections;
use Froxlor\Api\Commands\CustomerBackups as CustomerBackups; use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
@@ -72,7 +72,7 @@ if ($page == 'overview') {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { if (strpos($row['path'], $userinfo['documentroot']) === 0) {
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']); $row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
} }
$row['path'] = makeCorrectDir($row['path']); $row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";"); eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
$count ++; $count ++;
@@ -214,7 +214,7 @@ if ($page == 'overview') {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { if (strpos($row['path'], $userinfo['documentroot']) === 0) {
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']); $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('1', $lng['panel']['yes'], $row['options_indexes']);
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $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']); $row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
@@ -374,7 +374,7 @@ if ($page == 'overview') {
$action = "abort"; $action = "abort";
$row = $existing_backupJob['data']; $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_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_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
$row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no']; $row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];

View File

@@ -20,8 +20,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Ftps as Ftps; use Froxlor\Api\Commands\Ftps as Ftps;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings

View File

@@ -20,8 +20,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Customers as Customers; use Froxlor\Api\Commands\Customers as Customers;
if ($action == 'logout') { if ($action == 'logout') {

View File

@@ -19,8 +19,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) { if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {

View File

@@ -20,8 +20,8 @@
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Mysqls as Mysqls; use Froxlor\Api\Commands\Mysqls as Mysqls;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings

View File

@@ -21,8 +21,8 @@ define('AREA', 'customer');
$intrafficpage = 1; $intrafficpage = 1;
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','traffic')) { if (Settings::IsInList('panel.customer_hide_options','traffic')) {

View File

@@ -19,7 +19,7 @@ if (! defined('AREA')) {
* *
*/ */
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Api\Commands\DomainZones as DomainZones; use Froxlor\Api\Commands\DomainZones as DomainZones;
// This file is being included in admin_domains and customer_domains // This file is being included in admin_domains and customer_domains

View File

@@ -19,9 +19,9 @@
define('AREA', 'login'); define('AREA', 'login');
require './lib/init.php'; require './lib/init.php';
use \Froxlor\Database; use Froxlor\Database\Database;
use \Froxlor\Settings; use Froxlor\Settings;
use \Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;
if ($action == '') { if ($action == '') {
$action = 'login'; $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 // there can be only one script to handle this so we can use a fixed value here
$script = "/index.php"; // $_SERVER['SCRIPT_NAME']; $script = "/index.php"; // $_SERVER['SCRIPT_NAME'];
if (Settings::Get('system.froxlordirectlyviahostname') == 0) { 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; $activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;

View File

@@ -1,7 +1,6 @@
<?php <?php
use Froxlor\Database\Database;
use \Froxlor\Database; use Froxlor\Settings;
use \Froxlor\Settings;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
@@ -134,12 +133,30 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
showUpdateStep("Updating cronjob table"); showUpdateStep("Updating cronjob table");
Database::query("ALTER TABLE `" . TABLE_PANEL_CRONRUNS . "` ADD `cronclass` varchar(500) NOT NULL AFTER `cronfile`"); 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"); $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(
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\Traffic\\TrafficCron', 'cf' => 'traffic')); 'cc' => '\\Froxlor\\Cron\\TasksCron',
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\Traffic\\ReportsCron', 'cf' => 'usage_report')); 'cf' => 'tasks'
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(
Database::pexecute($upd_stmt, array('cc' => '\\Froxlor\\Cron\\System\\BackupCron', 'cf' => 'backup')); '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'"); Database::query("DELETE FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `module` = 'froxlor/ticket'");
lastStepStatus(0); lastStepStatus(0);
@@ -163,7 +180,9 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201812180')) {
$dns_target = 'PowerDNS'; $dns_target = 'PowerDNS';
} }
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :v WHERE `settinggroup` = 'system' AND `varname` = 'dns_server'"); $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); lastStepStatus(0);
\Froxlor\Froxlor::updateToDbVersion('201812190'); \Froxlor\Froxlor::updateToDbVersion('201812190');

View File

@@ -1,7 +1,6 @@
<?php <?php
use Froxlor\Database\Database;
use \Froxlor\Database; use Froxlor\Settings;
use \Froxlor\Settings;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
@@ -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); 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_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 == '') { if ($update_perl_suexecpath == '') {
$update_perl_suexecpath = '/var/www/cgi-bin/'; $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); 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"); showUpdateStep("Adding new settings for awstats");
$stmt = Database::prepare(" $stmt = Database::prepare("
@@ -1150,7 +1149,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.13.1')) {
if (\Froxlor\Froxlor::isFroxlorVersion('0.9.14-svn2')) { if (\Froxlor\Froxlor::isFroxlorVersion('0.9.14-svn2')) {
showUpdateStep("Updating from 0.9.14-svn2 to 0.9.14-svn3", false); 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"); showUpdateStep("Adding AWStats icons path to the settings");
$stmt = Database::prepare(" $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'] : ''; $update_ssl_cert_chainfile = isset($_POST['update_ssl_cert_chainfile']) ? $_POST['update_ssl_cert_chainfile'] : '';
if ($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"); 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); 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_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_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']) ? makeCorrectDir($_POST['update_phpfpm_tmpdir']) : '/var/customers/tmp'; $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']) ? makeCorrectDir($_POST['update_phpfpm_peardir']) : '/usr/share/php/:/usr/share/php5/'; $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_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'; $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); showUpdateStep("Inserting settings for nginx fastcgi-params file", true);
$fastcgiparams = '/etc/nginx/fastcgi_params'; $fastcgiparams = '/etc/nginx/fastcgi_params';
if (isset($_POST['nginx_fastcgi_params']) && $_POST['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(" $stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET INSERT INTO `" . TABLE_PANEL_SETTINGS . "` SET
@@ -2244,7 +2243,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.28.1')) {
$fastcgiparams = Settings::Get('nginx.fastcgiparams'); $fastcgiparams = Settings::Get('nginx.fastcgiparams');
// check the faulty value explicitly // check the faulty value explicitly
if ($fastcgiparams == '/etc/nginx/fastcgi_params/') { if ($fastcgiparams == '/etc/nginx/fastcgi_params/') {
$fastcgiparams = makeCorrectFile(substr($fastcgiparams, 0, - 1)); $fastcgiparams = \Froxlor\FileDir::makeCorrectFile(substr($fastcgiparams, 0, - 1));
$stmt = Database::prepare(" $stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET UPDATE `" . TABLE_PANEL_SETTINGS . "` SET
`value` = :value `value` = :value
@@ -2329,7 +2328,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.29-dev3')) {
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;"); ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;");
lastStepStatus(0); 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) == '/') { if (trim($system_customersslpath) == '/') {
// prevent users from specifying nonsense here // prevent users from specifying nonsense here
$system_customersslpath = '/etc/ssl/froxlor-custom/'; $system_customersslpath = '/etc/ssl/froxlor-custom/';
@@ -2808,7 +2807,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.32-dev4')) {
showUpdateStep("Adding new settings for cron"); showUpdateStep("Adding new settings for cron");
// get user-chosen value // get user-chosen value
$crondfile = isset($_POST['crondfile']) ? $_POST['crondfile'] : "/etc/cron.d/froxlor"; $crondfile = isset($_POST['crondfile']) ? $_POST['crondfile'] : "/etc/cron.d/froxlor";
$crondfile = makeCorrectFile($crondfile); $crondfile = \Froxlor\FileDir::makeCorrectFile($crondfile);
Settings::AddNew("system.cronconfig", $crondfile); Settings::AddNew("system.cronconfig", $crondfile);
// add task to generate cron.d-file // add task to generate cron.d-file
inserttask('99'); inserttask('99');
@@ -3312,9 +3311,10 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.35.1') && \Froxlor\Froxlor::isDataba
`interval` = '1 DAY', `interval` = '1 DAY',
`desc_lng_key` = 'cron_backup', `desc_lng_key` = 'cron_backup',
`lastrun` = 0, `lastrun` = 0,
`isactive` = :isactive" `isactive` = :isactive");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array('isactive' => $enable_backup)); 'isactive' => $enable_backup
));
lastStepStatus(0); lastStepStatus(0);
\Froxlor\Froxlor::updateToDbVersion('201604270'); \Froxlor\Froxlor::updateToDbVersion('201604270');
@@ -3452,7 +3452,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201609050')) {
$websrv_default = "/etc/nginx/acme.conf"; $websrv_default = "/etc/nginx/acme.conf";
} }
$acmeconffile = isset($_POST['acmeconffile']) ? $_POST['acmeconffile'] : $websrv_default; $acmeconffile = isset($_POST['acmeconffile']) ? $_POST['acmeconffile'] : $websrv_default;
$acmeconffile = makeCorrectFile($acmeconffile); $acmeconffile = \Froxlor\FileDir::makeCorrectFile($acmeconffile);
Settings::AddNew("system.letsencryptacmeconf", $acmeconffile); Settings::AddNew("system.letsencryptacmeconf", $acmeconffile);
lastStepStatus(0); lastStepStatus(0);
@@ -3602,8 +3602,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.38.6')) {
if (\Froxlor\Froxlor::isDatabaseVersion('201612110')) { if (\Froxlor\Froxlor::isDatabaseVersion('201612110')) {
showUpdateStep("Adding field for OCSP stapling"); showUpdateStep("Adding field for OCSP stapling");
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `ocsp_stapling` TINYINT(1) NOT NULL DEFAULT '0';");
"` ADD `ocsp_stapling` TINYINT(1) NOT NULL DEFAULT '0';");
lastStepStatus(0); lastStepStatus(0);
showUpdateStep("Adding default setting for Apache 2.4 OCSP cache path"); showUpdateStep("Adding default setting for Apache 2.4 OCSP cache path");

View File

@@ -14,7 +14,7 @@
* @package Language * @package Language
* *
*/ */
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
use PHPMailer\PHPMailer; use PHPMailer\PHPMailer;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cli\Action; namespace Froxlor\Cli\Action;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\SImExporter; use Froxlor\SImExporter;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Cli\ConfigServicesCmd; use Froxlor\Cli\ConfigServicesCmd;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cli\Action; namespace Froxlor\Cli\Action;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Cli\SwitchServerIpCmd; use Froxlor\Cli\SwitchServerIpCmd;
class SwitchServerIpAction extends \Froxlor\Cli\Action class SwitchServerIpAction extends \Froxlor\Cli\Action

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron; namespace Froxlor\Cron;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
class CronConfig class CronConfig

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Dns; namespace Froxlor\Cron\Dns;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
/** /**

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use \Froxlor\Database; use Froxlor\Database\Database;
use \Froxlor\Settings; use \Froxlor\Settings;
use Froxlor\Cron\Http\Php\Fpm; use Froxlor\Cron\Http\Php\Fpm;
use Froxlor\Cron\Http\Php\PhpInterface; use Froxlor\Cron\Http\Php\PhpInterface;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use \Froxlor\Database; use Froxlor\Database\Database;
use \Froxlor\Settings; use \Froxlor\Settings;
use Froxlor\Cron\Http\Php\PhpInterface; use Froxlor\Cron\Http\Php\PhpInterface;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
/** /**

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
/** /**

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Cron\Http\Php\Fpm; use Froxlor\Cron\Http\Php\Fpm;
use Froxlor\Cron\Http\Php\PhpInterface; use Froxlor\Cron\Http\Php\PhpInterface;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Cron\Http\Php\PhpInterface; use Froxlor\Cron\Http\Php\PhpInterface;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Cron\Http\Php\Fpm; use Froxlor\Cron\Http\Php\Fpm;
use Froxlor\Cron\Http\Php\PhpInterface; use Froxlor\Cron\Http\Php\PhpInterface;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Cron\Http\Php\PhpInterface; use Froxlor\Cron\Http\Php\PhpInterface;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\Http; namespace Froxlor\Cron\Http;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
/** /**

View File

@@ -1,9 +1,7 @@
<?php <?php
namespace Froxlor\Cron; namespace Froxlor\Cron;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\FroxlorLogger;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\System; namespace Froxlor\Cron\System;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\System; namespace Froxlor\Cron\System;
use Froxlor\Database; use Froxlor\Database\Database;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Cron\System; namespace Froxlor\Cron\System;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
/** /**

View File

@@ -17,7 +17,7 @@ namespace Froxlor\Cron\Traffic;
* @package Cron * @package Cron
* *
*/ */
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
class ReportsCron extends \Froxlor\Cron\FroxlorCron class ReportsCron extends \Froxlor\Cron\FroxlorCron

View File

@@ -17,7 +17,7 @@ namespace Froxlor\Cron\Traffic;
* @package Cron * @package Cron
* *
*/ */
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
class TrafficCron extends \Froxlor\Cron\FroxlorCron class TrafficCron extends \Froxlor\Cron\FroxlorCron

View File

@@ -302,7 +302,7 @@ class Database
); );
if ($socket != null) { if ($socket != null) {
$dbconf["dsn"]['unix_socket'] = makeCorrectFile($socket); $dbconf["dsn"]['unix_socket'] = \Froxlor\FileDir::makeCorrectFile($socket);
} else { } else {
$dbconf["dsn"]['host'] = $host; $dbconf["dsn"]['host'] = $host;
$dbconf["dsn"]['port'] = $port; $dbconf["dsn"]['port'] = $port;
@@ -390,7 +390,7 @@ class Database
* log to a file, so we can actually ask people for the error * log to a file, so we can actually ask people for the error
* (no one seems to find the stuff in the syslog) * (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)) { if (! file_exists($sl_dir)) {
@mkdir($sl_dir, 0755); @mkdir($sl_dir, 0755);
} }
@@ -403,7 +403,7 @@ class Database
* log error for reporting * log error for reporting
*/ */
$errid = substr(md5(microtime()), 5, 5); $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'); $errlog = @fopen($err_file, 'w');
@fwrite($errlog, "|CODE " . $error->getCode() . "\n"); @fwrite($errlog, "|CODE " . $error->getCode() . "\n");
@fwrite($errlog, "|MSG " . $error_message . "\n"); @fwrite($errlog, "|MSG " . $error_message . "\n");

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Database\Manager; namespace Froxlor\Database\Manager;
use Froxlor\Database; use Froxlor\Database\Database;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Dns; namespace Froxlor\Dns;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
class Dns class Dns

View File

@@ -18,7 +18,7 @@ namespace Froxlor\Http;
* @since 0.9.33 * @since 0.9.33
* *
*/ */
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\FileDir; use Froxlor\FileDir;
/** /**

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Http\LetsEncrypt; namespace Froxlor\Http\LetsEncrypt;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
// Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz> // Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz>

View File

@@ -1,7 +1,7 @@
<?php <?php
namespace Froxlor\Http\LetsEncrypt; namespace Froxlor\Http\LetsEncrypt;
use Froxlor\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\Settings;
// Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz> // Copyright (c) 2015, Stanislav Humplik <sh@analogic.cz>

View File

@@ -2,7 +2,8 @@
namespace Froxlor; namespace Froxlor;
use Froxlor\Database as Database; use Froxlor\Database\Database;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.

View File

@@ -16,11 +16,10 @@
* @package System * @package System
* *
*/ */
require dirname(__DIR__) . '/vendor/autoload.php';
require __DIR__ . '/vendor/autoload.php'; use Froxlor\Database\Database;
use Froxlor\Settings;
use \Froxlor\Database;
use \Froxlor\Settings;
header("Content-Type: text/html; charset=UTF-8"); header("Content-Type: text/html; charset=UTF-8");
@@ -96,13 +95,12 @@ 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) if (! isset($sql) || ! is_array($sql)) {
|| !is_array($sql)
) {
$config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $_deftheme . '/misc/configurehint.tpl'); $config_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $_deftheme . '/misc/configurehint.tpl');
$config_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $config_hint); $config_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $config_hint);
die($config_hint); die($config_hint);
@@ -173,14 +171,13 @@ $timediff = time() - Settings::Get('session.sessiontimeout');
$del_stmt = Database::prepare(" $del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `lastactivity` < :timediff DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `lastactivity` < :timediff
"); ");
Database::pexecute($del_stmt, array('timediff' => $timediff)); Database::pexecute($del_stmt, array(
'timediff' => $timediff
));
$userinfo = array(); $userinfo = array();
if (isset($s) if (isset($s) && $s != "" && $nosession != 1) {
&& $s != ""
&& $nosession != 1
) {
ini_set("session.name", "s"); ini_set("session.name", "s");
ini_set("url_rewriter.tags", ""); ini_set("url_rewriter.tags", "");
ini_set("session.use_cookies", false); ini_set("session.use_cookies", false);
@@ -211,10 +208,7 @@ if (isset($s)
$userinfo_stmt = Database::prepare($query); $userinfo_stmt = Database::prepare($query);
$userinfo = Database::pexecute_first($userinfo_stmt, $userinfo_data); $userinfo = Database::pexecute_first($userinfo_stmt, $userinfo_data);
if ((($userinfo['adminsession'] == '1' && AREA == 'admin' && isset($userinfo['adminid'])) 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')) {
|| ($userinfo['adminsession'] == '0' && (AREA == 'customer' || AREA == 'login') && isset($userinfo['customerid'])))
&& (!isset($userinfo['deactivated']) || $userinfo['deactivated'] != '1')
) {
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "` SET UPDATE `" . TABLE_PANEL_SESSIONS . "` SET
`lastactivity` = :lastactive `lastactivity` = :lastactive
@@ -269,12 +263,9 @@ if (isset($userinfo['language']) && isset($languages[$userinfo['language']])) {
// default: use language from session, #277 // default: use language from session, #277
$language = $userinfo['language']; $language = $userinfo['language'];
} else { } else {
if (!isset($userinfo['def_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
|| !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($_GET['language'])
&& isset($languages[$_GET['language']])
) {
$language = $_GET['language']; $language = $_GET['language'];
} else { } else {
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
@@ -347,8 +338,7 @@ if (!file_exists('templates/'.$theme.'/config.json')) {
$_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 // 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"; $themevariant = "default";
} }
@@ -370,7 +360,7 @@ if ($nosession == 1 && AREA != 'login') {
"qrystr" => $_SERVER["QUERY_STRING"] "qrystr" => $_SERVER["QUERY_STRING"]
); );
redirectTo('index.php', $params); redirectTo('index.php', $params);
exit; exit();
} }
/** /**
@@ -381,9 +371,7 @@ $templatecache = array();
/** /**
* Logic moved out of lng-file * Logic moved out of lng-file
*/ */
if (isset($userinfo['loginname']) if (isset($userinfo['loginname']) && $userinfo['loginname'] != '') {
&& $userinfo['loginname'] != ''
) {
$lng['menue']['main']['username'] .= $userinfo['loginname']; $lng['menue']['main']['username'] .= $userinfo['loginname'];
// Initialize logging // Initialize logging
$log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo); $log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo);
@@ -407,13 +395,13 @@ if (AREA == 'admin' || AREA == 'customer') {
'label' => $lng['admin']['overview'], 'label' => $lng['admin']['overview'],
'elements' => array( 'elements' => array(
array( array(
'label' => $lng['menue']['main']['username'], 'label' => $lng['menue']['main']['username']
), ),
array( array(
'url' => 'admin_index.php?action=logout', 'url' => 'admin_index.php?action=logout',
'label' => $lng['login']['logout'], 'label' => $lng['login']['logout']
), )
), )
), ),
'server' => array( 'server' => array(
'label' => $lng['admin']['server'], 'label' => $lng['admin']['server'],
@@ -422,11 +410,11 @@ if (AREA == 'admin' || AREA == 'customer') {
array( array(
'url' => 'admin_updates.php?page=overview', 'url' => 'admin_updates.php?page=overview',
'label' => $lng['update']['update'], 'label' => $lng['update']['update'],
'required_resources' => 'change_serversettings', 'required_resources' => 'change_serversettings'
), )
), )
), )
), )
); );
$navigation = buildNavigation($navigation_data['admin'], $userinfo); $navigation = buildNavigation($navigation_data['admin'], $userinfo);
} else { } else {

View File

@@ -19,7 +19,7 @@ if (! defined('AREA')) {
* *
*/ */
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\SubDomains as SubDomains; use Froxlor\Api\Commands\SubDomains as SubDomains;
// This file is being included in admin_domains and customer_domains // This file is being included in admin_domains and customer_domains

View File

@@ -19,8 +19,8 @@ if (! defined('AREA')) {
* *
*/ */
use Froxlor\Database as Database; use Froxlor\Database\Database;
use Froxlor\Settings as Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Certificates as Certificates; use Froxlor\Api\Commands\Certificates as Certificates;
// This file is being included in admin_domains and customer_domains // This file is being included in admin_domains and customer_domains

View File

@@ -1,5 +1,4 @@
<?php <?php
if (file_exists('/etc/froxlor-test.pwd') && file_exists('/etc/froxlor-test.rpwd')) { if (file_exists('/etc/froxlor-test.pwd') && file_exists('/etc/froxlor-test.rpwd')) {
// froxlor jenkins test-system // froxlor jenkins test-system
$pwd = trim(file_get_contents('/etc/froxlor-test.pwd')); $pwd = trim(file_get_contents('/etc/froxlor-test.pwd'));
@@ -33,8 +32,8 @@ file_put_contents($userdata, $userdata_content);
// include autoloader / api / etc // include autoloader / api / etc
require dirname(__DIR__) . '/vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
use \Froxlor\Database; use Froxlor\Database\Database;
use \Froxlor\Settings; use Froxlor\Settings;
Database::needRoot(true); Database::needRoot(true);
Database::query("DROP DATABASE IF EXISTS `test1sql1`;"); Database::query("DROP DATABASE IF EXISTS `test1sql1`;");