From 9c31d45f1edb240ce9882e5e9847edbe46706b9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 21 Aug 2009 22:00:26 +0000 Subject: [PATCH] Errors in confirmation/company link fixed --- .gitattributes | 1 + application/ship-simu/config.php | 5 +- .../main/menu/class_ShipSimuConfirmMenu.php | 50 +++++++++++++++++++ .../main/user/class_ShipSimuBaseUser.php | 9 +++- .../action_ship_simu_login_status_problem.ctp | 28 +++++++---- 5 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 application/ship-simu/main/menu/class_ShipSimuConfirmMenu.php diff --git a/.gitattributes b/.gitattributes index 7b79692..b58a7bd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -148,6 +148,7 @@ application/ship-simu/main/login/helper/.htaccess -text application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php -text application/ship-simu/main/menu/.htaccess -text application/ship-simu/main/menu/class_ShipSimu -text +application/ship-simu/main/menu/class_ShipSimuConfirmMenu.php -text application/ship-simu/main/menu/class_ShipSimuHomeMenu.php -text application/ship-simu/main/menu/class_ShipSimuLoginAreaMenu.php -text application/ship-simu/main/menu/class_ShipSimuLoginMenu.php -text diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index 4ca3bac..f83162e 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -92,7 +92,7 @@ $cfg->setConfigEntry('user_status_guest', 'GUEST'); $cfg->setConfigEntry('user_status_confirmed', 'CONFIRMED'); // CFG: USER-STATUS-LOCKED -//$cfg->setConfigEntry('user_status_locked', 'LOCKED'); +$cfg->setConfigEntry('user_status_locked', 'LOCKED'); // CFG: LOGIN-HELPER-CLASS $cfg->setConfigEntry('login_helper_class', 'ShipSimuLoginHelper'); @@ -466,6 +466,9 @@ $cfg->setConfigEntry('logout_menu_class', 'ShipSimuLogoutMenu'); // CFG: REGISTER-MENU-CLASS $cfg->setConfigEntry('register_menu_class', 'ShipSimuRegisterMenu'); +// CFG: CONFIRM-MENU-CLASS +$cfg->setConfigEntry('confirm_menu_class', 'ShipSimuConfirmMenu'); + // CFG: LOGIN-AREA-MENU-CLASS $cfg->setConfigEntry('login_area_menu_class', 'ShipSimuLoginAreaMenu'); diff --git a/application/ship-simu/main/menu/class_ShipSimuConfirmMenu.php b/application/ship-simu/main/menu/class_ShipSimuConfirmMenu.php new file mode 100644 index 0000000..72d2ddb --- /dev/null +++ b/application/ship-simu/main/menu/class_ShipSimuConfirmMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ShipSimuConfirmMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public final static function createShipSimuConfirmMenu () { + // Get a new instance + $menuInstance = new ShipSimuConfirmMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/user/class_ShipSimuBaseUser.php b/application/ship-simu/main/user/class_ShipSimuBaseUser.php index e77ba3e..5515d3c 100644 --- a/application/ship-simu/main/user/class_ShipSimuBaseUser.php +++ b/application/ship-simu/main/user/class_ShipSimuBaseUser.php @@ -70,8 +70,13 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable { // Default is that everyone is poor... ;-) $hasRequired = false; - // Get a points instance from registry - $pointsInstance = Registry::getRegistry()->getInstance('points'); + try { + // Get a points instance from registry + $pointsInstance = Registry::getRegistry()->getInstance('points'); + } catch (NullPointerException $e) { + // Instance not found in registry + // @TODO We should log this exception later + } // Is there an instance? if (is_null($pointsInstance)) { diff --git a/application/ship-simu/templates/de/code/action_ship_simu_login_status_problem.ctp b/application/ship-simu/templates/de/code/action_ship_simu_login_status_problem.ctp index 5d69da5..df4a8de 100644 --- a/application/ship-simu/templates/de/code/action_ship_simu_login_status_problem.ctp +++ b/application/ship-simu/templates/de/code/action_ship_simu_login_status_problem.ctp @@ -2,7 +2,7 @@ // 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. -$helperInstance = ObjectFactory::createObjectByConfiguredName('web_form_helper', array($this, "resend")); +$helperInstance = ObjectFactory::createObjectByConfiguredName('web_form_helper', array($this, 'resend_link')); // Pre-fetch field data with a given registry key $helperInstance->prefetchValueInstance('user'); @@ -29,10 +29,13 @@ if ($helperInstance->ifUserAccountUnconfirmed()) { // Flush content and automatically close the form $helperInstance->flushContent(); -if ($helperInstance->ifUserAccountUnconfirmed()) { - // Build the form for confirmation - $helperInstance = ObjectFactory::createObjectByConfiguredName('web_form_helper', array($this, "confirm_code")); +// Build the form for confirmation +$helperInstance = ObjectFactory::createObjectByConfiguredName('web_form_helper', array($this, 'confirm_code')); +// Pre-fetch field data with a given registry key +$helperInstance->prefetchValueInstance('user'); + +if ($helperInstance->ifUserAccountUnconfirmed()) { // Add code box $helperInstance->addFormGroup('code', "Bitte gebe hier den Bestätigungscode aus der Willkommensemail ein. Solltest du diese nicht erhalten haben, kannst du dir diesen jetzt zusenden lassen."); $helperInstance->addFieldText('code', "Bestätigungscode aus der Mail:"); @@ -42,10 +45,13 @@ if ($helperInstance->ifUserAccountUnconfirmed()) { $helperInstance->addFormGroup('buttons', "Bitte einmal abschicken und das Ergebnis abwarten!"); $helperInstance->addInputResetButton("Nochmal eingeben"); $helperInstance->addInputSubmitButton("Bestätigungscode absenden"); +} else { + // Add message + $helperInstance->addFormNote('status_not_unconfirmed', "Möglicherweise hast du einen Bestätigungslink angeklickt, obwohl dein Account bereits freigegeben oder gesperrt ist."); +} - // Flush content and automatically close the form - $helperInstance->flushContent(); -} // END - if +// Flush content and automatically close the form +$helperInstance->flushContent(); // [EOC] ?> @@ -59,8 +65,12 @@ if ($helperInstance->ifUserAccountUnconfirmed()) { kannst dir nun den Bestätigungslink erneut aussenden lassen, oder den Bestätigungscode unten eingeben. -
- {?resend?} + + +
+ Weitere Möglichkeiten:
-- 2.39.5