From 6b5ab4234376c367887b641d20006dd0e3b0a6ae Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 7 Apr 2015 18:15:17 +0200 Subject: [PATCH] Added a lot more stuff for login area and more: - First 'welcome' or 'overview' page is "ready". - Registration is half-finished (confirmation is not done) - Added a lot more classes Signed-off-by: Roland Haeder --- application/city/config.php | 188 +++++++++++++++- application/city/main/actions/.htaccess | 1 + application/city/main/actions/class_ | 82 +++++++ .../main/actions/class_BaseCityAction.php | 62 ++++++ application/city/main/actions/html/.htaccess | 1 + .../html/class_HtmlCityLoginWelcomeAction.php | 81 +++++++ .../html/class_CityHtmlRegisterCommand.php | 2 +- .../html/class_HtmlCityRegisterCommand.php | 2 +- .../html/class_CityHtmlLoginController.php | 68 ++++++ .../city/main/controller/html/login/.htaccess | 1 + .../class_CityHtmlLoginAreaController.php | 87 ++++++++ application/city/main/login/.htaccess | 1 + .../city/main/login/class_CityGuestLogin.php | 152 +++++++++++++ .../city/main/login/class_CityUserLogin.php | 140 ++++++++++++ application/city/main/login/helper/.htaccess | 1 + .../login/helper/class_CityLoginHelper.php | 114 ++++++++++ application/city/main/menu/class_City | 50 +++++ .../city/main/menu/class_CityConfirmMenu.php | 50 +++++ .../main/menu/class_CityLoginAreaMenu.php | 50 +++++ .../main/menu/class_CityLoginFailedMenu.php | 50 +++++ .../city/main/menu/class_CityLoginMenu.php | 50 +++++ .../city/main/menu/class_CityLogoutMenu.php | 50 +++++ .../city/main/menu/class_CityStatusMenu.php | 50 +++++ .../city/main/menu/government/.htaccess | 1 + .../class_CityGovernmentFailedAreaMenu.php | 50 +++++ application/city/main/registration/.htaccess | 1 + .../registration/class_CityRegistration.php | 208 ++++++++++++++++++ ...ion_city_login_government_startup_help.ctp | 62 ++++++ .../action_city_login_government_training.ctp | 62 ++++++ .../de/code/action_city_login_logout.ctp | 30 +++ .../de/code/action_city_login_profile.ctp | 145 ++++++++++++ .../code/action_city_login_status_problem.ctp | 79 +++++++ .../de/code/action_city_login_welcome.ctp | 3 + .../templates/de/code/block_persona_data.ctp | 27 +++ .../templates/de/code/captch_graphic_code.ctp | 2 +- .../city/templates/de/code/city_main.ctp | 32 ++- .../city/templates/de/code/login_main.ctp | 57 +++++ .../city/templates/de/code/register_form.ctp | 2 +- .../de/menu/login_area_menu_entries.xml | 95 ++++++++ core | 2 +- db/user/.htaccess | 1 + db/user_points/.htaccess | 1 + 42 files changed, 2175 insertions(+), 18 deletions(-) create mode 100644 application/city/main/actions/.htaccess create mode 100644 application/city/main/actions/class_ create mode 100644 application/city/main/actions/class_BaseCityAction.php create mode 100644 application/city/main/actions/html/.htaccess create mode 100644 application/city/main/actions/html/class_HtmlCityLoginWelcomeAction.php create mode 100644 application/city/main/controller/html/class_CityHtmlLoginController.php create mode 100644 application/city/main/controller/html/login/.htaccess create mode 100644 application/city/main/controller/html/login/class_CityHtmlLoginAreaController.php create mode 100644 application/city/main/login/.htaccess create mode 100644 application/city/main/login/class_CityGuestLogin.php create mode 100644 application/city/main/login/class_CityUserLogin.php create mode 100644 application/city/main/login/helper/.htaccess create mode 100644 application/city/main/login/helper/class_CityLoginHelper.php create mode 100644 application/city/main/menu/class_City create mode 100644 application/city/main/menu/class_CityConfirmMenu.php create mode 100644 application/city/main/menu/class_CityLoginAreaMenu.php create mode 100644 application/city/main/menu/class_CityLoginFailedMenu.php create mode 100644 application/city/main/menu/class_CityLoginMenu.php create mode 100644 application/city/main/menu/class_CityLogoutMenu.php create mode 100644 application/city/main/menu/class_CityStatusMenu.php create mode 100644 application/city/main/menu/government/.htaccess create mode 100644 application/city/main/menu/government/class_CityGovernmentFailedAreaMenu.php create mode 100644 application/city/main/registration/.htaccess create mode 100644 application/city/main/registration/class_CityRegistration.php create mode 100644 application/city/templates/de/code/action_city_login_government_startup_help.ctp create mode 100644 application/city/templates/de/code/action_city_login_government_training.ctp create mode 100644 application/city/templates/de/code/action_city_login_logout.ctp create mode 100644 application/city/templates/de/code/action_city_login_profile.ctp create mode 100644 application/city/templates/de/code/action_city_login_status_problem.ctp create mode 100644 application/city/templates/de/code/action_city_login_welcome.ctp create mode 100644 application/city/templates/de/code/block_persona_data.ctp create mode 100644 application/city/templates/de/code/login_main.ctp create mode 100644 application/city/templates/de/menu/login_area_menu_entries.xml create mode 100644 db/user/.htaccess create mode 100644 db/user_points/.htaccess diff --git a/application/city/config.php b/application/city/config.php index 40ffebb..de73d49 100644 --- a/application/city/config.php +++ b/application/city/config.php @@ -68,32 +68,71 @@ $cfg->setConfigEntry('city_html_cmd_home_resolver_class', 'CityHtmlCommandResolv // CFG: CITY-HTML-CMD-REGISTER-RESOLVER-CLASS $cfg->setConfigEntry('city_html_cmd_register_resolver_class', 'CityHtmlCommandResolver'); +// CFG: CITY-HTML-CMD-LOGIN-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_login_resolver_class', 'HtmlCommandResolver'); + // CFG: NEWS-READER-HOME-CLASS $cfg->setConfigEntry('news_reader_home_class', 'DefaultNewsReader'); // CFG: NEWS-READER-REGISTER-CLASS $cfg->setConfigEntry('news_reader_register_class', 'DefaultNewsReader'); +// CFG: NEWS-READER-LOGIN-AREA-CLASS +$cfg->setConfigEntry('news_reader_login_area_class', 'DefaultNewsReader'); + // CFG: NEWS-HOME-LIMIT $cfg->setConfigEntry('news_home_limit', 10); // CFG: NEWS-REGISTER-LIMIT $cfg->setConfigEntry('news_register_limit', 5); +// CFG: NEWS-LOGIN-AREA-LIMIT +$cfg->setConfigEntry('news_login_area_limit', 5); + // CFG: CITY-HOME-MENU-CLASS $cfg->setConfigEntry('city_home_menu_class', 'CityHomeMenu'); // CFG: CITY-REGISTER-MENU-CLASS $cfg->setConfigEntry('city_register_menu_class', 'CityRegisterMenu'); +// CFG: LOGIN-FAILED-MENU-CLASS +$cfg->setConfigEntry('login_failed_menu_class', 'CityLoginFailedMenu'); + +// CFG: STATUS-MENU-CLASS +$cfg->setConfigEntry('status_menu_class', 'CityStatusMenu'); + +// CFG: LOGIN-MENU-CLASS +$cfg->setConfigEntry('login_menu_class', 'CityLoginMenu'); + +// CFG: LOGOUT-MENU-CLASS +$cfg->setConfigEntry('logout_menu_class', 'CityLogoutMenu'); + +// CFG: REGISTER-MENU-CLASS +$cfg->setConfigEntry('register_menu_class', 'CityRegisterMenu'); + +// CFG: CONFIRM-MENU-CLASS +$cfg->setConfigEntry('confirm_menu_class', 'CityConfirmMenu'); + +// CFG: LOGIN-AREA-MENU-CLASS +$cfg->setConfigEntry('login_area_menu_class', 'CityLoginAreaMenu'); + +// CFG: GOVERNMENT-FAILED-AREA-MENU-CLASS +$cfg->setConfigEntry('government_failed_area_menu_class', 'CityGovernmentFailedAreaMenu'); + // CFG: MENU-TEMPLATE-CLASS $cfg->setConfigEntry('menu_template_class', 'MenuTemplateEngine'); // CFG: MENU-TEMPLATE-EXTENSION $cfg->setConfigEntry('menu_template_extension', '.xml'); +// CFG: HTML-BLOCK-HELPER +$cfg->setConfigEntry('html_block_helper_class', 'HtmlBlockHelper'); + // CFG: HTML-FORM-HELPER -$cfg->setConfigEntry('html_form_helper', 'HtmlFormHelper'); +$cfg->setConfigEntry('html_form_helper_class', 'HtmlFormHelper'); + +// CFG: HTML-LINK-HELPER +$cfg->setConfigEntry('html_link_helper_class', 'HtmlLinkHelper'); // CFG: FORM-ACTION $cfg->setConfigEntry('form_action', 'index.php?app={?app_short_name?}&command=do_form'); @@ -194,6 +233,18 @@ $cfg->setConfigEntry('captcha_encrypt_validator_filter', 'CaptchaEncryptFilter') // CFG: CITY-HTML-CMD-DO-FORM-RESOLVER-CLASS $cfg->setConfigEntry('city_html_cmd_do_form_resolver_class', 'HtmlCommandResolver'); +// CFG: CITY-HTML-CMD-LOGIN-AREA-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_login_area_resolver_class', 'HtmlCommandResolver'); + +// CFG: CITY-HTML-CMD-CONFIRM-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_confirm_resolver_class', 'HtmlCommandResolver'); + +// CFG: CITY-HTML-CMD-PROBLEM-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_problem_resolver_class', 'HtmlCommandResolver'); + +// CFG: CITY-HTML-CMD-LOGOUT-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_logout_resolver_class', 'HtmlCommandResolver'); + // CFG: CAPTCHA-GUEST-VERIFIER-FILTER $cfg->setConfigEntry('captcha_guest_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter'); @@ -221,6 +272,141 @@ $cfg->setConfigEntry('birthday_register_verifier_filter', 'BirthdayVerifierFilte // CFG: BIRTHDAY-PROFILE-VERIFIER-FILTER $cfg->setConfigEntry('birthday_profile_verifier_filter', 'BirthdayVerifierFilter'); +// CFG: GUEST-LOGIN-USERNAME +$cfg->setConfigEntry('guest_login_user', 'guest'); + +// CFG: GUEST-LOGIN-PASS +$cfg->setConfigEntry('guest_login_passwd', 'guest'); + +// CFG: USER-REGISTRATION +$cfg->setConfigEntry('user_registration_class', 'CityRegistration'); + +// CFG: USER-LOGIN-CLASS +$cfg->setConfigEntry('user_login_class', 'CityUserLogin'); + +// CFG: GUEST-LOGIN-CLASS +$cfg->setConfigEntry('guest_login_class', 'CityGuestLogin'); + +// CFG: CONFIRM-EMAIL-ENABLED +$cfg->setConfigEntry('confirm_email_enabled', 'Y'); + +// CFG: USER-STATUS-REGISTER +$cfg->setConfigEntry('user_status_unconfirmed', 'UNCONFIRMED'); + +// CFG: USER-STATUS-GUEST +$cfg->setConfigEntry('user_status_guest', 'GUEST'); + +// CFG: USER-STATUS-CONFIRMED +$cfg->setConfigEntry('user_status_confirmed', 'CONFIRMED'); + +// CFG: USER-STATUS-LOCKED +$cfg->setConfigEntry('user_status_locked', 'LOCKED'); + +// CFG: LOGIN-HELPER-CLASS +$cfg->setConfigEntry('login_helper_class', 'CityLoginHelper'); + +// CFG: AUTH-METHOD-CLASS +$cfg->setConfigEntry('auth_method_class', 'CookieAuth'); + +// CFG: APP-LOGIN-URL +$cfg->setConfigEntry('app_login_url', 'index.php?app={?app_short_name?}&command=login_area'); + +// CFG: LOGIN-FAILED-URL +$cfg->setConfigEntry('login_failed_url', 'index.php?app={?app_short_name?}&command=login_failed'); + +// CFG: LOGIN-FAILED-LOGIN-RETRY-ACTION-URL +$cfg->setConfigEntry('login_failed_login_retry_action_url', 'index.php?app={?app_short_name?}&command=login&note=login_failed'); + +// CFG: LOGIN-AREA-LOGOUT-ACTION-URL +$cfg->setConfigEntry('login_area_logout_action_url', 'index.php?app={?app_short_name?}&command=login_area'); + +// CFG: GOVERNMENT-FAILED-LOGOUT-ACTION-URL +$cfg->setConfigEntry('government_failed_logout_action_url', 'index.php?app={?app_short_name?}&command=login_area'); + +// CFG: LOGIN-AREA-PROFILE-ACTION-URL +$cfg->setConfigEntry('login_area_profile_action_url', 'index.php?app={?app_short_name?}&command=login_area&status=profile'); + +// CFG: GOVERNMENT-FAILED-PROFILE-ACTION-URL +$cfg->setConfigEntry('government_failed_profile_action_url', 'index.php?app={?app_short_name?}&command=login_area&status=profile'); + +// CFG: LOGIN-AREA-LOGOUT-NOW-ACTION-URL +$cfg->setConfigEntry('login_area_logout_now_action_url', 'index.php?app={?app_short_name?}&command=logout'); + +// CFG: LOGIN-AREA-RETURN-LOGIN-ACTION-URL +$cfg->setConfigEntry('login_area_return_login_action_url', 'index.php?app={?app_short_name?}&command=login_area'); + +// CFG: LOGIN-AREA-SHIPSIMU-PROFILE-ACTION-URL +$cfg->setConfigEntry('login_area_shipsimu_profile_action_url', 'index.php?app={?app_short_name?}&command=login_area&action=profile'); + +// CFG: LOGOUT_DONE-RELOGIN-ACTION-URL +$cfg->setConfigEntry('logout_done_relogin_action_url', 'index.php?app={?app_short_name?}&command=login'); + +// CFG: LOGIN-REGISTER-ACTION-URL +$cfg->setConfigEntry('login_register_action_url', 'index.php?app={?app_short_name?}&command=register'); + +// CFG: CONFIRM-DIRECT-LOGIN-ACTION-URL +$cfg->setConfigEntry('confirm_direct_login_action_url', 'index.php?app={?app_short_name?}&command=login_area'); + +// CFG: LOGOUT-DONE-URL +$cfg->setConfigEntry('logout_done_url', 'index.php?app={?app_short_name?}&command=logout_done'); + +// CFG: ACTION-STATUS-PROBLEM +$cfg->setConfigEntry('action_status_problem', 'status_problem'); + +// CFG: LOGIN-USER-STATUS-URL +$cfg->setConfigEntry('login_user_status_url', 'index.php?app={?app_short_name?}&command=login_area&action=status_problem&status=status_problem&status=general'); + +// CFG: LOGIN-USER-STATUS-GUEST-URL +$cfg->setConfigEntry('login_user_status_guest_url', 'index.php?app={?app_short_name?}&command=login_area&action=status_problem&status=status_problem&status=guest'); + +// CFG: USER-NOT-UNCONFIRMED-URL +$cfg->setConfigEntry('user_not_unconfirmed_url', 'index.php?app={?app_short_name?}&command=login_area&action=status_problem&status=unconfirmed_problem'); + +// CFG: USER-UNCONFIRMED-EMAIL-MISSING-URL +$cfg->setConfigEntry('user_unconfirmed_email_missing_url', 'index.php?app={?app_short_name?}&command=login_area&action=status_problem&status=unconfirmed_email_missing'); + +// CFG: CONFIRM-CODE-INVALID-URL +$cfg->setConfigEntry('confirm_code_invalid_url', 'index.php?app={?app_short_name?}&command=login_area&action=status_problem&status=confirm_code_invalid'); + +// CFG: USER-NOT-FOUND-URL +$cfg->setConfigEntry('user_not_found_url', 'index.php?app={?app_short_name?}&command=login_area&action=status_problem&status=user_not_found'); + +// CFG: USER-AUTH-FILTER +$cfg->setConfigEntry('user_auth_filter', 'UserAuthFilter'); + +// CFG: USER-UPDATE-FILTER +$cfg->setConfigEntry('user_update_filter', 'UserUpdateFilter'); + +// CFG: LOGIN-DEFAULT-ACTION +$cfg->setConfigEntry('login_default_action', 'welcome'); + +// CFG: MONEYBANK-ACTIVATED +$cfg->setConfigEntry('moneybank_activated', 'Y'); + +// CFG: MONEYBANK-OPENING-CLASS +$cfg->setConfigEntry('moneybank_opening_class', 'MoneyBankRealtimeOpening'); + +// CFG: USER-POINTS-CLASS +$cfg->setConfigEntry('user_points_class', 'UserPoints'); + +// CFG: BLOCK-SHOWS-REGISTRATION +$cfg->setConfigEntry('block_shows_registration', 'Y'); + +// CFG: GOVERNMENT-CLASS +$cfg->setConfigEntry('government_class', 'SimplifiedGovernment'); + +// CFG: BANK-CLASS +$cfg->setConfigEntry('bank_class', 'MoneyBank'); + +// CFG: USER-POINTS-DB-WRAPPER-CLASS +$cfg->setConfigEntry('user_points_db_wrapper_class', 'UserPointsDatabaseWrapper'); + +// CFG: USER-GOVERNMENT-WRAPPER-CLASS +$cfg->setConfigEntry('user_government_wrapper_class', 'UserGovernmentDatabaseWrapper'); + +// CFG: PAYMENT-DB-WRAPPER-CLASS +$cfg->setConfigEntry('payment_db_wrapper_class', 'PaymentsDatabaseWrapper'); + /****************************************************************************** * Console client * ******************************************************************************/ diff --git a/application/city/main/actions/.htaccess b/application/city/main/actions/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/actions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/actions/class_ b/application/city/main/actions/class_ new file mode 100644 index 0000000..1f7aa89 --- /dev/null +++ b/application/city/main/actions/class_ @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City 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 ???Action extends BaseCityAction implements Commandable, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @param $resolverInstance An instance of an action resolver + * @return $actionInstance An instance of this action class + */ + public final static function create???Action (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new ???Action(); + + // Return the instance + return $actionInstance; + } + + /** + * 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 + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here + $this->partialStub("You have to implement me."); + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Call parent addExtraFilters method + parent::addExtraFilters($controllerInstance, $requestInstance); + + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/city/main/actions/class_BaseCityAction.php b/application/city/main/actions/class_BaseCityAction.php new file mode 100644 index 0000000..a21caf5 --- /dev/null +++ b/application/city/main/actions/class_BaseCityAction.php @@ -0,0 +1,62 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseCityAction extends BaseAction { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } + + /** + * 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 + * @todo 0% done + */ + protected function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Add code here executed with every action + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/city/main/actions/html/.htaccess b/application/city/main/actions/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/actions/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/actions/html/class_HtmlCityLoginWelcomeAction.php b/application/city/main/actions/html/class_HtmlCityLoginWelcomeAction.php new file mode 100644 index 0000000..6407d6b --- /dev/null +++ b/application/city/main/actions/html/class_HtmlCityLoginWelcomeAction.php @@ -0,0 +1,81 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HtmlCityLoginWelcomeAction extends BaseCityAction implements Commandable, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this action + * + * @param $resolverInstance An instance of an action resolver + * @return $actionInstance An instance of this action class + */ + public static final function createHtmlCityLoginWelcomeAction (ActionResolver $resolverInstance) { + // Get a new instance + $actionInstance = new HtmlCityLoginWelcomeAction(); + + // Set the resolver instance + $actionInstance->setResolverInstance($resolverInstance); + + // Return the instance + return $actionInstance; + } + + /** + * 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 + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Call parent execute method + parent::execute($requestInstance, $responseInstance); + + // Add your code here... + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Add some filters here + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Unfinished method + } +} + +// [EOF] +?> diff --git a/application/city/main/commands/html/class_CityHtmlRegisterCommand.php b/application/city/main/commands/html/class_CityHtmlRegisterCommand.php index ad43a76..012bbbc 100644 --- a/application/city/main/commands/html/class_CityHtmlRegisterCommand.php +++ b/application/city/main/commands/html/class_CityHtmlRegisterCommand.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2015 Ship-Simu Developer Team + * @copyright Copyright (c) 2015 City Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * diff --git a/application/city/main/commands/html/class_HtmlCityRegisterCommand.php b/application/city/main/commands/html/class_HtmlCityRegisterCommand.php index 4b82e51..a683c42 100644 --- a/application/city/main/commands/html/class_HtmlCityRegisterCommand.php +++ b/application/city/main/commands/html/class_HtmlCityRegisterCommand.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2015 Ship-Simu Developer Team + * @copyright Copyright (c) 2015 City Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * diff --git a/application/city/main/controller/html/class_CityHtmlLoginController.php b/application/city/main/controller/html/class_CityHtmlLoginController.php new file mode 100644 index 0000000..5ac7d8a --- /dev/null +++ b/application/city/main/controller/html/class_CityHtmlLoginController.php @@ -0,0 +1,68 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityHtmlLoginController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + * @todo Add some filters to this controller + */ + public static final function createCityHtmlLoginController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new CityHtmlLoginController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // 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) { + // Generic pre-post command execution + $this->executeGenericPrePostCommand($requestInstance, $responseInstance); + } +} + +// [EOF] +?> diff --git a/application/city/main/controller/html/login/.htaccess b/application/city/main/controller/html/login/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/controller/html/login/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/controller/html/login/class_CityHtmlLoginAreaController.php b/application/city/main/controller/html/login/class_CityHtmlLoginAreaController.php new file mode 100644 index 0000000..5169a87 --- /dev/null +++ b/application/city/main/controller/html/login/class_CityHtmlLoginAreaController.php @@ -0,0 +1,87 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityHtmlLoginAreaController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Init additional filter chains + foreach (array('shutdown') as $filterChain) { + $this->initFilterChain($filterChain); + } // END - foreach + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + * @todo Add some morer filters to this controller + */ + public static final function createCityHtmlLoginAreaController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new CityHtmlLoginAreaController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // User auth filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_filter')); + + // User update filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_filter')); + + // News fetcher filter + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_filter')); + + // News proccess/display-preparation + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_filter')); + + // 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) { + /* + * Generic execute of the command: pre and post filters with redirect + * but request becomes valid after pre-filters run. + */ + $this->genericHanleRequestLoginAreaFailedRedirect($requestInstance, $responseInstance); + } +} + +// [EOF] +?> diff --git a/application/city/main/login/.htaccess b/application/city/main/login/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/login/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/login/class_CityGuestLogin.php b/application/city/main/login/class_CityGuestLogin.php new file mode 100644 index 0000000..4b8f5eb --- /dev/null +++ b/application/city/main/login/class_CityGuestLogin.php @@ -0,0 +1,152 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityGuestLogin extends BaseFrameworkSystem implements LoginableUser { + /** + * The hashed password + */ + private $hashedPassword = ''; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this login class + * + * @return $loginInstance An instance of this login class + */ + public static final function createCityGuestLogin () { + // Get a new instance + $loginInstance = new CityGuestLogin(); + + // Return the instance + return $loginInstance; + } + + /** + * Logins the user with the given request containing the credential. The + * result of the login can be thrown by exception or, if prefered stored + * 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 + * @throws UserAuthMethodException If wether username nor email login + * was detected + * @throws MissingMethodException If a method was not found in the + * User class + * @throws UserPasswordMismatchException If the supplied password did not + * match with the stored password + */ + public function doLogin (Requestable $requestInstance, Responseable $responseInstance) { + // By default no method is selected + $method = null; + $data = ""; + + // Detect login method (username or email) and try to get a userinstance + if (!is_null($requestInstance->getRequestElement('user'))) { + // Username found! + $method = 'createGuestByUsername'; + $data = $requestInstance->getRequestElement('user'); + } // END - if + + // Is a method detected? + if (is_null($method)) { + // Then abort here + throw new UserAuthMethodException($this, self::EXCEPTION_MISSING_METHOD); + } elseif (!method_exists($this->getConfigInstance()->getConfigEntry('guest_class'), $method)) { + // The method is invalid! + throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD); + } + + // Get a user instance + $userInstance = call_user_func_array(array($this->getConfigInstance()->getConfigEntry('guest_class'), $method), array($data)); + + // Remember this new instance in registry + Registry::getRegistry()->addInstance('user', $userInstance); + + // Is the password correct? + if ($userInstance->ifPasswordHashMatches($requestInstance) === false) { + // Mismatching password + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); + } // END - if + + // Now do the real login. This can be cookie- or session-based login + // which depends on the admins setting then on the user's taste. + // 1) Get a login helper instance + $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance)); + + // 2) Execute the login. This will now login... + $helperInstance->executeLogin($responseInstance); + } + + /** + * Determines wether the login was fine. This is done by checking if 'login' instance is in registry + * + * @return $loginDone Wether the login was fine or not + */ + public function ifLoginWasSuccessfull () { + // Is the registry key there? + $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable); + + // Return the result + return $loginDone; + } + + /** + * Encrypt given request key or throw an exception if key was not found in + * request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + // Check if password is found in 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')->hashString($plainPassword, $userInstance->getPasswordHash()); + + // Store the hash back in request + $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/city/main/login/class_CityUserLogin.php b/application/city/main/login/class_CityUserLogin.php new file mode 100644 index 0000000..f02a615 --- /dev/null +++ b/application/city/main/login/class_CityUserLogin.php @@ -0,0 +1,140 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityUserLogin extends BaseFrameworkSystem implements LoginableUser { + /** + * The hashed password + */ + private $hashedPassword = ''; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this login class + * + * @return $loginInstance An instance of this login class + */ + public static final function createCityUserLogin () { + // Get a new instance + $loginInstance = new CityUserLogin(); + + // Return the instance + return $loginInstance; + } + + /** + * Logins the user with the given request containing the credential. The + * result of the login can be thrown by exception or, if prefered stored + * 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 + * @throws UserPasswordMismatchException If the supplied password did not + * match with the stored password + * @todo We need to add something here which will make more than one + * @todo guest logins, users who are online but based on the same + * @todo user account. + */ + public function doLogin (Requestable $requestInstance, Responseable $responseInstance) { + // By default no method is selected + $method = null; + $data = ""; + + // Get member class + $userClass = $this->getConfigInstance()->getConfigEntry('user_class'); + + // Get a user instance + $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance)); + + // Remember this new instance in registry + Registry::getRegistry()->addInstance('user', $userInstance); + + // Is the password correct? + if ($userInstance->ifPasswordHashMatches($requestInstance) === false) { + // Mismatching password + throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH); + } // END - if + + // ToDo place + + // Now do the real login. This can be cookie- or session-based login + // which depends on the admins setting then on the user's taste. + // 1) Get a login helper instance + $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance)); + + // 2) Execute the login. This will now login... + $helperInstance->executeLogin($responseInstance); + } + + /** + * Determines wether the login was fine. This is done by checking if 'login' instance is in registry + * + * @return $loginDone Wether the login was fine or not + */ + public function ifLoginWasSuccessfull () { + // Is the registry key there? + $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable); + + // Return the result + return $loginDone; + } + + /** + * Encrypt given request key or throw an exception if key was not found in + * request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + // Check if password is found in 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')->hashString($plainPassword, $userInstance->getPasswordHash()); + + // Store the hash back in request + $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/city/main/login/helper/.htaccess b/application/city/main/login/helper/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/login/helper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/login/helper/class_CityLoginHelper.php b/application/city/main/login/helper/class_CityLoginHelper.php new file mode 100644 index 0000000..0abe805 --- /dev/null +++ b/application/city/main/login/helper/class_CityLoginHelper.php @@ -0,0 +1,114 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityLoginHelper extends BaseLoginHelper implements HelpableLogin { + /** + * The login method we shall choose + */ + private $authMethod = ''; + + // Exception constants + const EXCEPTION_INVALID_USER_INSTANCE = 0x190; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class by given request instance + * + * @param $requestInstance An instance of a Requestable class + * @return $helperInstance An instance of this helper class + * @throws UserInstanceMissingException If the user instance in registry + * is missing or invalid + */ + public static final function createCityLoginHelper (Requestable $requestInstance) { + // Get a new instance first + $helperInstance = new CityLoginHelper(); + + // Get a user instance from registry + $userInstance = Registry::getRegistry()->getInstance('user'); + + // Is this instance valid? + if (!$userInstance instanceof ManageableAccount) { + // Thrown an exception here + throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE); + } // END - if + + // Set default login method from config + $helperInstance->setDefaultAuthMethod(); + + // Set request instance + $helperInstance->setRequestInstance($requestInstance); + + // Return the prepared instance + return $helperInstance; + } + + /** + * Setter for default login method from config + * + * @return void + */ + protected function setDefaultAuthMethod () { + $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class'); + } + + /** + * 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 + */ + public function executeLogin (Responseable $responseInstance) { + // Get an instance from the login method + $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance)); + + // Set user cookie + $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username')); + + // Set password cookie + $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash')); + + // Remember this login instance for later usage + Registry::getRegistry()->addInstance('login', $loginInstance); + } +} + +// +?> diff --git a/application/city/main/menu/class_City b/application/city/main/menu/class_City new file mode 100644 index 0000000..979c2e0 --- /dev/null +++ b/application/city/main/menu/class_City @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City 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 City???Menu 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 createCity???Menu () { + // Get a new instance + $menuInstance = new City???Menu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/class_CityConfirmMenu.php b/application/city/main/menu/class_CityConfirmMenu.php new file mode 100644 index 0000000..056f766 --- /dev/null +++ b/application/city/main/menu/class_CityConfirmMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityConfirmMenu 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 static final function createCityConfirmMenu () { + // Get a new instance + $menuInstance = new CityConfirmMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/class_CityLoginAreaMenu.php b/application/city/main/menu/class_CityLoginAreaMenu.php new file mode 100644 index 0000000..52d8be2 --- /dev/null +++ b/application/city/main/menu/class_CityLoginAreaMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityLoginAreaMenu 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 static final function createCityLoginAreaMenu () { + // Get a new instance + $menuInstance = new CityLoginAreaMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/class_CityLoginFailedMenu.php b/application/city/main/menu/class_CityLoginFailedMenu.php new file mode 100644 index 0000000..4acd90e --- /dev/null +++ b/application/city/main/menu/class_CityLoginFailedMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityLoginFailedMenu 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 static final function createCityLoginFailedMenu () { + // Get a new instance + $menuInstance = new CityLoginFailedMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/class_CityLoginMenu.php b/application/city/main/menu/class_CityLoginMenu.php new file mode 100644 index 0000000..201c3c1 --- /dev/null +++ b/application/city/main/menu/class_CityLoginMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityLoginMenu 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 static final function createCityLoginMenu () { + // Get a new instance + $menuInstance = new CityLoginMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/class_CityLogoutMenu.php b/application/city/main/menu/class_CityLogoutMenu.php new file mode 100644 index 0000000..9b59a72 --- /dev/null +++ b/application/city/main/menu/class_CityLogoutMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityLogoutMenu 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 static final function createCityLogoutMenu () { + // Get a new instance + $menuInstance = new CityLogoutMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/class_CityStatusMenu.php b/application/city/main/menu/class_CityStatusMenu.php new file mode 100644 index 0000000..1dcd6d4 --- /dev/null +++ b/application/city/main/menu/class_CityStatusMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityStatusMenu 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 static final function createCityStatusMenu () { + // Get a new instance + $menuInstance = new CityStatusMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/menu/government/.htaccess b/application/city/main/menu/government/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/menu/government/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/menu/government/class_CityGovernmentFailedAreaMenu.php b/application/city/main/menu/government/class_CityGovernmentFailedAreaMenu.php new file mode 100644 index 0000000..c72a2b9 --- /dev/null +++ b/application/city/main/menu/government/class_CityGovernmentFailedAreaMenu.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityGovernmentFailedAreaMenu 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 static final function createCityGovernmentFailedAreaMenu () { + // Get a new instance + $menuInstance = new CityGovernmentFailedAreaMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/city/main/registration/.htaccess b/application/city/main/registration/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/registration/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/registration/class_CityRegistration.php b/application/city/main/registration/class_CityRegistration.php new file mode 100644 index 0000000..fd72623 --- /dev/null +++ b/application/city/main/registration/class_CityRegistration.php @@ -0,0 +1,208 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityRegistration extends BaseRegistration implements UserRegister { + /** + * Hashed password + */ + private $hashedPassword = ''; + + /** + * Elements for criteria + */ + private $criteriaElements = array( + 'username', + 'pass_hash', + 'email' => 'email1', + 'surname', + 'family', + 'street', + 'zip', + 'city', + 'icq', + 'jabber', + 'yahoo', + 'aol', + 'msn', + 'birth_day', + 'birth_month', + 'birth_year' + ); + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Create a new instance + * + * @return $registrationInstance An instance of this registration class + */ + public static final function createCityRegistration () { + // Get a new instance + $registrationInstance = new CityRegistration(); + + // Initialize the filter chains + $registrationInstance->initFilterChains(); + + // And return it + return $registrationInstance; + } + + /** + * Encrypt given request key or throw an exception if key was not found in + * request + * + * @param $requestKey Key in request class + * @return void + */ + public function encryptPassword ($requestKey) { + // Check if password is found in request + if ($this->getRequestInstance()->isRequestElementSet($requestKey)) { + // So encrypt the password and store it for later usage in + // the request: + + // 1.: Get the plain password + $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey); + + // 2. Get a crypto helper and hash the password + $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($plainPassword); + + // 3. Store the hash back in request + $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword); + } + } + + /** + * Perform things like informing assigned affilates about new registration + * before registration + * + * @return void + * @todo Maybe add more things to perform + */ + public function doPreRegistration () { + // First run all pre filters + $this->executePreFilters(); + } + + /** + * Registers the new user account by insterting the request data into the + * database and paying some start credits or throw exceptions if this fails + * + * @return void + * @todo Maybe add more things to perform + */ + public function registerNewUser () { + // Get a user database wrapper + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class'); + + // Use this instance to insert the whole registration instance + $wrapperInstance->insertRegistrationObject($this); + } + + /** + * Perform things like notifying partner websites after registration is done + * + * @return void + * @todo Maybe add more things to perform + */ + public function doPostRegistration () { + // First run all post filters + $this->executePostFilters(); + } + + /** + * Do the action which is required after all registration steps are done. + * This can be a simple redirect to another webpage or displaying a message + * to the user. Or this can be a login step into the newly created account. + * + * @return void + */ + public function doPostAction () { + // Get an action instance from our factory + $actionInstance = ObjectFactory::createObjectByConfiguredName('post_registration_class'); + + // Execute the action + $actionInstance->execute($this->getRequestInstance(), $this->getResponseInstance()); + } + + /** + * Adds registration elements to a given dataset instance + * + * @param $criteriaInstance An instance of a StoreableCriteria class + * @param $requestInstance An instance of a Requestable class + * @return void + */ + public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL) { + // Default is unconfirmed! + $configEntry = 'user_status_unconfirmed'; + + // Is the confirmation process entirely disabled? + if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === 'N') { + // No confirmation of email needed + $configEntry = 'user_status_confirmed'; + } // END - if + + // Add a lot elements to the dataset criteria + foreach ($this->criteriaElements as $alias => $element) { + // Do we have an alias? + if (is_string($alias)) { + // Yes, so use it + $criteriaInstance->addCriteria($alias, $this->getRequestInstance()->getRequestElement($element)); + + // Debug message + //* DEBUG: */ $this->debugOutput('ALIAS: alias='.$alias.',element='.$element.'='.$this->getRequestInstance()->getRequestElement($element)); + } else { + // No, default entry + $criteriaInstance->addCriteria($element, $this->getRequestInstance()->getRequestElement($element)); + + // Debug message + //* DEBUG: */ $this->debugOutput('DEFAULT: element='.$element.'='.$this->getRequestInstance()->getRequestElement($element)); + } + + // Is this a guest account? + if ((($element == 'username') || ($alias == 'username')) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) { + // Yes, then set the config entry to guest status + $configEntry = 'user_status_guest'; + } // END - if + } // END - foreach + + // Mark the username as unique key + $criteriaInstance->setUniqueKey(UserDatabaseWrapper::DB_COLUMN_USERNAME); + + // Add account status as configured + $criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry); + + // Include registration timestamp + $criteriaInstance->addCriteria('registered', date('Y-m-d H:i:s', time())); + } +} + +// +?> diff --git a/application/city/templates/de/code/action_city_login_government_startup_help.ctp b/application/city/templates/de/code/action_city_login_government_startup_help.ctp new file mode 100644 index 0000000..bce1daf --- /dev/null +++ b/application/city/templates/de/code/action_city_login_government_startup_help.ctp @@ -0,0 +1,62 @@ +prefetchValueInstance('user'); + +// Add main form group +$helperInstance->addFormNote('reality_warning', "WARNUNG: Bitte dieses Formular nicht mit echten Angaben ausfüllen! (Die Profildaten sollte jedoch echt sein.)"); + +// Add group for personal data +$helperInstance->addFormGroup('persona_data', "Deine persönliche Daten, die für die Beantragung nötig sind:"); + +// Display email, surname and family name +$helperInstance->addFormNote('surname', "Vorname: ".$helperInstance->getValueField('surname').""); +$helperInstance->addFormNote('family', "Nachname: ".$helperInstance->getValueField('family').""); +$helperInstance->addFormNote('email', "Email-Adresse: ".$helperInstance->getValueField('email').""); +$helperInstance->addFormNote('birthday', "Geburtstag: ".(int)$helperInstance->getValueField('birth_day').".".(int)$helperInstance->getValueField('birth_month').".".(int)$helperInstance->getValueField('birth_year').""); + +// Add link placeholder for profile page +$helperInstance->addFormNote('profile', "Stimmen die Daten noch? {?city_profile?}"); + +// Ask again for current account password +$helperInstance->addFormGroup('password', "Bitte gebe zur Bestätigung dein derzeitiges Passwort ein."); +$helperInstance->addFieldText('password', "Derzeitiges Passwort:"); +$helperInstance->addInputPasswordField('password'); + +// CAPTCHA enabled? +if ($helperInstance->ifFormSecuredWithCaptcha()) { + $helperInstance->addFormGroup('captcha_user', "Die virtuelle Beantragung von Starthilfe ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du die Starthilfe beantragen kannst."); + $helperInstance->addCaptcha(); +} // END - if + +// Final notices +$helperInstance->addFormGroup('buttons', "Sind alle Daten nun korrekt eingegeben? Dann sende sie mit einem Klick einfach ab!"); +$helperInstance->addInputResetButton("Alles nochmal eingeben"); +$helperInstance->addInputSubmitButton("Starthilfe beantragen"); +$helperInstance->addFormNote('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzen gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz"."); + +// Flush the finished form +$helperInstance->flushContent(); + +// Get link helper for profile link +$linkInstance = ObjectFactory::createObjectByConfiguredName('html_link_helper_class', array($this, 'city_profile')); + +// Add action +$linkInstance->addActionLinkById('profile', 'profile'); + +// Flush the finished form +$linkInstance->flushContent(); + +// [EOC] +?> +
+
+ Virtuelle Beantragung von Starthilfe +
+ +
+ {?city_government_startup?} +
+
diff --git a/application/city/templates/de/code/action_city_login_government_training.ctp b/application/city/templates/de/code/action_city_login_government_training.ctp new file mode 100644 index 0000000..d7d423c --- /dev/null +++ b/application/city/templates/de/code/action_city_login_government_training.ctp @@ -0,0 +1,62 @@ +prefetchValueInstance('user'); + +// Add main form group +$helperInstance->addFormNote('reality_warning', "WARNUNG: Bitte dieses Formular nicht mit echten Angaben ausfüllen!"); + +// Add group for personal data +$helperInstance->addFormGroup('persona_data', "Deine persönliche Daten, die für die Kursusteilnahme nötig sind:"); + +// Ask again for current account password +$helperInstance->addFormGroup('password', "Bitte gebe zur Bestätigung dein derzeitiges Passwort ein."); +$helperInstance->addFieldText('password', "Derzeitiges Passwort:"); +$helperInstance->addInputPasswordField('password'); + +// Display email, surname and family name +$helperInstance->addFormNote('surname', "Vorname: ".$helperInstance->getValueField('surname').""); +$helperInstance->addFormNote('family', "Nachname: ".$helperInstance->getValueField('family').""); +$helperInstance->addFormNote('email', "Email-Adresse: ".$helperInstance->getValueField('email').""); +$helperInstance->addFormNote('birthday', "Geburtstag: ".(int)$helperInstance->getValueField('birth_day').".".(int)$helperInstance->getValueField('birth_month').".".(int)$helperInstance->getValueField('birth_year').""); + +// Add link placeholder for profile page +$helperInstance->addFormNote('profile', "Stimmen die Daten noch? {?city_profile?}"); + +// CAPTCHA enabled? +if ($helperInstance->ifFormSecuredWithCaptcha()) { + $helperInstance->addFormGroup('captcha_user', "Die virtuelle Beantragung eines Trainingkursus ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, um den Trainingskursus zu beantragen."); + $helperInstance->addCaptcha(); +} // END - if + +// Final notices +$helperInstance->addFormGroup('buttons', "Sind alle Daten nun korrekt eingegeben? Dann sende sie mit einem Klick einfach ab!"); +$helperInstance->addInputResetButton("Alles nochmal eingeben"); +$helperInstance->addInputSubmitButton("Trainingskurs beantragen"); +$helperInstance->addFormNote('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzen gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz"."); + +// Flush the finished form +$helperInstance->flushContent(); + +// Get link helper for profile link +$linkInstance = ObjectFactory::createObjectByConfiguredName('html_link_helper_class', array($this, 'city_profile')); + +// Add action +$linkInstance->addActionLinkById('profile', 'profile'); + +// Flush the finished form +$linkInstance->flushContent(); + +// [EOC] +?> +
+
+ Virtuelle Beantragung eines Training-Kursus +
+ +
+ {?city_government_training?} +
+
diff --git a/application/city/templates/de/code/action_city_login_logout.ctp b/application/city/templates/de/code/action_city_login_logout.ctp new file mode 100644 index 0000000..bc534f8 --- /dev/null +++ b/application/city/templates/de/code/action_city_login_logout.ctp @@ -0,0 +1,30 @@ +addLinkWithTextById('logout_now'); + +// Flush the content +$helperInstance->flushContent(); + +// Get helper instance +$helperInstance = ObjectFactory::createObjectByConfiguredName('html_link_helper_class', array($this, 'return_login')); + +// Set link text +$helperInstance->addLinkWithTextById('return_login'); + +// Flush the content +$helperInstance->flushContent(); + +// [EOC] +?> +
+
+ Willst du dich wirklich aus dem Spiel ausloggen? +
+ +
+ {?logout_now?} | {?return_login?} +
+
diff --git a/application/city/templates/de/code/action_city_login_profile.ctp b/application/city/templates/de/code/action_city_login_profile.ctp new file mode 100644 index 0000000..26ac26d --- /dev/null +++ b/application/city/templates/de/code/action_city_login_profile.ctp @@ -0,0 +1,145 @@ +prefetchValueInstance('user'); + +// Password can only be changed when the old one is entered and new one twice! +$helperInstance->addFormGroup('pass', "Neues Passwort einrichten:"); +$helperInstance->addFormSubGroup('pass', "Bitte gebe zum Ändern deines Passwortes zweimal das gewünschte neue Passwort ein."); +$helperInstance->addFieldText('pass1', "Neues Passwort:"); +$helperInstance->addInputPasswordField('pass1'); +$helperInstance->addFieldText('pass2', "Neues Passwort, Wiederholung:"); +$helperInstance->addInputPasswordField('pass2'); + +// Display current email +$helperInstance->addFormNote('current_email', "Derzeitige Email-Adresse: ".$helperInstance->getValueField('email').""); + +// Only for changing email address +if ($helperInstance->ifEmailChangeAllowed()) { + $helperInstance->addFormGroup('email', "Änderung deiner Email-Addresse:"); + $helperInstance->addFormSubGroup('email', "Gebe nur deine Email-Adresse zweimal ein, wenn du diese ändern möchtest!"); + $helperInstance->addFieldText('email1', "Email-Adresse:"); + $helperInstance->addInputTextField('email1'); + $helperInstance->addFieldText('email2', "Wiederholung Email-Adresse:"); + $helperInstance->addInputTextField('email2'); + + if ($helperInstance->ifEmailMustBeUnique()) { + $helperInstance->addFormNote('email', "Die von dir eingegebene Email-Adresse darf nur einmal im Spiel verwendet worden sein."); + } // END - if + + if ($helperInstance->ifEmailChangeRequireConfirmation()) { + $helperInstance->addFormNote('confirm', "Es wird ein Bestätigungslink an deine neue Email-Adresse gesendet. Bitte klicke diesen dann möglichst schnell an."); + } // END - if +} // END - if + +// Add form group for user profile +$helperInstance->addFormGroup('profile', "Hier kannst du deine Profildaten ändern."); + +// Persoenliche Daten mit in der Anmeldung abfragen? +if ($helperInstance->ifRegisterIncludesPersonaData()) { + $helperInstance->addFormSubGroup('persona', "Wenn du magst, dann vervollständige deine komplette Adresse mit deinem Namen."); + $helperInstance->addFieldText('surname', "Dein Vorname:"); + $helperInstance->addInputTextFieldWithDefault('surname'); + $helperInstance->addFieldText('family', "Dein Nachname:"); + $helperInstance->addInputTextFieldWithDefault('family'); + $helperInstance->addFieldText('street', "Strasse und Hausnummer:"); + $helperInstance->addInputTextFieldWithDefault('street'); + $helperInstance->addFieldText('city', "Wohnort:"); + $helperInstance->addInputTextFieldWithDefault('city'); + + // Include birthday? + if ($helperInstance->ifProfileIncludesBirthDay()) { + $helperInstance->addFormSubGroup('birthday', "Verrate uns doch dein Geburtsdatum, als Dankeschön erhälst du interessante Prämien - ausschliesslich per Email - zum Geburtstag zugesandt! Gültiges Format: TT.MM.JJJJ"); + $helperInstance->addInputTextField('birth_day'); + $helperInstance->addFieldText('birth_day', "."); + $helperInstance->addInputTextField('birth_month'); + $helperInstance->addFieldText('birth_day', "."); + $helperInstance->addInputTextField('birth_year'); + } // END - if +} // END - if + +// Add sub group for zip code +$helperInstance->addFormSubGroup('zip', "Magst du uns auch deine Postleitzahl verraten?"); +$helperInstance->addFieldText('zip', "Postleitzahl:"); +$helperInstance->addInputTextFieldWithDefault('zip'); + +// Add sub group for chat protocols +$helperInstance->addFormSubGroup('chat', "Gebe hier deine Nicknames bzw. Nummern an:"); + +// Add ICQ chat? +if ($helperInstance->ifChatEnabled('icq')) { + $helperInstance->addFieldText('icq', "ICQ-Nummer:"); + $helperInstance->addInputTextFieldWithDefault('icq'); +} // END - if + +// Add Jabber chat? +if ($helperInstance->ifChatEnabled('jabber')) { + $helperInstance->addFieldText('jabber', "Jabber:"); + $helperInstance->addInputTextFieldWithDefault('jabber'); +} // END - if + +// Add Yahoo! chat? +if ($helperInstance->ifChatEnabled('yahoo')) { + $helperInstance->addFieldText('yahoo', "Yahoo!:"); + $helperInstance->addInputTextFieldWithDefault('yahoo'); +} // END - if + +// Add AOL chat? +if ($helperInstance->ifChatEnabled('aol')) { + $helperInstance->addFieldText('aol', "AOL-Screenname:"); + $helperInstance->addInputTextFieldWithDefault('aol'); +} // END - if + +// Add MSN chat? +if ($helperInstance->ifChatEnabled('msn')) { + $helperInstance->addFieldText('msn', "MSN:"); + $helperInstance->addInputTextFieldWithDefault('msn'); +} // END - if + +if (!$helperInstance->ifRegisterRequiresEmailVerification()) { + $helperInstance->addFormExtraNote(1, "Die Benachrichtigungen per Email sind im Loginbereich verfeinerbar, welche du genau haben willst."); +} // END - if + +// Rules already accepted? +if ($helperInstance->ifRulesHaveChanged()) { + $helperInstance->addFormGroup('rules', "Bitte lese dir die Spieleregeln gut durch und kreuze dann "Ja, ich akzeptiere die aktuellen Spielregeln" an."); + $helperInstance->addFieldText('rules', "Ja, ich akzeptiere die aktuellen Spielregeln:"); + $helperInstance->addInputCheckboxField('rules', false); +} else { + $helperInstance->addFormNote('rules_accepted', "Du hast die aktuellen Spielregeln akzeptiert. Vielen Dank!"); + $helperInstance->addInputHiddenField('rules', "1"); +} + +// CAPTCHA enabled? +if ($helperInstance->ifFormSecuredWithCaptcha()) { + $helperInstance->addFormGroup('captcha_user', "Das Ändern von Profildaten ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit deine Änderungen gespeichert werden können."); + $helperInstance->addCaptcha(); +} // END - if + +// Ask again for current account password +$helperInstance->addFormGroup('pass_old', "Bitte gebe zur Bestätigung der Änderungen dein derzeitiges Passwort ein."); +$helperInstance->addFieldText('pass_old', "Derzeitiges Passwort:"); +$helperInstance->addInputPasswordField('pass_old'); + +// Final notices +$helperInstance->addFormGroup('buttons', "Sind alle Daten nun korrekt eingegeben? Dann sende sie mit einem Klick einfach ab!"); +$helperInstance->addInputResetButton("Alles nochmal eingeben"); +$helperInstance->addInputSubmitButton("Accountdaten aktualisieren"); +$helperInstance->addFormNote('data_protection', "Deine Daten werden nach den gültigen Datenschutzgesetzen gespeichert und werden nicht an Dritte weitergegeben. Weiteres dazu siehe Link "Datenschutz"."); + +// Flush finished form +$helperInstance->flushContent(); + +// [EOC] +?> +
+ Deine Profildaten bearbeiten +
+ +
+ {?city_profile?} +
diff --git a/application/city/templates/de/code/action_city_login_status_problem.ctp b/application/city/templates/de/code/action_city_login_status_problem.ctp new file mode 100644 index 0000000..813840f --- /dev/null +++ b/application/city/templates/de/code/action_city_login_status_problem.ctp @@ -0,0 +1,79 @@ +prefetchValueInstance('user'); + +// Add submit button or notice +if ($helperInstance->ifUserAccountUnconfirmed()) { + // Add submit button + $helperInstance->addInputHiddenFieldWithDefault('email'); + $helperInstance->addInputSubmitButton("Bestätigungslink erneut aussenden"); +} elseif ($helperInstance->ifUserAccountLocked()) { + // Account is locked + $helperInstance->addFormNote('status_locked', "Dein Account wurde gesperrt! Grund der Sperre: + ".$helperInstance->getValueField('lock_reason')." + Bitte melde dich beim Support, damit dieser dir weiterhelfen kann." + ); +} elseif ($helperInstance->ifUserAccountGuest()) { + // Account is guest account + $helperInstance->addFormNote('status_guest', "Gästeaccounts sind in der Funktionalität + leicht eingeschränkt. Bitte melde dich an, damit du ein + vollwertiges Account bekommst." + ); +} + +// Flush content and automatically close the form +$helperInstance->flushContent(); + +// Build the form for confirmation +$helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', 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:"); + $helperInstance->addInputTextField('code'); + + // Add submit button + $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(); + +// [EOC] +?> +
+ Problem mit deinem Account gefunden: +
+ +
+ Du bist möglicherweise für deine ausgewählte Aktion nicht + berechtigt oder du hast noch deine Email-Adresse nicht bestätigt. Du + kannst dir nun den Bestätigungslink erneut aussenden lassen, oder den + Bestätigungscode unten eingeben. + + + +
+ Weitere Möglichkeiten: +
+ +
+ {?confirm_code?} +
+
diff --git a/application/city/templates/de/code/action_city_login_welcome.ctp b/application/city/templates/de/code/action_city_login_welcome.ctp new file mode 100644 index 0000000..550d73c --- /dev/null +++ b/application/city/templates/de/code/action_city_login_welcome.ctp @@ -0,0 +1,3 @@ +
+ {?city_login_news?} +
diff --git a/application/city/templates/de/code/block_persona_data.ctp b/application/city/templates/de/code/block_persona_data.ctp new file mode 100644 index 0000000..07ff64c --- /dev/null +++ b/application/city/templates/de/code/block_persona_data.ctp @@ -0,0 +1,27 @@ +prefetchValueInstance('user'); + +// Flush the content out +$helperInstance->flushContent(); + +// [EOC] +?> +
+ Spielername: {?block_username?} +
+
+ Spielerstatus: {?block_user_status?} +
+
+ {?currency?}: {?block_points?} +
+
+ {?profile?} +
+
+ Angemeldet seit: {?block_registered?} +
diff --git a/application/city/templates/de/code/captch_graphic_code.ctp b/application/city/templates/de/code/captch_graphic_code.ctp index 942d94c..6e89dfc 100644 --- a/application/city/templates/de/code/captch_graphic_code.ctp +++ b/application/city/templates/de/code/captch_graphic_code.ctp @@ -1,6 +1,6 @@ addFieldText('captcha_code', "Bitte wiederhole den Code:"); diff --git a/application/city/templates/de/code/city_main.ctp b/application/city/templates/de/code/city_main.ctp index 70c12a7..006357e 100644 --- a/application/city/templates/de/code/city_main.ctp +++ b/application/city/templates/de/code/city_main.ctp @@ -1,21 +1,29 @@ {?header?}
- +
+ {?city_header?} +
+ + + + -
- {?city_header?} -
+
+ {?language_selector?} +
-
- {?main_content?} -
+
+ {?content?} +
- +
{?footer?} diff --git a/application/city/templates/de/code/login_main.ctp b/application/city/templates/de/code/login_main.ctp new file mode 100644 index 0000000..fb818fe --- /dev/null +++ b/application/city/templates/de/code/login_main.ctp @@ -0,0 +1,57 @@ +prefetchValueInstance('user', 'user_points'); + +// Assign fields with template variables +$blockInstance->assignField('username'); +$blockInstance->assignFieldWithFilter('user_status', 'user_status_translator'); +$blockInstance->assignFieldWithFilter('points', 'format_number'); + +// Shall we include registration date? +if ($blockInstance->ifIncludeRegistrationStamp()) { + // Then assign it as well! + $blockInstance->assignFieldWithFilter('registered', 'format_timestamp'); +} // END - if + +// Flush the content out to a template variable +$blockInstance->flushContent(); + +// Get helper instance +$linkInstance = ObjectFactory::createObjectByConfiguredName('html_link_helper_class', array($this, 'logout')); + +// Add action +$linkInstance->addActionLinkById('logout', 'logout'); + +// Flush the content +$linkInstance->flushContent(); + +// [EOC] +?> +
+ Willkommen im Loginbereich von {?app_full_name?}! +
+ +
+ {?login_content?} +
+ +
+
+ Account-Infos: +
+ +
+ {?persona_data?} +
+ +
+ {?logout?} +
+
diff --git a/application/city/templates/de/code/register_form.ctp b/application/city/templates/de/code/register_form.ctp index 3a9c354..db0103c 100644 --- a/application/city/templates/de/code/register_form.ctp +++ b/application/city/templates/de/code/register_form.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('html_form_helper', array($this, 'city_register')); +$helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'city_register')); // Always ask at least for nickname and password $helperInstance->addFormGroup('login', "Bitte gebe hier gewünschten Nickname und dein Zugangspasswort ein."); diff --git a/application/city/templates/de/menu/login_area_menu_entries.xml b/application/city/templates/de/menu/login_area_menu_entries.xml new file mode 100644 index 0000000..9c3a6ee --- /dev/null +++ b/application/city/templates/de/menu/login_area_menu_entries.xml @@ -0,0 +1,95 @@ + + + + + + + + <title-id><![CDATA[home_menu_title]]></title-id> + <title-class><![CDATA[menu_title]]></title-class> + <title-text><![CDATA[Home:]]></title-text> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <title-id><![CDATA[misc_menu_title]]></title-id> + <title-class><![CDATA[menu_title]]></title-class> + <title-text><![CDATA[Weiteres:]]></title-text> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core b/core index bbb4031..4d41d33 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit bbb4031b65beb69a02f8c476ae4cdc36da851d84 +Subproject commit 4d41d3384681ba250309b7c71948968938f8df5b diff --git a/db/user/.htaccess b/db/user/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/db/user/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/db/user_points/.htaccess b/db/user_points/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/db/user_points/.htaccess @@ -0,0 +1 @@ +Deny from all -- 2.39.5