]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 15 Feb 2023 20:40:30 +0000 (21:40 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 15 Feb 2023 21:30:49 +0000 (22:30 +0100)
- added method FrameworkConfiguration::isEnabled() which requires configuration
  keys like 'is_foo_enabled' while you can just invoke
  $configInstance->isEnabled('foo')
- Added some debug lines
- added missing configuration entries
- Configuration entries like is_<form-name>_captcha_secured_enabled are still missing

14 files changed:
application/tests/config-local.php-dist [new file with mode: 0644]
framework/config-global.php
framework/config/class_FrameworkConfiguration.php
framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php
framework/main/classes/feature/class_FrameworkFeature.php
framework/main/classes/filter/validator/class_EmailValidatorFilter.php
framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php
framework/main/classes/helper/html/blocks/class_HtmlBlockHelper.php
framework/main/classes/helper/html/forms/class_HtmlFormHelper.php
framework/main/classes/output/debug/console/class_DebugConsoleOutput.php
framework/main/classes/rng/class_RandomNumberGenerator.php
framework/main/classes/tools/console/class_ConsoleTools.php
framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php

diff --git a/application/tests/config-local.php-dist b/application/tests/config-local.php-dist
new file mode 100644 (file)
index 0000000..7bb585d
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+
+/**
+ * Local configuration entries which you can customize. Please keep the
+ * comments starting with CFG: as-is or else, the later configuration wizard
+ * (aka. 'admin' project) will not be able to parse it. You need to rename this
+ * file to config-local.php and make in that new file your changes.
+ *
+ * If you want to start an own network (which may accept different types of
+ * objects which would be rejected by the global network) please change
+ * hub_bootstrap_nodes (semicolon-seperated list) to your bootstrapper.
+ *
+ * You can set external_address to a hostname, e.g. me.homelinux.org, which will be
+ * included in the announcement. This is very useful for consumer DSL
+ * connections because they might be disconnected every 24 hours and rotate the
+ * IP number.
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2022 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// Some hub-specific configuration like port hostname where we will listen, etc.
+$cfg = FrameworkBootstrap::getConfigurationInstance();
index 1daa27d5ab99a1526e425deabb2a6e0edc3d18f0..fbf6849673b65adb90e8022fc3d7b326cc7f9bee 100644 (file)
@@ -277,9 +277,6 @@ $cfg->setConfigEntry('hash_extra_mask', '%1s:%2s:%3s'); // 1=salt, 2=extra salt,
 // CFG: HASH-NORMAL-MASK
 $cfg->setConfigEntry('hash_normal_mask', '%1s:%2s'); // 1=salt, 2=plain password/string
 
-// CFG: IS-SINGLE-SERVER
-$cfg->setConfigEntry('is_single_server', 'Y');
-
 // CFG: POST-REGISTRATION-CLASS
 $cfg->setConfigEntry('post_registration_class', 'Org\Mxchange\CoreFramework\Action\PostRegistration\Login\LoginAfterRegistrationAction');
 
@@ -301,12 +298,6 @@ $cfg->setConfigEntry('cookie_domain', FrameworkBootstrap::detectDomain()); // Is
 // CFG: COOKIE-SSL
 $cfg->setConfigEntry('cookie_ssl', FrameworkBootstrap::isHttpSecured());
 
-// CFG: CRYPT-FIXED-SALT
-$cfg->setConfigEntry('crypt_fixed_salt', 'N');
-
-// CFG: DB-UPDATE-PRIMARY-FORCED
-$cfg->setConfigEntry('db_update_primary_forced', 'Y');
-
 // CFG: GERMAN-DATE-TIME
 $cfg->setConfigEntry('german_date_time', "%3\$s.%2\$s.%1\$s, %4\$s:%5\$s:%6\$s");
 
@@ -331,11 +322,11 @@ $cfg->setConfigEntry('local_file_database_class', 'Org\Mxchange\CoreFramework\Da
 // CFG: COMPRESSOR-CHANNEL-CLASS
 $cfg->setConfigEntry('compressor_channel_class', 'Org\Mxchange\CoreFramework\Middleware\Compressor\CompressorChannel');
 
-// CFG: DEBUG-HTML-OUTPUT-TIMINGS
-$cfg->setConfigEntry('debug_html_output_timings', 'N');
+// CFG: IS-DEBUG-HTML-OUTPUT-TIMINGS-ENABLED
+$cfg->setConfigEntry('is_debug_html_output_timings_enabled', false);
 
-// CFG: DEBUG-CONSOLE-OUTPUT-TIMINGS
-$cfg->setConfigEntry('debug_console_output_timings', 'Y');
+// CFG: IS-DEBUG-CONSOLE-OUTPUT-TIMINGS-ENABLED
+$cfg->setConfigEntry('is_debug_console_output_timings_enabled', true);
 
 // CFG: PROXY-HOST
 $cfg->setConfigEntry('proxy_host', '');
@@ -349,9 +340,6 @@ $cfg->setConfigEntry('proxy_username', '');
 // CFG: PROXY-PASSWORD
 $cfg->setConfigEntry('proxy_password', '');
 
-// CFG: PROXY-CONNECT-METHOD
-$cfg->setConfigEntry('proxy_connect_method', 'Y');
-
 // CFG: HOSTNAME-FILE
 $cfg->setConfigEntry('hostname_file', '/etc/hostname');
 
@@ -483,3 +471,54 @@ $cfg->setConfigEntry('developer_mode_enabled', true);
 
 // CFG: CRYPTO-HASH-FUNCTION-NAME
 $cfg->setConfigEntry('crypto_hash_function_name', 'sha256');
+
+/**
+ * -------------------------------------------------------------
+ * Boolean is_*_enabled configuration keys
+ * -------------------------------------------------------------
+ */
+
+// CFG: IS-REGISTER-EMAIL-UNIQUE-ENABLED
+$cfg->setConfigEntry('is_register_email_unique_enabled', true);
+
+// CFG: IS-BLOCK-SHOWS-REGISTRATION-ENABLED
+$cfg->setConfigEntry('is_block_shows_registration_enabled', true);
+
+// CFG: IS-REGISTER-REQUIRES-EMAIl-ENABLED
+$cfg->setConfigEntry('is_register_requires_email_enabled', true);
+
+// CFG: IS-REGISTER-INCLUDES-PROFILE-ENABLED
+$cfg->setConfigEntry('is_register_includes_profile_enabled', true);
+
+// CFG: IS-REGISTER-PERSONAL-DATA-ENABLED
+$cfg->setConfigEntry('is_register_personal_data_enabled', true);
+
+// CFG: IS-PROFILE-INCLUDES-BIRTHDAY-ENABLED
+$cfg->setConfigEntry('is_profile_includes_birthday_enabled', true);
+
+// CFG: IS-USER-LOGIN-ENABLED
+$cfg->setConfigEntry('is_user_login_enabled', true);
+
+// CFG: IS-GUEST-LOGIN-ENABLED
+$cfg->setConfigEntry('is_guest_login_enabled', true);
+
+// CFG: IS-EMAIL-CHANGE-CONFIRMATION-ENABLED
+$cfg->setConfigEntry('is_email_change_confirmation_enabled', true);
+
+// CFG: IS-EMAIL-CHANGE-ENABLED
+$cfg->setConfigEntry('is_email_change_enabled', true);
+
+// CFG: IS-REFILL-PAGE-ACTIVE-ENABLED
+$cfg->setConfigEntry('is_refill_page_active_enabled', true);
+
+// CFG: IS-PROXY-CONNECT-METHOD-ENABLED
+$cfg->setConfigEntry('is_proxy_connect_method_enabled', true);
+
+// CFG: IS-SINGLE-SERVER-ENABLED
+$cfg->setConfigEntry('is_single_server_enabled', true);
+
+// CFG: IS-CRYPT-FIXED-SALT-ENABLED
+$cfg->setConfigEntry('is_crypt_fixed_salt_enabled', false);
+
+// CFG: IS-DB-UPDATE-PRIMARY-FORCED-ENABLED
+$cfg->setConfigEntry('is_db_update_primary_forced_enabled', true);
index 7375aa0433c26404129ff67411f8b4ec0009818b..b4696e1b660672fb92d4d61fcf6062012352000f 100644 (file)
@@ -13,6 +13,7 @@ use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
 
 // Import SPL stuff
 use \InvalidArgumentException;
+use \UnexpectedValueException;
 
 /**
  * A class for the configuration stuff implemented in a singleton design pattern
@@ -221,6 +222,41 @@ class FrameworkConfiguration implements Registerable {
                //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
        }
 
+       /**
+        * Checks if a configuration entry is_*_enabled set to 'Y'
+        *
+        * @param       $keyPart        Configuration to expand with is_$keyPart_enabled
+        * @return      $enabled        Whether it has been set to Y or N
+        * @throws      InvalidArgumentException        If a parameter is invalid
+        * @throws      UnexpectedValueException        If a returned value is of an unexpected type or value
+        */
+       public function isEnabled (string $keyPart) {
+               // Validate parameters
+               //* NOISY-DEBUG: */ printf('[%s:%d]: keyPart=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $keyPart);
+               if (empty($keyPart)) {
+                       // Entry is empty
+                       throw new InvalidArgumentException('Parameter "keyPart" is empty', self::EXCEPTION_CONFIG_KEY_IS_EMPTY);
+               }
+
+               // Construct final config key
+               $configKey = sprintf('is_%s_enabled', $keyPart);
+
+               // Get value from it
+               //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s' . PHP_EOL, __METHOD__, __LINE__, $configKey);
+               $isEnabled = $this->getConfigEntry($configKey);
+
+               // Is it Y/N?
+               //* NOISY-DEBUG: */ printf('[%s:%d]: isEnabled[]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($isEnabled));
+               if (!is_bool($isEnabled)) {
+                       // Throw exception
+                       throw new UnexpectedValueException(sprintf('isEnabled[]=%s is unexpected', gettype($isEnabled)));
+               }
+
+               // Return it
+               //* NOISY-DEBUG: */ printf('[%s:%d]: isEnabled=%d - EXIT!' . PHP_EOL, __METHOD__, __LINE__, intval($isEnabled));
+               return $isEnabled;
+       }
+
        /**
         * Generates a code for hashes from this class
         *
index 41648caa23b500a92999f4570b8fd086fd7cf543..63f0ae6094231191e5157f87d50a1e16b3c30302 100644 (file)
@@ -696,7 +696,7 @@ Loaded includes:
                        }
                } else {
                        // Are debug times enabled?
-                       if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings') == 'Y') {
+                       if (FrameworkBootstrap::getConfigurationInstance()->isEnabled('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings')) {
                                // Prepent it
                                $message = $this->getPrintableExecutionTime() . $message;
                        }
index 964c1b738821f549fbcb79f68676d41f5b25a24f..a4ef4ffcc0f6b8807063f2e19d006ca2d081fcc2 100644 (file)
@@ -330,7 +330,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac
                        // Then create the info file
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CACHED-LFDB: Creating info table for tableName=%s ...', $tableName));
                        $this->createTableInfoFile($dataSetInstance);
-               } elseif ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('db_update_primary_forced') == 'Y') && ($dataSetInstance->getPrimaryKey() != $this->tableInfo[$tableName]['primary'])) {
+               } elseif (FrameworkBootstrap::getConfigurationInstance()->isEnabled('db_update_primary_forced') && $dataSetInstance->getPrimaryKey() != $this->tableInfo[$tableName]['primary']) {
                        // Set the array element
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CACHED-LFDB: Setting primaryKey=%s for tableName=%s ...', $dataSetInstance->getPrimaryKey(), $tableName));
                        $this->tableInfo[$tableName]['primary'] = $dataSetInstance->getPrimaryKey();
index 1bcec3f8822eb30bab2181bd2e3c7bd6ebe5924b..db57e5cc6759c3bd90bb775397c411eb0340c5e6 100644 (file)
@@ -9,6 +9,9 @@ use Org\Mxchange\CoreFramework\Loader\NoClassException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Utils\Strings\StringUtils;
 
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * The general feature management class. No instance is needed as this class
  * has only public methods that are static.
@@ -73,8 +76,16 @@ class FrameworkFeature extends BaseFrameworkSystem {
         *
         * @param       $featureName    Name of the feature to be checked
         * @return      $isEnabled              Whether the given feature is enabled
+        * @throws      InvalidArgumentException        If a parameter is invalid
         */
        public static function isFeatureEnabled (string $featureName) {
+               // Check parameter
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName));
+               if (empty($featureName)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "featureName" is empty');
+               }
+
                // Is the cache set?
                if (!isset(self::$enabledFeatures[$featureName]['is_enabled'])) {
                        // Generate config key
@@ -85,6 +96,7 @@ class FrameworkFeature extends BaseFrameworkSystem {
                }
 
                // Return "cached" status
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: is_enabled[%s]=%d - EXIT!', $featureName, intval(self::$enabledFeatures[$featureName]['is_enabled'])));
                return self::$enabledFeatures[$featureName]['is_enabled'];
        }
 
