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:
@@ -15,27 +15,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
global $settings, $theme;
|
||||
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||
|
||||
$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'
|
||||
&& (int)$newfieldvalue == 1
|
||||
&& (int)$settings['phpfpm']['enabled'] == 1
|
||||
&& (int)Settings::Get('phpfpm.enabled') == 1
|
||||
) {
|
||||
$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'
|
||||
&& (int)$newfieldvalue == 1
|
||||
&& (int)$settings['system']['mod_fcgid'] == 1
|
||||
&& (int)Settings::Get('system.mod_fcgid') == 1
|
||||
) {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled');
|
||||
}
|
||||
|
||||
@@ -15,44 +15,30 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
global $settings, $theme;
|
||||
if((int)$settings['system']['mod_fcgid'] == 1)
|
||||
{
|
||||
/**
|
||||
* fcgid-configdir has changed ->
|
||||
* check against customer-doc-prefix
|
||||
*/
|
||||
if($fieldname == "system_mod_fcgid_configdir")
|
||||
{
|
||||
function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||
|
||||
if((int)Settings::Get('system.mod_fcgid') == 1) {
|
||||
// fcgid-configdir has changed -> check against customer-doc-prefix
|
||||
if ($fieldname == "system_mod_fcgid_configdir") {
|
||||
$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
|
||||
*/
|
||||
elseif($fieldname == "system_documentroot_prefix")
|
||||
{
|
||||
// customer-doc-prefix has changed -> check against fcgid-configdir
|
||||
elseif ($fieldname == "system_documentroot_prefix") {
|
||||
$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
|
||||
if(substr($newdir, 0, strlen($cdir)) == $cdir
|
||||
|| substr($cdir, 0, strlen($newdir)) == $newdir
|
||||
|| $newdir == $cdir
|
||||
if (substr($newdir, 0, strlen($cdir)) == $cdir
|
||||
|| substr($cdir, 0, strlen($newdir)) == $newdir
|
||||
|| $newdir == $cdir
|
||||
) {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidpathcannotbeincustomerdoc');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,9 @@
|
||||
|
||||
function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||
|
||||
global $settings;
|
||||
|
||||
$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
|
||||
if (strtolower($newfieldvalue) != 'apache2') {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenableddeadlock');
|
||||
|
||||
@@ -17,20 +17,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
global $settings, $theme;
|
||||
if(!isset($allnewfieldvalues['customer_mysqlprefix']))
|
||||
{
|
||||
$allnewfieldvalues['customer_mysqlprefix'] = $settings['customer']['mysqlprefix'];
|
||||
function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) {
|
||||
|
||||
if (!isset($allnewfieldvalues['customer_mysqlprefix'])) {
|
||||
$allnewfieldvalues['customer_mysqlprefix'] = Settings::Get('customer.mysqlprefix');
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'accountprefixiswrong');
|
||||
}
|
||||
return $returnvalue;
|
||||
|
||||
@@ -26,24 +26,22 @@
|
||||
*
|
||||
* @return string either the password or an errormessage+exit
|
||||
*/
|
||||
function validatePassword($password = null)
|
||||
{
|
||||
global $settings, $theme;
|
||||
function validatePassword($password = null) {
|
||||
|
||||
if ($settings['panel']['password_min_length'] > 0) {
|
||||
if (Settings::Get('panel.password_min_length') > 0) {
|
||||
$password = validate(
|
||||
$password,
|
||||
$settings['panel']['password_min_length'], /* replacer needs to be password length, not the fieldname */
|
||||
'/^.{'.(int)$settings['panel']['password_min_length'].',}$/D',
|
||||
Settings::Get('panel.password_min_length'),
|
||||
'/^.{'.(int)Settings::Get('panel.password_min_length').',}$/D',
|
||||
'notrequiredpasswordlength'
|
||||
);
|
||||
}
|
||||
|
||||
if ($settings['panel']['password_regex'] != '') {
|
||||
if (Settings::Get('panel.password_regex') != '') {
|
||||
$password = validate(
|
||||
$password,
|
||||
$settings['panel']['password_regex'],
|
||||
$settings['panel']['password_regex'],
|
||||
Settings::Get('panel.password_regex'),
|
||||
Settings::Get('panel.password_regex'),
|
||||
'notrequiredpasswordcomplexity'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user