TYPO3 CMS  TYPO3_6-2
ConditionMatcher.php
Go to the documentation of this file.
1 <?php
3 
25 
33  protected function evaluateCondition($string) {
34  list($key, $value) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('=', $string, FALSE, 2);
35  $result = $this->evaluateConditionCommon($key, $value);
36  if (is_bool($result)) {
37  return $result;
38  } else {
39  switch ($key) {
40  case 'usergroup':
41  $groupList = $this->getGroupList();
42  // '0,-1' is the default usergroups when not logged in!
43  if ($groupList != '0,-1') {
44  $values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
45  foreach ($values as $test) {
46  if ($test == '*' || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($groupList, $test)) {
47  return TRUE;
48  }
49  }
50  }
51  break;
52  case 'treeLevel':
53  $values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
54  $treeLevel = count($this->rootline) - 1;
55  foreach ($values as $test) {
56  if ($test == $treeLevel) {
57  return TRUE;
58  }
59  }
60  break;
61  case 'PIDupinRootline':
62 
63  case 'PIDinRootline':
64  $values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
65  if ($key == 'PIDinRootline' || !in_array($this->pageId, $values)) {
66  foreach ($values as $test) {
67  foreach ($this->rootline as $rl_dat) {
68  if ($rl_dat['uid'] == $test) {
69  return TRUE;
70  }
71  }
72  }
73  }
74  break;
75  }
76  }
77  return FALSE;
78  }
79 
86  protected function getVariable($var) {
87  $vars = explode(':', $var, 2);
88  $val = $this->getVariableCommon($vars);
89  if (is_null($val)) {
90  $splitAgain = explode('|', $vars[1], 2);
91  $k = trim($splitAgain[0]);
92  if ($k) {
93  switch ((string) trim($vars[0])) {
94  case 'TSFE':
95  $val = $this->getGlobal('TSFE|' . $vars[1]);
96  break;
97  }
98  }
99  }
100  return $val;
101  }
102 
108  protected function getGroupList() {
109  $groupList = $GLOBALS['TSFE']->gr_list;
110  return $groupList;
111  }
112 
118  protected function determinePageId() {
119  return (int)$GLOBALS['TSFE']->id;
120  }
121 
127  protected function getPage() {
128  return $GLOBALS['TSFE']->page;
129  }
130 
136  protected function determineRootline() {
137  $rootline = (array) $GLOBALS['TSFE']->tmpl->rootLine;
138  return $rootline;
139  }
140 
146  protected function getUserId() {
147  $userId = $GLOBALS['TSFE']->fe_user->user['uid'];
148  return $userId;
149  }
150 
156  protected function isUserLoggedIn() {
157  $userLoggedIn = FALSE;
158  if ($GLOBALS['TSFE']->loginUser) {
159  $userLoggedIn = TRUE;
160  }
161  return $userLoggedIn;
162  }
163 
170  protected function log($message) {
171  if (is_object($GLOBALS['TT'])) {
172  $GLOBALS['TT']->setTSlogMessage($message, 3);
173  }
174  }
175 
176 }
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]