@@ -97,10 +109,17 @@ class FrameworkFeature extends BaseFrameworkSystem {
         *
         * @param       $featureName    Name of the feature to be checked on availability
         * @return      $isAvailable    Whether the given feature is available
+        * @throws      InvalidArgumentException        If a parameter is invalid
         */
        public static function isFeatureAvailable (string $featureName) {
-               // Is the cache set?
+               // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FRAMEWORK-FEATURE: featureName=%s - CALLED!', $featureName));
+               if (empty($featureName)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "featureName" is empty');
+               }
+
+               // Is the cache set?
                if (!isset(self::$enabledFeatures[$featureName]['is_available'])) {
                        // Default is not available
                        self::$enabledFeatures[$featureName]['is_available'] = false;
index da354037262ef8411c8a261d9fe87bd842439a0e..b9202e8e4482d350f126b9260d8eaba1acc9aec0 100644 (file)
@@ -73,7 +73,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                $email = $requestInstance->getRequestElement('email');
 
                // Is the Email set?
-               if ((is_null($email)) || (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_email_unique') == 'Y')) {
+               if ((is_null($email)) || (FrameworkBootstrap::getConfigurationInstance()->isEnabled('register_email_unique'))) {
                        // Try it again
                        $email1 = $requestInstance->getRequestElement('email1');
                        $email2 = $requestInstance->getRequestElement('email2');
index 89f0a2d5a14cd94ce3de22c1526c38d6b6c752d8..5e92facf6a123939db1e33af295551f000697e03 100644 (file)
@@ -79,12 +79,10 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl
                }
 
                // Create config entry
-               $configKey = sprintf('%s_captcha_secured',
-                       $requestInstance->getRequestElement('form')
-               );
+               $configKey = sprintf('%s_captcha_secured', $requestInstance->getRequestElement('form'));
 
                // Is the CAPTCHA enabled?
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configKey) != 'Y') {
+               if (FrameworkBootstrap::getConfigurationInstance()->isEnabled($configKey)) {
                        // Not enabled, so don't check
                        return;
                }
index fd717dccb96dc229a441fea6ca2c043505f07f13..1ecb84035ac9400c0ffa720e50cbe2ce03b50103 100644 (file)
@@ -91,7 +91,7 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $withRegistration       Whether with registration date
         */
        public function ifIncludeRegistrationStamp () {
-               $withRegistration = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('block_shows_registration') == 'Y');
+               $withRegistration = FrameworkBootstrap::getConfigurationInstance()->isEnabled('block_shows_registration');
                return $withRegistration;
        }
 
index 691728bfeb7249eebbe019a720eb09dd0bd5e6a8..dd6fc62fb202e469b43a98cb4d55159e2299aaf3 100644 (file)
@@ -766,7 +766,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether the email address is required
         */
        public function ifRegisterRequiresEmailVerification () {
-               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_requires_email') == 'Y');
+               $required = FrameworkBootstrap::getConfigurationInstance()->isEnabled('register_requires_email');
                return $required;
        }
 
@@ -776,7 +776,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether profile data shall be asked
         */
        public function ifRegisterIncludesProfile () {
-               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_includes_profile') == 'Y');
+               $required = FrameworkBootstrap::getConfigurationInstance()->isEnabled('register_includes_profile');
                return $required;
        }
 
@@ -786,7 +786,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isSecured      Whether this form is secured by a CAPTCHA
         */
        public function ifFormSecuredWithCaptcha () {
-               $isSecured = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getFormName() . '_captcha_secured') == 'Y');
+               $isSecured = FrameworkBootstrap::getConfigurationInstance()->isEnabled($this->getFormName() . '_captcha_secured');
                return $isSecured;
        }
 
@@ -796,7 +796,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether personal data shall be asked
         */
        public function ifRegisterIncludesPersonaData () {
-               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_personal_data') == 'Y');
+               $required = FrameworkBootstrap::getConfigurationInstance()->isEnabled('register_personal_data');
                return $required;
        }
 
@@ -806,7 +806,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether birthday shall be asked
         */
        public function ifProfileIncludesBirthDay () {
-               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('profile_includes_birthday') == 'Y');
+               $required = FrameworkBootstrap::getConfigurationInstance()->isEnabled('profile_includes_birthday');
                return $required;
        }
 
