]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php
Opps, forgot this.
[core.git] / inc / classes / main / helper / captcha / web / class_GraphicalCodeCaptcha.php
index 37a206ca4b3d5ea836eb3f3548fd3ee999ef4dd0..3d097bdb14969bc9726bbb186a87adb468b5fc86 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A solveable graphical code CAPTCHA
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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
@@ -25,12 +25,12 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
        /**
         * Hash of the CAPTCHA string
         */
-       private $hashedString = "";
+       private $hashedString = '';
 
        /**
         * Encrypted string
         */
-       private $encryptedString = "";
+       private $encryptedString = '';
 
        /**
         * Protected constructor
@@ -49,7 +49,7 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
         * @param       $extraInstance          An extra instance, just for better hash data
         * @return      $captchaInstance        An instance of this captcha class
         */
-       public final static function createGraphicalCodeCaptcha (HelpableTemplate $helperInstance, FrameworkInterface $extraInstance = null) {
+       public static final function createGraphicalCodeCaptcha (HelpableTemplate $helperInstance, FrameworkInterface $extraInstance = NULL) {
                // Get a new instance
                $captchaInstance = new GraphicalCodeCaptcha();
 
@@ -70,10 +70,10 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
         */
        public function initiateCaptcha () {
                // Get total length
-               $captchaLength = $this->getConfigInstance()->readConfig('captcha_string_length');
+               $captchaLength = $this->getConfigInstance()->getConfigEntry('captcha_string_length');
 
                // Get max string length
-               $strLength = $this->getConfigInstance()->readConfig('random_string_length');
+               $strLength = $this->getConfigInstance()->getConfigEntry('random_string_length');
 
                // Calculate starting position based on random place
                $start = $this->getRngInstance()->randomNumber(0, ($strLength - $captchaLength));
@@ -91,7 +91,7 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
                $captchaString = substr($base64String, $start, $captchaLength);
 
                // Get all characters we want to replace
-               $searchChars = $this->getConfigInstance()->readConfig('captcha_search_chars');
+               $searchChars = $this->getConfigInstance()->getConfigEntry('captcha_search_chars');
 
                // Get fixed salt and use it as "replacement characters"
                $replaceChars = $this->getRngInstance()->getExtraSalt();
@@ -137,13 +137,13 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
                $templateInstance->loadCodeTemplate('captch_graphic_code');
 
                // Rename variable
-               $templateInstance->renameVariable('captcha_code', $helperInstance->getFormName().'_captcha');
-               $templateInstance->renameVariable('captcha_hash', $helperInstance->getFormName().'_hash');
-               $templateInstance->renameVariable('encrypted_code', $helperInstance->getFormName().'_encrypt');
+               $templateInstance->renameVariable('captcha_code', $helperInstance->getFormName() . '_captcha');
+               $templateInstance->renameVariable('captcha_hash', $helperInstance->getFormName() . '_hash');
+               $templateInstance->renameVariable('encrypted_code', $helperInstance->getFormName() . '_encrypt');
 
                // Assign variables
-               $templateInstance->assignVariable($helperInstance->getFormName().'_encrypt', urlencode(base64_encode($this->encryptedString)));
-               $templateInstance->assignVariable($helperInstance->getFormName().'_hash', $this->hashedString);
+               $templateInstance->assignVariable($helperInstance->getFormName() . '_encrypt', urlencode(base64_encode($this->encryptedString)));
+               $templateInstance->assignVariable($helperInstance->getFormName() . '_hash', $this->hashedString);
 
                // Compile the template
                $templateInstance->compileTemplate();