<?php
-// Own namespace
+// Must be this namespace, else the launcher cannot find the class.
namespace CoreFramework\Helper\Application;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
+use CoreFramework\Configuration\FrameworkConfiguration;
+use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Loader\ClassLoader;
use CoreFramework\Manager\ManageableApplication;
use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Registry\Registerable;
use CoreFramework\Registry\Registry;
use CoreFramework\Template\CompileableTemplate;
}
/**
- * Launches the test suite
+ * 1) Setups application data
+ *
+ * @return void
+ */
+ public function setupApplicationData () {
+ // Set all application data
+ $this->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');
self::convertToClassName(sprintf(
'%s_%s_controller_resolver',
$this->getAppShortName(),
- $responseType
+ FrameworkBootstrap::getRequestTypeFromSystem()
))
);
$resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
* @return $masterTemplateName Name of the master template
*/
public function buildMasterTemplateName () {
- return 'node_main';
+ return 'tests_main';
}
/**
<?php
-/**
- * Application data
- *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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
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
}
// 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),
} // END - function
// Assertion handler
-function __assertHandler ($file, $line, $code) {
+function test_assert_handler ($file, $line, $code) {
// Empty code?
if ($code === '') {
$code = '<em>Unknown</em>';
} // 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');
<?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Helper\Application\ApplicationHelper;
-use CoreFramework\Loader\ClassLoader;
-
-/**
- * Application initializer
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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
+++ /dev/null
-<?php
-$rands = array();
-$max_iter = 500000;
-$max_rand = 200000;
-
-print 'max_iter=' . $max_iter . ',max_rand=' . $max_rand . PHP_EOL;
-
-for ($idx = 0; $idx < $max_iter; $idx++) {
- $number = mt_rand(0, $max_rand);
- if (isset($rands['mt_rand'][$number])) {
- $rands['mt_rand'][$number]++;
- } else {
- $rands['mt_rand'][$number] = 1;
- }
-
- $number = rand(0, $max_rand);
- if (isset($rands['rand'][$number])) {
- $rands['rand'][$number]++;
- } else {
- $rands['rand'][$number] = 1;
- }
-}
-
-print 'mt_rand=' . count($rands['mt_rand']) . PHP_EOL;
-print 'rand=' . count($rands['rand']) . PHP_EOL;
<?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-
-/**
- * The application launcher
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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 <span class=\"app_name\">%s</span> could not be launched because the helper class <span class=\"class_name\">%s</span> is not loaded.",
- $application,
- 'CoreFramework\Helper\Application\ApplicationHelper'
- ));
-} elseif (!is_object($app)) {
- // No object!
- ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> 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 <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
- $application,
- FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')
- ));
-}
-
-// Call user function
-call_user_func_array(array($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')), array());
+// @DEPRECATED
// 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;
<?php
error_reporting(E_ALL | E_STRICT);
-define('START_TIME' , microtime(TRUE));
+define('START_TIME' , microtime(true));
define('CHECK_POINT' , 'chash.pos');
// Hashes needed to complete a "block"
print ('FLUSHING: Writing ' . count($GLOBALS['found_hashes']) . ' blocks ...' . PHP_EOL);
// Start timer
- $timer = microtime(TRUE);
+ $timer = microtime(true);
// Flush data
file_put_contents(
);
// Set time
- $GLOBALS['time_flush'] = microtime(TRUE);
+ $GLOBALS['time_flush'] = microtime(true);
print ('FLUSHING: Took ' . ($GLOBALS['time_flush'] - $timer) . ' seconds.' . PHP_EOL);
}
print ('FOUND: hash=' . $hash . ',nonce=' . $GLOBALS['nonce'] . ',total_found=' . $GLOBALS['total_found'] . PHP_EOL);
// Set time as a new hash was found
- $GLOBALS['found_time'] = microtime(TRUE);
+ $GLOBALS['found_time'] = microtime(true);
// Flush check-point file after new hash is found
flushCheckPointFile($hash);
$GLOBALS['root_hash'] = $GLOBALS['modula_hash'];
// Output results
-print ('hashes=' . print_r($gensisHashes, TRUE));
-print ('modulaHashes=' . print_r($modulaHashes, TRUE));
-print ('sqrtHashes=' . print_r($sqrtHashes, TRUE));
+print ('hashes=' . print_r($gensisHashes, true));
+print ('modulaHashes=' . print_r($modulaHashes, true));
+print ('sqrtHashes=' . print_r($sqrtHashes, true));
print ('modulaHash=' . $GLOBALS['modula_hash'] . PHP_EOL);
// Total reward + hashes
$GLOBALS['total_hashes'] = 0;
$GLOBALS['total_found'] = 0;
$GLOBALS['total_blocks'] = 0;
-$GLOBALS['found_time'] = microtime(TRUE);
+$GLOBALS['found_time'] = microtime(true);
// Is the check point there?
if (is_readable(CHECK_POINT)) {
print ('found=' . count($GLOBALS['found_hashes'][$GLOBALS['total_blocks']]) . PHP_EOL);
// Start "mining"
-while (TRUE) {
+while (true) {
// Init hash-per-block counter and hashrate
$GLOBALS['hashes_block'] = 0;
$hashrate = 0;
// Wait for block_size iterations (= found hashes). This is one block
- $timeBlock = microtime(TRUE);
+ $timeBlock = microtime(true);
$timeDisplay = $timeBlock;
$GLOBALS['time_flush'] = $timeBlock;
$GLOBALS['iteration_second'] = 0;
// Now start the "mining" ...
- $timeHash = microtime(TRUE);
+ $timeHash = microtime(true);
while ($sumNonce < $GLOBALS['sum_modula']) {
// Calculate new nonce
calculateNonce();
$sumNonce = calculateSumFromHash($nonceHash);
// Time spend in loop
- $testTime = abs(microtime(TRUE) - $timeDisplay);
+ $testTime = abs(microtime(true) - $timeDisplay);
// Calculate hashrate/sec
$hashrate = 1 / $testTime * $GLOBALS['iteration_second'] * $GLOBALS['hash_cycles'];
print ('hashrate=' . round($hashrate) . ' hashes/sec,iterSecond=' . $GLOBALS['iteration_second'] . ' iterations/sec' . PHP_EOL);
// Reset timer
- $timeDisplay = microtime(TRUE);
+ $timeDisplay = microtime(true);
$GLOBALS['iteration_second'] = 0;
} // END - if
// Time spend from last flush
- $testTime = abs(microtime(TRUE) - $GLOBALS['time_flush']);
+ $testTime = abs(microtime(true) - $GLOBALS['time_flush']);
// Only once per 10 seconds
if ($testTime >= $GLOBALS['flush_file_time']) {
} // 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']) {
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']])) {
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();
// 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);
} // 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;
$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
--- /dev/null
+<?php
+$rands = array();
+$max_iter = 500000;
+$max_rand = 200000;
+
+print 'max_iter=' . $max_iter . ',max_rand=' . $max_rand . PHP_EOL;
+
+for ($idx = 0; $idx < $max_iter; $idx++) {
+ $number = mt_rand(0, $max_rand);
+ if (isset($rands['mt_rand'][$number])) {
+ $rands['mt_rand'][$number]++;
+ } else {
+ $rands['mt_rand'][$number] = 1;
+ }
+
+ $number = rand(0, $max_rand);
+ if (isset($rands['rand'][$number])) {
+ $rands['rand'][$number]++;
+ } else {
+ $rands['rand'][$number] = 1;
+ }
+}
+
+print 'mt_rand=' . count($rands['mt_rand']) . PHP_EOL;
+print 'rand=' . count($rands['rand']) . PHP_EOL;
### WARNING: THIS FILE IS AUTO-GENERATED BY ./contrib/todo-builder.sh ###
### DO NOT EDIT THIS FILE. ###
-./application/tests/class_ApplicationHelper.php:237: * @todo Nothing to add?
-./inc/config/class_FrameworkConfiguration.php:116: * @todo This method encapsulates a deprecated PHP function and should be deprecated, too.
-./inc/config/class_FrameworkConfiguration.php:227: * @todo We have to add some more entries from $_SERVER here
-./inc/database.php:11: * @todo Minimize these includes
-./inc/database.php:51:// @TODO Rewrite this
-./inc/includes.php:11: * @todo Minimize these includes
-./inc/includes.php:37:// @TODO This makes the core depending on the SPL. But it should be installed anyway.
-./inc/includes.php:41:// @TODO Find a nicer OOP-ed way for this
-./inc/loader/class_ClassLoader.php:319: /* @TODO: Do not exit here. */
-./inc/main/classes/class_BaseFrameworkSystem.php:2133: // @TODO Move the constant to e.g. BaseDatabaseResult when there is a non-cached database result available
-./inc/main/classes/class_BaseFrameworkSystem.php:2248: * @todo Write a logging mechanism for productive mode
-./inc/main/classes/class_BaseFrameworkSystem.php:2263: // @TODO Finish this part!
-./inc/main/classes/class_BaseFrameworkSystem.php:308: // @todo Try to clean these constants up
-./inc/main/classes/class_BaseFrameworkSystem.php:3291: * @todo Improve documentation
-./inc/main/classes/class_BaseFrameworkSystem.php:3453: * @todo Move all this socket-related stuff into own class, most of it resides in BaseListener
-./inc/main/classes/class_BaseFrameworkSystem.php:550: // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class
-./inc/main/classes/class_BaseFrameworkSystem.php:654: * @todo SearchableResult and UpdateableResult shall have a super interface to use here
-./inc/main/classes/commands/console/class_ConsoleFuseCommand.php:72: // @TODO Unfinished
-./inc/main/classes/commands/html/class_HtmlLoginAreaCommand.php:64: * @todo Add some stuff here: Some personal data, app/game related data
-./inc/main/classes/commands/html/class_HtmlProblemCommand.php:58: * @todo 0% done
-./inc/main/classes/commands/html/class_HtmlStatusCommand.php:58: * @todo 0% done
-./inc/main/classes/console/class_ConsoleTools.php:268: * @todo This should be moved out to an external class, e.g. HttpClient
-./inc/main/classes/console/class_ConsoleTools.php:269: * @todo Make IP, host name, port and script name configurable
-./inc/main/classes/console/class_ConsoleTools.php:276: // @TODO Add some DNS caching here
-./inc/main/classes/console/class_ConsoleTools.php:45: * @todo We should connect this to a caching class to cache DNS requests
-./inc/main/classes/console/class_ConsoleTools.php:58: // @TODO Here should the cacher be implemented
-./inc/main/classes/controller/console/class_ConsoleDefaultController.php:10: * @todo This controller shall still provide some headlines for sidebars
-./inc/main/classes/controller/html/class_HtmlConfirmController.php:40: * @todo Add some filters to this controller
-./inc/main/classes/controller/html/class_HtmlDefaultController.php:10: * @todo This controller shall still provide some headlines for sidebars
-./inc/main/classes/controller/html/class_HtmlLoginController.php:41: * @todo Add some filters to this controller
-./inc/main/classes/controller/html/class_HtmlLogoutController.php:10: * @todo This controller shall still provide some headlines for sidebars
-./inc/main/classes/controller/html/class_HtmlLogoutDoneController.php:40: * @todo Add some filters to this controller
-./inc/main/classes/controller/html/class_HtmlProblemController.php:40: * @todo Add some filters to this controller
-./inc/main/classes/controller/html/class_HtmlRegisterController.php:40: * @todo Add some filters to this controller
-./inc/main/classes/controller/html/class_HtmlStatusController.php:10: * @todo This controller shall still provide some headlines for sidebars
-./inc/main/classes/controller/html/login/class_HtmlLoginAreaController.php:40: * @todo Add some morer filters to this controller
-./inc/main/classes/criteria/dataset/class_DataSetCriteria.php:150: // @TODO Issue a warning
-./inc/main/classes/criteria/search/class_SearchCriteria.php:102: * @todo Find a nice casting here. (int) allows until and including 32766.
-./inc/main/classes/criteria/search/class_SearchCriteria.php:70: * @todo Find a nice casting here. (int) allows until and including 32766.
-./inc/main/classes/database/backend/class_CachedLocalFileDatabase.php:327: * @todo Do some checks on the database directory and files here
-./inc/main/classes/database/backend/class_CachedLocalFileDatabase.php:616: * @todo Add more generic non-public data for removal
-./inc/main/classes/database/class_BaseDatabaseWrapper.php:204: // @TODO Minor: Update above comment to e.g. BaseDatabaseResult
-./inc/main/classes/database/frontend/class_NewsDatabaseWrapper.php:10: * @todo Add missing own interface for public methods
-./inc/main/classes/database/frontend/class_PaymentsDatabaseWrapper.php:10: * @todo Add missing own interface for public methods
-./inc/main/classes/database/result/class_CachedDatabaseResult.php:244: * @todo 0% done
-./inc/main/classes/database/result/class_CachedDatabaseResult.php:398: * @todo Find a caching way without modifying the result array
-./inc/main/classes/decorator/template/class_XmlRewriterTemplateDecorator.php:407: * @todo Find something useful with this!
-./inc/main/classes/discovery/payment/class_LocalPaymentDiscovery.php:85: * @todo 0% done
-./inc/main/classes/factories/logger/class_LoggerFactory.php:46: // @TODO Unfinished work
-./inc/main/classes/factories/login/class_LoginFactory.php:39: * @return $loginInstance An instance of a login helper (@TODO Use actual interface name)
-./inc/main/classes/factories/user/class_UserFactory.php:39: * @return $userInstance An instance of a user class (@TODO use actual interface name)
-./inc/main/classes/feature/fuse/class_FuseFeature.php:52: * @todo 0% done
-./inc/main/classes/file_directories/binary/class_BaseBinaryFile.php:848: // @TODO Unfinished
-./inc/main/classes/file_directories/class_BaseAbstractFile.php:154: * @todo Handle seekStatus
-./inc/main/classes/file_directories/class_BaseFileIo.php:171: * @todo Handle seekStatus
-./inc/main/classes/file_directories/directory/class_FrameworkDirectoryPointer.php:68: * @todo Get rid of inConstructor, could be old-lost code.
-./inc/main/classes/file_directories/io_stream/class_FileIoStream.php:264: * @todo 0% done
-./inc/main/classes/file_directories/io_stream/class_FileIoStream.php:74: * @todo This method needs heavy rewrite
-./inc/main/classes/filter/change/class_EmailChangeFilter.php:55: * @todo Implement email change of the user here. HINT: Use the User class!
-./inc/main/classes/filter/change/class_PasswordChangeFilter.php:55: * @todo Finished updating user password hash here. HINT: Use the User class again.
-./inc/main/classes/filter/news/class_NewsProcessFilter.php:55: * @todo Unfinished stub, add functionality here
-./inc/main/classes/filter/payment/class_PaymentDiscoveryFilter.php:97: * @todo 0% done
-./inc/main/classes/filter/update/class_UserUpdateFilter.php:55: * @todo Add more user updates here
-./inc/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php:57: * @todo Rewrite handling of different password fields
-./inc/main/classes/handler/class_BaseHandler.php:66: * @todo Rewrite this to use DHT
-./inc/main/classes/handler/raw_data/network/class_BaseRawDataHandler.php:149: * @todo This method will be moved to a better place
-./inc/main/classes/handler/tasks/class_TaskHandler.php:142: // @TODO Messurement can be added around this call
-./inc/main/classes/helper/class_BaseHelper.php:183: * @todo Rewrite this method using a helper class for filtering data
-./inc/main/classes/helper/class_BaseHelper.php:212: // @TODO Try to log it here
-./inc/main/classes/helper/class_BaseHelper.php:478: $this->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
*/
// 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();
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 ... ;-)
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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.
// 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
*
*/
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 <span class=\"app_name\">%s</span> could not be launched because the helper class <span class=\"class_name\">%s</span> is not loaded.",
+ $application,
+ 'CoreFramework\Helper\Application\ApplicationHelper'
+ ));
+ } elseif (!is_object($applicationInstance)) {
+ // No object!
+ ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> 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 <span class=\"app_name\">%s</span> 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;
}
}
--- /dev/null
+<?php
+// Import framework stuff
+use CoreFramework\Configuration\FrameworkConfiguration;
+use CoreFramework\Bootstrap\FrameworkBootstrap;
+use CoreFramework\EntryPoint\ApplicationEntryPoint;
+
+/**
+ * General configuration. Do not touch this file! If you need different settings
+ * create a config-local.php in this directory at and set your changed
+ * configuration entries there.
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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);
+++ /dev/null
-<?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Bootstrap\FrameworkBootstrap;
-use CoreFramework\EntryPoint\ApplicationEntryPoint;
-
-/**
- * General configuration. Do not touch this file! If you need different settings
- * create a config-local.php in this directory at and set your changed
- * configuration entries there.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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);
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;
* 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?
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();
/**
* 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;
}
/**
* @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);
}
* @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);
}
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
<?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Connection\Database\DatabaseConnection;
-use CoreFramework\EntryPoint\ApplicationEntryPoint;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Middleware\Debug\DebugMiddleware;
-
-/**
- * Initializes the database layer
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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
<?php
-// Import framework stuff
-use CoreFramework\Factory\ObjectFactory;
-
-/**
- * Initializes the local file database class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// For testing purposes we use a local file database
-$databaseInstance = ObjectFactory::createObjectByConfiguredName('local_file_database_class');
+// @DEPRECATED
<?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Loader\ClassLoader;
-
-/**
- * Loads more include files by using the generic class loader
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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
namespace CoreFramework\Loader;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Object\BaseFrameworkSystem;
// Import SPL stuff
use \InvalidArgumentException;
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
/**
* 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.
} // 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) {
// 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;
$pathName = realpath(sprintf(
'%s/%s/%s',
$cfg->getConfigEntry('application_base_path'),
- $cfg->getConfigEntry('app_name'),
+ $cfg->getConfigEntry('detected_app_name'),
$shortPath
));
// 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
* @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;
}
* @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__);
}
/**
* @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__);
}
/**
*/
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
*/
$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 {
} // 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
*
// 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
} // END - if
// IS the cache there?
- if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) {
+ if (FrameworkBootstrap::isReadableFile($this->listCacheFQFN)) {
// Get content
$cacheContent = file_get_contents($this->listCacheFQFN);
$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
}
$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
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);
// 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
}
}
- /**
- * 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
*
namespace CoreFramework\Auth;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Object\BaseFrameworkSystem;
use CoreFramework\Registry\Registerable;
use CoreFramework\Response\Responseable;
// Get a new instance
$loginInstance = new CookieAuth();
- // Set the response instance
- $loginInstance->setResponseInstance($responseInstance);
-
// Return the prepared instance
return $loginInstance;
}
* @return void
*/
public function setUserAuth ($userName) {
- $this->getResponseInstance()->addCookie('username', $userName);
+ FrameworkBootstrap::getResponseInstance()->addCookie('username', $userName);
}
/**
* @return void
*/
public function setPasswordAuth ($passHash) {
- $this->getResponseInstance()->addCookie('u_hash', $passHash);
+ FrameworkBootstrap::getResponseInstance()->addCookie('u_hash', $passHash);
}
/**
*/
public function getUserAuth () {
// Get the username from cookie
- $userName = $this->getRequestInstance()->readCookie('username');
+ $userName = FrameworkBootstrap::getRequestInstance()->readCookie('username');
// Return the username
return $userName;
*/
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;
*/
public function destroyAuthData () {
// Expire both cookies
- $this->getResponseInstance()->expireCookie('username');
- $this->getResponseInstance()->expireCookie('u_hash');
+ FrameworkBootstrap::getResponseInstance()->expireCookie('username');
+ FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash');
}
/**
* @return void
*/
public function updateAuthData () {
- $this->getResponseInstance()->refreshCookie('username');
- $this->getResponseInstance()->refreshCookie('u_hash');
+ FrameworkBootstrap::getResponseInstance()->refreshCookie('username');
+ FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash');
}
}
$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);
$exists = (count($array[$arrayElement]) >= $minimumCount);
} else {
// Not found
- $exists = FALSE;
+ $exists = false;
}
} // END - if
namespace CoreFramework\Object;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Compressor\Compressor;
use CoreFramework\Configuration\FrameworkConfiguration;
use CoreFramework\Connection\Database\DatabaseConnection;
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;
*/
private $realClass = 'BaseFrameworkSystem';
- /**
- * Instance of a Requestable class
- */
- private $requestInstance = NULL;
-
- /**
- * Instance of a Responseable class
- */
- private $responseInstance = NULL;
-
/**
* Search criteria instance
*/
/**
* Socket resource
*/
- private $socketResource = FALSE;
+ private $socketResource = false;
/**
* Regular expression to use for validation
*
* 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.... *
$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
// 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
$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)
));
}
* @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;
}
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
*
// 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)) {
$content .= sprintf('<pre>%s</pre>',
trim(
htmlentities(
- print_r($this, TRUE)
+ print_r($this, true)
)
)
);
* 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
print('</pre>');
// Exit program?
- if ($doExit === TRUE) {
+ if ($doExit === true) {
exit();
} // END - if
}
// 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));
*
* @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;
// 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 {
$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
// Get current array
$fieldArray = $resultInstance->current();
- //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.':<pre>'.print_r($fieldArray, TRUE).'</pre>');
+ //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput($fieldName.':<pre>'.print_r($fieldArray, true).'</pre>');
// Convert dashes to underscore
$fieldName2 = self::convertDashesToUnderscores($fieldName);
$fieldValue = $fieldArray[$fieldName2];
} elseif (defined('DEVELOPER')) {
// Missing field entry, may require debugging
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray<pre>=' . print_r($fieldArray, TRUE) . '</pre>,fieldName=' . $fieldName . ' not found!');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldArray<pre>=' . print_r($fieldArray, true) . '</pre>,fieldName=' . $fieldName . ' not found!');
} else {
// Missing field entry, may require debugging
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']:fieldName=' . $fieldName . ' not found!');
// Get current array
$fieldArray = $resultInstance->current();
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=<pre>'.print_r($fieldArray, TRUE).'</pre>');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . $this->__toString() . ':' . __LINE__ . '] fieldName=' . $fieldName . ',fieldArray=<pre>'.print_r($fieldArray, true).'</pre>');
// Convert dashes to underscore
$fieldName = self::convertDashesToUnderscores($fieldName);
*/
public function getMilliTime () {
// Get the time of day as float
- $milliTime = gettimeofday(TRUE);
+ $milliTime = gettimeofday(true);
// Return it
return $milliTime;
*/
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')) {
*/
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
*
*/
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);
* @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
* @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
} // 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];
*/
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)) {
*/
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)) {
*/
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;
* @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;
* @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;
* @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;
*/
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)) {
$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;
}
*/
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)) {
$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;
}
$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;
}
$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;
}
*/
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;
*/
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;
// 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));
}
/**
- * 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
assert(is_bool($boolean));
// "Translate" it
- $translated = ($boolean === TRUE) ? 'Y' : 'N';
+ $translated = ($boolean === true) ? 'Y' : 'N';
// ... and return it
return $translated;
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.
$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
} // 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]));
// @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);
// @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);
} // 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
// 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
* @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();
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Object\BaseFrameworkSystem;
+use CoreFramework\Registry\Registry;
use CoreFramework\Request\Requestable;
use CoreFramework\Response\Responseable;
assert(!$requestInstance->isPostRequestMethod());
// Get the application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+ $applicationInstance = Registry::getRegistry()->getInstance('app');
// Prepare a template instance
$templateInstance = $this->prepareTemplateInstance($applicationInstance);
*/
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);
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;
*/
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);
} // END - if
// Get the application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+ $applicationInstance = Registry::getRegistry()->getInstance('app');
// Prepare a template instance
$templateInstance = $this->prepareTemplateInstance($applicationInstance);
} // END - if
// Get application instance
- $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+ $applicationInstance = Registry::getRegistry()->getInstance('app');
// Get a resolver
$actionResolver = HtmlActionResolver::createHtmlActionResolver($this->actionName, $applicationInstance);
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;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class HtmlLoginCommand extends BaseCommand implements Commandable, Registerable {
+class HtmlLoginCommand extends BaseCommand implements Commandable {
/**
* Protected constructor
*
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);
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;
*/
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);
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;
// 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();
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;
*/
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);
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;
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;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class HtmlRegisterCommand extends BaseCommand implements Commandable, Registerable {
+class HtmlRegisterCommand extends BaseCommand implements Commandable {
/**
* Protected constructor
*
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);
$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');
*/
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);
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;
$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);
} // END - if
// Decompress it
- $streamData = bzdecompress($streamData, TRUE);
+ $streamData = bzdecompress($streamData, true);
// Return the decompressed stream
return $streamData;
<?php
// Own namespace
-namespace CoreFramework\Tools;
+namespace CoreFramework\Console\Tools;
// Import framework stuff
use CoreFramework\Configuration\FrameworkConfiguration;
parent::__construct(__CLASS__);
}
- /**
- * Tries to resolve an IP address from given hostname. Currently only IPv
- * addresses are resolved.
- *
- * @param $hostname Host name we shall resolve
- * @return $ip IP address resolved from host name
- * @todo We should connect this to a caching class to cache DNS requests
- */
- protected function resolveIpAddress ($hostname) {
- // Debug message
- self::createDebugInstance(__CLASS__, __LINE__)->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
*
} // 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);
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();
$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.',
}
// Set it in configuration
- FrameworkConfiguration::getSelfInstance()->setServerAddress($ip);
+ FrameworkConfiguration::getSelfInstance()->setServerAddress($ipAddress);
// Return it
- return $ip;
+ return $ipAddress;
}
/**
// @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);
} // 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
// 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
$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
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) {
$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));
*/
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);
*/
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);
//* 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);
//* 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);
*/
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);
}
/**
- * 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);
//* 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)) {
}
/**
- * 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
}
/**
- * 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
*/
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);
// 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);
// 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));
//* 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));
// 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');
//* 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));
// 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
$isMatching = (
(
(
- $isMatching === TRUE
+ $isMatching === true
) && (
- $searchExclude === FALSE
+ $searchExclude === false
)
) || (
(
(
- $isMatching === TRUE
+ $isMatching === true
) && (
- $searchExclude !== FALSE
+ $searchExclude !== false
) && (
$searchExclude !== $value
)
$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
* @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;
// Hash the password with salt
//* DEBUG: */ echo "salt=".$salt."/plain=".$str."<br />\n";
- if ($withFixed === TRUE) {
+ if ($withFixed === true) {
// Use additional fixed salt
$hashed = $salt . md5(sprintf($this->getConfigInstance()->getConfigEntry('hash_extra_mask'),
$salt,
/**
* Whether the "connection is already up
*/
- private $alreadyConnected = FALSE;
+ private $alreadyConnected = false;
/**
* Table information array
$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;
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));
$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);
// 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) {
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
$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
// 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) {
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
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;
}
*/
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
$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
$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
$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);
// 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
*/
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
*/
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);
// 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
*/
public function find ($key) {
// By default nothing is found
- $found = FALSE;
+ $found = false;
// Rewind the pointer
$this->rewind();
// Is the element there?
if (isset($currentEntry[$key])) {
// Okay, found!
- $found = TRUE;
+ $found = true;
// So "cache" it
$this->foundValue = $currentEntry[$key];
* @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);
}
* @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);
}
* @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);
}
* @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);
}
* @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;
$templateInstance = ObjectFactory::createObjectByConfiguredName($configEntry);
// Disable language support
- $templateInstance->enableLanguageSupport(FALSE);
+ $templateInstance->enableLanguageSupport(false);
/*
* Enable compacting/rewriting of the XML to save bandwidth from XML
*/
public function isFeatureAvailable () {
// Default is not available
- $isAvailable = FALSE;
+ $isAvailable = false;
// Unfinished:
$this->partialStub('Please implement this method.');
* 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
* )
*/
// 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)
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));
*/
public function isFeatureAvailable () {
// Default is not available
- $isAvailable = FALSE;
+ $isAvailable = false;
// Unfinished:
$this->partialStub('Please implement this method.');
/* 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
*/
*/
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;
* @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
$this->updateSeekPosition();
// Flush the header?
- if ($flushHeader === TRUE) {
+ if ($flushHeader === true) {
// Flush header
$this->flushFileHeader();
//* 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()) {
$this->readFileHeader();
// The above method does already check the header
- $isInitialized = TRUE;
+ $isInitialized = true;
} // END - if
// Return result
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));
$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
/**
* 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
*/
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);
}
* 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
* @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
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;
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
/**
* 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
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;
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
/**
* 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
namespace CoreFramework\Filesystem\Pointer;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\FileSystem\BaseFileIo;
use CoreFramework\Generic\NullPointerException;
use CoreFramework\Object\BaseFrameworkSystem;
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))) {
// 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
* 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
*
* @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
/**
* 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
// 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
* 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
*
* @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) {
/**
* 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
// 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
* 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
*
* @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) {
/**
* 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
$lineArray = array();
// Whether the parser reads a quoted string (which may contain the column separator again)
- $isInQuotes = FALSE;
+ $isInQuotes = false;
// Init column data
$column = '';
//* 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));
//* 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);
// 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();
$authInstance->destroyAuthData();
// Mark the request as invalid
- $requestInstance->requestIsValid(FALSE);
+ $requestInstance->requestIsValid(false);
// Add fatal message
$responseInstance->addFatalMessage('auth_data_incomplete');
// 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');
// 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');
// Do both match?
if ($email1 != $email2) {
// Request is invalid!
- $requestInstance->requestIsValid(FALSE);
+ $requestInstance->requestIsValid(false);
// Emails are mismatching
$responseInstance->addFatalMessage('emails_mismatch');
// 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
// Are they different?
if ($userEmail == $email1) {
// Nothing has been changed is fine...
- return TRUE;
+ return true;
} // END - if
// Update the "new_email" field
// 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');
// 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');
// 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');
// 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');
// 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);
// 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);
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');
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');
// 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');
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)) {
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');
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');
} // END - elseif
} elseif (empty($email)) {
// Empty field!
- $requestInstance->requestIsValid(FALSE);
+ $requestInstance->requestIsValid(false);
// Add a message to the response
$responseInstance->addFatalMessage('email_empty');
*/
private function ifEmailIsTaken ($email) {
// Default is already taken
- $alreadyTaken = TRUE;
+ $alreadyTaken = true;
// Initialize instance
$userInstance = NULL;
}
// 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
// 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');
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)) {
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');
// 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');
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');
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');
*/
private function ifUserNameIsTaken ($userName) {
// Default is already taken
- $alreadyTaken = TRUE;
+ $alreadyTaken = true;
// Initialize instance
$userInstance = NULL;
}
// 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
// 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');
if (empty($password)) {
// Password is empty
- $requestInstance->requestIsValid(FALSE);
+ $requestInstance->requestIsValid(false);
// Add a message to the response
$responseInstance->addFatalMessage('password_empty');
// 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');
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');
// 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');
// 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');
// 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');
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');
// 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');
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');
// 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');
// 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');
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');
// 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');
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');
// 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');
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');
*/
private function ifUserGuestIsTaken ($userName) {
// Default is already taken
- $alreadyTaken = TRUE;
+ $alreadyTaken = true;
// Initialize instance
$userInstance = NULL;
}
// 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
// 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');
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');
*/
private function ifUserNameIsTaken ($userName) {
// Default is already taken
- $alreadyTaken = TRUE;
+ $alreadyTaken = true;
// Initialize instance
$userInstance = NULL;
}
// 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
// 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');
$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');
// 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');
*/
private function executeCurrentTask () {
// Update no task by default
- $updateTask = FALSE;
+ $updateTask = false;
// Is the current task valid?
if (!$this->getListInstance()->getIterator()->valid()) {
$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;
} // 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');
// 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
// 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
// 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(
'<!-- group %s opened (length: %s, tag: %s) //-->%s' . PHP_EOL,
$groupId,
} // 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
$this->groups[$groupId]['tag'],
$content
);
- $this->groups[$groupId]['opened'] = FALSE;
+ $this->groups[$groupId]['opened'] = false;
// Mark previous group as closed
$this->setPreviousGroupId('');
// 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("<!-- sub-group %s opened (length: %s, tag: %s) //-->%s\n", $subGroupId, strlen($content), $tag, $content);
$this->subGroups[$subGroupId]['tag'] = $tag;
*/
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
// Add content to it and mark it as closed
$this->subGroups[$subGroupId]['content'] .= sprintf('<!-- sub-group %s closed (length: %s, tag: %s) //-->%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
// 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=<pre>".htmlentities($groupContent)."</pre><br />\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=<pre>".htmlentities($subGroupContent)."</pre><br />\n";
*/
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;
*/
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
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;
* @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();
$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
// 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
/**
* 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
$formContent = '</form>';
// 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("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\"",
$formName,
$formContent .= '>';
// Open the form and remeber the form name
- $this->formOpened = TRUE;
+ $this->formOpened = true;
// Add it to the content
$this->addHeaderContent($formContent);
} // END - if
// Simply close it
- $this->formOpened = FALSE;
+ $this->formOpened = false;
// Add it to the content
$this->addFooterContent($formContent);
*/
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
*/
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
*/
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
* @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("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
*/
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
*/
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
*/
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)) {
}
// 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 = " </div>\n</div><!-- Group - CLOSE //-->";
// Is this group opened?
- if ($this->ifGroupOpenedPreviously() === FALSE) {
+ if ($this->ifGroupOpenedPreviously() === false) {
// Begin the div/span blocks
$content = sprintf("<!-- Group %s - OPEN //-->
<div class=\"group_box\" id=\"%s_group_box\">
*/
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)) {
}
// 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 = " </div>\n</div><!-- Sub group- CLOSE //-->";
// Is this group opened?
- if ($this->ifSubGroupOpenedPreviously() === FALSE) {
+ if ($this->ifSubGroupOpenedPreviously() === false) {
// Begin the span block
$content = sprintf("<!-- Sub group %s - OPEN //-->
<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
*/
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
*/
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
*/
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
*/
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
*/
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
* @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;
}
* @todo Implement check if rules have been changed
*/
public function ifRulesHaveChanged () {
- return FALSE;
+ return false;
}
/**
*/
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();
namespace CoreFramework\Helper;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Configuration\FrameworkConfiguration;
use CoreFramework\Generic\NullPointerException;
use CoreFramework\Registry\Registry;
$applicationInstance = Registry::getRegistry()->getInstance('application');
// Get the request instance
- $requestInstance = $applicationInstance->getRequestInstance();
+ $requestInstance = FrameworkBootstrap::getRequestInstance();
// Sanity-check on it
if (is_null($requestInstance)) {
*/
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
*/
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
// 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());
namespace CoreFramework\Image;
// Import framework stuff
-use CoreFramework\Object\BaseFrameworkSystem;
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Template\CompileableTemplate;
/**
$cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
// Does it exist?
- if (BaseFrameworkSystem::isReadableFile($cacheFile)) {
+ if (FrameworkBootstrap::isReadableFile($cacheFile)) {
// Remove it
@unlink($cacheFile);
} // END - if
$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__));
);
// 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__));
}
* @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);
}
* @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);
}
/**
* 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
*/
* @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);
}
/**
* Whether we are in blocking or non-blocking mode (default: non-blocking
*/
- private $blockingMode = FALSE;
+ private $blockingMode = false;
/**
* A peer pool instance
$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);
// 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)) {
// 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
namespace CoreFramework\Listener\Socket;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Listener\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.');
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
$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);
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;
/**
$templateInstance->renderXmlContent();
// Get responce instance
- $responseInstance = $this->getApplicationInstance()->getResponseInstance();
+ $responseInstance = FrameworkBootstrap::getResponseInstance();
// Transfer the data to the response
$templateInstance->transferToResponse($responseInstance);
$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();
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;
/**
$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
* @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));
}
* @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;
}
/**
* Class name for this output class is being used for logging
*/
- private $loggerClassName = FALSE;
+ private $loggerClassName = false;
/**
* Protected constructor
namespace CoreFramework\Debug\Output;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Debug\Debugger;
use CoreFramework\Output\Debug\BaseDebugOutput;
use CoreFramework\Registry\Registerable;
* @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
* @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
}
* @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);
* @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
}
/**
* @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 <br />
$output = str_replace('<br />', '', $output);
print(stripslashes($output)."<br />\n");
* @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
}
namespace CoreFramework\Output;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Manager\ManageableApplication;
use CoreFramework\Output\BaseOutput;
use CoreFramework\Registry\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
* @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));
}
$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');
*/
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');
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;
// Get a new instance
$readerInstance = new ConsoleNewsReader();
- // Set request instance
- $readerInstance->setRequestInstance($requestInstance);
-
// Return prepared instance
return $readerInstance;
}
*/
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');
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;
// Get a new instance
$readerInstance = new DefaultNewsReader();
- // Set request instance
- $readerInstance->setRequestInstance($requestInstance);
-
// Return prepared instance
return $readerInstance;
}
*/
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');
namespace CoreFramework\Registration;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Filter\Filterable;
use CoreFramework\Object\BaseFrameworkSystem;
*/
protected function executePreFilters () {
// Execute all pre filters
- $this->preRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
+ $this->preRegistrationFilter->processFilters(FrameworkBootstrap::getRequestInstance(), FrameworkBootstrap::getResponseInstance());
}
/**
*/
protected function executePostFilters () {
// Execute all post filters
- $this->postRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
+ $this->postRegistrationFilter->processFilters(FrameworkBootstrap::getRequestInstance(), FrameworkBootstrap::getResponseInstance());
}
}
} // 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;
/**
* 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;
}
/**
* @return void
* @todo Needs to be implemented
*/
- public function prepareRequestData () {
+ protected function prepareRequestData () {
$this->partialStub("Please implement this method.");
}
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class BaseRequest extends BaseFrameworkSystem {
+abstract class BaseRequest extends BaseFrameworkSystem {
/**
* Array for the request data
*/
/**
* 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
}
/**
- * 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;
}
*
* @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
// 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?
*
* @return void
*/
- public function prepareRequestData () {
+ protected function prepareRequestData () {
// Copy GET then POST data
$this->setRequestData(array_merge($_GET, $_POST));
}
*/
public function isActionValid ($namespace, $actionName) {
// By default nothing shall be valid
- $isValid = FALSE;
+ $isValid = false;
// Is a action set?
if (empty($namespace)) {
// Is this class already loaded?
if (class_exists($this->getClassName())) {
// This class does exist. :-)
- $isValid = TRUE;
+ $isValid = true;
} // END - if
// Set action name
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);
}
} // 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
} // 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
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);
}
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
} // 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
namespace CoreFramework\Resolver\Command;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Command\Commandable;
use CoreFramework\Command\InvalidCommandException;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Request\Requestable;
use CoreFramework\Resolver\BaseResolver;
+// Import SPL stuff
+use \UnexpectedValueException;
+
/**
* A generic command resolver class
*
*
* @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
// 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
// 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
// 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
*/
protected function isCommandValid ($namespace, $commandName) {
// By default nothing shall be valid
- $isValid = FALSE;
+ $isValid = false;
// Is namespace and command name set?
if (empty($namespace)) {
// Is this class already loaded?
if (class_exists($this->getClassName())) {
// This class does exist. :-)
- $isValid = TRUE;
+ $isValid = true;
} // END - if
// Set command name
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);
}
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);
}
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);
}
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);
}
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
*
$resolverConfigEntry,
array(
$controllerName,
- $this->getApplicationInstance()
+ Registry::getRegistry()->getInstance('app')
)
);
$controllerInstance = ObjectFactory::createObjectByName(
*/
protected function isControllerValid ($namespace, $controllerName) {
// By default nothing shall be valid
- $isValid = FALSE;
+ $isValid = false;
// Is namespace and controller name set?
if (empty($namespace)) {
$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);
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);
}
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);
}
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);
}
* @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));
}
/**
* @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()) {
$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);
namespace CoreFramework\Response;
// Import framework stuff
-use CoreFramework\Manager\ManageableApplication;
use CoreFramework\Response\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;
}
* @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."<br />\n";
$this->partialStub('Naturally unimplemented in console response.');
}
* @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.');
}
namespace CoreFramework\Response;
// Import framework stuff
-use CoreFramework\Manager\ManageableApplication;
+use CoreFramework\Registry\Registry;
use CoreFramework\Response\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;
}
* @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."<br />\n";
// Are headers already sent?
if (headers_sent()) {
} // 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
* @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
} // 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');
// 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]);
// 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
}
namespace CoreFramework\Response;
// Import framework stuff
-use CoreFramework\Manager\ManageableApplication;
+use CoreFramework\Registry\Registry;
use CoreFramework\Response\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;
}
* @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
} // 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
* @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
} // 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');
* already sent with an exception
* @return void
*/
- public function flushBuffer ($force = FALSE) {
+ public function flushBuffer ($force = false) {
// Finish the image
$this->getImageInstance()->finishImage();
// 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]);
// 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
}
$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';
namespace Scrypt;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Object\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) {
* @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
*
* @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
$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__));
);
// 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__));
}
} // 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));
*/
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;
* @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);
}
* @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);
}
* @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);
}
* @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);
}
namespace CoreFramework\Template\Engine;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Generic\EmptyVariableException;
use CoreFramework\Manager\ManageableApplication;
/**
* 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;
*
* @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)) {
$found = $this->getVariableIndex($variableName, $variableGroup);
// Is the variable found?
- if ($found !== FALSE) {
+ if ($found !== false) {
// Read it
$content = $this->getVariableValue($variableGroup, $found);
} // END - if
* @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
}
$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
$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
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)) {
//* 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);
$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();
$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);
$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);
$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);
*/
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);
// 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);
);
// 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 "<?"
$evalLeft = substr($eval, 0, strpos($eval, $this->codeBegin));
// Goes something wrong?
if ((!isset($result)) || (empty($result))) {
// Output eval command
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Failed eval() code: <pre>%s</pre>', $this->markupCode($eval, TRUE)), TRUE);
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Failed eval() code: <pre>%s</pre>', $this->markupCode($eval, true)), true);
// Output backtrace here
$this->debugBackTrace();
*/
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.
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)) {
* @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=<pre>' . htmlentities($rawCode) . '</pre>');
preg_match_all($this->regExpVarValue, $rawCode, $varMatches);
// Compile all variables
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:<pre>' . print_r($varMatches, TRUE) . '</pre>');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:<pre>' . print_r($varMatches, true) . '</pre>');
foreach ($varMatches[0] as $match) {
// Add variable tags around it
$varCode = '{?' . $match . '?}';
//* 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 {
* @param $languageSupport New language support setting
* @return void
*/
- public final function enableLanguageSupport ($languageSupport = TRUE) {
+ public final function enableLanguageSupport ($languageSupport = true) {
$this->languageSupport = (bool) $languageSupport;
}
* @param $xmlCompacting New XML compacting setting
* @return void
*/
- public final function enableXmlCompacting ($xmlCompacting = TRUE) {
+ public final function enableXmlCompacting ($xmlCompacting = true) {
$this->xmlCompacting = (bool) $xmlCompacting;
}
*/
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);
*/
public function ifUsernameExists () {
// By default the username does not exist
- $exists = FALSE;
+ $exists = false;
// Is a previous result there?
if (!$this->getResultInstance() instanceof SearchableResult) {
// Search for it
if ($this->getResultInstance()->next()) {
// Entry found
- $exists = TRUE;
+ $exists = true;
} // END - if
// Return the status
*/
public function ifEmailAddressExists () {
// By default the email does not exist
- $exists = FALSE;
+ $exists = false;
// Is a previous result there?
if (!$this->getResultInstance() instanceof SearchableResult) {
// Search for it
if ($this->getResultInstance()->next()) {
// Entry found
- $exists = TRUE;
+ $exists = true;
// Is the username set?
if ($this->getUserName() == '') {
*/
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)) {
$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);
}
$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);
}
// Are there arguments?
if ((isset($dbgInfo['args'])) && (is_array($dbgInfo['args'])) && (isset($dbgInfo['args'][0]))) {
- //* DEBUG: */ echo $dbgIndex.": <pre>".htmlentities(print_r($dbgInfo['args'], TRUE))."</pre>";
+ //* DEBUG: */ echo $dbgIndex.": <pre>".htmlentities(print_r($dbgInfo['args'], true))."</pre>";
$info = '';
foreach ($dbgInfo['args'] as $debug) {
// Add only non-array elements
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace CoreFramework\Dns;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
+/**
+ * This exception is thrown when a host name cannot be resolved to an IP address
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+ }
+
+}
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 <webmaster@shipsimu.org>
* @version 0.0.0
<?php
-// Own namespace
-namespace CoreFramework\Deprecated;
-
-/**
- * This exception is thrown when a command instance is invalid
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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
*/
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
* @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
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);
* @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
* @param $stripTags Whether HTML tags shall be stripped out
* @return void
*/
- function outputStream ($output, $stripTags = FALSE);
+ function outputStream ($output, $stripTags = false);
}
* @param $stripTags Whether HTML tags shall be stripped out
* @return void
*/
- function output ($outStream = FALSE, $stripTags = FALSE);
+ function output ($outStream = false, $stripTags = false);
}
* 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
*
* @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);
/**
* 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
*/
* @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
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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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);
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 ();
}
* @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
* @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
* "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
* @param $languageSupport New language support setting
* @return void
*/
- function enableLanguageSupport ($languageSupport = TRUE);
+ function enableLanguageSupport ($languageSupport = true);
/**
* Checks whether language support is enabled
* @param $xmlCompacting New XML compacting setting
* @return void
*/
- function enableXmlCompacting ($xmlCompacting = TRUE);
+ function enableXmlCompacting ($xmlCompacting = true);
/**
* Checks whether XML compacting is enabled
* @param $add Whether add this group
* @return void
*/
- function setVariableGroup ($groupName, $add = TRUE);
+ function setVariableGroup ($groupName, $add = true);
/**
* Getter for template type
$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)) {
$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);
$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
* @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
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);
}
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);
}
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Own namespace
-namespace PrimeraPortal\Api;
-
-// Import framework stuff
-use CoreFramework\Object\BaseFrameworkSystem;
-
-/**
- * PrimeraApi
- * -------------------------------------------
- * Mit dieser Klasse ist ein einfacher Primeratransfer von Ihrem Account
- * zu dem Account eines bei Primusportal.de registrierten Mitglieds m�glich.
- *
- * ----------------- Aenderungen durch Roland Haeder 09.08.2008 ---------------
- * Klasse umbenannt nach PrimeraApi, damit sie in das Framework besser passt.
- * Zudem sind alle oeffentlichen Attribute nun privat, der Konstruktor hat den
- * neuen "magischen" Namen __construct() und "normale" Konstanten sind nach
- * Klassenkonstanten umbenannt. Unsinnige else-Bloecke sind noch umgewandelt.
- * Methodennamen fangen nun immer mit einem kleinen Buchstaben an. Zudem sind
- * die Methoden Pay,Query und Parse umbenannt.
- * ----------------- Aenderungen durch Roland Haeder 09.08.2008 ---------------
- *
- * ----------------- Aenderungen durch Roland Haeder 19.04.2011 ---------------
- * Es ist nun bei allen Methoden- und Feldnamen der erste Buchstabe
- * kleingeschrieben, damit es besser in meine Namenskonvention passt. Noch mehr
- * doppelte Anfuehrungszeichen in einfache umgewandelt, damit die Klasse
- * performanter (wegen sonst doppeltes Parsen) wird.
- * ----------------- Aenderungen durch Roland Haeder 19.04.2011 ---------------
- *
- * ------------ Achtung! Bitte zuerst lesen, bevor Sie weiterlesen: -----------
- * Das meiste aus der unteren Anleitung sollte auf die hier verwendeten Namen
- * portiert sein. Falls Sie Fragen haben, bitte melden Sie sich bei Roland
- * Haeder. Funktionell wurde hier aber nichts geaendert.
- * ------------ Achtung! Bitte zuerst lesen, bevor Sie weiterlesen: -----------
- *
- * Die Einbindung des Interfaces geschieht folgenderma�en:
- * 1. Einbindung der Klasse in Ihr PHP-Auszahlungsskript:
- * CODE:
- * $primusUsername = 'username'; // Ihr Username bei Primusportal
- * $primusPassword = 'passwort'; // Ihr Passwort bei Primusportal
- *
- * $apiInstance = ObjectFactory::createObjectByName('PrimeraApi', array($primusUsername, $primusPassword));
- * 2. Durchf�hren einer Auszahlung:
- * CODE:
- * $Status = $apiInstance->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 <xxgarbagexx@web.de>
- * @author Roland Haeder <webmaster.shipsimu.org>
- * @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-start -->', $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;
- }
-
-}
/**
* Static base API URL
*/
- private static $apiUrl = 'http://www.wds66.com/api/';
+ private static $apiUrl = 'https://www.wds66.com/api/';
/**
* API Wernis amount
$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',
// Widthdraw this amount
private function executeWithdraw ($amount) {
// First all fails...
- $result = FALSE;
+ $result = false;
// Prepare the purpose
$purpose = "\"Bube oder Dame\"-Einsatz gesetzt.";
if ($return['status'] == $this->statusOkay) {
// All fine!
- $result = TRUE;
+ $result = true;
} else {
// Status failture text
$this->setStatusMessage($return['message'], $return['status']);
// Payout this amount
private function executePayout ($amount) {
// First all fails...
- $result = FALSE;
+ $result = false;
// Prepare the purpose
$purpose = "\"Bube oder Dame\"-Gewinn erhalten.";
if ($return['status'] == $this->statusOkay) {
// All fine!
- $result = TRUE;
+ $result = true;
} else {
// Status failture text
$this->setStatusMessage($return['message'], $return['status']);
<?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Object\BaseFrameworkSystem;
-
-/**
- * The application selector main include file
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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
* @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
} // 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)) {
$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
// 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,
*/
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();