@@ -816,7 +816,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnique
         */
        public function ifEmailMustBeUnique () {
-               $isUnique = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_email_unique') == 'Y');
+               $isUnique = FrameworkBootstrap::getConfigurationInstance()->isEnabled('register_email_unique');
                return $isUnique;
        }
 
@@ -826,7 +826,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether the specified chat protocol is enabled
         */
        public function ifChatEnabled (string $chatProtocol) {
-               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('chat_enabled_' . $chatProtocol) == 'Y');
+               $required = FrameworkBootstrap::getConfigurationInstance()->isEnabled('chat_protocol_' . $chatProtocol);
                return $required;
        }
 
@@ -836,7 +836,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isEnabled      Whether the login is enabled or disabled
         */
        public function ifLoginIsEnabled () {
-               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_enabled') == 'Y');
+               $isEnabled = FrameworkBootstrap::getConfigurationInstance()->isEnabled('user_login');
                return $isEnabled;
        }
 
@@ -846,7 +846,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isEnabled      Whether the login shall be done by username
         */
        public function ifLoginWithUsername () {
-               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type') == "username");
+               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type') == 'username');
                return $isEnabled;
        }
 
@@ -856,7 +856,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isEnabled      Whether the login shall be done by email
         */
        public function ifLoginWithEmail () {
-               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type') == "email");
+               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type') == 'email');
                return $isEnabled;
        }
 
