* Added support for objects in conditions. Use it like this: [globalString = TSFE...
authorMichael Stucki <michael.stucki@typo3.org>
Mon, 19 Dec 2005 16:50:23 +0000 (16:50 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Mon, 19 Dec 2005 16:50:23 +0000 (16:50 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@918 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_matchcondition.php

index d4bbd44..dcbc4bd 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,12 @@
-2005-12-19  Kasper Skårhøj  <kasper2005@typo3.com>
+2005-12-19  Michael Stucki  <michael@typo3.org>
+
+       * Added support for objects in conditions. Use it like this: [globalString = TSFE:fe_user|user|username = myname]
+
+2005-12-19  Kasper Skaarhoj  <kasper2005@typo3.com>
 
        * Change logout-button label to "Exit" when in SwitchBackUser mode.
        * Fixed a htmlspecialchars() thing in TCEforms.
 
-2005-12-17  Kasper Skårhøj  <kasper2005@typo3.com>
 2005-12-18  Michael Stucki  <michael@typo3.org>
 
        * Cleanup: Changed all occurences of "depreciated" => "deprecated"
index d13b30a..82a8a35 100644 (file)
@@ -546,9 +546,18 @@ class t3lib_matchCondition {
 
                for ($a=1;$a<$c;$a++) {
                        if (!isset($theVar))    {break;}
-                       $theVar = $theVar[trim($vars[$a])];
+
+                       $key = trim($vars[$a]);
+                       if (is_object($theVar)) {
+                               $theVar = $theVar->$key;
+                       } elseif (is_array($theVar))    {
+                               $theVar = $theVar[$key];
+                       } else {
+                               return '';
+                       }
                }
-               if (!is_array($theVar)) {
+
+               if (!is_array($theVar) && !is_object($theVar))  {
                        return $theVar;
                } else {
                        return '';
@@ -576,7 +585,8 @@ class t3lib_matchCondition {
                                                $val = t3lib_div::_GP($k);
                                        break;
                                        case 'TSFE':
-                                               $val = $GLOBALS['TSFE']->$k;
+                                               $val = $this->getGlobal('TSFE|'.$vars[1]);
+                                               $splitAgain=0;  // getGlobal resolves all parts of the key, so no further splitting is needed
                                        break;
                                        case 'ENV':
                                                $val = getenv($k);