application/ship-simu/main/commands/.htaccess -text
application/ship-simu/main/commands/web/.htaccess -text
application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php -text
+application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php -text
application/ship-simu/main/companies/.htaccess -text
application/ship-simu/main/companies/class_ShippingCompany.php -text
application/ship-simu/main/constructions/.htaccess -text
application/ship-simu/templates/de/code/header.ctp -text
application/ship-simu/templates/de/code/home.ctp -text
application/ship-simu/templates/de/code/login_failed.ctp -text
-application/ship-simu/templates/de/code/register.ctp -text
+application/ship-simu/templates/de/code/login_form.ctp -text
+application/ship-simu/templates/de/code/register_form.ctp -text
application/ship-simu/templates/de/code/shipsimu_main.ctp -text
application/ship-simu/templates/de/html/.htaccess -text
application/ship-simu/templates/de/html/nav_advert.tpl -text
inc/classes/exceptions/main/class_NullPointerException.php -text
inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php -text
inc/classes/exceptions/main/class_VariableIsNotSetException.php -text
+inc/classes/exceptions/result/.htaccess -text
+inc/classes/exceptions/result/class_InvalidDatabaseResultException.php -text
inc/classes/exceptions/template/.htaccess -text
inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -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_WebLoginCommand.php -text
inc/classes/main/commands/web/class_WebLoginFailedCommand.php -text
inc/classes/main/commands/web/class_WebRegisterCommand.php -text
inc/classes/main/compressor/.htaccess -text
inc/classes/main/controller/default/.htaccess -text
inc/classes/main/controller/default/class_WebDefaultController.php -text
inc/classes/main/controller/default/class_WebDefaultNewsController.php -text
+inc/classes/main/controller/default/class_WebLoginController.php -text
inc/classes/main/controller/default/class_WebLoginFailedController.php -text
inc/classes/main/controller/form/.htaccess -text
inc/classes/main/controller/form/class_WebDoFormController.php -text
inc/classes/main/database/databases/.htaccess -text
inc/classes/main/database/databases/class_LocalFileDatabase.php -text
inc/classes/main/database/wrapper/.htaccess -text
+inc/classes/main/database/wrapper/class_NewsDatabaseWrapper.php -text
inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php -text
inc/classes/main/debug/.htaccess -text
inc/classes/main/debug/class_DebugConsoleOutput.php -text
inc/classes/main/filter/validator/class_EmailValidatorFilter.php -text
inc/classes/main/filter/validator/class_PasswordValidatorFilter.php -text
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php -text
+inc/classes/main/filter/verifier/.htaccess -text
+inc/classes/main/filter/verifier/class_EmailValidatorFilter.php -text
+inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php -text
inc/classes/main/helper/.htaccess -text
inc/classes/main/helper/class_ -text
inc/classes/main/helper/class_BaseHelper.php -text
$requestInstance = ObjectFactory::createObjectByName('HttpRequest');
// ... and a new response object
- $responseInstance = HttpResponse::createHttpResponse($this);
+ $responseInstance = ObjectFactory::createObjectByName('HttpResponse', array($this));
+
+ // Remember both in this application
+ $this->setRequestInstance($requestInstance);
+ $this->setResponseInstance($responseInstance);
// Get the parameter from the request
$commandName = $requestInstance->getRequestElement("page");
// CFG: DEFAULT-COMMAND
$cfg->setConfigEntry('default_command', "home");
-// CFG: HOME-WITH-NEWS
-$cfg->setConfigEntry('home_with_news', "Y");
+// CFG: PAGE-WITH-NEWS
+$cfg->setConfigEntry('page_with_news', "home");
// CFG: FORM-ACTION
$cfg->setConfigEntry('form_action', "index.php?app={?app_short_name?}&page=do_form");
// CFG: USER-AUTH-FILTER
$cfg->setConfigEntry('user_auth_class', "UserAuthFilter");
+// CFG: NEWS-HOME-LIMIT
+$cfg->setConfigEntry('news_home_limit', 10);
+
+// CFG: NEWS-LOGIN-AREA-LIMIT
+$cfg->setConfigEntry('news_login_area_limit', 15);
+
+// CFG: LOGIN-ENABLED
+$cfg->setConfigEntry('login_enabled', "Y");
+
+// CFG: LOGIN-DISABLED-REASON
+$cfg->setConfigEntry('login_disabled_reason', "Loginbereich befindet sich noch im Aufbau.");
+
+// CFG: LOGIN-TYPE
+$cfg->setConfigEntry('login_type', "username"); // username, email, both
+
+// CFG: GUEST-LOGIN-ALLOWED
+$cfg->setConfigEntry('guest_login_allowed', "Y");
+
+// CFG: GUEST-LOGIN-USERNAME
+$cfg->setConfigEntry('guest_login_username', "guest");
+
+// CFG: GUEST-LOGIN-PASSWORD
+$cfg->setConfigEntry('guest_login_password', "guest");
+
// [EOF]
?>
--- /dev/null
+<?php
+/**
+ * A command for user login
+ *
+ * @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 WebShipsimuUserLoginCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("User login handling command for Ship-Simu");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this command and sets the resolver instance
+ *
+ * @param $resolverInstance An instance of a command resolver
+ * @return $commandInstance The created command instance
+ */
+ public final static function createWebShipsimuUserLoginCommand (CommandResolver $resolverInstance) {
+ // Get a new instance
+ $commandInstance = new WebShipsimuUserLoginCommand();
+
+ // Set the resolver instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Get the controller instance from the resolver (breaks MVC pattern again)
+ $controllerInstance = $resolverInstance->getControllerInstance();
+
+ switch ($commandInstance->getConfigInstance()->readConfig('login_type')) {
+ case "username": // Login via username
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_class'));
+ break;
+
+ case "email": // Login via email
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_class'));
+ break;
+
+ default: // Wether username or email is set
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_class'));
+ break;
+ }
+ // @TODO Add more filters
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_class'));
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the 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) {
+ // First get a UserLogin instance
+ $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
+
+ // First set request and response instance
+ $loginInstance->setRequestInstance($requestInstance);
+
+ // Encrypt the password
+ $loginInstance->encryptPassword('pass');
+
+ // Do the login here
+ $loginInstance->doLogin($requestInstance, $responseInstance);
+
+ // Was the login fine? Then redirect here
+ if ($loginInstance->ifLoginWasSuccessfull()) {
+ // Try to redirect here
+ try {
+ $responseInstance->redirectToConfiguredUrl('app_login_url');
+ } catch (FrameworkException $e) {
+ // Something went wrong here!
+ $responseInstance->addFatalMessage($e->getMessage());
+ }
+ } else {
+ // Attach error message to the response
+ $responseInstance->addFatalMessage('failed_user_login');
+ }
+ }
+}
+
+// [EOF]
+?>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
+ /**
+ * The hashed password
+ */
+ private $hashedPassword = "";
+
/**
* Protected constructor
*
// Return the result
return $loginDone;
}
+
+ /**
+ * Encrypt the given request key or throw an exception if the key was not
+ * found in the request
+ *
+ * @param $requestKey Key in request class
+ * @return void
+ */
+ public function encryptPassword ($requestKey) {
+ // Check if the password is found in the request
+ if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
+ // So encrypt the password and store it for later usage in
+ // the request:
+
+ // Get the plain password
+ $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey);
+
+ // Get user instance
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Get a crypto helper and hash the password
+ $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashPassword($plainPassword, $userInstance->getPasswordHash());
+
+ // Store the hash back in the request
+ $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
+ } // END - if
+ }
}
// [EOF]
*/
private $authMethod = "";
- /**
- * Instance for a request class
- */
- private $requestInstance = null;
-
// Exception constants
const EXCEPTION_INVALID_USER_INSTANCE = 0x080;
$this->authMethod = $this->getConfigInstance()->readConfig('auth_method_class');
}
- /**
- * Setter for request instance
- *
- * @param $requestInstance A Requestable class instance
- * @return void
- */
- public final function setRequestInstance (Requestable $requestInstance) {
- $this->requestInstance = $requestInstance;
- }
-
- /**
- * Getter for request instance
- *
- * @param
- * @return $requestInstance A Requestable class instance
- */
- public final function getRequestInstance () {
- return $this->requestInstance;
- }
-
/**
* Execute the login request by given response instance. This instance can
* be used for sending cookies or at least the session id out.
$loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance));
// Set user cookie
- $loginInstance->setUserAuth($this->requestInstance->getRequestElement('username'));
+ $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username'));
// Set password cookie
- $loginInstance->setPasswordAuth($this->requestInstance->getRequestElement('pass_hash'));
+ $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash'));
// Remember this login instance for later usage
Registry::getRegistry()->addInstance('login', $loginInstance);
--- /dev/null
+<?php
+// Get helper instance for web forms. This will add the opening form-tag to
+// the helper's render cache which is simply a small variable in the class
+// BaseHelper.
+$helper = WebFormHelper::createWebFormHelper($this, "shipsimu_user_login");
+
+// Formular deaktiviert?
+if ($helper->ifLoginIsEnabled()) {
+ // Formular ist aktiv
+ $helper->addFormGroup("login", "Gebe hier deine Logindaten ein:");
+
+ // Welches Loginverfahren wurde konfiguriert?
+ if ($helper->ifLoginWithUsername()) {
+ // Login mit Username
+ $helper->addFormSubGroup("username", "Bitte mit deinem Nickname einloggen.");
+ $helper->addFieldText("username", "Dein Nickname:");
+ $helper->addInputTextField("username");
+ } elseif ($helper->ifLoginWithEmail()) {
+ // Login mit Email
+ $helper->addFormSubGroup("email", "Bitte mit deiner Email-Adresse einloggen.");
+ $helper->addFieldText("email", "Deine Email-Addresse:");
+ $helper->addInputTextField("email");
+ } else {
+ // Login mit Email/Username
+ $helper->addFormSubGroup("user_email", "Bitte mit deinem Nickname oder Email-Adresse einloggen.");
+ $helper->addFieldText("user_email", "Dein Nickname/Email:");
+ $helper->addInputTextField("user_email");
+ }
+
+ $helper->addFormSubGroup("pass", "Gebe dein Passwort von der Anmeldung ein.");
+ $helper->addFieldText("pass", "Dein Passwort:");
+ $helper->addInputPasswordField("pass");
+ $helper->addFormGroup("buttons", "Alles richtig eingegeben?");
+ $helper->addInputResetButton("Formular leeren");
+ $helper->addInputSubmitButton("Zum Spiel einloggen");
+} else {
+ // Formular deaktiviert
+ $helper->addFormNote("Einloggen in's Spiel ist derzeit administrativ deaktiviert worden. Bitte komme später noch mal wieder.");
+ $helper->addFormNote("Nachricht vom Admin: <span id=\"disabled_reason\">".$this->getConfigInstance()->readConfig('login_disabled_reason')."</span>");
+}
+
+// Formular schliessen
+$helper->addFormTag();
+$helper->flushContent();
+
+// Ist Gastlogin erlaubt?
+if ($helper->ifGuestLoginAllowed()) {
+ // Neue Helper-Instanz holen
+ $helper = WebFormHelper::createWebFormHelper($this, "shipsimu_guest_login");
+ $helper->addInputHiddenField("username", $this->getConfigInstance()->readConfig('guest_login_username'));
+ $helper->addInputHiddenField("password", $this->getConfigInstance()->readConfig('guest_login_password'));
+ $helper->addFormGroup("buttons", "Gastlogins sind in der Funkionsweise eingeschränkt. Mehr dazu unter "Gastlogin".");
+ $helper->addInputSubmitButton("Als Gast einloggen");
+ $helper->addFormTag();
+ $helper->flushContent();
+}
+
+?>
+<div id="content_header">
+ Einloggen zu <span class="app_name">{?app_full_name?}</span>
+</div>
+
+<div id="login_box">
+ {?shipsimu_user_login?}
+</div>
+
+<div id="guest_login">
+ {?shipsimu_guest_login?}
+</div>
+++ /dev/null
-<?php
-// Get helper instance for web forms. This will add the opening form-tag to
-// the helper's render cache which is simply a small variable in the class
-// BaseHelper.
-$helper = WebFormHelper::createWebFormHelper($this, "shipsimu_register");
-
-// Nickname und Passwort sollten immer abgefragt werden, die Email als Loginname
-// wuerde aber auch gehen.
-$helper->addFormGroup("login", "Bitte gebe hier gewünschten Nickname und dein Zugangspasswort ein.");
-$helper->addFormSubGroup("username", "Dein Nickname wird erst nach Absenden des Formulares geprüft. Später bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
-$helper->addFieldText("username", "Nickname im Spiel:");
-$helper->addInputTextField("username");
-$helper->addFormSubGroup("password", "Dein Passwort sollte nicht zu leicht erratbar sein. Später bauen wir hier noch einen automatischen Test ein, der dir sofort die Passwortstärke anzeigt.");
-$helper->addFieldText("pass1", "Passwort:");
-$helper->addInputPasswordField("pass1");
-$helper->addFieldText("pass2", "Passwortwiederholung:");
-$helper->addInputPasswordField("pass2");
-
-if ($helper->ifRegisterRequiresEmailVerification()) {
- $helper->addFormGroup("email", "Bitte gebe deine Email zweimal (ein zweites Mal zur Bestätigung) ein, damit wir dir deinen Freischaltlink zusenden können.");
- $helper->addFieldText("email1", "Email-Adresse:");
- $helper->addInputTextField("email1");
- $helper->addFieldText("email2", "Wiederholung Email-Adresse:");
- $helper->addInputTextField("email2");
- if ($helper->ifEmailMustBeUnique()) {
- $helper->addFormNote("Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
- } // END - Unique email addresses
-} // END - email verification
-
-if ($helper->ifRegisterIncludesProfile()) {
- $helper->addFormGroup("profile", "Hier kannst du zusätzlich deine Profildaten vorweg eingeben, du kannst sie aber auch nach dem Login vervollständigen!");
- if (!$helper->ifRegisterRequiresEmailVerification()) {
- $helper->addFormSubGroup("email", "Die Angabe deiner Email-Adresse ist nur dann nötig, wenn du auch Email-Benachrichtigungen (<span id=\"add_note\">*1</span>) haben möchtest.");
- $helper->addFieldText("email1", "Email-Adresse:");
- $helper->addInputTextField("email1");
- } // END - No email verification
-
- // Persoenliche Daten mit in der Anmeldung abfragen?
- if ($helper->ifRegisterIncludesPersonaData()) {
- $helper->addFormSubGroup("persona", "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen.");
- $helper->addFieldText("surname", "Dein Vorname:");
- $helper->addInputTextField("surname");
- $helper->addFieldText("family", "Dein Nachname:");
- $helper->addInputTextField("family");
- $helper->addFieldText("street", "Strasse und Hausnummer:");
- $helper->addInputTextField("street");
- $helper->addFieldText("city", "Wohnort:");
- $helper->addInputTextField("city");
- } // END - Persona data
-
- $helper->addFormSubGroup("zip", "Magst du uns auch deine Postleitzahl verraten?");
- $helper->addFieldText("zip", "Postleitzahl:");
- $helper->addInputTextField("zip");
-
- $helper->addFormSubGroup("chat", "Gebe hier deine Nicknames bzw. Nummern an:");
- if ($helper->ifChatEnabled("icq")) {
- $helper->addFieldText("icq", "ICQ-Nummer:");
- $helper->addInputTextField("icq");
- }
- if ($helper->ifChatEnabled("jabber")) {
- $helper->addFieldText("jabber", "Jabber:");
- $helper->addInputTextField("jabber");
- }
- if ($helper->ifChatEnabled("yahoo")) {
- $helper->addFieldText("yahoo", "Yahoo!:");
- $helper->addInputTextField("yahoo");
- }
- if ($helper->ifChatEnabled("aol")) {
- $helper->addFieldText("aol", "AOL-Screenname:");
- $helper->addInputTextField("aol");
- }
- if ($helper->ifChatEnabled("msn")) {
- $helper->addFieldText("msn", "MSN:");
- $helper->addInputTextField("msn");
- }
-
- if (!$helper->ifRegisterRequiresEmailVerification()) {
- $helper->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
- } // END - Extra note
-} // END - ask profile data
-
-// Spielregeln abfragen
-$helper->addFormGroup("rules", "Bitte lese dir die Spieleregeln gut durch und kreuze dann "Ja, ich akzeptiere die aktuellen Spielregeln" an.");
-$helper->addFieldText("rules", "Ja, ich akzeptiere die aktuellen Spielregeln:");
-$helper->addInputCheckboxField("rules", false);
-
-// Abschliessender Hinweis und Abschluss des Formulars
-$helper->addFormGroup("buttons", "Wenn du alle benötigten Felder korrekt ausgefüt hast, kannst du die Anmeldung abschliessen.");
-$helper->addInputResetButton("Alles nochmal eingeben");
-$helper->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
-$helper->addFormNote("Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
-$helper->addFormTag();
-$helper->flushContent();
-?>
-<div id="content_header">
- Anmeldung bei <span class="app_name">{?app_full_name?}</span>
-</div>
-
-<div id="register_box">
- {?shipsimu_register?}
-</div>
--- /dev/null
+<?php
+// Get helper instance for web forms. This will add the opening form-tag to
+// the helper's render cache which is simply a small variable in the class
+// BaseHelper.
+$helper = WebFormHelper::createWebFormHelper($this, "shipsimu_register");
+
+// Nickname und Passwort sollten immer abgefragt werden, die Email als Loginname
+// wuerde aber auch gehen.
+$helper->addFormGroup("login", "Bitte gebe hier gewünschten Nickname und dein Zugangspasswort ein.");
+$helper->addFormSubGroup("username", "Dein Nickname wird erst nach Absenden des Formulares geprüft. Später bauen wir dann einen automatischen Test ein, der dir sofort zeigt, ob der Nickname bereits vergeben ist.");
+$helper->addFieldText("username", "Nickname im Spiel:");
+$helper->addInputTextField("username");
+$helper->addFormSubGroup("password", "Dein Passwort sollte nicht zu leicht erratbar sein. Später bauen wir hier noch einen automatischen Test ein, der dir sofort die Passwortstärke anzeigt.");
+$helper->addFieldText("pass1", "Passwort:");
+$helper->addInputPasswordField("pass1");
+$helper->addFieldText("pass2", "Passwortwiederholung:");
+$helper->addInputPasswordField("pass2");
+
+if ($helper->ifRegisterRequiresEmailVerification()) {
+ $helper->addFormGroup("email", "Bitte gebe deine Email zweimal (ein zweites Mal zur Bestätigung) ein, damit wir dir deinen Freischaltlink zusenden können.");
+ $helper->addFieldText("email1", "Email-Adresse:");
+ $helper->addInputTextField("email1");
+ $helper->addFieldText("email2", "Wiederholung Email-Adresse:");
+ $helper->addInputTextField("email2");
+ if ($helper->ifEmailMustBeUnique()) {
+ $helper->addFormNote("Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein.");
+ } // END - Unique email addresses
+} // END - email verification
+
+if ($helper->ifRegisterIncludesProfile()) {
+ $helper->addFormGroup("profile", "Hier kannst du zusätzlich deine Profildaten vorweg eingeben, du kannst sie aber auch nach dem Login vervollständigen!");
+ if (!$helper->ifRegisterRequiresEmailVerification()) {
+ $helper->addFormSubGroup("email", "Die Angabe deiner Email-Adresse ist nur dann nötig, wenn du auch Email-Benachrichtigungen (<span id=\"add_note\">*1</span>) haben möchtest.");
+ $helper->addFieldText("email1", "Email-Adresse:");
+ $helper->addInputTextField("email1");
+ } // END - No email verification
+
+ // Persoenliche Daten mit in der Anmeldung abfragen?
+ if ($helper->ifRegisterIncludesPersonaData()) {
+ $helper->addFormSubGroup("persona", "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen.");
+ $helper->addFieldText("surname", "Dein Vorname:");
+ $helper->addInputTextField("surname");
+ $helper->addFieldText("family", "Dein Nachname:");
+ $helper->addInputTextField("family");
+ $helper->addFieldText("street", "Strasse und Hausnummer:");
+ $helper->addInputTextField("street");
+ $helper->addFieldText("city", "Wohnort:");
+ $helper->addInputTextField("city");
+ } // END - Persona data
+
+ $helper->addFormSubGroup("zip", "Magst du uns auch deine Postleitzahl verraten?");
+ $helper->addFieldText("zip", "Postleitzahl:");
+ $helper->addInputTextField("zip");
+
+ $helper->addFormSubGroup("chat", "Gebe hier deine Nicknames bzw. Nummern an:");
+ if ($helper->ifChatEnabled("icq")) {
+ $helper->addFieldText("icq", "ICQ-Nummer:");
+ $helper->addInputTextField("icq");
+ }
+ if ($helper->ifChatEnabled("jabber")) {
+ $helper->addFieldText("jabber", "Jabber:");
+ $helper->addInputTextField("jabber");
+ }
+ if ($helper->ifChatEnabled("yahoo")) {
+ $helper->addFieldText("yahoo", "Yahoo!:");
+ $helper->addInputTextField("yahoo");
+ }
+ if ($helper->ifChatEnabled("aol")) {
+ $helper->addFieldText("aol", "AOL-Screenname:");
+ $helper->addInputTextField("aol");
+ }
+ if ($helper->ifChatEnabled("msn")) {
+ $helper->addFieldText("msn", "MSN:");
+ $helper->addInputTextField("msn");
+ }
+
+ if (!$helper->ifRegisterRequiresEmailVerification()) {
+ $helper->addFormExtraNote(1, "Die Benachrichtigungen per sind im Loginbereich verfeinerbar, welche du genau haben willst.");
+ } // END - Extra note
+} // END - ask profile data
+
+// Spielregeln abfragen
+$helper->addFormGroup("rules", "Bitte lese dir die Spieleregeln gut durch und kreuze dann "Ja, ich akzeptiere die aktuellen Spielregeln" an.");
+$helper->addFieldText("rules", "Ja, ich akzeptiere die aktuellen Spielregeln:");
+$helper->addInputCheckboxField("rules", false);
+
+// Abschliessender Hinweis und Abschluss des Formulars
+$helper->addFormGroup("buttons", "Wenn du alle benötigten Felder korrekt ausgefüt hast, kannst du die Anmeldung abschliessen.");
+$helper->addInputResetButton("Alles nochmal eingeben");
+$helper->addInputSubmitButton("Anmeldung zum Spiel abschliessen");
+$helper->addFormNote("Deine Daten werden nach den gültigen Datenschutzgesetzten gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz".");
+$helper->addFormTag();
+$helper->flushContent();
+?>
+<div id="content_header">
+ Anmeldung bei <span class="app_name">{?app_full_name?}</span>
+</div>
+
+<div id="register_box">
+ {?shipsimu_register?}
+</div>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown if a database result does not contain expected entries
+ *
+ * @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 InvalidDatabaseResultException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Construct the message
+ $message = sprintf("[%s:%d] Database instance <u>%s</u> contains invalid entries.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]->__toString()
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*/
function assignVariable ($var, $value);
- /**
- * Assign a configuration variables for templates
- *
- * @param $var The configuration "variable" we want to assign
- * @param $value The value we want to store in the variable
- * @return void
- */
- function assignConfigVariable ($var, $value);
-
/**
* Load a specified web template into the engine
*
- * @param $template The web template we shall load which is
- * located in "html" by default
+ * @param $template The web template we shall load which is located in
+ * "html" by default
* @return void
*/
function loadWebTemplate ($template);
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $title = ucfirst($requestInstance->getRequestElement("page"));
- if (empty($title)) $title = "Home";
- $templateInstance->assignVariable('title', $title);
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_home_title'));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
$action = sprintf("login_%s", $actReq);
} // END - if
- // TODO Do the action somewhere here
+ // @TODO Do the action somewhere here
// Load the matching template
$templateInstance->loadCodeTemplate($action);
--- /dev/null
+<?php
+/**
+ * A command for the login form
+ *
+ * @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 WebLoginCommand 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 createWebLoginCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLoginCommand();
+
+ // 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) {
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateEngine($appInstance);
+
+ // Assign application data with template engine
+ $templateInstance->assignApplicationData($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");
+
+ // Load the home template
+ $templateInstance->loadCodeTemplate("login_form");
+
+ // Assign the home template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable("login_form", "content");
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_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]
+?>
$templateInstance->assignTemplateWithVariable("footer", "footer");
// Load the register template
- $templateInstance->loadCodeTemplate("register");
+ $templateInstance->loadCodeTemplate("register_form");
// Assign the register template with the master template as a content ... ;)
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("register", "content");
+ $templateInstance->assignTemplateWithVariable("register_form", "content");
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $title = ucfirst($requestInstance->getRequestElement("page"));
- if (empty($title)) $title = "Register";
- $templateInstance->assignVariable('title', $title);
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_register_title'));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
* @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @todo This controller shall still provide some headlines for sidebars
*
* This 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
+/**
+ * Controller for login form with password reminder and maybe enabled
+ * "guest-login" button
+ *
+ * @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 WebLoginController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Controller for login form");
+
+ // 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 createWebLoginController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebLoginController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // @TODO Add some filters to this controller
+
+ // 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]
+?>
}
// Hash the password with salt
+ //* DEBUG: */ echo $salt."/".$plainPassword."/".$this->rngInstance->getExtraSalt()."<br />\n";
$hashed = $salt . md5(sprintf($this->getConfigInstance()->readConfig('hash_mask'),
$salt,
$this->rngInstance->getExtraSalt(),
--- /dev/null
+<?php
+/**
+ * A database wrapper for news classes
+ *
+ * @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
+ * @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 NewsDatabaseWrapper extends BaseDatabaseWrapper {
+ /**
+ * Cache instance
+ */
+ private $cacheInstance = null;
+
+ // Constants for exceptions
+ const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x070;
+
+ // Constants for database columns
+
+ // Constants for database table names
+ const DB_TABLE_NEWS = "news";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct() {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Database wrapper for user objects");
+
+ // Create unique ID number
+ $this->generateUniqueId();
+ }
+
+ /**
+ * Creates an instance of this database wrapper by a provided user class
+ *
+ * @return $wrapperInstance An instance of the created wrapper class
+ */
+ public final static function createNewsDatabaseWrapper () {
+ // Get a new instance
+ $wrapperInstance = new NewsDatabaseWrapper();
+
+ // Initialize the cache instance
+ $wrapperInstance->initCacheInstance();
+
+ // Return the instance
+ return $wrapperInstance;
+ }
+
+ /**
+ * Initializes the cache instance with a new object
+ *
+ * @return void
+ */
+ protected function initCacheInstance () {
+ // Set the new instance
+ $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache();
+ }
+
+ /**
+ * Do a "select" query on the user table with the given search criteria and
+ * store it in cache for later usage
+ *
+ * @param $criteriaInstance An instance of a Criteria class
+ * @return $resultInstance An instance of a database result class
+ */
+ public function doSelectByCriteria (Criteria $criteriaInstance) {
+ // First get a key suitable for our cache and extend it with this class name
+ $cacheKey = sprintf("%s@%s",
+ $this->__toString(),
+ $criteriaInstance->getCacheKey()
+ );
+
+ // Does this key exists in cache?
+ if ($this->cacheInstance->offsetExists($cacheKey)) {
+ // Then use this result
+ $result = $cacheInstance->offsetGet($cacheKey);
+ } else {
+ // Now it's time to ask the database layer for this select statement
+ $result = $this->getDatabaseInstance()->doSelectByTableCriteria(self::DB_TABLE_NEWS, $criteriaInstance);
+
+ // Cache the result if not null
+ if (!is_null($result)) {
+ // A valid result has returned from the database layer
+ $this->cacheInstance->offsetSet($cacheKey, $result);
+ } else {
+ // This invalid result must be wrapped
+ $result = array(
+ 'status' => "invalid",
+ 'exception' => $this->getDatabaseInstance()->getLastException()
+ );
+ }
+ }
+
+ // Create an instance of a DatabaseResult class with the given result
+ $resultInstance = DatabaseResult::createDatabaseResult($result);
+
+ // And return the instance
+ return $resultInstance;
+ }
+}
+
+// [EOF]
+?>
// Get a news instance
$newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance);
- // TODO Need to extend/rewrite this
- $this->partialStub("Unfinished work.");
+ // Store the news instance in registry
+ Registry::getRegistry()->addInstance('news', $newsInstance);
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating the email address. This filter may intercept
+ * the filter chain if no email address is given or if the supplied email has an
+ * invalid form. It could also intercept the filter chain if the email address
+ * is already used by some one if configuration requires this.
+ *
+ * @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 EmailValidatorFilter 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 Email validation");
+
+ // 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 createEmailValidatorFilter () {
+ // Get a new instance
+ $filterInstance = new EmailValidatorFilter();
+
+ // 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 Email from request
+ $email = $requestInstance->getRequestElement('email');
+
+ // Is the Email set?
+ if ((is_null($email)) || ($this->getConfigInstance()->readConfig('register_email_unique') == "Y")) {
+ // Try it again
+ $email1 = $requestInstance->getRequestElement('email1');
+ $email2 = $requestInstance->getRequestElement('email2');
+
+ // Is the email still not set?
+ if ((is_null($email1)) || (is_null($email2))) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('email_unset');
+
+ // Abort here
+ return false;
+ } elseif ((empty($email1)) || (empty($email2))) {
+ // Email is empty
+ $requestInstance->requestIsValid(false);
+
+ // Is the email empty?
+ if (empty($email1)) {
+ // Add a message to the response
+ $responseInstance->addFatalMessage('email1_empty');
+ } // END - if
+
+ // Is the confirmation empty?
+ if (empty($email2)) {
+ // Add a message to the response
+ $responseInstance->addFatalMessage('email2_empty');
+ } // END - if
+
+ // Abort here
+ return false;
+ } elseif ($this->ifEmailIsTaken($email1)) {
+ // Email is already taken
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('email_taken');
+
+ // Abort here
+ return false;
+ } elseif ($email1 != $email2) {
+ // Emails didn't match
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('emails_mismatch');
+
+ // Abort here
+ return false;
+ } // END - elseif
+ } elseif (empty($email)) {
+ // Empty field!
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('email_empty');
+
+ // Abort here
+ return false;
+ } // END - elseif
+ }
+
+ /**
+ * Check wether the email as already been taken
+ *
+ * @param $email Email to check for existence
+ * @return $alreadyTaken Wether the email has been taken
+ */
+ private function ifEmailIsTaken ($email) {
+ // Default is already taken
+ $alreadyTaken = true;
+
+ // Initialize instance
+ $userInstance = null;
+
+ // Get a registry instance
+ $registry = Registry::getRegistry();
+
+ // Is the user already there?
+ if ($registry->instanceExists('user')) {
+ // Use the instance for checking for the email
+ $userInstance = $registry->getInstance('user');
+ $userInstance->setEmailAddress($email);
+ } else {
+ // If this instance is created then the username *does* exist
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByEmail"), array($email));
+
+ // Remember this user instance in our registry for later usage
+ $registry->addInstance('user', $userInstance);
+ }
+
+ // Does the email exist?
+ if (!$userInstance->ifEmailAddressExists()) {
+ // This email has not being used yet
+ $alreadyTaken = false;
+ }
+
+ // Return the result
+ return $alreadyTaken;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating the password. This filter may intercept
+ * the filter chain if no password is given or the password 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 PasswordVerifierFilter 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 password verification");
+
+ // 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 createPasswordVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new PasswordVerifierFilter();
+
+ // 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 password
+ $password = $requestInstance->getRequestElement('pass');
+
+ // Is the password still not set?
+ if (is_null($password)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('password_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($password)) {
+ // Password is empty
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('password_empty');
+
+ // Abort here
+ return false;
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for verfying the username. This filter may intercept the
+ * filter chain if no username is given or if the supplied username has an
+ * invalid form. It could also intercept the filter chain if the username was
+ * not found.
+ *
+ * @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 UserNameVerifierFilter 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 username verification");
+
+ // 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 createUserNameVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new UserNameVerifierFilter();
+
+ // 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 username from request
+ $userName = $requestInstance->getRequestElement('username');
+
+ // Is the username set?
+ if (is_null($userName)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($userName)) {
+ // Empty field!
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_empty');
+
+ // Abort here
+ return false;
+ } elseif (!$this->ifUserNameIsTaken($userName)) {
+ // Username is already taken
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_not_found');
+
+ // Abort here
+ return false;
+ }
+ }
+
+ /**
+ * Check wether the username as already been taken
+ *
+ * @param $userName Username to check for existence
+ * @return $alreadyTaken Wether the username has been taken
+ */
+ private function ifUserNameIsTaken ($userName) {
+ // Default is already taken
+ $alreadyTaken = true;
+
+ // Initialize instance
+ $userInstance = null;
+
+ // Get a registry instance
+ $registry = Registry::getRegistry();
+
+ // Is the user already there?
+ if ($registry->instanceExists('user')) {
+ // Use the instance for checking for the email
+ $userInstance = $registry->getInstance('user');
+ $userInstance->setUserName($userName);
+ } else {
+ // If this instance is created then the username *does* exist
+ try {
+ // Get a new instance
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByUsername"), array($userName));
+
+ // Remember this user instance in our registry for later usage
+ $registry->addInstance('user', $userInstance);
+ } catch (UsernameMissingException $e) {
+ // User was not found
+ }
+ }
+
+ // Does the username exist?
+ if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
+ // This username is still available
+ $alreadyTaken = false;
+ }
+
+ // Return the result
+ return $alreadyTaken;
+ }
+}
+
+// [EOF]
+?>
return $required;
}
+ /**
+ * Checks wether login is enabled or disabled
+ *
+ * @return $isEnabled Wether the login is enabled or disabled
+ */
+ public function ifLoginIsEnabled () {
+ $isEnabled = ($this->getConfigInstance()->readConfig('login_enabled') == "Y");
+ return $isEnabled;
+ }
+
+ /**
+ * Checks wether login shall be done by username
+ *
+ * @return $isEnabled Wether the login shall be done by username
+ */
+ public function ifLoginWithUsername () {
+ $isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "username");
+ return $isEnabled;
+ }
+
+ /**
+ * Checks wether login shall be done by email
+ *
+ * @return $isEnabled Wether the login shall be done by email
+ */
+ public function ifLoginWithEmail () {
+ $isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "email");
+ return $isEnabled;
+ }
+
+ /**
+ * Checks wether guest login is allowed
+ *
+ * @return $isAllowed Wether guest login is allowed
+ */
+ public function ifGuestLoginAllowed () {
+ $isAllowed = ($this->getConfigInstance()->readConfig('guest_login_allowed') == "Y");
+ return $isAllowed;
+ }
+
/**
* Flushs the content out (not yet secured against open forms, etc.!) or
* throw an exception if it is not yet closed
* 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 {
+class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
+ /**
+ * Result set with news
+ */
+ private $resultInstance = null;
+
/**
* Protected constructor
*
* @return void
*/
public function initializeReader () {
- // TODO Need to implement this method
+ // Get "page" for saving some calls
+ $page = $this->getRequestInstance()->getRequestElement('page');
+
+ // First get a wrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class');
+
+ // Next create a searchable criteria instance
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add the page as criteria to it at lease
+ $criteriaInstance->addCriteria('page', $page);
+
+ // Add limitation from config
+ $criteriaInstance->setLimit($this->getConfigInstance()->readConfig("news_{$page}_limit"));
+
+ // Get a resultInstance back from the database
+ $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Save that resultInstance in this class
+ $this->resultInstance = $resultInstance;
}
}
*/
protected function executePostFilters () {
// Execute all post filters
- $this->postRegistrationFilter->processFilters($this->requestInstance, $this->responseInstance);
+ $this->postRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
}
}
$class = sprintf("Web%sController",
$this->convertToClassName($commandName)
);
- } elseif ($this->getConfigInstance()->readConfig('home_with_news') == "Y") {
+ } elseif ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
// Yes, display news in home then set default controller with news
$class = "WebDefaultNewsController";
} else {
- // No nes at "home" page
+ // No news at "home" page or non-news page
$class = "WebDefaultController";
}
//* DEBUG: */ echo ", controller=".$class."<br />\n";
$domain = $this->getConfigInstance()->readConfig('cookie_domain');
setcookie($cookieName, $cookieValue, $expires);
- // TODO Why are these parameters conflicting?
+ // @TODO Why are these parameters conflicting?
//, $path, $domain, (isset($_SERVER['HTTPS']))
return;
- // TODO This will send only one cookie out, the first one.
+ // @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?
+ // @TODO Why are these parameters conflicting?
// $cookieString .= "; path=".$path."; domain=".$domain;
// Set the cookie as a header
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, SeekableIterator {
+ // Exception constants
+ const EXCEPTION_INVALID_DATABASE_RESULT = 0x0b0;
+
/**
* Current position in array
*/
* @return void
*/
public function rewind () {
- $this->currentPos = 0;
+ $this->currentPos = -1;
}
/**
// Set the server IP to cluster
$serverIp = "cluster";
+
// Do we have a single server?
if ($this->getConfigInstance()->readConfig('is_single_server') == "Y") {
// Then use that IP for extra security
}
// One-way data we need for "extra-salting" the random number
- // @TODO Add site for stronger salt!
+ // @TODO Add site key for stronger salt!
$this->extraSalt = sha1($serverIp . ":" . getenv('SERVER_SOFTWARE') . ":" . $this->getConfigInstance()->readConfig('date_key') . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
// Get config entry for max salt length
}
}
+ /**
+ * Setter for template type. Only "html", "emails" and "compiled" should
+ * be sent here
+ *
+ * @param $templateType The current template's type
+ * @return void
+ */
+ private final function setTemplateType ($templateType) {
+ // Cast it
+ $templateType = (string) $templateType;
+
+ // And set it (only 2 letters)
+ $this->templateType = $templateType;
+ }
+
+ /**
+ * Setter for the last loaded template's FQFN
+ *
+ * @param $template The last loaded template
+ * @return void
+ */
+ private final function setLastTemplate ($template) {
+ // Cast it to string
+ $template = (string) $template;
+ $this->lastTemplate = $template;
+ }
+
+ /**
+ * Getter for the last loaded template's FQFN
+ *
+ * @return $template The last loaded template
+ */
+ private final function getLastTemplate () {
+ return $this->lastTemplate;
+ }
+
+ /**
+ * Assign a given congfiguration variable with a value
+ *
+ * @param $var The configuration variable we want to assign
+ * @return void
+ */
+ private final function assignConfigVariable ($var) {
+ // Sweet and simple...
+ $this->configVariables[$var] = $this->getConfigInstance()->readConfig($var);
+ }
+
/**
* Initialize the variable stack. This holds all variables for later
* compilation.
/**
* Setter for path of compiled templates
*
- * @param $compileOutputPath The local base path for all
- * compiled templates
+ * @param $compileOutputPath The local base path for all compiled
+ * templates
* @return void
*/
public final function setCompileOutputPath ($compileOutputPath) {
$this->compileOutputPath = $compileOutputPath;
}
- /**
- * Setter for template type. Only "html", "emails" and "compiled" should
- * be sent here
- *
- * @param $templateType The current template's type
- * @return void
- */
- private final function setTemplateType ($templateType) {
- // Cast it
- $templateType = (string) $templateType;
-
- // And set it (only 2 letters)
- $this->templateType = $templateType;
- }
-
/**
* Getter for template type
*
return $this->templateType;
}
- /**
- * Setter for the last loaded template's FQFN
- *
- * @param $template The last loaded template
- * @return void
- */
- private final function setLastTemplate ($template) {
- // Cast it to string
- $template = (string) $template;
- $this->lastTemplate = $template;
- }
-
- /**
- * Getter for the last loaded template's FQFN
- *
- * @return $template The last loaded template
- */
- private final function getLastTemplate () {
- return $this->lastTemplate;
- }
-
/**
* Assign (add) a given variable with a value
*
- * @param $var The variable we are looking for
- * @param $value The value we want to store in the variable
+ * @param $var The variable we are looking for
+ * @param $value The value we want to store in the variable
* @return void
*/
public final function assignVariable ($var, $value) {
}
}
- /**
- * Assign a given congfiguration variable with a value
- *
- * @param $var The configuration variable we are looking for
- * @param $value The value we want to store in the variable
- * @return void
- */
- public final function assignConfigVariable ($var, $value) {
- // Sweet and simple...
- $this->configVariables[$var] = $value;
- }
-
/**
* Removes a given variable
*
- * @param $var The variable we are looking for
+ * @param $var The variable we are looking for
* @return void
*/
public final function removeVariable ($var) {
/**
* Private setter for raw template data
*
- * @param $rawTemplateData The raw data from the template
+ * @param $rawTemplateData The raw data from the template
* @return void
*/
private final function setRawTemplateData ($rawTemplateData) {
/**
* Private setter for compiled templates
+ *
+ * @return void
*/
private final function setCompiledData ($compiledData) {
// Cast it to string
/**
* Private loader for all template types
*
- * @param $template The template we shall load
+ * @param $template The template we shall load
* @return void
*/
private final function loadTemplate ($template) {
/**
* A private loader for raw template names
*
- * @param $fqfn The full-qualified file name for a template
+ * @param $fqfn The full-qualified file name for a template
* @return void
* @throws NullPointerException If $inputInstance is null
* @throws NoObjectException If $inputInstance is not an object
* @throws MissingMethodException If $inputInstance is missing a
- * required method
+ * required method
*/
private function loadRawTemplateData ($fqfn) {
// Get a input/output instance from the middleware
* Try to assign an extracted template variable as a "content" or "config"
* variable.
*
- * @param $varName The variable's name (shall be content or
- * config) by default
- * @param $var The variable we want to assign
+ * @param $varName The variable's name (shall be content orconfig) by
+ * default
+ * @param $var The variable we want to assign
*/
private function assignTemplateVariable ($varName, $var) {
// Is it not a config variable?
$this->assignVariable($var, "");
} else {
// Configuration variables
- $this->assignConfigVariable($var, $this->getConfigInstance()->readConfig($var));
+ $this->assignConfigVariable($var);
}
}
/**
* Main analysis of the loaded template
*
- * @param $templateMatches Found template place-holders, see below
+ * @param $templateMatches Found template place-holders, see below
* @return void
*
*---------------------------------
/**
* Compile a given raw template code and remember it for later usage
*
- * @param $code The raw template code
- * @param $template The template's name
+ * @param $code The raw template code
+ * @param $template The template's name
* @return void
*/
private function compileCode ($code, $template) {
* Insert all given and loaded templates by running through all loaded
* codes and searching for their place-holder in the main template
*
- * @param $templateMatches See method analyzeTemplate()
+ * @param $templateMatches See method analyzeTemplate()
* @return void
*/
private function insertAllTemplates (array $templateMatches) {
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class User extends BaseFrameworkSystem implements ManageableUser, Registerable {
+ /**
+ * Instance of the database result
+ */
+ private $resultInstance = null;
+
/**
* Username of current user
*/
return $userInstance;
}
+ /**
+ * "Getter" for databse entry
+ *
+ * @return $entry An array with database entries
+ * @throws NullPointerException If the database result is not found
+ * @throws InvalidDatabaseResultException If the database result is invalid
+ */
+ private function getDatabaseEntry () {
+ // Is there an instance?
+ if (is_null($this->resultInstance)) {
+ // Throw new exception
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Rewind it
+ $this->resultInstance->rewind();
+
+ // Do we have an entry?
+ if (!$this->resultInstance->valid()) {
+ throw new InvalidDatabaseResultException(array($this, $this->resultInstance), DatabaseResult::EXCEPTION_INVALID_DATABASE_RESULT);
+ } // END - if
+
+ // Get next entry
+ $this->resultInstance->next();
+
+ // Fetch it
+ $entry = $this->resultInstance->current();
+
+ // And return it
+ return $entry;
+ }
+
/**
* Setter for username
*
// By default the username does not exist
$exists = false;
- // Get a UserDatabaseWrapper instance
- $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+ // Is a previous result there?
+ if (is_null($this->resultInstance)) {
+ // Get a UserDatabaseWrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
- // Create a search criteria
- $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_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);
+ // 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);
+ // Get a search result
+ $this->resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+ } else {
+ // Rewind it
+ $this->resultInstance->rewind();
+ }
// Search for it
- if ($result->next()) {
+ if ($this->resultInstance->next()) {
// Entry found
$exists = true;
} // END - if
// By default the email does not exist
$exists = false;
- // Get a UserDatabaseWrapper instance
- $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+ // Is a previous result there?
+ if (is_null($this->resultInstance)) {
+ // Get a UserDatabaseWrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
- // Create a search criteria
- $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_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_EMAIL, $this->getEmail());
- $criteriaInstance->setLimit(1);
+ // Add the username as a criteria and set limit to one entry
+ $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_EMAIL, $this->getEmail());
+ $criteriaInstance->setLimit(1);
- // Get a search result
- $result = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+ // Get a search resultInstance
+ $this->resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+ } else {
+ // Rewind it
+ $this->resultInstance->rewind();
+ }
// Search for it
- if ($result->next()) {
+ if ($this->resultInstance->next()) {
// Entry found
$exists = true;
} // END - if
$criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
$criteriaInstance->setLimit(1);
- // Get a search result
- $result = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+ // Get a search resultInstance
+ $this->resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
// Search for it
- if ($result->next()) {
+ if ($this->resultInstance->next()) {
// Get the current entry (can only be one!)
- $entry = $result->current();
+ $entry = $this->resultInstance->current();
// So does the hashes match?
$matches = ($requestInstance->getRequestElement('pass_hash') === $entry['pass_hash']);
public function addUpdateData ($column, $value) {
$this->partialStub("Column={$column}, value={$value}");
}
+
+ /**
+ * "Getter" for user's password hash
+ *
+ * @return $passHash User's password hash from database result
+ */
+ public function getPasswordHash () {
+ // Default is missing password hash
+ $passHash = null;
+
+ // Get a database entry
+ $entry = $this->getDatabaseEntry();
+
+ // Is the password hash there?
+ if (isset($entry['pass_hash'])) {
+ // Get it
+ $passHash = $entry['pass_hash'];
+ }
+
+ // And return the hash
+ return $passHash;
+ }
}
// [EOF]
// CFG: RULES-ACCEPTED-FILTER
$cfg->setConfigEntry('rules_accepted_class', "RulesAcceptedFilter");
+// CFG: USERNAME-VERIFIER
+$cfg->setConfigEntry('username_verifier_class', "UserNameVerifierFilter");
+
+// CFG: EMAIL-VERIFIER
+$cfg->setConfigEntry('email_verifier_class', "EmailVerifierFilter");
+
+// CFG: PASSWORD-VERIFIER
+$cfg->setConfigEntry('password_verifier_class', "PasswordVerifierFilter");
+
// CFG: CRYPTO-HELPER
$cfg->setConfigEntry('crypto_class', "CryptoHelper");
// CFG: USER-DB-WRAPPER
$cfg->setConfigEntry('user_db_wrapper_class', "UserDatabaseWrapper");
+// CFG: NEWS-DB-WRAPPER
+$cfg->setConfigEntry('news_db_wrapper_class', "NewsDatabaseWrapper");
+
// CFG: WEB-CMD-RESOLVER
$cfg->setConfigEntry('web_cmd_resolver_class', "WebCommandResolver");
$cfg->setConfigEntry('hash_mask', "%1s:%2s:%3s"); // 1=salt, 2=extra salt, 3=plain password
// CFG: IS-SINGLE-SERVER
-$cfg->setConfigEntry('is_single_server', "Y");
+$cfg->setConfigEntry('is_single_server', "N");
// CFG: POST-REGISTRATION-ACTION
$cfg->setConfigEntry('post_registration_class', "LoginAfterRegistrationAction");
// If the basePath is false it is invalid
if ($basePath2 === false) {
- // TODO: Do not die here.
+ // @TODO: Do not die here.
die("Cannot read {$basePath} !");
} else {
// Set base path
<?php
// Developer mode active? Comment out if no dev!
-//define('DEVELOPER', true);
+define('DEVELOPER', true);
//xdebug_start_trace();
/**
* The main class with the entry point to the whole application. This class
* @version 0.0.0
* @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This 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 some instances
- $tpl = FrameworkConfiguration::getInstance()->readConfig('tpl_engine');
+ $tpl = FrameworkConfiguration::getInstance()->readConfig('template_class');
$lang = LanguageSystem::getInstance();
$io = FileIoHandler::getInstance();
// Use the template engine for putting out (nicer look) the message
try {
// Get the template instance from our object factory
- $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array(FrameworkConfiguration::getInstance()->readConfig('tpl_base_path'), $lang, $io));
+ $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array(FrameworkConfiguration::getInstance()->readConfig('tpl_base_path'), $lang, $io));
} catch (BasePathIsEmptyException $e) {
die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
$e->getMessage()
// Assign variables
$tplEngine->assignVariable('message', $message);
$tplEngine->assignVariable('backtrace', $backtrace);
+ $tplEngine->assignVariable('total_includes', ClassLoader::getInstance()->getTotal());
$tplEngine->assignVariable('total_objects', ObjectFactory::getTotal());
// Load the template