@@ -866,7 +866,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isAllowed      Whether guest login is allowed
         */
        public function ifGuestLoginAllowed () {
-               $isAllowed = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('guest_login_allowed') == 'Y');
+               $isAllowed = FrameworkBootstrap::getConfigurationInstance()->isEnabled('guest_login');
                return $isAllowed;
        }
 
@@ -876,7 +876,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $requireConfirm         Whether email change must be confirmed
         */
        public function ifEmailChangeRequireConfirmation () {
-               $requireConfirm = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('email_change_confirmation') == 'Y');
+               $requireConfirm = FrameworkBootstrap::getConfigurationInstance()->isEnabled('email_change_confirmation');
                return $requireConfirm;
        }
 
@@ -896,7 +896,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $emailChange    Whether changing email address is allowed
         */
        public function ifEmailChangeAllowed () {
-               $emailChange = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('email_change_allowed') == 'Y');
+               $emailChange = FrameworkBootstrap::getConfigurationInstance()->isEnabled('email_change');
                return $emailChange;
        }
 
@@ -937,7 +937,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $refillActive   Whether the refill page is active
         */
        public function ifRefillPageActive () {
-               $refillActive = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('refill_page_active') == 'Y');
+               $refillActive = FrameworkBootstrap::getConfigurationInstance()->isEnabled('refill_page_active');
                return $refillActive;
        }
 
