namespace Org\Mxchange\CoreFramework\Helper\Captcha;
// Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper;
use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
/**
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
*
* @return void
*/
- protected function __construct () {
+ private function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
*/
public function initiateCaptcha () {
// Get total length
- $captchaLength = $this->getConfigInstance()->getConfigEntry('captcha_string_length');
+ $captchaLength = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('captcha_string_length');
// Get max string length
- $strLength = $this->getConfigInstance()->getConfigEntry('random_string_length');
+ $strLength = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('random_string_length');
// Calculate starting position based on random place
$start = $this->getRngInstance()->randomNumber(0, ($strLength - $captchaLength));
$captchaString = substr($base64String, $start, $captchaLength);
// Get all characters we want to replace
- $searchChars = $this->getConfigInstance()->getConfigEntry('captcha_search_chars');
+ $searchChars = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('captcha_search_chars');
// Get fixed salt and use it as "replacement characters"
$replaceChars = $this->getRngInstance()->getExtraSalt();
// Replace character
$captchaString = str_replace($search, $replace, $captchaString, $captchaLength);
- } // END - foreach
+ }
// Get crypto instance
- $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+ $cryptoInstance = CryptoHelper::getSelfInstance();
// Hash the CAPTCHA code for later comparison
$this->hashedString = $cryptoInstance->hashString($captchaString);