3 * A general purpose web helper. You should not instance this like all the other
4 * base classes. Instead write your own web helper class and inherit this class.
6 * @author Roland Haeder <webmaster@ship-simu.org>
8 * @copyright Copyright (c) 2007 - 2009 Roland Haeder, this is free software
9 * @license GNU GPL 3.0 or any newer version
10 * @link http://www.ship-simu.org
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 class BaseWebHelper extends BaseHelper {
27 * Protected constructor
29 * @param $className The real class name
32 protected function __construct ($className) {
33 // Call parent constructor
34 parent::__construct($className);
38 * Checks wether the registration requires a valid email address
40 * @return $required Wether the email address is required
42 public function ifRegisterRequiresEmailVerification () {
43 $required = ($this->getConfigInstance()->readConfig('register_requires_email') === "Y");
48 * Checks wether profile data shall be asked
50 * @return $required Wether profile shall be asked
52 public function ifRegisterIncludesProfile () {
53 $required = ($this->getConfigInstance()->readConfig('register_includes_profile') === "Y");
58 * Checks wether personal data shall be asked
60 * @return $required Wether personal data shall be asked
62 public function ifRegisterIncludesPersonaData () {
63 $required = ($this->getConfigInstance()->readConfig('register_personal_data') === "Y");
68 * Checks wether for birthday shall be asked
70 * @return $required Wether birthday shall be asked
72 public function ifProfileIncludesBirthDay () {
73 $required = ($this->getConfigInstance()->readConfig('profile_includes_birthday') === "Y");
78 * Checks wether email addresses can only be once used
82 public function ifEmailMustBeUnique () {
83 $isUnique = ($this->getConfigInstance()->readConfig('register_email_unique') === "Y");
88 * Checks wether the specified chat protocol is enabled in this form
90 * @return $required Wether the specified chat protocol is enabled
92 public function ifChatEnabled ($chatProtocol) {
93 $required = ($this->getConfigInstance()->readConfig(sprintf("chat_enabled_%s", $chatProtocol)) == "Y");
98 * Checks wether login is enabled or disabled
100 * @return $isEnabled Wether the login is enabled or disabled
102 public function ifLoginIsEnabled () {
103 $isEnabled = ($this->getConfigInstance()->readConfig('login_enabled') === "Y");
108 * Checks wether login shall be done by username
110 * @return $isEnabled Wether the login shall be done by username
112 public function ifLoginWithUsername () {
113 $isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "username");
118 * Checks wether login shall be done by email
120 * @return $isEnabled Wether the login shall be done by email
122 public function ifLoginWithEmail () {
123 $isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "email");
128 * Checks wether guest login is allowed
130 * @return $isAllowed Wether guest login is allowed
132 public function ifGuestLoginAllowed () {
133 $isAllowed = ($this->getConfigInstance()->readConfig('guest_login_allowed') === "Y");
138 * Checks wether the email address change must be confirmed
140 * @return $requireConfirm Wether email change must be confirmed
142 public function ifEmailChangeRequireConfirmation () {
143 $requireConfirm = ($this->getConfigInstance()->readConfig('email_change_confirmation') === "Y");
144 return $requireConfirm;
148 * Checks wether the rules has been updated
150 * @return $rulesUpdated Wether rules has been updated
151 * @todo Implement check if rules have been changed
153 public function ifRulesHaveChanged () {
158 * Checks wether email change is allowed
160 * @return $emailChange Wether changing email address is allowed
162 public function ifEmailChangeAllowed () {
163 $emailChange = ($this->getConfigInstance()->readConfig('email_change_allowed') === "Y");
168 * Checks wether the user account is unconfirmed
170 * @return $isUnconfirmed Wether the user account is unconfirmed
172 public function ifUserAccountUnconfirmed () {
173 $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_unconfirmed'));
174 return $isUnconfirmed;
178 * Checks wether the user account is locked
180 * @return $isUnconfirmed Wether the user account is locked
182 public function ifUserAccountLocked () {
183 $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_locked'));
184 return $isUnconfirmed;
188 * Checks wether the user account is a guest
190 * @return $isUnconfirmed Wether the user account is a guest
192 public function ifUserAccountGuest () {
193 $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_guest'));
194 return $isUnconfirmed;
198 * Checks wether the refill page is active which should be not the default
199 * on non-web applications.
201 * @return $refillActive Wether the refill page is active
203 public function ifRefillPageActive () {
204 $refillActive = ($this->getConfigInstance()->readConfig('refill_page_active') === "Y");
205 return $refillActive;