index 5602c6ed9566eda3706f0b1cc3a531a9694bb672..1e7646d80f821e392be90f7564b87be634c04da8 100644 (file)
@@ -36,7 +36,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
        /**
         * Cached configuration entry 'debug_*_output_timings'
         */
-       private $debugOutputTimings = 'N';
+       private $isDebugOutputTimingsEnabled = FALSE;
 
        /**
         * Protected constructor
@@ -48,7 +48,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
                parent::__construct(__CLASS__);
 
                // Cache configuration entry
-               $this->debugOutputTimings = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings');
+               $this->isDebugOutputTimingsEnabled = FrameworkBootstrap::getConfigurationInstance()->isEnabled('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings');
        }
 
        /**
@@ -79,7 +79,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
                }
 
                // Are debug times enabled?
-               if ($this->debugOutputTimings == 'Y') {
+               if ($this->isDebugOutputTimingsEnabled) {
                        // Output it first
                        $output = $this->getPrintableExecutionTime() . $output;
                }
index 91c40bb6968a2375ac00baac7d94b6027e9dc121..a8270adf294e313d058e7721df92cd34acd4567d 100644 (file)
@@ -119,7 +119,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
                $serverIp = 'cluster';
 
                // Do we have a single server?
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('is_single_server') == 'Y') {
+               if (FrameworkBootstrap::getConfigurationInstance()->isEnabled('single_server')) {
                        // Then use that IP for extra security
                        $serverIp = FrameworkBootstrap::detectServerAddress();
                }
@@ -214,7 +214,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
                $key = md5($this->getExtraSalt());
 
                // Get key
-               if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('crypt_fixed_salt') == 'Y') {
+               if (FrameworkBootstrap::getConfigurationInstance()->isEnabled('crypt_fixed_salt')) {
                        $key = md5($this->getFixedSalt());
                }
 
index b46f50b8828fed9bb2d04debbadea1a49c77026e..a390e2ff2d2a4cc6bdef32d277c5cb829d049c1e 100644 (file)
@@ -377,7 +377,7 @@ class ConsoleTools extends BaseFrameworkSystem {
                // Do we use proxy?
                if ($helperInstance->isProxyUsed() === true) {
                        // CONNECT method?
-                       if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_connect_method') == 'Y') {
+                       if (FrameworkBootstrap::getConfigurationInstance()->isEnabled('proxy_connect_method')) {
                                // Setup proxy tunnel
                                $response = $helperInstance->setupProxyTunnel('shipsimu.org', 80, $socketResource);
 
index d2b92e22b580db795a784285a08faef54bd9b13b..73b933356ffd1387299a5fa13ae953a87d4ce5fe 100644 (file)
@@ -64,18 +64,21 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
         * @param       $requestInstance        An instance of a class with an Requestable interface
         * @param       $responseInstance       An instance of a class with an Responseable interface
         * @return      void
-        * @todo        0% done
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Init counter
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TESTS-CONFIGURATION-LOADABLE-CLASSES-FILTER: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
                $passed = 0;
                $failed = 0;
+               $skipped = 0;
 
                // Loop through all configuration keys
                foreach (FrameworkBootstrap::getConfigurationInstance()->getConfigurationArray() as $configKey => $configValue) {
                        // Key must end with _class
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TESTS-CONFIGURATION-LOADABLE-CLASSES-FILTER: configKey[%s]=%s,configValue[%s]=%s', gettype($configKey), $configKey, gettype($configValue), $configValue));
                        if (substr($configKey, -6, 6) != '_class') {
                                // Skip this
+                               $skipped++;
                                continue;
                        }
 
@@ -87,14 +90,14 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
                                // Is the config entry valid and class is there?
                                if (!is_string($configValue)) {
                                        // Is not a string
-                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('configValue=%s has unexpected type "%s". FAILED', $configValue, gettype($configValue)));
+                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('configValue=%s has unexpected type "%s", required: string - FAILED!', $configValue, gettype($configValue)));
 
                                        // Skip further tests
                                        $failed++;
                                        continue;
                                } elseif (!class_exists($configValue)) {
                                        // Class not found
-                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" not found. FAILED', $configValue));
+                                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" not found. FAILED!', $configValue));
 
                                        // Skip further tests
                                        $failed++;
@@ -115,7 +118,7 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements
                }
 
                // Output result
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Test result: %d okay, %d failed (%0.02f%% passed)', $passed, $failed, ($passed / ($passed + $failed) * 100)));
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Test result: %d okay, %d failed (%0.02f%% passed), %d skipped - EXIT!', $passed, $failed, ($passed / ($passed + $failed) * 100), $skipped));
        }
 
 }