]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/helper/web/forms/class_WebFormHelper.php
Copyright year updated, converted double->single quotes
[core.git] / inc / classes / main / helper / web / forms / class_WebFormHelper.php
index e20545f0d254246a2e90694eae6073aaed0be568..5bb8a27ceaeb0335d27d04576ae0bcae1b27982a 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A helper for constructing web forms
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007 - 2009 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @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
  */
 class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        /**
-        * Wether the form tag is opened (keep at false or else your forms will
+        * Whether the form tag is opened (keep at FALSE or else your forms will
         * never work!)
         */
-       private $formOpened = false;
+       private $formOpened = FALSE;
 
        /**
         * Name of the form
@@ -34,9 +34,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        private $formName = '';
 
        /**
-        * Wether form tag is enabled (default: true)
+        * Whether form tag is enabled (default: TRUE)
         */
-       private $formEnabled = true;
+       private $formEnabled = TRUE;
 
        // Class Constants
        const EXCEPTION_FORM_NAME_INVALID       = 0x120;
@@ -59,11 +59,11 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         *
         * @param       $templateInstance       An instance of a valid template engine
         * @param       $formName                       Name of the form
-        * @param       $formId                         Value for "id" attribute (default: $formName)
-        * @param       $withForm                       Wether include the form tag
+        * @param       $formId                         Value for 'id' attribute (default: $formName)
+        * @param       $withForm                       Whether include the form tag
         * @return      $helperInstance         A preparedf instance of this helper
         */
