migrated a few functions to new Settings class and removed unused function createAWStatsVhost(), refs #1325
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -24,34 +24,30 @@
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function makeChownWithNewStats($row)
|
function makeChownWithNewStats($row) {
|
||||||
{
|
|
||||||
global $settings;
|
|
||||||
|
|
||||||
// get correct user
|
// get correct user
|
||||||
if($settings['system']['mod_fcgid'] == '1' && isset($row['deactivated']) && $row['deactivated'] == '0')
|
if ((Settings::Get('system.mod_fcgid') == '1' || Settings::Get('phpfpm.enabled') == '1')
|
||||||
{
|
&& isset($row['deactivated'])
|
||||||
|
&& $row['deactivated'] == '0'
|
||||||
|
) {
|
||||||
$user = $row['loginname'];
|
$user = $row['loginname'];
|
||||||
$group = $row['loginname'];
|
$group = $row['loginname'];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user = $row['guid'];
|
$user = $row['guid'];
|
||||||
$group = $row['guid'];
|
$group = $row['guid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get correct directory
|
// get correct directory
|
||||||
$dir = $row['documentroot'];
|
$dir = $row['documentroot'];
|
||||||
if($settings['system']['awstats_enabled'] == '1')
|
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||||
{
|
|
||||||
$dir .= '/awstats/';
|
$dir .= '/awstats/';
|
||||||
} else {
|
} else {
|
||||||
$dir .= '/webalizer/';
|
$dir .= '/webalizer/';
|
||||||
}
|
}
|
||||||
|
|
||||||
// only run chown if directory exists
|
// only run chown if directory exists
|
||||||
if (file_exists($dir))
|
if (file_exists($dir)) {
|
||||||
{
|
|
||||||
// run chown
|
// run chown
|
||||||
safe_exec('chown -R '.escapeshellarg($user).':'.escapeshellarg($group).' '.escapeshellarg(makeCorrectDir($dir)));
|
safe_exec('chown -R '.escapeshellarg($user).':'.escapeshellarg($group).' '.escapeshellarg(makeCorrectDir($dir)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,8 @@
|
|||||||
*/
|
*/
|
||||||
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false) {
|
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false) {
|
||||||
|
|
||||||
global $settings;
|
|
||||||
|
|
||||||
if ($force
|
if ($force
|
||||||
|| (int)$settings['system']['store_index_file_subs'] == 1
|
|| (int)Settings::Get('system.store_index_file_subs') == 1
|
||||||
) {
|
) {
|
||||||
$result_stmt = Database::prepare("
|
$result_stmt = Database::prepare("
|
||||||
SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login`
|
SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login`
|
||||||
@@ -46,7 +44,7 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
|
|||||||
$template = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
$template = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$replace_arr = array(
|
$replace_arr = array(
|
||||||
'SERVERNAME' => $settings['system']['hostname'],
|
'SERVERNAME' => Settings::Get('system.hostname'),
|
||||||
'CUSTOMER' => $template['customer_login'],
|
'CUSTOMER' => $template['customer_login'],
|
||||||
'ADMIN' => $template['admin_login'],
|
'ADMIN' => $template['admin_login'],
|
||||||
'CUSTOMER_EMAIL' => $template['customer_email'],
|
'CUSTOMER_EMAIL' => $template['customer_email'],
|
||||||
@@ -54,12 +52,12 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
|
|||||||
);
|
);
|
||||||
|
|
||||||
$htmlcontent = replace_variables($template['value'], $replace_arr);
|
$htmlcontent = replace_variables($template['value'], $replace_arr);
|
||||||
$indexhtmlpath = makeCorrectFile($destination . '/index.' . $settings['system']['index_file_extension']);
|
$indexhtmlpath = makeCorrectFile($destination . '/index.' . Settings::Get('system.index_file_extension'));
|
||||||
$index_html_handler = fopen($indexhtmlpath, 'w');
|
$index_html_handler = fopen($indexhtmlpath, 'w');
|
||||||
fwrite($index_html_handler, $htmlcontent);
|
fwrite($index_html_handler, $htmlcontent);
|
||||||
fclose($index_html_handler);
|
fclose($index_html_handler);
|
||||||
if ($logger !== null) {
|
if ($logger !== null) {
|
||||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . $settings['system']['index_file_extension'] . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath));
|
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . Settings::Get('system.index_file_extension') . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
function correctErrorDocument($errdoc = null) {
|
function correctErrorDocument($errdoc = null) {
|
||||||
|
|
||||||
global $settings, $idna_convert;
|
global $idna_convert;
|
||||||
|
|
||||||
if ($errdoc !== null && $errdoc != '') {
|
if ($errdoc !== null && $errdoc != '') {
|
||||||
// not a URL
|
// not a URL
|
||||||
@@ -45,15 +45,14 @@ function correctErrorDocument($errdoc = null) {
|
|||||||
// a string (check for ending ")
|
// a string (check for ending ")
|
||||||
else {
|
else {
|
||||||
// string won't work for lighty
|
// string won't work for lighty
|
||||||
if ($settings['system']['webserver'] == 'lighttpd') {
|
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||||
standard_error('stringerrordocumentnotvalidforlighty');
|
standard_error('stringerrordocumentnotvalidforlighty');
|
||||||
|
|
||||||
} elseif(substr($errdoc, -1) != '"') {
|
} elseif(substr($errdoc, -1) != '"') {
|
||||||
$errdoc .= '"';
|
$errdoc .= '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($settings['system']['webserver'] == 'lighttpd') {
|
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||||
standard_error('urlerrordocumentnotvalidforlighty');
|
standard_error('urlerrordocumentnotvalidforlighty');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
*/
|
*/
|
||||||
function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot, $awstats_params = array()) {
|
function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot, $awstats_params = array()) {
|
||||||
|
|
||||||
global $settings;
|
|
||||||
|
|
||||||
// Generation header
|
// Generation header
|
||||||
$header = "## GENERATED BY FROXLOR\n";
|
$header = "## GENERATED BY FROXLOR\n";
|
||||||
$header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \of F Y h:i:s A') . "\n";
|
$header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \of F Y h:i:s A') . "\n";
|
||||||
@@ -42,8 +40,8 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
|
|||||||
makeChownWithNewStats($awstats_params);
|
makeChownWithNewStats($awstats_params);
|
||||||
|
|
||||||
// weird but could happen...
|
// weird but could happen...
|
||||||
if (!is_dir($settings['system']['awstats_conf'])) {
|
if (!is_dir(Settings::Get('system.awstats_conf'))) {
|
||||||
safe_exec('mkdir -p '.escapeshellarg($settings['system']['awstats_conf']));
|
safe_exec('mkdir -p '.escapeshellarg(Settings::Get('system.awstats_conf')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are the variables we will replace
|
// These are the variables we will replace
|
||||||
@@ -59,11 +57,11 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
|
|||||||
$siteDomain,
|
$siteDomain,
|
||||||
$hostAliases,
|
$hostAliases,
|
||||||
$awstats_dir,
|
$awstats_dir,
|
||||||
makeCorrectDir($settings['system']['awstats_conf'])
|
makeCorrectDir(Settings::Get('system.awstats_conf'))
|
||||||
);
|
);
|
||||||
|
|
||||||
// File names
|
// File names
|
||||||
$domain_file = makeCorrectFile($settings['system']['awstats_conf'].'/awstats.' . $siteDomain . '.conf');
|
$domain_file = makeCorrectFile(Settings::Get('system.awstats_conf').'/awstats.' . $siteDomain . '.conf');
|
||||||
$model_file = FROXLOR_INSTALL_DIR.'/templates/misc/awstatsmodel/awstats.froxlor.model.conf';
|
$model_file = FROXLOR_INSTALL_DIR.'/templates/misc/awstatsmodel/awstats.froxlor.model.conf';
|
||||||
$model_file = makeCorrectFile($model_file);
|
$model_file = makeCorrectFile($model_file);
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file is part of the Froxlor project.
|
|
||||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
|
||||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the COPYING
|
|
||||||
* file that was distributed with this source code. You can also view the
|
|
||||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
|
||||||
*
|
|
||||||
* @copyright (c) the authors
|
|
||||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
|
||||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
|
||||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
|
||||||
* @package Functions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function generates the VHost configuration for AWStats
|
|
||||||
* This will enable the /awstats url and enable security on these folders
|
|
||||||
* @author Berend Dekens
|
|
||||||
*
|
|
||||||
* @param siteDomain Name of the domain we want stats for
|
|
||||||
*
|
|
||||||
* @return String with configuration for use in vhost file
|
|
||||||
*/
|
|
||||||
function createAWStatsVhost($siteDomain, $settings = null) {
|
|
||||||
|
|
||||||
if ($settings['system']['mod_fcgid'] != '1') {
|
|
||||||
|
|
||||||
$vhosts_file = ' # AWStats statistics' . "\n";
|
|
||||||
$vhosts_file.= ' RewriteEngine On' . "\n";
|
|
||||||
$vhosts_file.= ' RewriteRule ^/awstats(/.*)?$ /awstats/awstats.pl?config=' . $siteDomain . ' [L,PT]' . "\n";
|
|
||||||
$vhosts_file.= ' RewriteRule ^/awstats.pl(.*)$ /awstats/awstats.pl$1 [QSA,L,PT]' . "\n";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$vhosts_file = ' <IfModule mod_proxy.c>' . "\n";
|
|
||||||
$vhosts_file.= ' RewriteEngine On' . "\n";
|
|
||||||
$vhosts_file.= ' RewriteRule awstats.pl(.*)$ http://' . $settings['system']['hostname'] . '/cgi-bin/awstats.pl$1 [R,P]' . "\n";
|
|
||||||
$vhosts_file.= ' RewriteRule awstats$ http://' . $settings['system']['hostname'] . '/cgi-bin/awstats.pl?config=' . $siteDomain . ' [R,P]' . "\n";
|
|
||||||
$vhosts_file.= ' </IfModule>' . "\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return $vhosts_file;
|
|
||||||
}
|
|
||||||
@@ -19,9 +19,8 @@
|
|||||||
* Generates a random password
|
* Generates a random password
|
||||||
*/
|
*/
|
||||||
function generatePassword() {
|
function generatePassword() {
|
||||||
global $settings;
|
|
||||||
return substr(
|
return substr(
|
||||||
base64_encode(sha1(md5(uniqid(microtime(), 1))).md5(uniqid(microtime(), 1)).sha1(md5(uniqid(microtime(), 1)))),
|
base64_encode(sha1(md5(uniqid(microtime(), 1))).md5(uniqid(microtime(), 1)).sha1(md5(uniqid(microtime(), 1)))),
|
||||||
rand(5, 50), ($settings['panel']['password_min_length'] > 0 ? $settings['panel']['password_min_length'] : 10)
|
rand(5, 50), (Settings::Get('panel.password_min_length') > 0 ? Settings::Get('panel.password_min_length') : 10)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,21 +15,18 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getFilesystemQuota()
|
function getFilesystemQuota() {
|
||||||
{
|
|
||||||
global $settings, $theme;
|
if (Settings::Get('system.diskquota_enabled')) {
|
||||||
if ($settings['system']['diskquota_enabled'])
|
|
||||||
{
|
// Fetch all quota in the desired partition
|
||||||
# Fetch all quota in the desired partition
|
exec(Settings::Get('system.diskquota_repquota_path') . " -np " . escapeshellarg(Settings::Get('system.diskquota_customer_partition')), $repquota);
|
||||||
exec($settings['system']['diskquota_repquota_path'] . " -np " . escapeshellarg($settings['system']['diskquota_customer_partition']), $repquota);
|
|
||||||
|
|
||||||
$usedquota = array();
|
$usedquota = array();
|
||||||
foreach ($repquota as $tmpquota)
|
foreach ($repquota as $tmpquota) {
|
||||||
{
|
// Let's see if the line matches a quota - line
|
||||||
# Let's see if the line matches a quota - line
|
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches)) {
|
||||||
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches))
|
// It matches - put it into an array with userid as key (for easy lookup later)
|
||||||
{
|
|
||||||
# It matches - put it into an array with userid as key (for easy lookup later)
|
|
||||||
$usedquota[$matches[1]] = array(
|
$usedquota[$matches[1]] = array(
|
||||||
'block' => array(
|
'block' => array(
|
||||||
'used' => $matches[2],
|
'used' => $matches[2],
|
||||||
@@ -46,7 +43,6 @@ function getFilesystemQuota()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $usedquota;
|
return $usedquota;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '') {
|
function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '') {
|
||||||
|
|
||||||
global $settings;
|
|
||||||
|
|
||||||
if ($type == '1'
|
if ($type == '1'
|
||||||
|| $type == '3'
|
|| $type == '3'
|
||||||
|| $type == '4'
|
|| $type == '4'
|
||||||
@@ -38,11 +36,11 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '
|
|||||||
|| $type == '10'
|
|| $type == '10'
|
||||||
) {
|
) {
|
||||||
// 4 = bind -> if bind disabled -> no task
|
// 4 = bind -> if bind disabled -> no task
|
||||||
if ($type == '4' && $settings['system']['bind_enable'] == '0') {
|
if ($type == '4' && Settings::Get('system.bind_enable') == '0') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 10 = quota -> if quota disabled -> no task
|
// 10 = quota -> if quota disabled -> no task
|
||||||
if ($type == '10' && $settings['system']['diskquota_enabled'] == '0') {
|
if ($type == '10' && Settings::Get('system.diskquota_enabled') == '0') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$del_stmt = Database::prepare("
|
$del_stmt = Database::prepare("
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
function checkLastGuid() {
|
function checkLastGuid() {
|
||||||
|
|
||||||
global $log, $cronlog, $settings;
|
global $log, $cronlog;
|
||||||
|
|
||||||
$mylog = null;
|
$mylog = null;
|
||||||
if (isset($cronlog) && $cronlog instanceof FroxlorLogger) {
|
if (isset($cronlog) && $cronlog instanceof FroxlorLogger) {
|
||||||
@@ -86,10 +86,9 @@ function checkLastGuid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now check if it differs from our settings
|
// now check if it differs from our settings
|
||||||
if ($update_to_guid != $settings['system']['lastguid']) {
|
if ($update_to_guid != Settings::Get('system.lastguid')) {
|
||||||
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to '.$update_to_guid);
|
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to '.$update_to_guid);
|
||||||
saveSetting('system', 'lastguid', $update_to_guid);
|
Settings::Set('system.lastguid', $update_to_guid);
|
||||||
$settings['system']['lastguid'] = $update_to_guid;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
|
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
|
||||||
|
|||||||
@@ -34,9 +34,7 @@
|
|||||||
*/
|
*/
|
||||||
function makeCryptPassword ($password) {
|
function makeCryptPassword ($password) {
|
||||||
|
|
||||||
global $settings;
|
$type = isset(Settings::Get('system.passwordcryptfunc')) ? (int)Settings::Get('system.passwordcryptfunc') : 1;
|
||||||
|
|
||||||
$type = isset($settings['system']['passwordcryptfunc']) ? (int)$settings['system']['passwordcryptfunc'] : 1;
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -15,27 +15,21 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||||
{
|
|
||||||
global $settings, $theme;
|
|
||||||
|
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||||
|
|
||||||
/*
|
// check whether fcgid should be enabled but php-fpm is
|
||||||
* check whether fcgid should be enabled but php-fpm is
|
|
||||||
*/
|
|
||||||
if($fieldname == 'system_mod_fcgid_enabled'
|
if($fieldname == 'system_mod_fcgid_enabled'
|
||||||
&& (int)$newfieldvalue == 1
|
&& (int)$newfieldvalue == 1
|
||||||
&& (int)$settings['phpfpm']['enabled'] == 1
|
&& (int)Settings::Get('phpfpm.enabled') == 1
|
||||||
) {
|
) {
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled');
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled');
|
||||||
}
|
}
|
||||||
/*
|
// check whether php-fpm should be enabled but fcgid is
|
||||||
* check whether php-fpm should be enabled but fcgid is
|
|
||||||
*/
|
|
||||||
elseif($fieldname == 'system_phpfpm_enabled'
|
elseif($fieldname == 'system_phpfpm_enabled'
|
||||||
&& (int)$newfieldvalue == 1
|
&& (int)$newfieldvalue == 1
|
||||||
&& (int)$settings['system']['mod_fcgid'] == 1
|
&& (int)Settings::Get('system.mod_fcgid') == 1
|
||||||
) {
|
) {
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled');
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,28 +15,18 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||||
{
|
|
||||||
global $settings, $theme;
|
if((int)Settings::Get('system.mod_fcgid') == 1) {
|
||||||
if((int)$settings['system']['mod_fcgid'] == 1)
|
// fcgid-configdir has changed -> check against customer-doc-prefix
|
||||||
{
|
if ($fieldname == "system_mod_fcgid_configdir") {
|
||||||
/**
|
|
||||||
* fcgid-configdir has changed ->
|
|
||||||
* check against customer-doc-prefix
|
|
||||||
*/
|
|
||||||
if($fieldname == "system_mod_fcgid_configdir")
|
|
||||||
{
|
|
||||||
$newdir = makeCorrectDir($newfieldvalue);
|
$newdir = makeCorrectDir($newfieldvalue);
|
||||||
$cdir = makeCorrectDir($settings['system']['documentroot_prefix']);
|
$cdir = makeCorrectDir(Settings::Get('system.documentroot_prefix'));
|
||||||
}
|
}
|
||||||
/**
|
// customer-doc-prefix has changed -> check against fcgid-configdir
|
||||||
* customer-doc-prefix has changed ->
|
elseif ($fieldname == "system_documentroot_prefix") {
|
||||||
* check against fcgid-configdir
|
|
||||||
*/
|
|
||||||
elseif($fieldname == "system_documentroot_prefix")
|
|
||||||
{
|
|
||||||
$newdir = makeCorrectDir($newfieldvalue);
|
$newdir = makeCorrectDir($newfieldvalue);
|
||||||
$cdir = makeCorrectDir($settings['system']['mod_fcgid_configdir']);
|
$cdir = makeCorrectDir(Settings::Get('system.mod_fcgid_configdir'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// neither dir can be within the other nor can they be equal
|
// neither dir can be within the other nor can they be equal
|
||||||
@@ -45,14 +35,10 @@ function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfield
|
|||||||
|| $newdir == $cdir
|
|| $newdir == $cdir
|
||||||
) {
|
) {
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidpathcannotbeincustomerdoc');
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidpathcannotbeincustomerdoc');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,9 @@
|
|||||||
|
|
||||||
function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||||
|
|
||||||
global $settings;
|
|
||||||
|
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||||
|
|
||||||
if ((int)$settings['system']['mod_fcgid'] == 1) {
|
if ((int)Settings::Get('system.mod_fcgid') == 1) {
|
||||||
// now check if we enable a webserver != apache
|
// now check if we enable a webserver != apache
|
||||||
if (strtolower($newfieldvalue) != 'apache2') {
|
if (strtolower($newfieldvalue) != 'apache2') {
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenableddeadlock');
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenableddeadlock');
|
||||||
|
|||||||
@@ -17,20 +17,20 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||||
{
|
|
||||||
global $settings, $theme;
|
if (!isset($allnewfieldvalues['customer_mysqlprefix'])) {
|
||||||
if(!isset($allnewfieldvalues['customer_mysqlprefix']))
|
$allnewfieldvalues['customer_mysqlprefix'] = Settings::Get('customer.mysqlprefix');
|
||||||
{
|
|
||||||
$allnewfieldvalues['customer_mysqlprefix'] = $settings['customer']['mysqlprefix'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$returnvalue = array();
|
$returnvalue = array();
|
||||||
if(validateUsername($newfieldvalue, $settings['panel']['unix_names'], 14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true)
|
if (validateUsername(
|
||||||
{
|
$newfieldvalue,
|
||||||
|
Settings::Get('panel.unix_names'),
|
||||||
|
14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true
|
||||||
|
) {
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'accountprefixiswrong');
|
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'accountprefixiswrong');
|
||||||
}
|
}
|
||||||
return $returnvalue;
|
return $returnvalue;
|
||||||
|
|||||||
@@ -26,24 +26,22 @@
|
|||||||
*
|
*
|
||||||
* @return string either the password or an errormessage+exit
|
* @return string either the password or an errormessage+exit
|
||||||
*/
|
*/
|
||||||
function validatePassword($password = null)
|
function validatePassword($password = null) {
|
||||||
{
|
|
||||||
global $settings, $theme;
|
|
||||||
|
|
||||||
if ($settings['panel']['password_min_length'] > 0) {
|
if (Settings::Get('panel.password_min_length') > 0) {
|
||||||
$password = validate(
|
$password = validate(
|
||||||
$password,
|
$password,
|
||||||
$settings['panel']['password_min_length'], /* replacer needs to be password length, not the fieldname */
|
Settings::Get('panel.password_min_length'),
|
||||||
'/^.{'.(int)$settings['panel']['password_min_length'].',}$/D',
|
'/^.{'.(int)Settings::Get('panel.password_min_length').',}$/D',
|
||||||
'notrequiredpasswordlength'
|
'notrequiredpasswordlength'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($settings['panel']['password_regex'] != '') {
|
if (Settings::Get('panel.password_regex') != '') {
|
||||||
$password = validate(
|
$password = validate(
|
||||||
$password,
|
$password,
|
||||||
$settings['panel']['password_regex'],
|
Settings::Get('panel.password_regex'),
|
||||||
$settings['panel']['password_regex'],
|
Settings::Get('panel.password_regex'),
|
||||||
'notrequiredpasswordcomplexity'
|
'notrequiredpasswordcomplexity'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user