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
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
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
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
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
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
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
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
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
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
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
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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u>",
+ $filterInstance->__toString(),
+ $this->getLine(),
+ $this->getHexCode($code)
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* @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
$message = (string) $message;
$code = (int) $code;
- // make sure everything is assigned properly
+ // Make sure everything is assigned properly
parent::__construct($message, $code);
}
/**
* 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));
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown in a filter chain to stop processing further filters
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* @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
* @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
* @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
* @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
--- /dev/null
+<?php
+/**
+ * An exception thrown when a user instance is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> does not include a class with implemented interface <u>ManageableUser</u>.",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
*
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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
--- /dev/null
+<?php
+/**
+ * A class for mismatching passwords
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> 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]
+?>
* @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
* @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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for authorization methods
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface Authorizeable extends FrameworkInterface {
+ /**
+ * Destroy the authorization data
+ *
+ * @return void
+ */
+ function destroyAuthData();
+}
+
+//
+?>
/**
* An interface for classes which are "able" to cache
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
/**
*
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
* @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
* @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
* @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
* @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
/**
* An interface for criterias
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
/**
* An interface for local criterias
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
* @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
* @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
* @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
* @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
* @return void
* @throws SqlException If an SQL error occurs
*/
- function insertDataSet (StoreableCriteria $dataSetInstance);
+ function queryInsertDataSet (StoreableCriteria $dataSetInstance);
}
// [EOF]
* @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
* @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
* @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
* @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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper interface for logins
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+}
+
+//
+?>
* @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
* @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
* @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
* @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
* @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
/**
* An interface for user login classes
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
* 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);
}
//
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for news reader
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface ReadableNews extends FrameworkInterface {
+ /**
+ * Initializes the news reader class. This is very reader-dependent
+ *
+ * @return void
+ */
+ function initializeReader();
+}
+
+//
+?>
/**
* A class for user registration
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
/**
* An interface for registries
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
/**
* A class for registerable classes
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
* @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
* @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);
}
//
* @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
* @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
* @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
* @throws ResponseHeadersAlreadySentException Thrown if headers are
* already sent
*/
- function flushBuffer($force=false);
+ function flushBuffer ($force = false);
/**
* Adds a fatal message id to the response. The added messages can then be
* @return void
*/
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);
}
//
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for searchable results
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* @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
* @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
* @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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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);
}
//
* A general action class
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
*/
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());
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A cookie-bases authorization class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* A simple memory cache (similar to a registry)
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
* 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
/**
* The file I/O instance for the template loader
*/
- private $fileIOInstance = null;
+ private $fileIoInstance = null;
/***********************
* Exception codes.... *
$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')));
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
*
/**
* 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;
}
/**
}
// 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;
* @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;
}
* @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
/**
*
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @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
* @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
* @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
$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);
--- /dev/null
+<?php
+/**
+ * A command for the login area (member/gamer area)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* @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
$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);
* @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
$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');
}
/**
// 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;
}
* @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]
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Controller for login area with news
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* @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
* for looking in storages like the database.
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
* A helper class for cryptographical things like hashing passwords and so on
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
* @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
* @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
*/
abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject {
// Constants for exceptions
- const EXCEPTION_SQL_QUERY = 0xc00;
+ const EXCEPTION_SQL_QUERY = 0x050;
/**
* The limiter instance
* @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
* @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
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"
* @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 . '/';
* @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(),
* @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
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";
*/
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);
}
}
* @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
* @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
* @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
* @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
* @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
*/
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);
* @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);
}
* @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;
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for checking user permissions
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class RulesAcceptedFilter extends BaseFrameworkSystem implements Filterable {
+class RulesAcceptedFilter extends BaseFilter implements Filterable {
/**
* Protected constructor
*
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
// Add a message to the response
$responseInstance->addFatalMessage('rules_unchecked');
- // Abort here
+ // Skip further processing
return false;
}
}
--- /dev/null
+<?php
+/**
+ * A general filter class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
// Run all filters
//* DEBUG */ echo "COUNT=".count($this->filters)."<br />\n";
foreach ($this->filters as $filterInstance) {
- // Execute this filter
- //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.<br />\n";
+ // Try to execute this filter
+ try {
+ //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing started.<br />\n";
$filterInstance->execute($requestInstance, $responseInstance);
- //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.<br />\n";
- }
+ //* DEBUG */ echo "FILTER: ".$filterInstance->__toString().": Processing ended.<br />\n";
+ } catch (FilterChainException $e) {
+ // This exception can be thrown to just skip any further processing
+ break;
+ }
+ } // END - foreach
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A pre-filter for downloading news from a source. This can be a XML feed or
+ * the local database. You *can* register this filter as post filter but for
+ * output on web pages it makes no sense.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A post-filter for processing downloaded news. This will prepare the news fir
+ * output to the template engine.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class NullFilter extends BaseFrameworkSystem implements Filterable {
+class NullFilter extends BaseFilter implements Filterable {
/**
* Protected constructor
*
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class EmailValidatorFilter extends BaseFilter implements Filterable {
/**
* Protected constructor
*
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class PasswordValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class PasswordValidatorFilter extends BaseFilter implements Filterable {
/**
* Protected constructor
*
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class UserNameValidatorFilter extends BaseFilter implements Filterable {
/**
* Protected constructor
*
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general login helper class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
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
// Check wether we shall open or close the form
if ($this->formOpened === false) {
// Add HTML code
- $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s\" method=\"%s\" target=\"%s\"",
+ $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\"",
$formName,
+ $this->getConfigInstance()->readConfig('base_url'),
$this->getConfigInstance()->readConfig('form_action'),
$this->getConfigInstance()->readConfig('form_method'),
$this->getConfigInstance()->readConfig('form_target')
* @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
* @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
* @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
* @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
* @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
* @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
* @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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A default news reader class reads news from database layer
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
* A general registration class
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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
*/
*/
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');
}
/**
* A registry for several data types
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
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;
try {
if ($this->isRequestElementSet($element)) {
$value = $this->requestData[$element];
- }
+ } // END - if
} catch (MissingArrayElementsException $e) {
// Do nothing here
}
// Does this header exist?
if (isset($_SERVER[$name])) {
$headerValue = $_SERVER[$name];
- }
+ } // END - if
// Return the value
return $headerValue;
/**
* 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) {
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]
// 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');
// Still not found?
throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
}
- }
+ } // END - if
// Initiate the command
$commandInstance = ObjectFactory::createObjectByName($className, array($this));
}
/**
- * "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
$class = "WebDefaultController";
// Generate the class name
+ //* DEBUG: */ echo __METHOD__.": Command=".$commandName;
if ($commandName != $defaultCommand) {
// Create controller class name
$class = sprintf("Web%sController",
// No nes at "home" page
$class = "WebDefaultController";
}
+ //* DEBUG: */ echo ", controller=".$class."<br />\n";
// Is this class loaded?
if (!class_exists($class)) {
} // 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
*/
private $responseHeaders = array();
+ /**
+ * Cookies we shall sent out
+ */
+ private $cookies = array();
+
/**
* Body of the response
*/
* @param $output Output we shall sent in the HTTP response
* @return void
*/
- public function setReponseBody ($output) {
+ public function setResponseBody ($output) {
$this->responseBody = $output;
}
// 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?
}
// Clear response header and body
- $this->setReponseBody("");
+ $this->setResponseBody("");
$this->resetResponseHeaders();
}
// 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]
* A database result class
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class DatabaseResult extends BaseFrameworkSystem {
+class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, SeekableIterator {
/**
* Current position in array
*/
// 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];
// 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]
* A standard random number generator
*
* @author Roland Haeder <webmaster@ship-simu.org>
- * @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
* @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
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
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
* @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());
$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 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());
$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]
* @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
* @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
* @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
* @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);
}
}
* @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
* @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
$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;
* @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
*/
// 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();
// 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');
// 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");
$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
$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);
$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]
?>
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
/**
* 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) {
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]
*/
// CFG: DEFAULT-APPLICATION
-FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "hub");
-FrameworkConfiguration::getInstance()->setConfigEntry("app_name", "hub");
+FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "mxchange");
+FrameworkConfiguration::getInstance()->setConfigEntry("app_name", "mxchange");
// [EOF]
?>
* @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
* @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
* @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
*/
// Get the instance
-$io = ObjectFactory::createObjectByConfiguredName('file_io_handler');
+$io = ObjectFactory::createObjectByConfiguredName('file_io_class');
// [EOF]
?>
* @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
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 {
* @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
*/
private $classCacheFQFN = "";
+ /**
+ * Counter for loaded include files
+ */
+ private $total = 0;
+
/**
* The *public* constructor
*
// 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
// 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
} // END - if
} // END - foreach
}
+
+ /**
+ * Getter for total include counter
+ *
+ * @return $total Total loaded include files
+ */
+ public final function getTotal () {
+ return $this->total;
+ }
}
// [EOF]
* @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
*/
// 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("");