-       public final static function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false, $withForm = true) {
+       public static final function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = FALSE, $withForm = TRUE) {
                // Get new instance
                $helperInstance = new WebFormHelper();
 
@@ -71,7 +71,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                $helperInstance->setTemplateInstance($templateInstance);
 
                // Is the form id not set?
-               if ($formId === false) {
+               if ($formId === FALSE) {
                        // Use form id from form name
                        $formId = $formName;
                } // END - if
@@ -79,13 +79,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                // Set form name
                $helperInstance->setFormName($formName);
 
-               // A form-less field may say "false" here...
-               if ($withForm === true) {
+               // A form-less field may say 'FALSE' here...
+               if ($withForm === TRUE) {
                        // Create the form
                        $helperInstance->addFormTag($formName, $formId);
                } else {
                        // Disable form
-                       $helperInstance->enableForm(false);
+                       $helperInstance->enableForm(FALSE);
                }
 
                // Return the prepared instance
@@ -95,31 +95,31 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        /**
         * Add the form tag or close it an already opened form tag
         *
-        * @param       $formName       Name of the form (default: false)
-        * @param       $formId         Id of the form (attribute "id"; default: false)
+        * @param       $formName       Name of the form (default: FALSE)
+        * @param       $formId         Id of the form (attribute 'id'; default: FALSE)
         * @return      void
-        * @throws      InvalidFormNameException        If the form name is invalid (=false)
+        * @throws      InvalidFormNameException        If the form name is invalid ( = FALSE)
         * @todo        Add some unique PIN here to bypass problems with some browser and/or extensions
         */
-       public function addFormTag ($formName = false, $formId = false) {
+       public function addFormTag ($formName = FALSE, $formId = FALSE) {
                // When the form is not yet opened at least form name must be valid
-               if (($this->formOpened === false) && ($formName === false)) {
+               if (($this->formOpened === FALSE) && ($formName === FALSE)) {
                        // Thrown an exception
                        throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
                } // END - if
 
                // Close the form is default
-               $formContent = "</form>";
+               $formContent = '</form>';
 
-               // Check wether we shall open or close the form
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               // Check whether we shall open or close the form
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Add HTML code
                        $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\"",
                                $formName,
-                               $this->getConfigInstance()->readConfig('base_url'),
-                               $this->getConfigInstance()->readConfig('form_action'),
-                               $this->getConfigInstance()->readConfig('form_method'),
-                               $this->getConfigInstance()->readConfig('form_target')
+                               $this->getConfigInstance()->getConfigEntry('base_url'),
+                               $this->getConfigInstance()->getConfigEntry('form_action'),
+                               $this->getConfigInstance()->getConfigEntry('form_method'),
+                               $this->getConfigInstance()->getConfigEntry('form_target')
                        );
 
                        // Add form id as well
@@ -128,10 +128,10 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        );
 
                        // Add close bracket
-                       $formContent .= ">";
+                       $formContent .= '>';
 
                        // Open the form and remeber the form name
-                       $this->formOpened = true;
+                       $this->formOpened = TRUE;
 
                        // Add it to the content
                        $this->addHeaderContent($formContent);
@@ -146,7 +146,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        } // END - if
 
                        // Simply close it
-                       $this->formOpened = false;
+                       $this->formOpened = FALSE;
 
                        // Add it to the content
                        $this->addFooterContent($formContent);
@@ -164,7 +164,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputTextField ($fieldName, $fieldValue = '') {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
@@ -176,7 +176,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                        $fieldValue
                );
 
-               // And add it maybe with a "li" tag
+               // And add it maybe with a 'li' tag
                $this->addContentToPreviousGroup($inputContent);
        }
 
@@ -189,7 +189,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        public function addInputTextFieldWithDefault ($fieldName) {
                // Get the value from instance
                $fieldValue = $this->getValueField($fieldName);
-               //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+               //* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
                $this->addInputTextField($fieldName, $fieldValue);
@@ -206,7 +206,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputPasswordField ($fieldName, $fieldValue = '') {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
@@ -233,7 +233,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputHiddenField ($fieldName, $fieldValue = '') {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
@@ -257,7 +257,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        public function addInputHiddenFieldWithDefault ($fieldName) {
                // Get the value from instance
                $fieldValue = $this->getValueField($fieldName);
-               //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+               //* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
                $this->addInputHiddenField($fieldName, $fieldValue);
@@ -272,8 +272,8 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputHiddenConfiguredField ($fieldName, $prefix) {
                // Get the value from instance
-               $fieldValue = $this->getConfigInstance()->readConfig("{$prefix}_{$fieldName}");
-               //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+               $fieldValue = $this->getConfigInstance()->getConfigEntry("{$prefix}_{$fieldName}");
+               //* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
                $this->addInputHiddenField($fieldName, $fieldValue);
@@ -284,20 +284,20 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         * yet opened. The field's name will be set as id.
         *
         * @param       $fieldName              Input field name
-        * @param       $fieldChecked   Wether the field is checked (defaut: checked)
+        * @param       $fieldChecked   Whether the field is checked (defaut: checked)
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputCheckboxField ($fieldName, $fieldChecked = true) {
+       public function addInputCheckboxField ($fieldName, $fieldChecked = TRUE) {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
-               // Set wether the check box is checked...
+               // Set whether the check box is checked...
                $checked = " checked=\"checked\"";
-               if ($fieldChecked === false) $checked = " ";
+               if ($fieldChecked === FALSE) $checked = ' ';
 
                // Generate the content
                $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
@@ -320,9 +320,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputResetButton ($buttonText) {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
-                       throw new FormClosedException (array($this, "reset"), self::EXCEPTION_CLOSED_FORM);
+                       throw new FormClosedException (array($this, 'reset'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
@@ -345,9 +345,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputSubmitButton ($buttonText) {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
-                       throw new FormClosedException (array($this, "submit"), self::EXCEPTION_CLOSED_FORM);
+                       throw new FormClosedException (array($this, 'submit'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
@@ -372,13 +372,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addFormGroup ($groupId = '', $groupText = '') {
                // Is a form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw exception here
                        throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // At least the group name should be set
-               if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
+               if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === FALSE)) {
                        // Throw exception here
                        throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (empty($groupId)) {
@@ -387,16 +387,16 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                }
 
                // Same group to open?
-               if (($this->ifGroupOpenedPreviously() === false) && ($groupId === $this->getPreviousGroupId())) {
+               if (($this->ifGroupOpenedPreviously() === FALSE) && ($groupId === $this->getPreviousGroupId())) {
                        // Abort here silently
-                       return false;
+                       return FALSE;
                } // END - if
 
                // Initialize content with closing div by default
                $content = "    </div>\n</div><!-- Group - CLOSE //-->";
 
                // Is this group opened?
-               if ($this->ifGroupOpenedPreviously() === false) {
+               if ($this->ifGroupOpenedPreviously() === FALSE) {
                        // Begin the div/span blocks
                        $content = sprintf("<!-- Group %s - OPEN //-->
 <div class=\"group_box\" id=\"%s_group_box\">
@@ -428,7 +428,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
 
                        // All call it again if group name is not empty
                        if ((!empty($groupId)) && ($groupId != $prevGroupId)) {
-                               //* DEBUG: */ echo $groupId."/".$prevGroupId."<br />\n";
+                               //* DEBUG: */ echo $groupId.'/'.$prevGroupId."<br />\n";
                                $this->addFormGroup($groupId, $groupText);
                        } // END - if
                }
@@ -447,13 +447,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addFormSubGroup ($subGroupId = '', $subGroupText = '') {
                // Is a group opened?
-               if ($this->ifGroupOpenedPreviously() === false) {
+               if ($this->ifGroupOpenedPreviously() === FALSE) {
                        // Throw exception here
                        throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
                } // END - if
 
                // At least the sub group name should be set
-               if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
+               if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === FALSE)) {
                        // Throw exception here
                        throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (empty($subGroupId)) {
@@ -462,16 +462,16 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                }
 
                // Same sub group to open?
-               if (($this->ifSubGroupOpenedPreviously() === false) && ($subGroupId == $this->getPreviousSubGroupId())) {
+               if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($subGroupId == $this->getPreviousSubGroupId())) {
                        // Abort here silently
-                       return false;
+                       return FALSE;
                } // END - if
 
                // Initialize content with closing div by default
                $content = "    </div>\n</div><!-- Sub group- CLOSE //-->";
 
                // Is this group opened?
-               if ($this->ifSubGroupOpenedPreviously() === false) {
+               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
                        // Begin the span block
                        $content = sprintf("<!-- Sub group %s - OPEN //-->
 <div class=\"subgroup_box\" id=\"%s_subgroup_box\">
@@ -513,14 +513,14 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addFieldText ($fieldName, $fieldText) {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Set the block type
-               $block = "div";
-               if ($this->ifGroupOpenedPreviously()) $block = "span";
+               $block = 'div';
+               if ($this->ifGroupOpenedPreviously()) $block = 'span';
 
                // Generate the content
                $inputContent = sprintf("       <%s id=\"%s_text\">
@@ -547,9 +547,9 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addFormNote ($noteId, $formNotes) {
                // Is the form opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
-                       throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
+                       throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
@@ -575,13 +575,13 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addInputSelectField ($selectId, $firstEntry) {
                // Is the form group opened?
-               if (($this->formOpened === false) && ($this->formEnabled === true)) {
+               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
                        // Throw an exception
-                       throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
+                       throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Shall we close or open the sub group?
-               if (($this->ifSubGroupOpenedPreviously() === false) && ($this->getPreviousSubGroupId() !== $selectId)) {
+               if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($this->getPreviousSubGroupId() !== $selectId)) {
                        // Initialize first entry (which might be non-selectable if content is provided
                        if (!empty($firstEntry)) {
                                // Add selection around it
@@ -622,7 +622,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addSelectSubOption ($subName, $subValue) {
                // Is there a sub group (shall be a selection box!)
-               if ($this->ifSubGroupOpenedPreviously() === false) {
+               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
                        // Then throw an exception here
                        throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
                } // END - if
@@ -650,7 +650,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function addSelectOption ($optionName, $optionValue) {
                // Is there a sub group (shall be a selection box!)
-               if ($this->ifSubGroupOpenedPreviously() === false) {
+               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
                        // Then throw an exception here
                        throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
                } // END - if
@@ -672,8 +672,16 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         * @return      void
         */
        public function addCaptcha () {
-               // Get last executed pre filter
-               $extraInstance = Registry::getRegistry()->getInstance('extra');
+               // Init instance
+               $extraInstance = NULL;
+
+               try {
+                       // Get last executed pre filter
+                       $extraInstance = Registry::getRegistry()->getInstance('extra');
+               } catch (NullPointerException $e) {
+                       // Instance in registry is not set (NULL)
+                       // @TODO We need to log this later
+               }
 
                // Get a configured instance
                $captchaInstance = ObjectFactory::createObjectByConfiguredName($this->getFormName().'_captcha', array($this, $extraInstance));
@@ -691,10 +699,10 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        /**
         * Enables/disables the form tag usage
         *
-        * @param       $formEnabled    Wether form is enabled or disabled
+        * @param       $formEnabled    Whether form is enabled or disabled
         * @return      void
         */
-       public final function enableForm ($formEnabled = true) {
+       public final function enableForm ($formEnabled = TRUE) {
                $this->formEnabled = (bool) $formEnabled;
        }
 
@@ -718,35 +726,186 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
        }
 
        /**
-        * Checks wether the registration requires a valid email address
+        * Checks whether the registration requires a valid email address
         *
-        * @return      $required       Wether the email address is required
+        * @return      $required       Whether the email address is required
         */
        public function ifRegisterRequiresEmailVerification () {
-               $required = ($this->getConfigInstance()->readConfig('register_requires_email') === "Y");
+               $required = ($this->getConfigInstance()->getConfigEntry('register_requires_email') == 'Y');
                return $required;
        }
 
        /**
-        * Checks wether profile data shall be asked
+        * Checks whether profile data shall be asked
         *
-        * @return      $required       Wether profile data shall be asked
+        * @return      $required       Whether profile data shall be asked
         */
        public function ifRegisterIncludesProfile () {
-               $required = ($this->getConfigInstance()->readConfig('register_includes_profile') === "Y");
+               $required = ($this->getConfigInstance()->getConfigEntry('register_includes_profile') == 'Y');
                return $required;
        }
 
        /**
-        * Checks wether this form is secured by a CAPTCHA
+        * Checks whether this form is secured by a CAPTCHA
         *
-        * @return      $isSecured      Wether this form is secured by a CAPTCHA
+        * @return      $isSecured      Whether this form is secured by a CAPTCHA
         */
        public function ifFormSecuredWithCaptcha () {
-               $isSecured = ($this->getConfigInstance()->readConfig($this->getFormName().'_captcha_secured') === "Y");
+               $isSecured = ($this->getConfigInstance()->getConfigEntry($this->getFormName().'_captcha_secured') == 'Y');
                return $isSecured;
        }
 
+       /**
+        * Checks whether personal data shall be asked
+        *
+        * @return      $required       Whether personal data shall be asked
+        */
+       public function ifRegisterIncludesPersonaData () {
+               $required = ($this->getConfigInstance()->getConfigEntry('register_personal_data') == 'Y');
+               return $required;
+       }
+
+       /**
+        * Checks whether for birthday shall be asked
+        *
+        * @return      $required       Whether birthday shall be asked
+        */
+       public function ifProfileIncludesBirthDay () {
+               $required = ($this->getConfigInstance()->getConfigEntry('profile_includes_birthday') == 'Y');
+               return $required;
+       }
+
+       /**
+        * Checks whether email addresses can only be once used
+        *
+        * @return      $isUnique
+        */
+       public function ifEmailMustBeUnique () {
+               $isUnique = ($this->getConfigInstance()->getConfigEntry('register_email_unique') == 'Y');
+               return $isUnique;
+       }
+
+       /**
+        * Checks whether the specified chat protocol is enabled in this form
+        *
+        * @return      $required       Whether the specified chat protocol is enabled
+        */
+       public function ifChatEnabled ($chatProtocol) {
+               $required = ($this->getConfigInstance()->getConfigEntry('chat_enabled_' . $chatProtocol) == 'Y');
+               return $required;
+       }
+
+       /**
+        * Checks whether login is enabled or disabled
+        *
+        * @return      $isEnabled      Whether the login is enabled or disabled
+        */
+       public function ifLoginIsEnabled () {
+               $isEnabled = ($this->getConfigInstance()->getConfigEntry('login_enabled') == 'Y');
+               return $isEnabled;
+       }
+
+       /**
+        * Checks whether login shall be done by username
+        *
+        * @return      $isEnabled      Whether the login shall be done by username
+        */
+       public function ifLoginWithUsername () {
+               $isEnabled = ($this->getConfigInstance()->getConfigEntry('login_type') == "username");
+               return $isEnabled;
+       }
+
+       /**
+        * Checks whether login shall be done by email
+        *
+        * @return      $isEnabled      Whether the login shall be done by email
+        */
+       public function ifLoginWithEmail () {
+               $isEnabled = ($this->getConfigInstance()->getConfigEntry('login_type') == "email");
+               return $isEnabled;
+       }
+
+       /**
+        * Checks whether guest login is allowed
+        *
+        * @return      $isAllowed      Whether guest login is allowed
+        */
+       public function ifGuestLoginAllowed () {
+               $isAllowed = ($this->getConfigInstance()->getConfigEntry('guest_login_allowed') == 'Y');
+               return $isAllowed;
+       }
+
+       /**
+        * Checks whether the email address change must be confirmed
+        *
+        * @return      $requireConfirm         Whether email change must be confirmed
+        */
+       public function ifEmailChangeRequireConfirmation () {
+               $requireConfirm = ($this->getConfigInstance()->getConfigEntry('email_change_confirmation') == 'Y');
+               return $requireConfirm;
+       }
+
+       /**
+        * Checks whether the rules has been updated
+        *
+        * @return      $rulesUpdated   Whether rules has been updated
+        * @todo        Implement check if rules have been changed
+        */
+       public function ifRulesHaveChanged () {
+               return FALSE;
+       }
+
+       /**
+        * Checks whether email change is allowed
+        *
+        * @return      $emailChange    Whether changing email address is allowed
+        */
+       public function ifEmailChangeAllowed () {
+               $emailChange = ($this->getConfigInstance()->getConfigEntry('email_change_allowed') == 'Y');
+               return $emailChange;
+       }
+
+       /**
+        * Checks whether the user account is unconfirmed
+        *
+        * @return      $isUnconfirmed  Whether the user account is unconfirmed
+        */
+       public function ifUserAccountUnconfirmed () {
+               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->getConfigEntry('user_status_unconfirmed'));
+               return $isUnconfirmed;
+       }
+
+       /**
+        * Checks whether the user account is locked
+        *
+        * @return      $isUnconfirmed  Whether the user account is locked
+        */
+       public function ifUserAccountLocked () {
+               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->getConfigEntry('user_status_locked'));
+               return $isUnconfirmed;
+       }
+
+       /**
+        * Checks whether the user account is a guest
+        *
+        * @return      $isUnconfirmed  Whether the user account is a guest
+        */
+       public function ifUserAccountGuest () {
+               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->getConfigEntry('user_status_guest'));
+               return $isUnconfirmed;
+       }
+
+       /**
+        * Checks whether the refill page is active which should be not the default
+        * on non-web applications.
+        *
+        * @return      $refillActive   Whether the refill page is active
+        */
+       public function ifRefillPageActive () {
+               $refillActive = ($this->getConfigInstance()->getConfigEntry('refill_page_active') == 'Y');
+               return $refillActive;
+       }
+
        /**
         * Flushs the content out (not yet secured against open forms, etc.!) or
         * close the form automatically
@@ -756,10 +915,10 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
         */
        public function flushContent () {
                // Is the form still open?
-               if (($this->formOpened === true) && ($this->formEnabled === true)) {
+               if (($this->formOpened === TRUE) && ($this->formEnabled === TRUE)) {
                        // Close the form automatically
                        $this->addFormTag();
-               } elseif ($this->formEnabled === false) {
+               } elseif ($this->formEnabled === FALSE) {
                        if ($this->ifSubGroupOpenedPreviously()) {
                                // Close sub group
                                $this->addFormSubGroup();
@@ -770,7 +929,7 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
                }
 
                // Send content to template engine
-               //* DEBUG: */ echo __METHOD__.": form=".$this->getFormName().", size=".strlen($this->renderContent())."<br />\n";
+               //* DEBUG: */ print __METHOD__.": form=".$this->getFormName().", size=".strlen($this->renderContent())."<br />\n";
                $this->getTemplateInstance()->assignVariable($this->getFormName(), $this->renderContent());
        }
 }