From: Roland Häder Date: Thu, 18 May 2017 20:23:46 +0000 (+0200) Subject: Rewrite continued: X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=146c8b3c929a1b0ab17d6605e5ae949ac44899c1 Rewrite continued: - the framework now attempts to initialize the application more OOP-ed - this is done by calling 3 simple methods: + FrameworkBootstrap::initFramework(); + FrameworkBootstrap::prepareApplication(); + FrameworkBootstrap::startApplication(); - initFramework: 3 simple steps again: + scanFrameworkClasses: scans for framework-related classes, interfaces and exceptions + determineRequestType: determines request-type (console, html) and loads all given parameter into the initialized request class. It also initializes the response instance + validateApplicationParameter: validates the parameter 'app' if it is there and points to a valid application (very basic check, more later on) - prepareApplication: Prepares detected application by attempting to load all required include files and only optional if present. Please note that some files are now deprecated and should be ported to the new methods (see below) - startApplication: Starts the application by calling 3 methods: + setupApplicationData: replacement for data.php, sets all application's data. Please don't set any configuration stuff here, this is still done in config.php! + initApplication: Calls some additional methods to initialize application. Here is a good place to init database instance by calling the shiny new method initDatabaseInstance(). + launchApplication: Still old method name which starts the application. Please remove any request/response-init stuff from here as it is now generically done in FrameworkBootstrap - include files in framework/database/ are now all deprecated - renamed framework/config.inc.php -> framework/config-global.php - PrimeraPortal's API is history, so let us remove the obsolete file here, too - some "contrib" files updated - updated TODOs.txt - moved rand.php to contrib/ folder Signed-off-by: Roland Häder --- diff --git a/application/tests/class_ApplicationHelper.php b/application/tests/class_ApplicationHelper.php index 5d3c60dc..6b234b43 100644 --- a/application/tests/class_ApplicationHelper.php +++ b/application/tests/class_ApplicationHelper.php @@ -1,11 +1,14 @@ setAppName('Unit tests and more'); + $this->setAppVersion('0.0.0'); + $this->setAppShortName('tests'); + } + + /** + * 2) Does initial stuff before starting the application * * @return void */ - public final function entryPoint () { - // Set this application in registry - Registry::getRegistry()->addInstance('app', $this); + public function initApplication () { + // Get config instance + $cfg = FrameworkConfiguration::getSelfInstance(); - // Default response is console - $response = self::getResponseTypeFromSystem(); - $responseType = self::getResponseTypeFromSystem(); + // Initialize output system + self::createDebugInstance('ApplicationHelper'); - // Create a new request object - $requestInstance = ObjectFactory::createObjectByName(sprintf('CoreFramework\Request\%sRequest', self::convertToClassName($response))); + /* + * This application needs a database connection then simply call init + * method. + */ + FrameworkBootstrap::initDatabaseInstance(); - // Remember request instance here - $this->setRequestInstance($requestInstance); + // Register core tests + ClassLoader::registerTestsPath('framework/main/tests'); - // Do we have another response? - if ($requestInstance->isRequestElementSet('request')) { - // Then use it - $response = strtolower($requestInstance->getRequestElement('request')); - $responseType = $response; - } // END - if + // Register own tests + ClassLoader::registerTestsPath('application/tests/tests'); - // ... and a new response object - $responseClass = sprintf('CoreFramework\Response\%sResponse', self::convertToClassName($response)); - $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this)); + // Scan for them now + ClassLoader::scanTestsClasses(); + } - // Remember response instance here - $this->setResponseInstance($responseInstance); + /** + * 3) Launches the application + * + * @return void + */ + public function launchApplication () { + // Get request/response instances + $requestInstance = FrameworkBootstrap::getRequestInstance(); + $responseInstance = FrameworkBootstrap::getResponseInstance(); // Get the parameter from the request $commandName = $requestInstance->getRequestElement('command'); @@ -205,7 +225,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica self::convertToClassName(sprintf( '%s_%s_controller_resolver', $this->getAppShortName(), - $responseType + FrameworkBootstrap::getRequestTypeFromSystem() )) ); $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this)); @@ -242,7 +262,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica * @return $masterTemplateName Name of the master template */ public function buildMasterTemplateName () { - return 'node_main'; + return 'tests_main'; } /** diff --git a/application/tests/data.php b/application/tests/data.php index e1fd3230..7d6dceec 100644 --- a/application/tests/data.php +++ b/application/tests/data.php @@ -1,37 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * 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 . - */ - -// Get an instance of the helper -$app = call_user_func_array( - array('CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance'), - array() -); - -// Set application name and version -$app->setAppName('Unit tests and more'); -$app->setAppVersion('0.0.0'); -$app->setAppShortName('tests'); +// @DEPRECATED diff --git a/application/tests/exceptions.php b/application/tests/exceptions.php index 7248c82c..ed824148 100644 --- a/application/tests/exceptions.php +++ b/application/tests/exceptions.php @@ -89,7 +89,7 @@ Backtrace: print($message); } elseif (is_object($exceptionInstance)) { // Output more details - printf('exceptionInstance=%s', print_r($exceptionInstance, TRUE)); + printf('exceptionInstance=%s', print_r($exceptionInstance, true)); } else { /* * Invalid exception instance detected! Do *only* throw exceptions that @@ -101,7 +101,7 @@ Backtrace: } // Error handler -function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) { +function test_error_handler ($errno, $errstr, $errfile, $errline, array $errcontext) { // Construct the message $message = sprintf('File: %s, Line: %s, Code: %s, Message: %s', basename($errfile), @@ -115,7 +115,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) } // END - function // Assertion handler -function __assertHandler ($file, $line, $code) { +function test_assert_handler ($file, $line, $code) { // Empty code? if ($code === '') { $code = 'Unknown'; @@ -136,14 +136,14 @@ function __assertHandler ($file, $line, $code) { } // END - function // Set error handler -//set_error_handler('__errorHandler'); +//set_error_handler('test_error_handler'); // Set the new handler set_exception_handler('tests_exception_handler'); // Init assert handling -assert_options(ASSERT_ACTIVE , TRUE); -assert_options(ASSERT_WARNING , FALSE); -assert_options(ASSERT_BAIL , TRUE); -assert_options(ASSERT_QUIET_EVAL, FALSE); -assert_options(ASSERT_CALLBACK , '__assertHandler'); +assert_options(ASSERT_ACTIVE , true); +assert_options(ASSERT_WARNING , false); +assert_options(ASSERT_BAIL , true); +assert_options(ASSERT_QUIET_EVAL, false); +assert_options(ASSERT_CALLBACK , 'test_assert_handler'); diff --git a/application/tests/init.php b/application/tests/init.php index 6266e1c8..7d6dceec 100644 --- a/application/tests/init.php +++ b/application/tests/init.php @@ -1,51 +1,2 @@ - * @version 0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 . - */ - -// Scan for application's classes, exceptions and interfaces -ClassLoader::scanApplicationClasses(); - -// Get config instance -$cfg = FrameworkConfiguration::getSelfInstance(); - -// Initialize output system -ApplicationHelper::createDebugInstance('ApplicationHelper'); - -/* - * This application needs a database connection then we have to simply include - * the framework/database.php script - */ -require $cfg->getConfigEntry('framework_base_path') . 'database.php'; - -// Register core tests -ClassLoader::registerTestsPath('framework/main/tests'); - -// Register own tests -ClassLoader::registerTestsPath('application/tests/tests'); - -// Scan for them now -ClassLoader::scanTestsClasses(); +// @DEPRECATED diff --git a/application/tests/rand.php b/application/tests/rand.php deleted file mode 100644 index ddd36e68..00000000 --- a/application/tests/rand.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * 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 . - */ - -// Is there an application helper instance? We need the method main() for -// maining the application -$app = call_user_func_array( - array( - 'CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance' - ), array() -); - -// Some sanity checks -if ((empty($app)) || (is_null($app))) { - // Something went wrong! - ApplicationEntryPoint::app_exit(sprintf("[Main:] The application %s could not be launched because the helper class %s is not loaded.", - $application, - 'CoreFramework\Helper\Application\ApplicationHelper' - )); -} elseif (!is_object($app)) { - // No object! - ApplicationEntryPoint::app_exit(sprintf("[Main:] The application %s could not be launched because 'app' is not an object.", - $application - )); -} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) { - // Method not found! - ApplicationEntryPoint::app_exit(sprintf("[Main:] The application %s could not be launched because the method %s is missing.", - $application, - FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method') - )); -} - -// Call user function -call_user_func_array(array($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')), array()); +// @DEPRECATED diff --git a/contrib/benchmarks/array_serialization.php b/contrib/benchmarks/array_serialization.php index 588af616..cb7864ac 100644 --- a/contrib/benchmarks/array_serialization.php +++ b/contrib/benchmarks/array_serialization.php @@ -18,18 +18,18 @@ $array = array( // Now test with serialize() print 'serialize() ...' . PHP_EOL; -$time = microtime(TRUE); +$time = microtime(true); for ($idx = 0; $idx < $iter; $idx++) { $serialized = serialize($array); } -$diff1 = microtime(TRUE) - $time; +$diff1 = microtime(true) - $time; // Now test with json_encode() print 'json_encode() ...' . PHP_EOL; -$time = microtime(TRUE); +$time = microtime(true); for ($idx = 0; $idx < $iter; $idx++) { $json_encoded = json_encode($array); } -$diff2 = microtime(TRUE) - $time; +$diff2 = microtime(true) - $time; print 'diff1=' . $diff1 . ',diff2=' . $diff2 . PHP_EOL; diff --git a/contrib/chash/chash.php b/contrib/chash/chash.php index 41af8db1..1c4965cb 100644 --- a/contrib/chash/chash.php +++ b/contrib/chash/chash.php @@ -1,7 +1,7 @@ = $GLOBALS['flush_file_time']) { @@ -484,7 +484,7 @@ while (TRUE) { } // END - if // Time spend from last found block - $testTime = abs(microtime(TRUE) - $GLOBALS['found_time']); + $testTime = abs(microtime(true) - $GLOBALS['found_time']); // Is the last found time to far away? if ($testTime >= $GLOBALS['restart_search_time']) { @@ -501,7 +501,7 @@ while (TRUE) { foreach ($block as $hash) { if (!isset($hash['root_hash'])) { // Bad file - die('INCONSISTENCY: hash=' . print_r($hash, TRUE)); + die('INCONSISTENCY: hash=' . print_r($hash, true)); } // END - if if (isset($rootHashes[$hash['root_hash']])) { @@ -544,7 +544,7 @@ while (TRUE) { print ('idx=' . $idx . ',modulaHash=' . $GLOBALS['root_hash'] . ' - Is now new root hash!' . PHP_EOL); // Reset "found time" (when a hash was found) - $GLOBALS['found_time'] = microtime(TRUE); + $GLOBALS['found_time'] = microtime(true); // Re-initialize nonce initNonce(); @@ -568,7 +568,7 @@ while (TRUE) { // If the iteration is zero, then no hash is found if ($GLOBALS['iteration'] == 0) { // Bad hash found - $timeBadHashes += abs(microtime(TRUE) - $timeHash); + $timeBadHashes += abs(microtime(true) - $timeHash); // And next round print('BAD:nonce=' . $GLOBALS['nonce'] . PHP_EOL); @@ -586,7 +586,7 @@ while (TRUE) { } // END - while // Time taken for one - $timeBlock = abs(microtime(TRUE) - $timeBlock); + $timeBlock = abs(microtime(true) - $timeBlock); // Calculate reward $reward = abs($timeBlock - $timeBadHashes) / $hashrate * $GLOBALS['hashes_block'] / $GLOBALS['block_size'] * 1000; @@ -610,7 +610,7 @@ while (TRUE) { $blockValue = $GLOBALS['total_reward'] / $GLOBALS['total_blocks'] * $GLOBALS['total_hashes'] / ($GLOBALS['block_size'] * $GLOBALS['total_blocks']); // Calculate reward per hour (= 3600 seconds) - $rewardPerHour = $GLOBALS['total_reward'] / abs(microtime(TRUE) - START_TIME) * 3600; + $rewardPerHour = $GLOBALS['total_reward'] / abs(microtime(true) - START_TIME) * 3600; print ('totalReward=' . $GLOBALS['total_reward'] . ',blockValue=' . $blockValue . ',rewardPerHour=' . $rewardPerHour . PHP_EOL); } // END - while diff --git a/contrib/rand.php b/contrib/rand.php new file mode 100644 index 00000000..ddd36e68 --- /dev/null +++ b/contrib/rand.php @@ -0,0 +1,25 @@ +debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] fieldName=' . $fieldName . ' is not set! - @TODO'); -./inc/main/classes/helper/html/forms/class_HtmlFormHelper.php:102: * @todo Add some unique PIN here to bypass problems with some browser and/or extensions -./inc/main/classes/helper/html/forms/class_HtmlFormHelper.php:621: * @todo Add checking if sub option is already added -./inc/main/classes/helper/html/forms/class_HtmlFormHelper.php:649: * @todo Add checking if sub option is already added -./inc/main/classes/helper/html/forms/class_HtmlFormHelper.php:683: // @TODO We need to log this later -./inc/main/classes/helper/html/forms/class_HtmlFormHelper.php:852: * @todo Implement check if rules have been changed -./inc/main/classes/helper/html/links/class_HtmlLinkHelper.php:184: * @todo Completely unimplemented -./inc/main/classes/images/class_BaseImage.php:172: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:182: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:192: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:202: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:212: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:231: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:250: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:261: * @todo Find something usefull for this method. -./inc/main/classes/images/class_BaseImage.php:271: * @todo Find something usefull for this method. -./inc/main/classes/index/class_BaseIndex.php:150: * @todo Currently the index file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole index file. -./inc/main/classes/listener/class_BaseListener.php:346: // @TODO On some systems it is 134, on some 107? -./inc/main/classes/listener/class_BaseListener.php:519: // @TODO Does this work on Windozer boxes??? -./inc/main/classes/lists/class_BaseList.php:305: // @TODO Extend this somehow? -./inc/main/classes/lists/groups/class_ListGroupList.php:61: * @todo 0% done -./inc/main/classes/mailer/debug/class_DebugMailer.php:124: * @todo 0% done -./inc/main/classes/menu/class_BaseMenu.php:65: // Log exception @TODO Maybe to intrusive? -./inc/main/classes/output/console/class_ConsoleOutput.php:56: // @TODO Need to rewrite this to $requestInstance->addHeader() -./inc/main/classes/parser/xml/class_XmlParser.php:79: // @TODO We need to find a fallback solution here -./inc/main/classes/points/class_UserPoints.php:100: * @todo Finish loading part of points -./inc/main/classes/request/console/class_ConsoleRequest.php:112: // @TODO Can't this be 'CONSOLE' ? -./inc/main/classes/request/html/class_HtmlRequest.php:10: * @todo Move out the cookie part to a seperate class, e.g. Cookie -./inc/main/classes/response/html/class_HtmlResponse.php:83: * @todo Encryption of cookie data not yet supported. -./inc/main/classes/response/html/class_HtmlResponse.php:84: * @todo Why are these parameters conflicting? -./inc/main/classes/response/html/class_HtmlResponse.php:85: * @todo If the return statement is removed and setcookie() commented out, -./inc/main/classes/response/html/class_HtmlResponse.php:86: * @todo this will send only one cookie out, the first one. -./inc/main/classes/response/image/class_ImageResponse.php:79: // @TODO Please fix this -./inc/main/classes/response/image/class_ImageResponse.php:95: * @todo Encryption of cookie data not yet supported. -./inc/main/classes/response/image/class_ImageResponse.php:96: * @todo Why are these parameters conflicting? -./inc/main/classes/response/image/class_ImageResponse.php:97: * @todo If the return statement is removed and setcookie() commented out, -./inc/main/classes/response/image/class_ImageResponse.php:98: * @todo this will send only one cookie out, the first one. -./inc/main/classes/rng/class_RandomNumberGenerator.php:175: * @todo I had a better random number generator here but now it is somewhere lost :( -./inc/main/classes/rng/class_RandomNumberGenerator.php:97: * @todo Add site key for stronger salt! -./inc/main/classes/stacker/file/class_BaseFileStack.php:162: * @todo Currently the stack file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole stack file. -./inc/main/classes/stacker/file/class_BaseFileStack.php:337: // @TODO Please implement this, returning FALSE -./inc/main/classes/stacker/file/class_BaseFileStack.php:60: * @todo To hard assertions here, better rewrite them to exceptions -./inc/main/classes/template/class_BaseTemplateEngine.php:1064: // @TODO This silent abort should be logged, maybe. -./inc/main/classes/template/class_BaseTemplateEngine.php:1072: // @TODO Old behaviour, will become obsolete! -./inc/main/classes/template/class_BaseTemplateEngine.php:1075: // @TODO Yet another old way -./inc/main/classes/template/class_BaseTemplateEngine.php:1298: * @todo Make this code some nicer... -./inc/main/classes/template/class_BaseTemplateEngine.php:961: * @todo Unfinished work or don't die here. -./inc/main/classes/template/class_BaseTemplateEngine.php:986: // @TODO Non-string found so we need some deeper analysis... -./inc/main/classes/template/console/class_ConsoleTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType() -./inc/main/classes/template/image/class_ImageTemplateEngine.php:215: * @todo Find something usefull with this! -./inc/main/classes/template/image/class_ImageTemplateEngine.php:235: * @todo Add cache creation here -./inc/main/classes/template/mail/class_MailTemplateEngine.php:10: * @todo This template engine does not make use of setTemplateType() -./inc/main/classes/template/mail/class_MailTemplateEngine.php:228: * @todo Add cache creation here -./inc/main/classes/template/mail/class_MailTemplateEngine.php:238: * @todo Should we call back the mailer class here? -./inc/main/classes/template/mail/class_MailTemplateEngine.php:317: * @todo 0% done -./inc/main/classes/template/menu/class_MenuTemplateEngine.php:305: * @todo Find something useful with this! -./inc/main/classes/template/menu/class_MenuTemplateEngine.php:351: * @todo Add cache creation here -./inc/main/classes/user/class_BaseUser.php:309: * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem -./inc/main/classes/user/class_BaseUser.php:81: * @todo Find a way of casting here. "(int)" might destroy the user id > 32766 -./inc/main/classes/user/guest/class_Guest.php:46: * @todo Add more ways over creating user classes -./inc/main/classes/user/member/class_Member.php:88: * @todo Add more ways over creating user classes -./inc/main/exceptions/config/class_NoConfigEntryException.php:10: * @todo Rename this class to NoFoundEntryException -./inc/main/exceptions/main/class_MissingMethodException.php:13: * @todo Try to rewrite user/guest login classes and mark this exception as deprecated -./inc/main/interfaces/application/class_ManageableApplication.php:58: * @todo Nothing to add? -./inc/main/interfaces/class_FrameworkInterface.php:11: * @todo Find a better name for this interface -./inc/main/interfaces/criteria/extended/class_LocalSearchCriteria.php:30: * @todo Find a nice casting here. (int) allows until and including 32766. -./inc/main/interfaces/criteria/extended/class_LocalSearchCriteria.php:54: * @todo Find a nice casting here. (int) allows until and including 32766. -./inc/main/interfaces/database/backend/class_DatabaseBackend.php:109: * @todo Add more generic non-data for removal -./inc/main/interfaces/database/backend/class_DatabaseBackend.php:61: * @todo Do some checks on the database directory and files here -./inc/main/interfaces/handler/task/class_HandleableTask.php:10: * @todo HandleableDataSet looks strange here -./inc/main/middleware/compressor/class_CompressorChannel.php:103: // @TODO Is there a configurable fall-back compressor needed, or is NullCompressor okay? -./inc/main/middleware/debug/class_DebugMiddleware.php:118: // @TODO Initialization phase -./inc/main/middleware/io/class_FileIoHandler.php:174: * @todo 0% done -./inc/main/third_party/api/wernisportal/class_WernisApi.php:10: * @todo Out-dated since 0.6-BETA -./inc/selector.php:11: * @todo Minimize these includes -./index.php:43: * @todo This method is old code and needs heavy rewrite and should be moved to ApplicationHelper +./application/tests/class_ApplicationHelper.php:273: * @todo Nothing to add? +./framework/config/class_FrameworkConfiguration.php:126: * @todo This method encapsulates a deprecated PHP function and should be deprecated, too. +./framework/config/class_FrameworkConfiguration.php:251: * @todo Have to check some more entries from $_SERVER here +./framework/loader/class_ClassLoader.php:232: // @TODO Throw exception instead of break +./framework/loader/class_ClassLoader.php:423: /* @TODO: Do not exit here. */ +./framework/main/classes/cache/class_MemoryCache.php:17: * @todo Rename to InProgressCache +./framework/main/classes/class_BaseFrameworkSystem.php:2136: // @TODO Move the constant to e.g. BaseDatabaseResult when there is a non-cached database result available +./framework/main/classes/class_BaseFrameworkSystem.php:2251: * @todo Write a logging mechanism for productive mode +./framework/main/classes/class_BaseFrameworkSystem.php:2266: // @TODO Finish this part! +./framework/main/classes/class_BaseFrameworkSystem.php:3266: * @todo Improve documentation +./framework/main/classes/class_BaseFrameworkSystem.php:3376: * @todo Move all this socket-related stuff into own class, most of it resides in BaseListener +./framework/main/classes/class_BaseFrameworkSystem.php:345: // @todo Try to clean these constants up +./framework/main/classes/class_BaseFrameworkSystem.php:590: // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class +./framework/main/classes/class_BaseFrameworkSystem.php:694: * @todo SearchableResult and UpdateableResult shall have a super interface to use here +./framework/main/classes/commands/console/class_ConsoleFuseCommand.php:83: // @TODO Unfinished +./framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php:78: * @todo Add some stuff here: Some personal data, app/game related data +./framework/main/classes/commands/html/class_HtmlProblemCommand.php:70: * @todo 0% done +./framework/main/classes/commands/html/class_HtmlStatusCommand.php:70: * @todo 0% done +./framework/main/classes/console/class_ConsoleTools.php:166: * @todo This should be connected to a caching class to cache DNS requests +./framework/main/classes/console/class_ConsoleTools.php:191: // @TODO Here should the cacher be implemented +./framework/main/classes/console/class_ConsoleTools.php:289: * @todo This should be moved out to an external class, e.g. HttpClient +./framework/main/classes/console/class_ConsoleTools.php:290: * @todo Make IP, host name, port and script name configurable +./framework/main/classes/console/class_ConsoleTools.php:297: // @TODO Add some DNS caching here +./framework/main/classes/controller/console/class_ConsoleDefaultController.php:19: * @todo This controller shall still provide some headlines for sidebars +./framework/main/classes/controller/html/class_HtmlConfirmController.php:50: * @todo Add some filters to this controller +./framework/main/classes/controller/html/class_HtmlDefaultController.php:20: * @todo This controller shall still provide some headlines for sidebars +./framework/main/classes/controller/html/class_HtmlLoginController.php:51: * @todo Add some filters to this controller +./framework/main/classes/controller/html/class_HtmlLogoutController.php:21: * @todo This controller shall still provide some headlines for sidebars +./framework/main/classes/controller/html/class_HtmlLogoutDoneController.php:50: * @todo Add some filters to this controller +./framework/main/classes/controller/html/class_HtmlProblemController.php:50: * @todo Add some filters to this controller +./framework/main/classes/controller/html/class_HtmlRegisterController.php:50: * @todo Add some filters to this controller +./framework/main/classes/controller/html/class_HtmlStatusController.php:20: * @todo This controller shall still provide some headlines for sidebars +./framework/main/classes/controller/html/login/class_HtmlLoginAreaController.php:51: * @todo Add some morer filters to this controller +./framework/main/classes/criteria/dataset/class_DataSetCriteria.php:157: // @TODO Issue a warning +./framework/main/classes/criteria/search/class_SearchCriteria.php:109: * @todo Find a nice casting here. (int) allows until and including 32766. +./framework/main/classes/criteria/search/class_SearchCriteria.php:77: * @todo Find a nice casting here. (int) allows until and including 32766. +./framework/main/classes/database/backend/class_CachedLocalFileDatabase.php:339: * @todo Do some checks on the database directory and files here +./framework/main/classes/database/backend/class_CachedLocalFileDatabase.php:628: * @todo Add more generic non-public data for removal +./framework/main/classes/database/class_BaseDatabaseWrapper.php:214: // @TODO Minor: Update above comment to e.g. BaseDatabaseResult +./framework/main/classes/database/frontend/class_NewsDatabaseWrapper.php:17: * @todo Add missing own interface for public methods +./framework/main/classes/database/frontend/class_PaymentsDatabaseWrapper.php:16: * @todo Add missing own interface for public methods +./framework/main/classes/database/result/class_CachedDatabaseResult.php:260: * @todo 0% done +./framework/main/classes/database/result/class_CachedDatabaseResult.php:414: * @todo Find a caching way without modifying the result array +./framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php:415: * @todo Find something useful with this! +./framework/main/classes/discovery/payment/class_LocalPaymentDiscovery.php:95: * @todo 0% done +./framework/main/classes/factories/logger/class_LoggerFactory.php:53: // @TODO Unfinished work +./framework/main/classes/factories/login/class_LoginFactory.php:47: * @return $loginInstance An instance of a login helper (@TODO Use actual interface name) +./framework/main/classes/factories/user/class_UserFactory.php:48: * @return $userInstance An instance of a user class (@TODO use actual interface name) +./framework/main/classes/feature/fuse/class_FuseFeature.php:59: * @todo 0% done +./framework/main/classes/file_directories/binary/class_BaseBinaryFile.php:856: // @TODO Unfinished +./framework/main/classes/file_directories/class_BaseAbstractFile.php:162: * @todo Handle seekStatus +./framework/main/classes/file_directories/class_BaseFileIo.php:180: * @todo Handle seekStatus +./framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php:78: * @todo Get rid of inConstructor, could be old-lost code. +./framework/main/classes/file_directories/io_stream/class_FileIoStream.php:273: * @todo 0% done +./framework/main/classes/file_directories/io_stream/class_FileIoStream.php:83: * @todo This method needs heavy rewrite +./framework/main/classes/filter/change/class_EmailChangeFilter.php:65: * @todo Implement email change of the user here. HINT: Use the User class! +./framework/main/classes/filter/change/class_PasswordChangeFilter.php:65: * @todo Finished updating user password hash here. HINT: Use the User class again. +./framework/main/classes/filter/news/class_NewsProcessFilter.php:64: * @todo Unfinished stub, add functionality here +./framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php:111: * @todo 0% done +./framework/main/classes/filter/update/class_UserUpdateFilter.php:65: * @todo Add more user updates here +./framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php:69: * @todo Rewrite handling of different password fields +./framework/main/classes/filter/verifier/class_EmailVerifierFilter.php:64: * @todo 0% done +./framework/main/classes/handler/class_BaseHandler.php:74: * @todo Rewrite this to use DHT +./framework/main/classes/handler/raw_data/network/class_BaseRawDataHandler.php:156: * @todo This method will be moved to a better place +./framework/main/classes/handler/tasks/class_TaskHandler.php:153: // @TODO Messurement can be added around this call +./framework/main/classes/helper/class_BaseHelper.php:193: * @todo Rewrite this method using a helper class for filtering data +./framework/main/classes/helper/class_BaseHelper.php:222: // @TODO Try to log it here +./framework/main/classes/helper/class_BaseHelper.php:488: $this->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] fieldName=' . $fieldName . ' is not set! - @TODO'); +./framework/main/classes/helper/html/forms/class_HtmlFormHelper.php:113: * @todo Add some unique PIN here to bypass problems with some browser and/or extensions +./framework/main/classes/helper/html/forms/class_HtmlFormHelper.php:632: * @todo Add checking if sub option is already added +./framework/main/classes/helper/html/forms/class_HtmlFormHelper.php:660: * @todo Add checking if sub option is already added +./framework/main/classes/helper/html/forms/class_HtmlFormHelper.php:694: // @TODO We need to log this later +./framework/main/classes/helper/html/forms/class_HtmlFormHelper.php:863: * @todo Implement check if rules have been changed +./framework/main/classes/helper/html/links/class_HtmlLinkHelper.php:194: * @todo Completely unimplemented +./framework/main/classes/images/class_BaseImage.php:179: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:189: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:199: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:209: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:219: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:238: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:257: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:268: * @todo Find something usefull for this method. +./framework/main/classes/images/class_BaseImage.php:278: * @todo Find something usefull for this method. +./framework/main/classes/index/class_BaseIndex.php:159: * @todo Currently the index file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole index file. +./framework/main/classes/listener/class_BaseListener.php:356: // @TODO On some systems it is 134, on some 107? +./framework/main/classes/listener/class_BaseListener.php:529: // @TODO Does this work on Windozer boxes??? +./framework/main/classes/lists/class_BaseList.php:318: // @TODO Extend this somehow? +./framework/main/classes/lists/groups/class_ListGroupList.php:68: * @todo 0% done +./framework/main/classes/mailer/debug/class_DebugMailer.php:137: * @todo 0% done +./framework/main/classes/menu/class_BaseMenu.php:75: // Log exception @TODO Maybe to intrusive? +./framework/main/classes/output/console/class_ConsoleOutput.php:64: // @TODO Need to rewrite this to $requestInstance->addHeader() +./framework/main/classes/parser/xml/class_XmlParser.php:87: // @TODO We need to find a fallback solution here +./framework/main/classes/points/class_UserPoints.php:112: * @todo Finish loading part of points +./framework/main/classes/points/class_UserPoints.php:184: * @todo $requestInstance is currently unused +./framework/main/classes/request/console/class_ConsoleRequest.php:118: // @TODO Can't this be 'CONSOLE' ? +./framework/main/classes/request/html/class_HtmlRequest.php:16: * @todo Move out the cookie part to a seperate class, e.g. Cookie +./framework/main/classes/response/html/class_HtmlResponse.php:80: * @todo Encryption of cookie data not yet supported. +./framework/main/classes/response/html/class_HtmlResponse.php:81: * @todo Why are these parameters conflicting? +./framework/main/classes/response/html/class_HtmlResponse.php:82: * @todo If the return statement is removed and setcookie() commented out, +./framework/main/classes/response/html/class_HtmlResponse.php:83: * @todo this will send only one cookie out, the first one. +./framework/main/classes/response/image/class_ImageResponse.php:76: // @TODO Please fix this +./framework/main/classes/response/image/class_ImageResponse.php:92: * @todo Encryption of cookie data not yet supported. +./framework/main/classes/response/image/class_ImageResponse.php:93: * @todo Why are these parameters conflicting? +./framework/main/classes/response/image/class_ImageResponse.php:94: * @todo If the return statement is removed and setcookie() commented out, +./framework/main/classes/response/image/class_ImageResponse.php:95: * @todo this will send only one cookie out, the first one. +./framework/main/classes/rng/class_RandomNumberGenerator.php:104: * @todo Add site key for stronger salt! +./framework/main/classes/rng/class_RandomNumberGenerator.php:182: * @todo I had a better random number generator here but now it is somewhere lost :( +./framework/main/classes/stacker/file/class_BaseFileStack.php:170: * @todo Currently the stack file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole stack file. +./framework/main/classes/stacker/file/class_BaseFileStack.php:345: // @TODO Please implement this, returning false +./framework/main/classes/stacker/file/class_BaseFileStack.php:68: * @todo To hard assertions here, better rewrite them to exceptions +./framework/main/classes/streams/crypto/class_McryptStream.php:16: * @todo mcrypt will become deprecated, rewrite to OpenSSL +./framework/main/classes/template/class_BaseTemplateEngine.php:1065: // @TODO This silent abort should be logged, maybe. +./framework/main/classes/template/class_BaseTemplateEngine.php:1073: // @TODO Old behaviour, will become obsolete! +./framework/main/classes/template/class_BaseTemplateEngine.php:1076: // @TODO Yet another old way +./framework/main/classes/template/class_BaseTemplateEngine.php:1299: * @todo Make this code some nicer... +./framework/main/classes/template/class_BaseTemplateEngine.php:962: * @todo Unfinished work or don't die here. +./framework/main/classes/template/class_BaseTemplateEngine.php:987: // @TODO Non-string found so we need some deeper analysis... +./framework/main/classes/template/console/class_ConsoleTemplateEngine.php:21: * @todo This template engine does not make use of setTemplateType() +./framework/main/classes/template/image/class_ImageTemplateEngine.php:231: * @todo Find something usefull with this! +./framework/main/classes/template/image/class_ImageTemplateEngine.php:251: * @todo Add cache creation here +./framework/main/classes/template/mail/class_MailTemplateEngine.php:244: * @todo Add cache creation here +./framework/main/classes/template/mail/class_MailTemplateEngine.php:24: * @todo This template engine does not make use of setTemplateType() +./framework/main/classes/template/mail/class_MailTemplateEngine.php:254: * @todo Should we call back the mailer class here? +./framework/main/classes/template/mail/class_MailTemplateEngine.php:333: * @todo 0% done +./framework/main/classes/template/menu/class_MenuTemplateEngine.php:319: * @todo Find something useful with this! +./framework/main/classes/template/menu/class_MenuTemplateEngine.php:365: * @todo Add cache creation here +./framework/main/classes/user/class_BaseUser.php:320: * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem +./framework/main/classes/user/class_BaseUser.php:92: * @todo Find a way of casting here. "(int)" might destroy the user id > 32766 +./framework/main/classes/user/guest/class_Guest.php:55: * @todo Add more ways over creating user classes +./framework/main/classes/user/member/class_Member.php:98: * @todo Add more ways over creating user classes +./framework/main/exceptions/compressor/class_MismatchingCompressorsException.php:16: * @todo Rename to CompressorMismatchException +./framework/main/exceptions/config/class_ConfigValueTypeUnsupportedException.php:18: * @todo These are invalid argument exceptions +./framework/main/exceptions/config/class_NoConfigEntryException.php:16: * @todo Rename this class to NoFoundEntryException +./framework/main/exceptions/language/class_LanguagePathIsNoDirectoryException.php:16: * @todo Don't use this anymore +./framework/main/exceptions/main/class_MissingMethodException.php:19: * @todo Try to rewrite user/guest login classes and mark this exception as deprecated +./framework/main/exceptions/socket/class_NoSocketErrorDetectedException.php:15: * @todo Those are logic exceptions and should be rewritten +./framework/main/exceptions/user/class_UserNoGuestException.php:17: * @todo Better rename this +./framework/main/interfaces/application/class_ManageableApplication.php:79: * @todo Nothing to add? +./framework/main/interfaces/class_FrameworkInterface.php:14: * @todo Find a better name for this interface +./framework/main/interfaces/criteria/extended/class_LocalSearchCriteria.php:36: * @todo Find a nice casting here. (int) allows until and including 32766. +./framework/main/interfaces/criteria/extended/class_LocalSearchCriteria.php:60: * @todo Find a nice casting here. (int) allows until and including 32766. +./framework/main/interfaces/database/backend/class_DatabaseBackend.php:117: * @todo Add more generic non-data for removal +./framework/main/interfaces/database/backend/class_DatabaseBackend.php:69: * @todo Do some checks on the database directory and files here +./framework/main/interfaces/handler/task/class_HandleableTask.php:18: * @todo HandleableDataSet looks strange here +./framework/main/interfaces/visitor/decorator/class_DecoratorVisitor.php:37: * @todo Find interface for this type-hint (only interface/array as type-hints rule) +./framework/main/middleware/compressor/class_CompressorChannel.php:121: // @TODO Is there a configurable fall-back compressor needed, or is NullCompressor okay? +./framework/main/middleware/database/class_DatabaseConnection.php:70: * @todo $debugInstance is currently not used +./framework/main/middleware/debug/class_DebugMiddleware.php:128: // @TODO Initialization phase +./framework/main/middleware/io/class_FileIoHandler.php:185: * @todo 0% done +./framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php:66: * @todo 0% done +./framework/main/tests/filter/tests/requirements/class_TestsPhpRequirementsFilter.php:63: * @todo 0% done +./framework/main/third_party/api/wernisportal/class_WernisApi.php:16: * @todo Out-dated since 0.6-BETA +./index.php:58: * @todo This method is old code and needs heavy rewrite and should be moved to ApplicationHelper ### ### DEPRECATION FOLLOWS: ### ### -./inc/classes.php:2:// @DEPRECATED -./inc/database.php:10: * @deprecated -./inc/includes.php:10: * @deprecated -./inc/main/classes/class_BaseFrameworkSystem.php:1882: * @deprecated Not fully, as the new Logger facilities are not finished yet. -./inc/main/exceptions/main/class_MissingMethodException.php:14: * @deprecated Please do no longer use this exception -./inc/main/middleware/debug/class_DebugMiddleware.php:12: * @deprecated See LoggerFactory for a more flexible approach -./inc/selector.php:10: * @deprecated +./application/tests/data.php:2:// @DEPRECATED +./application/tests/init.php:2:// @DEPRECATED +./application/tests/loader.php:2:// @DEPRECATED +./application/tests/starter.php:2:// @DEPRECATED +./framework/classes.php:2:// @DEPRECATED +./framework/config/config-hubmaster.php:2:// @DEPRECATED +./framework/config-global.php:54:// @DEPRECATED As PHP is deprecating this +./framework/database/lib-lfdb.php:2:// @DEPRECATED +./framework/database.php:2:// @DEPRECATED +./framework/includes.php:2:// @DEPRECATED +./framework/main/classes/class_BaseFrameworkSystem.php:1885: * @deprecated Not fully, as the new Logger facilities are not finished yet. +./framework/main/exceptions/base64/class_Base64EncodingBadException.php:17: * @deprecated Don't use this anymore +./framework/main/exceptions/base64/class_Base64EncodingModuloException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/crypto/class_EncryptInvalidLengthException.php:17: * @deprecated Don't use this anymore +./framework/main/exceptions/crypto/class_EncryptMissingException.php:17: * @deprecated Don't use this anymore +./framework/main/exceptions/database/local_file/class_SavePathIsEmptyException.php:16: * @deprecated Please don't use this anymore. +./framework/main/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php:13: * @deprecated Don't use this +./framework/main/exceptions/database/local_file/class_SavePathReadProtectedException.php:13: * @deprecated Please don't use this +./framework/main/exceptions/database/local_file/class_SavePathWriteProtectedException.php:13: * @deprecated Please don't use this +./framework/main/exceptions/file_directory/class_FileIsEmptyException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/file_directory/class_FileReadProtectedException.php:16: * @deprecated Don't read this anymore +./framework/main/exceptions/file_directory/class_FileWriteProtectedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/file_directory/class_InvalidDataLengthException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/file_directory/class_InvalidMD5ChecksumException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/file_directory/class_PathIsNoDirectoryException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/file_directory/class_PathReadProtectedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/file_directory/class_PathWriteProtectedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/filter/class_InvalidFilterChainException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_FormClosedException.php:17: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_FormGroupClosedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_FormOpenedException.php:17: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_HelperGroupAlreadyCreatedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_HelperNoPreviousOpenedSubGroupException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_HelperSubGroupAlreadyCreatedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_InvalidFormNameException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_NoGroupOpenedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/helper/class_UserInstanceMissingException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/language/class_InvalidLanguagePathStringException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/language/class_LanguagePathReadProtectedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/main/class_DimNotFoundInArrayException.php:16: * @deprecated Please don't use this anymore +./framework/main/exceptions/main/class_InvalidArrayCountException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/main/class_InvalidClassNameException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/main/class_InvalidCommandInstanceException.php:2:// @DEPRECATED +./framework/main/exceptions/main/class_InvalidObjectException.php:17: * @deprecated Don't use this anymore +./framework/main/exceptions/main/class_MissingDecimalsThousandsSeparatorException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/main/class_MissingMethodException.php:20: * @deprecated Please do no longer use this exception +./framework/main/exceptions/main/class_VariableIsNotSetException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/socket/class_SocketAlreadyRegisteredException.php:14: * @deprecated Don't use this anymore +./framework/main/exceptions/stacker/class_EmptyStackerException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/template/class_BasePathIsEmptyException.php:2:// @DEPRECATED +./framework/main/exceptions/template/class_BasePathReadProtectedException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/template/class_InvalidBasePathStringException.php:2:// @DEPRECATED +./framework/main/exceptions/template/class_NoVariableException.php:16: * @deprecated Don't use this anymore +./framework/main/exceptions/template/class_UnexpectedTemplateTypeException.php:16: * @deprecated Don't use this anymore +./framework/main/middleware/debug/class_DebugMiddleware.php:22: * @deprecated See LoggerFactory for a more flexible approach +./framework/selector.php:2:// @DEPRECATED diff --git a/framework/bootstrap/bootstrap.inc.php b/framework/bootstrap/bootstrap.inc.php index 848e6898..6611496e 100644 --- a/framework/bootstrap/bootstrap.inc.php +++ b/framework/bootstrap/bootstrap.inc.php @@ -26,7 +26,7 @@ use CoreFramework\Bootstrap\FrameworkBootstrap; */ // Load very basic classes, required to bootstrap -require __DIR__ . '/class_FrameworkBootstrap.php'; +require sprintf('%s%sclass_FrameworkBootstrap.php', __DIR__, DIRECTORY_SEPARATOR); // Bootstrap framework FrameworkBootstrap::doBootstrap(); diff --git a/framework/bootstrap/class_FrameworkBootstrap.php b/framework/bootstrap/class_FrameworkBootstrap.php index 460c984d..317bf5dd 100644 --- a/framework/bootstrap/class_FrameworkBootstrap.php +++ b/framework/bootstrap/class_FrameworkBootstrap.php @@ -3,7 +3,22 @@ namespace CoreFramework\Bootstrap; // Import framework stuff +use CoreFramework\Configuration\FrameworkConfiguration; +use CoreFramework\Connection\Database\DatabaseConnection; +use CoreFramework\Connector\Database\DatabaseConnector; use CoreFramework\EntryPoint\ApplicationEntryPoint; +use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Helper\Application\ApplicationHelper; +use CoreFramework\Loader\ClassLoader; +use CoreFramework\Manager\ManageableApplication; +use CoreFramework\Middleware\Debug\DebugMiddleware; +use CoreFramework\Object\BaseFrameworkSystem; +use CoreFramework\Registry\Registry; +use CoreFramework\Request\Requestable; +use CoreFramework\Response\Responseable; + +// Import SPL stuff +use \BadMethodCallException; /** * A framework-bootstrap class which helps the frameworks to bootstrap ... ;-) @@ -28,6 +43,42 @@ use CoreFramework\EntryPoint\ApplicationEntryPoint; * along with this program. If not, see . */ final class FrameworkBootstrap { + + /** + * Instance of a Requestable class + */ + private static $requestInstance = NULL; + + /** + * Instance of a Responseable class + */ + private static $responseInstance = NULL; + + /* + * Includes applications may have. They will be tried in the given order, + * some will become soon deprecated. + */ + private static $configAppIncludes = array( + // The ApplicationHelper class (required) + 'class_ApplicationHelper' => 'required', + // Some debugging stuff (optional but can be committed) + 'debug' => 'optional', + // Application's exception handler (optional but can be committed) + 'exceptions' => 'optional', + // Application's configuration file (committed, non-local specific) + 'config' => 'required', + // Local configuration file (optional, not committed, listed in .gitignore) + 'config-local' => 'optional', + // Application data (deprecated) + 'data' => 'deprecated', + // Application loader (deprecated) + 'loader' => 'deprecated', + // Application initializer (deprecated) + 'init' => 'deprecated', + // Application starter (deprecated) + 'starter' => 'deprecated', + ); + /** * Private constructor, no instance is needed from this class as only * static methods exist. @@ -36,6 +87,131 @@ final class FrameworkBootstrap { // Prevent making instances from this "utilities" class } + /** + * Getter for request instance + * + * @return $requestInstance An instance of a Requestable class + */ + public static function getRequestInstance () { + return self::$requestInstance; + } + + /** + * Getter for response instance + * + * @return $responseInstance An instance of a Responseable class + */ + public static function getResponseInstance () { + return self::$responseInstance; + } + + /** + * "Getter" to get response/request type from analysis of the system. + * + * @return $requestType Analyzed request type + */ + public static function getRequestTypeFromSystem () { + // Default is console + $requestType = 'console'; + + // Is 'HTTP_HOST' set? + if (isset($_SERVER['HTTP_HOST'])) { + // Then it is a HTML response/request. + $requestType = 'html'; + } // END - if + + // Return it + return $requestType; + } + + /** + * Checks whether the given file/path is in open_basedir(). This does not + * gurantee that the file is actually readable and/or writeable. If you need + * such gurantee then please use isReadableFile() instead. + * + * @param $filePathName Name of the file/path to be checked + * @return $isReachable Whether it is within open_basedir() + */ + public static function isReachableFilePath ($filePathName) { + // Is not reachable by default + $isReachable = false; + + // Get open_basedir parameter + $openBaseDir = ini_get('open_basedir'); + + // Is it set? + if (!empty($openBaseDir)) { + // Check all entries + foreach (explode(PATH_SEPARATOR, $openBaseDir) as $dir) { + // Check on existence + if (substr($filePathName, 0, strlen($dir)) == $dir) { + // Is reachable + $isReachable = true; + } // END - if + } // END - foreach + } else { + // If open_basedir is not set, all is allowed + $isReachable = true; + } + + // Return status + return $isReachable; + } + + /** + * Checks whether the give file is within open_basedir() (done by + * isReachableFilePath()), is actually a file and is readable. + * + * @param $fileName Name of the file to be checked + * @return $isReadable Whether the file is readable (and therefor exists) + */ + public static function isReadableFile ($fileName) { + // Default is not readable + $isReadable = false; + + // Is within parameters, so check if it is a file and readable + $isReadable = ( + ( + self::isReachableFilePath($fileName) + ) && ( + file_exists($fileName) + ) && ( + is_file($fileName) + ) && ( + is_readable($fileName) + ) && ( + filesize($fileName) > 100 + ) + ); + + // Return status + return $isReadable; + } + + /** + * Loads given include file + * + * @param $fqfn Include's FQFN + * @return void + * @throws InvalidArgumentException If $fqfn was not found or not readable or deprecated + */ + public static function loadInclude ($fqfn) { + // Trace message + //* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $fqfn); + + // Should be there ... + if (!self::isReadableFile($fqfn)) { + // Abort here + throw new InvalidArgumentException(sprintf('Cannot find fqfn=%s.', $fqfn)); + } // END - if + + // Load it + require $fqfn; + + // Trace message + //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__); + } + /** * Does the actual bootstrap * @@ -43,27 +219,287 @@ final class FrameworkBootstrap { */ public static function doBootstrap () { // Load basic include files to continue bootstrapping - require ApplicationEntryPoint::detectFrameworkPath() . 'main/interfaces/class_FrameworkInterface.php'; - require ApplicationEntryPoint::detectFrameworkPath() . 'main/interfaces/registry/class_Registerable.php'; - require ApplicationEntryPoint::detectFrameworkPath() . 'config/class_FrameworkConfiguration.php'; + self::loadInclude(sprintf('%smain%sinterfaces%sclass_FrameworkInterface.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)); + self::loadInclude(sprintf('%smain%sinterfaces%sregistry%sclass_Registerable.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR)); + self::loadInclude(sprintf('%sconfig%sclass_FrameworkConfiguration.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR)); + + // Load global configuration + self::loadInclude(sprintf('%s%s', ApplicationEntryPoint::detectFrameworkPath(), 'config-global.php')); + } + + /** + * Initializes the framework by scanning for all framework-relevant + * classes, interfaces and exception. Then determine the request type and + * initialize a Requestable instance which will then contain all request + * parameter, also from CLI. Next step is to validate the application + * (very basic). + * + * @return void + */ + public static function initFramework () { + /** + * 1) Load class loader and scan framework classes, interfaces and + * exceptions. + */ + self::scanFrameworkClasses(); + + /* + * 2) Determine the request type, console or web and store request and + * response here. This also initializes the request instance will + * all given parameters (see doc-tag for possible sources of + * parameters). + */ + self::determineRequestType(); + + /* + * 3) Now, that there are all request parameters being available, check + * if 'app' is supplied. If it is not found, abort execution, if + * found, continue below with next step. + */ + self::validateApplicationParameter(); + } + + /** + * Initializes the detected application. This may fail if required files + * are not found in the application's base path (not to be confused with + * 'application_base_path' which only points to /some/foo/application/. + * + * @return void + */ + public static function prepareApplication () { + // Configuration entry 'detected_app_name' must be set, get it here, including full path + $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('detected_app_name'); + $fullPath = FrameworkConfiguration::getSelfInstance()->getConfigEntry('detected_full_app_path'); + + /* + * Now check and load all files, found deprecated files will throw a + * warning at the user. + */ + foreach (self::$configAppIncludes as $fileName => $status) { + // Construct FQFN + $fqfn = sprintf('%s%s.php', $fullPath, $fileName); + + // Determine if this file is wanted/readable/deprecated + if (($status == 'required') && (!self::isReadableFile($fqfn))) { + // Nope, required file cannot be found/read from + ApplicationEntryPoint::app_exit(sprintf('Application "%s" does not have required file "%s.php". Please add it.', $application, $fileName)); + } elseif ((file_exists($fqfn)) && (!is_readable($fqfn))) { + // Found, not readable file + ApplicationEntryPoint::app_exit(sprintf('File "%s.php" from application "%s" cannot be read. Please fix CHMOD.', $fileName, $application)); + } elseif (($status != 'required') && (!self::isReadableFile($fqfn))) { + // Not found but optional/deprecated file, skip it + continue; + } + + // Is the file deprecated? + if ($status == 'deprecated') { + // Issue warning + trigger_error(sprintf('Deprecated file "%s.php" found, will not load it to avoid problems. Please remove it from your application "%s" to avoid this warning.', $fileName, $application), E_USER_WARNING); + + // Skip loading deprecated file + continue; + } // END - if + + // Load it + self::loadInclude($fqfn); + } // END - foreach + + // Scan for application's classes, exceptions and interfaces + ClassLoader::scanApplicationClasses(); + } + + /** + * Starts a fully initialized application, the class ApplicationHelper must + * be loaded at this point. + * + * @return void + */ + public static function startApplication () { + // Configuration entry 'detected_app_name' must be set, get it here + $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('detected_app_name'); + + // Is there an application helper instance? + $applicationInstance = call_user_func_array( + array( + 'CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance' + ), array() + ); + + // Some sanity checks + if ((empty($applicationInstance)) || (is_null($applicationInstance))) { + // Something went wrong! + ApplicationEntryPoint::app_exit(sprintf("[Main:] The application %s could not be launched because the helper class %s is not loaded.", + $application, + 'CoreFramework\Helper\Application\ApplicationHelper' + )); + } elseif (!is_object($applicationInstance)) { + // No object! + ApplicationEntryPoint::app_exit(sprintf("[Main:] The application %s could not be launched because 'app' is not an object (%s).", + $application, + gettype($applicationInstance) + )); + } elseif (!($applicationInstance instanceof ManageableApplication)) { + // Missing interface + ApplicationEntryPoint::app_exit(sprintf("[Main:] The application %s could not be launched because 'app' is lacking required interface ManageableApplication.", + $application + )); + } + + // Set it in registry + Registry::getRegistry()->addInstance('app', $applicationInstance); + + // Now call all methods in one go + foreach (array('setupApplicationData', 'initApplication', 'launchApplication') as $methodName) { + // Debug message + //* NOISY-DEBUG: */ printf('[%s:%d]: Calling methodName=%s ...' . PHP_EOL, __METHOD__, __LINE__, $methodName); + + // Call method + call_user_func(array($applicationInstance, $methodName)); + } // END - if + } + + /** + * Initializes database instance, no need to double-call this method + * + * @return void + */ + public static function initDatabaseInstance () { + // Get application instance + $applicationInstance = ApplicationHelper::getSelfInstance(); + + // Is the database instance already set? + if ($applicationInstance instanceof DatabaseConnector) { + // Yes, then abort here + throw new BadMethodCallException('Method called twice.'); + } // END - if + + // Initialize database layer + $databaseInstance = ObjectFactory::createObjectByConfiguredName(FrameworkConfiguration::getSelfInstance()->getConfigEntry('database_type') . '_class'); + + // Prepare database instance + $connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance); + + // Set it in application helper + $applicationInstance->setDatabaseInstance($connectionInstance); + } + + /** + * 1) Loads class scanner and scans all framework's classes and interfaces. + * This method also registers the class loader's method autoLoad() for the + * SPL auto-load feature. Remember that you can register additional methods + * (not functions, please) for other libraries. + * + * Yes, I know about Composer, but I like to keep my class loader around. + * You can always use mine as long as your classes have a namespace + * according naming-convention: Vendor\Project\Group[\SubGroup] + * + * @return void + */ + private static function scanFrameworkClasses () { + // Include the class loader function + require FrameworkConfiguration::getSelfInstance()->getConfigEntry('framework_base_path') . 'loader/class_ClassLoader.php'; + + // Register auto-load function with the SPL + spl_autoload_register('CoreFramework\Loader\ClassLoader::autoLoad'); + + // Scan for all framework classes, exceptions and interfaces + ClassLoader::scanFrameworkClasses(); + } + + /** + * 2) Determines request/response type and stores the created + * request/response instances in this object for later usage. + * + * @return void + */ + private static function determineRequestType () { + // Determine request type + $request = self::getRequestTypeFromSystem(); + $requestType = self::getRequestTypeFromSystem(); + + // Create a new request object + $requestInstance = ObjectFactory::createObjectByName(sprintf('CoreFramework\Request\%sRequest', BaseFrameworkSystem::convertToClassName($request))); + + // Remember request instance here + self::setRequestInstance($requestInstance); + + // Do we have another response? + if ($requestInstance->isRequestElementSet('request')) { + // Then use it + $request = strtolower($requestInstance->getRequestElement('request')); + $requestType = $request; + } // END - if + + // ... and a new response object + $responseClass = sprintf('CoreFramework\Response\%sResponse', BaseFrameworkSystem::convertToClassName($request)); + $responseInstance = ObjectFactory::createObjectByName($responseClass); - // Load main configuration - require ApplicationEntryPoint::detectFrameworkPath() . 'config.inc.php'; + // Remember response instance here + self::setResponseInstance($responseInstance); } /** - * Parses all parameters, like $_GET, $_POST, $_COOKIE and also "emulated" - * from command-line. Accepted CLI parameters are in following forms: + * 3) Validate parameter 'app' if it is set and the application is there. * - * --foo=bar - parameter 'foo' gets value "bar" (string) - * --enable-foo=true - parameter 'enableFoo' gets value true (boolean) - * --baz=123 - parameter 'baz' get value 123 (integer) + * @return void + */ + private static function validateApplicationParameter () { + // Is the parameter set? + if (!self::getRequestInstance()->isRequestElementSet('app')) { + /* + * Don't continue here, the application 'selector' is no longer + * supported and only existed as an idea to select the proper + * application (by user). + */ + ApplicationEntryPoint::app_exit('No application specified. Please provide a parameter "app" and retry.'); + } // END - if + + // Get it for local usage + $application = self::getRequestInstance()->getRequestElement('app'); + + // Secure it, by keeping out tags + $application = htmlentities(strip_tags($application), ENT_QUOTES); + + // Secure it a little more with a reg.exp. + $application = preg_replace('/([^a-z0-9_-])+/i', '', $application); + + // Construct FQPN (Full-Qualified Path Name) for ApplicationHelper class + $applicationPath = sprintf( + '%s%s%s', + FrameworkConfiguration::getSelfInstance()->getConfigEntry('application_base_path'), + $application, + DIRECTORY_SEPARATOR + ); + + // Full path for application + // Is the path there? This secures a bit the parameter (from untrusted source). + if ((!is_dir($applicationPath)) || (!is_readable($applicationPath))) { + // Not found or not readable + ApplicationEntryPoint::app_exit(sprintf('Application "%s" not found.', $application)); + } // END - if + + // Set the detected application's name and full path for later usage + FrameworkConfiguration::getSelfInstance()->setConfigEntry('detected_full_app_path', $applicationPath); + FrameworkConfiguration::getSelfInstance()->setConfigEntry('detected_app_name' , $application); + } + /** + * Setter for request instance * - * The same also works without 2 dashes as it was possible before: + * @param $requestInstance An instance of a Requestable class + * @return void + */ + private static function setRequestInstance (Requestable $requestInstance) { + self::$requestInstance = $requestInstance; + } + + /** + * Setter for response instance * - * app=tests - launches application 'tests' (parameter 'app' gets string value "tests") + * @param $responseInstance An instance of a Responseable class + * @return void */ - public static function parseParameters () { + private static function setResponseInstance (Responseable $responseInstance) { + self::$responseInstance = $responseInstance; } } diff --git a/framework/config-global.php b/framework/config-global.php new file mode 100644 index 00000000..f11a27e7 --- /dev/null +++ b/framework/config-global.php @@ -0,0 +1,469 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * 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 . + */ + +// Get a new configuration instance +$cfg = FrameworkConfiguration::getSelfInstance(); + +// CFG: ROOT-BASE-PATH +$cfg->setConfigEntry('root_base_path', ApplicationEntryPoint::getRootPath() . '/'); + +// CFG: CORE-BASE-PATH +$cfg->setConfigEntry('framework_base_path', ApplicationEntryPoint::detectFrameworkPath()); + +// CFG: BASE-URL +$cfg->setConfigEntry('base_url', $cfg->detectBaseUrl()); + +// CFG: DATABASE-TYPE +$cfg->setConfigEntry('database_type', 'local_file_database'); + +// CFG: LOCAL-DATABASE-PATH +$cfg->setConfigEntry('local_database_path', $cfg->getConfigEntry('root_base_path') . 'db/'); + +// CFG: TIME-ZONE +$cfg->setDefaultTimezone('Europe/Berlin'); + +// CFG: MAGIC-QUOTES-RUNTIME +// @DEPRECATED As PHP is deprecating this +$cfg->setMagicQuotesRuntime(false); + +// CFG: CLASS-PREFIX +$cfg->setConfigEntry('class_prefix', 'class_'); + +// CFG: CLASS-SUFFIX +$cfg->setConfigEntry('class_suffix', '.php'); + +// CFG: RAW-TEMPLATE-EXTENSION +$cfg->setConfigEntry('raw_template_extension', '.tpl'); + +// CFG: CODE-TEMPLATE-EXTENSION +$cfg->setConfigEntry('code_template_extension', '.ctp'); + +// CFG: SELECTOR-PATH +$cfg->setConfigEntry('selector_path', 'selector'); + +// CFG: TEMPLATE-BASE-PATH +$cfg->setConfigEntry('tpl_base_path', 'templates/'); + +// CFG: LANGUAGE-BASE-PATH +$cfg->setConfigEntry('language_base_path', 'language/'); + +// CFG: COMPRESSOR-BASE-PATH +$cfg->setConfigEntry('compressor_base_path', 'main/classes/compressor/'); + +// CFG: APPLICATION-BASE-PATH +$cfg->setConfigEntry('application_base_path', $cfg->getConfigEntry('root_base_path') . 'application/'); + +// CFG: COMPILE-OUTPUT-PATH +$cfg->setConfigEntry('compile_output_path', 'templates/_compiled/'); + +// CFG: HTML-TEMPLATE-CLASS +$cfg->setConfigEntry('html_template_class', 'CoreFramework\Template\Engine\HtmlTemplateEngine'); + +// CFG: DECO-XML-REWRITER-TEMPLATE-CLASS +$cfg->setConfigEntry('deco_xml_rewriter_template_class', 'CoreFramework\Template\Xml\XmlRewriterTemplateDecorator'); + +// CFG: DEBUG-HTML-CLASS +$cfg->setConfigEntry('debug_html_class', 'CoreFramework\Output\Debug\DebugWebOutput'); + +// CFG: DEBUG-CONSOLE-CLASS +$cfg->setConfigEntry('debug_console_class', 'CoreFramework\Debug\Output\DebugConsoleOutput'); + +// CFG: DEFAULT-LANGUAGE +$cfg->setConfigEntry('default_lang', 'de'); // A two-char language string: de for german, en for english and so on + +// CFG: HTML-TEMPLATE-TYPE +$cfg->setConfigEntry('html_template_type', 'html'); + +// CFG: EMAIL-TEMPLATE-TYPE +$cfg->setConfigEntry('email_template_type', 'emails'); + +// CFG: CODE-HTML-TEMPLATE-TYPE +$cfg->setConfigEntry('code_html_template_type', 'code'); + +// CFG: CODE-CONSOLE-TEMPLATE-TYPE +$cfg->setConfigEntry('code_console_template_type', 'xml'); + +// CFG: IMAGE-TEMPLATE-TYPE +$cfg->setConfigEntry('image_template_type', 'image'); + +// CFG: MENU-TEMPLATE-TYPE +$cfg->setConfigEntry('menu_template_type', 'menu'); + +// CFG: OUTPUT-CLASS +$cfg->setConfigEntry('output_class', 'CoreFramework\Output\WebOutput'); + +// CFG: LANGUAGE-SYSTEM-CLASS +$cfg->setConfigEntry('language_system_class', 'CoreFramework\Localization\LanguageSystem'); + +// CFG: SELECTOR-TEMPLATE-PREFIX +$cfg->setConfigEntry('tpl_selector_prefix', 'selector'); + +// CFG: WEB-CONTENT-TYPE +$cfg->setConfigEntry('web_content_type', 'text/html'); + +// CFG: VALID-TEMPLATE-VARIABLE +$cfg->setConfigEntry('tpl_valid_var', 'content'); + +// CFG: META-AUTHOR +$cfg->setConfigEntry('meta_author', 'Your-name-here'); + +// CFG: META-PUBLISHER +$cfg->setConfigEntry('meta_publisher', 'Your-name-here'); + +// CFG: META-KEYWORDS +$cfg->setConfigEntry('meta_keywords', 'test,test,test'); + +// CFG: META-DESCRIPTION +$cfg->setConfigEntry('meta_description', 'A description for your website'); + +// CFG: SELECTOR-MAIN-TEMPLATE +$cfg->setConfigEntry('selector_main_tpl', 'selector_main'); + +// CFG: SELECTOR-APPS-TEMPLATE +$cfg->setConfigEntry('selector_apps_tpl', 'selector_apps'); + +// CFG: SELECTOR-NAME +$cfg->setConfigEntry('selector_name', 'selector'); + +// CFG: DEFAULT-APPLICATION +$cfg->setConfigEntry('default_application', 'selector'); + +// CFG: VERBOSE-LEVEL +$cfg->setConfigEntry('verbose_level', 0); + +// CFG: CACHE-CLASS +$cfg->setConfigEntry('cache_class', 'CoreFramework\Cache\Memory\MemoryCache'); + +// CFG: SEARCH-CRITERIA-CLASS +$cfg->setConfigEntry('search_criteria_class', 'CoreFramework\Criteria\Search\SearchCriteria'); + +// CFG: DATASET-CRITERIA-CLASS +$cfg->setConfigEntry('dataset_criteria_class', 'CoreFramework\Criteria\DataSet\DataSetCriteria'); + +// CFG: UPDATE-CRITERIA-CLASS +$cfg->setConfigEntry('update_criteria_class', 'CoreFramework\Criteria\Update\UpdateCriteria'); + +// CFG: FILE-IO-CLASS +$cfg->setConfigEntry('file_io_class', 'CoreFramework\Handler\Filesystem\FileIoHandler'); + +// CFG: DATABASE-RESULT-CLASS +$cfg->setConfigEntry('database_result_class', 'CoreFramework\Result\Database\CachedDatabaseResult'); + +// CFG: FILTER-CHAIN-CLASS +$cfg->setConfigEntry('filter_chain_class', 'CoreFramework\Chain\Filter\FilterChain'); + +// CFG: FILE-INPUT-CLASS +$cfg->setConfigEntry('file_input_class', 'CoreFramework\Stream\Filesystem\FileIoStream'); + +// CFG: FILE-OUTPUT-CLASS +$cfg->setConfigEntry('file_output_class', 'CoreFramework\Stream\Filesystem\FileIoStream'); + +// CFG: EMAIL-VALIDATOR-FILTER-CLASS +$cfg->setConfigEntry('email_validator_filter_class', 'CoreFramework\Filter\Validator\Email\EmailValidatorFilter'); + +// CFG: USERNAME-VALIDATOR-FILTER-CLASS +$cfg->setConfigEntry('username_validator_filter_class', 'CoreFramework\Filter\Validator\Username\UserNameValidatorFilter'); + +// CFG: USERNAME-IS-GUEST-FILTER-CLASS +$cfg->setConfigEntry('username_is_guest_filter_class', 'CoreFramework\Filter\User\Username\UserNameIsGuestFilter'); + +// CFG: PASSWORD-VALIDATOR-FILTER-CLASS +$cfg->setConfigEntry('password_validator_filter_class', 'CoreFramework\Filter\Validator\Password\PasswordValidatorFilter'); + +// CFG: RULES-ACCEPTED-FILTER-CLASS +$cfg->setConfigEntry('rules_accepted_filter_class', 'CoreFramework\Filter\RulesCheckbox\RulesAcceptedFilter'); + +// CFG: USERNAME-VERIFIER-FILTER-CLASS +$cfg->setConfigEntry('username_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\UserNameVerifierFilter'); + +// CFG: USER-GUEST-VERIFIER-FILTER-CLASS +$cfg->setConfigEntry('user_guest_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\UserGuestVerifierFilter'); + +// CFG: EMAIL-VERIFIER-FILTER-CLASS +$cfg->setConfigEntry('email_verifier_filter_class', 'CoreFramework\Filter\Verifier\Email\EmailVerifierFilter'); + +// CFG: PASSWORD-VERIFIER-FILTER-CLASS +$cfg->setConfigEntry('password_verifier_filter_class', 'CoreFramework\Filter\Verifier\Password\PasswordVerifierFilter'); + +// CFG: PASSWD-GUEST-VERIFIER-FILTER-CLASS +$cfg->setConfigEntry('passwd_guest_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\PasswordGuestVerifierFilter'); + +// CFG: EMAIL-CHANGE-FILTER-CLASS +$cfg->setConfigEntry('email_change_filter_class', 'CoreFramework\Filter\Change\Email\EmailChangeFilter'); + +// CFG: PASSWORD-CHANGE-FILTER-CLASS +$cfg->setConfigEntry('password_change_filter_class', 'CoreFramework\Filter\Change\Password\PasswordChangeFilter'); + +// CFG: ACCOUNT-PASSWORD-FILTER-CLASS +$cfg->setConfigEntry('account_password_filter_class', 'CoreFramework\Filter\Verifier\Password\AccountPasswordVerifierFilter'); + +// CFG: USER-STATUS-FILTER-CLASS +$cfg->setConfigEntry('user_status_filter_class', 'CoreFramework\Filter\Verifier\User\UserStatusVerifierFilter'); + +// CFG: USER-UNCONFIRMED-FILTER-CLASS +$cfg->setConfigEntry('user_unconfirmed_filter_class', 'CoreFramework\Filter\Verifier\User\UserUnconfirmedVerifierFilter'); + +// CFG: CRYPTO-CLASS +$cfg->setConfigEntry('crypto_class', 'CoreFramework\Helper\Crypto\CryptoHelper'); + +// CFG: RNG-CLASS +$cfg->setConfigEntry('rng_class', 'CoreFramework\Crypto\RandomNumber\RandomNumberGenerator'); + +// CFG: USER-DB-WRAPPER-CLASS +$cfg->setConfigEntry('user_db_wrapper_class', 'CoreFramework\Wrapper\Database\User\UserDatabaseWrapper'); + +// CFG: NEWS-DB-WRAPPER-CLASS +$cfg->setConfigEntry('news_db_wrapper_class', 'CoreFramework\Wrapper\Database\News\NewsDatabaseWrapper'); + +// CFG: HTML-CMD-RESOLVER-CLASS +$cfg->setConfigEntry('html_cmd_resolver_class', 'CoreFramework\Resolver\Command\HtmlCommandResolver'); + +// CFG: HTML-CMD-LOGIN-RESOLVER-CLASS +$cfg->setConfigEntry('html_cmd_login_resolver_class', 'CoreFramework\Resolver\Command\HtmlCommandResolver'); + +// CFG: IMAGE-CMD-RESOLVER-CLASS +$cfg->setConfigEntry('image_cmd_resolver_class', 'CoreFramework\Resolver\Command\ImageCommandResolver'); + +// CFG: IMAGE-CMD-CODE-CAPTCHA-RESOLVER-CLASS +$cfg->setConfigEntry('image_cmd_code_captcha_resolver_class', 'CoreFramework\Resolver\Command\ImageCommandResolver'); + +// CFG: MAILER-CLASS +$cfg->setConfigEntry('mailer_class', 'CoreFramework\Mailer\Debug\DebugMailer'); + +// CFG: XML-PARSER-CLASS +$cfg->setConfigEntry('xml_parser_class', 'CoreFramework\Parser\Xml\XmlParser'); + +// CFG: DECO-COMPACTING-XML-PARSER-CLASS +$cfg->setConfigEntry('deco_compacting_xml_parser_class', 'CoreFramework\Parser\Xml\XmlCompactorDecorator'); + +// CFG: MATH-PRIME +$cfg->setConfigEntry('math_prime', 591623); + +// CFG: DATE-KEY +$cfg->setConfigEntry('date_key', date('d-m-Y (l-F-T)', time())); + +// CFG: SALT-LENGTH +$cfg->setConfigEntry('salt_length', 10); + +// CFG: RND-STR-LENGTH +$cfg->setConfigEntry('rnd_str_length', 128); + +// CFG: HASH-EXTRA-MASK +$cfg->setConfigEntry('hash_extra_mask', '%1s:%2s:%3s'); // 1=salt, 2=extra salt, 3=plain password/string + +// 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', 'CoreFramework\Action\PostRegistration\Login\LoginAfterRegistrationAction'); + +// CFG: USER-CLASS +$cfg->setConfigEntry('user_class', 'CoreFramework\User\Login\Member'); + +// CFG: GUEST-CLASS +$cfg->setConfigEntry('guest_class', 'CoreFramework\User\Guest\Guest'); + +// CFG: COOKIE-EXPIRE +$cfg->setConfigEntry('cookie_expire', (60*60*2)); // Two hours! + +// CFG: COOKIE-PATH +$cfg->setConfigEntry('cookie_path', $cfg->detectScriptPath() . '/'); + +// CFG: COOKIE-DOMAIN +$cfg->setConfigEntry('cookie_domain', $cfg->detectDomain()); // Is mostly the same... + +// CFG: COOKIE-SSL +$cfg->setConfigEntry('cookie_ssl', $cfg->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"); + +// CFG: PRODUCT-INSTALL-MODE +$cfg->setConfigEntry('product_install_mode', 'debug'); + +// CFG: DECIMALS +$cfg->setConfigEntry('decimals', 3); + +// CFG: MENU-STACKER-CLASS +$cfg->setConfigEntry('menu_stacker_class', 'CoreFramework\Stacker\File\FiLoStacker'); + +// CFG: STACKER-GENERIC-MAX-SIZE +$cfg->setConfigEntry('stacker_generic_max_size', 100); + +// CFG: STACKER-CURRENT-NODE-MAX-SIZE +$cfg->setConfigEntry('stacker_current_node_max_size', 20); + +// CFG: LOCAL-FILE-DATABASE-CLASS +$cfg->setConfigEntry('local_file_database_class', 'CoreFramework\Database\Backend\Lfdb\CachedLocalFileDatabase'); + +// CFG: COMPRESSOR-CHANNEL-CLASS +$cfg->setConfigEntry('compressor_channel_class', 'CoreFramework\Middleware\Compressor\CompressorChannel'); + +// CFG: DEBUG-HTML-OUTPUT-TIMINGS +$cfg->setConfigEntry('debug_html_output_timings', 'N'); + +// CFG: DEBUG-CONSOLE-OUTPUT-TIMINGS +$cfg->setConfigEntry('debug_console_output_timings', 'Y'); + +// CFG: PROXY-HOST +$cfg->setConfigEntry('proxy_host', ''); + +// CFG: PROXY-PORT +$cfg->setConfigEntry('proxy_port', ''); + +// CFG: PROXY-USERNAME +$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'); + +// CFG: DATABASE-CACHE-ENABLED +$cfg->setConfigEntry('database_cache_enabled', false); + +// CFG: DIRECTORY-CLASS +$cfg->setConfigEntry('directory_class', 'CoreFramework\Filesytem\Pointer\FrameworkDirectoryPointer'); + +// CFG: FILE-RAW-INPUT-CLASS +$cfg->setConfigEntry('file_raw_input_class', 'CoreFramework\Filesystem\Pointer\Input\FrameworkRawFileInputPointer'); + +// CFG: FILE-RAW-OUTPUT-CLASS +$cfg->setConfigEntry('file_raw_output_class', 'CoreFramework\Filesystem\Pointer\Output\FrameworkRawFileOutputPointer'); + +// CFG: FILE-RAW-INPUT-OUTPUT-CLASS +$cfg->setConfigEntry('file_raw_input_output_class', 'CoreFramework\Filesystem\Pointer\FrameworkFileInputOutputPointer'); + +// CFG: TEXT-FILE-INPUT-CLASS +$cfg->setConfigEntry('text_file_input_class', 'CoreFramework\Filesystem\Pointer\Input\FrameworkTextFileInputPointer'); + +// CFG: CSV-INPUT-FILE-CLASS +$cfg->setConfigEntry('csv_input_file_class', 'CoreFramework\Filesystem\Input\Csv\CsvInputFile'); + +// CFG: FILE-ITERATOR-CLASS +$cfg->setConfigEntry('file_iterator_class', 'CoreFramework\Iterator\File\FileIterator'); + +// CFG: FILE-STACK-PRE-ALLOCATE-ENABLED +$cfg->setConfigEntry('file_stack_pre_allocate_enabled', 'Y'); + +// CFG: FILE-STACK-PRE-ALLOCATE-COUNT +$cfg->setConfigEntry('file_stack_pre_allocate_count', 10000); + +// CFG: INDEX-INDEX-CLASS +$cfg->setConfigEntry('file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex'); + +// CFG: INDEX-PRE-ALLOCATE-ENABLED +$cfg->setConfigEntry('index_pre_allocate_enabled', 'Y'); + +// CFG: INDEX-PRE-ALLOCATE-COUNT +$cfg->setConfigEntry('index_pre_allocate_count', 10000); + +// CFG: STACK-FILE-CLASS +$cfg->setConfigEntry('stack_file_class', 'CoreFramework\Filesystem\Stack\StackFile'); + +// CFG: INDEX-FILE-CLASS +$cfg->setConfigEntry('index_file_class', 'CoreFramework\Filesystem\Index\IndexFile'); + +// CFG: TASK-HANDLER-CLASS +$cfg->setConfigEntry('task_handler_class', 'CoreFramework\Handler\Task\TaskHandler'); + +// CFG: TASK-LIST-CLASS +$cfg->setConfigEntry('task_list_class', 'CoreFramework\Lists\Task\TaskList'); + +// CFG: LIST-GROUP-CLASS +$cfg->setConfigEntry('list_group_class', 'CoreFramework\Lists\Group\ListGroupList'); + +// CFG: DEFAULT-ITERATOR-CLASS +$cfg->setConfigEntry('default_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); + +// CFG: ACTIVE-TASK-VISITOR-CLASS +$cfg->setConfigEntry('active_task_visitor_class', 'CoreFramework\Visitor\Task\Active\ActiveTaskVisitor'); + +// CFG: IDLE-TASK-CLASS +$cfg->setConfigEntry('idle_task_class', 'CoreFramework\Task\IdleLoop\IdleLoopTask'); + +// CFG: TASK-IDLE-LOOP-STARTUP-DELAY +$cfg->setConfigEntry('task_idle_loop_startup_delay', 0); + +// CFG: TASK-IDLE-LOOP-INTERVAL-DELAY +$cfg->setConfigEntry('task_idle_loop_interval_delay', 0); + +// CFG: TASK-IDLE-LOOP-MAX-RUNS +$cfg->setConfigEntry('task_idle_loop_max_runs', 0); + +// CFG: IDLE-LOOP-TIME (5 milli seconds) +$cfg->setConfigEntry('idle_loop_time', 5); + +// CFG: SHUTDOWN-TASK-VISITOR-CLASS +$cfg->setConfigEntry('shutdown_task_visitor_class', 'CoreFramework\Visitor\Task\Shutdown\ShutdownTaskVisitor'); + +// CFG: DEFAULT-IMAGE-COMMAND +$cfg->setConfigEntry('default_image_command', 'build'); + +// CFG: DEFAULT-IMAGE-CONTROLLER +$cfg->setConfigEntry('default_image_controller', 'build'); + +// CFG: MENU-TEMPLATE-CLASS +$cfg->setConfigEntry('menu_template_class', 'CoreFramework\Template\Engine\MenuTemplateEngine'); + +// CFG: MENU-TEMPLATE-EXTENSION +$cfg->setConfigEntry('menu_template_extension', '.xml'); + +// CFG: FEATURE-FUSE-CLASS +$cfg->setConfigEntry('feature_fuse_class', 'CoreFramework\Feature\Fuse\FuseFeature'); + +// CFG: TEMP-FILE-PATH +$cfg->setConfigEntry('temp_file_path', sys_get_temp_dir()); + +// CFG: IPC-SOCKET-FILE-NAME +$cfg->setConfigEntry('ipc_socket_file_name', 'php_ipc_socket'); + +// CFG: EXTENSION-SCRYPT-LOADED (By default scrypt is assumed absent and later tested being there) +$cfg->setConfigEntry('extension_scrypt_loaded', false); + +// CFG: EXTENSION-UUID-LOADED (By default uuid is assumed absent and later tested being there) +$cfg->setConfigEntry('extension_uuid_loaded', false); + +// Remove config from this name-space. Don't worry, no configuration is cleared. +unset($cfg); diff --git a/framework/config.inc.php b/framework/config.inc.php deleted file mode 100644 index e0498c68..00000000 --- a/framework/config.inc.php +++ /dev/null @@ -1,472 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * 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 . - */ - -// Get a new configuration instance -$cfg = FrameworkConfiguration::getSelfInstance(); - -// CFG: ROOT-BASE-PATH -$cfg->setConfigEntry('root_base_path', ApplicationEntryPoint::getRootPath() . '/'); - -// CFG: CORE-BASE-PATH -$cfg->setConfigEntry('framework_base_path', ApplicationEntryPoint::detectFrameworkPath()); - -// CFG: BASE-URL -$cfg->setConfigEntry('base_url', $cfg->detectBaseUrl()); - -// CFG: DATABASE-TYPE -$cfg->setConfigEntry('database_type', 'lfdb'); - -// CFG: LOCAL-DATABASE-PATH -$cfg->setConfigEntry('local_database_path', $cfg->getConfigEntry('root_base_path') . 'db/'); - -// CFG: TIME-ZONE -$cfg->setDefaultTimezone('Europe/Berlin'); - -// CFG: MAGIC-QUOTES-RUNTIME -// @DEPRECATED As PHP is deprecating this -$cfg->setMagicQuotesRuntime(FALSE); - -// CFG: CLASS-PREFIX -$cfg->setConfigEntry('class_prefix', 'class_'); - -// CFG: CLASS-SUFFIX -$cfg->setConfigEntry('class_suffix', '.php'); - -// CFG: RAW-TEMPLATE-EXTENSION -$cfg->setConfigEntry('raw_template_extension', '.tpl'); - -// CFG: CODE-TEMPLATE-EXTENSION -$cfg->setConfigEntry('code_template_extension', '.ctp'); - -// CFG: SELECTOR-PATH -$cfg->setConfigEntry('selector_path', 'selector'); - -// CFG: LAUNCH-METHOD -$cfg->setConfigEntry('entry_method', 'entryPoint'); - -// CFG: TEMPLATE-BASE-PATH -$cfg->setConfigEntry('tpl_base_path', 'templates/'); - -// CFG: LANGUAGE-BASE-PATH -$cfg->setConfigEntry('language_base_path', 'language/'); - -// CFG: COMPRESSOR-BASE-PATH -$cfg->setConfigEntry('compressor_base_path', 'main/classes/compressor/'); - -// CFG: APPLICATION-BASE-PATH -$cfg->setConfigEntry('application_base_path', $cfg->getConfigEntry('root_base_path') . 'application/'); - -// CFG: COMPILE-OUTPUT-PATH -$cfg->setConfigEntry('compile_output_path', 'templates/_compiled/'); - -// CFG: HTML-TEMPLATE-CLASS -$cfg->setConfigEntry('html_template_class', 'CoreFramework\Template\Engine\HtmlTemplateEngine'); - -// CFG: DECO-XML-REWRITER-TEMPLATE-CLASS -$cfg->setConfigEntry('deco_xml_rewriter_template_class', 'CoreFramework\Template\Xml\XmlRewriterTemplateDecorator'); - -// CFG: DEBUG-HTML-CLASS -$cfg->setConfigEntry('debug_html_class', 'CoreFramework\Output\Debug\DebugWebOutput'); - -// CFG: DEBUG-CONSOLE-CLASS -$cfg->setConfigEntry('debug_console_class', 'CoreFramework\Debug\Output\DebugConsoleOutput'); - -// CFG: DEFAULT-LANGUAGE -$cfg->setConfigEntry('default_lang', 'de'); // A two-char language string: de for german, en for english and so on - -// CFG: HTML-TEMPLATE-TYPE -$cfg->setConfigEntry('html_template_type', 'html'); - -// CFG: EMAIL-TEMPLATE-TYPE -$cfg->setConfigEntry('email_template_type', 'emails'); - -// CFG: CODE-HTML-TEMPLATE-TYPE -$cfg->setConfigEntry('code_html_template_type', 'code'); - -// CFG: CODE-CONSOLE-TEMPLATE-TYPE -$cfg->setConfigEntry('code_console_template_type', 'xml'); - -// CFG: IMAGE-TEMPLATE-TYPE -$cfg->setConfigEntry('image_template_type', 'image'); - -// CFG: MENU-TEMPLATE-TYPE -$cfg->setConfigEntry('menu_template_type', 'menu'); - -// CFG: OUTPUT-CLASS -$cfg->setConfigEntry('output_class', 'CoreFramework\Output\WebOutput'); - -// CFG: LANGUAGE-SYSTEM-CLASS -$cfg->setConfigEntry('language_system_class', 'CoreFramework\Localization\LanguageSystem'); - -// CFG: SELECTOR-TEMPLATE-PREFIX -$cfg->setConfigEntry('tpl_selector_prefix', 'selector'); - -// CFG: WEB-CONTENT-TYPE -$cfg->setConfigEntry('web_content_type', 'text/html'); - -// CFG: VALID-TEMPLATE-VARIABLE -$cfg->setConfigEntry('tpl_valid_var', 'content'); - -// CFG: META-AUTHOR -$cfg->setConfigEntry('meta_author', 'Your-name-here'); - -// CFG: META-PUBLISHER -$cfg->setConfigEntry('meta_publisher', 'Your-name-here'); - -// CFG: META-KEYWORDS -$cfg->setConfigEntry('meta_keywords', 'test,test,test'); - -// CFG: META-DESCRIPTION -$cfg->setConfigEntry('meta_description', 'A description for your website'); - -// CFG: SELECTOR-MAIN-TEMPLATE -$cfg->setConfigEntry('selector_main_tpl', 'selector_main'); - -// CFG: SELECTOR-APPS-TEMPLATE -$cfg->setConfigEntry('selector_apps_tpl', 'selector_apps'); - -// CFG: SELECTOR-NAME -$cfg->setConfigEntry('selector_name', 'selector'); - -// CFG: DEFAULT-APPLICATION -$cfg->setConfigEntry('default_application', 'selector'); - -// CFG: VERBOSE-LEVEL -$cfg->setConfigEntry('verbose_level', 0); - -// CFG: CACHE-CLASS -$cfg->setConfigEntry('cache_class', 'CoreFramework\Cache\Memory\MemoryCache'); - -// CFG: SEARCH-CRITERIA-CLASS -$cfg->setConfigEntry('search_criteria_class', 'CoreFramework\Criteria\Search\SearchCriteria'); - -// CFG: DATASET-CRITERIA-CLASS -$cfg->setConfigEntry('dataset_criteria_class', 'CoreFramework\Criteria\DataSet\DataSetCriteria'); - -// CFG: UPDATE-CRITERIA-CLASS -$cfg->setConfigEntry('update_criteria_class', 'CoreFramework\Criteria\Update\UpdateCriteria'); - -// CFG: FILE-IO-CLASS -$cfg->setConfigEntry('file_io_class', 'CoreFramework\Handler\Filesystem\FileIoHandler'); - -// CFG: DATABASE-RESULT-CLASS -$cfg->setConfigEntry('database_result_class', 'CoreFramework\Result\Database\CachedDatabaseResult'); - -// CFG: FILTER-CHAIN-CLASS -$cfg->setConfigEntry('filter_chain_class', 'CoreFramework\Chain\Filter\FilterChain'); - -// CFG: FILE-INPUT-CLASS -$cfg->setConfigEntry('file_input_class', 'CoreFramework\Stream\Filesystem\FileIoStream'); - -// CFG: FILE-OUTPUT-CLASS -$cfg->setConfigEntry('file_output_class', 'CoreFramework\Stream\Filesystem\FileIoStream'); - -// CFG: EMAIL-VALIDATOR-FILTER-CLASS -$cfg->setConfigEntry('email_validator_filter_class', 'CoreFramework\Filter\Validator\Email\EmailValidatorFilter'); - -// CFG: USERNAME-VALIDATOR-FILTER-CLASS -$cfg->setConfigEntry('username_validator_filter_class', 'CoreFramework\Filter\Validator\Username\UserNameValidatorFilter'); - -// CFG: USERNAME-IS-GUEST-FILTER-CLASS -$cfg->setConfigEntry('username_is_guest_filter_class', 'CoreFramework\Filter\User\Username\UserNameIsGuestFilter'); - -// CFG: PASSWORD-VALIDATOR-FILTER-CLASS -$cfg->setConfigEntry('password_validator_filter_class', 'CoreFramework\Filter\Validator\Password\PasswordValidatorFilter'); - -// CFG: RULES-ACCEPTED-FILTER-CLASS -$cfg->setConfigEntry('rules_accepted_filter_class', 'CoreFramework\Filter\RulesCheckbox\RulesAcceptedFilter'); - -// CFG: USERNAME-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('username_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\UserNameVerifierFilter'); - -// CFG: USER-GUEST-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('user_guest_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\UserGuestVerifierFilter'); - -// CFG: EMAIL-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('email_verifier_filter_class', 'CoreFramework\Filter\Verifier\Email\EmailVerifierFilter'); - -// CFG: PASSWORD-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('password_verifier_filter_class', 'CoreFramework\Filter\Verifier\Password\PasswordVerifierFilter'); - -// CFG: PASSWD-GUEST-VERIFIER-FILTER-CLASS -$cfg->setConfigEntry('passwd_guest_verifier_filter_class', 'CoreFramework\Filter\Verifier\User\PasswordGuestVerifierFilter'); - -// CFG: EMAIL-CHANGE-FILTER-CLASS -$cfg->setConfigEntry('email_change_filter_class', 'CoreFramework\Filter\Change\Email\EmailChangeFilter'); - -// CFG: PASSWORD-CHANGE-FILTER-CLASS -$cfg->setConfigEntry('password_change_filter_class', 'CoreFramework\Filter\Change\Password\PasswordChangeFilter'); - -// CFG: ACCOUNT-PASSWORD-FILTER-CLASS -$cfg->setConfigEntry('account_password_filter_class', 'CoreFramework\Filter\Verifier\Password\AccountPasswordVerifierFilter'); - -// CFG: USER-STATUS-FILTER-CLASS -$cfg->setConfigEntry('user_status_filter_class', 'CoreFramework\Filter\Verifier\User\UserStatusVerifierFilter'); - -// CFG: USER-UNCONFIRMED-FILTER-CLASS -$cfg->setConfigEntry('user_unconfirmed_filter_class', 'CoreFramework\Filter\Verifier\User\UserUnconfirmedVerifierFilter'); - -// CFG: CRYPTO-CLASS -$cfg->setConfigEntry('crypto_class', 'CoreFramework\Helper\Crypto\CryptoHelper'); - -// CFG: RNG-CLASS -$cfg->setConfigEntry('rng_class', 'CoreFramework\Crypto\RandomNumber\RandomNumberGenerator'); - -// CFG: USER-DB-WRAPPER-CLASS -$cfg->setConfigEntry('user_db_wrapper_class', 'CoreFramework\Wrapper\Database\User\UserDatabaseWrapper'); - -// CFG: NEWS-DB-WRAPPER-CLASS -$cfg->setConfigEntry('news_db_wrapper_class', 'CoreFramework\Wrapper\Database\News\NewsDatabaseWrapper'); - -// CFG: HTML-CMD-RESOLVER-CLASS -$cfg->setConfigEntry('html_cmd_resolver_class', 'CoreFramework\Resolver\Command\HtmlCommandResolver'); - -// CFG: HTML-CMD-LOGIN-RESOLVER-CLASS -$cfg->setConfigEntry('html_cmd_login_resolver_class', 'CoreFramework\Resolver\Command\HtmlCommandResolver'); - -// CFG: IMAGE-CMD-RESOLVER-CLASS -$cfg->setConfigEntry('image_cmd_resolver_class', 'CoreFramework\Resolver\Command\ImageCommandResolver'); - -// CFG: IMAGE-CMD-CODE-CAPTCHA-RESOLVER-CLASS -$cfg->setConfigEntry('image_cmd_code_captcha_resolver_class', 'CoreFramework\Resolver\Command\ImageCommandResolver'); - -// CFG: MAILER-CLASS -$cfg->setConfigEntry('mailer_class', 'CoreFramework\Mailer\Debug\DebugMailer'); - -// CFG: XML-PARSER-CLASS -$cfg->setConfigEntry('xml_parser_class', 'CoreFramework\Parser\Xml\XmlParser'); - -// CFG: DECO-COMPACTING-XML-PARSER-CLASS -$cfg->setConfigEntry('deco_compacting_xml_parser_class', 'CoreFramework\Parser\Xml\XmlCompactorDecorator'); - -// CFG: MATH-PRIME -$cfg->setConfigEntry('math_prime', 591623); - -// CFG: DATE-KEY -$cfg->setConfigEntry('date_key', date('d-m-Y (l-F-T)', time())); - -// CFG: SALT-LENGTH -$cfg->setConfigEntry('salt_length', 10); - -// CFG: RND-STR-LENGTH -$cfg->setConfigEntry('rnd_str_length', 128); - -// CFG: HASH-EXTRA-MASK -$cfg->setConfigEntry('hash_extra_mask', '%1s:%2s:%3s'); // 1=salt, 2=extra salt, 3=plain password/string - -// 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', 'CoreFramework\Action\PostRegistration\Login\LoginAfterRegistrationAction'); - -// CFG: USER-CLASS -$cfg->setConfigEntry('user_class', 'CoreFramework\User\Login\Member'); - -// CFG: GUEST-CLASS -$cfg->setConfigEntry('guest_class', 'CoreFramework\User\Guest\Guest'); - -// CFG: COOKIE-EXPIRE -$cfg->setConfigEntry('cookie_expire', (60*60*2)); // Two hours! - -// CFG: COOKIE-PATH -$cfg->setConfigEntry('cookie_path', $cfg->detectScriptPath() . '/'); - -// CFG: COOKIE-DOMAIN -$cfg->setConfigEntry('cookie_domain', $cfg->detectDomain()); // Is mostly the same... - -// CFG: COOKIE-SSL -$cfg->setConfigEntry('cookie_ssl', $cfg->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"); - -// CFG: PRODUCT-INSTALL-MODE -$cfg->setConfigEntry('product_install_mode', 'debug'); - -// CFG: DECIMALS -$cfg->setConfigEntry('decimals', 3); - -// CFG: MENU-STACKER-CLASS -$cfg->setConfigEntry('menu_stacker_class', 'CoreFramework\Stacker\File\FiLoStacker'); - -// CFG: STACKER-GENERIC-MAX-SIZE -$cfg->setConfigEntry('stacker_generic_max_size', 100); - -// CFG: STACKER-CURRENT-NODE-MAX-SIZE -$cfg->setConfigEntry('stacker_current_node_max_size', 20); - -// CFG: LOCAL-FILE-DATABASE-CLASS -$cfg->setConfigEntry('local_file_database_class', 'CoreFramework\Database\Backend\Lfdb\CachedLocalFileDatabase'); - -// CFG: COMPRESSOR-CHANNEL-CLASS -$cfg->setConfigEntry('compressor_channel_class', 'CoreFramework\Middleware\Compressor\CompressorChannel'); - -// CFG: DEBUG-HTML-OUTPUT-TIMINGS -$cfg->setConfigEntry('debug_html_output_timings', 'N'); - -// CFG: DEBUG-CONSOLE-OUTPUT-TIMINGS -$cfg->setConfigEntry('debug_console_output_timings', 'Y'); - -// CFG: PROXY-HOST -$cfg->setConfigEntry('proxy_host', ''); - -// CFG: PROXY-PORT -$cfg->setConfigEntry('proxy_port', ''); - -// CFG: PROXY-USERNAME -$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'); - -// CFG: DATABASE-CACHE-ENABLED -$cfg->setConfigEntry('database_cache_enabled', FALSE); - -// CFG: DIRECTORY-CLASS -$cfg->setConfigEntry('directory_class', 'CoreFramework\Filesytem\Pointer\FrameworkDirectoryPointer'); - -// CFG: FILE-RAW-INPUT-CLASS -$cfg->setConfigEntry('file_raw_input_class', 'CoreFramework\Filesystem\Pointer\Input\FrameworkRawFileInputPointer'); - -// CFG: FILE-RAW-OUTPUT-CLASS -$cfg->setConfigEntry('file_raw_output_class', 'CoreFramework\Filesystem\Pointer\Output\FrameworkRawFileOutputPointer'); - -// CFG: FILE-RAW-INPUT-OUTPUT-CLASS -$cfg->setConfigEntry('file_raw_input_output_class', 'CoreFramework\Filesystem\Pointer\FrameworkFileInputOutputPointer'); - -// CFG: TEXT-FILE-INPUT-CLASS -$cfg->setConfigEntry('text_file_input_class', 'CoreFramework\Filesystem\Pointer\Input\FrameworkTextFileInputPointer'); - -// CFG: CSV-INPUT-FILE-CLASS -$cfg->setConfigEntry('csv_input_file_class', 'CoreFramework\Filesystem\Input\Csv\CsvInputFile'); - -// CFG: FILE-ITERATOR-CLASS -$cfg->setConfigEntry('file_iterator_class', 'CoreFramework\Iterator\File\FileIterator'); - -// CFG: FILE-STACK-PRE-ALLOCATE-ENABLED -$cfg->setConfigEntry('file_stack_pre_allocate_enabled', 'Y'); - -// CFG: FILE-STACK-PRE-ALLOCATE-COUNT -$cfg->setConfigEntry('file_stack_pre_allocate_count', 10000); - -// CFG: INDEX-INDEX-CLASS -$cfg->setConfigEntry('file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex'); - -// CFG: INDEX-PRE-ALLOCATE-ENABLED -$cfg->setConfigEntry('index_pre_allocate_enabled', 'Y'); - -// CFG: INDEX-PRE-ALLOCATE-COUNT -$cfg->setConfigEntry('index_pre_allocate_count', 10000); - -// CFG: STACK-FILE-CLASS -$cfg->setConfigEntry('stack_file_class', 'CoreFramework\Filesystem\Stack\StackFile'); - -// CFG: INDEX-FILE-CLASS -$cfg->setConfigEntry('index_file_class', 'CoreFramework\Filesystem\Index\IndexFile'); - -// CFG: TASK-HANDLER-CLASS -$cfg->setConfigEntry('task_handler_class', 'CoreFramework\Handler\Task\TaskHandler'); - -// CFG: TASK-LIST-CLASS -$cfg->setConfigEntry('task_list_class', 'CoreFramework\Lists\Task\TaskList'); - -// CFG: LIST-GROUP-CLASS -$cfg->setConfigEntry('list_group_class', 'CoreFramework\Lists\Group\ListGroupList'); - -// CFG: DEFAULT-ITERATOR-CLASS -$cfg->setConfigEntry('default_iterator_class', 'CoreFramework\Iterator\DefaultIterator'); - -// CFG: ACTIVE-TASK-VISITOR-CLASS -$cfg->setConfigEntry('active_task_visitor_class', 'CoreFramework\Visitor\Task\Active\ActiveTaskVisitor'); - -// CFG: IDLE-TASK-CLASS -$cfg->setConfigEntry('idle_task_class', 'CoreFramework\Task\IdleLoop\IdleLoopTask'); - -// CFG: TASK-IDLE-LOOP-STARTUP-DELAY -$cfg->setConfigEntry('task_idle_loop_startup_delay', 0); - -// CFG: TASK-IDLE-LOOP-INTERVAL-DELAY -$cfg->setConfigEntry('task_idle_loop_interval_delay', 0); - -// CFG: TASK-IDLE-LOOP-MAX-RUNS -$cfg->setConfigEntry('task_idle_loop_max_runs', 0); - -// CFG: IDLE-LOOP-TIME (5 milli seconds) -$cfg->setConfigEntry('idle_loop_time', 5); - -// CFG: SHUTDOWN-TASK-VISITOR-CLASS -$cfg->setConfigEntry('shutdown_task_visitor_class', 'CoreFramework\Visitor\Task\Shutdown\ShutdownTaskVisitor'); - -// CFG: DEFAULT-IMAGE-COMMAND -$cfg->setConfigEntry('default_image_command', 'build'); - -// CFG: DEFAULT-IMAGE-CONTROLLER -$cfg->setConfigEntry('default_image_controller', 'build'); - -// CFG: MENU-TEMPLATE-CLASS -$cfg->setConfigEntry('menu_template_class', 'CoreFramework\Template\Engine\MenuTemplateEngine'); - -// CFG: MENU-TEMPLATE-EXTENSION -$cfg->setConfigEntry('menu_template_extension', '.xml'); - -// CFG: FEATURE-FUSE-CLASS -$cfg->setConfigEntry('feature_fuse_class', 'CoreFramework\Feature\Fuse\FuseFeature'); - -// CFG: TEMP-FILE-PATH -$cfg->setConfigEntry('temp_file_path', sys_get_temp_dir()); - -// CFG: IPC-SOCKET-FILE-NAME -$cfg->setConfigEntry('ipc_socket_file_name', 'php_ipc_socket'); - -// CFG: EXTENSION-SCRYPT-LOADED (By default scrypt is assumed absent and later tested being there) -$cfg->setConfigEntry('extension_scrypt_loaded', FALSE); - -// CFG: EXTENSION-UUID-LOADED (By default uuid is assumed absent and later tested being there) -$cfg->setConfigEntry('extension_uuid_loaded', FALSE); - -// Remove config from this name-space. Don't worry, no configuration is cleared. -unset($cfg); diff --git a/framework/config/class_FrameworkConfiguration.php b/framework/config/class_FrameworkConfiguration.php index 733ba9e1..f7a48ece 100644 --- a/framework/config/class_FrameworkConfiguration.php +++ b/framework/config/class_FrameworkConfiguration.php @@ -3,6 +3,8 @@ namespace CoreFramework\Configuration; // Import framework stuff +use CoreFramework\Console\Tools\ConsoleTools; +use CoreFramework\Dns\UnknownHostnameException; use CoreFramework\Generic\FrameworkInterface; use CoreFramework\Generic\NullPointerException; use CoreFramework\Registry\Registerable; @@ -245,7 +247,8 @@ class FrameworkConfiguration implements Registerable { * Detects the server address (SERVER_ADDR) and set it in configuration * * @return $serverAddress The detected server address - * @todo We have to add some more entries from $_SERVER here + * @throws UnknownHostnameException If SERVER_NAME cannot be resolved to an IP address + * @todo Have to check some more entries from $_SERVER here */ public function detectServerAddress () { // Is the entry set? @@ -254,6 +257,21 @@ class FrameworkConfiguration implements Registerable { if (isset($_SERVER['SERVER_ADDR'])) { // Set it from $_SERVER $this->setServerAddress($_SERVER['SERVER_ADDR']); + } elseif (isset($_SERVER['SERVER_NAME'])) { + // Resolve IP address + $serverIp = ConsoleTools::resolveIpAddress($_SERVER['SERVER_NAME']); + + // Is it valid? + if ($serverIp === false) { + /* + * Why is gethostbyname() returning the host name and not + * false as many other PHP functions are doing? ;-( + */ + throw new UnknownHostnameException(sprintf('Cannot resolve "%s" to an IP address. Please fix your setup.', $_SERVER['SERVER_NAME'])); + } // END - if + + // Al fine, set it + $this->setServerAddress($serverIp); } elseif (class_exists('ConsoleTools')) { // Run auto-detecting through console tools lib ConsoleTools::acquireSelfIPAddress(); @@ -289,20 +307,20 @@ class FrameworkConfiguration implements Registerable { /** * Detects the HTTPS flag * - * @return $https The detected HTTPS flag or null if failed + * @return $isSecured The detected HTTPS flag or null if failed */ public function detectHttpSecured () { // Default is null - $https = NULL; + $isSecured = NULL; // Is HTTPS set? if ($this->isHttpSecured()) { // Then use it - $https = $_SERVER['HTTPS']; + $isSecured = $_SERVER['HTTPS']; } // END - if // Return it - return $https; + return $isSecured; } /** @@ -383,7 +401,7 @@ class FrameworkConfiguration implements Registerable { * @throws NullPointerException If the result instance is null */ public final function getField ($fieldName) { - // Our super interface "FrameworkInterface" requires this + // The super interface "FrameworkInterface" requires this throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -395,7 +413,7 @@ class FrameworkConfiguration implements Registerable { * @throws NullPointerException If the result instance is null */ public function isFieldSet ($fieldName) { - // Our super interface "FrameworkInterface" requires this + // The super interface "FrameworkInterface" requires this throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -418,9 +436,9 @@ class FrameworkConfiguration implements Registerable { public function equals (FrameworkInterface $objectInstance) { // Now test it $equals = (( - $this->__toString() == $objectInstance->__toString() + $this->__toString() === $objectInstance->__toString() ) && ( - $this->hashCode() == $objectInstance->hashCode() + $this->hashCode() === $objectInstance->hashCode() )); // Return the result diff --git a/framework/database.php b/framework/database.php index fe39b3b0..7d6dceec 100644 --- a/framework/database.php +++ b/framework/database.php @@ -1,65 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @deprecated - * @todo Minimize these includes - * - * 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 . - */ - -// Initialize database layer -$databaseInstance = NULL; - -// Generate FQFN for the database layer -$fqfn = sprintf( - '%sdatabase/lib-%s.php', - FrameworkConfiguration::getSelfInstance()->getConfigEntry('framework_base_path'), - FrameworkConfiguration::getSelfInstance()->getConfigEntry('database_type') -); - -// Load the database layer include -if (BaseFrameworkSystem::isReadableFile($fqfn)) { - // Load the layer - require $fqfn; -} else { - // Layer is missing! - ApplicationEntryPoint::app_exit(sprintf('[Main:] Database layer is missing! (%s) -> R.I.P.', - FrameworkConfiguration::getSelfInstance()->getConfigEntry('database_type') - )); -} - -// Clean it up -unset($fqfn); - -// Prepare database instance -$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance); - -// Is the app variable there and valid? -// @TODO Rewrite this -if (is_object($app)) { - $app->setDatabaseInstance($connectionInstance); -} // END - if +// @DEPRECATED diff --git a/framework/database/lib-lfdb.php b/framework/database/lib-lfdb.php index b365a9f3..7d6dceec 100644 --- a/framework/database/lib-lfdb.php +++ b/framework/database/lib-lfdb.php @@ -1,29 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * 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 . - */ - -// For testing purposes we use a local file database -$databaseInstance = ObjectFactory::createObjectByConfiguredName('local_file_database_class'); +// @DEPRECATED diff --git a/framework/includes.php b/framework/includes.php index ceaab36d..7d6dceec 100644 --- a/framework/includes.php +++ b/framework/includes.php @@ -1,75 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @deprecated - * @todo Minimize these includes - * - * 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 . - */ - -// Include the class loader function -require FrameworkConfiguration::getSelfInstance()->getConfigEntry('framework_base_path') . 'loader/class_ClassLoader.php'; - -/* - * Shall we include additional configs where you can configure some things? - * Then load matching config file. - */ -ClassLoader::getSelfInstance()->loadExtraConfigs(); - -// Register auto-load function with the SPL -// @TODO This makes the core depending on the SPL. But it should be installed anyway. -spl_autoload_register('CoreFramework\Loader\ClassLoader::autoLoad'); - -// Does the user has an application specified? -// @TODO Find a nicer OOP-ed way for this -if (!empty($_GET['app'])) { - // Set the application from string - $application = (string) $_GET['app']; -} elseif (!empty($_SERVER['argv'][1])) { - // Set the application from string - $application = (string) $_SERVER['argv'][1]; - $app = explode('=', trim($application)); - if ($app[0] == 'app') { - // Application is valid! - $application = trim($app[1]); - } else { - // Invalid entry found, first must be "app"! - $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_application'); - } -} else { - // Set the "application selector" application - $application = FrameworkConfiguration::getSelfInstance()->getConfigEntry('default_application'); -} - -// Secure it, by keeping out tags -$application = htmlentities(strip_tags($application), ENT_QUOTES); - -// Secure it a little more with a reg.exp. -$application = preg_replace('/([^a-z0-9_-])+/i', '', $application); - -// Set the application name for later usage -FrameworkConfiguration::getSelfInstance()->setConfigEntry('app_name', $application); - -// Scan for all framework classes, exceptions and interfaces -ClassLoader::scanFrameworkClasses(); +// @DEPRECATED diff --git a/framework/loader/class_ClassLoader.php b/framework/loader/class_ClassLoader.php index 939d3559..211aded9 100644 --- a/framework/loader/class_ClassLoader.php +++ b/framework/loader/class_ClassLoader.php @@ -3,8 +3,8 @@ namespace CoreFramework\Loader; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Configuration\FrameworkConfiguration; -use CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff use \InvalidArgumentException; @@ -85,19 +85,19 @@ class ClassLoader { private $ignoreList = array(); /** - * Debug this class loader? (TRUE = yes, FALSE = no) + * Debug this class loader? (true = yes, false = no) */ - private $debug = FALSE; + private $debug = false; /** * Whether the file list is cached */ - private $listCached = FALSE; + private $listCached = false; /** * Wethe class content has been cached */ - private $classesCached = FALSE; + private $classesCached = false; /** * Filename for the list cache @@ -117,7 +117,7 @@ class ClassLoader { /** * By default the class loader is strict with naming-convention check */ - private static $strictNamingConventionCheck = TRUE; + private static $strictNamingConventionCheck = true; /** * Framework/application paths for classes, etc. @@ -157,14 +157,14 @@ class ClassLoader { } // END - if // Skip here if already cached - if ($this->listCached === FALSE) { + if ($this->listCached === false) { // Writes the cache file of our list away $cacheContent = json_encode($this->foundClasses); file_put_contents($this->listCacheFQFN, $cacheContent); } // END - if // Skip here if already cached - if ($this->classesCached === FALSE) { + if ($this->classesCached === false) { // Generate a full-cache of all classes $cacheContent = ''; foreach (array_keys($this->loadedClasses) as $fqfn) { @@ -224,7 +224,7 @@ class ClassLoader { // Debug message //* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName); - // Is it not FALSE and accessible? + // Is it not false and accessible? if (is_bool($pathName)) { // Skip this continue; @@ -265,7 +265,7 @@ class ClassLoader { $pathName = realpath(sprintf( '%s/%s/%s', $cfg->getConfigEntry('application_base_path'), - $cfg->getConfigEntry('app_name'), + $cfg->getConfigEntry('detected_app_name'), $shortPath )); @@ -300,18 +300,24 @@ class ClassLoader { // Debug message //* NOISY-DEBUG: */ printf('[%s:%d]: shortPath=%s' . PHP_EOL, __METHOD__, __LINE__, $shortPath); - // Create path name - $pathName = realpath(sprintf( + // Construct path name + $pathName = sprintf( '%s/%s', - $cfg->getConfigEntry('framework_base_path'), + $cfg->getConfigEntry('root_base_path'), $shortPath - )); + ); // Debug message - //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName); + //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s - BEFORE!' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName); + + // Try to find it + $pathName = realpath($pathName); + + // Debug message + //* NOISY-DEBUG: */ printf('[%s:%d]: pathName[%s]=%s - AFTER!' . PHP_EOL, __METHOD__, __LINE__, gettype($pathName), $pathName); // Is the path readable? - if (is_dir($pathName)) { + if ((is_dir($pathName)) && (is_readable($pathName))) { // Try to load the application classes ClassLoader::getSelfInstance()->scanClassPath($pathName); } // END - if @@ -327,7 +333,7 @@ class ClassLoader { * @param $strictNamingConventionCheck Whether to strictly check naming-convention * @return void */ - public static function enableStrictNamingConventionCheck ($strictNamingConventionCheck = TRUE) { + public static function enableStrictNamingConventionCheck ($strictNamingConventionCheck = true) { self::$strictNamingConventionCheck = $strictNamingConventionCheck; } @@ -339,8 +345,14 @@ class ClassLoader { * @return void */ public static function registerTestsPath ($relativePath) { + // Trace message + //* NOISY-DEBUG: */ printf('[%s:%d]: relativePath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $relativePath); + // "Register" it self::$testPaths[$relativePath] = $relativePath; + + // Trace message + //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__); } /** @@ -350,8 +362,14 @@ class ClassLoader { * @return void */ public static function autoLoad ($className) { + // Trace message + //* NOISY-DEBUG: */ printf('[%s:%d]: className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); + // Try to include this class self::getSelfInstance()->loadClassFile($className); + + // Trace message + //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__); } /** @@ -379,7 +397,7 @@ class ClassLoader { */ public function scanClassPath ($basePath, array $ignoreList = array() ) { // Is a list has been restored from cache, don't read it again - if ($this->listCached === TRUE) { + if ($this->listCached === true) { // Abort here return; } // END - if @@ -400,8 +418,8 @@ class ClassLoader { */ $basePath2 = realpath($basePath); - // If the basePath is FALSE it is invalid - if ($basePath2 === FALSE) { + // If the basePath is false it is invalid + if ($basePath2 === false) { /* @TODO: Do not exit here. */ exit(__METHOD__ . ': Cannot read ' . $basePath . ' !' . PHP_EOL); } else { @@ -451,31 +469,6 @@ class ClassLoader { } // END - while } - /** - * Load extra config files - * - * @return void - */ - public function loadExtraConfigs () { - // Backup old prefix - $oldPrefix = $this->prefix; - - // Set new prefix (temporary!) - $this->prefix = 'config-'; - - // Set base directory - $basePath = $this->configInstance->getConfigEntry('framework_base_path') . 'config/'; - - // Load all classes from the config directory - $this->scanClassPath($basePath); - - // Include these extra configs now - $this->includeExtraConfigs(); - - // Set back the old prefix - $this->prefix = $oldPrefix; - } - /** * Initializes our loader class * @@ -488,8 +481,8 @@ class ClassLoader { // Construct the FQFN for the cache if (!defined('DEVELOPER')) { - $this->listCacheFQFN = $this->configInstance->getConfigEntry('local_database_path') . 'list-' . $this->configInstance->getConfigEntry('app_name') . '.cache'; - $this->classCacheFQFN = $this->configInstance->getConfigEntry('local_database_path') . 'class-' . $this->configInstance->getConfigEntry('app_name') . '.cache'; + $this->listCacheFQFN = $this->configInstance->getConfigEntry('local_database_path') . 'list-' . $this->configInstance->getConfigEntry('detected_app_name') . '.cache'; + $this->classCacheFQFN = $this->configInstance->getConfigEntry('local_database_path') . 'class-' . $this->configInstance->getConfigEntry('detected_app_name') . '.cache'; } // END - if // Set suffix and prefix from configuration @@ -505,7 +498,7 @@ class ClassLoader { } // END - if // IS the cache there? - if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) { + if (FrameworkBootstrap::isReadableFile($this->listCacheFQFN)) { // Get content $cacheContent = file_get_contents($this->listCacheFQFN); @@ -513,16 +506,16 @@ class ClassLoader { $this->foundClasses = json_decode($cacheContent); // List has been restored from cache! - $this->listCached = TRUE; + $this->listCached = true; } // END - if // Does the class cache exist? - if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) { + if (FrameworkBootstrap::isReadableFile($this->listCacheFQFN)) { // Then include it - require $this->classCacheFQFN; + FrameworkBootstrap::loadInclude($this->classCacheFQFN); // Mark the class cache as loaded - $this->classesCached = TRUE; + $this->classesCached = true; } // END - if } @@ -543,7 +536,7 @@ class ClassLoader { $classNameParts = explode("\\", $className); // At least 3 parts should be there - if ((self::$strictNamingConventionCheck === TRUE) && (count($classNameParts) < 3)) { + if ((self::$strictNamingConventionCheck === true) && (count($classNameParts) < 3)) { // Namespace scheme is: Project\Package[\SubPackage...] throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Project\Package[\SubPackage...]\SomeFooBar', $className)); } // END - if @@ -559,14 +552,14 @@ class ClassLoader { if ((isset($this->foundClasses[$fileName])) && (!isset($this->loadedClasses[$this->foundClasses[$fileName]]))) { // File is found and not loaded so load it only once //* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - START' . PHP_EOL, __METHOD__, __LINE__, $fileName); - require $this->foundClasses[$fileName]; + FrameworkBootstrap::loadInclude($this->foundClasses[$fileName]); //* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - END' . PHP_EOL, __METHOD__, __LINE__, $fileName); // Count this loaded class/interface/exception $this->total++; // Mark this class as loaded for other purposes than loading it. - $this->loadedClasses[$this->foundClasses[$fileName]] = TRUE; + $this->loadedClasses[$this->foundClasses[$fileName]] = true; // Remove it from classes list so it won't be found twice. //* NOISY-DEBUG: */ printf('[%s:%d] UNSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName); @@ -575,8 +568,8 @@ class ClassLoader { // Developer mode excludes caching (better debugging) if (!defined('DEVELOPER')) { // Reset cache - //* NOISY-DEBUG: */ printf('[%s:%d] classesCached=FALSE' . PHP_EOL, __METHOD__, __LINE__); - $this->classesCached = FALSE; + //* NOISY-DEBUG: */ printf('[%s:%d] classesCached=false' . PHP_EOL, __METHOD__, __LINE__); + $this->classesCached = false; } // END - if } else { // Not found @@ -584,28 +577,6 @@ class ClassLoader { } } - /** - * Includes all extra config files - * - * @return void - */ - private function includeExtraConfigs () { - // Run through all class names (should not be much) - foreach ($this->foundClasses as $fileName => $fqfn) { - // Is this a config? - if (substr($fileName, 0, strlen($this->prefix)) == $this->prefix) { - // Then include it - //* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - START' . PHP_EOL, __METHOD__, __LINE__, $fileName); - require $fqfn; - //* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - END' . PHP_EOL, __METHOD__, __LINE__, $fileName); - - // Remove it from the list - //* NOISY-DEBUG: */ printf('[%s:%d] UNSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName); - unset($this->foundClasses[$fileName]); - } // END - if - } // END - foreach - } - /** * Getter for total include counter * diff --git a/framework/main/classes/auth/class_CookieAuth.php b/framework/main/classes/auth/class_CookieAuth.php index a98999f4..f1c38e40 100644 --- a/framework/main/classes/auth/class_CookieAuth.php +++ b/framework/main/classes/auth/class_CookieAuth.php @@ -3,6 +3,7 @@ namespace CoreFramework\Auth; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Object\BaseFrameworkSystem; use CoreFramework\Registry\Registerable; use CoreFramework\Response\Responseable; @@ -50,9 +51,6 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera // Get a new instance $loginInstance = new CookieAuth(); - // Set the response instance - $loginInstance->setResponseInstance($responseInstance); - // Return the prepared instance return $loginInstance; } @@ -64,7 +62,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera * @return void */ public function setUserAuth ($userName) { - $this->getResponseInstance()->addCookie('username', $userName); + FrameworkBootstrap::getResponseInstance()->addCookie('username', $userName); } /** @@ -74,7 +72,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera * @return void */ public function setPasswordAuth ($passHash) { - $this->getResponseInstance()->addCookie('u_hash', $passHash); + FrameworkBootstrap::getResponseInstance()->addCookie('u_hash', $passHash); } /** @@ -84,7 +82,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera */ public function getUserAuth () { // Get the username from cookie - $userName = $this->getRequestInstance()->readCookie('username'); + $userName = FrameworkBootstrap::getRequestInstance()->readCookie('username'); // Return the username return $userName; @@ -97,7 +95,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera */ public function getPasswordAuth () { // Get the username from cookie - $passHash = $this->getRequestInstance()->readCookie('u_hash'); + $passHash = FrameworkBootstrap::getRequestInstance()->readCookie('u_hash'); // Return the username return $passHash; @@ -110,8 +108,8 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera */ public function destroyAuthData () { // Expire both cookies - $this->getResponseInstance()->expireCookie('username'); - $this->getResponseInstance()->expireCookie('u_hash'); + FrameworkBootstrap::getResponseInstance()->expireCookie('username'); + FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash'); } /** @@ -120,8 +118,8 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera * @return void */ public function updateAuthData () { - $this->getResponseInstance()->refreshCookie('username'); - $this->getResponseInstance()->refreshCookie('u_hash'); + FrameworkBootstrap::getResponseInstance()->refreshCookie('username'); + FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash'); } } diff --git a/framework/main/classes/cache/class_MemoryCache.php b/framework/main/classes/cache/class_MemoryCache.php index c23851ee..9966c073 100644 --- a/framework/main/classes/cache/class_MemoryCache.php +++ b/framework/main/classes/cache/class_MemoryCache.php @@ -84,7 +84,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable { $exists = $this->dataCache->offsetExists($offset); // So look for array element? - if (($exists === TRUE) && (!is_null($arrayElement))) { + if (($exists === true) && (!is_null($arrayElement))) { // Get it $array = $this->offsetGet($offset); @@ -94,7 +94,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable { $exists = (count($array[$arrayElement]) >= $minimumCount); } else { // Not found - $exists = FALSE; + $exists = false; } } // END - if diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 1df10748..248da126 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -3,6 +3,7 @@ namespace CoreFramework\Object; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Compressor\Compressor; use CoreFramework\Configuration\FrameworkConfiguration; use CoreFramework\Connection\Database\DatabaseConnection; @@ -30,11 +31,9 @@ use CoreFramework\Middleware\Debug\DebugMiddleware; use CoreFramework\Parser\Parseable; use CoreFramework\Registry\Register; use CoreFramework\Registry\Registry; -use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Resolver; use CoreFramework\Result\Database\CachedDatabaseResult; use CoreFramework\Result\Search\SearchableResult; -use CoreFramework\Response\Responseable; use CoreFramework\Stacker\Stackable; use CoreFramework\Stream\Output\OutputStreamer; use CoreFramework\Template\CompileableTemplate; @@ -81,16 +80,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $realClass = 'BaseFrameworkSystem'; - /** - * Instance of a Requestable class - */ - private $requestInstance = NULL; - - /** - * Instance of a Responseable class - */ - private $responseInstance = NULL; - /** * Search criteria instance */ @@ -289,7 +278,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * Socket resource */ - private $socketResource = FALSE; + private $socketResource = false; /** * Regular expression to use for validation @@ -347,7 +336,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * The integer size is 4 bytes on 32-bit and 8 bytes on a 64-bit system. */ - private $archArrayElement = FALSE; + private $archArrayElement = false; /*********************** * Exception codes.... * @@ -481,10 +470,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->setConfigInstance(FrameworkConfiguration::getSelfInstance()); } // END - if - // Is the startup time set? (0 cannot be TRUE anymore) + // Is the startup time set? (0 cannot be true anymore) if (self::$startupTime == 0) { // Then set it - self::$startupTime = microtime(TRUE); + self::$startupTime = microtime(true); } // END - if // Set array element @@ -573,12 +562,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Is an other object, maybe no __toString() available $argsString .= $reflection->getName(); - } elseif ($arg === TRUE) { - // ... is boolean 'TRUE' - $argsString .= 'TRUE'; - } elseif ($arg === FALSE) { - // ... is boolean 'FALSE' - $argsString .= 'FALSE'; + } elseif ($arg === true) { + // ... is boolean 'true' + $argsString .= 'true'; + } elseif ($arg === false) { + // ... is boolean 'false' + $argsString .= 'false'; } // Comma for next one @@ -628,7 +617,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->debugBackTrace(sprintf('Tried to set a missing field. name=%s, value[%s]=%s', $name, gettype($value), - print_r($value, TRUE) + print_r($value, true) )); } @@ -906,7 +895,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $applicationInstance An instance of a manageable application helper class */ protected final function getApplicationInstance () { - $applicationInstance = Registry::getRegistry()->getInstance('application'); + $applicationInstance = Registry::getRegistry()->getInstance('app'); return $applicationInstance; } @@ -920,44 +909,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { Registry::getRegistry()->addInstance('application', $applicationInstance); } - /** - * Setter for request instance - * - * @param $requestInstance An instance of a Requestable class - * @return void - */ - public final function setRequestInstance (Requestable $requestInstance) { - $this->requestInstance = $requestInstance; - } - - /** - * Getter for request instance - * - * @return $requestInstance An instance of a Requestable class - */ - public final function getRequestInstance () { - return $this->requestInstance; - } - - /** - * Setter for response instance - * - * @param $responseInstance An instance of a Responseable class - * @return void - */ - public final function setResponseInstance (Responseable $responseInstance) { - $this->responseInstance = $responseInstance; - } - - /** - * Getter for response instance - * - * @return $responseInstance An instance of a Responseable class - */ - public final function getResponseInstance () { - return $this->responseInstance; - } - /** * Private getter for language instance * @@ -1792,7 +1743,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Is the application instance set? if (is_null($applicationInstance)) { // Get the current instance - $applicationInstance = $this->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Still null? if (is_null($applicationInstance)) { @@ -1831,7 +1782,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $content .= sprintf('
%s
', trim( htmlentities( - print_r($this, TRUE) + print_r($this, true) ) ) ); @@ -1905,10 +1856,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * Outputs a debug backtrace and stops further script execution * * @param $message An optional message to output - * @param $doExit Whether exit the program (TRUE is default) + * @param $doExit Whether exit the program (true is default) * @return void */ - public function debugBackTrace ($message = '', $doExit = TRUE) { + public function debugBackTrace ($message = '', $doExit = true) { // Sorry, there is no other way getting this nice backtrace if (!empty($message)) { // Output message @@ -1920,7 +1871,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { print(''); // Exit program? - if ($doExit === TRUE) { + if ($doExit === true) { exit(); } // END - if } @@ -1942,7 +1893,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Try it try { // Get a debugger instance - $debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_' . self::getResponseTypeFromSystem() . '_class'), $className); + $debugInstance = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getSelfInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_class'), $className); } catch (NullPointerException $e) { // Didn't work, no instance there exit(sprintf('Cannot create debugInstance! Exception=%s,message=%s,className=%s,lineNumber=%d' . PHP_EOL, $e->__toString(), $e->getMessage(), $className, $lineNumber)); @@ -1980,10 +1931,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * @param $message Message we shall send out... * @param $doPrint Whether print or die here (default: print) - * @paran $stripTags Whether to strip tags (default: FALSE) + * @paran $stripTags Whether to strip tags (default: false) * @return void */ - public function debugOutput ($message, $doPrint = TRUE, $stripTags = FALSE) { + public function debugOutput ($message, $doPrint = true, $stripTags = false) { // Set debug instance to NULL $debugInstance = NULL; @@ -2000,19 +1951,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Use debug output handler $debugInstance->output($message, $stripTags); - if ($doPrint === FALSE) { + if ($doPrint === false) { // Die here if not printed exit(); } // END - if } else { // Are debug times enabled? - if ($this->getConfigInstance()->getConfigEntry('debug_' . self::getResponseTypeFromSystem() . '_output_timings') == 'Y') { + if ($this->getConfigInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings') == 'Y') { // Prepent it $message = $this->getPrintableExecutionTime() . $message; } // END - if // Put directly out - if ($doPrint === TRUE) { + if ($doPrint === true) { // Print message $this->outputLine($message); } else { @@ -2181,7 +2132,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->getResultInstance()->rewind(); // Do we have an entry? - if ($this->getResultInstance()->valid() === FALSE) { + if ($this->getResultInstance()->valid() === false) { // @TODO Move the constant to e.g. BaseDatabaseResult when there is a non-cached database result available throw new InvalidDatabaseResultException(array($this, $this->getResultInstance()), CachedDatabaseResult::EXCEPTION_INVALID_DATABASE_RESULT); } // END - if @@ -2218,7 +2169,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Get current array $fieldArray = $resultInstance->current(); - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.':
'.print_r($fieldArray, TRUE).'
'); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.':
'.print_r($fieldArray, true).'
'); // Convert dashes to underscore $fieldName2 = self::convertDashesToUnderscores($fieldName); @@ -2229,7 +2180,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $fieldValue = $fieldArray[$fieldName2]; } elseif (defined('DEVELOPER')) { // Missing field entry, may require debugging - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray
=' . print_r($fieldArray, TRUE) . '
,fieldName=' . $fieldName . ' not found!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray
=' . print_r($fieldArray, true) . '
,fieldName=' . $fieldName . ' not found!'); } else { // Missing field entry, may require debugging self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldName=' . $fieldName . ' not found!'); @@ -2258,7 +2209,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Get current array $fieldArray = $resultInstance->current(); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=
'.print_r($fieldArray, TRUE).'
'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=
'.print_r($fieldArray, true).'
'); // Convert dashes to underscore $fieldName = self::convertDashesToUnderscores($fieldName); @@ -2339,7 +2290,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public function getMilliTime () { // Get the time of day as float - $milliTime = gettimeofday(TRUE); + $milliTime = gettimeofday(true); // Return it return $milliTime; @@ -2352,7 +2303,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public function idle ($milliSeconds) { // Sleep is fine by default - $hasSlept = TRUE; + $hasSlept = true; // Idle so long with found function if (function_exists('time_sleep_until')) { @@ -2518,34 +2469,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected function isBase64Encoded ($encodedData) { // Determine it - $isBase64 = (@base64_decode($encodedData, TRUE) !== FALSE); + $isBase64 = (@base64_decode($encodedData, true) !== false); // Return it return $isBase64; } - /** - * "Getter" to get response/request type from analysis of the system. - * - * @return $responseType Analyzed response type - */ - protected static function getResponseTypeFromSystem () { - // Default is console - $responseType = 'console'; - - // Is 'HTTP_HOST' set? - if (isset($_SERVER['HTTP_HOST'])) { - /* - * Then it is a HTML response/request as RSS and so on may be - * transfered over HTTP as well. - */ - $responseType = 'html'; - } // END - if - - // Return it - return $responseType; - } - /** * Gets a cache key from Criteria instance * @@ -2581,7 +2510,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected function getPrintableExecutionTime () { // Caculate the execution time - $executionTime = microtime(TRUE) - $this->getStartupTime(); + $executionTime = microtime(true) - $this->getStartupTime(); // Pack it in nice braces $executionTime = sprintf('[ %01.5f ] ', $executionTime); @@ -2630,18 +2559,18 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $assertMismatch Whether to assert mismatches * @return $ret The (hopefully) secured numbered value */ - public function bigintval ($num, $castValue = TRUE, $assertMismatch = FALSE) { + public function bigintval ($num, $castValue = true, $assertMismatch = false) { // Filter all numbers out $ret = preg_replace('/[^0123456789]/', '', $num); // Shall we cast? - if ($castValue === TRUE) { + if ($castValue === true) { // Cast to biggest numeric type $ret = (double) $ret; } // END - if // Assert only if requested - if ($assertMismatch === TRUE) { + if ($assertMismatch === true) { // Has the whole value changed? assert(('' . $ret . '' != '' . $num . '') && (!is_null($num))); } // END - if @@ -2657,12 +2586,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $assertMismatch Whether to assert mismatches * @return $ret The (hopefully) secured hext-numbered value */ - public function hexval ($num, $assertMismatch = FALSE) { + public function hexval ($num, $assertMismatch = false) { // Filter all numbers out $ret = preg_replace('/[^0123456789abcdefABCDEF]/', '', $num); // Assert only if requested - if ($assertMismatch === TRUE) { + if ($assertMismatch === true) { // Has the whole value changed? assert(('' . $ret . '' != '' . $num . '') && (!is_null($num))); } // END - if @@ -2758,7 +2687,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], TRUE)); + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true)); // Return it return $this->genericArray[$keyGroup][$subGroup]; @@ -2808,7 +2737,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function appendStringToGenericArrayKey ($keyGroup, $subGroup, $key, $value, $appendGlue = '') { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); // Is it already there? if ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { @@ -2832,7 +2761,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function appendStringToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value, $appendGlue = '') { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); // Is it already there? if ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { @@ -2856,7 +2785,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function setStringGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value, $appendGlue = '') { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true) . ',appendGlue=' . $appendGlue); // Set it $this->genericArray[$keyGroup][$subGroup][$key][$element] = (string) $value; @@ -2871,12 +2800,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $forceInit Optionally force initialization * @return void */ - protected final function initGenericArrayGroup ($keyGroup, $subGroup, $forceInit = FALSE) { + protected final function initGenericArrayGroup ($keyGroup, $subGroup, $forceInit = false) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',forceInit=' . intval($forceInit)); // Is it already set? - if (($forceInit === FALSE) && ($this->isGenericArrayGroupSet($keyGroup, $subGroup))) { + if (($forceInit === false) && ($this->isGenericArrayGroupSet($keyGroup, $subGroup))) { // Already initialized trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' already initialized.'); exit; @@ -2895,12 +2824,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $forceInit Optionally force initialization * @return void */ - protected final function initGenericArrayKey ($keyGroup, $subGroup, $key, $forceInit = FALSE) { + protected final function initGenericArrayKey ($keyGroup, $subGroup, $key, $forceInit = false) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',forceInit=' . intval($forceInit)); // Is it already set? - if (($forceInit === FALSE) && ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key))) { + if (($forceInit === false) && ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key))) { // Already initialized trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' already initialized.'); exit; @@ -2920,12 +2849,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $forceInit Optionally force initialization * @return void */ - protected final function initGenericArrayElement ($keyGroup, $subGroup, $key, $element, $forceInit = FALSE) { + protected final function initGenericArrayElement ($keyGroup, $subGroup, $key, $element, $forceInit = false) { // Debug message //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',forceInit=' . intval($forceInit)); // Is it already set? - if (($forceInit === FALSE) && ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element))) { + if (($forceInit === false) && ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element))) { // Already initialized trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ' already initialized.'); exit; @@ -2946,7 +2875,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function pushValueToGenericArrayKey ($keyGroup, $subGroup, $key, $value) { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true)); // Is it set? if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { @@ -2958,7 +2887,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $count = array_push($this->genericArray[$keyGroup][$subGroup][$key], $value); // Return count - //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE)); + //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], true)); //* DEBUG: */ print(__METHOD__ . ': count=' . $count . PHP_EOL); return $count; } @@ -2975,7 +2904,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function pushValueToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true)); // Is it set? if (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { @@ -2987,7 +2916,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $count = array_push($this->genericArray[$keyGroup][$subGroup][$key][$element], $value); // Return count - //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE)); + //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], true)); //* DEBUG: */ print(__METHOD__ . ': count=' . $count . PHP_EOL); return $count; } @@ -3015,8 +2944,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $value = array_pop($this->genericArray[$keyGroup][$subGroup][$key]); // Return value - //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE)); - //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . print_r($value, TRUE) . PHP_EOL); + //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], true)); + //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . print_r($value, true) . PHP_EOL); return $value; } @@ -3043,8 +2972,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $value = array_shift($this->genericArray[$keyGroup][$subGroup][$key]); // Return value - //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE)); - //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . print_r($value, TRUE) . PHP_EOL); + //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], true)); + //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . print_r($value, true) . PHP_EOL); return $value; } @@ -3168,7 +3097,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function setGenericArrayKey ($keyGroup, $subGroup, $key, $value) { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, true)); // Set value here $this->genericArray[$keyGroup][$subGroup][$key] = $value; @@ -3209,7 +3138,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ protected final function setGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) { // Debug message - //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, true)); // Then set it $this->genericArray[$keyGroup][$subGroup][$key][$element] = $value; @@ -3285,12 +3214,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Get application instance $applicationInstance = Registry::getRegistry()->getInstance('app'); - // Is this a response instance? - if ($this instanceof Responseable) { - // Then set it in application instance - $applicationInstance->setResponseInstance($this); - } // END - if - // Init web output instance $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class', array($applicationInstance)); @@ -3299,7 +3222,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } /** - * Translates boolean TRUE to 'Y' and FALSE to 'N' + * Translates boolean true to 'Y' and false to 'N' * * @param $boolean Boolean value * @return $translated Translated boolean value @@ -3309,7 +3232,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { assert(is_bool($boolean)); // "Translate" it - $translated = ($boolean === TRUE) ? 'Y' : 'N'; + $translated = ($boolean === true) ? 'Y' : 'N'; // ... and return it return $translated; @@ -3383,58 +3306,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $packed; } - /** - * Checks whether the given file/path is in open_basedir(). This does not - * gurantee that the file is actually readable and/or writeable. If you need - * such gurantee then please use isReadableFile() instead. - * - * @param $filePathName Name of the file/path to be checked - * @return $isReachable Whether it is within open_basedir() - */ - protected static function isReachableFilePath ($filePathName) { - // Is not reachable by default - $isReachable = FALSE; - - // Get open_basedir parameter - $openBaseDir = ini_get('open_basedir'); - - // Is it set? - if (!empty($openBaseDir)) { - // Check all entries - foreach (explode(PATH_SEPARATOR, $openBaseDir) as $dir) { - // Check on existence - if (substr($filePathName, 0, strlen($dir)) == $dir) { - // Is reachable - $isReachable = TRUE; - } // END - if - } // END - foreach - } else { - // If open_basedir is not set, all is allowed - $isReachable = TRUE; - } - - // Return status - return $isReachable; - } - - /** - * Checks whether the give file is within open_basedir() (done by - * isReachableFilePath()), is actually a file and is readable. - * - * @param $fileName Name of the file to be checked - * @return $isReadable Whether the file is readable (and therefor exists) - */ - public static function isReadableFile ($fileName) { - // Default is not readable - $isReadable = FALSE; - - // Is within parameters, so check if it is a file and readable - $isReadable = ((self::isReachableFilePath($fileName)) && (file_exists($fileName)) && (is_file($fileName)) && (is_readable($fileName))); - - // Return status - return $isReadable; - } - /** * Creates a full-qualified file name (FQFN) for given file name by adding * a configured temporary file path to it. @@ -3458,7 +3329,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $fqfn = $basePath . '/' . $fileName; // Is it reachable? - if (!self::isReachableFilePath($fqfn)) { + if (!FrameworkBootstrap::isReachableFilePath($fqfn)) { // Not reachable throw new FileIoException($fqfn, self::EXCEPTION_FILE_NOT_REACHABLE); } // END - if @@ -3512,7 +3383,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Check socket array, 1st element is mostly IP address (or file name), 2nd is port number - //* DEBUG-DIE: */ die(__METHOD__ . ':socketData=' . print_r($socketData, TRUE)); + //* DEBUG-DIE: */ die(__METHOD__ . ':socketData=' . print_r($socketData, true)); assert(isset($socketData[0])); assert(isset($socketData[1])); diff --git a/framework/main/classes/client/http/class_HttpClient.p b/framework/main/classes/client/http/class_HttpClient.p index c8222de7..98e50d01 100644 --- a/framework/main/classes/client/http/class_HttpClient.p +++ b/framework/main/classes/client/http/class_HttpClient.p @@ -3,9 +3,11 @@ // @TODO Add some DNS caching here // Open connection - if ($helperInstance->isProxyUsed() === TRUE) { + if ($helperInstance->isProxyUsed() === true) { // Resolve hostname into IP address - $ip = $helperInstance->resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host')); + $ip = ConsoleTools::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host')); + + // @TODO Handle $ip = false // Connect to host through proxy connection $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30); diff --git a/framework/main/classes/client/http/class_HttpClient.ph b/framework/main/classes/client/http/class_HttpClient.ph index 76a31133..db79276a 100644 --- a/framework/main/classes/client/http/class_HttpClient.ph +++ b/framework/main/classes/client/http/class_HttpClient.ph @@ -22,9 +22,11 @@ // @TODO Add some DNS caching here // Open connection - if ($helperInstance->isProxyUsed() === TRUE) { + if ($helperInstance->isProxyUsed() === true) { // Resolve hostname into IP address - $ip = $helperInstance->resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host')); + $ip = ConsoleTools::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host')); + + // @TODO Handle $ip = false // Connect to host through proxy connection $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30); @@ -40,13 +42,13 @@ } // END - if // Prepare the GET request - $request = 'GET ' . ($helperInstance->isProxyUsed() === TRUE ? 'http://shipsimu.org' : '') . '/ip.php HTTP/1.0' . self::HTTP_EOL; + $request = 'GET ' . ($helperInstance->isProxyUsed() === true ? 'http://shipsimu.org' : '') . '/ip.php HTTP/1.0' . self::HTTP_EOL; $request .= 'Host: shipsimu.org' . self::HTTP_EOL; $request .= 'User-Agent: ' . $this->getUserAgent() . self::HTTP_EOL; $request .= 'Connection: close' . self::HTTP_EOL; // Do we use proxy? - if ($helperInstance->isProxyUsed() === TRUE) { + if ($helperInstance->isProxyUsed() === true) { // CONNECT method? if ($helperInstance->getConfigInstance()->getConfigEntry('proxy_connect_method') == 'Y') { // Setup proxy tunnel @@ -55,7 +57,7 @@ // If the response is invalid, abort if ((count($response) == 3) && (empty($response[0])) && (empty($response[1])) && (empty($response[2]))) { // Invalid response! - $helperInstance->debugBackTrace('Proxy tunnel not working: response=' . print_r($response, TRUE)); + $helperInstance->debugBackTrace('Proxy tunnel not working: response=' . print_r($response, true)); } // END - if } else { // Add header for proxy diff --git a/framework/main/classes/client/http/class_HttpClient.php b/framework/main/classes/client/http/class_HttpClient.php index 1c89e942..688c9d30 100644 --- a/framework/main/classes/client/http/class_HttpClient.php +++ b/framework/main/classes/client/http/class_HttpClient.php @@ -48,7 +48,7 @@ class HttpClient extends BaseClient implements Client { * @param $socketResource Resource of a socket (optional) * @return $clientInstance An instance of a Client class */ - public final static function createHttpClient ($socketResouce = FALSE) { + public final static function createHttpClient ($socketResouce = false) { // Get a new instance $clientInstance = new HttpClient(); diff --git a/framework/main/classes/commands/class_BaseCommand.php b/framework/main/classes/commands/class_BaseCommand.php index 3feb617e..020f8fa0 100644 --- a/framework/main/classes/commands/class_BaseCommand.php +++ b/framework/main/classes/commands/class_BaseCommand.php @@ -5,6 +5,7 @@ namespace CoreFramework\Command; // Import framework stuff use CoreFramework\Factory\ObjectFactory; use CoreFramework\Object\BaseFrameworkSystem; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Response\Responseable; @@ -55,7 +56,7 @@ class BaseCommand extends BaseFrameworkSystem { assert(!$requestInstance->isPostRequestMethod()); // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlConfirmCommand.php b/framework/main/classes/commands/html/class_HtmlConfirmCommand.php index ac5fc6bb..9ad52885 100644 --- a/framework/main/classes/commands/html/class_HtmlConfirmCommand.php +++ b/framework/main/classes/commands/html/class_HtmlConfirmCommand.php @@ -73,7 +73,7 @@ class HtmlConfirmCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlHomeCommand.php b/framework/main/classes/commands/html/class_HtmlHomeCommand.php index 6f8be22d..3dd9aa7a 100644 --- a/framework/main/classes/commands/html/class_HtmlHomeCommand.php +++ b/framework/main/classes/commands/html/class_HtmlHomeCommand.php @@ -7,6 +7,7 @@ use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; use CoreFramework\Response\Responseable; @@ -70,7 +71,7 @@ class HtmlHomeCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php b/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php index 10588301..399de5b3 100644 --- a/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLoginAreaCommand.php @@ -98,7 +98,7 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable { } // END - if // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); @@ -197,7 +197,7 @@ class HtmlLoginAreaCommand extends BaseCommand implements Commandable { } // END - if // Get application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Get a resolver $actionResolver = HtmlActionResolver::createHtmlActionResolver($this->actionName, $applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlLoginCommand.php b/framework/main/classes/commands/html/class_HtmlLoginCommand.php index 2ab7b0e6..064b2425 100644 --- a/framework/main/classes/commands/html/class_HtmlLoginCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLoginCommand.php @@ -7,7 +7,6 @@ use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; -use CoreFramework\Registry\Registerable; use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; @@ -35,7 +34,7 @@ use CoreFramework\Response\Responseable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class HtmlLoginCommand extends BaseCommand implements Commandable, Registerable { +class HtmlLoginCommand extends BaseCommand implements Commandable { /** * Protected constructor * @@ -75,7 +74,7 @@ class HtmlLoginCommand extends BaseCommand implements Commandable, Registerable Registry::getRegistry()->addInstance('extra', $this); // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php b/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php index aa4def25..906eb22a 100644 --- a/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLoginFailedCommand.php @@ -7,6 +7,7 @@ use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; use CoreFramework\Response\Responseable; @@ -70,7 +71,7 @@ class HtmlLoginFailedCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlLogoutCommand.php b/framework/main/classes/commands/html/class_HtmlLogoutCommand.php index 9225d79b..58d51479 100644 --- a/framework/main/classes/commands/html/class_HtmlLogoutCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLogoutCommand.php @@ -7,6 +7,7 @@ use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; use CoreFramework\Response\Responseable; @@ -72,9 +73,6 @@ class HtmlLogoutCommand extends BaseCommand implements Commandable { // Get an auth instance for checking and updating the auth cookies $authInstance = ObjectFactory::createObjectByConfiguredName('auth_method_class', array($responseInstance)); - // Set request instance - $authInstance->setRequestInstance($requestInstance); - // Destroy the auth data $authInstance->destroyAuthData(); diff --git a/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php b/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php index fabe6339..7614be13 100644 --- a/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php +++ b/framework/main/classes/commands/html/class_HtmlLogoutDoneCommand.php @@ -7,6 +7,7 @@ use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; use CoreFramework\Response\Responseable; @@ -70,7 +71,7 @@ class HtmlLogoutDoneCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlProblemCommand.php b/framework/main/classes/commands/html/class_HtmlProblemCommand.php index 520f65bc..3759f985 100644 --- a/framework/main/classes/commands/html/class_HtmlProblemCommand.php +++ b/framework/main/classes/commands/html/class_HtmlProblemCommand.php @@ -6,6 +6,7 @@ namespace CoreFramework\Command\Failed; use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; use CoreFramework\Response\Responseable; diff --git a/framework/main/classes/commands/html/class_HtmlRegisterCommand.php b/framework/main/classes/commands/html/class_HtmlRegisterCommand.php index 4198c323..214e18fb 100644 --- a/framework/main/classes/commands/html/class_HtmlRegisterCommand.php +++ b/framework/main/classes/commands/html/class_HtmlRegisterCommand.php @@ -7,7 +7,6 @@ use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; -use CoreFramework\Registry\Registerable; use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; @@ -35,7 +34,7 @@ use CoreFramework\Response\Responseable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class HtmlRegisterCommand extends BaseCommand implements Commandable, Registerable { +class HtmlRegisterCommand extends BaseCommand implements Commandable { /** * Protected constructor * @@ -75,7 +74,7 @@ class HtmlRegisterCommand extends BaseCommand implements Commandable, Registerab Registry::getRegistry()->addInstance('extra', $this); // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php b/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php index 25b9f004..d19d9c24 100644 --- a/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php +++ b/framework/main/classes/commands/html/class_HtmlResendLinkCommand.php @@ -75,7 +75,7 @@ class HtmlResendLinkCommand extends BaseCommand implements Commandable { $userInstance = Registry::getRegistry()->getInstance('user'); // Get an application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Get a RNG instance (Random Number Generator) $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); diff --git a/framework/main/classes/commands/html/class_HtmlStatusCommand.php b/framework/main/classes/commands/html/class_HtmlStatusCommand.php index 5b50a773..ae1325b4 100644 --- a/framework/main/classes/commands/html/class_HtmlStatusCommand.php +++ b/framework/main/classes/commands/html/class_HtmlStatusCommand.php @@ -71,7 +71,7 @@ class HtmlStatusCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php b/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php index a0e329df..b61bcfdd 100644 --- a/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php +++ b/framework/main/classes/commands/image/class_ImageCodeCaptchaCommand.php @@ -6,6 +6,7 @@ namespace CoreFramework\Command\Captcha; use CoreFramework\Command\BaseCommand; use CoreFramework\Command\Commandable; use CoreFramework\Controller\Controller; +use CoreFramework\Registry\Registry; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\Command\CommandResolver; use CoreFramework\Response\Responseable; @@ -72,7 +73,7 @@ class ImageCodeCaptchaCommand extends BaseCommand implements Commandable { $decryptedCode = $requestInstance->getRequestElement('decrypted'); // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + $applicationInstance = Registry::getRegistry()->getInstance('app'); // Prepare a template instance $templateInstance = $this->prepareTemplateInstance($applicationInstance); diff --git a/framework/main/classes/compressor/class_Bzip2Compressor.php b/framework/main/classes/compressor/class_Bzip2Compressor.php index 3708da83..16bffd47 100644 --- a/framework/main/classes/compressor/class_Bzip2Compressor.php +++ b/framework/main/classes/compressor/class_Bzip2Compressor.php @@ -89,7 +89,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { } // END - if // Decompress it - $streamData = bzdecompress($streamData, TRUE); + $streamData = bzdecompress($streamData, true); // Return the decompressed stream return $streamData; diff --git a/framework/main/classes/console/class_ConsoleTools.php b/framework/main/classes/console/class_ConsoleTools.php index 84b72f82..a2f62337 100644 --- a/framework/main/classes/console/class_ConsoleTools.php +++ b/framework/main/classes/console/class_ConsoleTools.php @@ -1,6 +1,6 @@ debugOutput(sprintf('[%s:] Host name to resolve is: %s', - $this->__toString(), - $hostname - )); - - // Default is an invalid one - $ip = '0.0.0.0'; - - // Resolve it - // @TODO Here should the cacher be implemented - $ipResolved = gethostbyname($hostname); - - // Was it fine? - if (($ipResolved !== FALSE) && ($ipResolved != $hostname)) { - // Okay, this works! - $ip = $ipResolved; - - // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] Resolved IP address is: %s', - $this->__toString(), - $ip - )); - } else { - // Problem while resolving IP address - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] Problem resolving IP address for host %s. Please check your /etc/hosts file.', - $this->__toString(), - $hostname - )); - } - - // Return resolved IP - return $ip; - } - /** * Checks wether proxy configuration is used * @@ -180,7 +136,7 @@ class ConsoleTools extends BaseFrameworkSystem { } // END - if // Has an equals sign? - if (strpos($line, '=') !== FALSE) { + if (strpos($line, '=') !== false) { // Then "explode" it again, right part is hostname in quotes $hostData = explode('=', $line); @@ -201,15 +157,71 @@ class ConsoleTools extends BaseFrameworkSystem { return $hostname; } + /** + * Tries to resolve an IP address from given hostname. Currently only IPv + * addresses are resolved. + * + * @param $hostname Host name we shall resolve + * @return $ipAddress IPv4 address resolved from host name + * @todo This should be connected to a caching class to cache DNS requests + */ + public static function resolveIpAddress ($hostname) { + // Debug message + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] Host name to resolve is: %s', + __CLASS__, + $hostname + )); + + // Default is false + $ipAddress = false; + + // Is a dot at the end? + if (substr($hostname, -1, 1) != '.') { + /* + * Then append it to prevent lookup of invalid host names through + * all search-domains. This will greatly improve lookup performance + * and has no disadvantages for anybody. A dot at the end of a + * domain btw means full-qualified domain, do not prepend to any + * other domain, basically. + */ + $hostname .= '.'; + } // END - if + + // Resolve it + // @TODO Here should the cacher be implemented + $ipResolved = gethostbyname($hostname); + + // Was it fine? + if (($ipResolved !== false) && ($ipResolved != $hostname)) { + // Okay, this works! + $ipAddress = $ipResolved; + + // Debug message + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] Resolved IP address is: %s', + __CLASS__, + $ipAddress + )); + } else { + // Problem while resolving IP address + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] Problem resolving IP address for host %s. Please check your /etc/hosts file.', + __CLASS__, + $hostname + )); + } + + // Return resolved IP + return $ipAddress; + } + /** * Aquires the IP address of this host by reading the /etc/hostname file * and solving it. It is now stored in configuration * - * @return $ip Aquired IP address + * @return $ipAddress Aquired IPv4 address */ public static function acquireSelfIPAddress () { // Local IP by default - $ip = '127.0.0.1'; + $ipAddress = '127.0.0.1'; // Get a new instance $helperInstance = new ConsoleTools(); @@ -228,15 +240,15 @@ class ConsoleTools extends BaseFrameworkSystem { $hostname = $helperInstance->extractHostnameFromRawData($rawData); // Resolve the IP number - $ip = $helperInstance->resolveIpAddress($hostname); + $ipAddress = self::resolveIpAddress($hostname); } catch (FileNotFoundException $e) { // Fall-back to 'SESSION_SVR' which found on my Sun Station if (isset($_SERVER['SESSION_SVR'])) { // Resolve it - $ip = $helperInstance->resolveIpAddress($_SERVER['SESSION_SVR']); + $ipAddress = self::resolveIpAddress($_SERVER['SESSION_SVR']); } elseif (isset($_SERVER['COMPUTERNAME'])) { - // May happen on some XP systems, so also try this - $ip = $helperInstance->resolveIpAddress($_SERVER['COMPUTERNAME']); + // May happen on some Windows XP systems, so also try this + $ipAddress = self::resolveIpAddress($_SERVER['COMPUTERNAME']); } else { // Could not find our hostname self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:] WARNING: Cannot resolve my own IP address.', @@ -254,10 +266,10 @@ class ConsoleTools extends BaseFrameworkSystem { } // Set it in configuration - FrameworkConfiguration::getSelfInstance()->setServerAddress($ip); + FrameworkConfiguration::getSelfInstance()->setServerAddress($ipAddress); // Return it - return $ip; + return $ipAddress; } /** @@ -285,12 +297,12 @@ class ConsoleTools extends BaseFrameworkSystem { // @TODO Add some DNS caching here // Open connection - if ($helperInstance->isProxyUsed() === TRUE) { + if ($helperInstance->isProxyUsed() === true) { // Resolve hostname into IP address - $ip = $helperInstance->resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host')); + $ipAddress = self::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host')); // Connect to host through proxy connection - $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30); + $socketResource = fsockopen($ipAddress, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30); } else { // Connect to host directly $socketResource = fsockopen('188.138.90.169', 80, $errorNo, $errorStr, 30); @@ -303,13 +315,13 @@ class ConsoleTools extends BaseFrameworkSystem { } // END - if // Prepare the GET request - $request = 'GET ' . ($helperInstance->isProxyUsed() === TRUE ? 'http://shipsimu.org' : '') . '/ip.php HTTP/1.0' . self::HTTP_EOL; + $request = 'GET ' . ($helperInstance->isProxyUsed() === true ? 'http://shipsimu.org' : '') . '/ip.php HTTP/1.0' . self::HTTP_EOL; $request .= 'Host: shipsimu.org' . self::HTTP_EOL; $request .= 'User-Agent: ' . self::HTTP_USER_AGENT . self::HTTP_EOL; $request .= 'Connection: close' . self::HTTP_EOL; // Do we use proxy? - if ($helperInstance->isProxyUsed() === TRUE) { + if ($helperInstance->isProxyUsed() === true) { // CONNECT method? if ($helperInstance->getConfigInstance()->getConfigEntry('proxy_connect_method') == 'Y') { // Setup proxy tunnel @@ -318,7 +330,7 @@ class ConsoleTools extends BaseFrameworkSystem { // If the response is invalid, abort if ((count($response) == 3) && (empty($response[0])) && (empty($response[1])) && (empty($response[2]))) { // Invalid response! - $helperInstance->debugBackTrace('Proxy tunnel not working: response=' . print_r($response, TRUE)); + $helperInstance->debugBackTrace('Proxy tunnel not working: response=' . print_r($response, true)); } // END - if } else { // Add header for proxy @@ -397,7 +409,7 @@ class ConsoleTools extends BaseFrameworkSystem { $type = 'console'; // Now, do we have a request method, or query string set? - if ((isset($_SERVER['REQUEST_METHOD'])) || (isset($_SERVER['QUERY_STRING']))) { + if (self::analyzeEnvironmentForType() == 'http') { // Possibly HTTP request $type = 'web'; } // END - if diff --git a/framework/main/classes/container/socket/class_SocketContainer.php b/framework/main/classes/container/socket/class_SocketContainer.php index fa1d2aab..b3c66caa 100644 --- a/framework/main/classes/container/socket/class_SocketContainer.php +++ b/framework/main/classes/container/socket/class_SocketContainer.php @@ -56,7 +56,7 @@ class SocketContainer extends BaseContainer implements Registerable { unset($packageData[NetworkPackage::PACKAGE_DATA_HASH]); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']:socketResource=' . $socketResource . ',packageData='.print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']:socketResource=' . $socketResource . ',packageData='.print_r($packageData, true)); // Is the info instance set? if ($infoInstance instanceof ShareableInfo) { @@ -104,7 +104,7 @@ class SocketContainer extends BaseContainer implements Registerable { $packageData = $this->getPackageData(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',packageData=' . print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',packageData=' . print_r($packageData, true)); // So, does both match? $matches = ((isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) && ($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] === $unl)); diff --git a/framework/main/classes/criteria/class_BaseCriteria.php b/framework/main/classes/criteria/class_BaseCriteria.php index 3fa951dc..7073abb6 100644 --- a/framework/main/classes/criteria/class_BaseCriteria.php +++ b/framework/main/classes/criteria/class_BaseCriteria.php @@ -60,7 +60,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { */ public function isKeySet ($criteriaType, $criteriaKey) { // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE)); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false)); // Determine it $isSet = $this->isGenericArrayElementSet('criteria', $criteriaType, 'entries', $criteriaKey); @@ -146,7 +146,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { */ public final function unsetCriteria ($criteriaKey) { // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE)); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false)); // Convert dashes to underscore $criteriaKey = self::convertDashesToUnderscores($criteriaKey); @@ -172,7 +172,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue . ',criteriaType=' . $criteriaType . ' - CALLED!'); // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue))); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false) && (!is_bool($criteriaValue))); // Convert dashes to underscore $criteriaKey = self::convertDashesToUnderscores($criteriaKey); @@ -198,7 +198,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue . ',criteriaType=' . $criteriaType . ' - CALLED!'); // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue))); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false) && (!is_bool($criteriaValue))); // Convert dashes to underscore $criteriaKey = self::convertDashesToUnderscores($criteriaKey); @@ -220,7 +220,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { */ public final function addChoiceCriteria ($criteriaKey, $criteriaValue) { // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue))); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false) && (!is_bool($criteriaValue))); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '(' . $this->__toString() . ')-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue); @@ -257,18 +257,18 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { } /** - * Get criteria element or FALSE if not found + * Get criteria element or false if not found * * @param $criteriaKey The requested criteria key * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' - * @return $value Whether the value of the critera or FALSE + * @return $value Whether the value of the critera or false */ public function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default') { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaType=' . $criteriaType . ' - CALLED!'); // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE)); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false)); // Convert dashes to underscore $criteriaKey = self::convertDashesToUnderscores($criteriaKey); @@ -277,7 +277,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($criteriaType) . '-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteria()=' . $this->countGenericArrayGroup('criteria', $criteriaType)); // Default is not found - $value = FALSE; + $value = false; // Is the criteria there? if ($this->isKeySet($criteriaType, $criteriaKey)) { @@ -293,10 +293,10 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { } /** - * Get criteria element or FALSE if not found for 'choice' type + * Get criteria element or false if not found for 'choice' type * * @param $criteriaKey The requested criteria key - * @return $value Whether the value of the critera or FALSE + * @return $value Whether the value of the critera or false */ public function getCriteriaChoiceElemnent ($criteriaKey) { // Call inner method @@ -304,10 +304,10 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { } /** - * Get criteria element or FALSE if not found for 'exclude' type + * Get criteria element or false if not found for 'exclude' type * * @param $criteriaKey The requested criteria key - * @return $value Whether the value of the critera or FALSE + * @return $value Whether the value of the critera or false */ public function getCriteriaExcludeElemnent ($criteriaKey) { // Call inner method @@ -323,13 +323,13 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { */ public function ifEntryMatches (array $entryArray, $criteriaType = 'default') { // First nothing matches and nothing is counted - $matches = FALSE; + $matches = false; $counted = 0; // Walk through all entries foreach ($entryArray as $key => $entry) { // Make sure no 'my-' or 'my_' passes this point - assert((strpos($key, 'my-') === FALSE) && (strpos($key, 'my_') === FALSE)); + assert((strpos($key, 'my-') === false) && (strpos($key, 'my_') === false)); // Convert dashes to underscore $key = self::convertDashesToUnderscores($key); @@ -337,7 +337,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { // Then walk through all search criteria foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) { // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue))); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false) && (!is_bool($criteriaValue))); // Convert dashes to underscore $criteriaKey = self::convertDashesToUnderscores($criteriaKey); @@ -399,7 +399,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { // Now walk through all criterias foreach ($this->getGenericArrayKey('criteria', $criteriaType, 'entries') as $criteriaKey => $criteriaValue) { // Make sure no 'my-' or 'my_' passes this point - assert((strpos($criteriaKey, 'my-') === FALSE) && (strpos($criteriaKey, 'my_') === FALSE) && (!is_bool($criteriaValue))); + assert((strpos($criteriaKey, 'my-') === false) && (strpos($criteriaKey, 'my_') === false) && (!is_bool($criteriaValue))); // $criteriaValue cannot be an array assert(!is_array($criteriaValue)); diff --git a/framework/main/classes/criteria/search/class_SearchCriteria.php b/framework/main/classes/criteria/search/class_SearchCriteria.php index 58e0b5e7..e6f71ea2 100644 --- a/framework/main/classes/criteria/search/class_SearchCriteria.php +++ b/framework/main/classes/criteria/search/class_SearchCriteria.php @@ -147,7 +147,7 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaElement(' . $key . ')[' . gettype($searchDefault) . ']=' . $searchDefault); // 'default' check - $isMatching = (((($searchDefault !== FALSE) && ($searchDefault == $value)) || ((is_null($searchDefault)) && (is_null($value)))) || ($searchDefault === FALSE)); + $isMatching = (((($searchDefault !== false) && ($searchDefault == $value)) || ((is_null($searchDefault)) && (is_null($value)))) || ($searchDefault === false)); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaElement(' . $key . ')[' . gettype($searchDefault) . ']=' . $searchDefault . ',isMatching=' . intval($isMatching)); @@ -155,16 +155,16 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { // Get 'choice' search value (can be NULL or $separator-separated string) $searchChoice = $this->getCriteriaChoiceElemnent($key); - // May be FALSE or array - assert(($searchChoice === FALSE) || (is_array($searchChoice))); + // May be false or array + assert(($searchChoice === false) || (is_array($searchChoice))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[' . gettype($searchChoice) . ']=' . print_r($searchChoice, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[' . gettype($searchChoice) . ']=' . print_r($searchChoice, true)); // 'choice' check if ((is_array($searchChoice)) && (count($valueArray) == 1)) { // $value is a single-search value, so use in_array() - $isMatching = ((($isMatching === TRUE) || (($searchDefault === FALSE) && (!is_null($value)))) && (in_array($value, $searchChoice))); + $isMatching = ((($isMatching === true) || (($searchDefault === false) && (!is_null($value)))) && (in_array($value, $searchChoice))); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[]=' . gettype($searchChoice) . ',value[' . gettype($value) . ']=' . $value . ',isMatching=' . intval($isMatching) . ' - SINGLE-MATCH'); @@ -173,14 +173,14 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[]=' . gettype($searchChoice) . ',valueArray()=' . count($valueArray) . ',isMatching=' . intval($isMatching)); // $value is choice-search value, so check all entries - $isMatching = (($isMatching === TRUE) || (($searchDefault === FALSE) && (!is_null($value)))); + $isMatching = (($isMatching === true) || (($searchDefault === false) && (!is_null($value)))); $idx = 0; foreach ($valueArray as $idx => $match) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: match=' . $match . ',count(searchChoice)=' . count($searchChoice)); // Is it found? (one is okay) - $isMatching = (($isMatching === TRUE) && (in_array($match, $searchChoice))); + $isMatching = (($isMatching === true) && (in_array($match, $searchChoice))); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: match=' . $match . ',isMatching=' . intval($isMatching)); @@ -189,9 +189,9 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[]=' . gettype($searchChoice) . ',valueArray()=' . count($valueArray) . ',idx=' . $idx . ',isMatching=' . intval($isMatching) . ' - CHOICE-MATCH'); } else { - // Choice-match is FALSE + // Choice-match is false // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[]=' . gettype($searchChoice) . ',value[' . gettype($value) . ']=' . $value . ',isMatching=' . intval($isMatching) . ' - FALSE-MATCH'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SEARCH-CRITERIA[' . __METHOD__ . ':' . __LINE__ . ']: getCriteriaChoiceElement(' . $key . ')[]=' . gettype($searchChoice) . ',value[' . gettype($value) . ']=' . $value . ',isMatching=' . intval($isMatching) . ' - false-MATCH'); } // Debug message @@ -207,16 +207,16 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { $isMatching = ( ( ( - $isMatching === TRUE + $isMatching === true ) && ( - $searchExclude === FALSE + $searchExclude === false ) ) || ( ( ( - $isMatching === TRUE + $isMatching === true ) && ( - $searchExclude !== FALSE + $searchExclude !== false ) && ( $searchExclude !== $value ) diff --git a/framework/main/classes/crypto/class_CryptoHelper.php b/framework/main/classes/crypto/class_CryptoHelper.php index 9a31a269..b4043172 100644 --- a/framework/main/classes/crypto/class_CryptoHelper.php +++ b/framework/main/classes/crypto/class_CryptoHelper.php @@ -151,7 +151,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable { $uuid = ''; // Is the UUID extension loaded and enabled? (see pecl) - if ($this->getConfigInstance()->getConfigEntry('extension_uuid_loaded') === TRUE) { + if ($this->getConfigInstance()->getConfigEntry('extension_uuid_loaded') === true) { // Then add it as well $uuid = uuid_create(); } // END - if @@ -171,7 +171,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable { * @param $withFixed Whether to include a fixed salt (not recommended in p2p applications) * @return $hashed The hashed and salted string */ - public function hashString ($str, $oldHash = '', $withFixed = TRUE) { + public function hashString ($str, $oldHash = '', $withFixed = true) { // Cast the string $str = (string) $str; @@ -189,7 +189,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable { // Hash the password with salt //* DEBUG: */ echo "salt=".$salt."/plain=".$str."
\n"; - if ($withFixed === TRUE) { + if ($withFixed === true) { // Use additional fixed salt $hashed = $salt . md5(sprintf($this->getConfigInstance()->getConfigEntry('hash_extra_mask'), $salt, diff --git a/framework/main/classes/database/backend/class_CachedLocalFileDatabase.php b/framework/main/classes/database/backend/class_CachedLocalFileDatabase.php index a2f65b40..2efa187e 100644 --- a/framework/main/classes/database/backend/class_CachedLocalFileDatabase.php +++ b/framework/main/classes/database/backend/class_CachedLocalFileDatabase.php @@ -58,7 +58,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac /** * Whether the "connection is already up */ - private $alreadyConnected = FALSE; + private $alreadyConnected = false; /** * Table information array @@ -189,11 +189,11 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac $serializedData = $this->getCompressorChannel()->getCompressor()->decompressStream($compressedData); // Unserialize it - $dataArray = json_decode($serializedData, TRUE); + $dataArray = json_decode($serializedData, true); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: Read ' . count($dataArray) . ' elements from database file ' . $fqfn . '.'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataArray=' . print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataArray=' . print_r($dataArray, true)); // Finally return it return $dataArray; @@ -209,7 +209,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac private function writeDataArrayToFqfn ($fqfn, array $dataArray) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file ' . $fqfn . ' ...'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataArray=' . print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataArray=' . print_r($dataArray, true)); // Serialize and compress it $compressedData = $this->getCompressorChannel()->getCompressor()->compressStream(json_encode($dataArray)); @@ -319,7 +319,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac $infoArray = $this->getContentsFromTableInfoFile($dataSetInstance); // Is the primary key there? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: tableInfo=' . print_r($this->tableInfo, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: tableInfo=' . print_r($this->tableInfo, true)); if (!isset($this->tableInfo[$tableName]['primary'])) { // Then create the info file $this->createTableInfoFile($dataSetInstance); @@ -393,12 +393,12 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac // Read the file $dataArray = $this->getDataArrayFromFile($pathName . $dataFile); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',dataArray='.print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',dataArray='.print_r($dataArray, true)); // Is this an array? if (is_array($dataArray)) { // Default is nothing found - $isFound = TRUE; + $isFound = true; // Search in the criteria with FMFW (First Matches, First Wins) foreach ($dataArray as $key => $value) { @@ -406,13 +406,13 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac assert(!is_bool($value)); // Found one entry? - $isFound = (($isFound === TRUE) && ($searchInstance->isCriteriaMatching($key, $value))); + $isFound = (($isFound === true) && ($searchInstance->isCriteriaMatching($key, $value))); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: key=' . $key . ',value=' . $value . ',isFound=' . intval($isFound)); } // END - foreach // Is all found? //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: isFound=' . intval($isFound) . ',limitFound=' . $limitFound . ',limit=' . $searchInstance->getLimit()); - if ($isFound === TRUE) { + if ($isFound === true) { // Shall we skip this entry? if ($searchInstance->getSkip() > 0) { // We shall skip some entries @@ -427,7 +427,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac $dataArray[$this->getIndexKey()] = $idx; // Entry found! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: indexKey=' . $this->getIndexKey() . ',idx=' . $idx . ',dataArray=' . print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: indexKey=' . $this->getIndexKey() . ',idx=' . $idx . ',dataArray=' . print_r($dataArray, true)); array_push($resultData[BaseDatabaseBackend::RESULT_INDEX_ROWS], $dataArray); // Count found entries up @@ -531,12 +531,12 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac // Open this file for reading $dataArray = $this->getDataArrayFromFile($pathName . $dataFile); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',dataArray='.print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',dataArray='.print_r($dataArray, true)); // Is this an array? if (is_array($dataArray)) { // Default is nothing found - $isFound = TRUE; + $isFound = true; // Search in the criteria with FMFW (First Matches, First Wins) foreach ($dataArray as $key => $value) { @@ -544,12 +544,12 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac assert(!is_bool($value)); // Found one entry? - $isFound = (($isFound === TRUE) && ($searchInstance->isCriteriaMatching($key, $value))); + $isFound = (($isFound === true) && ($searchInstance->isCriteriaMatching($key, $value))); } // END - foreach // Is all found? //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: isFound=' . intval($isFound)); - if ($isFound === TRUE) { + if ($isFound === true) { // Shall we skip this entry? if ($searchInstance->getSkip() > 0) { // We shall skip some entries @@ -632,7 +632,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac unset($data[$this->indexKey]); // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: data[' . gettype($data) . ']='.print_r($data, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE: data[' . gettype($data) . ']='.print_r($data, true)); return $data; } diff --git a/framework/main/classes/database/class_BaseDatabaseWrapper.php b/framework/main/classes/database/class_BaseDatabaseWrapper.php index edc28b9d..dbf0872e 100644 --- a/framework/main/classes/database/class_BaseDatabaseWrapper.php +++ b/framework/main/classes/database/class_BaseDatabaseWrapper.php @@ -62,7 +62,7 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { */ private final function initCacheInstance () { // Is the cache enabled? - if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) { + if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) { // Set the new instance $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache(); } // END - if @@ -99,14 +99,14 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { $cacheKey = NULL; // Is cache enabled? - if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) { + if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) { // First get a key suitable for our cache and extend it with this class name $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys); //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...'); } // END - if // Does this key exists in cache? - if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) && ($this->cacheInstance->offsetExists($cacheKey))) { + if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey))) { // Purge the cache $this->cacheInstance->purgeOffset($cacheKey); } // END - if @@ -127,14 +127,14 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { $cacheKey = NULL; // Is cache enabled? - if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) { + if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) { // First get a key suitable for our cache and extend it with this class name $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys); //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...'); } // END - if // Does this key exists in cache? - if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) && ($this->cacheInstance->offsetExists($cacheKey))) { + if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey))) { // Purge the cache $this->cacheInstance->purgeOffset($cacheKey); } // END - if @@ -174,15 +174,15 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { $cacheKey = NULL; // Is the cache enabled? - if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) { + if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) { // First get a key suitable for our cache and extend it with this class name $cacheKey = $this->getCacheKeyByCriteria($criteriaInstance, $onlyKeys); } // END - if // Does this key exists in cache? - if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) && ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1))) { + if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) && ($this->cacheInstance->offsetExists($cacheKey, BaseDatabaseBackend::RESULT_INDEX_ROWS, 1))) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Cache used for cacheKey=' . $cacheKey . ':' . print_r($this->cacheInstance->offsetGet($cacheKey), TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-WRAPPER: Cache used for cacheKey=' . $cacheKey . ':' . print_r($this->cacheInstance->offsetGet($cacheKey), true)); // Then use this result $result = $this->cacheInstance->offsetGet($cacheKey); @@ -197,7 +197,7 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem { // Cache the result if not null if (!is_null($result)) { // Is cache enabled? - if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) { + if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === true) { // A valid result has returned from the database layer $this->cacheInstance->offsetSet($cacheKey, $result); } // END - if diff --git a/framework/main/classes/database/result/class_CachedDatabaseResult.php b/framework/main/classes/database/result/class_CachedDatabaseResult.php index 9c2586c9..17cf461d 100644 --- a/framework/main/classes/database/result/class_CachedDatabaseResult.php +++ b/framework/main/classes/database/result/class_CachedDatabaseResult.php @@ -140,14 +140,14 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function next () { // Default is not valid - $nextValid = FALSE; + $nextValid = false; // Is the result valid? if ($this->valid()) { // Next entry found, so count one up and cache it $this->currentPos++; $this->currentRow = $this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][$this->currentPos]; - $nextValid = TRUE; + $nextValid = true; } // END - if // Return the result @@ -197,7 +197,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function valid () { // By default nothing is valid - $isValid = FALSE; + $isValid = false; // Debug message //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] this->currentPos=' . $this->currentPos); @@ -205,7 +205,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul // Check if all is fine ... if (($this->ifStatusIsOkay()) && (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][($this->currentPos + 1)])) && (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][0]))) { // All fine! - $isValid = TRUE; + $isValid = true; } // END - if // Return the result @@ -373,7 +373,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul */ public function find ($key) { // By default nothing is found - $found = FALSE; + $found = false; // Rewind the pointer $this->rewind(); @@ -389,7 +389,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul // Is the element there? if (isset($currentEntry[$key])) { // Okay, found! - $found = TRUE; + $found = true; // So "cache" it $this->foundValue = $currentEntry[$key]; diff --git a/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php b/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php index 9b4e6a03..a8b18f09 100644 --- a/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php +++ b/framework/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php @@ -66,7 +66,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT * @param $add Whether add this group * @return void */ - public function setVariableGroup ($groupName, $add = TRUE) { + public function setVariableGroup ($groupName, $add = true) { // Call the inner class' method $this->getTemplateInstance()->setVariableGroup($groupName, $add); } @@ -289,7 +289,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT * @param $setMatchAsCode Sets $match if readVariable() returns empty result * @return $rawCode Compile code with inserted variable value */ - public function compileRawCode ($rawCode, $setMatchAsCode = FALSE) { + public function compileRawCode ($rawCode, $setMatchAsCode = false) { return $this->getTemplateInstance()->compileRawCode($rawCode, $setMatchAsCode); } @@ -343,7 +343,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT * @param $languageSupport New language support setting * @return void */ - public function enableLanguageSupport ($languageSupport = TRUE) { + public function enableLanguageSupport ($languageSupport = true) { // Call the inner class' method $this->getTemplateInstance()->enableLanguageSupport($languageSupport); } @@ -364,7 +364,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT * @param $xmlCompacting New XML compacting setting * @return void */ - public function enableXmlCompacting ($xmlCompacting = TRUE) { + public function enableXmlCompacting ($xmlCompacting = true) { // Call the inner class' method $this->getTemplateInstance()->enableXmlCompacting($xmlCompacting); } diff --git a/framework/main/classes/factories/client/class_ClientFactory.php b/framework/main/classes/factories/client/class_ClientFactory.php index 38f1bf83..5da193dc 100644 --- a/framework/main/classes/factories/client/class_ClientFactory.php +++ b/framework/main/classes/factories/client/class_ClientFactory.php @@ -47,7 +47,7 @@ class ClientFactory extends ObjectFactory { * @param $socketResource A valid socket resource (optional) * @return $clientInstance An instance of the requested client */ - public static final function createClientByProtocolInstance (HandleableProtocol $protocolInstance, $socketResource = FALSE) { + public static final function createClientByProtocolInstance (HandleableProtocol $protocolInstance, $socketResource = false) { // Default is NULL (to initialize variable) $clientInstance = NULL; diff --git a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php index 2b82f60a..73d455ea 100644 --- a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php +++ b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php @@ -59,7 +59,7 @@ class XmlTemplateEngineFactory extends ObjectFactory { $templateInstance = ObjectFactory::createObjectByConfiguredName($configEntry); // Disable language support - $templateInstance->enableLanguageSupport(FALSE); + $templateInstance->enableLanguageSupport(false); /* * Enable compacting/rewriting of the XML to save bandwidth from XML diff --git a/framework/main/classes/feature/class_ b/framework/main/classes/feature/class_ index e9991521..20a04fd7 100644 --- a/framework/main/classes/feature/class_ +++ b/framework/main/classes/feature/class_ @@ -60,7 +60,7 @@ class ???Feature extends BaseFeature implements Feature { */ public function isFeatureAvailable () { // Default is not available - $isAvailable = FALSE; + $isAvailable = false; // Unfinished: $this->partialStub('Please implement this method.'); diff --git a/framework/main/classes/feature/class_FrameworkFeature.php b/framework/main/classes/feature/class_FrameworkFeature.php index 5ae33127..09fa8263 100644 --- a/framework/main/classes/feature/class_FrameworkFeature.php +++ b/framework/main/classes/feature/class_FrameworkFeature.php @@ -41,16 +41,16 @@ class FrameworkFeature extends BaseFrameworkSystem { * A typical available entry looks like this: * * array( - * 'is_enabled' => TRUE, - * 'is_available' => TRUE, + * 'is_enabled' => true, + * 'is_available' => true, * 'instance' => SomeFeature Object * ) * * And a typical disabled entry looks like this: * * array( - * 'is_enabled' => FALSE, - * 'is_available' => FALSE, + * 'is_enabled' => false, + * 'is_available' => false, * 'instance' => NULL * ) */ @@ -104,14 +104,14 @@ class FrameworkFeature extends BaseFrameworkSystem { // Is the cache set? if (!isset(self::$enabledFeatures[$featureName]['is_available'])) { // Default is not available - self::$enabledFeatures[$featureName]['is_available'] = FALSE; + self::$enabledFeatures[$featureName]['is_available'] = false; self::$enabledFeatures[$featureName]['instance'] = NULL; // Is the feature enabled? if (!self::isFeatureEnabled($featureName)) { // Then it can't be available self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: Feature "%s"is not enabled.', __METHOD__, __LINE__, $featureName)); - return FALSE; + return false; } // END - if // Create config key (for feature class lookup) @@ -154,7 +154,7 @@ class FrameworkFeature extends BaseFrameworkSystem { public static function callFeature ($featureName, $featureMethod, array $args = NULL) { /* * Please make sure that isFeatureAvailable() has been called and it has - * returned TRUE before calling this method. + * returned true before calling this method. */ assert(self::isFeatureAvailable($featureName)); diff --git a/framework/main/classes/feature/fuse/class_FuseFeature.php b/framework/main/classes/feature/fuse/class_FuseFeature.php index 348fbf8b..7c88644b 100644 --- a/framework/main/classes/feature/fuse/class_FuseFeature.php +++ b/framework/main/classes/feature/fuse/class_FuseFeature.php @@ -60,7 +60,7 @@ class FuseFeature extends BaseFeature implements Feature { */ public function isFeatureAvailable () { // Default is not available - $isAvailable = FALSE; + $isAvailable = false; // Unfinished: $this->partialStub('Please implement this method.'); diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php index fc4140cd..e55a95fb 100644 --- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php +++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php @@ -152,7 +152,7 @@ class BaseBinaryFile extends BaseAbstractFile { /* Only for debugging if (isset($this->gaps[0])) { // Output first and last gap - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] this->gaps[0]=%s,this->gaps[%s]=%s', __METHOD__, __LINE__, print_r($this->gaps[0], TRUE), (count($this->gaps) - 1), print_r($this->gaps[count($this->gaps) - 1], TRUE))); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] this->gaps[0]=%s,this->gaps[%s]=%s', __METHOD__, __LINE__, print_r($this->gaps[0], true), (count($this->gaps) - 1), print_r($this->gaps[count($this->gaps) - 1], true))); } // END - if */ @@ -318,7 +318,7 @@ class BaseBinaryFile extends BaseAbstractFile { */ public static function isBlockSeparatorFound ($str) { // Determine it - $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== FALSE); + $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== false); // Return result return $isFound; @@ -403,7 +403,7 @@ class BaseBinaryFile extends BaseAbstractFile { * @param $flushHeader Whether to flush the header (default: flush) * @return void */ - public function writeData ($seekPosition, $data, $flushHeader = TRUE) { + public function writeData ($seekPosition, $data, $flushHeader = true) { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data()=%d - CALLED!', __METHOD__, __LINE__, $seekPosition, strlen($data))); // Write data at given position @@ -416,7 +416,7 @@ class BaseBinaryFile extends BaseAbstractFile { $this->updateSeekPosition(); // Flush the header? - if ($flushHeader === TRUE) { + if ($flushHeader === true) { // Flush header $this->flushFileHeader(); @@ -453,7 +453,7 @@ class BaseBinaryFile extends BaseAbstractFile { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__)); // Default is not initialized - $isInitialized = FALSE; + $isInitialized = false; // Is the file initialized? if ($this->isFileInitialized()) { @@ -471,7 +471,7 @@ class BaseBinaryFile extends BaseAbstractFile { $this->readFileHeader(); // The above method does already check the header - $isInitialized = TRUE; + $isInitialized = true; } // END - if // Return result @@ -487,12 +487,12 @@ class BaseBinaryFile extends BaseAbstractFile { public function isFileInitialized () { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__)); - // Get it from iterator which holds the pointer instance. If FALSE is returned + // Get it from iterator which holds the pointer instance. If false is returned $fileSize = $this->size(); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] fileSize=%s', __METHOD__, __LINE__, $fileSize)); /* - * The returned file size should not be FALSE or NULL as this means + * The returned file size should not be false or NULL as this means * that the pointer class does not work correctly. */ assert(is_int($fileSize)); @@ -754,7 +754,7 @@ class BaseBinaryFile extends BaseAbstractFile { $dataArray = explode(chr(self::SEPARATOR_ENTRIES), $data); // This array must contain two elements - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('dataArray=' . print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('dataArray=' . print_r($dataArray, true)); assert(count($dataArray) == 2); // Left part is the actual block, right one the back-buffer data @@ -764,7 +764,7 @@ class BaseBinaryFile extends BaseAbstractFile { /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid */ diff --git a/framework/main/classes/file_directories/binary/index/class_IndexFile.php b/framework/main/classes/file_directories/binary/index/class_IndexFile.php index 1e4fa7a4..3fa46515 100644 --- a/framework/main/classes/file_directories/binary/index/class_IndexFile.php +++ b/framework/main/classes/file_directories/binary/index/class_IndexFile.php @@ -69,7 +69,7 @@ class IndexFile extends BaseBinaryFile implements Block { * @throws UnsupportedOperationException If this method is called */ public function writeValueToFile ($groupId, $value) { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',value[' . gettype($value) . ']=' . print_r($value, true)); throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/file_directories/class_BaseAbstractFile.php b/framework/main/classes/file_directories/class_BaseAbstractFile.php index a702c683..b867067b 100644 --- a/framework/main/classes/file_directories/class_BaseAbstractFile.php +++ b/framework/main/classes/file_directories/class_BaseAbstractFile.php @@ -183,7 +183,7 @@ class BaseAbstractFile extends BaseFrameworkSystem implements FilePointer, Close * Write data to a file pointer * * @param $dataStream The data stream we shall write to the file - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error * @throws NullPointerException If the file pointer instance * is not set by setPointer() * @throws InvalidResourceException If there is being set diff --git a/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php b/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php index 8bcb3ccf..64688af7 100644 --- a/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php +++ b/framework/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php @@ -77,7 +77,7 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem implements Framework * @throws PathReadProtectedException If the provided path name is read-protected * @todo Get rid of inConstructor, could be old-lost code. */ - public static final function createFrameworkDirectoryPointer ($pathName, $inConstructor = FALSE) { + public static final function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) { // Some pre-sanity checks... if (is_null($pathName)) { // No pathname given diff --git a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php index a75f0ec4..e2f81c50 100644 --- a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php +++ b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php @@ -3,6 +3,7 @@ namespace CoreFramework\Filesystem\Pointer\Input; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\FileSystem\BaseFileIo; use CoreFramework\Filesystem\Pointer\InputPointer; use CoreFramework\Generic\NullPointerException; @@ -57,20 +58,20 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer { if ((is_null($fileName)) || (empty($fileName))) { // No filename given throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) { + } elseif (!FrameworkBootstrap::isReachableFilePath($fileName)) { // File cannot be accessed (due to open_basedir restriction) throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE); - } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) { + } elseif ((!FrameworkBootstrap::isReadableFile($fileName)) && (file_exists($fileName))) { // File exists but cannot be read from throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ); - } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (!file_exists($fileName))) { + } elseif ((!FrameworkBootstrap::isReadableFile($fileName)) && (!file_exists($fileName))) { // File does not exist throw new FileNotFoundException($fileName, self::EXCEPTION_FILE_NOT_FOUND); } // Try to open a handler $filePointer = fopen($fileName, 'rb'); - if ((is_null($filePointer)) || ($filePointer === FALSE)) { + if ((is_null($filePointer)) || ($filePointer === false)) { // Something bad happend throw new FileIoException($fileName, self::EXCEPTION_FILE_POINTER_INVALID); } // END - if @@ -159,7 +160,7 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer { /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid * @throws UnsupportedOperationException If this method is called diff --git a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php index 5347f34d..024ad4e0 100644 --- a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php +++ b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php @@ -3,6 +3,7 @@ namespace CoreFramework\Filesystem\Pointer\Input; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\FileSystem\BaseFileIo; use CoreFramework\Filesystem\Pointer\InputPointer; use CoreFramework\Generic\NullPointerException; @@ -56,20 +57,20 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { if ((is_null($fileName)) || (empty($fileName))) { // No filename given throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) { + } elseif (!FrameworkBootstrap::isReachableFilePath($fileName)) { // File cannot be reached throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE); - } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (!file_exists($fileName))) { + } elseif ((!FrameworkBootstrap::isReadableFile($fileName)) && (!file_exists($fileName))) { // File does not exist! throw new FileNotFoundException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ); - } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) { + } elseif ((!FrameworkBootstrap::isReadableFile($fileName)) && (file_exists($fileName))) { // File cannot be read from (but exists) throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ); } // Try to open a handler $filePointer = fopen($fileName, 'r'); - if ((is_null($filePointer)) || ($filePointer === FALSE)) { + if ((is_null($filePointer)) || ($filePointer === false)) { // Something bad happend throw new FileIoException($fileName, self::EXCEPTION_FILE_POINTER_INVALID); } // END - if @@ -161,7 +162,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid * @throws UnsupportedOperationException If this method is called diff --git a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php index ee070c7c..6e5814f9 100644 --- a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php +++ b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php @@ -3,6 +3,7 @@ namespace CoreFramework\Filesystem\Pointer; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\FileSystem\BaseFileIo; use CoreFramework\Generic\NullPointerException; use CoreFramework\Object\BaseFrameworkSystem; @@ -57,10 +58,10 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP if ((is_null($fileName)) || (empty($fileName))) { // No filename given throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) { + } elseif (!FrameworkBootstrap::isReachableFilePath($fileName)) { // File exists but cannot be read throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE); - } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) { + } elseif ((!FrameworkBootstrap::isReadableFile($fileName)) && (file_exists($fileName))) { // File exists but cannot be read throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ); } elseif ((file_exists($fileName)) && (!is_writable($fileName))) { @@ -73,7 +74,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP // Try to open a handler $filePointer = fopen($fileName, 'c+b'); - if ((is_null($filePointer)) || ($filePointer === FALSE)) { + if ((is_null($filePointer)) || ($filePointer === false)) { // Something bad happend throw new FileIoException($fileName, self::EXCEPTION_FILE_POINTER_INVALID); } // END - if @@ -129,7 +130,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP * Write data to a file pointer * * @param $dataStream The data stream we shall write to the file - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error */ public function writeToFile ($dataStream) { // Validate the pointer @@ -144,7 +145,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP * * @param $seekPosition Seek position in file * @param $data Data to be written - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error */ public function writeAtPosition ($seekPosition, $data) { // First seek to it @@ -239,7 +240,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid * @throws UnsupportedOperationException If this method is called diff --git a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php index 893c4f56..4be0c808 100644 --- a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php @@ -59,7 +59,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer // Try to open a handler $filePointer = @fopen($fileName, $mode); - if ((is_null($filePointer)) || ($filePointer === FALSE)) { + if ((is_null($filePointer)) || ($filePointer === false)) { // Something bad happend throw new FileIoException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); } // END - if @@ -79,7 +79,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer * Write data to a file pointer * * @param $dataStream The data stream we shall write to the file - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error * @throws NullPointerException If the file pointer instance * is not set by setPointer() * @throws InvalidResourceException If there is being set @@ -115,7 +115,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer * * @param $seekPosition Seek position in file * @param $data Data to be written - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error * @throws UnsupportedOperationException If this method is called */ public function writeAtPosition ($seedPosition, $data) { @@ -134,7 +134,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid * @throws UnsupportedOperationException If this method is called diff --git a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php index f7e5b025..80a25a43 100644 --- a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php @@ -59,7 +59,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer // Try to open a handler $filePointer = @fopen($fileName, $mode); - if ((is_null($filePointer)) || ($filePointer === FALSE)) { + if ((is_null($filePointer)) || ($filePointer === false)) { // Something bad happend throw new FileIoException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); } // END - if @@ -79,7 +79,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer * Write data to a file pointer * * @param $dataStream The data stream we shall write to the file - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error * @throws NullPointerException If the file pointer instance * is not set by setPointer() * @throws InvalidResourceException If there is being set @@ -115,7 +115,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer * * @param $seekPosition Seek position in file * @param $data Data to be written - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error * @throws UnsupportedOperationException If this method is called */ public function writeAtPosition ($seedPosition, $data) { @@ -134,7 +134,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid * @throws UnsupportedOperationException If this method is called diff --git a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php index 93c9aec1..16675fd6 100644 --- a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php +++ b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php @@ -102,7 +102,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { $lineArray = array(); // Whether the parser reads a quoted string (which may contain the column separator again) - $isInQuotes = FALSE; + $isInQuotes = false; // Init column data $column = ''; @@ -116,7 +116,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] idx=%s,char=%s ...', __METHOD__, __LINE__, $idx, $char)); // Is the column separator found and not within quotes? - if (($isInQuotes === FALSE) && ($char == $columnSeparator)) { + if (($isInQuotes === false) && ($char == $columnSeparator)) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Adding column=%s ...', __METHOD__, __LINE__, $column)); @@ -136,7 +136,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] column=%s ...', __METHOD__, __LINE__, $column)); // $column must be empty at this point if we are at starting quote - assert(($isInQuotes === TRUE) || (empty($column))); + assert(($isInQuotes === true) || (empty($column))); // Double-quote found, so flip variable $isInQuotes = (!$isInQuotes); diff --git a/framework/main/classes/filter/auth/class_UserAuthFilter.php b/framework/main/classes/filter/auth/class_UserAuthFilter.php index 63bcc49c..2f0b5539 100644 --- a/framework/main/classes/filter/auth/class_UserAuthFilter.php +++ b/framework/main/classes/filter/auth/class_UserAuthFilter.php @@ -92,9 +92,6 @@ class UserAuthFilter extends BaseFilter implements Filterable { // Then get an auth instance for checking and updating the auth cookies $authInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance)); - // Set request instance - $authInstance->setRequestInstance($requestInstance); - // Now, get the auth data for comparison $authLogin = $authInstance->getUserAuth(); $authHash = $authInstance->getPasswordAuth(); @@ -105,7 +102,7 @@ class UserAuthFilter extends BaseFilter implements Filterable { $authInstance->destroyAuthData(); // Mark the request as invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('auth_data_incomplete'); diff --git a/framework/main/classes/filter/change/class_EmailChangeFilter.php b/framework/main/classes/filter/change/class_EmailChangeFilter.php index 3347823d..632607d8 100644 --- a/framework/main/classes/filter/change/class_EmailChangeFilter.php +++ b/framework/main/classes/filter/change/class_EmailChangeFilter.php @@ -72,7 +72,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Is only first email set? if ((!empty($email1)) && (empty($email2))) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Email 2 is empty $responseInstance->addFatalMessage('email2_empty'); @@ -84,7 +84,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Is only second email set? if ((empty($email1)) && (!empty($email2))) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Email 1 is empty $responseInstance->addFatalMessage('email1_empty'); @@ -96,7 +96,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Do both match? if ($email1 != $email2) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Emails are mismatching $responseInstance->addFatalMessage('emails_mismatch'); @@ -108,7 +108,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Are email and confirmation empty? if ((empty($email1)) && (empty($email2))) { // No email change required! - return TRUE; + return true; } // END - if // Now, get a user instance for comparison @@ -120,7 +120,7 @@ class EmailChangeFilter extends BaseFilter implements Filterable { // Are they different? if ($userEmail == $email1) { // Nothing has been changed is fine... - return TRUE; + return true; } // END - if // Update the "new_email" field diff --git a/framework/main/classes/filter/change/class_PasswordChangeFilter.php b/framework/main/classes/filter/change/class_PasswordChangeFilter.php index a3ccfb82..0b643169 100644 --- a/framework/main/classes/filter/change/class_PasswordChangeFilter.php +++ b/framework/main/classes/filter/change/class_PasswordChangeFilter.php @@ -73,7 +73,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { // Is only first email set? if ((!empty($pass1)) && (empty($pass2))) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Email 2 is empty $responseInstance->addFatalMessage('pass2_empty'); @@ -85,7 +85,7 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { // Is only second pass set? if ((empty($pass1)) && (!empty($pass2))) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Email 1 is empty $responseInstance->addFatalMessage('pass1_empty'); @@ -97,13 +97,13 @@ class PasswordChangeFilter extends BaseFilter implements Filterable { // Are password and confirmation empty? if ((empty($pass1)) && (empty($pass2))) { // Don't change password here - return TRUE; + return true; } // END - if // Do both match? if ($pass1 != $pass2) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Emails are mismatching $responseInstance->addFatalMessage('pass_mismatch'); diff --git a/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php b/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php index 3c9afa43..1e2aac26 100644 --- a/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php +++ b/framework/main/classes/filter/checkboxes/class_RulesAcceptedFilter.php @@ -71,7 +71,7 @@ class RulesAcceptedFilter extends BaseFilter implements Filterable { // Was the "rules" value found in form? And is it set? if (is_null($rules)) { // Not found in form so stop processing here - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('rules_unchecked'); diff --git a/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php b/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php index b2eb002b..d7e408b2 100644 --- a/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php +++ b/framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php @@ -71,7 +71,7 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable { // Is it there? if (is_null($encryptRequest)) { // Not found, so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Throw exception throw new EncryptMissingException($this, CryptoHelper::EXCEPTION_ENCRYPT_MISSING); @@ -86,7 +86,7 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable { // Is it the expected length? if (strlen($decryptedString) != $this->getConfigInstance()->getConfigEntry('captcha_string_length')) { // Not found, so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Throw exception throw new EncryptInvalidLengthException($this, CryptoHelper::EXCEPTION_ENCRYPT_INVALID); diff --git a/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php b/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php index 2b98122f..b9cab888 100644 --- a/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php +++ b/framework/main/classes/filter/payment/class_PaymentDiscoveryFilter.php @@ -124,7 +124,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { Registry::getRegistry()->addInstance('payments', $discoveryInstance); } catch (NoConfigEntryException $e) { // Something bad happend - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('payment_config_entry_error'); @@ -134,7 +134,7 @@ class PaymentDiscoveryFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } catch (NoClassException $e) { // Something bad happend - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('payment_class_error'); diff --git a/framework/main/classes/filter/validator/class_EmailValidatorFilter.php b/framework/main/classes/filter/validator/class_EmailValidatorFilter.php index 1abdf68c..1bdd5631 100644 --- a/framework/main/classes/filter/validator/class_EmailValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_EmailValidatorFilter.php @@ -79,7 +79,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { // Is the email still not set? if ((is_null($email1)) || (is_null($email2))) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('email_unset'); @@ -88,7 +88,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ((empty($email1)) || (empty($email2))) { // Email is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Is the email empty? if (empty($email1)) { @@ -106,7 +106,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifEmailIsTaken($email1)) { // Email is already taken - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('email_taken'); @@ -115,7 +115,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($email1 != $email2) { // Emails didn't match - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('emails_mismatch'); @@ -125,7 +125,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { } // END - elseif } elseif (empty($email)) { // Empty field! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('email_empty'); @@ -143,7 +143,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { */ private function ifEmailIsTaken ($email) { // Default is already taken - $alreadyTaken = TRUE; + $alreadyTaken = true; // Initialize instance $userInstance = NULL; @@ -165,9 +165,9 @@ class EmailValidatorFilter extends BaseFilter implements Filterable { } // Does the email exist? - if ($userInstance->ifEmailAddressExists() === FALSE) { + if ($userInstance->ifEmailAddressExists() === false) { // This email has not being used yet - $alreadyTaken = FALSE; + $alreadyTaken = false; } // Return the result diff --git a/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php b/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php index 85c99897..05295e67 100644 --- a/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_PasswordValidatorFilter.php @@ -71,7 +71,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { // Is the password still not set? if ((is_null($password1)) || (is_null($password2))) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -80,7 +80,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ((empty($password1)) || (empty($password2))) { // Password is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Is the password empty? if (empty($password1)) { @@ -98,7 +98,7 @@ class PasswordValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($password1 != $password2) { // Passwords didn't match - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('pass_mismatch'); diff --git a/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php b/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php index dd0ea326..fafe6942 100644 --- a/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php +++ b/framework/main/classes/filter/validator/class_UserNameValidatorFilter.php @@ -72,7 +72,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { // Is the username set? if (is_null($userName)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_unset'); @@ -81,7 +81,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_empty'); @@ -90,7 +90,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif ($this->ifUserNameIsTaken($userName)) { // Username is already taken - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_taken'); @@ -108,7 +108,7 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { */ private function ifUserNameIsTaken ($userName) { // Default is already taken - $alreadyTaken = TRUE; + $alreadyTaken = true; // Initialize instance $userInstance = NULL; @@ -135,9 +135,9 @@ class UserNameValidatorFilter extends BaseFilter implements Filterable { } // Does the username exist? - if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === FALSE)) { + if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === false)) { // This username is still available - $alreadyTaken = FALSE; + $alreadyTaken = false; } // END - if // Return the result diff --git a/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php b/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php index 5b2cc16d..2741b3cd 100644 --- a/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php @@ -80,7 +80,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { // Is the password still not set? if (is_null($password)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -92,7 +92,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable { if (empty($password)) { // Password is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_empty'); diff --git a/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php b/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php index 70639077..bbc2f17d 100644 --- a/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_ConfirmCodeVerifierFilter.php @@ -71,7 +71,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { // Is this code set? if (is_null($confirmCode)) { // Is not in request - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('confirm_code_unset'); @@ -80,7 +80,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($confirmCode)) { // Email is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('confirm_code_empty'); @@ -98,7 +98,7 @@ class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable { // Do we have the same code or different? if ($userCode != $confirmCode) { // Email is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Redirect to error page $responseInstance->redirectToConfiguredUrl('confirm_code_invalid'); diff --git a/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php b/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php index ce505afd..eb0267cd 100644 --- a/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php @@ -67,7 +67,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is the form set? if (($requestInstance->getRequestElement('command') !== 'do_form') || (!$requestInstance->isRequestElementSet('form'))) { // Required field not set - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('command_form_invalid'); @@ -93,7 +93,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is this set? if (is_null($captchaCode)) { // Not set so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('captcha_code_unset'); @@ -102,7 +102,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($captchaCode)) { // Empty value so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('captcha_code_empty'); @@ -117,7 +117,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is this set? if (is_null($captchaHash)) { // Not set so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('captcha_hash_unset'); @@ -126,7 +126,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($captchaHash)) { // Empty value so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('captcha_hash_empty'); @@ -144,7 +144,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl // Is this CAPTCHA valid? if ($hashedCode != $captchaHash) { // Not the same so request is invalid - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add fatal message $responseInstance->addFatalMessage('captcha_hash_mismatch'); diff --git a/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php b/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php index 48412df8..224f88b6 100644 --- a/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_PasswordGuestVerifierFilter.php @@ -70,7 +70,7 @@ class PasswordGuestVerifierFilter extends BaseFilter implements Filterable { // Is the password still not set? if (is_null($password)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -79,7 +79,7 @@ class PasswordGuestVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($password)) { // Password is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_empty'); diff --git a/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php b/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php index 9fe3c0fc..b49cd20b 100644 --- a/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_PasswordVerifierFilter.php @@ -70,7 +70,7 @@ class PasswordVerifierFilter extends BaseFilter implements Filterable { // Is the password still not set? if (is_null($password)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_unset'); @@ -79,7 +79,7 @@ class PasswordVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($password)) { // Password is empty - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('password_empty'); diff --git a/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php index ddea8b02..b442c4e7 100644 --- a/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserGuestVerifierFilter.php @@ -72,7 +72,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { // Is the username set? if (is_null($userName)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_guest_unset'); @@ -81,16 +81,16 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_guest_empty'); // Abort here throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } elseif ($this->ifUserGuestIsTaken($userName) === FALSE) { + } elseif ($this->ifUserGuestIsTaken($userName) === false) { // Username is already taken - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_guest_not_found'); @@ -111,7 +111,7 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { */ private function ifUserGuestIsTaken ($userName) { // Default is already taken - $alreadyTaken = TRUE; + $alreadyTaken = true; // Initialize instance $userInstance = NULL; @@ -138,9 +138,9 @@ class UserGuestVerifierFilter extends BaseFilter implements Filterable { } // Does the username exist? - if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === FALSE)) { + if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === false)) { // This username is still available - $alreadyTaken = FALSE; + $alreadyTaken = false; } // Return the result diff --git a/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php index 4ee02081..3dd15d1b 100644 --- a/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserNameVerifierFilter.php @@ -72,7 +72,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { // Is the username set? if (is_null($userName)) { // Not found in form so stop the filtering process - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_unset'); @@ -81,16 +81,16 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); } elseif (empty($userName)) { // Empty field! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_empty'); // Abort here throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } elseif ($this->ifUserNameIsTaken($userName) === FALSE) { + } elseif ($this->ifUserNameIsTaken($userName) === false) { // Username is already taken - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Add a message to the response $responseInstance->addFatalMessage('username_not_found'); @@ -108,7 +108,7 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { */ private function ifUserNameIsTaken ($userName) { // Default is already taken - $alreadyTaken = TRUE; + $alreadyTaken = true; // Initialize instance $userInstance = NULL; @@ -135,9 +135,9 @@ class UserNameVerifierFilter extends BaseFilter implements Filterable { } // Does the username exist? - if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === FALSE)) { + if ((is_null($userInstance)) || ($userInstance->ifUsernameExists() === false)) { // This username is still available - $alreadyTaken = FALSE; + $alreadyTaken = false; } // END - if // Return the result diff --git a/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php index 26a35447..2118321c 100644 --- a/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserStatusVerifierFilter.php @@ -69,7 +69,7 @@ class UserStatusVerifierFilter extends BaseFilter implements Filterable { // Is the user account confirmed? if ((!$userInstance->isConfirmed()) && (!$userInstance->isGuest()) && ($requestInstance->getRequestElement('action') != $this->getConfigInstance()->getConfigEntry('action_status_problem'))) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Redirect to configured URL $responseInstance->redirectToConfiguredUrl('login_user_status'); diff --git a/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php b/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php index 2acbb929..73ea3840 100644 --- a/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php +++ b/framework/main/classes/filter/verifier/class_UserUnconfirmedVerifierFilter.php @@ -68,9 +68,9 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable { $userInstance = UserFactory::createUserByRequest($requestInstance); // Is the email address valid? - if ($userInstance->ifEmailAddressExists() === FALSE) { + if ($userInstance->ifEmailAddressExists() === false) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Redirect to configured URL $responseInstance->redirectToConfiguredUrl('user_unconfirmed_email_missing'); @@ -82,7 +82,7 @@ class UserUnconfirmedVerifierFilter extends BaseFilter implements Filterable { // Is the user account confirmed? if ($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) != $this->getConfigInstance()->getConfigEntry('user_status_unconfirmed')) { // Request is invalid! - $requestInstance->requestIsValid(FALSE); + $requestInstance->requestIsValid(false); // Redirect to configured URL $responseInstance->redirectToConfiguredUrl('user_not_unconfirmed'); diff --git a/framework/main/classes/handler/tasks/class_TaskHandler.php b/framework/main/classes/handler/tasks/class_TaskHandler.php index b0fd9444..2c96d96a 100644 --- a/framework/main/classes/handler/tasks/class_TaskHandler.php +++ b/framework/main/classes/handler/tasks/class_TaskHandler.php @@ -91,7 +91,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { */ private function executeCurrentTask () { // Update no task by default - $updateTask = FALSE; + $updateTask = false; // Is the current task valid? if (!$this->getListInstance()->getIterator()->valid()) { @@ -103,7 +103,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { $currentTask = $this->getListInstance()->getIterator()->current(); // Is the task not yet started? - if ($currentTask['task_started'] === FALSE) { + if ($currentTask['task_started'] === false) { // Determine difference between current time and registration $diff = ($this->getMilliTime() - $currentTask['task_registered']) * 1000; @@ -115,8 +115,8 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { } // END - if // Launch the task and mark it as updated - $currentTask['task_started'] = TRUE; - $updateTask = TRUE; + $currentTask['task_started'] = true; + $updateTask = true; // Debug message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Task ' . $currentTask['id'] . ' started with startup_delay=' . $currentTask['task_startup_delay'] . 'ms'); @@ -131,7 +131,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Is the interval delay reached? if ((($diff < $currentTask['task_interval_delay']) && ($currentTask['task_max_runs'] == 0)) || (($currentTask['task_max_runs'] > 0) && ($currentTask['task_total_runs'] == $currentTask['task_max_runs']))) { // Should we update the task from startup? - if ($updateTask === TRUE) { + if ($updateTask === true) { // Update the task before leaving $this->updateTask($currentTask); } // END - if @@ -239,11 +239,11 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Identifier for the generateHash() method 'id' => $taskName, // Whether the task is started - 'task_started' => FALSE, + 'task_started' => false, // Whether the task is paused (not yet implemented) - 'task_paused' => FALSE, + 'task_paused' => false, // Whether the task can be paused (not yet implemented) - 'task_pauseable' => TRUE, + 'task_pauseable' => true, // Timestamp of registration 'task_registered' => $this->getMilliTime(), // Last activity timestamp diff --git a/framework/main/classes/helper/class_BaseHelper.php b/framework/main/classes/helper/class_BaseHelper.php index b0948b67..bb38baca 100644 --- a/framework/main/classes/helper/class_BaseHelper.php +++ b/framework/main/classes/helper/class_BaseHelper.php @@ -266,7 +266,7 @@ class BaseHelper extends BaseFrameworkSystem { // Add the group to the stack $this->groups[$this->totalCounter] = $groupId; - $this->groups[$groupId]['opened'] = TRUE; + $this->groups[$groupId]['opened'] = true; $this->groups[$groupId]['content'] = sprintf( '%s' . PHP_EOL, $groupId, @@ -296,7 +296,7 @@ class BaseHelper extends BaseFrameworkSystem { } // END - if // Check if any group was opened before - if ($this->ifGroupOpenedPreviously() === FALSE) { + if ($this->ifGroupOpenedPreviously() === false) { // Then throw an exception throw new HelperNoPreviousOpenedGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED); } // END - if @@ -322,7 +322,7 @@ class BaseHelper extends BaseFrameworkSystem { $this->groups[$groupId]['tag'], $content ); - $this->groups[$groupId]['opened'] = FALSE; + $this->groups[$groupId]['opened'] = false; // Mark previous group as closed $this->setPreviousGroupId(''); @@ -353,7 +353,7 @@ class BaseHelper extends BaseFrameworkSystem { // Add the group to the stack $this->subGroups[$this->totalCounter] = $subGroupId; - $this->subGroups[$subGroupId]['opened'] = TRUE; + $this->subGroups[$subGroupId]['opened'] = true; $this->subGroups[$subGroupId]['content'] = sprintf("%s\n", $subGroupId, strlen($content), $tag, $content); $this->subGroups[$subGroupId]['tag'] = $tag; @@ -371,7 +371,7 @@ class BaseHelper extends BaseFrameworkSystem { */ public function closePreviousSubGroupByContent ($content = '') { // Check if any sub group was opened before - if ($this->ifSubGroupOpenedPreviously() === FALSE) { + if ($this->ifSubGroupOpenedPreviously() === false) { // Then throw an exception throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED); } // END - if @@ -387,7 +387,7 @@ class BaseHelper extends BaseFrameworkSystem { // Add content to it and mark it as closed $this->subGroups[$subGroupId]['content'] .= sprintf('%s' . PHP_EOL, $subGroupId, strlen($content), $this->subGroups[$subGroupId]['tag'], $content); - $this->subGroups[$subGroupId]['opened'] = FALSE + $this->subGroups[$subGroupId]['opened'] = false ; // Mark previous sub group as closed @@ -416,12 +416,12 @@ class BaseHelper extends BaseFrameworkSystem { // Now "walk" through all groups and sub-groups for ($idx = 1; $idx <= $this->totalCounter; $idx++) { // Is this a sub/group and is it closed? - if ((isset($this->groups[$idx])) && ($this->groups[$this->groups[$idx]]['opened'] === FALSE)) { + if ((isset($this->groups[$idx])) && ($this->groups[$this->groups[$idx]]['opened'] === false)) { // Then add it's content $groupContent = trim($this->groups[$this->groups[$idx]]['content']); //* DEBUG: */ echo "group={$this->groups[$idx]},content=
".htmlentities($groupContent)."

\n"; $content .= $groupContent; - } elseif ((isset($this->subGroups[$idx])) && ($this->subGroups[$this->subGroups[$idx]]['opened'] === FALSE)) { + } elseif ((isset($this->subGroups[$idx])) && ($this->subGroups[$this->subGroups[$idx]]['opened'] === false)) { // Then add it's content $subGroupContent = $this->subGroups[$this->subGroups[$idx]]['content']; //* DEBUG: */ echo "subgroup={$this->subGroups[$idx]},content=
".htmlentities($subGroupContent)."

\n"; @@ -451,7 +451,7 @@ class BaseHelper extends BaseFrameworkSystem { */ protected function ifGroupIsOpened ($groupId) { // Is the group open? - $isOpened = ((isset($this->groups[$groupId])) && ($this->groups[$groupId]['opened'] === TRUE)); + $isOpened = ((isset($this->groups[$groupId])) && ($this->groups[$groupId]['opened'] === true)); // Return status return $isOpened; diff --git a/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php b/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php index 4e6fbc47..65e7f9c4 100644 --- a/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php +++ b/framework/main/classes/helper/html/forms/class_HtmlFormHelper.php @@ -34,10 +34,10 @@ use CoreFramework\Wrapper\Database\User\UserDatabaseWrapper; */ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { /** - * Whether the form tag is opened (keep at FALSE or else your forms will + * Whether the form tag is opened (keep at false or else your forms will * never work!) */ - private $formOpened = FALSE; + private $formOpened = false; /** * Name of the form @@ -45,9 +45,9 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { private $formName = ''; /** - * Whether form tag is enabled (default: TRUE) + * Whether form tag is enabled (default: true) */ - private $formEnabled = TRUE; + private $formEnabled = true; // Class Constants const EXCEPTION_FORM_NAME_INVALID = 0x120; @@ -74,7 +74,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { * @param $withForm Whether include the form tag * @return $helperInstance A preparedf instance of this helper */ - public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, $formName, $formId = FALSE, $withForm = TRUE) { + public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false, $withForm = true) { // Get new instance $helperInstance = new HtmlFormHelper(); @@ -82,7 +82,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { $helperInstance->setTemplateInstance($templateInstance); // Is the form id not set? - if ($formId === FALSE) { + if ($formId === false) { // Use form id from form name $formId = $formName; } // END - if @@ -90,13 +90,13 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { // Set form name $helperInstance->setFormName($formName); - // A form-less field may say 'FALSE' here... - if ($withForm === TRUE) { + // A form-less field may say 'false' here... + if ($withForm === true) { // Create the form $helperInstance->addFormTag($formName, $formId); } else { // Disable form - $helperInstance->enableForm(FALSE); + $helperInstance->enableForm(false); } // Return the prepared instance @@ -106,15 +106,15 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { /** * Add the form tag or close it an already opened form tag * - * @param $formName Name of the form (default: FALSE) - * @param $formId Id of the form (attribute 'id'; default: FALSE) + * @param $formName Name of the form (default: false) + * @param $formId Id of the form (attribute 'id'; default: false) * @return void - * @throws InvalidFormNameException If the form name is invalid ( = FALSE) + * @throws InvalidFormNameException If the form name is invalid ( = false) * @todo Add some unique PIN here to bypass problems with some browser and/or extensions */ - public function addFormTag ($formName = FALSE, $formId = FALSE) { + public function addFormTag ($formName = false, $formId = false) { // When the form is not yet opened at least form name must be valid - if (($this->formOpened === FALSE) && ($formName === FALSE)) { + if (($this->formOpened === false) && ($formName === false)) { // Thrown an exception throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID); } // END - if @@ -123,7 +123,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { $formContent = ''; // Check whether we shall open or close the form - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Add HTML code $formContent = sprintf("
formOpened = TRUE; + $this->formOpened = true; // Add it to the content $this->addHeaderContent($formContent); @@ -157,7 +157,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { } // END - if // Simply close it - $this->formOpened = FALSE; + $this->formOpened = false; // Add it to the content $this->addFooterContent($formContent); @@ -175,7 +175,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addInputTextField ($fieldName, $fieldValue = '') { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -217,7 +217,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addInputPasswordField ($fieldName, $fieldValue = '') { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -244,7 +244,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addInputHiddenField ($fieldName, $fieldValue = '') { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -299,16 +299,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { * @return void * @throws FormClosedException If the form is not yet opened */ - public function addInputCheckboxField ($fieldName, $fieldChecked = TRUE) { + public function addInputCheckboxField ($fieldName, $fieldChecked = true) { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM); } // END - if // Set whether the check box is checked... $checked = " checked=\"checked\""; - if ($fieldChecked === FALSE) $checked = ' '; + if ($fieldChecked === false) $checked = ' '; // Generate the content $inputContent = sprintf("", @@ -331,7 +331,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addInputResetButton ($buttonText) { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, 'reset'), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -356,7 +356,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addInputSubmitButton ($buttonText) { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, 'submit'), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -383,13 +383,13 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addFormGroup ($groupId = '', $groupText = '') { // Is a form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw exception here throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM); } // END - if // At least the group name should be set - if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === FALSE)) { + if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) { // Throw exception here throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); } elseif (empty($groupId)) { @@ -398,16 +398,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { } // Same group to open? - if (($this->ifGroupOpenedPreviously() === FALSE) && ($groupId === $this->getPreviousGroupId())) { + if (($this->ifGroupOpenedPreviously() === false) && ($groupId === $this->getPreviousGroupId())) { // Abort here silently - return FALSE; + return false; } // END - if // Initialize content with closing div by default $content = " \n"; // Is this group opened? - if ($this->ifGroupOpenedPreviously() === FALSE) { + if ($this->ifGroupOpenedPreviously() === false) { // Begin the div/span blocks $content = sprintf("
@@ -458,13 +458,13 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addFormSubGroup ($subGroupId = '', $subGroupText = '') { // Is a group opened? - if ($this->ifGroupOpenedPreviously() === FALSE) { + if ($this->ifGroupOpenedPreviously() === false) { // Throw exception here throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP); } // END - if // At least the sub group name should be set - if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === FALSE)) { + if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) { // Throw exception here throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); } elseif (empty($subGroupId)) { @@ -473,16 +473,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { } // Same sub group to open? - if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($subGroupId == $this->getPreviousSubGroupId())) { + if (($this->ifSubGroupOpenedPreviously() === false) && ($subGroupId == $this->getPreviousSubGroupId())) { // Abort here silently - return FALSE; + return false; } // END - if // Initialize content with closing div by default $content = "
\n"; // Is this group opened? - if ($this->ifSubGroupOpenedPreviously() === FALSE) { + if ($this->ifSubGroupOpenedPreviously() === false) { // Begin the span block $content = sprintf("
@@ -524,7 +524,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addFieldText ($fieldName, $fieldText) { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -558,7 +558,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addFormNote ($noteId, $formNotes) { // Is the form opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM); } // END - if @@ -586,13 +586,13 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addInputSelectField ($selectId, $firstEntry) { // Is the form group opened? - if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === false) && ($this->formEnabled === true)) { // Throw an exception throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM); } // END - if // Shall we close or open the sub group? - if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($this->getPreviousSubGroupId() !== $selectId)) { + if (($this->ifSubGroupOpenedPreviously() === false) && ($this->getPreviousSubGroupId() !== $selectId)) { // Initialize first entry (which might be non-selectable if content is provided if (!empty($firstEntry)) { // Add selection around it @@ -633,7 +633,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addSelectSubOption ($subName, $subValue) { // Is there a sub group (shall be a selection box!) - if ($this->ifSubGroupOpenedPreviously() === FALSE) { + if ($this->ifSubGroupOpenedPreviously() === false) { // Then throw an exception here throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED); } // END - if @@ -661,7 +661,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addSelectOption ($optionName, $optionValue) { // Is there a sub group (shall be a selection box!) - if ($this->ifSubGroupOpenedPreviously() === FALSE) { + if ($this->ifSubGroupOpenedPreviously() === false) { // Then throw an exception here throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED); } // END - if @@ -713,7 +713,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { * @param $formEnabled Whether form is enabled or disabled * @return void */ - public final function enableForm ($formEnabled = TRUE) { + public final function enableForm ($formEnabled = true) { $this->formEnabled = (bool) $formEnabled; } @@ -863,7 +863,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { * @todo Implement check if rules have been changed */ public function ifRulesHaveChanged () { - return FALSE; + return false; } /** @@ -926,10 +926,10 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function flushContent () { // Is the form still open? - if (($this->formOpened === TRUE) && ($this->formEnabled === TRUE)) { + if (($this->formOpened === true) && ($this->formEnabled === true)) { // Close the form automatically $this->addFormTag(); - } elseif ($this->formEnabled === FALSE) { + } elseif ($this->formEnabled === false) { if ($this->ifSubGroupOpenedPreviously()) { // Close sub group $this->addFormSubGroup(); diff --git a/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php b/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php index f38d05e2..b9df4c06 100644 --- a/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php +++ b/framework/main/classes/helper/html/links/class_HtmlLinkHelper.php @@ -3,6 +3,7 @@ namespace CoreFramework\Helper; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Configuration\FrameworkConfiguration; use CoreFramework\Generic\NullPointerException; use CoreFramework\Registry\Registry; @@ -84,7 +85,7 @@ class HtmlLinkHelper extends BaseHtmlHelper implements HelpableTemplate { $applicationInstance = Registry::getRegistry()->getInstance('application'); // Get the request instance - $requestInstance = $applicationInstance->getRequestInstance(); + $requestInstance = FrameworkBootstrap::getRequestInstance(); // Sanity-check on it if (is_null($requestInstance)) { @@ -249,7 +250,7 @@ class HtmlLinkHelper extends BaseHtmlHelper implements HelpableTemplate { */ public function addLinkNote ($groupId, $groupNote, $groupCode = 'div') { // Check if a previous group was opened - if ($this->ifGroupOpenedPreviously() === FALSE) { + if ($this->ifGroupOpenedPreviously() === false) { // No group was opened before! throw new NoGroupOpenedException(array($this, $groupNote), self::EXCEPTION_GROUP_NOT_OPENED); } // END - if @@ -282,7 +283,7 @@ class HtmlLinkHelper extends BaseHtmlHelper implements HelpableTemplate { */ protected function addActionLink ($linkAction, $linkText, $linkTitle) { // Check if a previous group was opened - if ($this->ifGroupOpenedPreviously() === FALSE) { + if ($this->ifGroupOpenedPreviously() === false) { // No group was opened before! throw new NoGroupOpenedException(array($this, $linkAction . '(' . $linkText . ')'), self::EXCEPTION_GROUP_NOT_OPENED); } // END - if diff --git a/framework/main/classes/images/class_BaseImage.php b/framework/main/classes/images/class_BaseImage.php index da592594..a42c6c11 100644 --- a/framework/main/classes/images/class_BaseImage.php +++ b/framework/main/classes/images/class_BaseImage.php @@ -528,7 +528,7 @@ class BaseImage extends BaseFrameworkSystem implements Registerable { // Walk through all groups foreach ($templateInstance->getVariableGroups() as $group => $set) { // Set the group - $templateInstance->setVariableGroup($group, FALSE); + $templateInstance->setVariableGroup($group, false); // Compile image string $imageString = $templateInstance->compileRawCode($this->getString()); diff --git a/framework/main/classes/images/extended/class_PngImage.php b/framework/main/classes/images/extended/class_PngImage.php index 39c87273..fbf444ca 100644 --- a/framework/main/classes/images/extended/class_PngImage.php +++ b/framework/main/classes/images/extended/class_PngImage.php @@ -3,7 +3,7 @@ namespace CoreFramework\Image; // Import framework stuff -use CoreFramework\Object\BaseFrameworkSystem; +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Template\CompileableTemplate; /** @@ -72,7 +72,7 @@ class PngImage extends BaseImage { $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn(); // Does it exist? - if (BaseFrameworkSystem::isReadableFile($cacheFile)) { + if (FrameworkBootstrap::isReadableFile($cacheFile)) { // Remove it @unlink($cacheFile); } // END - if diff --git a/framework/main/classes/index/class_BaseIndex.php b/framework/main/classes/index/class_BaseIndex.php index 514b00a8..d44519f2 100644 --- a/framework/main/classes/index/class_BaseIndex.php +++ b/framework/main/classes/index/class_BaseIndex.php @@ -104,7 +104,7 @@ class BaseIndex extends BaseFrameworkSystem { $this->getIteratorInstance()->setHeader($header); // Check if the array has only 3 elements - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, true))); assert(count($header) == 2); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__)); @@ -146,7 +146,7 @@ class BaseIndex extends BaseFrameworkSystem { ); // Write it to disk (header is always at seek position 0) - $this->getIteratorInstance()->writeData(0, $header, FALSE); + $this->getIteratorInstance()->writeData(0, $header, false); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__)); } @@ -328,7 +328,7 @@ class BaseIndex extends BaseFrameworkSystem { * @return void * @throws UnsupportedOperationException This method is not (and maybe never will be) supported */ - public function writeData ($seekPosition, $data, $flushHeader = TRUE) { + public function writeData ($seekPosition, $data, $flushHeader = true) { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data[]=%s,flushHeader=%d', __METHOD__, __LINE__, $seekPosition, gettype($data), intval($flushHeader))); throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -342,7 +342,7 @@ class BaseIndex extends BaseFrameworkSystem { * @throws UnsupportedOperationException If this method is called */ public function writeValueToFile ($groupId, $value) { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] groupId=' . $groupId . ',value[' . gettype($value) . ']=' . print_r($value, true)); throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/iterator/file/class_FileIterator.php b/framework/main/classes/iterator/file/class_FileIterator.php index 4006faa6..1935b986 100644 --- a/framework/main/classes/iterator/file/class_FileIterator.php +++ b/framework/main/classes/iterator/file/class_FileIterator.php @@ -100,7 +100,7 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid */ @@ -280,7 +280,7 @@ class FileIterator extends BaseIterator implements SeekableWritableFileIterator * @param $flushHeader Whether to flush the header (default: flush) * @return void */ - public function writeData ($seekPosition, $data, $flushHeader = TRUE) { + public function writeData ($seekPosition, $data, $flushHeader = true) { // Call block instance $this->getBlockInstance()->writeData($seekPosition, $data, $flushHeader); } diff --git a/framework/main/classes/listener/class_BaseListener.php b/framework/main/classes/listener/class_BaseListener.php index ae98d5bd..9765ca6f 100644 --- a/framework/main/classes/listener/class_BaseListener.php +++ b/framework/main/classes/listener/class_BaseListener.php @@ -56,7 +56,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { /** * Whether we are in blocking or non-blocking mode (default: non-blocking */ - private $blockingMode = FALSE; + private $blockingMode = false; /** * A peer pool instance @@ -85,7 +85,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { $isServerSocket = ((is_resource($socketResource)) && (!@socket_getpeername($socketResource, $peerName))); // We need to clear the error here if it is a resource - if ($isServerSocket === TRUE) { + if ($isServerSocket === true) { // Clear the error //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('socketResource[]=' . gettype($socketResource)); socket_clear_error($socketResource); @@ -494,14 +494,14 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { // Some new peers found? if ($left < 1) { // Debug message - //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, TRUE)); + //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); // Nothing new found return; } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); // Do we have changed peers? if (in_array($this->getSocketResource(), $readers)) { @@ -535,7 +535,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { // Output result (only for debugging!) /* $option = socket_get_option($newSocket, SOL_SOCKET, SO_RCVTIMEO); - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SO_RCVTIMEO[' . gettype($option) . ']=' . print_r($option, TRUE)); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SO_RCVTIMEO[' . gettype($option) . ']=' . print_r($option, true)); */ // Enable SO_OOBINLINE diff --git a/framework/main/classes/listener/socket/class_SocketFileListener.php b/framework/main/classes/listener/socket/class_SocketFileListener.php index 7261b9fa..645f8535 100644 --- a/framework/main/classes/listener/socket/class_SocketFileListener.php +++ b/framework/main/classes/listener/socket/class_SocketFileListener.php @@ -3,6 +3,7 @@ namespace CoreFramework\Listener\Socket; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Listener\Listenable; @@ -89,7 +90,7 @@ class SocketFileListener extends BaseListener implements Listenable { assert(!empty($socketFile)); // Is the file there? - if ((self::isReachableFilePath($socketFile)) && (file_exists($socketFile))) { + if ((FrameworkBootstrap::isReachableFilePath($socketFile)) && (file_exists($socketFile))) { // Old socket found self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: WARNING: Old socket at ' . $socketFile . ' found. Will not start.'); diff --git a/framework/main/classes/lists/class_BaseList.php b/framework/main/classes/lists/class_BaseList.php index 3703aecc..8d79d1d6 100644 --- a/framework/main/classes/lists/class_BaseList.php +++ b/framework/main/classes/lists/class_BaseList.php @@ -199,7 +199,7 @@ class BaseList extends BaseFrameworkSystem implements IteratorAggregate, Countab if ($this->isHashValid($hash)) { // Add it array_push($array, $this->listEntries[$hash]); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash . ',array(' . count($array) . ')=' . print_r($array, TRUE) . ' - ADDED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash . ',array(' . count($array) . ')=' . print_r($array, true) . ' - ADDED!'); } // END - if } // END - foreach @@ -232,7 +232,7 @@ class BaseList extends BaseFrameworkSystem implements IteratorAggregate, Countab $hash = $this->generateHash($groupName, $groupName, $entry); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . print_r($entry, TRUE) . ', hash=' . $hash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: this=' . $this->__toString() . ',groupName=' . $groupName . ',entry=' . print_r($entry, true) . ', hash=' . $hash); // Add the hash to the index array_push($this->listIndex, $hash); diff --git a/framework/main/classes/mailer/debug/class_DebugMailer.php b/framework/main/classes/mailer/debug/class_DebugMailer.php index b7781ca7..b3700931 100644 --- a/framework/main/classes/mailer/debug/class_DebugMailer.php +++ b/framework/main/classes/mailer/debug/class_DebugMailer.php @@ -3,11 +3,13 @@ namespace CoreFramework\Mailer\Debug; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Generic\NullPointerException; use CoreFramework\Mailer\BaseMailer; use CoreFramework\Mailer\DeliverableMail; use CoreFramework\Manager\Login\ManageableMember; use CoreFramework\Manager\ManageableApplication; +use CoreFramework\Registry\Registry; use CoreFramework\Template\CompileableTemplate; /** @@ -120,7 +122,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail { $templateInstance->renderXmlContent(); // Get responce instance - $responseInstance = $this->getApplicationInstance()->getResponseInstance(); + $responseInstance = FrameworkBootstrap::getResponseInstance(); // Transfer the data to the response $templateInstance->transferToResponse($responseInstance); @@ -175,7 +177,7 @@ class DebugMailer extends BaseMailer implements DeliverableMail { $templateInstance->assignTemplateWithVariable('footer', 'footer'); // Load the master template - $templateInstance->loadCodeTemplate($this->getApplicationInstance()->buildMasterTemplateName()); + $templateInstance->loadCodeTemplate(Registry::getRegistry()->getInstance('app')->buildMasterTemplateName()); // Then compile it again $templateInstance->compileVariables(); diff --git a/framework/main/classes/menu/class_BaseMenu.php b/framework/main/classes/menu/class_BaseMenu.php index fb309963..98de1ea7 100644 --- a/framework/main/classes/menu/class_BaseMenu.php +++ b/framework/main/classes/menu/class_BaseMenu.php @@ -3,8 +3,10 @@ namespace CoreFramework\Menu; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Object\BaseFrameworkSystem; +use CoreFramework\Registry\Registry; use CoreFramework\Template\CompileableTemplate; /** @@ -58,12 +60,12 @@ class BaseMenu extends BaseFrameworkSystem { $templateInstance->loadMenuTemplate('generic_menu_entries'); // Get the 'command' from request instance - $command = $this->getApplicationInstance()->getRequestInstance()->getRequestElement('command'); + $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command'); // If page is empty, choose default if (empty($command)) { // Use default page as none has been specified - $command = $this->getConfigInstance()->getConfigEntry('default_' . $this->getApplicationInstance()->getAppShortName() . '_' . self::getResponseTypeFromSystem() . '_command'); + $command = $this->getConfigInstance()->getConfigEntry('default_' . Registry::getRegistry()->getInstance('app')->getAppShortName() . '_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command'); } // END - if // Load the menu template for this page diff --git a/framework/main/classes/output/class_ b/framework/main/classes/output/class_ index d21367a4..dbca8d46 100644 --- a/framework/main/classes/output/class_ +++ b/framework/main/classes/output/class_ @@ -71,7 +71,7 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable { * @return void * @todo 0% done */ - public final function output ($outStream = FALSE, $stripTags = FALSE) { + public final function output ($outStream = false, $stripTags = false) { $this->partialStub('Please implement this method. outStream()=' . strlen($outStream) . ',stripTags=' . intval($stripTags)); } diff --git a/framework/main/classes/output/console/class_ConsoleOutput.php b/framework/main/classes/output/console/class_ConsoleOutput.php index d08c1324..86d3898c 100644 --- a/framework/main/classes/output/console/class_ConsoleOutput.php +++ b/framework/main/classes/output/console/class_ConsoleOutput.php @@ -95,7 +95,7 @@ class ConsoleOutput extends BaseOutput implements OutputStreamer { * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream = FALSE, $stripTags = FALSE) { + public final function output ($outStream = false, $stripTags = false) { print trim($outStream) . PHP_EOL; } diff --git a/framework/main/classes/output/debug/class_BaseDebugOutput.php b/framework/main/classes/output/debug/class_BaseDebugOutput.php index 5c2083ab..8b6a9de4 100644 --- a/framework/main/classes/output/debug/class_BaseDebugOutput.php +++ b/framework/main/classes/output/debug/class_BaseDebugOutput.php @@ -31,7 +31,7 @@ class BaseDebugOutput extends BaseOutput { /** * Class name for this output class is being used for logging */ - private $loggerClassName = FALSE; + private $loggerClassName = false; /** * Protected constructor diff --git a/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php b/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php index 3b6dff70..7ad5e973 100644 --- a/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php +++ b/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php @@ -3,6 +3,7 @@ namespace CoreFramework\Debug\Output; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Debug\Debugger; use CoreFramework\Output\Debug\BaseDebugOutput; use CoreFramework\Registry\Registerable; @@ -61,15 +62,15 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function outputStream ($output, $stripTags = FALSE) { + public final function outputStream ($output, $stripTags = false) { // Strip HTML tags out? - if ($stripTags === TRUE) { + if ($stripTags === true) { // Prepare the output without HTML tags $output = trim(html_entity_decode(strip_tags(stripslashes($output)))); } // END - if // Are debug times enabled? - if ($this->getConfigInstance()->getConfigEntry('debug_' . self::getResponseTypeFromSystem() . '_output_timings') == 'Y') { + if ($this->getConfigInstance()->getConfigEntry('debug_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_output_timings') == 'Y') { // Output it first $output = $this->getPrintableExecutionTime() . $output; } // END - if @@ -85,9 +86,9 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream = FALSE, $stripTags = FALSE) { + public final function output ($outStream = false, $stripTags = false) { // Empty output will be silently ignored - if ($outStream !== FALSE) { + if ($outStream !== false) { $this->outputStream($outStream, $stripTags); } // END - if } diff --git a/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php b/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php index 2ea7da73..b7aed9ab 100644 --- a/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php +++ b/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php @@ -60,7 +60,7 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function outputStream ($output, $stripTags = FALSE) { + public final function outputStream ($output, $stripTags = false) { // Split multiple lines into and array to put them out line-by-line $errorLines = explode(chr(10), $output); @@ -84,11 +84,11 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream = FALSE, $stripTags = FALSE) { + public final function output ($outStream = false, $stripTags = false) { // Empty output will be silently ignored - if ($outStream !== FALSE) { + if ($outStream !== false) { $this->outputStream($outStream); - } + } // END - if } /** diff --git a/framework/main/classes/output/debug/web/class_DebugWebOutput.php b/framework/main/classes/output/debug/web/class_DebugWebOutput.php index 4093172a..f63c4d6f 100644 --- a/framework/main/classes/output/debug/web/class_DebugWebOutput.php +++ b/framework/main/classes/output/debug/web/class_DebugWebOutput.php @@ -60,7 +60,7 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function outputStream ($output, $stripTags = FALSE) { + public final function outputStream ($output, $stripTags = false) { // Strip out
$output = str_replace('
', '', $output); print(stripslashes($output)."
\n"); @@ -73,9 +73,9 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream = FALSE, $stripTags = FALSE) { + public final function output ($outStream = false, $stripTags = false) { // Empty output will be silently ignored - if ($outStream !== FALSE) { + if ($outStream !== false) { $this->outputStream($outStream, $stripTags); } // END - if } diff --git a/framework/main/classes/output/web/class_WebOutput.php b/framework/main/classes/output/web/class_WebOutput.php index e1299ef1..44803ff1 100644 --- a/framework/main/classes/output/web/class_WebOutput.php +++ b/framework/main/classes/output/web/class_WebOutput.php @@ -3,6 +3,7 @@ namespace CoreFramework\Output; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Manager\ManageableApplication; use CoreFramework\Output\BaseOutput; use CoreFramework\Registry\Registerable; @@ -65,7 +66,7 @@ class WebOutput extends BaseOutput implements OutputStreamer, Registerable { // Set the content type if (!empty($contentType)) { // Set the header - $applicationInstance->getResponseInstance()->addHeader('Content-type', $contentType); + FrameworkBootstrap::getResponseInstance()->addHeader('Content-type', $contentType); } // END - if } // END - if @@ -80,7 +81,7 @@ class WebOutput extends BaseOutput implements OutputStreamer, Registerable { * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream = FALSE, $stripTags = FALSE) { + public final function output ($outStream = false, $stripTags = false) { print(stripslashes($outStream)); } diff --git a/framework/main/classes/parser/xml/class_XmlParser.php b/framework/main/classes/parser/xml/class_XmlParser.php index 7a84119b..cc05e946 100644 --- a/framework/main/classes/parser/xml/class_XmlParser.php +++ b/framework/main/classes/parser/xml/class_XmlParser.php @@ -92,7 +92,7 @@ class XmlParser extends BaseParser implements Parseable { $xmlParser = xml_parser_create(); // Force case-folding to on - xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, TRUE); + xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, true); // Set UTF-8 xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); diff --git a/framework/main/classes/points/class_UserPoints.php b/framework/main/classes/points/class_UserPoints.php index 723fca00..f3eb51e3 100644 --- a/framework/main/classes/points/class_UserPoints.php +++ b/framework/main/classes/points/class_UserPoints.php @@ -113,7 +113,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo */ public function ifUserHasRequiredPoints ($action) { // Default is that everyone is poor... ;-) - $hasRequired = FALSE; + $hasRequired = false; // Get the required points entry $requiredPoints = $this->getConfigInstance()->getConfigEntry($action . '_action_points'); diff --git a/framework/main/classes/reader/class_ConsoleNewsReader.php b/framework/main/classes/reader/class_ConsoleNewsReader.php index f371a2bb..d44d198d 100644 --- a/framework/main/classes/reader/class_ConsoleNewsReader.php +++ b/framework/main/classes/reader/class_ConsoleNewsReader.php @@ -3,6 +3,7 @@ namespace CoreFramework\Reader\News\Console; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Object\BaseFrameworkSystem; @@ -53,9 +54,6 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg // Get a new instance $readerInstance = new ConsoleNewsReader(); - // Set request instance - $readerInstance->setRequestInstance($requestInstance); - // Return prepared instance return $readerInstance; } @@ -68,7 +66,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg */ public function initializeReader () { // Get 'command' for saving some calls - $command = $this->getRequestInstance()->getRequestElement('command'); + $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command'); // First get a wrapper instance $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class'); diff --git a/framework/main/classes/reader/class_DefaultNewsReader.php b/framework/main/classes/reader/class_DefaultNewsReader.php index 0563672f..f2188dac 100644 --- a/framework/main/classes/reader/class_DefaultNewsReader.php +++ b/framework/main/classes/reader/class_DefaultNewsReader.php @@ -3,6 +3,7 @@ namespace CoreFramework\Reader\News; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Object\BaseFrameworkSystem; @@ -52,9 +53,6 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg // Get a new instance $readerInstance = new DefaultNewsReader(); - // Set request instance - $readerInstance->setRequestInstance($requestInstance); - // Return prepared instance return $readerInstance; } @@ -67,7 +65,7 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg */ public function initializeReader () { // Get 'command' for saving some calls - $command = $this->getRequestInstance()->getRequestElement('command'); + $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command'); // First get a wrapper instance $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class'); diff --git a/framework/main/classes/registration/class_BaseRegistration.php b/framework/main/classes/registration/class_BaseRegistration.php index db2ec310..f2a78f20 100644 --- a/framework/main/classes/registration/class_BaseRegistration.php +++ b/framework/main/classes/registration/class_BaseRegistration.php @@ -3,6 +3,7 @@ namespace CoreFramework\Registration; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Filter\Filterable; use CoreFramework\Object\BaseFrameworkSystem; @@ -91,7 +92,7 @@ class BaseRegistration extends BaseFrameworkSystem { */ protected function executePreFilters () { // Execute all pre filters - $this->preRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance()); + $this->preRegistrationFilter->processFilters(FrameworkBootstrap::getRequestInstance(), FrameworkBootstrap::getResponseInstance()); } /** @@ -101,7 +102,7 @@ class BaseRegistration extends BaseFrameworkSystem { */ protected function executePostFilters () { // Execute all post filters - $this->postRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance()); + $this->postRegistrationFilter->processFilters(FrameworkBootstrap::getRequestInstance(), FrameworkBootstrap::getResponseInstance()); } } diff --git a/framework/main/classes/registry/class_BaseRegistry.php b/framework/main/classes/registry/class_BaseRegistry.php index 9d47a9a1..9a2af749 100644 --- a/framework/main/classes/registry/class_BaseRegistry.php +++ b/framework/main/classes/registry/class_BaseRegistry.php @@ -182,7 +182,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { } // END - foreach // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: Returning entry(' . count($entry) . ')=' . print_r($entry, TRUE)); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: Returning entry(' . count($entry) . ')=' . print_r($entry, true)); // Return it return $entry; diff --git a/framework/main/classes/request/class_ b/framework/main/classes/request/class_ index 10b6a14e..48b31cea 100644 --- a/framework/main/classes/request/class_ +++ b/framework/main/classes/request/class_ @@ -38,17 +38,17 @@ class ???Request extends BaseRequest implements Requestable { /** * Creates an instance of this class and prepares it a little * - * @return $httpInstance An instance of this class + * @return $requestInstance An instance of this class */ public final static function create???Request () { // Create an instance - $httpInstance = new ???Request(); + $requestInstance = new ???Request(); // Prepare the HTTP request data for usage - $httpInstance->prepareRequestData(); + $requestInstance->prepareRequestData(); // Return the prepared instance - return $httpInstance; + return $requestInstance; } /** @@ -57,7 +57,7 @@ class ???Request extends BaseRequest implements Requestable { * @return void * @todo Needs to be implemented */ - public function prepareRequestData () { + protected function prepareRequestData () { $this->partialStub("Please implement this method."); } diff --git a/framework/main/classes/request/class_BaseRequest.php b/framework/main/classes/request/class_BaseRequest.php index 49130652..eaff2be0 100644 --- a/framework/main/classes/request/class_BaseRequest.php +++ b/framework/main/classes/request/class_BaseRequest.php @@ -27,7 +27,7 @@ use CoreFramework\Object\BaseFrameworkSystem; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BaseRequest extends BaseFrameworkSystem { +abstract class BaseRequest extends BaseFrameworkSystem { /** * Array for the request data */ @@ -35,10 +35,10 @@ class BaseRequest extends BaseFrameworkSystem { /** * Whether this request is valid and can be further processed. The default is - * valid so make sure your intercepting filters sets this attribute to FALSE + * valid so make sure your intercepting filters sets this attribute to false * when they need to intercept the data flow. */ - private $requestIsValid = TRUE; + private $requestIsValid = true; /** * Protected constructor @@ -119,12 +119,12 @@ class BaseRequest extends BaseFrameworkSystem { } /** - * Sets whether the request was valid (default: TRUE) + * Sets whether the request was valid (default: true) * * @param $isValid Whether the request is valid * @return void */ - public final function requestIsValid ($isValid = TRUE) { + public final function requestIsValid ($isValid = true) { $this->requestIsValid = (bool) $isValid; } diff --git a/framework/main/classes/request/console/class_ConsoleRequest.php b/framework/main/classes/request/console/class_ConsoleRequest.php index af8f3758..e83970fe 100644 --- a/framework/main/classes/request/console/class_ConsoleRequest.php +++ b/framework/main/classes/request/console/class_ConsoleRequest.php @@ -59,11 +59,11 @@ class ConsoleRequest extends BaseRequest implements Requestable { * * @return void */ - public function prepareRequestData () { + protected function prepareRequestData () { // 'argv' and 'argc' should be there if ((!isset($_SERVER['argv'])) || (!isset($_SERVER['argc']))) { // Maybe not right PHP mode? (needs CLI?) - trigger_error(sprintf('[%s:%d]: argv/argc not set: %s', __METHOD__, __LINE__, print_r($_SERVER, TRUE)), E_USER_ERROR); + trigger_error(sprintf('[%s:%d]: argv/argc not set: %s', __METHOD__, __LINE__, print_r($_SERVER, true)), E_USER_ERROR); } // END - if // Get the "request data" from the command-line argument list @@ -83,7 +83,7 @@ class ConsoleRequest extends BaseRequest implements Requestable { // Try to determine next parameters foreach ($args as $arg) { - // Seperate arguemnt name from value + // Seperate argument key from value $argArray = explode('=', $arg); // Is the second one set? diff --git a/framework/main/classes/request/html/class_HtmlRequest.php b/framework/main/classes/request/html/class_HtmlRequest.php index db025f0d..17ae9918 100644 --- a/framework/main/classes/request/html/class_HtmlRequest.php +++ b/framework/main/classes/request/html/class_HtmlRequest.php @@ -92,7 +92,7 @@ class HtmlRequest extends BaseRequest implements Requestable { * * @return void */ - public function prepareRequestData () { + protected function prepareRequestData () { // Copy GET then POST data $this->setRequestData(array_merge($_GET, $_POST)); } diff --git a/framework/main/classes/resolver/action/class_BaseActionResolver.php b/framework/main/classes/resolver/action/class_BaseActionResolver.php index 238267b2..bec3e14b 100644 --- a/framework/main/classes/resolver/action/class_BaseActionResolver.php +++ b/framework/main/classes/resolver/action/class_BaseActionResolver.php @@ -75,7 +75,7 @@ class BaseActionResolver extends BaseResolver { */ public function isActionValid ($namespace, $actionName) { // By default nothing shall be valid - $isValid = FALSE; + $isValid = false; // Is a action set? if (empty($namespace)) { @@ -100,7 +100,7 @@ class BaseActionResolver extends BaseResolver { // Is this class already loaded? if (class_exists($this->getClassName())) { // This class does exist. :-) - $isValid = TRUE; + $isValid = true; } // END - if // Set action name diff --git a/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php b/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php index e27ff3f5..aaee84f4 100644 --- a/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php +++ b/framework/main/classes/resolver/action/html/class_HtmlActionResolver.php @@ -65,7 +65,7 @@ class HtmlActionResolver extends BaseActionResolver implements ActionResolver { if (empty($actionName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'defaultAction'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isActionValid($actionName) === FALSE) { + } elseif ($resolverInstance->isActionValid($actionName) === false) { // Invalid action found throw new InvalidActionException(array($resolverInstance, $actionName), self::EXCEPTION_INVALID_ACTION); } @@ -102,7 +102,7 @@ class HtmlActionResolver extends BaseActionResolver implements ActionResolver { } // END - if // Check if action is valid - if ($this->isActionValid($actionName) === FALSE) { + if ($this->isActionValid($actionName) === false) { // This action is invalid! throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION); } // END - if @@ -142,7 +142,7 @@ class HtmlActionResolver extends BaseActionResolver implements ActionResolver { } // END - if // Check if action is valid - if ($this->isActionValid($actionName) === FALSE) { + if ($this->isActionValid($actionName) === false) { // This action is invalid! throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION); } // END - if diff --git a/framework/main/classes/resolver/class_ b/framework/main/classes/resolver/class_ index 317825e6..0547b94d 100644 --- a/framework/main/classes/resolver/class_ +++ b/framework/main/classes/resolver/class_ @@ -52,7 +52,7 @@ class ???Resolver extends BaseResolver implements Resolver { if (empty($!!!Name)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'default|||'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->is|||Valid($!!!Name) === FALSE) { + } elseif ($resolverInstance->is|||Valid($!!!Name) === false) { // Invalid action found throw new Invalid|||Exception(array($resolverInstance, $!!!Name), self::EXCEPTION_INVALID_ACTION); } @@ -87,7 +87,7 @@ class ???Resolver extends BaseResolver implements Resolver { if (empty($!!!Name)) $!!!Name = $this->getConfigInstance()->getConfigEntry('default_action'); // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { + if ($this->is|||Valid($!!!Name) === false) { // This action is invalid! throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); } // END - if @@ -127,7 +127,7 @@ class ???Resolver extends BaseResolver implements Resolver { } // END - if // Check if action is valid - if ($this->is|||Valid($!!!Name) === FALSE) { + if ($this->is|||Valid($!!!Name) === false) { // This action is invalid! throw new Invalid|||Exception(array($this, $!!!Name), self::EXCEPTION_INVALID_ACTION); } // END - if diff --git a/framework/main/classes/resolver/command/class_BaseCommandResolver.php b/framework/main/classes/resolver/command/class_BaseCommandResolver.php index 7b77bdce..a6d015cc 100644 --- a/framework/main/classes/resolver/command/class_BaseCommandResolver.php +++ b/framework/main/classes/resolver/command/class_BaseCommandResolver.php @@ -3,6 +3,7 @@ namespace CoreFramework\Resolver\Command; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Command\Commandable; use CoreFramework\Command\InvalidCommandException; use CoreFramework\Factory\ObjectFactory; @@ -10,6 +11,9 @@ use CoreFramework\Generic\EmptyVariableException; use CoreFramework\Request\Requestable; use CoreFramework\Resolver\BaseResolver; +// Import SPL stuff +use \UnexpectedValueException; + /** * A generic command resolver class * @@ -86,10 +90,8 @@ class BaseCommandResolver extends BaseResolver { * * @param $requestInstance An instance of a Requestable class * @return $commandInstance An instance of the resolved command - * @throws InvalidCommandException Thrown if $commandName is - * invalid - * @throws InvalidCommandInstanceException Thrown if $commandInstance - * is an invalid instance + * @throws InvalidCommandException Thrown if $commandName is invalid + * @throws UnexpectedValueException Thrown if $commandInstance is an invalid instance */ public function resolveCommandByRequest (Requestable $requestInstance) { // Init variables @@ -101,11 +103,11 @@ class BaseCommandResolver extends BaseResolver { // Is the command empty? Then fall back to default command if (empty($commandName)) { - $commandName = $this->getConfigInstance()->getConfigEntry('default_' . self::getResponseTypeFromSystem() . '_command'); + $commandName = $this->getConfigInstance()->getConfigEntry('default_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command'); } // END - if // Check if command is valid - if ($this->isCommandValid($this->getNamespace(), $commandName) === FALSE) { + if ($this->isCommandValid($this->getNamespace(), $commandName) === false) { // This command is invalid! throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); } // END - if @@ -116,7 +118,7 @@ class BaseCommandResolver extends BaseResolver { // And validate it if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) { // This command has an invalid instance! - throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); + throw new UnexpectedValueException(sprintf('commandInstance for commandName=%s is not object (%s) or does not implement Commandable.', $commandName, gettype($commandInstance)), self::EXCEPTION_INVALID_COMMAND); } // END - if // Set last command @@ -139,11 +141,11 @@ class BaseCommandResolver extends BaseResolver { // Is the command empty? Then fall back to default command if (empty($commandName)) { - $commandName = $this->getConfigInstance()->getConfigEntry('default_' . self::getResponseTypeFromSystem() . '_command'); + $commandName = $this->getConfigInstance()->getConfigEntry('default_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_command'); } // END - if // Check if command is valid - if ($this->isCommandValid($commandName) === FALSE) { + if ($this->isCommandValid($commandName) === false) { // This command is invalid! throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND); } // END - if @@ -165,7 +167,7 @@ class BaseCommandResolver extends BaseResolver { */ protected function isCommandValid ($namespace, $commandName) { // By default nothing shall be valid - $isValid = FALSE; + $isValid = false; // Is namespace and command name set? if (empty($namespace)) { @@ -190,7 +192,7 @@ class BaseCommandResolver extends BaseResolver { // Is this class already loaded? if (class_exists($this->getClassName())) { // This class does exist. :-) - $isValid = TRUE; + $isValid = true; } // END - if // Set command name diff --git a/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php b/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php index daadc60a..17a29204 100644 --- a/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php +++ b/framework/main/classes/resolver/command/console/class_ConsoleCommandResolver.php @@ -62,7 +62,7 @@ class ConsoleCommandResolver extends BaseCommandResolver implements CommandResol if (empty($commandName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isCommandValid($commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid($commandName) === false) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } diff --git a/framework/main/classes/resolver/command/html/class_Html b/framework/main/classes/resolver/command/html/class_Html index 3a89a511..06160b66 100644 --- a/framework/main/classes/resolver/command/html/class_Html +++ b/framework/main/classes/resolver/command/html/class_Html @@ -57,7 +57,7 @@ class Html???CommandResolver extends BaseCommandResolver implements CommandResol if (empty($commandName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isCommandValid($commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid($commandName) === false) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } diff --git a/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php b/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php index 8635e913..2ed244b0 100644 --- a/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php +++ b/framework/main/classes/resolver/command/html/class_HtmlCommandResolver.php @@ -66,7 +66,7 @@ class HtmlCommandResolver extends BaseCommandResolver implements CommandResolver if (empty($commandName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isCommandValid($commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid($commandName) === false) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } diff --git a/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php b/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php index b62109c7..d053dc52 100644 --- a/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php +++ b/framework/main/classes/resolver/command/image/class_ImageCommandResolver.php @@ -65,7 +65,7 @@ class ImageCommandResolver extends BaseCommandResolver implements CommandResolve if (empty($commandName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isCommandValid($commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid($commandName) === false) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } diff --git a/framework/main/classes/resolver/controller/class_BaseControllerResolver.php b/framework/main/classes/resolver/controller/class_BaseControllerResolver.php index 3f906f9f..f2a3f3ec 100644 --- a/framework/main/classes/resolver/controller/class_BaseControllerResolver.php +++ b/framework/main/classes/resolver/controller/class_BaseControllerResolver.php @@ -7,8 +7,10 @@ use CoreFramework\Controller\DefaultControllerException; use CoreFramework\Controller\Controller; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Generic\EmptyVariableException; +use CoreFramework\Registry\Registry; use CoreFramework\Resolver\BaseResolver; use CoreFramework\Resolver\Controller\ControllerResolver; + /** * A generic controller resolver class * @@ -109,7 +111,7 @@ class BaseControllerResolver extends BaseResolver { $resolverConfigEntry, array( $controllerName, - $this->getApplicationInstance() + Registry::getRegistry()->getInstance('app') ) ); $controllerInstance = ObjectFactory::createObjectByName( @@ -132,7 +134,7 @@ class BaseControllerResolver extends BaseResolver { */ protected function isControllerValid ($namespace, $controllerName) { // By default nothing shall be valid - $isValid = FALSE; + $isValid = false; // Is namespace and controller name set? if (empty($namespace)) { @@ -162,11 +164,11 @@ class BaseControllerResolver extends BaseResolver { $this->setClassName($className); // Try it hard to get an controller - while ($isValid === FALSE) { + while ($isValid === false) { // Is this class already loaded? if (class_exists($this->getClassName())) { // This class does exist. :-) - $isValid = TRUE; + $isValid = true; } elseif ($this->getClassName() != $newsControllerName) { // Set default controller $this->setClassName($newsControllerName); diff --git a/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php b/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php index 191e212c..61743b58 100644 --- a/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php +++ b/framework/main/classes/resolver/controller/console/class_ConsoleControllerResolver.php @@ -63,7 +63,7 @@ class ConsoleControllerResolver extends BaseControllerResolver implements Contro if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === false) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php b/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php index 6eeef599..bf9de8f5 100644 --- a/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php +++ b/framework/main/classes/resolver/controller/html/class_HtmlControllerResolver.php @@ -63,7 +63,7 @@ class HtmlControllerResolver extends BaseControllerResolver implements Controlle if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === false) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php b/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php index 18016bb4..7ec7c537 100644 --- a/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php +++ b/framework/main/classes/resolver/controller/image/class_ImageControllerResolver.php @@ -63,7 +63,7 @@ class ImageControllerResolver extends BaseControllerResolver implements Controll if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid($namespace, $controllerName) === false) { // Invalid controller found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/framework/main/classes/response/class_BaseResponse.php b/framework/main/classes/response/class_BaseResponse.php index bb21e391..f7bbb781 100644 --- a/framework/main/classes/response/class_BaseResponse.php +++ b/framework/main/classes/response/class_BaseResponse.php @@ -151,8 +151,11 @@ class BaseResponse extends BaseFrameworkSystem { * @return void */ public final function addFatalMessage ($messageId) { + // Get application instance + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Adds the resolved message id to the fatal message list - $this->addFatalMessagePlain($this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId)); + $this->addFatalMessagePlain($applicationInstance()->getLanguageInstance()->getMessage($messageId)); } /** @@ -175,8 +178,12 @@ class BaseResponse extends BaseFrameworkSystem { * @throws ResponseHeadersAlreadySentException Thrown if headers are * already sent */ - public function flushBuffer ($force = FALSE) { - if ((headers_sent()) && ($force === FALSE)) { + public function flushBuffer ($force = false) { + // Get application instance + $applicationInstance = Registry::getRegistry()->getInstance('app'); + + // Headers already sent? + if ((headers_sent()) && ($force === false)) { // Headers are already sent! throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT); } elseif (!headers_sent()) { @@ -218,7 +225,7 @@ class BaseResponse extends BaseFrameworkSystem { $this->getWebOutputInstance()->output($this->responseBody); } else { // Display all error messages - $this->getApplicationInstance()->handleFatalMessages($this->getGenericArrayKey('fatal_messages', 'generic', 'message')); + $applicationInstance()->handleFatalMessages($this->getGenericArrayKey('fatal_messages', 'generic', 'message')); // Send the error messages out to the world $this->getWebOutputInstance()->output($this->responseBody); diff --git a/framework/main/classes/response/console/class_ConsoleResponse.php b/framework/main/classes/response/console/class_ConsoleResponse.php index 10b064c4..5bb281cf 100644 --- a/framework/main/classes/response/console/class_ConsoleResponse.php +++ b/framework/main/classes/response/console/class_ConsoleResponse.php @@ -3,7 +3,6 @@ namespace CoreFramework\Response; // Import framework stuff -use CoreFramework\Manager\ManageableApplication; use CoreFramework\Response\Responseable; /** @@ -48,22 +47,12 @@ class ConsoleResponse extends BaseResponse implements Responseable { /** * Creates an object of this class * - * @param $applicationInstance An instance of a manageable application - * @return $responseInstance A prepared instance of this class + * @return $responseInstance A prepared instance of this class */ - public static final function createConsoleResponse (ManageableApplication $applicationInstance) { + public static final function createConsoleResponse () { // Get a new instance $responseInstance = new ConsoleResponse(); - // Set the application instance - $responseInstance->setApplicationInstance($applicationInstance); - - // Initialize the template engine here - $responseInstance->initTemplateEngine($applicationInstance); - - // Init web output instance - $responseInstance->initWebOutputInstance(); - // Return the prepared instance return $responseInstance; } @@ -88,7 +77,7 @@ class ConsoleResponse extends BaseResponse implements Responseable { * @return void * @throws ResponseHeadersAlreadySentException If headers are already sent */ - public function addCookie ($cookieName, $cookieValue, $encrypted = FALSE, $expires = NULL) { + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) { //* DEBUG: */ echo $cookieName.'='.$cookieValue."
\n"; $this->partialStub('Naturally unimplemented in console response.'); } @@ -133,7 +122,7 @@ class ConsoleResponse extends BaseResponse implements Responseable { * @return void * @throws ResponseHeadersAlreadySentException Thrown if headers are already sent */ - public function flushBuffer ($force = FALSE) { + public function flushBuffer ($force = false) { $this->partialStub('Please implement this class.'); } diff --git a/framework/main/classes/response/html/class_HtmlResponse.php b/framework/main/classes/response/html/class_HtmlResponse.php index 05d5e2be..ea3ca718 100644 --- a/framework/main/classes/response/html/class_HtmlResponse.php +++ b/framework/main/classes/response/html/class_HtmlResponse.php @@ -3,7 +3,7 @@ namespace CoreFramework\Response; // Import framework stuff -use CoreFramework\Manager\ManageableApplication; +use CoreFramework\Registry\Registry; use CoreFramework\Response\Responseable; /** @@ -42,28 +42,18 @@ class HtmlResponse extends BaseResponse implements Responseable { parent::__construct(__CLASS__); // Set response type - $this->setResponseType('html'); + $this->setResponseType('http'); } /** * Creates an object of this class * - * @param $applicationInstance An instance of a manageable application - * @return $responseInstance A prepared instance of this class + * @return $responseInstance A prepared instance of this class */ - public static final function createHtmlResponse (ManageableApplication $applicationInstance) { + public static final function createHtmlResponse () { // Get a new instance $responseInstance = new HtmlResponse(); - // Set the application instance - $responseInstance->setApplicationInstance($applicationInstance); - - // Initialize the template engine here - $responseInstance->initTemplateEngine($applicationInstance); - - // Init web output instance - $responseInstance->initWebOutputInstance(); - // Return the prepared instance return $responseInstance; } @@ -92,7 +82,7 @@ class HtmlResponse extends BaseResponse implements Responseable { * @todo If the return statement is removed and setcookie() commented out, * @todo this will send only one cookie out, the first one. */ - public function addCookie ($cookieName, $cookieValue, $encrypted = FALSE, $expires = NULL) { + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) { //* DEBUG: */ echo $cookieName.'='.$cookieValue."
\n"; // Are headers already sent? if (headers_sent()) { @@ -102,7 +92,7 @@ class HtmlResponse extends BaseResponse implements Responseable { } // END - if // Shall we encrypt the cookie? - if ($encrypted === TRUE) { + if ($encrypted === true) { // Unsupported at the moment $this->partialStub('Encryption is unsupported at the moment.'); } // END - if @@ -140,6 +130,9 @@ class HtmlResponse extends BaseResponse implements Responseable { * @throws ResponseHeadersAlreadySentException If headers are already sent */ public function redirectToConfiguredUrl ($configEntry) { + // Get application instance + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Is the header not yet sent? if (headers_sent()) { // Throw an exception here @@ -147,7 +140,7 @@ class HtmlResponse extends BaseResponse implements Responseable { } // END - if // Assign application data - $this->getTemplateInstance()->assignApplicationData($this->getApplicationInstance()); + $this->getTemplateInstance()->assignApplicationData($applicationInstance()); // Get the url from config $url = $this->getConfigInstance()->getConfigEntry($configEntry . '_url'); @@ -192,7 +185,7 @@ class HtmlResponse extends BaseResponse implements Responseable { // Is the cookie there? if (isset($_COOKIE[$cookieName])) { // Then expire it with 20 minutes past - $this->addCookie($cookieName, '', FALSE, (time() - 1200)); + $this->addCookie($cookieName, '', false, (time() - 1200)); // Remove it from array unset($_COOKIE[$cookieName]); @@ -209,7 +202,7 @@ class HtmlResponse extends BaseResponse implements Responseable { // Only update existing cookies if (isset($_COOKIE[$cookieName])) { // Update the cookie - $this->addCookie($cookieName, $_COOKIE[$cookieName], FALSE); + $this->addCookie($cookieName, $_COOKIE[$cookieName], false); } // END - if } diff --git a/framework/main/classes/response/image/class_ImageResponse.php b/framework/main/classes/response/image/class_ImageResponse.php index 58e3e41f..fac49db8 100644 --- a/framework/main/classes/response/image/class_ImageResponse.php +++ b/framework/main/classes/response/image/class_ImageResponse.php @@ -3,7 +3,7 @@ namespace CoreFramework\Response; // Import framework stuff -use CoreFramework\Manager\ManageableApplication; +use CoreFramework\Registry\Registry; use CoreFramework\Response\Responseable; /** @@ -48,22 +48,12 @@ class ImageResponse extends BaseResponse implements Responseable { /** * Creates an object of this class * - * @param $applicationInstance An instance of a manageable application - * @return $responseInstance A prepared instance of this class + * @return $responseInstance A prepared instance of this class */ - public static final function createImageResponse (ManageableApplication $applicationInstance) { + public static final function createImageResponse () { // Get a new instance $responseInstance = new ImageResponse(); - // Set the application instance - $responseInstance->setApplicationInstance($applicationInstance); - - // Initialize the template engine here - $responseInstance->initTemplateEngine($applicationInstance); - - // Init web output instance - $responseInstance->initWebOutputInstance(); - // Return the prepared instance return $responseInstance; } @@ -104,7 +94,7 @@ class ImageResponse extends BaseResponse implements Responseable { * @todo If the return statement is removed and setcookie() commented out, * @todo this will send only one cookie out, the first one. */ - public function addCookie ($cookieName, $cookieValue, $encrypted = FALSE, $expires = NULL) { + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) { // Are headers already sent? if (headers_sent()) { // Throw an exception here @@ -112,7 +102,7 @@ class ImageResponse extends BaseResponse implements Responseable { } // END - if // Shall we encrypt the cookie? - if ($encrypted === TRUE) { + if ($encrypted === true) { // Unsupported at the moment $this->partialStub('Encryption is unsupported at the moment.'); } // END - if @@ -150,6 +140,9 @@ class ImageResponse extends BaseResponse implements Responseable { * @throws ResponseHeadersAlreadySentException If headers are already sent */ public function redirectToConfiguredUrl ($configEntry) { + // Get application instance + $applicationInstance = Registry::getRegistry()->getInstance('app'); + // Is the header not yet sent? if (headers_sent()) { // Throw an exception here @@ -157,7 +150,7 @@ class ImageResponse extends BaseResponse implements Responseable { } // END - if // Assign application data - $this->getTemplateInstance()->assignApplicationData($this->getApplicationInstance()); + $this->getTemplateInstance()->assignApplicationData($applicationInstance()); // Get the url from config $url = $this->getConfigInstance()->getConfigEntry($configEntry . '_url'); @@ -197,7 +190,7 @@ class ImageResponse extends BaseResponse implements Responseable { * already sent with an exception * @return void */ - public function flushBuffer ($force = FALSE) { + public function flushBuffer ($force = false) { // Finish the image $this->getImageInstance()->finishImage(); @@ -224,7 +217,7 @@ class ImageResponse extends BaseResponse implements Responseable { // Is the cookie there? if (isset($_COOKIE[$cookieName])) { // Then expire it with 20 minutes past - $this->addCookie($cookieName, '', FALSE, (time() - 1200)); + $this->addCookie($cookieName, '', false, (time() - 1200)); // Remove it from array unset($_COOKIE[$cookieName]); @@ -241,7 +234,7 @@ class ImageResponse extends BaseResponse implements Responseable { // Only update existing cookies if (isset($_COOKIE[$cookieName])) { // Update the cookie - $this->addCookie($cookieName, $_COOKIE[$cookieName], FALSE); + $this->addCookie($cookieName, $_COOKIE[$cookieName], false); } // END - if } diff --git a/framework/main/classes/rng/class_RandomNumberGenerator.php b/framework/main/classes/rng/class_RandomNumberGenerator.php index 515d7881..d2229285 100644 --- a/framework/main/classes/rng/class_RandomNumberGenerator.php +++ b/framework/main/classes/rng/class_RandomNumberGenerator.php @@ -112,7 +112,7 @@ class RandomNumberGenerator extends BaseFrameworkSystem { $this->extraNumber = ($this->prime * $this->prime / pow(pi(), 2)); // Seed mt_rand() - mt_srand((double) sqrt(microtime(TRUE) * 100000000 * $this->extraNumber)); + mt_srand((double) sqrt(microtime(true) * 100000000 * $this->extraNumber)); // Set the server IP to cluster $serverIp = 'cluster'; diff --git a/framework/main/classes/scrypt/class_Scrypt.php b/framework/main/classes/scrypt/class_Scrypt.php index ba563a77..5b00c898 100644 --- a/framework/main/classes/scrypt/class_Scrypt.php +++ b/framework/main/classes/scrypt/class_Scrypt.php @@ -3,6 +3,7 @@ namespace Scrypt; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Object\BaseFrameworkSystem; /** @@ -95,7 +96,7 @@ abstract class Scrypt extends BaseFrameworkSystem $buffer_valid = true; } } - if (!$buffer_valid && BaseFrameworkSystem::isReadableFile('/dev/urandom')) { + if (!$buffer_valid && FrameworkBootstrap::isReadableFile('/dev/urandom')) { $f = fopen('/dev/urandom', 'r'); $read = static::strlen($buffer); while ($read < $length) { diff --git a/framework/main/classes/stacker/class_BaseStacker.php b/framework/main/classes/stacker/class_BaseStacker.php index a054afca..be0a4c3a 100644 --- a/framework/main/classes/stacker/class_BaseStacker.php +++ b/framework/main/classes/stacker/class_BaseStacker.php @@ -53,9 +53,9 @@ class BaseStacker extends BaseFrameworkSystem { * @return void * @throws AlreadyInitializedStackerException If the stack is already initialized */ - public function initStack ($stackerName, $forceReInit = FALSE) { + public function initStack ($stackerName, $forceReInit = false) { // Is the stack already initialized? - if (($forceReInit === FALSE) && ($this->isStackInitialized($stackerName))) { + if (($forceReInit === false) && ($this->isStackInitialized($stackerName))) { // Then throw the exception throw new AlreadyInitializedStackerException(array($this, $stackerName, $forceReInit), self::EXCEPTION_STACKER_ALREADY_INITIALIZED); } // END - if @@ -69,7 +69,7 @@ class BaseStacker extends BaseFrameworkSystem { * * @return void */ - public function initStacks (array $stacks, $forceReInit = FALSE) { + public function initStacks (array $stacks, $forceReInit = false) { // "Walk" through all (more will be added as needed foreach ($stacks as $stackerName) { // Init this stack diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php index b81d140d..cf6614ee 100644 --- a/framework/main/classes/stacker/file/class_BaseFileStack.php +++ b/framework/main/classes/stacker/file/class_BaseFileStack.php @@ -105,7 +105,7 @@ class BaseFileStack extends BaseStacker { $this->getIteratorInstance()->setHeader($header); // Check if the array has only 3 elements - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, TRUE))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] header(%d)=%s', __METHOD__, __LINE__, count($header), print_r($header, true))); assert(count($header) == 3); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__)); @@ -156,7 +156,7 @@ class BaseFileStack extends BaseStacker { ); // Write it to disk (header is always at seek position 0) - $this->getIteratorInstance()->writeData(0, $header, FALSE); + $this->getIteratorInstance()->writeData(0, $header, false); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__)); } @@ -236,7 +236,7 @@ class BaseFileStack extends BaseStacker { } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] stackerName=' . $stackerName . ',value[' . gettype($value) . ']=' . print_r($value, true)); // No objects/resources are allowed as their serialization takes to long assert(!is_object($value)); @@ -342,8 +342,8 @@ class BaseFileStack extends BaseStacker { */ protected function isStackFull ($stackerName) { // File-based stacks will only run full if the disk space is low. - // @TODO Please implement this, returning FALSE - $isFull = FALSE; + // @TODO Please implement this, returning false + $isFull = false; // Return result return $isFull; @@ -372,7 +372,7 @@ class BaseFileStack extends BaseStacker { * @return void * @throws UnsupportedOperationException This method is not (and maybe never will be) supported */ - public function initStack ($stackerName, $forceReInit = FALSE) { + public function initStack ($stackerName, $forceReInit = false) { throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -382,7 +382,7 @@ class BaseFileStack extends BaseStacker { * @return void * @throws UnsupportedOperationException This method is not (and maybe never will be) supported */ - public function initStacks (array $stacks, $forceReInit = FALSE) { + public function initStacks (array $stacks, $forceReInit = false) { throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -531,7 +531,7 @@ class BaseFileStack extends BaseStacker { * @return void * @throws UnsupportedOperationException This method is not (and maybe never will be) supported */ - public function writeData ($seekPosition, $data, $flushHeader = TRUE) { + public function writeData ($seekPosition, $data, $flushHeader = true) { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data[]=%s,flushHeader=%d', __METHOD__, __LINE__, $seekPosition, gettype($data), intval($flushHeader))); throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -545,7 +545,7 @@ class BaseFileStack extends BaseStacker { * @throws UnsupportedOperationException This method is not (and maybe never will be) supported */ public function writeValueToFile ($groupId, $value) { - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,value[%s]=%s', __METHOD__, __LINE__, $groupId, gettype($value), print_r($value, TRUE))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] groupId=%s,value[%s]=%s', __METHOD__, __LINE__, $groupId, gettype($value), print_r($value, true))); throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getPointerInstance()), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/template/class_BaseTemplateEngine.php b/framework/main/classes/template/class_BaseTemplateEngine.php index cb071257..cebf170d 100644 --- a/framework/main/classes/template/class_BaseTemplateEngine.php +++ b/framework/main/classes/template/class_BaseTemplateEngine.php @@ -3,6 +3,7 @@ namespace CoreFramework\Template\Engine; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Generic\EmptyVariableException; use CoreFramework\Manager\ManageableApplication; @@ -149,12 +150,12 @@ class BaseTemplateEngine extends BaseFrameworkSystem { /** * Language support is enabled by default */ - private $languageSupport = TRUE; + private $languageSupport = true; /** * XML compacting is disabled by default */ - private $xmlCompacting = FALSE; + private $xmlCompacting = false; // Exception codes for the template engine const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x110; @@ -184,14 +185,14 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * * @param $variableName The variable we are looking for * @param $variableGroup Optional variable group to look in - * @return $index FALSE means not found, >=0 means found on a specific index + * @return $index false means not found, >=0 means found on a specific index */ private function getVariableIndex ($variableName, $variableGroup = NULL) { // Replace all dashes to underscores to match variables with configuration entries $variableName = trim(self::convertDashesToUnderscores($variableName)); // First everything is not found - $found = FALSE; + $found = false; // If the stack is NULL, use the current group if (is_null($variableGroup)) { @@ -279,7 +280,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $found = $this->getVariableIndex($variableName, $variableGroup); // Is the variable found? - if ($found !== FALSE) { + if ($found !== false) { // Read it $content = $this->getVariableValue($variableGroup, $found); } // END - if @@ -330,13 +331,13 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $add Whether add this group * @return void */ - public function setVariableGroup ($groupName, $add = TRUE) { + public function setVariableGroup ($groupName, $add = true) { // Set group name //* DEBIG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__.': currGroup=' . $groupName); $this->currGroup = $groupName; // Skip group 'general' - if (($groupName != 'general') && ($add === TRUE)) { + if (($groupName != 'general') && ($add === true)) { $this->variableGroups[$groupName] = 'OK'; } // END - if } @@ -394,7 +395,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $index = $this->getVariableIndex($variableName); // Is the variable set? - if ($index === FALSE) { + if ($index === false) { // Unset variables cannot be modified throw new NoVariableException(array($this, $variableName, $value), self::EXCEPTION_VARIABLE_IS_MISSING); } // END - if @@ -433,7 +434,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $index = $this->getVariableIndex($variableName); // Is the variable set? - if ($index === FALSE) { + if ($index === false) { // Is the stack there? if (!isset($this->varStack[$variableGroup])) { // Then initialize it here @@ -778,7 +779,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:rawData(' . strlen($rawData) . ')=' . $rawData . ',variableMatches=' . print_r($variableMatches, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:rawData(' . strlen($rawData) . ')=' . $rawData . ',variableMatches=' . print_r($variableMatches, true)); // Did we find some variables? if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) { @@ -830,7 +831,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:template=' . $template); // Template not found, but maybe variable assigned? - if ($this->getVariableIndex($template) !== FALSE) { + if ($this->getVariableIndex($template) !== false) { // Use that content here $this->loadedRawData[$template] = $this->readVariable($template); @@ -908,7 +909,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $foundIndex = array_search($template, $templateMatches[1]); // Lookup the matching template replacement - if (($foundIndex !== FALSE) && (isset($templateMatches[0][$foundIndex]))) { + if (($foundIndex !== false) && (isset($templateMatches[0][$foundIndex]))) { // Get the current raw template $rawData = $this->getRawTemplateData(); @@ -1017,10 +1018,10 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $foundIndex = array_search($template, $templateMatches[1]); // Lookup the matching variable data - if (($foundIndex !== FALSE) && (isset($templateMatches[3][$foundIndex]))) { + if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) { // Split it up with another reg. exp. into variable=value pairs preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:varMatches=' . print_r($varMatches, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:varMatches=' . print_r($varMatches, true)); // Assign all variables $this->assignAllVariables($varMatches); @@ -1122,7 +1123,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $index = $this->getVariableIndex($variableName); // Was it found? - if ($index === FALSE) { + if ($index === false) { // Add it to the stack //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value); $this->addVariable($variableName, $value); @@ -1145,7 +1146,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $index = $this->getVariableIndex($variableName, $variableGroup); // Was it found? - if ($index !== FALSE) { + if ($index !== false) { // Remove this variable //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index); $this->unsetVariableStackOffset($index, $variableGroup); @@ -1232,7 +1233,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ public function loadCodeTemplate ($template) { // Set template type - $this->setTemplateType($this->getConfigInstance()->getConfigEntry('code_' . self::getResponseTypeFromSystem() . '_template_type')); + $this->setTemplateType($this->getConfigInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type')); // Load the special template $this->loadTemplate($template); @@ -1271,7 +1272,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Iterate through all general variables foreach ($this->getVarStack('general') as $index => $currVariable) { // Compile the value - $value = $this->compileRawCode($this->readVariable($currVariable['name']), TRUE); + $value = $this->compileRawCode($this->readVariable($currVariable['name']), true); // Debug message //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: name=' . $currVariable['name'] . ',value=' . $value); @@ -1328,7 +1329,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { ); // This loop does remove the backslashes (\) in PHP parameters - while (strpos($eval, $this->codeBegin) !== FALSE) { + while (strpos($eval, $this->codeBegin) !== false) { // Get left part before "codeBegin)); @@ -1362,7 +1363,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Goes something wrong? if ((!isset($result)) || (empty($result))) { // Output eval command - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Failed eval() code:
%s
', $this->markupCode($eval, TRUE)), TRUE); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Failed eval() code:
%s
', $this->markupCode($eval, true)), true); // Output backtrace here $this->debugBackTrace(); @@ -1391,12 +1392,12 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ public function compileTemplate () { // Get code type to make things shorter - $codeType = $this->getConfigInstance()->getConfigEntry('code_' . self::getResponseTypeFromSystem() . '_template_type'); + $codeType = $this->getConfigInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type'); // We will only work with template type "code" from configuration if (substr($this->getTemplateType(), 0, strlen($codeType)) != $codeType) { // Abort here - throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->getConfigEntry('code_' . self::getResponseTypeFromSystem() . '_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED); + throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED); } // END - if // Get the raw data. @@ -1412,7 +1413,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { preg_match_all($this->regExpCodeTags, $rawData, $templateMatches); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:templateMatches=' . print_r($templateMatches , TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:templateMatches=' . print_r($templateMatches , true)); // Analyze the matches array if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) { @@ -1476,13 +1477,13 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $setMatchAsCode Sets $match if readVariable() returns empty result * @return $rawCode Compile code with inserted variable value */ - public function compileRawCode ($rawCode, $setMatchAsCode=FALSE) { + public function compileRawCode ($rawCode, $setMatchAsCode=false) { // Find the variables //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:rawCode=
' . htmlentities($rawCode) . '
'); preg_match_all($this->regExpVarValue, $rawCode, $varMatches); // Compile all variables - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:
' . print_r($varMatches, TRUE) . '
'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:
' . print_r($varMatches, true) . '
'); foreach ($varMatches[0] as $match) { // Add variable tags around it $varCode = '{?' . $match . '?}'; @@ -1491,12 +1492,12 @@ class BaseTemplateEngine extends BaseFrameworkSystem { //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:varCode=' . $varCode); // Is the variable found in code? (safes some calls) - if (strpos($rawCode, $varCode) !== FALSE) { + if (strpos($rawCode, $varCode) !== false) { // Debug message //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: match=' . $match . ',rawCode[' . gettype($rawCode) . ']=' . $rawCode); // Use $match as new value or $value from read variable? - if ($setMatchAsCode === TRUE) { + if ($setMatchAsCode === true) { // Insert match $rawCode = str_replace($varCode, $match, $rawCode); } else { @@ -1575,7 +1576,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $languageSupport New language support setting * @return void */ - public final function enableLanguageSupport ($languageSupport = TRUE) { + public final function enableLanguageSupport ($languageSupport = true) { $this->languageSupport = (bool) $languageSupport; } @@ -1594,7 +1595,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { * @param $xmlCompacting New XML compacting setting * @return void */ - public final function enableXmlCompacting ($xmlCompacting = TRUE) { + public final function enableXmlCompacting ($xmlCompacting = true) { $this->xmlCompacting = (bool) $xmlCompacting; } diff --git a/framework/main/classes/template/menu/class_MenuTemplateEngine.php b/framework/main/classes/template/menu/class_MenuTemplateEngine.php index 316f1518..cded4f95 100644 --- a/framework/main/classes/template/menu/class_MenuTemplateEngine.php +++ b/framework/main/classes/template/menu/class_MenuTemplateEngine.php @@ -366,7 +366,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla */ private function initMenu ($templateDependency = '') { // Get web template engine - $this->setTemplateInstance(ObjectFactory::createObjectByConfiguredName('html_template_class', array($this->getApplicationInstance()))); + $this->setTemplateInstance(ObjectFactory::createObjectByConfiguredName('html_template_class', array(Registry::getRegistry()->getInstance('app')))); // Handle the dependency template $this->handleTemplateDependency('menu', $templateDependency); diff --git a/framework/main/classes/user/class_BaseUser.php b/framework/main/classes/user/class_BaseUser.php index f8b945f9..34761fef 100644 --- a/framework/main/classes/user/class_BaseUser.php +++ b/framework/main/classes/user/class_BaseUser.php @@ -130,7 +130,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable { */ public function ifUsernameExists () { // By default the username does not exist - $exists = FALSE; + $exists = false; // Is a previous result there? if (!$this->getResultInstance() instanceof SearchableResult) { @@ -160,7 +160,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable { // Search for it if ($this->getResultInstance()->next()) { // Entry found - $exists = TRUE; + $exists = true; } // END - if // Return the status @@ -174,7 +174,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable { */ public function ifEmailAddressExists () { // By default the email does not exist - $exists = FALSE; + $exists = false; // Is a previous result there? if (!$this->getResultInstance() instanceof SearchableResult) { @@ -204,7 +204,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable { // Search for it if ($this->getResultInstance()->next()) { // Entry found - $exists = TRUE; + $exists = true; // Is the username set? if ($this->getUserName() == '') { @@ -229,7 +229,7 @@ class BaseUser extends BaseFrameworkSystem implements Updateable { */ public function ifPasswordHashMatches (Requestable $requestInstance) { // By default nothing matches... ;) - $matches = FALSE; + $matches = false; // Is a previous result there? if ((!$this->getResultInstance() instanceof SearchableResult) || ($this->getResultInstance()->count() == 0)) { diff --git a/framework/main/classes/user/guest/class_Guest.php b/framework/main/classes/user/guest/class_Guest.php index ac73f177..70476729 100644 --- a/framework/main/classes/user/guest/class_Guest.php +++ b/framework/main/classes/user/guest/class_Guest.php @@ -91,10 +91,10 @@ class Guest extends BaseUser implements ManageableGuest, Registerable { $userInstance->setUserName($userName); // Check if username exists - if ($userInstance->ifUsernameExists() === FALSE) { + if ($userInstance->ifUsernameExists() === false) { // Throw an exception here throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND); - } elseif ($userInstance->isGuest() === FALSE) { + } elseif ($userInstance->isGuest() === false) { // Sanity check on 'guest' status failed throw new UserNoGuestException(array($userInstance, $userName), self::EXCEPTION_USER_NOT_GUEST_STATUS); } diff --git a/framework/main/classes/user/member/class_Member.php b/framework/main/classes/user/member/class_Member.php index 088a965a..94a37639 100644 --- a/framework/main/classes/user/member/class_Member.php +++ b/framework/main/classes/user/member/class_Member.php @@ -60,10 +60,10 @@ class Member extends BaseUser implements ManageableMember, Registerable { $userInstance->setUserName($userName); // Check if username exists - if ($userInstance->ifUsernameExists() === FALSE) { + if ($userInstance->ifUsernameExists() === false) { // Throw an exception here throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND); - } elseif ($userInstance->isGuest() === TRUE) { + } elseif ($userInstance->isGuest() === true) { // User should not be a guest here throw new UnexpectedGuestAccountException(array($userInstance, $userName), self::EXCEPTION_USER_IS_GUEST); } diff --git a/framework/main/exceptions/class_FrameworkException.php b/framework/main/exceptions/class_FrameworkException.php index 866e59f7..174e8763 100644 --- a/framework/main/exceptions/class_FrameworkException.php +++ b/framework/main/exceptions/class_FrameworkException.php @@ -126,7 +126,7 @@ abstract class FrameworkException extends ReflectionException { // Are there arguments? if ((isset($dbgInfo['args'])) && (is_array($dbgInfo['args'])) && (isset($dbgInfo['args'][0]))) { - //* DEBUG: */ echo $dbgIndex.":
".htmlentities(print_r($dbgInfo['args'], TRUE))."
"; + //* DEBUG: */ echo $dbgIndex.":
".htmlentities(print_r($dbgInfo['args'], true))."
"; $info = ''; foreach ($dbgInfo['args'] as $debug) { // Add only non-array elements diff --git a/framework/main/exceptions/dns/.htaccess b/framework/main/exceptions/dns/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/framework/main/exceptions/dns/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/framework/main/exceptions/dns/class_UnknownHostnameException.php b/framework/main/exceptions/dns/class_UnknownHostnameException.php new file mode 100644 index 00000000..10fa21bc --- /dev/null +++ b/framework/main/exceptions/dns/class_UnknownHostnameException.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * 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 . + */ +class UnknownHostnameException extends FrameworkException { + /** + * The constructor + * + * @param $msgArray Message array holding all needed data + * @param $code Code number for the exception + * @return void + */ + public function __construct (array $msgArray, $code) { + // Add a message around the host name + $message = sprintf('[%s:%d] Host name "%s" cannot be resolved (NXDOMAIN).', + $msgArray[0]->__toString(), + $this->getLine(), + $msgArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } + +} diff --git a/framework/main/exceptions/helper/class_InvalidFormNameException.php b/framework/main/exceptions/helper/class_InvalidFormNameException.php index 851f2ce8..0ddf0278 100644 --- a/framework/main/exceptions/helper/class_InvalidFormNameException.php +++ b/framework/main/exceptions/helper/class_InvalidFormNameException.php @@ -6,7 +6,7 @@ namespace CoreFramework\Deprecated; use CoreFramework\Generic\FrameworkException; /** - * An exception thrown when the form name is invalid (set to FALSE) + * An exception thrown when the form name is invalid (set to false) * * @author Roland Haeder * @version 0.0.0 diff --git a/framework/main/exceptions/main/class_InvalidCommandInstanceException.php b/framework/main/exceptions/main/class_InvalidCommandInstanceException.php index f4d171b1..7d6dceec 100644 --- a/framework/main/exceptions/main/class_InvalidCommandInstanceException.php +++ b/framework/main/exceptions/main/class_InvalidCommandInstanceException.php @@ -1,48 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @deprecated Don't use this anymore - * - * 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 . - */ -class InvalidCommandInstanceException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public function __construct (array $msgArray, $code) { - // Add a message around the missing class - $message = sprintf('[%s:%d] Invalid command %s detected.', - $msgArray[0]->__toString(), - $this->getLine(), - $msgArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } - -} +// @DEPRECATED diff --git a/framework/main/interfaces/application/class_ManageableApplication.php b/framework/main/interfaces/application/class_ManageableApplication.php index 5a7a5305..d7cb389f 100644 --- a/framework/main/interfaces/application/class_ManageableApplication.php +++ b/framework/main/interfaces/application/class_ManageableApplication.php @@ -35,11 +35,25 @@ use CoreFramework\Template\CompileableTemplate; */ interface ManageableApplication extends FrameworkInterface { /** - * Launches the application + * 1) Setups application data * * @return void */ - function entryPoint (); + function setupApplicationData (); + + /** + * 2) Does initial stuff before starting the application + * + * @return void + */ + function initApplication (); + + /** + * 3) Launches the application + * + * @return void + */ + function launchApplication (); /** * Handle the indexed array of fatal messages and puts them out in an diff --git a/framework/main/interfaces/block/class_Block.php b/framework/main/interfaces/block/class_Block.php index 3677e62b..882714b9 100644 --- a/framework/main/interfaces/block/class_Block.php +++ b/framework/main/interfaces/block/class_Block.php @@ -144,7 +144,7 @@ interface Block extends FrameworkInterface { * @param $flushHeader Whether to flush the header (default: flush) * @return void */ - function writeData ($seekPosition, $data, $flushHeader = TRUE); + function writeData ($seekPosition, $data, $flushHeader = true); /** * Searches for next suitable gap the given length of data can fit in diff --git a/framework/main/interfaces/criteria/class_Criteria.php b/framework/main/interfaces/criteria/class_Criteria.php index 0506238f..d76e0f6f 100644 --- a/framework/main/interfaces/criteria/class_Criteria.php +++ b/framework/main/interfaces/criteria/class_Criteria.php @@ -151,27 +151,27 @@ interface Criteria extends FrameworkInterface { function addConfiguredCriteria ($criteriaKey, $configEntry, $criteriaType = 'default'); /** - * Get criteria element or FALSE if not found + * Get criteria element or false if not found * * @param $criteriaKey The requested criteria key * @param $criteriaType Type of this criteria, can be one of 'default' (default), 'choice' or 'exclude' - * @return $value Whether the value of the critera or FALSE + * @return $value Whether the value of the critera or false */ function getCriteriaElemnent ($criteriaKey, $criteriaType = 'default'); /** - * Get criteria element or FALSE if not found for 'choice' type + * Get criteria element or false if not found for 'choice' type * * @param $criteriaKey The requested criteria key - * @return $value Whether the value of the critera or FALSE + * @return $value Whether the value of the critera or false */ function getCriteriaChoiceElemnent ($criteriaKey); /** - * Get criteria element or FALSE if not found for 'exclude' type + * Get criteria element or false if not found for 'exclude' type * * @param $criteriaKey The requested criteria key - * @return $value Whether the value of the critera or FALSE + * @return $value Whether the value of the critera or false */ function getCriteriaExcludeElemnent ($criteriaKey); diff --git a/framework/main/interfaces/crypto/class_Cryptable.php b/framework/main/interfaces/crypto/class_Cryptable.php index 441663f6..76a546e6 100644 --- a/framework/main/interfaces/crypto/class_Cryptable.php +++ b/framework/main/interfaces/crypto/class_Cryptable.php @@ -39,7 +39,7 @@ interface Cryptable extends FrameworkInterface { * @param $withFixed Whether to include a fixed salt (not recommended in p2p applications) * @return $hashed The hashed and salted string */ - function hashString ($str, $oldHash = '', $withFixed = TRUE); + function hashString ($str, $oldHash = '', $withFixed = true); /** * Encrypt the string with fixed salt diff --git a/framework/main/interfaces/debug/class_Debugger.php b/framework/main/interfaces/debug/class_Debugger.php index 7ee86072..d1fbc901 100644 --- a/framework/main/interfaces/debug/class_Debugger.php +++ b/framework/main/interfaces/debug/class_Debugger.php @@ -35,6 +35,6 @@ interface Debugger extends FrameworkInterface { * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - function outputStream ($output, $stripTags = FALSE); + function outputStream ($output, $stripTags = false); } diff --git a/framework/main/interfaces/io/output/class_OutputStreamer.php b/framework/main/interfaces/io/output/class_OutputStreamer.php index 0ef649d9..c534338d 100644 --- a/framework/main/interfaces/io/output/class_OutputStreamer.php +++ b/framework/main/interfaces/io/output/class_OutputStreamer.php @@ -35,6 +35,6 @@ interface OutputStreamer extends StreamableOutput { * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - function output ($outStream = FALSE, $stripTags = FALSE); + function output ($outStream = false, $stripTags = false); } diff --git a/framework/main/interfaces/io/pointer/class_OutputPointer.php b/framework/main/interfaces/io/pointer/class_OutputPointer.php index 9b934d19..3e83cd54 100644 --- a/framework/main/interfaces/io/pointer/class_OutputPointer.php +++ b/framework/main/interfaces/io/pointer/class_OutputPointer.php @@ -33,7 +33,7 @@ interface OutputPointer extends StreamableOutput, FilePointer { * Write data to a file pointer * * @param $dataStream The data stream we shall write to the file - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error * @throws NullPointerException If the file pointer instance * is not set by setPointer() * @throws InvalidResourceException If there is being set @@ -46,7 +46,7 @@ interface OutputPointer extends StreamableOutput, FilePointer { * * @param $seekPosition Seek position in file * @param $data Data to be written - * @return mixed Number of writes bytes or FALSE on error + * @return mixed Number of writes bytes or false on error */ function writeAtPosition ($seedPosition, $data); diff --git a/framework/main/interfaces/io/pointer/io/class_InputOutputPointer.php b/framework/main/interfaces/io/pointer/io/class_InputOutputPointer.php index f9706332..0b45bf6a 100644 --- a/framework/main/interfaces/io/pointer/io/class_InputOutputPointer.php +++ b/framework/main/interfaces/io/pointer/io/class_InputOutputPointer.php @@ -45,7 +45,7 @@ interface InputOutputPointer extends InputPointer, OutputPointer { /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid */ diff --git a/framework/main/interfaces/iterator/class_SeekableWritableFileIterator.php b/framework/main/interfaces/iterator/class_SeekableWritableFileIterator.php index 17a93cb1..45f49c6e 100644 --- a/framework/main/interfaces/iterator/class_SeekableWritableFileIterator.php +++ b/framework/main/interfaces/iterator/class_SeekableWritableFileIterator.php @@ -152,7 +152,7 @@ interface SeekableWritableFileIterator extends SeekableIterator { * @param $flushHeader Whether to flush the header (default: flush) * @return void */ - function writeData ($seekPosition, $data, $flushHeader = TRUE); + function writeData ($seekPosition, $data, $flushHeader = true); /** * Getter for seek position diff --git a/framework/main/interfaces/registry/socket/class_RegisterableSocket.php b/framework/main/interfaces/registry/socket/class_RegisterableSocket.php index a542f312..badabef8 100644 --- a/framework/main/interfaces/registry/socket/class_RegisterableSocket.php +++ b/framework/main/interfaces/registry/socket/class_RegisterableSocket.php @@ -31,7 +31,7 @@ use CoreFramework\Registry\Registerable; interface RegisterableSocket extends Registerable { /** * Checks whether given socket resource is registered. If $socketResource is - * FALSE only the instance will be checked. + * false only the instance will be checked. * * @param $infoInstance An instance of a ShareableInfo class * @param $socketResource A valid socket resource diff --git a/framework/main/interfaces/request/class_Requestable.php b/framework/main/interfaces/request/class_Requestable.php index 24b295a9..76399549 100644 --- a/framework/main/interfaces/request/class_Requestable.php +++ b/framework/main/interfaces/request/class_Requestable.php @@ -28,19 +28,11 @@ use CoreFramework\Generic\FrameworkInterface; * along with this program. If not, see . */ interface Requestable extends FrameworkInterface { - /** - * Prepares the request data for usage - * - * @return void - */ - function prepareRequestData (); - /** * Checks whether a request element is set * * @param $element Name of the request element we want to check * @return $isSet Whether the request element is set - * @throws MissingArrayElementsException Thrown if a request element is not set */ function isRequestElementSet ($element); @@ -54,55 +46,42 @@ interface Requestable extends FrameworkInterface { function getRequestElement ($element); /** - * Wrapper method for array_key() function for the request data array - * - * @return $array An array containing all array keys to return - */ - function getParameterNames (); - - /** - * Getter for a header element or 'null' if header was not found + * Setter for request elements * - * @param $headerName Name of the header - * @return $headerValue Value of the header or 'null' if not found - */ - function getHeaderElement ($headerName); - - /** - * Sets whether the request was valid (default: TRUE) - * - * @param $isValid Whether the request is valid + * @param $element Request element to se + * @param $value Value to set * @return void */ - function requestIsValid ($isValid = TRUE); + function setRequestElement ($element, $value); /** - * Reads a cookie and returns it's value or null if not found + * Setter for request data array * - * @param $cookieName Name of cookie we shall read - * @return $cookieValue Value of cookie or null if not found + * @param $requestData Request element to se + * @return void */ - function readCookie ($cookieName); + function setRequestData (array $requestData); /** - * Checks if the request method is GET. + * Wrapper method for array_key() function for the request data array * - * @return $isGet Whether the request method is GET + * @return $array An array containing all array keys to return */ - function isGetRequestMethod (); + function getParameterNames (); /** - * Checks if the request method is HEAD. + * Sets whether the request was valid (default: true) * - * @return $isHead Whether the request method is HEAD + * @param $isValid Whether the request is valid + * @return void */ - function isHeadRequestMethod (); + function requestIsValid ($isValid = true); /** - * Checks if the request method is POST. + * Returns whether this request is valid * - * @return $isPost Whether the request method is POST + * @return $requestIsValid Whether this request is valid */ - function isPostRequestMethod (); + function isRequestValid (); } diff --git a/framework/main/interfaces/response/class_Responseable.php b/framework/main/interfaces/response/class_Responseable.php index dbd09ef8..d4753e9c 100644 --- a/framework/main/interfaces/response/class_Responseable.php +++ b/framework/main/interfaces/response/class_Responseable.php @@ -66,7 +66,7 @@ interface Responseable extends FrameworkInterface { * @throws ResponseHeadersAlreadySentException Thrown if headers are * already sent */ - function flushBuffer ($force = FALSE); + function flushBuffer ($force = false); /** * Adds a fatal message id to the response. The added messages can then be @@ -86,7 +86,7 @@ interface Responseable extends FrameworkInterface { * @return void * @throws ResponseHeadersAlreadySentException If headers are already sent */ - function addCookie ($cookieName, $cookieValue, $encrypted = FALSE); + function addCookie ($cookieName, $cookieValue, $encrypted = false); /** * Redirect to a configured URL. The URL can be absolute or relative. In diff --git a/framework/main/interfaces/template/class_CompileableTemplate.php b/framework/main/interfaces/template/class_CompileableTemplate.php index 2a96e9c1..a4a12c72 100644 --- a/framework/main/interfaces/template/class_CompileableTemplate.php +++ b/framework/main/interfaces/template/class_CompileableTemplate.php @@ -147,10 +147,10 @@ interface CompileableTemplate extends FrameworkInterface { * "Compiles" a variable by replacing {?var?} with it's content * * @param $rawCode Raw code to compile - * @param $setMatchAsCode Sets $match if readVariable() returns empty result (default: FALSE) + * @param $setMatchAsCode Sets $match if readVariable() returns empty result (default: false) * @return $rawCode Compile code with inserted variable value */ - function compileRawCode ($rawCode, $setMatchAsCode = FALSE); + function compileRawCode ($rawCode, $setMatchAsCode = false); /** * Renames a variable in code and in stack @@ -176,7 +176,7 @@ interface CompileableTemplate extends FrameworkInterface { * @param $languageSupport New language support setting * @return void */ - function enableLanguageSupport ($languageSupport = TRUE); + function enableLanguageSupport ($languageSupport = true); /** * Checks whether language support is enabled @@ -191,7 +191,7 @@ interface CompileableTemplate extends FrameworkInterface { * @param $xmlCompacting New XML compacting setting * @return void */ - function enableXmlCompacting ($xmlCompacting = TRUE); + function enableXmlCompacting ($xmlCompacting = true); /** * Checks whether XML compacting is enabled @@ -223,7 +223,7 @@ interface CompileableTemplate extends FrameworkInterface { * @param $add Whether add this group * @return void */ - function setVariableGroup ($groupName, $add = TRUE); + function setVariableGroup ($groupName, $add = true); /** * Getter for template type diff --git a/framework/main/middleware/debug/class_DebugMiddleware.php b/framework/main/middleware/debug/class_DebugMiddleware.php index 5416df5d..abca7c30 100644 --- a/framework/main/middleware/debug/class_DebugMiddleware.php +++ b/framework/main/middleware/debug/class_DebugMiddleware.php @@ -74,7 +74,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable { $debugInstance = new DebugMiddleware(); // Default is that $outputClass may be invalid - $isInitialized = FALSE; + $isInitialized = false; // Is there a valid output instance provided? if ((!is_null($outputClass)) && (is_object($outputClass)) && ($outputClass instanceof OutputStreamer)) { @@ -82,7 +82,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable { $debugInstance->setOutputInstance($outputClass); // All fine - $isInitialized = TRUE; + $isInitialized = true; } elseif ((!is_null($outputClass)) && (is_string($outputClass)) && (class_exists($outputClass))) { // A name for a debug output class has been provided so we try to get it $outputInstance = ObjectFactory::createObjectByName($outputClass); @@ -91,11 +91,11 @@ class DebugMiddleware extends BaseMiddleware implements Registerable { $debugInstance->setOutputInstance($outputInstance); // All fine - $isInitialized = TRUE; + $isInitialized = true; } // Is the output class initialized? - if ($isInitialized === TRUE) { + if ($isInitialized === true) { // Then set class name $debugInstance->getOutputInstance()->setLoggerClassName($className); } // END - if @@ -122,7 +122,7 @@ class DebugMiddleware extends BaseMiddleware implements Registerable { * @param $stripTags Whether HTML tags shall be stripped out * @return void */ - public final function output ($outStream, $stripTags = FALSE) { + public final function output ($outStream, $stripTags = false) { // Is the output stream set if (empty($outStream)) { // @TODO Initialization phase diff --git a/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php b/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php index d7dfd9f6..56a2940e 100644 --- a/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php +++ b/framework/main/tests/resolver/command/console/class_TestsConsoleCommandResolver.php @@ -62,7 +62,7 @@ class TestsConsoleCommandResolver extends BaseCommandResolver implements Command if (empty($commandName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isCommandValid('CoreFramework\Tests\Command', $commandName) === FALSE) { + } elseif ($resolverInstance->isCommandValid('CoreFramework\Tests\Command', $commandName) === false) { // Invalid command found throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND); } diff --git a/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php b/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php index 18124fa4..07521787 100644 --- a/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php +++ b/framework/main/tests/resolver/controller/class_TestsConsoleControllerResolver.php @@ -63,7 +63,7 @@ class TestsConsoleControllerResolver extends BaseControllerResolver implements C if (empty($controllerName)) { // Then thrown an exception here throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif ($resolverInstance->isControllerValid('CoreFramework\Tests\Controller', $controllerName) === FALSE) { + } elseif ($resolverInstance->isControllerValid('CoreFramework\Tests\Controller', $controllerName) === false) { // Invalid command found throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER); } diff --git a/framework/main/third_party/api/primusportal/.htaccess b/framework/main/third_party/api/primusportal/.htaccess deleted file mode 100644 index 3a428827..00000000 --- a/framework/main/third_party/api/primusportal/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/framework/main/third_party/api/primusportal/class_PrimeraApi.php b/framework/main/third_party/api/primusportal/class_PrimeraApi.php deleted file mode 100644 index 20288de8..00000000 --- a/framework/main/third_party/api/primusportal/class_PrimeraApi.php +++ /dev/null @@ -1,269 +0,0 @@ -payPrimera($PayReceiver, $PayAmount, $PayDescription); - * - * Wobei $PayReicer der Username des Empf�ngers bei - * Primusportal.de ist. $PayAmount ist der gerundete( !! ) Betrag an Primera, - * die der Empf�nger erhalten soll. $PayDescription ist eine von Ihnen - * festgelegte kurze Beschreibung. Die L�nge dieses Textes darf 100 Zeichen - * nicht �berschreiten. Beispiel: - * $status = $apiInstance->payPrimera('garbage', 10000, 'Auszahlung IhreSeite.de - ID: 12345'); - * 3. �berpr�fung des Status (R�ckgabecode): - * CODE: - * if ($status === FALSE) { - * // Ein Fehler ist aufgetreten - * // Fehlerbehandlung hier einf�gen... - * } else { - * // Auszahlung erfolgreich durchgef�hrt - * // F�hren Sie hier Ihre Datenbankabfragen durch, um die Auszahlung zu - * // best�tigen... - * } - * - * Die komplette R�ckgabe des Interfaces wird als assoziatives Array in der Klassen- - * variable $data gespeichert: - * $data = array( - * 'status' => R�ckgabecode (PI_DONE, PI_SENDER_ERROR, ...), - * 'statustext' => Status in Worten (z.B.: 'Transaktion erfolgreich durchgef�hrt'), - * ); - * - * - * @author Andreas Schmidt - * @author Roland Haeder - * @version 1.0 - beta - * @copyright (c) 2007 by Primusportal.de - * @copyright (c) 2008, 2011 by Roland Haeder - */ -class PrimeraApi extends BaseFrameworkSystem { - /** - * Fehler - Interfacebenutzer - */ - const PI_ERROR = -1; - - /** - * Statuscode f�r erfolgreich ausgef�hrte Transaktion - */ - const PI_DONE = 200; - - /** - * Fehler - User existiert nicht oder ist gesperrt - */ - const PI_RECEIVER_ERROR = 301; - - /** - * Sender-Account Fehler (User nicht existent, gesperrt, ...) - */ - const PI_SENDER_ERROR = 401; - - /** - * Betrag fehler - */ - const PI_AMOUNT_ERROR = 501; - - /** - * Zu wenig Primera - */ - const PI_TOO_LESS_PRIMERA = 502; - - /** - * User nicht aktiv oder existiert nicht - */ - const PI_USER_CHECK_ERROR = 601; - - /** - * User aktiv - */ - const PI_USER_CHECK_OK = 602; - - /** - * Primerastand erfolgreich geholt - */ - const PI_GET_PRIMERA_DONE = 701; - - /** - * HTTP-EOL - */ - const HTTP_EOL = "\r\n"; - - /** - * URL f�r das Interface auf dem Primusserver: - */ - private $host = 'www.primusportal.de'; - private $path = '/transfer.interface.2.0.php'; - - private $errno = 0; - private $err = ''; - - private $separator = ':'; - - private $username = ''; - private $password = ''; - - private $data = array(); - - /** - * Konstruktor - */ - public function __construct ($primusUsername, $primusPassword) { - // Call parent constructor - parent::__construct(); - - // Set data - $this->username = $primusUsername; - $this->password = $primusPassword; - } - - /** - * Anfrage senden und Rueckgabecode in Variable speichern - */ - private function queryApi ( $data = array() ) { - $fp = fsockopen($this->host, 80, $this->errno, $this->_err); - if (!$fp) return false; - - $data['PrimusInterface_Username'] = base64_encode($this->username); - $data['PrimusInterface_Password'] = base64_encode(md5($this->password)); - - // POST-Daten uebermitteln: - $queryData = http_build_query($data, '', '&'); - - $request .= 'POST ' . $this->path . 'HTTP/1.1' . self::HTTP_EOL; - $request .= 'Host: ' . $this->host . self::HTTP_EOL; - $request .= 'Content-type: application/x-www-form-urlencoded' . self::HTTP_EOL; - $request .= 'Content-length: '. strlen($queryData) . self::HTTP_EOL; - $request .= 'Connection: close' . self::HTTP_EOL; - $request .= self::HTTP_EOL; - $request .= $queryData; - - fputs($fp, $request); - - $return = ''; - while (!feof($fp)) { - $return .= fgets($fp, 128); - } // END - while - - $content = explode('', $return); - return $content[1]; - } - - /** - * Funktion parst die R�ckgabe vom Transferskript: - */ - private function parseContent ( $content ) { - $x = explode("\n", $content); - $return = array(); - foreach($x as $currentLine) { - $line_exploded = explode($this->separator, $currentLine,2); - if (count($line_exploded) > 1) { - $return[$line_exploded[0]] = $line_exploded[1]; - } // END - if - } // END - foreach - return $return; - } - - /** - * @param int/string $Receiver UserID / Username des Empf�ngers - * @param int$Amount Betrag in ganzzahligen Primera - * @param string $Description Beschreibung (Sichtbar in Einzelauflistung) - */ - public function payPrimera ($Receiver, $Amount, $Description = '') { - $valid = FALSE; - $postData = array( - 'PrimusInterface_Action' => 'Pay', - 'PrimusInterface_Receiver' => base64_encode($Receiver), - 'PrimusInterface_Amount' => base64_encode($Amount), - 'PrimusInterface_Description' => base64_encode($Description) - ); - - $postReturn = $this->parseContent( $this->queryApi($postData) ); - - $this->data = $postReturn; - if ($postReturn['status'] == '200') { - $valid = TRUE; - } // END - if - return $valid; - } - - /** - * �berpr�ft den Status eines Primus-Users - * - existiert der User - * - ist er aktiv - * @param string/int $User Userid / Username - */ - public function checkPrimusUser ($userName) { - $valid = FALSE; - $postData = array( - 'PrimusInterface_Action' => 'CheckPrimusUser', - 'PrimusInterface_CheckPrimusUser' => $userName - ); - - $postReturn = $this->parseContent( $this->queryApi($postData) ); - - $this->data = $postReturn; - - if ($postReturn['status'] == self::PI_USER_CHECK_OK) { - $valid = TRUE; - } // END - if - return $valid; - } - - /** - * Die Funktion liefer den aktuellen Primerastand - */ - public function getPrimera() { - $primera = FALSE; - $postData = array( - 'PrimusInterface_Action' => 'GetPrimera' - ); - $postReturn = $this->parseContent( $this->queryApi($postData) ); - - $this->data = $postReturn; - - if ($postReturn['status'] == self::PI_GET_PRIMERA_DONE) { - $primera = $postReturn['primera']; - } // END - if - - return $primera; - } - -} diff --git a/framework/main/third_party/api/wernisportal/class_WernisApi.php b/framework/main/third_party/api/wernisportal/class_WernisApi.php index c64fba3e..cc81fe73 100644 --- a/framework/main/third_party/api/wernisportal/class_WernisApi.php +++ b/framework/main/third_party/api/wernisportal/class_WernisApi.php @@ -32,7 +32,7 @@ class WernisApi extends BaseFrameworkSystem { /** * Static base API URL */ - private static $apiUrl = 'http://www.wds66.com/api/'; + private static $apiUrl = 'https://www.wds66.com/api/'; /** * API Wernis amount @@ -216,7 +216,7 @@ class WernisApi extends BaseFrameworkSystem { $response = $this->sendRawRequest($requestString); // Check the response header if all is fine - if (strpos($response[0], '200') === FALSE) { + if (strpos($response[0], '200') === false) { // Something bad happend... :( return array( 'status' => 'request_error', @@ -309,7 +309,7 @@ class WernisApi extends BaseFrameworkSystem { // Widthdraw this amount private function executeWithdraw ($amount) { // First all fails... - $result = FALSE; + $result = false; // Prepare the purpose $purpose = "\"Bube oder Dame\"-Einsatz gesetzt."; @@ -329,7 +329,7 @@ class WernisApi extends BaseFrameworkSystem { if ($return['status'] == $this->statusOkay) { // All fine! - $result = TRUE; + $result = true; } else { // Status failture text $this->setStatusMessage($return['message'], $return['status']); @@ -342,7 +342,7 @@ class WernisApi extends BaseFrameworkSystem { // Payout this amount private function executePayout ($amount) { // First all fails... - $result = FALSE; + $result = false; // Prepare the purpose $purpose = "\"Bube oder Dame\"-Gewinn erhalten."; @@ -362,7 +362,7 @@ class WernisApi extends BaseFrameworkSystem { if ($return['status'] == $this->statusOkay) { // All fine! - $result = TRUE; + $result = true; } else { // Status failture text $this->setStatusMessage($return['message'], $return['status']); diff --git a/framework/selector.php b/framework/selector.php index 7f88c168..7d6dceec 100644 --- a/framework/selector.php +++ b/framework/selector.php @@ -1,83 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * @deprecated - * @todo Minimize these includes - * - * 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 . - */ - -// Try to load these includes in the given order -$configAppIncludes = array( - 'class_ApplicationHelper', // The ApplicationHelper class - 'debug', // Some debugging stuff - 'exceptions', // The application's own exception handler - 'config', // The application's own configuration - 'config-local', // Local configuration file (optional) - 'data', // Application data - 'init', // The application initializer - 'starter', // The application starter (calls entryPoint(), etc.) -); - -// Cache base path/file here -$basePathFile = FrameworkConfiguration::getSelfInstance()->getConfigEntry('application_base_path') . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name'); - -// Is the directory there? -if (!is_dir($basePathFile)) { - // Not found. - trigger_error('Application ' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name') . ' not found.'); - exit; -} // END - if - -// Load them all (try only) -foreach ($configAppIncludes as $appInc) { - // Skip starter in test mode - if (($appInc == 'starter') && (defined('TEST'))) { - // Skip it here - continue; - } // END - if - - // Generate a FQFN for the helper class - $appFqFn = $basePathFile . '/' . $appInc . '.php'; - - // Does the include file exists? - if (BaseFrameworkSystem::isReadableFile($appFqFn)) { - // Load it - //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - START\n"; - require $appFqFn; - //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - END\n"; - } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('verbose_level') > 0) { - // File is missing - trigger_error(sprintf('Cannot load application script %s.php! File is missing or read-protected.', - $appInc - )); - exit; - } -} - -// Remove variables from namespace, which we don't need -unset($appInc); -unset($configAppIncludes); -unset($appFqFn); -unset($basePathFile); +// @DEPRECATED diff --git a/index.php b/index.php index 3cca6d52..f0f02f6d 100644 --- a/index.php +++ b/index.php @@ -57,7 +57,7 @@ final class ApplicationEntryPoint { * @return void * @todo This method is old code and needs heavy rewrite and should be moved to ApplicationHelper */ - public static final function app_exit ($message = '', $code = FALSE, $extraData = '', $silentMode = FALSE) { + public static final function app_exit ($message = '', $code = false, $extraData = '', $silentMode = false) { // Is this method already called? if (isset($GLOBALS['app_die_called'])) { // Then output the text directly @@ -65,7 +65,7 @@ final class ApplicationEntryPoint { } // END - if // This method shall not be called twice - $GLOBALS['app_die_called'] = TRUE; + $GLOBALS['app_die_called'] = true; // Is a message set? if (empty($message)) { @@ -77,7 +77,7 @@ final class ApplicationEntryPoint { $configInstance = FrameworkConfiguration::getSelfInstance(); // Do we have debug installation? - if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === TRUE)) { + if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) { // Abort here exit(); } // END - if @@ -199,15 +199,15 @@ final class ApplicationEntryPoint { // Debug message //* NOISY-DEBUG: */ printf('[%s:%d]: realPath[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($realPath), $realPath); - // Is it FALSE? - if ($realPath === FALSE) { + // Is it false? + if ($realPath === false) { // Then, not found. continue; } // END - if - // First create full-qualified file name (FQFN) to framework/config.inc.php + // First create full-qualified file name (FQFN) to framework/config-global.php $fqfn = sprintf( - '%s%sframework%sconfig.inc.php', + '%s%sframework%sconfig-global.php', $realPath, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, @@ -258,21 +258,30 @@ final class ApplicationEntryPoint { */ public static final function main () { // Load bootstrap file - require self::detectFrameworkPath() . 'bootstrap/bootstrap.inc.php'; + require sprintf('%sbootstrap%sbootstrap.inc.php', self::detectFrameworkPath(), DIRECTORY_SEPARATOR); /* - * Initial bootstrap is done, continue with parsing parameters and - * look for 'app'. + * Initial bootstrap is done, continue with initialization of + * framework. */ - FrameworkBootstrap::parseParameters(); + FrameworkBootstrap::initFramework(); + + // Next initialize the detected application + FrameworkBootstrap::prepareApplication(); + + /* + * Last step is to start the application, this will also initialize and + * register the application instance in registry. + */ + FrameworkBootstrap::startApplication(); } } // Developer mode active? Comment out if no dev! -define('DEVELOPER', TRUE); +define('DEVELOPER', true); // Log all exceptions (only debug! This option can create large error logs) -//define('LOG_EXCEPTIONS', TRUE); +//define('LOG_EXCEPTIONS', true); //xdebug_start_trace();