correct use of Database use
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -16,12 +16,11 @@
|
||||
* @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'])) {
|
||||
@@ -30,9 +29,7 @@ if (isset($_POST['id'])) {
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'admins'
|
||||
&& $userinfo['change_serversettings'] == '1'
|
||||
) {
|
||||
if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
@@ -108,7 +105,6 @@ if ($page == 'admins'
|
||||
|
||||
$admincount = $numrows_admins;
|
||||
eval("echo \"" . getTemplate("admins/admins") . "\";");
|
||||
|
||||
} elseif ($action == 'su') {
|
||||
|
||||
try {
|
||||
@@ -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,29 +165,34 @@ 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') {
|
||||
|
||||
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 = '';
|
||||
@@ -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');
|
||||
|
||||
@@ -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,11 +14,10 @@
|
||||
* @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'])) {
|
||||
@@ -74,7 +73,6 @@ if ($page == 'cronjobs' || $page == 'overview') {
|
||||
}
|
||||
|
||||
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
|
||||
@@ -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,12 +16,11 @@
|
||||
* @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'])) {
|
||||
@@ -30,9 +29,7 @@ if (isset($_POST['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 = 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);
|
||||
@@ -124,9 +122,7 @@ if ($page == 'customers'
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -152,10 +148,7 @@ if ($page == 'customers'
|
||||
|
||||
$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,
|
||||
@@ -205,15 +199,15 @@ if ($page == 'customers'
|
||||
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,9 +246,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,
|
||||
@@ -261,23 +255,29 @@ 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_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') {
|
||||
|
||||
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 = '';
|
||||
|
||||
@@ -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,8 +358,7 @@ 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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -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'])) {
|
||||
@@ -704,11 +704,9 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
} elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') {
|
||||
|
||||
require_once __DIR__ . '/dns_editor.php';
|
||||
|
||||
} elseif ($page == 'sslcertificates') {
|
||||
|
||||
require_once __DIR__ . '/ssl_certificates.php';
|
||||
|
||||
} elseif ($page == 'logfiles') {
|
||||
|
||||
require_once __DIR__ . '/logfiles_viewer.php';
|
||||
|
||||
132
admin_index.php
132
admin_index.php
@@ -16,12 +16,11 @@
|
||||
* @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;
|
||||
|
||||
@@ -29,20 +28,20 @@ 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);
|
||||
|
||||
@@ -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) {
|
||||
@@ -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,12 +175,9 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("index/index") . "\";");
|
||||
|
||||
} 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')) {
|
||||
@@ -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'));
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'oldpassword'
|
||||
));
|
||||
} elseif ($new_password == '') {
|
||||
standard_error(array('stringisempty', 'newpassword'));
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'newpassword'
|
||||
));
|
||||
} elseif ($new_password_confirm == '') {
|
||||
standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
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') {
|
||||
|
||||
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 = '';
|
||||
@@ -257,15 +265,15 @@ if ($page == 'overview') {
|
||||
|
||||
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 = '';
|
||||
@@ -300,15 +308,10 @@ if ($page == 'overview') {
|
||||
|
||||
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
|
||||
@@ -342,9 +345,7 @@ if ($page == 'overview') {
|
||||
$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 {
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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']);
|
||||
@@ -520,6 +520,6 @@ if ($page == '' || $page == 'overview') {
|
||||
'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];
|
||||
}
|
||||
@@ -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');
|
||||
@@ -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-type: application/json');
|
||||
echo $json_export;
|
||||
exit;
|
||||
exit();
|
||||
} elseif (isset($_GET['action']) && $_GET['action'] == "import") {
|
||||
// import
|
||||
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"])) {
|
||||
$imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]);
|
||||
try {
|
||||
Froxlor::getLocal($userinfo, array('json_str' => $imp_content))->importSettings();
|
||||
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')
|
||||
{
|
||||
} elseif ($page == 'testmail') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null;
|
||||
|
||||
/**
|
||||
@@ -384,7 +361,10 @@ elseif ($page == 'testmail')
|
||||
if (! $_mailerror) {
|
||||
// success
|
||||
$mail->ClearAddresses();
|
||||
standard_success('testmailsent', '', array('filename' => 'admin_settings.php', 'page' => 'testmail'));
|
||||
standard_success('testmailsent', '', array(
|
||||
'filename' => 'admin_settings.php',
|
||||
'page' => 'testmail'
|
||||
));
|
||||
}
|
||||
} else {
|
||||
// invalid sender e-mail
|
||||
|
||||
@@ -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.
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
@@ -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/';
|
||||
@@ -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');
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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.
|
||||
|
||||
64
lib/init.php
64
lib/init.php
@@ -16,11 +16,10 @@
|
||||
* @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");
|
||||
|
||||
@@ -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';
|
||||
|
||||
if (!isset($sql)
|
||||
|| !is_array($sql)
|
||||
) {
|
||||
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);
|
||||
@@ -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);
|
||||
@@ -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,12 +263,9 @@ 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'])) {
|
||||
@@ -347,8 +338,7 @@ if (!file_exists('templates/'.$theme.'/config.json')) {
|
||||
$_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";
|
||||
}
|
||||
|
||||
@@ -370,7 +360,7 @@ if ($nosession == 1 && AREA != 'login') {
|
||||
"qrystr" => $_SERVER["QUERY_STRING"]
|
||||
);
|
||||
redirectTo('index.php', $params);
|
||||
exit;
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,9 +371,7 @@ $templatecache = array();
|
||||
/**
|
||||
* Logic moved out of lng-file
|
||||
*/
|
||||
if (isset($userinfo['loginname'])
|
||||
&& $userinfo['loginname'] != ''
|
||||
) {
|
||||
if (isset($userinfo['loginname']) && $userinfo['loginname'] != '') {
|
||||
$lng['menue']['main']['username'] .= $userinfo['loginname'];
|
||||
// Initialize logging
|
||||
$log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo);
|
||||
@@ -407,13 +395,13 @@ if (AREA == 'admin' || AREA == 'customer') {
|
||||
'label' => $lng['admin']['overview'],
|
||||
'elements' => array(
|
||||
array(
|
||||
'label' => $lng['menue']['main']['username'],
|
||||
'label' => $lng['menue']['main']['username']
|
||||
),
|
||||
array(
|
||||
'url' => 'admin_index.php?action=logout',
|
||||
'label' => $lng['login']['logout'],
|
||||
),
|
||||
),
|
||||
'label' => $lng['login']['logout']
|
||||
)
|
||||
)
|
||||
),
|
||||
'server' => array(
|
||||
'label' => $lng['admin']['server'],
|
||||
@@ -422,11 +410,11 @@ if (AREA == 'admin' || AREA == 'customer') {
|
||||
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 {
|
||||
|
||||
@@ -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`;");
|
||||
|
||||
Reference in New Issue
Block a user