Fixed bug: Mishandling of session data. Thanks to Wolo Wolski.
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 20 Oct 2009 14:23:17 +0000 (14:23 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 20 Oct 2009 14:23:17 +0000 (14:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_freecap/trunk@25654 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
pi1/class.tx_srfreecap_pi1.php
pi2/class.tx_srfreecap_pi2.php

index 77cdeba..9e98caf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-10-20  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug: Mishandling of session data. Thanks to Wolo Wolski.
+
 2009-08-31  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature: new TS constant accessibleOutputImage and textual version.
index 2643328..b66cb09 100644 (file)
@@ -277,6 +277,10 @@ class tx_srfreecap_pi1 extends tslib_pibase {
                        // accessible via the web or use random string option
                        if ($this->sessionData[$this->extKey . '_attempts'] > $this->max_attempts) {
                                $this->sessionData[$this->extKey . '_word_hash'] = false;
+                               $this->sessionData[$this->extKey . '_word_accessible'] = false;
+                               $this->sessionData[$this->extKey . '_hash_func'] = false;
+                               $GLOBALS['TSFE']->fe_user->setKey('ses','tx_'.$this->extKey,$this->sessionData);
+                               $GLOBALS['TSFE']->storeSessionData();
                                $string = $this->pi_getLL('max_attempts');
                                $font = 5;
                                $width  = imagefontwidth($font) * strlen($string);
index a83c95c..54ae409 100644 (file)
@@ -109,7 +109,7 @@ class tx_srfreecap_pi2 extends tslib_pibase {
         */
        function checkWord($word) {
                        // Load session data
-               $this->sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses','tx_'.$this->extKey);
+               $this->sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses','tx_' . $this->extKey);
                if (!empty($this->sessionData[$this->extKey . '_word_hash']) && !empty($word)) {
                        // all freeCap words are lowercase.
                        // font #4 looks uppercase, but trust me, it's not...
@@ -120,6 +120,10 @@ class tx_srfreecap_pi2 extends tslib_pibase {
                                        // defeats re-use of known image with spoofed session id
                                        $this->sessionData[$this->extKey . '_attempts'] = 0;
                                        $this->sessionData[$this->extKey . '_word_hash'] = false;
+                                       $this->sessionData[$this->extKey . '_word_accessible'] = false;
+                                       $this->sessionData[$this->extKey . '_hash_func'] = false;
+                                       $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_' . $this->extKey, $this->sessionData);
+                                       $GLOBALS['TSFE']->storeSessionData();
                                        return true;
                                }
                        }