From: Roland Häder Date: Sun, 15 Jun 2008 19:25:32 +0000 (+0000) Subject: Code sync from ship-simu code (all class config entries must end with _class!) X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=0e9b4c76519b80ed1369936f56a68cea65aff56d Code sync from ship-simu code (all class config entries must end with _class!) --- diff --git a/.gitattributes b/.gitattributes index 80ba33608c..1858800235 100644 --- a/.gitattributes +++ b/.gitattributes @@ -26,6 +26,9 @@ inc/.htaccess -text inc/classes.php -text inc/classes/.htaccess -text inc/classes/exceptions/.htaccess -text +inc/classes/exceptions/auth/.htaccess -text +inc/classes/exceptions/auth/class_UserAuthorizationException.php -text +inc/classes/exceptions/class_ -text inc/classes/exceptions/class_FrameworkException.php -text inc/classes/exceptions/compressor/.htaccess -text inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php -text @@ -48,11 +51,14 @@ inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException. inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text inc/classes/exceptions/database/wrapper/.htaccess -text inc/classes/exceptions/database/wrapper/class_WrapperUserNameNotFoundException.php -text +inc/classes/exceptions/filter/.htaccess -text +inc/classes/exceptions/filter/class_FilterChainException.php -text inc/classes/exceptions/helper/.htaccess -text inc/classes/exceptions/helper/class_FormClosedException.php -text inc/classes/exceptions/helper/class_FormGroupClosedException.php -text inc/classes/exceptions/helper/class_FormOpenedException.php -text inc/classes/exceptions/helper/class_InvalidFormNameException.php -text +inc/classes/exceptions/helper/class_UserInstanceMissingException.php -text inc/classes/exceptions/io/.htaccess -text inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text @@ -104,10 +110,13 @@ inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -te inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text inc/classes/exceptions/user/.htaccess -text inc/classes/exceptions/user/class_UserEmailMissingException.php -text +inc/classes/exceptions/user/class_UserPasswordMismatchException.php -text inc/classes/exceptions/user/class_UsernameMissingException.php -text inc/classes/interfaces/.htaccess -text inc/classes/interfaces/application/.htaccess -text inc/classes/interfaces/application/class_ManageableApplication.php -text +inc/classes/interfaces/auth/.htaccess -text +inc/classes/interfaces/auth/class_Authorizeable.php -text inc/classes/interfaces/cache/.htaccess -text inc/classes/interfaces/cache/class_Cacheable.php -text inc/classes/interfaces/class_ -text @@ -136,6 +145,8 @@ inc/classes/interfaces/extended/.htaccess -text inc/classes/interfaces/extended/class_LimitableObject.php -text inc/classes/interfaces/filter/.htaccess -text inc/classes/interfaces/filter/class_Filterable.php -text +inc/classes/interfaces/helper/.htaccess -text +inc/classes/interfaces/helper/class_HelpableLogin.php -text inc/classes/interfaces/io/.htaccess -text inc/classes/interfaces/io/class_Streamable.php -text inc/classes/interfaces/io/file/.htaccess -text @@ -147,6 +158,8 @@ inc/classes/interfaces/language/.htaccess -text inc/classes/interfaces/language/class_ManageableLanguage.php -text inc/classes/interfaces/login/.htaccess -text inc/classes/interfaces/login/class_LoginableUser.php -text +inc/classes/interfaces/reader/.htaccess -text +inc/classes/interfaces/reader/class_ReadableNews.php -text inc/classes/interfaces/registration/.htaccess -text inc/classes/interfaces/registration/class_UserRegister.php -text inc/classes/interfaces/registry/.htaccess -text @@ -159,6 +172,8 @@ inc/classes/interfaces/resolver/class_CommandResolver.php -text inc/classes/interfaces/resolver/class_ControllerResolver.php -text inc/classes/interfaces/response/.htaccess -text inc/classes/interfaces/response/class_Responseable.php -text +inc/classes/interfaces/result/.htaccess -text +inc/classes/interfaces/result/class_SearchableResult.php -text inc/classes/interfaces/template/.htaccess -text inc/classes/interfaces/template/class_CompileableTemplate.php -text inc/classes/interfaces/template/view/class_ViewHelper.php -text @@ -170,6 +185,8 @@ inc/classes/main/actions/class_ -text inc/classes/main/actions/class_BaseAction.php -text inc/classes/main/actions/post_registration/.htaccess -text inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php -text +inc/classes/main/auth/.htaccess -text +inc/classes/main/auth/class_CookieAuth.php -text inc/classes/main/cache/.htaccess -text inc/classes/main/cache/class_MemoryCache.php -text inc/classes/main/class_ -text @@ -181,6 +198,7 @@ inc/classes/main/commands/class_BaseCommand.php -text inc/classes/main/commands/web/.htaccess -text inc/classes/main/commands/web/class_WebDoFormCommand.php -text inc/classes/main/commands/web/class_WebHomeCommand.php -text +inc/classes/main/commands/web/class_WebLoginAreaCommand.php -text inc/classes/main/commands/web/class_WebRegisterCommand.php -text inc/classes/main/compressor/.htaccess -text inc/classes/main/compressor/class_Bzip2Compressor.php -text @@ -196,6 +214,8 @@ inc/classes/main/controller/default/class_WebDefaultController.php -text inc/classes/main/controller/default/class_WebDefaultNewsController.php -text inc/classes/main/controller/form/.htaccess -text inc/classes/main/controller/form/class_WebDoFormController.php -text +inc/classes/main/controller/login/.htaccess -text +inc/classes/main/controller/login/class_WebLoginAreaController.php -text inc/classes/main/criteria/.htaccess -text inc/classes/main/criteria/class_DataSetCriteria.php -text inc/classes/main/criteria/class_SearchCriteria.php -text @@ -225,12 +245,18 @@ inc/classes/main/factories/objects/class_ObjectFactory.php -text inc/classes/main/factories/web/.htaccess -text inc/classes/main/factories/web/class_WebNewsFactory.php -text inc/classes/main/filter/.htaccess -text +inc/classes/main/filter/auth/.htaccess -text +inc/classes/main/filter/auth/class_UserAuthFilter.php -text inc/classes/main/filter/checkboxes/.htaccess -text inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php -text inc/classes/main/filter/class_ -text inc/classes/main/filter/class_AbstractFilterDecorator.php -text +inc/classes/main/filter/class_BaseFilter.php -text inc/classes/main/filter/class_FilterChain.php -text inc/classes/main/filter/decorator/.htaccess -text +inc/classes/main/filter/news/.htaccess -text +inc/classes/main/filter/news/class_NewsDownloadFilter.php -text +inc/classes/main/filter/news/class_NewsProcessFilter.php -text inc/classes/main/filter/null/.htaccess -text inc/classes/main/filter/null/class_NullFilter.php -text inc/classes/main/filter/validator/.htaccess -text @@ -240,6 +266,8 @@ inc/classes/main/filter/validator/class_UserNameValidatorFilter.php -text inc/classes/main/helper/.htaccess -text inc/classes/main/helper/class_ -text inc/classes/main/helper/class_BaseHelper.php -text +inc/classes/main/helper/login/.htaccess -text +inc/classes/main/helper/login/class_BaseLoginHelper.php -text inc/classes/main/helper/web/.htaccess -text inc/classes/main/helper/web/class_WebFormHelper.php -text inc/classes/main/io/.htaccess -text @@ -252,6 +280,8 @@ inc/classes/main/language/class_LanguageSystem.php -text inc/classes/main/output/.htaccess -text inc/classes/main/output/class_ConsoleOutput.php -text inc/classes/main/output/class_WebOutput.php -text +inc/classes/main/reader/.htaccess -text +inc/classes/main/reader/class_DefaultNewsReader.php -text inc/classes/main/registration/.htaccess -text inc/classes/main/registration/class_BaseRegistration.php -text inc/classes/main/registry/.htaccess -text diff --git a/inc/classes/exceptions/auth/.htaccess b/inc/classes/exceptions/auth/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/exceptions/auth/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/auth/class_UserAuthorizationException.php b/inc/classes/exceptions/auth/class_UserAuthorizationException.php new file mode 100644 index 0000000000..5fedd40f32 --- /dev/null +++ b/inc/classes/exceptions/auth/class_UserAuthorizationException.php @@ -0,0 +1,46 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class UserAuthorizationException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $filterInstance An instance of the filter throwing this exception + * @param $code Error code + * @return void + */ + public function __construct(Filterable $filterInstance, $code) { + // Construct the message + $message = sprintf("[%s:%d] Authorization has failed. Error code %s", + $filterInstance->__toString(), + $this->getLine(), + $this->getHexCode($code) + ); + + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/class_ b/inc/classes/exceptions/class_ new file mode 100644 index 0000000000..3001d8420a --- /dev/null +++ b/inc/classes/exceptions/class_ @@ -0,0 +1,39 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ???Exception extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $message Error message + * @param $code Error code + * @return void + */ + public function __construct($message, $code) { + // Call parent exception constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/class_FrameworkException.php b/inc/classes/exceptions/class_FrameworkException.php index b7db9a34d6..2c40396603 100644 --- a/inc/classes/exceptions/class_FrameworkException.php +++ b/inc/classes/exceptions/class_FrameworkException.php @@ -8,7 +8,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -44,7 +44,7 @@ abstract class FrameworkException extends ReflectionException { $message = (string) $message; $code = (int) $code; - // make sure everything is assigned properly + // Make sure everything is assigned properly parent::__construct($message, $code); } @@ -78,11 +78,12 @@ abstract class FrameworkException extends ReflectionException { /** * Getter for hex-decimal code * + * @param $code Integer code to encode in hex * @return $hexCode The exception code in hex-decimal format */ - public final function getHexCode () { + public final function getHexCode ($code = null) { // Get the decimal code - $code = $this->getCode(); + if (is_null($code)) $code = $this->getCode(); // Format it to hex-decimal, 0x as prefix and 3 chars $hexCode = sprintf("0x%03s", dechex($code)); diff --git a/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php b/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php index 8e8d7d985b..97c95adc7d 100644 --- a/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php +++ b/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php b/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php index dca689ec85..0622052983 100644 --- a/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php +++ b/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/container/class_ContainerItemIsNullException.php b/inc/classes/exceptions/container/class_ContainerItemIsNullException.php index 9effef81b9..05334ed1d6 100644 --- a/inc/classes/exceptions/container/class_ContainerItemIsNullException.php +++ b/inc/classes/exceptions/container/class_ContainerItemIsNullException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php b/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php index 9217d80bb0..33232c08a9 100644 --- a/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php +++ b/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/controller/class_DefaultControllerException.php b/inc/classes/exceptions/controller/class_DefaultControllerException.php index 11189697fa..5a93a29cf0 100644 --- a/inc/classes/exceptions/controller/class_DefaultControllerException.php +++ b/inc/classes/exceptions/controller/class_DefaultControllerException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/class_DatabaseException.php b/inc/classes/exceptions/database/class_DatabaseException.php index 6b713d2e6c..3ff2e019ee 100644 --- a/inc/classes/exceptions/database/class_DatabaseException.php +++ b/inc/classes/exceptions/database/class_DatabaseException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/general/class_SqlException.php b/inc/classes/exceptions/database/general/class_SqlException.php index 542764aad8..5cd4385c61 100644 --- a/inc/classes/exceptions/database/general/class_SqlException.php +++ b/inc/classes/exceptions/database/general/class_SqlException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php b/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php index dc5ed66beb..d9de2eef94 100644 --- a/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php +++ b/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php b/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php index a8bcc6ed23..a3be62a189 100644 --- a/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php +++ b/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php b/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php index ee1da7f487..06ef4b4cd1 100644 --- a/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php +++ b/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php b/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php index eb5417fe96..a5c57f482a 100644 --- a/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php +++ b/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/database/wrapper/class_WrapperUserNameNotFoundException.php b/inc/classes/exceptions/database/wrapper/class_WrapperUserNameNotFoundException.php index 6b38482df1..c6014b123c 100644 --- a/inc/classes/exceptions/database/wrapper/class_WrapperUserNameNotFoundException.php +++ b/inc/classes/exceptions/database/wrapper/class_WrapperUserNameNotFoundException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/filter/.htaccess b/inc/classes/exceptions/filter/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/exceptions/filter/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/filter/class_FilterChainException.php b/inc/classes/exceptions/filter/class_FilterChainException.php new file mode 100644 index 0000000000..e1bfe10db7 --- /dev/null +++ b/inc/classes/exceptions/filter/class_FilterChainException.php @@ -0,0 +1,45 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class FilterChainException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $filterInstance Instance of a filter class + * @param $code Exception code for better debugging + * @return void + */ + public function __construct(Filterable $filterInstance, $code) { + // Construct the message + $message = sprintf("[%s:%d] Filter chain interruppted by fatal error in filter.", + $filterInstance->__toString(), + $this->getLine() + ); + + // Call the parent exception + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/helper/class_FormClosedException.php b/inc/classes/exceptions/helper/class_FormClosedException.php index b7acb6fcf1..dd012eb045 100644 --- a/inc/classes/exceptions/helper/class_FormClosedException.php +++ b/inc/classes/exceptions/helper/class_FormClosedException.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/helper/class_FormGroupClosedException.php b/inc/classes/exceptions/helper/class_FormGroupClosedException.php index ff951fee6a..8c56a5d2ec 100644 --- a/inc/classes/exceptions/helper/class_FormGroupClosedException.php +++ b/inc/classes/exceptions/helper/class_FormGroupClosedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/helper/class_FormOpenedException.php b/inc/classes/exceptions/helper/class_FormOpenedException.php index 6a95cd991e..c2aafbd207 100644 --- a/inc/classes/exceptions/helper/class_FormOpenedException.php +++ b/inc/classes/exceptions/helper/class_FormOpenedException.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/helper/class_InvalidFormNameException.php b/inc/classes/exceptions/helper/class_InvalidFormNameException.php index b45e7a1c9b..00c36a25f1 100644 --- a/inc/classes/exceptions/helper/class_InvalidFormNameException.php +++ b/inc/classes/exceptions/helper/class_InvalidFormNameException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/helper/class_UserInstanceMissingException.php b/inc/classes/exceptions/helper/class_UserInstanceMissingException.php new file mode 100644 index 0000000000..a109572099 --- /dev/null +++ b/inc/classes/exceptions/helper/class_UserInstanceMissingException.php @@ -0,0 +1,46 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class UserInstanceMissingException extends FrameworkException { + /** + * The constructor + * + * @param $classArray Array with class instance and registry key + * @param $code Code number for the exception + * @return void + */ + public function __construct (array $classArray, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Registry key %s does not include a class with implemented interface ManageableUser.", + $classArray[0]->__toString(), + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php b/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php index 9527dbc1ae..12b4d2668a 100644 --- a/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php +++ b/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php index 8fb500192b..760fca2f96 100644 --- a/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php +++ b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_InvalidDataLengthException.php b/inc/classes/exceptions/io/class_InvalidDataLengthException.php index c53f66a9e3..90d4ae086e 100644 --- a/inc/classes/exceptions/io/class_InvalidDataLengthException.php +++ b/inc/classes/exceptions/io/class_InvalidDataLengthException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php index fefef2d23d..2dbe65cee5 100644 --- a/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php +++ b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php b/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php index 3a64350f7c..d15fbfec73 100644 --- a/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php +++ b/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_PathIsEmptyException.php b/inc/classes/exceptions/io/class_PathIsEmptyException.php index c43ab814b7..b8a286846f 100644 --- a/inc/classes/exceptions/io/class_PathIsEmptyException.php +++ b/inc/classes/exceptions/io/class_PathIsEmptyException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php b/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php index 11d94975a5..2cedc57b14 100644 --- a/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php +++ b/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/io/class_PathReadProtectedException.php b/inc/classes/exceptions/io/class_PathReadProtectedException.php index ce897d2fc6..102dae24af 100644 --- a/inc/classes/exceptions/io/class_PathReadProtectedException.php +++ b/inc/classes/exceptions/io/class_PathReadProtectedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php b/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php index ddb98356c1..6e02cfe494 100644 --- a/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php +++ b/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php b/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php index f87a412a5c..cd38561c3a 100644 --- a/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php +++ b/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php b/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php index c82818f697..9b6b581de5 100644 --- a/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php +++ b/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php b/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php index ba59b572a8..9df443e778 100644 --- a/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php +++ b/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php b/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php index 210b94c336..ea92f6de3b 100644 --- a/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php +++ b/inc/classes/exceptions/language/class_MissingFileIoHandlerException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php b/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php index a5c8946f9d..9511e21692 100644 --- a/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php +++ b/inc/classes/exceptions/language/class_MissingLanguageHandlerException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_ClassMismatchException.php b/inc/classes/exceptions/main/class_ClassMismatchException.php index 9e218ad2ad..92364cd3b1 100644 --- a/inc/classes/exceptions/main/class_ClassMismatchException.php +++ b/inc/classes/exceptions/main/class_ClassMismatchException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_ClassNotFoundException.php b/inc/classes/exceptions/main/class_ClassNotFoundException.php index 34f0ed3c36..5f037fe435 100644 --- a/inc/classes/exceptions/main/class_ClassNotFoundException.php +++ b/inc/classes/exceptions/main/class_ClassNotFoundException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php b/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php index 16abfebb35..29efd8f948 100644 --- a/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php +++ b/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php index 823321802b..d428331916 100644 --- a/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php +++ b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php b/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php index 7f0ee053e5..25a694c37e 100644 --- a/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php +++ b/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_EmptyVariableException.php b/inc/classes/exceptions/main/class_EmptyVariableException.php index 42a938ca05..7fa7f48e3a 100644 --- a/inc/classes/exceptions/main/class_EmptyVariableException.php +++ b/inc/classes/exceptions/main/class_EmptyVariableException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_ExceptionNotChangedException.php b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php index 7468bd4ff5..6fe9445836 100644 --- a/inc/classes/exceptions/main/class_ExceptionNotChangedException.php +++ b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.org * @deprecated * * This program is free software: you can redistribute it and/or modify diff --git a/inc/classes/exceptions/main/class_ExceptionNotFoundException.php b/inc/classes/exceptions/main/class_ExceptionNotFoundException.php index 95deb6175f..eed88505a3 100644 --- a/inc/classes/exceptions/main/class_ExceptionNotFoundException.php +++ b/inc/classes/exceptions/main/class_ExceptionNotFoundException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_GetterNotFoundException.php b/inc/classes/exceptions/main/class_GetterNotFoundException.php index fd6202265c..bcc958f558 100644 --- a/inc/classes/exceptions/main/class_GetterNotFoundException.php +++ b/inc/classes/exceptions/main/class_GetterNotFoundException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_InvalidArrayCountException.php b/inc/classes/exceptions/main/class_InvalidArrayCountException.php index f318d67857..0fc6f6685f 100644 --- a/inc/classes/exceptions/main/class_InvalidArrayCountException.php +++ b/inc/classes/exceptions/main/class_InvalidArrayCountException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_InvalidCommandException.php b/inc/classes/exceptions/main/class_InvalidCommandException.php index 27b676623c..add16453d1 100644 --- a/inc/classes/exceptions/main/class_InvalidCommandException.php +++ b/inc/classes/exceptions/main/class_InvalidCommandException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_InvalidCommandInstanceException.php b/inc/classes/exceptions/main/class_InvalidCommandInstanceException.php index dc10391389..7728526443 100644 --- a/inc/classes/exceptions/main/class_InvalidCommandInstanceException.php +++ b/inc/classes/exceptions/main/class_InvalidCommandInstanceException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_InvalidControllerException.php b/inc/classes/exceptions/main/class_InvalidControllerException.php index a2952b456a..a3043d7eaf 100644 --- a/inc/classes/exceptions/main/class_InvalidControllerException.php +++ b/inc/classes/exceptions/main/class_InvalidControllerException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_InvalidObjectException.php b/inc/classes/exceptions/main/class_InvalidObjectException.php index 39d67e733f..1b4438b0c9 100644 --- a/inc/classes/exceptions/main/class_InvalidObjectException.php +++ b/inc/classes/exceptions/main/class_InvalidObjectException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_MissingArrayElementsException.php b/inc/classes/exceptions/main/class_MissingArrayElementsException.php index 66c9a55c16..890aa2d2c6 100644 --- a/inc/classes/exceptions/main/class_MissingArrayElementsException.php +++ b/inc/classes/exceptions/main/class_MissingArrayElementsException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php b/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php index 055ebe9ab7..7c40bfb8c4 100644 --- a/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php +++ b/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_MissingMethodException.php b/inc/classes/exceptions/main/class_MissingMethodException.php index 3e78c1a224..65eb60d07e 100644 --- a/inc/classes/exceptions/main/class_MissingMethodException.php +++ b/inc/classes/exceptions/main/class_MissingMethodException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_NoArrayCreatedException.php b/inc/classes/exceptions/main/class_NoArrayCreatedException.php index a4098a7dc0..264d69d549 100644 --- a/inc/classes/exceptions/main/class_NoArrayCreatedException.php +++ b/inc/classes/exceptions/main/class_NoArrayCreatedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_NoArrayException.php b/inc/classes/exceptions/main/class_NoArrayException.php index 0f39cdc269..00f240ea7b 100644 --- a/inc/classes/exceptions/main/class_NoArrayException.php +++ b/inc/classes/exceptions/main/class_NoArrayException.php @@ -4,7 +4,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_NoObjectException.php b/inc/classes/exceptions/main/class_NoObjectException.php index a2d6dcf98f..1812a16fb6 100644 --- a/inc/classes/exceptions/main/class_NoObjectException.php +++ b/inc/classes/exceptions/main/class_NoObjectException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.org * @deprecated * @see InvalidObjectException * diff --git a/inc/classes/exceptions/main/class_NullPointerException.php b/inc/classes/exceptions/main/class_NullPointerException.php index eb91335bd4..42ed410f3e 100644 --- a/inc/classes/exceptions/main/class_NullPointerException.php +++ b/inc/classes/exceptions/main/class_NullPointerException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php b/inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php index 1877e126a2..16e36e1657 100644 --- a/inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php +++ b/inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/main/class_VariableIsNotSetException.php b/inc/classes/exceptions/main/class_VariableIsNotSetException.php index 2a36031d8c..36372e574c 100644 --- a/inc/classes/exceptions/main/class_VariableIsNotSetException.php +++ b/inc/classes/exceptions/main/class_VariableIsNotSetException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_BasePathIsEmptyException.php b/inc/classes/exceptions/template/class_BasePathIsEmptyException.php index 29a84ae220..78dd8571a5 100644 --- a/inc/classes/exceptions/template/class_BasePathIsEmptyException.php +++ b/inc/classes/exceptions/template/class_BasePathIsEmptyException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php b/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php index d798a692b7..ab6b7f058f 100644 --- a/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php +++ b/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_BasePathReadProtectedException.php b/inc/classes/exceptions/template/class_BasePathReadProtectedException.php index 687f295900..3d1507a3e2 100644 --- a/inc/classes/exceptions/template/class_BasePathReadProtectedException.php +++ b/inc/classes/exceptions/template/class_BasePathReadProtectedException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_InvalidBasePathStringException.php b/inc/classes/exceptions/template/class_InvalidBasePathStringException.php index 68241d3e8f..9aa3ad4bba 100644 --- a/inc/classes/exceptions/template/class_InvalidBasePathStringException.php +++ b/inc/classes/exceptions/template/class_InvalidBasePathStringException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php index 7e7a21bec9..b309f7b2d8 100644 --- a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php +++ b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.org * @deprecated * * This program is free software: you can redistribute it and/or modify diff --git a/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php b/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php index 2d79973509..c761da6afb 100644 --- a/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php +++ b/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php b/inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php index d5e1b214f5..46d15190a3 100644 --- a/inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php +++ b/inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php b/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php index b649aa1bb3..0fe1d02965 100644 --- a/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php +++ b/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/user/class_UserEmailMissingException.php b/inc/classes/exceptions/user/class_UserEmailMissingException.php index 64aedd73ca..3c816e96fe 100644 --- a/inc/classes/exceptions/user/class_UserEmailMissingException.php +++ b/inc/classes/exceptions/user/class_UserEmailMissingException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/exceptions/user/class_UserPasswordMismatchException.php b/inc/classes/exceptions/user/class_UserPasswordMismatchException.php new file mode 100644 index 0000000000..2ca954d6f0 --- /dev/null +++ b/inc/classes/exceptions/user/class_UserPasswordMismatchException.php @@ -0,0 +1,46 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class UserPasswordMismatchException extends FrameworkException { + /** + * The super constructor for all exceptions + * + * @param $msgArray The non-optional message for the exception + * @param $code An optional code for better debugging + * @return void + */ + public function __construct(array $msgArray, $code = 0) { + // Create the message + $message = sprintf("[%s:%d] Supplied password for user %s did not match with stored password.", + $msgArray[0]->__toString(), + $this->getLine(), + $msgArray[1]->getUserName() + ); + + // Make sure everything is assigned properly + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/user/class_UsernameMissingException.php b/inc/classes/exceptions/user/class_UsernameMissingException.php index ac261821ae..42160ede82 100644 --- a/inc/classes/exceptions/user/class_UsernameMissingException.php +++ b/inc/classes/exceptions/user/class_UsernameMissingException.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/application/class_ManageableApplication.php b/inc/classes/interfaces/application/class_ManageableApplication.php index e775a18ec9..cdf7afdc70 100644 --- a/inc/classes/interfaces/application/class_ManageableApplication.php +++ b/inc/classes/interfaces/application/class_ManageableApplication.php @@ -11,7 +11,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/auth/.htaccess b/inc/classes/interfaces/auth/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/interfaces/auth/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/auth/class_Authorizeable.php b/inc/classes/interfaces/auth/class_Authorizeable.php new file mode 100644 index 0000000000..88e383fe39 --- /dev/null +++ b/inc/classes/interfaces/auth/class_Authorizeable.php @@ -0,0 +1,34 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 . + */ +interface Authorizeable extends FrameworkInterface { + /** + * Destroy the authorization data + * + * @return void + */ + function destroyAuthData(); +} + +// +?> diff --git a/inc/classes/interfaces/cache/class_Cacheable.php b/inc/classes/interfaces/cache/class_Cacheable.php index c6fa237371..b58c8badd3 100644 --- a/inc/classes/interfaces/cache/class_Cacheable.php +++ b/inc/classes/interfaces/cache/class_Cacheable.php @@ -2,11 +2,11 @@ /** * An interface for classes which are "able" to cache * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/class_ b/inc/classes/interfaces/class_ index 055ad90d6a..60a8e962c5 100644 --- a/inc/classes/interfaces/class_ +++ b/inc/classes/interfaces/class_ @@ -2,11 +2,11 @@ /** * * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/class_FrameworkInterface.php b/inc/classes/interfaces/class_FrameworkInterface.php index 3acb33bb68..212e03174b 100644 --- a/inc/classes/interfaces/class_FrameworkInterface.php +++ b/inc/classes/interfaces/class_FrameworkInterface.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/commands/class_Commandable.php b/inc/classes/interfaces/commands/class_Commandable.php index 379204e341..76679cb547 100644 --- a/inc/classes/interfaces/commands/class_Commandable.php +++ b/inc/classes/interfaces/commands/class_Commandable.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/compressor/class_Compressor.php b/inc/classes/interfaces/compressor/class_Compressor.php index 799f90fe40..c7b725a24e 100644 --- a/inc/classes/interfaces/compressor/class_Compressor.php +++ b/inc/classes/interfaces/compressor/class_Compressor.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/controller/class_Controller.php b/inc/classes/interfaces/controller/class_Controller.php index ecba54f6a0..7169d880ef 100644 --- a/inc/classes/interfaces/controller/class_Controller.php +++ b/inc/classes/interfaces/controller/class_Controller.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/criteria/class_Criteria.php b/inc/classes/interfaces/criteria/class_Criteria.php index 35b51f35b5..f6cf6be6f1 100644 --- a/inc/classes/interfaces/criteria/class_Criteria.php +++ b/inc/classes/interfaces/criteria/class_Criteria.php @@ -2,11 +2,11 @@ /** * An interface for criterias * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php b/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php index 79c3b4768b..cfb84942ae 100644 --- a/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php +++ b/inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php @@ -2,11 +2,11 @@ /** * An interface for local criterias * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php b/inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php index 8af7c67d7f..42daaad823 100644 --- a/inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php +++ b/inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php b/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php index c5cf54e32f..196616153b 100644 --- a/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php +++ b/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php index f61df0713e..7621713a4d 100644 --- a/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php +++ b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php @@ -10,7 +10,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -56,7 +56,7 @@ interface DatabaseFrontendInterface extends FrameworkDatabaseInterface { * @throws UnsupportedCriteriaException If the criteria is unsupported * @throws SqlException If an SQL error occurs */ - function querySelect ($resultType, $tableName, Criteria $criteriaInstance); + function querySelect ($resultType, $tableName, LocalSearchCriteria $criteriaInstance); /** * "Inserts" a data set instance into a local file database folder @@ -65,7 +65,7 @@ interface DatabaseFrontendInterface extends FrameworkDatabaseInterface { * @return void * @throws SqlException If an SQL error occurs */ - function insertDataSet (StoreableCriteria $dataSetInstance); + function queryInsertDataSet (StoreableCriteria $dataSetInstance); } // [EOF] diff --git a/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php b/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php index bf149a9d61..9a56aec30b 100644 --- a/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php +++ b/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/debug/class_Debugger.php b/inc/classes/interfaces/debug/class_Debugger.php index 7dfc98e7aa..cce33d0459 100644 --- a/inc/classes/interfaces/debug/class_Debugger.php +++ b/inc/classes/interfaces/debug/class_Debugger.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/extended/class_LimitableObject.php b/inc/classes/interfaces/extended/class_LimitableObject.php index b66038fa72..d4eea0f444 100644 --- a/inc/classes/interfaces/extended/class_LimitableObject.php +++ b/inc/classes/interfaces/extended/class_LimitableObject.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/filter/class_Filterable.php b/inc/classes/interfaces/filter/class_Filterable.php index 9b88075811..657dc2aecf 100644 --- a/inc/classes/interfaces/filter/class_Filterable.php +++ b/inc/classes/interfaces/filter/class_Filterable.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/helper/.htaccess b/inc/classes/interfaces/helper/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/interfaces/helper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/helper/class_HelpableLogin.php b/inc/classes/interfaces/helper/class_HelpableLogin.php new file mode 100644 index 0000000000..cf5f84f873 --- /dev/null +++ b/inc/classes/interfaces/helper/class_HelpableLogin.php @@ -0,0 +1,36 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 . + */ +interface HelpableLogin extends FrameworkInterface { + /** + * Execute the login request by given response instance. This instance can + * be used for sending cookies or at least the session id out. + * + * @param $responseInstance An instance of a Responseable class + * @return void + */ + function executeLogin (Responseable $responseInstance); +} + +// +?> diff --git a/inc/classes/interfaces/io/class_Streamable.php b/inc/classes/interfaces/io/class_Streamable.php index a5a0927027..2d839a64c5 100644 --- a/inc/classes/interfaces/io/class_Streamable.php +++ b/inc/classes/interfaces/io/class_Streamable.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/io/file/class_FileInputStreamer.php b/inc/classes/interfaces/io/file/class_FileInputStreamer.php index 294f697ccb..5dc756b693 100644 --- a/inc/classes/interfaces/io/file/class_FileInputStreamer.php +++ b/inc/classes/interfaces/io/file/class_FileInputStreamer.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/io/file/class_FileOutputStreamer.php b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php index 92231d8036..2862c544f7 100644 --- a/inc/classes/interfaces/io/file/class_FileOutputStreamer.php +++ b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/io/output/class_OutputStreamer.php b/inc/classes/interfaces/io/output/class_OutputStreamer.php index babc128944..8dff6817d7 100644 --- a/inc/classes/interfaces/io/output/class_OutputStreamer.php +++ b/inc/classes/interfaces/io/output/class_OutputStreamer.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/language/class_ManageableLanguage.php b/inc/classes/interfaces/language/class_ManageableLanguage.php index c1c64fcf25..4d4dfac3e2 100644 --- a/inc/classes/interfaces/language/class_ManageableLanguage.php +++ b/inc/classes/interfaces/language/class_ManageableLanguage.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/login/class_LoginableUser.php b/inc/classes/interfaces/login/class_LoginableUser.php index c7abf2d8d0..107b13387c 100644 --- a/inc/classes/interfaces/login/class_LoginableUser.php +++ b/inc/classes/interfaces/login/class_LoginableUser.php @@ -2,11 +2,11 @@ /** * An interface for user login classes * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -28,9 +28,10 @@ interface LoginableUser extends FrameworkInterface { * in a boolean attribute which is then readable by a matching getter. * * @param $requestInstance An instance of a Requestable class + * @param $responseInstance An instance of a Responseable class * @return void */ - function doLogin (Requestable $requestInstance); + function doLogin (Requestable $requestInstance, Responseable $responseInstance); } // diff --git a/inc/classes/interfaces/reader/.htaccess b/inc/classes/interfaces/reader/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/interfaces/reader/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/reader/class_ReadableNews.php b/inc/classes/interfaces/reader/class_ReadableNews.php new file mode 100644 index 0000000000..c38b702007 --- /dev/null +++ b/inc/classes/interfaces/reader/class_ReadableNews.php @@ -0,0 +1,34 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 . + */ +interface ReadableNews extends FrameworkInterface { + /** + * Initializes the news reader class. This is very reader-dependent + * + * @return void + */ + function initializeReader(); +} + +// +?> diff --git a/inc/classes/interfaces/registration/class_UserRegister.php b/inc/classes/interfaces/registration/class_UserRegister.php index 9fbf2ff4f1..89a6fb2209 100644 --- a/inc/classes/interfaces/registration/class_UserRegister.php +++ b/inc/classes/interfaces/registration/class_UserRegister.php @@ -2,11 +2,11 @@ /** * A class for user registration * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/registry/class_Register.php b/inc/classes/interfaces/registry/class_Register.php index a750ac1b37..d25fbab5dc 100644 --- a/inc/classes/interfaces/registry/class_Register.php +++ b/inc/classes/interfaces/registry/class_Register.php @@ -2,11 +2,11 @@ /** * An interface for registries * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/registry/class_Registerable.php b/inc/classes/interfaces/registry/class_Registerable.php index 0616d002ad..7be47dbc4b 100644 --- a/inc/classes/interfaces/registry/class_Registerable.php +++ b/inc/classes/interfaces/registry/class_Registerable.php @@ -2,11 +2,11 @@ /** * A class for registerable classes * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/request/class_Requestable.php b/inc/classes/interfaces/request/class_Requestable.php index 1c093b7c90..1c3d092507 100644 --- a/inc/classes/interfaces/request/class_Requestable.php +++ b/inc/classes/interfaces/request/class_Requestable.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -70,6 +70,14 @@ interface Requestable extends FrameworkInterface { * @return void */ function requestIsValid ($isValid = true); + + /** + * Reads a cookie and returns it's value or null if not found + * + * @param $cookieName Name of cookie we shall read + * @return $cookieValue Value of cookie or null if not found + */ + function readCookie ($cookieName); } // diff --git a/inc/classes/interfaces/resolver/class_CommandResolver.php b/inc/classes/interfaces/resolver/class_CommandResolver.php index 5e01cd944e..c60c187292 100644 --- a/inc/classes/interfaces/resolver/class_CommandResolver.php +++ b/inc/classes/interfaces/resolver/class_CommandResolver.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/resolver/class_ControllerResolver.php b/inc/classes/interfaces/resolver/class_ControllerResolver.php index 2f275147a3..1b3d5f00bd 100644 --- a/inc/classes/interfaces/resolver/class_ControllerResolver.php +++ b/inc/classes/interfaces/resolver/class_ControllerResolver.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/response/class_Responseable.php b/inc/classes/interfaces/response/class_Responseable.php index 30bde5b388..a1fabde81d 100644 --- a/inc/classes/interfaces/response/class_Responseable.php +++ b/inc/classes/interfaces/response/class_Responseable.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -56,7 +56,7 @@ interface Responseable extends FrameworkInterface { * @throws ResponseHeadersAlreadySentException Thrown if headers are * already sent */ - function flushBuffer($force=false); + function flushBuffer ($force = false); /** * Adds a fatal message id to the response. The added messages can then be @@ -66,6 +66,35 @@ interface Responseable extends FrameworkInterface { * @return void */ function addFatalMessage ($messageId); + + /** + * Adds a cookie to the response + * + * @param $cookieName Cookie's name + * @param $cookieValue Value to store in the cookie + * @param $encrypted Do some extra encryption on the value + * @return void + * @throws ResponseHeadersAlreadySentException If headers are already sent + */ + function addCookie ($cookieName, $cookieValue, $encrypted = false); + + /** + * Redirect to a configured URL. The URL can be absolute or relative. In + * case of relative URL it will be extended automatically. + * + * @param $configEntry The configuration entry which holds our URL + * @return void + * @throws ResponseHeadersAlreadySentException If headers are already sent + */ + function redirectToConfiguredUrl ($configEntry); + + /** + * Expires the given cookie if it is set + * + * @param $cookieName Cookie to expire + * @return void + */ + function expireCookie ($cookieName); } // diff --git a/inc/classes/interfaces/result/.htaccess b/inc/classes/interfaces/result/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/interfaces/result/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/result/class_SearchableResult.php b/inc/classes/interfaces/result/class_SearchableResult.php new file mode 100644 index 0000000000..595e5c426f --- /dev/null +++ b/inc/classes/interfaces/result/class_SearchableResult.php @@ -0,0 +1,35 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 . + */ +interface SearchableResult extends FrameworkInterface { + /** + * Searches for an entry in the data result and returns it + * + * @param $criteriaInstance The criteria to look inside the data set + * @return $result Found result entry + */ + function searchEntry (LocalSearchCriteria $criteriaInstance); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/template/class_CompileableTemplate.php b/inc/classes/interfaces/template/class_CompileableTemplate.php index 16a500ed98..c0ec28b7d3 100644 --- a/inc/classes/interfaces/template/class_CompileableTemplate.php +++ b/inc/classes/interfaces/template/class_CompileableTemplate.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/template/view/class_ViewHelper.php b/inc/classes/interfaces/template/view/class_ViewHelper.php index b8617363bf..230d04ebcc 100644 --- a/inc/classes/interfaces/template/view/class_ViewHelper.php +++ b/inc/classes/interfaces/template/view/class_ViewHelper.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/interfaces/user/class_ManageableUser.php b/inc/classes/interfaces/user/class_ManageableUser.php index 768df47790..4dafed2894 100644 --- a/inc/classes/interfaces/user/class_ManageableUser.php +++ b/inc/classes/interfaces/user/class_ManageableUser.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -22,6 +22,37 @@ * along with this program. If not, see . */ interface ManageableUser extends FrameworkInterface { + /** + * Determines wether the username exists or not + * + * @return $exists Wether the username exists + */ + function ifUsernameExists (); + + /** + * Determines wether the email exists or not + * + * @return $exists Wether the email exists + */ + function ifEmailAddressExists (); + + /** + * Checks if the supplied password hash in request matches with the stored + * in database. + * + * @param $requestInstance A requestable class instance + * @return $matches Wether the supplied password hash matches + */ + function ifPasswordHashMatches (Requestable $requestInstance); + + /** + * Adds data for later complete update + * + * @param $column Column we want to update + * @param $value New value to store in database + * @return void + */ + function addUpdateData ($column, $value); } // diff --git a/inc/classes/main/actions/class_BaseAction.php b/inc/classes/main/actions/class_BaseAction.php index 9b2df36d50..15ba51ef0d 100644 --- a/inc/classes/main/actions/class_BaseAction.php +++ b/inc/classes/main/actions/class_BaseAction.php @@ -3,10 +3,10 @@ * A general action class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php b/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php index aae33eb5c2..c5f1e8a02f 100644 --- a/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php +++ b/inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php @@ -60,16 +60,16 @@ class LoginAfterRegistrationAction extends BaseAction implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a login class from factory - $loginInstance = ObjectFactory::createObjectByConfiguredName('login_user'); + $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class'); // Login the user by the request instance - $loginInstance->doLogin($requestInstance); + $loginInstance->doLogin($requestInstance, $responseInstance); // Was the login fine? Then redirect here if ($loginInstance->ifLoginWasSuccessfull()) { // Try to redirect here try { - $responseInstance->redirectConfiguredUrl('app_login'); + $responseInstance->redirectToConfiguredUrl('app_login_url'); } catch (FrameworkException $e) { // Something went wrong here! $responseInstance->addFatalMessage($e->getMessage()); diff --git a/inc/classes/main/auth/.htaccess b/inc/classes/main/auth/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/main/auth/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/auth/class_CookieAuth.php b/inc/classes/main/auth/class_CookieAuth.php new file mode 100644 index 0000000000..6b1bf3f065 --- /dev/null +++ b/inc/classes/main/auth/class_CookieAuth.php @@ -0,0 +1,121 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("Cookie-based login"); + + // Create unique ID number + $this->generateUniqueId(); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of this class by the given response instance + * + * @param $responseInstance An instance of a Responseable class + * @return $loginInstance An instance of this login class + */ + public final static function createCookieAuth (Responseable $responseInstance) { + // Get a new instance + $loginInstance = new CookieAuth(); + + // Set the response instance + $loginInstance->setResponseInstance($responseInstance); + + // Return the prepared instance + return $loginInstance; + } + + /** + * "Setter" for username auth data + * + * @param $userName The username from request we shall set + * @return void + */ + public function setUserAuth ($userName) { + $this->getResponseInstance()->addCookie('username', $userName); + } + + /** + * "Setter" for password hash auth data + * + * @param $passHash The hashed password from request we shall set + * @return void + */ + public function setPasswordAuth ($passHash) { + $this->getResponseInstance()->addCookie('u_hash', $passHash, true); + } + + /** + * Getter for user auth cookie + * + * @return $userName Username to get from cookie + */ + public function getUserAuth () { + // Get the username from cookie + $userName = $this->getRequestInstance()->readCookie('username'); + + // Return the username + return $userName; + } + + /** + * Getter for password hash auth cookie + * + * @return $passHash Password hash to get from cookie + */ + public function getPasswordAuth () { + // Get the username from cookie + $passHash = $this->getRequestInstance()->readCookie('u_hash'); + + // Return the username + return $passHash; + } + + /** + * Destroy the authorization data + * + * @return void + */ + public function destroyAuthData () { + // Expire both cookies + $this->getResponseInstance()->expireCookie('username'); + $this->getResponseInstance()->expireCookie('u_hash'); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/cache/class_MemoryCache.php b/inc/classes/main/cache/class_MemoryCache.php index 01d2a36781..4cb7459b6d 100644 --- a/inc/classes/main/cache/class_MemoryCache.php +++ b/inc/classes/main/cache/class_MemoryCache.php @@ -3,10 +3,10 @@ * A simple memory cache (similar to a registry) * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 2a0c80768b..3484a4eb5a 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -32,6 +32,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * The language instance for the template loader */ private static $langInstance = null; + /** + * Instance of a request class + */ + private $requestInstance = null; + + /** + * Instance of a response class + */ + private $responseInstance = null; /** * The real class name @@ -61,7 +70,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * The file I/O instance for the template loader */ - private $fileIOInstance = null; + private $fileIoInstance = null; /*********************** * Exception codes.... * @@ -267,7 +276,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->systemclasses[] = $this->getConfigInstance()->readConfig('app_helper_class'); // Set debug instance - $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine'))); + $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_class'))); // Get output instance and set it $outputInstance = ObjectFactory::createObjectByConfiguredName('web_engine', array($this->getConfigInstance()->readConfig('web_content_type'))); @@ -407,6 +416,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { self::$applicationInstance = $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; + } + /** * Getter for $realClass * @@ -758,20 +805,20 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * Private getter for file IO instance * - * @return $fileIOInstance An instance to the file I/O sub-system + * @return $fileIoInstance An instance to the file I/O sub-system */ protected final function getFileIoInstance () { - return $this->fileIOInstance; + return $this->fileIoInstance; } /** * Setter for file I/O instance * - * @param $fileIOInstance An instance to the file I/O sub-system + * @param $fileIoInstance An instance to the file I/O sub-system * @return void */ - public final function setFileIoInstance (FileIoHandler $fileIOInstance) { - $this->fileIOInstance = $fileIOInstance; + public final function setFileIoInstance (FileIoHandler $fileIoInstance) { + $this->fileIoInstance = $fileIoInstance; } /** @@ -821,7 +868,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // Initialize the template engine - $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance())); + $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance())); // Return the prepared instance return $tplEngine; @@ -886,10 +933,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $className Generated class name */ public function convertToClassName ($str) { + // Init class name $className = ""; + + // Convert all dashes in underscores + $str = str_replace("-", "_", $str); + + // Now use that underscores to get classname parts for hungarian style foreach (explode("_", $str) as $strPart) { + // Make the class name part lower case and first upper case $className .= ucfirst(strtolower($strPart)); - } + } // END - foreach + + // Return class name return $className; } diff --git a/inc/classes/main/class_FrameworkArrayObject.php b/inc/classes/main/class_FrameworkArrayObject.php index 6543d45f09..f1daed4b33 100644 --- a/inc/classes/main/class_FrameworkArrayObject.php +++ b/inc/classes/main/class_FrameworkArrayObject.php @@ -8,7 +8,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/commands/class_ b/inc/classes/main/commands/class_ index 628cd0f8eb..778e7d8bb0 100644 --- a/inc/classes/main/commands/class_ +++ b/inc/classes/main/commands/class_ @@ -2,11 +2,11 @@ /** * * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/commands/web/class_WebDoFormCommand.php b/inc/classes/main/commands/web/class_WebDoFormCommand.php index e7f59adeee..cdfd7161ac 100644 --- a/inc/classes/main/commands/web/class_WebDoFormCommand.php +++ b/inc/classes/main/commands/web/class_WebDoFormCommand.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/commands/web/class_WebHomeCommand.php b/inc/classes/main/commands/web/class_WebHomeCommand.php index 8dcf3b1c45..3cc3592cf4 100644 --- a/inc/classes/main/commands/web/class_WebHomeCommand.php +++ b/inc/classes/main/commands/web/class_WebHomeCommand.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -99,7 +99,7 @@ class WebHomeCommand extends BaseCommand implements Commandable { $templateInstance->loadCodeTemplate($masterTemplate); // Set title - $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig('command_parameter'))); + $title = ucfirst($requestInstance->getRequestElement("page")); if (empty($title)) $title = "Home"; $templateInstance->assignVariable('title', $title); diff --git a/inc/classes/main/commands/web/class_WebLoginAreaCommand.php b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php new file mode 100644 index 0000000000..d5f45ec598 --- /dev/null +++ b/inc/classes/main/commands/web/class_WebLoginAreaCommand.php @@ -0,0 +1,129 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class WebLoginAreaCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set special description + $this->setObjectDescription("Command for the "home" page"); + + // Create unique ID number + $this->generateUniqueId(); + + // Clean up a little + $this->removeSystemArray(); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public final static function createWebLoginAreaCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new WebLoginAreaCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given command with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Default action is the one from configuration + $action = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action')); + + // Get the application instance + $appInstance = $this->getResolverInstance()->getApplicationInstance(); + + // Prepare a template instance + $templateInstance = $this->prepareTemplateEngine($appInstance); + + // Load the master template + $masterTemplate = $appInstance->getMasterTemplate(); + + // Load header template + $templateInstance->loadCodeTemplate("header"); + + // Compile and assign it with a variable + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable("header", "header"); + + // Load footer template + $templateInstance->loadCodeTemplate("footer"); + + // Compile and assign it with a variable + $templateInstance->compileTemplate(); + $templateInstance->assignTemplateWithVariable("footer", "footer"); + + // Get "action" from request + $actReq = $requestInstance->getRequestElement("action"); + + // Do we have a "action" parameter set? + if (is_string($actReq)) { + // Then use it with prefix + $action = sprintf("login_%s", $actReq); + } // END - if + + // TODO Do the action somewhere here + + // Load the matching template + $templateInstance->loadCodeTemplate($action); + + // Assign the template with the master template as a content ... ;) + $templateInstance->assignTemplateWithVariable($action, "content"); + + // Load the master template + $templateInstance->loadCodeTemplate($masterTemplate); + + // Set title + $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_{$action}_title')); + + // ... and all variables. This should be merged together in a pattern + // to make things easier. A cache mechanism should be added between + // these two calls to cache compiled templates. + $templateInstance->compileVariables(); + + // Get the content back from the template engine and put it in the response class + $templateInstance->transferToResponse($responseInstance); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/commands/web/class_WebRegisterCommand.php b/inc/classes/main/commands/web/class_WebRegisterCommand.php index 1f85254b81..df50499987 100644 --- a/inc/classes/main/commands/web/class_WebRegisterCommand.php +++ b/inc/classes/main/commands/web/class_WebRegisterCommand.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -103,7 +103,7 @@ class WebRegisterCommand extends BaseCommand implements Commandable { $templateInstance->loadCodeTemplate($masterTemplate); // Set title - $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig('command_parameter'))); + $title = ucfirst($requestInstance->getRequestElement("page")); if (empty($title)) $title = "Register"; $templateInstance->assignVariable('title', $title); diff --git a/inc/classes/main/console/class_ConsoleTools.php b/inc/classes/main/console/class_ConsoleTools.php index ffdc18214c..ffd8b8e750 100644 --- a/inc/classes/main/console/class_ConsoleTools.php +++ b/inc/classes/main/console/class_ConsoleTools.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/controller/class_BaseController.php b/inc/classes/main/controller/class_BaseController.php index 409ded2b9e..4438cc216e 100644 --- a/inc/classes/main/controller/class_BaseController.php +++ b/inc/classes/main/controller/class_BaseController.php @@ -53,8 +53,8 @@ class BaseController extends BaseFrameworkSystem { $this->removeSystemArray(); // Initialize both filter chains - $this->preFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain'); - $this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain'); + $this->preFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); + $this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); } /** diff --git a/inc/classes/main/controller/default/class_WebDefaultNewsController.php b/inc/classes/main/controller/default/class_WebDefaultNewsController.php index 326c0b00bc..fee2d39f00 100644 --- a/inc/classes/main/controller/default/class_WebDefaultNewsController.php +++ b/inc/classes/main/controller/default/class_WebDefaultNewsController.php @@ -51,6 +51,10 @@ class WebDefaultNewsController extends BaseController implements Controller { // Set the command resolver $controllerInstance->setResolverInstance($resolverInstance); + // Add news filters to this controller + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class')); + // Return the prepared instance return $controllerInstance; } @@ -63,32 +67,24 @@ class WebDefaultNewsController extends BaseController implements Controller { * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + // Get the command instance from the resolver by sending a request instance to the resolver $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance); - // Load the news here - $this->loadNewsByRequest($requestInstance); - // This request was valid! :-D $requestInstance->requestIsValid(); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + // Flush the response out $responseInstance->flushBuffer(); } - - /** - * Loads news by a given request - * - * @param $requestInstance An instance of a request class - * @return void - */ - private function loadNewsByRequest (Requestable $requestInstance) { - // Generate a new news object but not carring about which concrete we have - $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance)->createNewsObject(); - } } // [EOF] diff --git a/inc/classes/main/controller/login/.htaccess b/inc/classes/main/controller/login/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/main/controller/login/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/controller/login/class_WebLoginAreaController.php b/inc/classes/main/controller/login/class_WebLoginAreaController.php new file mode 100644 index 0000000000..34893a10f9 --- /dev/null +++ b/inc/classes/main/controller/login/class_WebLoginAreaController.php @@ -0,0 +1,92 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class WebLoginAreaController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("Default controller with news"); + + // Create unique ID number + $this->generateUniqueId(); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + */ + public final static function createWebLoginAreaController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new WebLoginAreaController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // Add some filters to this controller + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class')); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + + // Get the command instance from the resolver by sending a request instance to the resolver + $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance); + + // This request was valid! :-D + $requestInstance->requestIsValid(); + + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); + + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + + // Flush the response out + $responseInstance->flushBuffer(); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/criteria/class_DataSetCriteria.php b/inc/classes/main/criteria/class_DataSetCriteria.php index feb6366fac..2e76c2f94d 100644 --- a/inc/classes/main/criteria/class_DataSetCriteria.php +++ b/inc/classes/main/criteria/class_DataSetCriteria.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/criteria/class_SearchCriteria.php b/inc/classes/main/criteria/class_SearchCriteria.php index f948909671..fc5b1addd3 100644 --- a/inc/classes/main/criteria/class_SearchCriteria.php +++ b/inc/classes/main/criteria/class_SearchCriteria.php @@ -5,10 +5,10 @@ * for looking in storages like the database. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/crypto/class_CryptoHelper.php b/inc/classes/main/crypto/class_CryptoHelper.php index cdde421138..4ec02ad917 100644 --- a/inc/classes/main/crypto/class_CryptoHelper.php +++ b/inc/classes/main/crypto/class_CryptoHelper.php @@ -3,10 +3,10 @@ * A helper class for cryptographical things like hashing passwords and so on * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/database/class_ b/inc/classes/main/database/class_ index 6c338fdd99..504f4ab110 100644 --- a/inc/classes/main/database/class_ +++ b/inc/classes/main/database/class_ @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/database/class_BaseDatabaseFrontend.php b/inc/classes/main/database/class_BaseDatabaseFrontend.php index cdf894fc04..2d2e04bdcf 100644 --- a/inc/classes/main/database/class_BaseDatabaseFrontend.php +++ b/inc/classes/main/database/class_BaseDatabaseFrontend.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -24,7 +24,7 @@ */ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { // Constants for exceptions - const EXCEPTION_SQL_QUERY = 0xc00; + const EXCEPTION_SQL_QUERY = 0x050; /** * The limiter instance diff --git a/inc/classes/main/database/class_BaseDatabaseWrapper.php b/inc/classes/main/database/class_BaseDatabaseWrapper.php index 9c42999de5..52447117eb 100644 --- a/inc/classes/main/database/class_BaseDatabaseWrapper.php +++ b/inc/classes/main/database/class_BaseDatabaseWrapper.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 151698c7f2..220ad14d28 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -8,7 +8,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -26,8 +26,8 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface { // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!) - const DB_CODE_TABLE_MISSING = 0x000; - const DB_CODE_TABLE_UNWRITEABLE = 0x001; + const DB_CODE_TABLE_MISSING = 0x010; + const DB_CODE_TABLE_UNWRITEABLE = 0x011; /** * Save path for "file database" @@ -535,16 +535,10 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend * @throws UnsupportedCriteriaException If the criteria is unsupported * @throws SqlException If an "SQL error" occurs */ - public function querySelect ($resultType, $tableName, Criteria $criteriaInstance) { + public function querySelect ($resultType, $tableName, LocalSearchCriteria $criteriaInstance) { // The result is null by any errors $resultData = null; - // Is this criteria supported? - if (!$criteriaInstance instanceof LocalSearchCriteria) { - // Not supported by this database layer - throw new UnsupportedCriteriaException(array($this, $criteriaInstance), self::EXCEPTION_REQUIRED_INTERFACE_MISSING); - } - // Create full path name $pathName = $this->getSavePath() . $tableName . '/'; @@ -640,7 +634,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend * @return void * @throws SqlException If an SQL error occurs */ - public function insertDataSet (StoreableCriteria $dataSetInstance) { + public function queryInsertDataSet (StoreableCriteria $dataSetInstance) { // Create full path name $fqfn = sprintf("%s%s/%s.%s", $this->getSavePath(), diff --git a/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php b/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php index 88bc13fbb2..5fc62e2a83 100644 --- a/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php +++ b/inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -29,7 +29,7 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper { private $cacheInstance = null; // Constants for exceptions - const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0xe00; + const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x070; // Constants for database columns const DB_COLUMN_USERNAME = "username"; @@ -132,14 +132,14 @@ class UserDatabaseWrapper extends BaseDatabaseWrapper { */ public function insertRegistrationObject (UserRegister $registrationInstance) { // Generate a data set for the request - $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria'); + $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class'); $dataSetInstance->setTableName(self::DB_TABLE_USER); // Add registration elements to the dataset $registrationInstance->addElementsToDataSet($dataSetInstance); // "Insert" this request instance completely into the database - $this->getDatabaseInstance()->insertDataSet($dataSetInstance); + $this->getDatabaseInstance()->queryInsertDataSet($dataSetInstance); } } diff --git a/inc/classes/main/debug/class_DebugConsoleOutput.php b/inc/classes/main/debug/class_DebugConsoleOutput.php index 77b28b4beb..be17ae39ad 100644 --- a/inc/classes/main/debug/class_DebugConsoleOutput.php +++ b/inc/classes/main/debug/class_DebugConsoleOutput.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php index af33e70080..34db47c5f7 100644 --- a/inc/classes/main/debug/class_DebugErrorLogOutput.php +++ b/inc/classes/main/debug/class_DebugErrorLogOutput.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/debug/class_DebugWebOutput.php b/inc/classes/main/debug/class_DebugWebOutput.php index 3eb613382e..81dd64dc9a 100644 --- a/inc/classes/main/debug/class_DebugWebOutput.php +++ b/inc/classes/main/debug/class_DebugWebOutput.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/extended/class_ObjectLimits.php b/inc/classes/main/extended/class_ObjectLimits.php index 0f9ea835e0..926e8fc699 100644 --- a/inc/classes/main/extended/class_ObjectLimits.php +++ b/inc/classes/main/extended/class_ObjectLimits.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/extended/class_SerializationContainer.php b/inc/classes/main/extended/class_SerializationContainer.php index 6d5c15de54..2f967e4b36 100644 --- a/inc/classes/main/extended/class_SerializationContainer.php +++ b/inc/classes/main/extended/class_SerializationContainer.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/factories/cache/class_CacheFactory.php b/inc/classes/main/factories/cache/class_CacheFactory.php index 48f83383fe..e2cb7bce35 100644 --- a/inc/classes/main/factories/cache/class_CacheFactory.php +++ b/inc/classes/main/factories/cache/class_CacheFactory.php @@ -66,7 +66,7 @@ class CacheFactory extends BaseFactory { */ public function createConfiguredCache () { // Read the config entry - $cacheType = $this->getConfigInstance()->readConfig("cache_type"); + $cacheType = $this->getConfigInstance()->readConfig("cache_class"); // And get a new instance $cacheInstance = ObjectFactory::createObjectByName($cacheType); diff --git a/inc/classes/main/factories/objects/class_ObjectFactory.php b/inc/classes/main/factories/objects/class_ObjectFactory.php index 024020d6d4..9a2ec9c2d2 100644 --- a/inc/classes/main/factories/objects/class_ObjectFactory.php +++ b/inc/classes/main/factories/objects/class_ObjectFactory.php @@ -55,14 +55,17 @@ class ObjectFactory extends BaseFactory { * @throws EmptyVariableException If a variable is empty unexpectly */ public final static function createObjectByName ($className, array $args=array()) { - // First get an instance of this factory - $factoryInstance = new ObjectFactory(); - // Is the class name valid and is the class there? if (empty($className)) { + // First get an instance of this factory + $factoryInstance = new ObjectFactory(); + // Throw an exception here throw new EmptyVariableException(array($factoryInstance, 'className'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); } elseif (!class_exists($className)) { + // First get an instance of this factory + $factoryInstance = new ObjectFactory(); + // Then throw an exception throw new ClassNotFoundException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND); } diff --git a/inc/classes/main/factories/web/class_WebNewsFactory.php b/inc/classes/main/factories/web/class_WebNewsFactory.php index ecd1f28642..dfbb6db85f 100644 --- a/inc/classes/main/factories/web/class_WebNewsFactory.php +++ b/inc/classes/main/factories/web/class_WebNewsFactory.php @@ -51,67 +51,16 @@ class WebNewsFactory extends BaseFactory { * @return $factoryInstance An instance of a WebNewsFactory class */ public final static function createFactoryByRequest (Requestable $requestInstance) { - // Generate the new instance - $factoryInstance = new WebNewsFactory(); - - // Get the element name from configuration - $element = FrameworkConfiguration::getInstance()->readConfig('app_selector_get'); - - // Analyze the request, first get the Uni* application name (short one from URL) - $appName = $requestInstance->getRequestElement($element); - - // Initialize some variables - $className = ""; - $className2 = $appName; - - // Then construct the class name - foreach (array("_", "-") as $exp) { - $array = explode($exp, $className2); - foreach ($array as $el) { - $className .= ucfirst(strtolower($el)); - } - - // Copy it back and clear the class name - $className2 = $className; - $className = ""; - } - - // After all is done, copy it back and add this class' name - $className = $className2 . $factoryInstance->__toString(); + // Get the news reader class name from config + $className = $requestInstance->getConfigInstance()->readConfig('news_reader_class'); // Once we have that name, try to load initialize it - $realFactoryInstance = ObjectFactory::createObjectByName($className); - - // And assign it with the factory - $factoryInstance->setRealFactoryInstance($realFactoryInstance); + $newsInstance = ObjectFactory::createObjectByName($className, array($requestInstance)); - // Remember the request we have used for later usage - $factoryInstance->setRequestInstance($requestInstance); + // Initialize the reader + $newsInstance->initializeReader(); // Return the prepared factory instance - return $factoryInstance; - } - - /** - * Setter for the request instance - * - * @param $requestInstance An instance of a request object - * @return void - */ - public final function setRequestInstance (Requestable $requestInstance) { - $this->requestInstance = $requestInstance; - } - - /** - * Creates a new object instance and returns it - * - * @return $newsInstance An instance of a news object - */ - public function createNewsObject () { - // Ask the real factory class for doing this - $newsInstance = $this->getRealFactoryInstance()->createNewObject($this->requestInstance); - - // And return it return $newsInstance; } } diff --git a/inc/classes/main/filter/auth/.htaccess b/inc/classes/main/filter/auth/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/main/filter/auth/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/filter/auth/class_UserAuthFilter.php b/inc/classes/main/filter/auth/class_UserAuthFilter.php new file mode 100644 index 0000000000..5754bf1d66 --- /dev/null +++ b/inc/classes/main/filter/auth/class_UserAuthFilter.php @@ -0,0 +1,114 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class UserAuthFilter extends BaseFilter implements Filterable { + // Exception constants + const EXCEPTION_AUTH_DATA_INVALID = 0x0a0; + + /** + * The login method we shall choose + */ + private $authMethod = ""; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("A user authorization filter"); + + // Create unique ID number + $this->generateUniqueId(); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createUserAuthFilter () { + // Get a new instance + $filterInstance = new UserAuthFilter(); + + // Set default auth method + $filterInstance->setDefaultAuthMethod(); + + // Return the instance + return $filterInstance; + } + + /** + * Setter for default login method from config + * + * @return void + */ + protected function setDefaultAuthMethod () { + $this->authMethod = $this->getConfigInstance()->readConfig('auth_method_class'); + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + * @throws UserAuthorizationException If the auth login was not found or if it was invalid + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // 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(); + + // If one is empty stop here + if ((empty($authLogin)) || (empty($authHash))) { + // Destroy the auth data + $authInstance->destroyAuthData(); + + // Mark the request as invalid + $requestInstance->requestIsValid(false); + + // Add fatal message + $responseInstance->addFatalMessage('auth_data_incomplete'); + + // Stop here + throw new UserAuthorizationException($this, self::EXCEPTION_AUTH_DATA_INVALID); + } + + // Destroy safely the auth instance + unset($authInstance); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php b/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php index 3029dcee64..d52c6aa6ac 100644 --- a/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php +++ b/inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php @@ -23,7 +23,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable { +class RulesAcceptedFilter extends BaseFilter implements Filterable { /** * Protected constructor * @@ -38,10 +38,6 @@ class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable { // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** @@ -76,7 +72,7 @@ class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable { // Add a message to the response $responseInstance->addFatalMessage('rules_unchecked'); - // Abort here + // Skip further processing return false; } } diff --git a/inc/classes/main/filter/class_BaseFilter.php b/inc/classes/main/filter/class_BaseFilter.php new file mode 100644 index 0000000000..3800c49250 --- /dev/null +++ b/inc/classes/main/filter/class_BaseFilter.php @@ -0,0 +1,45 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseFilter extends BaseFrameworkSystem { + // Exception constants + const EXCEPTION_FILTER_CHAIN_ABORTED = 0x090; + + /** + * Protected constructor + * + * @param $className Name of the filter class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/filter/class_FilterChain.php b/inc/classes/main/filter/class_FilterChain.php index fa1f8f4211..7004eb50f4 100644 --- a/inc/classes/main/filter/class_FilterChain.php +++ b/inc/classes/main/filter/class_FilterChain.php @@ -81,11 +81,16 @@ class FilterChain extends BaseFrameworkSystem { // Run all filters //* DEBUG */ echo "COUNT=".count($this->filters)."
\n"; foreach ($this->filters as $filterInstance) { - // Execute this filter - //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.
\n"; + // Try to execute this filter + try { + //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.
\n"; $filterInstance->execute($requestInstance, $responseInstance); - //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.
\n"; - } + //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.
\n"; + } catch (FilterChainException $e) { + // This exception can be thrown to just skip any further processing + break; + } + } // END - foreach } } diff --git a/inc/classes/main/filter/news/.htaccess b/inc/classes/main/filter/news/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/main/filter/news/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/filter/news/class_NewsDownloadFilter.php b/inc/classes/main/filter/news/class_NewsDownloadFilter.php new file mode 100644 index 0000000000..e3a1881c2a --- /dev/null +++ b/inc/classes/main/filter/news/class_NewsDownloadFilter.php @@ -0,0 +1,73 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NewsDownloadFilter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("A filter for downloading news"); + + // Create unique ID number + $this->generateUniqueId(); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createNewsDownloadFilter () { + // Get a new instance + $filterInstance = new NewsDownloadFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get a news instance + $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance); + + // TODO Need to extend/rewrite this + $this->partialStub("Unfinished work."); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/filter/news/class_NewsProcessFilter.php b/inc/classes/main/filter/news/class_NewsProcessFilter.php new file mode 100644 index 0000000000..8df6a0f011 --- /dev/null +++ b/inc/classes/main/filter/news/class_NewsProcessFilter.php @@ -0,0 +1,68 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NewsProcessFilter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("A filter for processing news"); + + // Create unique ID number + $this->generateUniqueId(); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createNewsProcessFilter () { + // Get a new instance + $filterInstance = new NewsProcessFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @param $requestInstance An instance of a class with an Requestable interface + * @param $responseInstance An instance of a class with an Responseable interface + * @return void + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + $this->partialStub("Unfinished work."); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/filter/null/class_NullFilter.php b/inc/classes/main/filter/null/class_NullFilter.php index 3ac6d34ac9..ef9c70c3fd 100644 --- a/inc/classes/main/filter/null/class_NullFilter.php +++ b/inc/classes/main/filter/null/class_NullFilter.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class NullFilter extends BaseFrameworkSystem implements Filterable { +class NullFilter extends BaseFilter implements Filterable { /** * Protected constructor * @@ -37,10 +37,6 @@ class NullFilter extends BaseFrameworkSystem implements Filterable { // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** diff --git a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php index a1276c88a3..4785a9653c 100644 --- a/inc/classes/main/filter/validator/class_EmailValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_EmailValidatorFilter.php @@ -24,7 +24,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable { +class EmailValidatorFilter extends BaseFilter implements Filterable { /** * Protected constructor * @@ -39,10 +39,6 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable { // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** diff --git a/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php b/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php index a8369d8190..1d371b1e82 100644 --- a/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_PasswordValidatorFilter.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class PasswordValidatorFilter extends BaseFrameworkSystem implements Filterable { +class PasswordValidatorFilter extends BaseFilter implements Filterable { /** * Protected constructor * @@ -37,10 +37,6 @@ class PasswordValidatorFilter extends BaseFrameworkSystem implements Filterable // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** diff --git a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php index 068f807754..456f16a40c 100644 --- a/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php +++ b/inc/classes/main/filter/validator/class_UserNameValidatorFilter.php @@ -24,7 +24,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable { +class UserNameValidatorFilter extends BaseFilter implements Filterable { /** * Protected constructor * @@ -39,10 +39,6 @@ class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** diff --git a/inc/classes/main/helper/login/.htaccess b/inc/classes/main/helper/login/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/main/helper/login/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/helper/login/class_BaseLoginHelper.php b/inc/classes/main/helper/login/class_BaseLoginHelper.php new file mode 100644 index 0000000000..25be6a9290 --- /dev/null +++ b/inc/classes/main/helper/login/class_BaseLoginHelper.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseLoginHelper extends BaseHelper { + /** + * Protected constructor + * + * @param $className Real name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/helper/web/class_WebFormHelper.php b/inc/classes/main/helper/web/class_WebFormHelper.php index e71f15137d..61a6243479 100644 --- a/inc/classes/main/helper/web/class_WebFormHelper.php +++ b/inc/classes/main/helper/web/class_WebFormHelper.php @@ -49,10 +49,10 @@ class WebFormHelper extends BaseHelper { private $subGroupName = ""; // Class Constants - const EXCEPTION_FORM_NAME_INVALID = 0xb00; - const EXCEPTION_CLOSED_FORM = 0xb01; - const EXCEPTION_OPENED_FORM = 0xb02; - const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0xb03; + const EXCEPTION_FORM_NAME_INVALID = 0x030; + const EXCEPTION_CLOSED_FORM = 0x031; + const EXCEPTION_OPENED_FORM = 0x032; + const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0x033; /** * Protected constructor @@ -119,8 +119,9 @@ class WebFormHelper extends BaseHelper { // Check wether we shall open or close the form if ($this->formOpened === false) { // Add HTML code - $formContent = sprintf("
getConfigInstance()->readConfig('base_url'), $this->getConfigInstance()->readConfig('form_action'), $this->getConfigInstance()->readConfig('form_method'), $this->getConfigInstance()->readConfig('form_target') diff --git a/inc/classes/main/io/class_FileIoStream.php b/inc/classes/main/io/class_FileIoStream.php index 1b57ee6619..f3cf60ef1a 100644 --- a/inc/classes/main/io/class_FileIoStream.php +++ b/inc/classes/main/io/class_FileIoStream.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/io/class_FrameworkDirectoryPointer.php b/inc/classes/main/io/class_FrameworkDirectoryPointer.php index 6206023750..f9eacc71fb 100644 --- a/inc/classes/main/io/class_FrameworkDirectoryPointer.php +++ b/inc/classes/main/io/class_FrameworkDirectoryPointer.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/io/class_FrameworkFileInputPointer.php b/inc/classes/main/io/class_FrameworkFileInputPointer.php index c86de9a927..25c77cb838 100644 --- a/inc/classes/main/io/class_FrameworkFileInputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileInputPointer.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/io/class_FrameworkFileOutputPointer.php b/inc/classes/main/io/class_FrameworkFileOutputPointer.php index 73cf90804d..5a7acddd62 100644 --- a/inc/classes/main/io/class_FrameworkFileOutputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileOutputPointer.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/language/class_LanguageSystem.php b/inc/classes/main/language/class_LanguageSystem.php index 19d05972ca..eb99cf1e8b 100644 --- a/inc/classes/main/language/class_LanguageSystem.php +++ b/inc/classes/main/language/class_LanguageSystem.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/output/class_ConsoleOutput.php b/inc/classes/main/output/class_ConsoleOutput.php index e75cf829d4..dfba40dce9 100644 --- a/inc/classes/main/output/class_ConsoleOutput.php +++ b/inc/classes/main/output/class_ConsoleOutput.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/output/class_WebOutput.php b/inc/classes/main/output/class_WebOutput.php index 6c86b6266a..5b4f58838d 100644 --- a/inc/classes/main/output/class_WebOutput.php +++ b/inc/classes/main/output/class_WebOutput.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/reader/.htaccess b/inc/classes/main/reader/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/classes/main/reader/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/reader/class_DefaultNewsReader.php b/inc/classes/main/reader/class_DefaultNewsReader.php new file mode 100644 index 0000000000..7fa8ff2e6b --- /dev/null +++ b/inc/classes/main/reader/class_DefaultNewsReader.php @@ -0,0 +1,74 @@ + + * @version 0.0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set part description + $this->setObjectDescription("Default news reader"); + + // Create unique ID number + $this->generateUniqueId(); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of this reader by a provided request instance + * + * @param $requestInstance An instance of a Requestable class + * @return $readerInstance An instance of this reader class + */ + public final static function createDefaultNewsReader (Requestable $requestInstance) { + // Get a new instance + $readerInstance = new DefaultNewsReader(); + + // Set request instance + $readerInstance->setRequestInstance($requestInstance); + + // Return prepared instance + return $readerInstance; + } + + /** + * Initializes this reader class by pre-fetching news depending on "page" + * (outside or login area), which amount of news and how much to skip + * + * @return void + */ + public function initializeReader () { + // TODO Need to implement this method + } +} + +// [EOF] +?> diff --git a/inc/classes/main/registration/class_BaseRegistration.php b/inc/classes/main/registration/class_BaseRegistration.php index 3066d2989d..79225300e1 100644 --- a/inc/classes/main/registration/class_BaseRegistration.php +++ b/inc/classes/main/registration/class_BaseRegistration.php @@ -3,10 +3,10 @@ * A general registration class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 @@ -22,16 +22,6 @@ * along with this program. If not, see . */ abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegister { - /** - * Instance of a request class - */ - private $requestInstance = null; - - /** - * Instance of a response class - */ - private $responseInstance = null; - /** * Pre-registration filter chain */ @@ -64,46 +54,8 @@ abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegis */ protected function initFilterChains () { // Pre/post-registration filters - $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain'); - $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain'); - } - - /** - * 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; + $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); + $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); } /** diff --git a/inc/classes/main/registry/class_Registry.php b/inc/classes/main/registry/class_Registry.php index a8abb50926..308e89c72b 100644 --- a/inc/classes/main/registry/class_Registry.php +++ b/inc/classes/main/registry/class_Registry.php @@ -3,10 +3,10 @@ * A registry for several data types * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/request/class_HttpRequest.php b/inc/classes/main/request/class_HttpRequest.php index e3bb312f9e..b6f9b95f46 100644 --- a/inc/classes/main/request/class_HttpRequest.php +++ b/inc/classes/main/request/class_HttpRequest.php @@ -93,7 +93,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { if (!isset($this->requestData[$element])) { // Then throw an exception throw new MissingArrayElementsException(array($this, 'requestData', $element), self::EXCEPTION_MISSING_ELEMENT); - } + } // END - if // All clear return true; @@ -113,7 +113,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { try { if ($this->isRequestElementSet($element)) { $value = $this->requestData[$element]; - } + } // END - if } catch (MissingArrayElementsException $e) { // Do nothing here } @@ -158,7 +158,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { // Does this header exist? if (isset($_SERVER[$name])) { $headerValue = $_SERVER[$name]; - } + } // END - if // Return the value return $headerValue; @@ -176,7 +176,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { /** * Sets wether the request was valid (default: true) * - * @param $isValid Wether the request is valid + * @param $isValid Wether the request is valid * @return void */ public final function requestIsValid ($isValid = true) { @@ -191,6 +191,26 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { public final function isRequestValid () { return $this->requestIsValid; } + + /** + * Reads a cookie and returns it's value or null if not found + * + * @param $cookieName Name of cookie we shall read + * @return $cookieValue Value of cookie or null if not found + */ + public final function readCookie ($cookieName) { + // Default is no cookie with that name found + $cookieValue = null; + + // Is the cookie set? + if (isset($_COOKIE[$cookieName])) { + // Then get it + $cookieValue = $_COOKIE[$cookieName]; + } // END - if + + // Return the value + return $cookieValue; + } } // [EOF] diff --git a/inc/classes/main/resolver/web/class_WebCommandResolver.php b/inc/classes/main/resolver/web/class_WebCommandResolver.php index fa52125d68..f4b87a2b30 100644 --- a/inc/classes/main/resolver/web/class_WebCommandResolver.php +++ b/inc/classes/main/resolver/web/class_WebCommandResolver.php @@ -94,7 +94,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { // Test if the required parameter is set try { // This goes fine so let's resolv the command - $commandName = $requestInstance->getRequestElement($this->getConfigInstance()->readConfig('command_parameter')); + $commandName = $requestInstance->getRequestElement("page"); // Is the command empty? Then fall back to default command if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command'); @@ -181,7 +181,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { // Still not found? throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND); } - } + } // END - if // Initiate the command $commandInstance = ObjectFactory::createObjectByName($className, array($this)); diff --git a/inc/classes/main/resolver/web/class_WebControllerResolver.php b/inc/classes/main/resolver/web/class_WebControllerResolver.php index b5f66e8531..0585196bc0 100644 --- a/inc/classes/main/resolver/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/web/class_WebControllerResolver.php @@ -126,7 +126,9 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { } /** - * "Loads" a given controller and instances it if not yet cached + * "Loads" a given controller and instances it if not yet cached. If the + * controller was not found one of the default controllers will be used + * depending on wether news shall be displayed. * * @param $commandName A controller name we shall look for * @return $controllerInstance A loaded controller instance @@ -150,6 +152,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { $class = "WebDefaultController"; // Generate the class name + //* DEBUG: */ echo __METHOD__.": Command=".$commandName; if ($commandName != $defaultCommand) { // Create controller class name $class = sprintf("Web%sController", @@ -162,6 +165,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { // No nes at "home" page $class = "WebDefaultController"; } + //* DEBUG: */ echo ", controller=".$class."
\n"; // Is this class loaded? if (!class_exists($class)) { @@ -176,7 +180,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { } // END - if // Initiate the resolver and controller - $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver', array($commandName, $this->getApplicationInstance())); + $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($commandName, $this->getApplicationInstance())); $controllerInstance = ObjectFactory::createObjectByName($class, array($resolverInstance)); // Remove resolver diff --git a/inc/classes/main/response/class_HttpResponse.php b/inc/classes/main/response/class_HttpResponse.php index 074373d1ea..3fc5d2db19 100644 --- a/inc/classes/main/response/class_HttpResponse.php +++ b/inc/classes/main/response/class_HttpResponse.php @@ -35,6 +35,11 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { */ private $responseHeaders = array(); + /** + * Cookies we shall sent out + */ + private $cookies = array(); + /** * Body of the response */ @@ -136,7 +141,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { * @param $output Output we shall sent in the HTTP response * @return void */ - public function setReponseBody ($output) { + public function setResponseBody ($output) { $this->responseBody = $output; } @@ -163,15 +168,25 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { // General header for no caching $this->addHeader('Expired', $now); // rfc2616 - Section 14.21 $this->addHeader('Last-Modified', $now); - $this->addHeader('Cache-Control:', 'no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 - $this->addHeader('Pragma:', 'no-cache'); // HTTP/1.0 + $this->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 + $this->addHeader('Pragma', 'no-cache'); // HTTP/1.0 // Define the charset to be used //$this->addHeader('Content-Type:', sprintf("text/html; charset=%s", $this->getConfigInstance()->readConfig('header_charset'))); foreach ($this->responseHeaders as $name=>$value) { header("{$name}: {$value}"); - } + } // END - foreach + + // Send cookies out? + if (count($this->cookies) > 0) { + // Send all cookies + $cookieString = implode(" ", $this->cookies); + header("Set-Cookie: {$cookieString}"); + + // Remove them all + $this->cookies = array(); + } // END - if } // Are there some error messages? @@ -187,7 +202,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { } // Clear response header and body - $this->setReponseBody(""); + $this->setResponseBody(""); $this->resetResponseHeaders(); } @@ -221,6 +236,115 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { // Adds the resolved message id to the fatal message list $this->fatalMessages[] = $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId); } + + /** + * Adds a cookie to the response + * + * @param $cookieName Cookie's name + * @param $cookieValue Value to store in the cookie + * @param $encrypted Do some extra encryption on the value + * @param $expires Timestamp of expiration (default: configured) + * @return void + * @throws ResponseHeadersAlreadySentException If headers are already sent + */ + public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) { + // Are headers already sent? + if (headers_sent()) { + // Throw an exception here + throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT); + } // END - if + + // Shall we encrypt the cookie? + if ($encrypted === true) { + // @TODO Encryption of cookie data not yet supported + } // END - if + + // For slow browsers set the cookie array element first + $_COOKIE[$cookieName] = $cookieValue; + + // Get all config entries + if (is_null($expires)) { + $expires = (time() + $this->getConfigInstance()->readConfig('cookie_expire')); + } // END - if + + $path = $this->getConfigInstance()->readConfig('cookie_path'); + $domain = $this->getConfigInstance()->readConfig('cookie_domain'); + + setcookie($cookieName, $cookieValue, $expires); + // TODO Why are these parameters conflicting? + //, $path, $domain, (isset($_SERVER['HTTPS'])) + return; + // TODO This will send only one cookie out, the first one. + + // Now construct the full header + $cookieString = $cookieName . "=" . $cookieValue . "; "; + $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT"; + // TODO Why are these parameters conflicting? + // $cookieString .= "; path=".$path."; domain=".$domain; + + // Set the cookie as a header + $this->cookies[$cookieName] = $cookieString; + } + + /** + * Redirect to a configured URL. The URL can be absolute or relative. In + * case of relative URL it will be extended automatically. + * + * @param $configEntry The configuration entry which holds our URL + * @return void + * @throws ResponseHeadersAlreadySentException If headers are already sent + */ + public function redirectToConfiguredUrl ($configEntry) { + // Is the header not yet sent? + if (headers_sent()) { + // Throw an exception here + throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT); + } // END - if + + // Get the url from config + $url = $this->getConfigInstance()->readConfig($configEntry); + + // Do we have a "http" in front of the URL? + if (substr(strtolower($url), 0, 4) != "http") { + // Is there a / in front of the relative URL? + if (substr($url, 0, 1) == "/") $url = substr($url, 1); + + // No, then extend it with our base URL + $url = $this->getConfigInstance()->readConfig('base_url') . "/" . $url; + } // END - if + + // Add redirect header + $this->addHeader("Location", $url); + + // Set correct response status + $this->setResponseStatus("301 Moved Permanently"); + + // Clear the body + $this->setResponseBody(""); + + // Flush the result + $this->flushBuffer(); + + // All done here... + exit(); + } + + /** + * Expires the given cookie if it is set + * + * @param $cookieName Cookie to expire + * @return void + */ + public function expireCookie ($cookieName) { + // Is the cookie there? + if (isset($_COOKIE[$cookieName])) { + // Then expire it with 20 minutes past + $this->addCookie($cookieName, "", false, (time() - 1200)); + + // Remove it from array + unset($_COOKIE[$cookieName]); + } // END - if + } } // [EOF] diff --git a/inc/classes/main/result/class_DatabaseResult.php b/inc/classes/main/result/class_DatabaseResult.php index 3d48861ba6..c6a0b1149a 100644 --- a/inc/classes/main/result/class_DatabaseResult.php +++ b/inc/classes/main/result/class_DatabaseResult.php @@ -3,10 +3,10 @@ * A database result class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class DatabaseResult extends BaseFrameworkSystem { +class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, SeekableIterator { /** * Current position in array */ @@ -97,7 +97,7 @@ class DatabaseResult extends BaseFrameworkSystem { // Is the result valid? if ($this->resultArray['status'] === "ok") { // The status is fine so let's have a look for the next entry - if (isset($this->resultArray['rows'][($this->currentPos + 1)])) { + if ($this->valid()) { // Next entry found, so count one up and cache it $this->currentPos++; $this->currentRow = $this->resultArray['rows'][$this->currentPos]; @@ -108,6 +108,89 @@ class DatabaseResult extends BaseFrameworkSystem { // Return the result return $nextValid; } + + /** + * Seeks for to a specified position + * + * @param $index Index to seek for + * @return void + */ + public function seek ($index) { + // Rewind to beginning + $this->rewind(); + + // Search for the entry + while ($this->currentPos < $index && ($this->valid())) { + // Continue on + $this->next(); + } // END - while + } + + /** + * Gives back the current position or null if not found + * + * @return $current Current element to give back + */ + public function current () { + // Default is not found + $current = null; + + // Does the current enty exist? + if (isset($this->resultArray['rows'][$this->currentPos])) { + // Then get it + $current = $this->resultArray['rows'][$this->currentPos]; + } // END - if + + // Return the result + return $current; + } + + /** + * Checks if next() and rewind will give a valid result + * + * @return $isValid Wether the next/rewind entry is valid + */ + public function valid () { + // By default nothing is valid + $isValid = false; + + // Check if + if ((isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) { + // All fine! + $isValid = true; + } // END - if + + // Return the result + return $isValid; + } + + /** + * Gets the current key of iteration + * + * @return $currentPos Key from iterator + */ + public function key () { + return $this->currentPos; + } + + /** + * Rewind to the beginning + * + * @return void + */ + public function rewind () { + $this->currentPos = 0; + } + + /** + * Searches for an entry in the data result and returns it + * + * @param $criteriaInstance The criteria to look inside the data set + * @return $result Found result entry + */ + public function searchEntry (LocalSearchCriteria $criteriaInstance) { + die("OK"); + } } // [EOF] diff --git a/inc/classes/main/rng/class_RandomNumberGenerator.php b/inc/classes/main/rng/class_RandomNumberGenerator.php index b50af11d86..8875a4ca06 100644 --- a/inc/classes/main/rng/class_RandomNumberGenerator.php +++ b/inc/classes/main/rng/class_RandomNumberGenerator.php @@ -3,10 +3,10 @@ * A standard random number generator * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/main/template/class_TemplateEngine.php b/inc/classes/main/template/class_TemplateEngine.php index e1c3bcee1e..fad4cf4a3f 100644 --- a/inc/classes/main/template/class_TemplateEngine.php +++ b/inc/classes/main/template/class_TemplateEngine.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -109,9 +109,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate private $helpers = array(); // Exception codes for the template engine - const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0xa00; - const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0xa01; - const EXCEPTION_INVALID_VIEW_HELPER = 0xa02; + const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x020; + const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x021; + const EXCEPTION_INVALID_VIEW_HELPER = 0x022; /** * Protected constructor diff --git a/inc/classes/main/user/class_User.php b/inc/classes/main/user/class_User.php index 25e2cc3ffd..cc9c443480 100644 --- a/inc/classes/main/user/class_User.php +++ b/inc/classes/main/user/class_User.php @@ -33,8 +33,9 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable { private $email = ""; // Exceptions - const EXCEPTION_USERNAME_NOT_FOUND = 0xd00; - const EXCEPTION_USER_EMAIL_NOT_FOUND = 0xd01; + const EXCEPTION_USERNAME_NOT_FOUND = 0x060; + const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x061; + const EXCEPTION_USER_PASS_MISMATCH = 0x062; /** * Protected constructor @@ -147,14 +148,14 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable { * @return $exists Wether the username exists */ public function ifUsernameExists () { - // By default the username does exist - $exists = true; + // By default the username does not exist + $exists = false; // Get a UserDatabaseWrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper'); + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); // Create a search criteria - $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria'); + $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add the username as a criteria and set limit to one entry $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUsername()); @@ -164,9 +165,9 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable { $result = $wrapperInstance->doSelectByCriteria($criteriaInstance); // Search for it - if (!$result->next()) { - // Entry not found - $exists = false; + if ($result->next()) { + // Entry found + $exists = true; } // END - if // Return the status @@ -179,14 +180,14 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable { * @return $exists Wether the email exists */ public function ifEmailAddressExists () { - // By default the username does exist - $exists = true; + // By default the email does not exist + $exists = false; // Get a UserDatabaseWrapper instance - $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper'); + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); // Create a search criteria - $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria'); + $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add the username as a criteria and set limit to one entry $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_EMAIL, $this->getEmail()); @@ -196,14 +197,62 @@ class User extends BaseFrameworkSystem implements ManageableUser, Registerable { $result = $wrapperInstance->doSelectByCriteria($criteriaInstance); // Search for it - if (!$result->next()) { - // Entry not found - $exists = false; + if ($result->next()) { + // Entry found + $exists = true; } // END - if // Return the status return $exists; } + + /** + * Checks if the supplied password hash in request matches with the stored + * in database. + * + * @param $requestInstance A requestable class instance + * @return $matches Wether the supplied password hash matches + */ + public function ifPasswordHashMatches (Requestable $requestInstance) { + // By default nothing matches... ;) + $matches = false; + + // Get a UserDatabaseWrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); + + // Create a search criteria + $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Add the username as a criteria and set limit to one entry + $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); + $criteriaInstance->setLimit(1); + + // Get a search result + $result = $wrapperInstance->doSelectByCriteria($criteriaInstance); + + // Search for it + if ($result->next()) { + // Get the current entry (can only be one!) + $entry = $result->current(); + + // So does the hashes match? + $matches = ($requestInstance->getRequestElement('pass_hash') === $entry['pass_hash']); + } // END - if + + // Return the status + return $matches; + } + + /** + * Adds data for later complete update + * + * @param $column Column we want to update + * @param $value New value to store in database + * @return void + */ + public function addUpdateData ($column, $value) { + $this->partialStub("Column={$column}, value={$value}"); + } } // [EOF] diff --git a/inc/classes/middleware/class_BaseMiddleware.php b/inc/classes/middleware/class_BaseMiddleware.php index 3b643540b5..472aa8ba71 100644 --- a/inc/classes/middleware/class_BaseMiddleware.php +++ b/inc/classes/middleware/class_BaseMiddleware.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index b881426427..346538024f 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/middleware/database/class_DatabaseConnection.php b/inc/classes/middleware/database/class_DatabaseConnection.php index 0c42807518..fc8ea9135f 100644 --- a/inc/classes/middleware/database/class_DatabaseConnection.php +++ b/inc/classes/middleware/database/class_DatabaseConnection.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -158,12 +158,12 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re * @param $dataSetInstance A storeable data set * @return void */ - public function insertDataSet (StoreableCriteria $dataSetInstance) { + public function queryInsertDataSet (StoreableCriteria $dataSetInstance) { // Connect to the database $this->dbLayer->connectToDatabase(); // Ask the database layer - $this->dbLayer->insertDataSet($dataSetInstance); + $this->dbLayer->queryInsertDataSet($dataSetInstance); } } diff --git a/inc/classes/middleware/debug/class_DebugMiddleware.php b/inc/classes/middleware/debug/class_DebugMiddleware.php index 6a6bacff9c..1f5e6e0e64 100644 --- a/inc/classes/middleware/debug/class_DebugMiddleware.php +++ b/inc/classes/middleware/debug/class_DebugMiddleware.php @@ -8,7 +8,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/classes/middleware/io/class_FileIoHandler.php b/inc/classes/middleware/io/class_FileIoHandler.php index 071e1d6ecb..99cb434e16 100644 --- a/inc/classes/middleware/io/class_FileIoHandler.php +++ b/inc/classes/middleware/io/class_FileIoHandler.php @@ -7,7 +7,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -68,8 +68,8 @@ class FileIoHandler extends BaseMiddleware { $ioHandler = new FileIoHandler(); // Set the *real* file IO instances (both the same) - $ioHandler->setInputStream(ObjectFactory::createObjectByConfiguredName('file_input_stream')); - $ioHandler->setOutputStream(ObjectFactory::createObjectByConfiguredName('file_output_stream')); + $ioHandler->setInputStream(ObjectFactory::createObjectByConfiguredName('file_input_class')); + $ioHandler->setOutputStream(ObjectFactory::createObjectByConfiguredName('file_output_class')); // Return instance return $ioHandler; diff --git a/inc/config.php b/inc/config.php index ccc1a64e3d..50571624ab 100644 --- a/inc/config.php +++ b/inc/config.php @@ -8,7 +8,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -25,9 +25,9 @@ */ // Load the class from inc/config direktory -require_once(dirname(__FILE__) . '/classes/interfaces/class_FrameworkInterface.php'); -require_once(dirname(__FILE__) . '/classes/interfaces/registry/class_Registerable.php'); -require_once(dirname(__FILE__) . '/config/class_FrameworkConfiguration.php'); +@require_once(dirname(__FILE__) . '/classes/interfaces/class_FrameworkInterface.php'); +@require_once(dirname(__FILE__) . '/classes/interfaces/registry/class_Registerable.php'); +@require_once(dirname(__FILE__) . '/config/class_FrameworkConfiguration.php'); // Get a new configuration instance $cfg = FrameworkConfiguration::createFrameworkConfiguration(); @@ -35,6 +35,9 @@ $cfg = FrameworkConfiguration::createFrameworkConfiguration(); // CFG: SERVER-PATH $cfg->definePath(dirname(dirname(__FILE__)) . '/'); // DON'T MISS THE TRAILING SLASH!!! +// CFG: BASE-URL +$cfg->setConfigEntry('base_url', $cfg->detectBaseUrl()); + // CFG: DATABASE-TYPE $cfg->defineDatabaseType('local'); @@ -62,9 +65,6 @@ $cfg->setConfigEntry('raw_template_extension', ".tpl"); // CFG: CODE-TEMPLATE-EXTENSION $cfg->setConfigEntry('code_template_extension', ".ctp"); -// CFG: SELECTOR-GET -$cfg->setConfigEntry('app_selector_get', "app"); - // CFG: SELECTOR-PATH $cfg->setConfigEntry('selector_path', "selector"); @@ -90,10 +90,10 @@ $cfg->setConfigEntry('application_path', "application"); $cfg->setConfigEntry('compile_output_path', "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH! // CFG: TEMPLATE-ENGINE -$cfg->setConfigEntry('tpl_engine', "TemplateEngine"); +$cfg->setConfigEntry('template_class', "TemplateEngine"); // CFG: DEBUG-ENGINE -$cfg->setConfigEntry('debug_engine', "DebugWebOutput"); +$cfg->setConfigEntry('debug_class', "DebugWebOutput"); // CFG: DEFAULT-LANGUAGE $cfg->setConfigEntry('default_lang', "de"); // A two-char language string: de for german, en for english and so on @@ -150,49 +150,49 @@ $cfg->setConfigEntry('default_application', "selector"); $cfg->setConfigEntry('verbose_level', 0); // CFG: CACHE-TYPE -$cfg->setConfigEntry('cache_type', "MemoryCache"); +$cfg->setConfigEntry('cache_class', "MemoryCache"); // CFG: SEARCH-CRITERIA -$cfg->setConfigEntry('search_criteria', "SearchCriteria"); +$cfg->setConfigEntry('search_criteria_class', "SearchCriteria"); // CFG: DATASET-CRITERIA -$cfg->setConfigEntry('dataset_criteria', "DataSetCriteria"); +$cfg->setConfigEntry('dataset_criteria_class', "DataSetCriteria"); // CFG: FILE-IO-HANDLER -$cfg->setConfigEntry('file_io_handler', "FileIoHandler"); +$cfg->setConfigEntry('file_io_class', "FileIoHandler"); // CFG: FILTER-CHAIN -$cfg->setConfigEntry('filter_chain', "FilterChain"); +$cfg->setConfigEntry('filter_chain_class', "FilterChain"); // CFG: FILE-INPUT-STREAM -$cfg->setConfigEntry('file_input_stream', "FileIoStream"); +$cfg->setConfigEntry('file_input_class', "FileIoStream"); // CFG: FILE-OUTPUT-STREAM -$cfg->setConfigEntry('file_output_stream', "FileIoStream"); +$cfg->setConfigEntry('file_output_class', "FileIoStream"); // CFG: EMAIL-VALIDATOR -$cfg->setConfigEntry('email_validator', "EmailValidatorFilter"); +$cfg->setConfigEntry('email_validator_class', "EmailValidatorFilter"); // CFG: USERNAME-VALIDATOR -$cfg->setConfigEntry('username_validator', "UserNameValidatorFilter"); +$cfg->setConfigEntry('username_validator_class', "UserNameValidatorFilter"); // CFG: PASSWORD-VALIDATOR -$cfg->setConfigEntry('password_validator', "PasswordValidatorFilter"); +$cfg->setConfigEntry('password_validator_class', "PasswordValidatorFilter"); // CFG: RULES-ACCEPTED-FILTER -$cfg->setConfigEntry('rules_accepted_filter', "RulesAcceptedFilter"); +$cfg->setConfigEntry('rules_accepted_class', "RulesAcceptedFilter"); // CFG: CRYPTO-HELPER -$cfg->setConfigEntry('crypto_heler', "CryptoHelper"); +$cfg->setConfigEntry('crypto_class', "CryptoHelper"); // CFG: RNG-CLASS $cfg->setConfigEntry('rng_class', "RandomNumberGenerator"); // CFG: USER-DB-WRAPPER -$cfg->setConfigEntry('user_db_wrapper', "UserDatabaseWrapper"); +$cfg->setConfigEntry('user_db_wrapper_class', "UserDatabaseWrapper"); // CFG: WEB-CMD-RESOLVER -$cfg->setConfigEntry('web_cmd_resolver', "WebCommandResolver"); +$cfg->setConfigEntry('web_cmd_resolver_class', "WebCommandResolver"); // CFG: MATH-PRIME $cfg->setConfigEntry('math_prime', 591623); @@ -213,10 +213,22 @@ $cfg->setConfigEntry('hash_mask', "%1s:%2s:%3s"); // 1=salt, 2=extra salt, 3=pla $cfg->setConfigEntry('is_single_server', "Y"); // CFG: POST-REGISTRATION-ACTION -$cfg->setConfigEntry('post_registration_action', "LoginAfterRegistrationAction"); +$cfg->setConfigEntry('post_registration_class', "LoginAfterRegistrationAction"); // CFG: USER-CLASS $cfg->setConfigEntry('user_class', "User"); +// CFG: COOKIE-EXPIRE +$cfg->setConfigEntry('cookie_expire', (60*60*2)); // Two hours! + +// CFG: COOKIE-PATH +$cfg->setConfigEntry('cookie_path', dirname($_SERVER['SCRIPT_NAME']) . "/"); + +// CFG: COOKIE-DOMAIN +$cfg->setConfigEntry('cookie_domain', $cfg->detectDomain()); // Is mostly the same... + +// CFG: COOKIE-SSL +$cfg->setConfigEntry('cookie_ssl', (isset($_SERVER['HTTPS']))); + // [EOF] ?> diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php index 6bfc3a26ce..50a4ac18a3 100644 --- a/inc/config/class_FrameworkConfiguration.php +++ b/inc/config/class_FrameworkConfiguration.php @@ -39,8 +39,8 @@ class FrameworkConfiguration implements Registerable { private static $cfgInstance = null; // Some constants for the configuration system - const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0xc00; - const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01; + const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0x040; + const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0x041; /** * Protected constructor @@ -169,7 +169,7 @@ class FrameworkConfiguration implements Registerable { /** * Define the local file path * - * @param $path The database type. See path inc/database/. + * @param $path Local file path for include files. * @return void */ public function definePath ($path) { @@ -261,6 +261,41 @@ class FrameworkConfiguration implements Registerable { public function __toString () { return get_class($this); } + + /** + * Dectect and return the base URL for all URLs and forms + * + * @return $baseUrl Detected base URL + */ + public function detectBaseUrl() { + // Initialize the URL + $baseUrl = "http"; + + // Do we have HTTPS? + if (isset($_SERVER['HTTPS'])) { + // Add the >s< for HTTPS + $baseUrl .= "s"; + } // END - if + + // Construct the full URL now and secure it against CSRF attacks + $baseUrl = $baseUrl . "://" . $this->detectDomain() . dirname($_SERVER['SCRIPT_NAME']); + + // Return the URL + return $baseUrl; + } + + /** + * Detect safely and return the full domain where this script is installed + * + * @return $fullDomain The detected full domain + */ + public function detectDomain () { + // Detect the full domain + $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES); + + // Return it + return $fullDomain; + } } // END - class // [EOF] diff --git a/inc/database.php b/inc/database.php index 4947dd1f48..8dd90e46da 100644 --- a/inc/database.php +++ b/inc/database.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/database/lib-local.php b/inc/database/lib-local.php index e4e36fbeee..613d6d2df8 100644 --- a/inc/database/lib-local.php +++ b/inc/database/lib-local.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 diff --git a/inc/file_io.php b/inc/file_io.php index e9472bbb45..afb41612bd 100644 --- a/inc/file_io.php +++ b/inc/file_io.php @@ -8,7 +8,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -25,7 +25,7 @@ */ // Get the instance -$io = ObjectFactory::createObjectByConfiguredName('file_io_handler'); +$io = ObjectFactory::createObjectByConfiguredName('file_io_class'); // [EOF] ?> diff --git a/inc/includes.php b/inc/includes.php index dc603cad1b..a9af02b502 100644 --- a/inc/includes.php +++ b/inc/includes.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -29,14 +29,14 @@ $cfg = FrameworkConfiguration::getInstance(); require(sprintf("%sinc/loader/class_ClassLoader%s", PATH, $cfg->readConfig('php_extension'))); // Does the user has an application specified? -if (!empty($_GET[$cfg->readConfig('app_selector_get')])) { +if (!empty($_GET['app'])) { // Set the application from string - $application = (string) $_GET[$cfg->readConfig('app_selector_get')]; + $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] == $cfg->readConfig('app_selector_get')) { + if ($app[0] == 'app') { // Application is valid! $application = trim($app[1]); } else { diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 869f4c2b24..fa9c771d9f 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -102,6 +102,11 @@ class ClassLoader { */ private $classCacheFQFN = ""; + /** + * Counter for loaded include files + */ + private $total = 0; + /** * The *public* constructor * @@ -236,7 +241,6 @@ class ClassLoader { // If the basePath is false it is invalid if ($basePath2 === false) { // TODO: Do not die here. - debug_print_backtrace(); die("Cannot read {$basePath} !"); } else { // Set base path @@ -307,6 +311,9 @@ class ClassLoader { // File is found so load it only once require($this->classes[$fileName]); + // Count this include + $this->total++; + // Developer mode excludes caching (better debugging) if (!defined('DEVELOPER')) { // Mark this class as loaded @@ -336,6 +343,15 @@ class ClassLoader { } // END - if } // END - foreach } + + /** + * Getter for total include counter + * + * @return $total Total loaded include files + */ + public final function getTotal () { + return $this->total; + } } // [EOF] diff --git a/inc/output.php b/inc/output.php index 4f07c30c79..35b9359f7d 100644 --- a/inc/output.php +++ b/inc/output.php @@ -6,7 +6,7 @@ * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.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 @@ -23,7 +23,7 @@ */ // Get a debugger instance -$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig('debug_engine')); +$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig('debug_class')); // Empty string should be ignored and used for testing the middleware DebugMiddleware::getInstance()->output("");