From 1c9d76725cb6caa18a905a225f99b46aea917fd2 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 26 Dec 2018 20:54:00 +0100 Subject: [PATCH] get rid of last function file Signed-off-by: Michael Kaufmann --- install/lib/class.FroxlorInstall.php | 3 --- lib/Froxlor/Cron/MasterCron.php | 3 --- lib/Froxlor/UI/Form.php | 12 +++++----- lib/Froxlor/Validate/Check.php | 34 ++++++++++++++++----------- lib/functions/constant.formfields.php | 24 ------------------- lib/functions/constant.logger.php | 19 --------------- tests/bootstrap.php | 3 --- 7 files changed, 26 insertions(+), 72 deletions(-) delete mode 100644 lib/functions/constant.formfields.php delete mode 100644 lib/functions/constant.logger.php diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index 60dee5d8..34a1bbd5 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -103,9 +103,6 @@ class FroxlorInstall $this->_sendHeaders(); // check if we have a valid installation already $this->_checkUserdataFile(); - // include the functions - require $this->_basepath . '/lib/functions/constant.formfields.php'; - require $this->_basepath . '/lib/functions/constant.logger.php'; // include the MySQL-Table-Definitions require $this->_basepath . '/lib/tables.inc.php'; // include language diff --git a/lib/Froxlor/Cron/MasterCron.php b/lib/Froxlor/Cron/MasterCron.php index eb0450cd..48ca32ee 100644 --- a/lib/Froxlor/Cron/MasterCron.php +++ b/lib/Froxlor/Cron/MasterCron.php @@ -189,9 +189,6 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron unset($sql['root_password']); } - // Includes the Functions - require \Froxlor\Froxlor::getInstallDir() . '/lib/functions/constant.formfields.php'; - // Includes the MySQL-Tabledefinitions etc. require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php'; fwrite(self::$debugHandler, 'Table definitions included' . "\n"); diff --git a/lib/Froxlor/UI/Form.php b/lib/Froxlor/UI/Form.php index e8816491..639c7104 100644 --- a/lib/Froxlor/UI/Form.php +++ b/lib/Froxlor/UI/Form.php @@ -135,15 +135,15 @@ class Form foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { if (($plausibility_check = self::checkPlausibilityFormField($fieldname, $fielddetails, $submitted_fields[$fieldname], $submitted_fields)) !== false) { if (is_array($plausibility_check) && isset($plausibility_check[0])) { - if ($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_OK) { + if ($plausibility_check[0] == \Froxlor\Validate\Check::FORMFIELDS_PLAUSIBILITY_CHECK_OK) { // Nothing to do here, everything's okay - } elseif ($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_ERROR) { + } elseif ($plausibility_check[0] == \Froxlor\Validate\Check::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR) { unset($plausibility_check[0]); $error = $plausibility_check[1]; unset($plausibility_check[1]); $targetname = implode(' ', $plausibility_check); \Froxlor\UI\Response::standard_error($error, $targetname); - } elseif ($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION) { + } elseif ($plausibility_check[0] == \Froxlor\Validate\Check::FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION) { unset($plausibility_check[0]); $question = $plausibility_check[1]; unset($plausibility_check[1]); @@ -239,15 +239,15 @@ class Form if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) { if (($plausibility_check = self::checkPlausibilityFormField($fieldname, $fielddetails, $submitted_fields[$fieldname], $submitted_fields)) !== false) { if (is_array($plausibility_check) && isset($plausibility_check[0])) { - if ($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_OK) { + if ($plausibility_check[0] == \Froxlor\Validate\Check::FORMFIELDS_PLAUSIBILITY_CHECK_OK) { // Nothing to do here, everything's okay - } elseif ($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_ERROR) { + } elseif ($plausibility_check[0] == \Froxlor\Validate\Check::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR) { unset($plausibility_check[0]); $error = $plausibility_check[1]; unset($plausibility_check[1]); $targetname = implode(' ', $plausibility_check); \Froxlor\UI\Response::standard_error($error, $targetname); - } elseif ($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION) { + } elseif ($plausibility_check[0] == \Froxlor\Validate\Check::FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION) { unset($plausibility_check[0]); $question = $plausibility_check[1]; unset($plausibility_check[1]); diff --git a/lib/Froxlor/Validate/Check.php b/lib/Froxlor/Validate/Check.php index 2115c98e..79a266bc 100644 --- a/lib/Froxlor/Validate/Check.php +++ b/lib/Froxlor/Validate/Check.php @@ -6,10 +6,16 @@ use Froxlor\Settings; class Check { + const FORMFIELDS_PLAUSIBILITY_CHECK_OK = 0; + + const FORMFIELDS_PLAUSIBILITY_CHECK_ERROR = 1; + + const FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION = 2; + public static function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); $check_array = array( @@ -38,7 +44,7 @@ class Check // the other interface is activated already and STAYS activated if ((int) Settings::Get($check_array[$fieldname]['other_enabled']) == 1) { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, $check_array[$fieldname]['other_enabled_lng'] ); } else { @@ -48,7 +54,7 @@ class Check } else { // not, bot are nogo $returnvalue = $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidandphpfpmnogoodtogether' ); } @@ -74,7 +80,7 @@ class Check if (Validate::validate_ip2($host_entry, true, 'invalidip', true, true) == false && Validate::validateDomain($host_entry) == false && Validate::validateLocalHostname($host_entry) == false && $host_entry != '%') { return array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'invalidmysqlhost', $host_entry ); @@ -82,7 +88,7 @@ class Check } return array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); } @@ -90,12 +96,12 @@ class Check { if (0 == strlen(trim($newfieldvalue)) || Validate::validateDomain($newfieldvalue) === false) { return array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'invalidhostname' ); } else { return array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); } } @@ -143,17 +149,17 @@ class Check // 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) { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidpathcannotbeincustomerdoc' ); } else { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); } } else { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); } @@ -163,14 +169,14 @@ class Check public static function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); if ((int) Settings::Get('system.mod_fcgid') == 1) { // fcgid only works for apache and lighttpd if (strtolower($newfieldvalue) != 'apache2' && strtolower($newfieldvalue) != 'lighttpd') { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenableddeadlock' ); } @@ -188,7 +194,7 @@ class Check $returnvalue = array(); if (Validate::validateUsername($newfieldvalue, Settings::Get('panel.unix_names'), 14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true) { $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_OK + self::FORMFIELDS_PLAUSIBILITY_CHECK_OK ); } else { $errmsg = 'accountprefixiswrong'; @@ -196,7 +202,7 @@ class Check $errmsg = 'mysqlprefixiswrong'; } $returnvalue = array( - FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, + self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, $errmsg ); } diff --git a/lib/functions/constant.formfields.php b/lib/functions/constant.formfields.php deleted file mode 100644 index 55ddb4fb..00000000 --- a/lib/functions/constant.formfields.php +++ /dev/null @@ -1,24 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Functions - * - */ -if (! defined('FORMFIELDS_PLAUSIBILITY_CHECK_OK')) - define('FORMFIELDS_PLAUSIBILITY_CHECK_OK', 0); -if (! defined('FORMFIELDS_PLAUSIBILITY_CHECK_ERROR')) - define('FORMFIELDS_PLAUSIBILITY_CHECK_ERROR', 1); -if (! defined('FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION')) - define('FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION', 2); diff --git a/lib/functions/constant.logger.php b/lib/functions/constant.logger.php deleted file mode 100644 index da6d9527..00000000 --- a/lib/functions/constant.logger.php +++ /dev/null @@ -1,19 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Functions - * - */ - diff --git a/tests/bootstrap.php b/tests/bootstrap.php index a48e10c5..a4e59d86 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -35,9 +35,6 @@ require dirname(__DIR__) . '/vendor/autoload.php'; // include table definitions require dirname(__DIR__) . '/lib/tables.inc.php'; -// include consts -require dirname(__DIR__) . '/lib/functions/constant.formfields.php'; - use Froxlor\Database\Database; use Froxlor\Settings;