[BUGFIX] Fix nested arrays in conditions
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Configuration / TypoScript / ConditionMatching / AbstractConditionMatcher.php
1 <?php
2 namespace TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use Psr\Log\LoggerAwareInterface;
18 use Psr\Log\LoggerAwareTrait;
19 use Symfony\Component\ExpressionLanguage\SyntaxError;
20 use TYPO3\CMS\Core\Configuration\Features;
21 use TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException;
22 use TYPO3\CMS\Core\Error\Exception;
23 use TYPO3\CMS\Core\ExpressionLanguage\Resolver;
24 use TYPO3\CMS\Core\Log\LogLevel;
25 use TYPO3\CMS\Core\Utility\GeneralUtility;
26 use TYPO3\CMS\Core\Utility\StringUtility;
27 use TYPO3\CMS\Core\Utility\VersionNumberUtility;
28
29 /**
30 * Matching TypoScript conditions
31 *
32 * Used with the TypoScript parser.
33 * Matches IPnumbers etc. for use with templates
34 */
35 abstract class AbstractConditionMatcher implements LoggerAwareInterface
36 {
37 use LoggerAwareTrait;
38
39 /**
40 * Id of the current page.
41 *
42 * @var int
43 */
44 protected $pageId;
45
46 /**
47 * The rootline for the current page.
48 *
49 * @var array
50 */
51 protected $rootline;
52
53 /**
54 * Whether to simulate the behaviour and match all conditions
55 * (used in TypoScript object browser).
56 *
57 * @var bool
58 */
59 protected $simulateMatchResult = false;
60
61 /**
62 * Whether to simulat the behaviour and match specific conditions
63 * (used in TypoScript object browser).
64 *
65 * @var array
66 */
67 protected $simulateMatchConditions = [];
68
69 /**
70 * @var Resolver
71 */
72 protected $expressionLanguageResolver;
73
74 /**
75 * @return bool
76 */
77 protected function strictSyntaxEnabled(): bool
78 {
79 return GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('TypoScript.strictSyntax');
80 }
81
82 /**
83 * Sets the id of the page to evaluate conditions for.
84 *
85 * @param int $pageId Id of the page (must be positive)
86 */
87 public function setPageId($pageId)
88 {
89 if (is_int($pageId) && $pageId > 0) {
90 $this->pageId = $pageId;
91 }
92 }
93
94 /**
95 * Gets the id of the page to evaluate conditions for.
96 *
97 * @return int Id of the page
98 */
99 public function getPageId()
100 {
101 return $this->pageId;
102 }
103
104 /**
105 * Sets the rootline.
106 *
107 * @param array $rootline The rootline to be used for matching (must have elements)
108 */
109 public function setRootline(array $rootline)
110 {
111 if (!empty($rootline)) {
112 $this->rootline = $rootline;
113 }
114 }
115
116 /**
117 * Gets the rootline.
118 *
119 * @return array The rootline to be used for matching
120 */
121 public function getRootline()
122 {
123 return $this->rootline;
124 }
125
126 /**
127 * Sets whether to simulate the behaviour and match all conditions.
128 *
129 * @param bool $simulateMatchResult Whether to simulate positive matches
130 */
131 public function setSimulateMatchResult($simulateMatchResult)
132 {
133 if (is_bool($simulateMatchResult)) {
134 $this->simulateMatchResult = $simulateMatchResult;
135 }
136 }
137
138 /**
139 * Sets whether to simulate the behaviour and match specific conditions.
140 *
141 * @param array $simulateMatchConditions Conditions to simulate a match for
142 */
143 public function setSimulateMatchConditions(array $simulateMatchConditions)
144 {
145 $this->simulateMatchConditions = $simulateMatchConditions;
146 }
147
148 /**
149 * Normalizes an expression
150 * + OR normalization: "...]OR[...", "...]||[...", "...][..." --> "...]||[..."
151 * + AND normalization: "...]AND[...", "...]&&[..." --> "...]&&[..."
152 *
153 * @param string $expression The expression to be normalized (e.g. "[A] && [B] OR [C]")
154 * @return string The normalized expression (e.g. "[A]&&[B]||[C]")
155 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
156 */
157 protected function normalizeExpression($expression)
158 {
159 $removeSpaces = '/
160 \\s*
161 ( # subroutine 1
162 \\[
163 (?:
164 [^\\[\\]] # any character except []
165 | (?1) # recursive subroutine 1 when brackets are around
166 )*
167 \\]
168 )
169 \\s*
170 /xi';
171
172 $adjacentBrackets = '/
173 ( # subroutine 1
174 \\[
175 (?:
176 [^\\[\\]] # any character except []
177 | (?1) # recursive subroutine 1 when brackets are around
178 )*
179 \\]
180 )
181 (*SKIP) # avoid backtracking into completed bracket expressions
182 \\[ # match the following [
183 /xi';
184
185 return preg_replace(
186 [
187 $removeSpaces,
188 '/\\]AND\\[/i',
189 '/\\]OR\\[/i',
190 $adjacentBrackets
191 ],
192 [
193 '\\1',
194 ']&&[',
195 ']||[',
196 '\\1||['
197 ],
198 trim($expression)
199 );
200 }
201
202 /**
203 * Matches a TypoScript condition expression.
204 *
205 * @param string $expression The expression to match
206 * @return bool Whether the expression matched
207 */
208 public function match($expression)
209 {
210 // Return directly if result should be simulated:
211 if ($this->simulateMatchResult) {
212 return $this->simulateMatchResult;
213 }
214 // Return directly if matching for specific condition is simulated only:
215 if (!empty($this->simulateMatchConditions)) {
216 return in_array($expression, $this->simulateMatchConditions);
217 }
218 // Sets the current pageId if not defined yet:
219 if (!isset($this->pageId)) {
220 $this->pageId = $this->determinePageId();
221 }
222 // Sets the rootline if not defined yet:
223 if (!isset($this->rootline)) {
224 $this->rootline = $this->determineRootline();
225 }
226 $result = false;
227 $normalizedExpression = $this->normalizeExpression($expression);
228 // First and last character must be square brackets (e.g. "[A]&&[B]":
229 if ($normalizedExpression[0] === '[' && substr($normalizedExpression, -1) === ']') {
230 $innerExpression = substr($normalizedExpression, 1, -1);
231 $orParts = explode(']||[', $innerExpression);
232 if ($this->strictSyntaxEnabled() && count($orParts) > 1) {
233 trigger_error('Multiple conditions blocks combined with AND, OR, && or || will be removed in TYPO3 v10.0, use the new expression language.', E_USER_DEPRECATED);
234 }
235 foreach ($orParts as $orPart) {
236 $andParts = explode(']&&[', $orPart);
237 if ($this->strictSyntaxEnabled() && count($andParts) > 1) {
238 trigger_error('Multiple conditions blocks combined with AND, OR, && or || will be removed in TYPO3 v10.0, use the new expression language.', E_USER_DEPRECATED);
239 }
240 foreach ($andParts as $andPart) {
241 $result = $this->evaluateExpression($andPart);
242 if (!is_bool($result)) {
243 $result = $this->evaluateCondition($andPart);
244 }
245 // If condition in AND context fails, the whole block is FALSE:
246 if ($result === false) {
247 break;
248 }
249 }
250 // If condition in OR context succeeds, the whole expression is TRUE:
251 if ($result === true) {
252 break;
253 }
254 }
255 }
256 return $result;
257 }
258
259 /**
260 * @param string $expression
261 * @return bool|null
262 */
263 protected function evaluateExpression(string $expression): ?bool
264 {
265 try {
266 $result = $this->expressionLanguageResolver->evaluate($expression);
267 if ($result !== null) {
268 return $result;
269 }
270 } catch (SyntaxError $exception) {
271 // SyntaxException means no support, let's try the fallback
272 $message = 'Expression could not be parsed, fallback kicks in.';
273 if (strpos($exception->getMessage(), 'Unexpected character "="') !== false) {
274 $message .= ' It looks like an old condition with only one equal sign.';
275 }
276 $this->logger->log(
277 $this->strictSyntaxEnabled() ? LogLevel::WARNING : LogLevel::INFO,
278 $message,
279 ['expression' => $expression]
280 );
281 } catch (\Throwable $exception) {
282 // The following error handling is required to mitigate a missing type check
283 // in the Symfony Expression Language handling. In case a condition
284 // use "in" or "not in" check in combination with a non array a PHP Warning
285 // is thrown. Example: [1 in "foo"] or ["bar" in "foo,baz"]
286 // This conditions are wrong for sure, but they will break the complete installation
287 // including the backend. To mitigate the problem we do the following:
288 // 1) In FE an InvalidTypoScriptConditionException is thrown (if strictSyntax is enabled)
289 // 2) In FE silent catch this error and log it (if strictSyntax is disabled)
290 // 3) In BE silent catch this error and log it, but never break the backend.
291 $this->logger->error($exception->getMessage(), [
292 'expression' => $expression,
293 'exception' => $exception
294 ]);
295 if (TYPO3_MODE === 'FE'
296 && $exception instanceof Exception
297 && $this->strictSyntaxEnabled()
298 && strpos($exception->getMessage(), 'in_array() expects parameter 2 to be array') !== false
299 ) {
300 throw new InvalidTypoScriptConditionException('Invalid expression in condition: [' . $expression . ']', 1536950931);
301 }
302 }
303 return null;
304 }
305
306 /**
307 * Evaluates a TypoScript condition given as input, eg. "[applicationContext = Production][...(other condition)...]"
308 *
309 * @param string $key The condition to match against its criteria.
310 * @param string $value
311 * @return bool|null Result of the evaluation; NULL if condition could not be evaluated
312 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
313 */
314 protected function evaluateConditionCommon($key, $value)
315 {
316 $keyParts = GeneralUtility::trimExplode('|', $key);
317 switch ($keyParts[0]) {
318 case 'applicationContext':
319 $values = GeneralUtility::trimExplode(',', $value, true);
320 $currentApplicationContext = GeneralUtility::getApplicationContext();
321 foreach ($values as $applicationContext) {
322 if ($this->searchStringWildcard($currentApplicationContext, $applicationContext)) {
323 return true;
324 }
325 }
326 return false;
327 case 'language':
328 if (GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE') === $value) {
329 return true;
330 }
331 $values = GeneralUtility::trimExplode(',', $value, true);
332 foreach ($values as $test) {
333 // matches a string with asterix in front and back. See https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html#language for use case.
334 if (preg_match('/^\\*.+\\*$/', $test)) {
335 $allLanguages = preg_split('/[,;]/', GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
336 if (in_array(substr($test, 1, -1), $allLanguages)) {
337 return true;
338 }
339 } elseif (GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE') == $test) {
340 return true;
341 }
342 }
343 return false;
344 case 'IP':
345 if ($value === 'devIP') {
346 $value = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
347 }
348
349 return (bool)GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value);
350 case 'hostname':
351 return (bool)GeneralUtility::cmpFQDN(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value);
352 case 'hour':
353 case 'minute':
354 case 'month':
355 case 'year':
356 case 'dayofweek':
357 case 'dayofmonth':
358 case 'dayofyear':
359 // In order to simulate time properly in templates.
360 $theEvalTime = $GLOBALS['SIM_EXEC_TIME'];
361 switch ($key) {
362 case 'hour':
363 $theTestValue = date('H', $theEvalTime);
364 break;
365 case 'minute':
366 $theTestValue = date('i', $theEvalTime);
367 break;
368 case 'month':
369 $theTestValue = date('m', $theEvalTime);
370 break;
371 case 'year':
372 $theTestValue = date('Y', $theEvalTime);
373 break;
374 case 'dayofweek':
375 $theTestValue = date('w', $theEvalTime);
376 break;
377 case 'dayofmonth':
378 $theTestValue = date('d', $theEvalTime);
379 break;
380 case 'dayofyear':
381 $theTestValue = date('z', $theEvalTime);
382 break;
383 default:
384 $theTestValue = 0;
385 break;
386 }
387 $theTestValue = (int)$theTestValue;
388 // comp
389 $values = GeneralUtility::trimExplode(',', $value, true);
390 foreach ($values as $test) {
391 if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($test)) {
392 $test = '=' . $test;
393 }
394 if ($this->compareNumber($test, $theTestValue)) {
395 return true;
396 }
397 }
398 return false;
399 case 'compatVersion':
400 return VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch) >= VersionNumberUtility::convertVersionNumberToInteger($value);
401 case 'loginUser':
402 if ($this->isUserLoggedIn()) {
403 $values = GeneralUtility::trimExplode(',', $value, true);
404 foreach ($values as $test) {
405 if ($test === '*' || (string)$this->getUserId() === (string)$test) {
406 return true;
407 }
408 }
409 } elseif ($value === '') {
410 return true;
411 }
412 return false;
413 case 'page':
414 if ($keyParts[1]) {
415 $page = $this->getPage();
416 $property = $keyParts[1];
417 if (!empty($page) && isset($page[$property]) && (string)$page[$property] === (string)$value) {
418 return true;
419 }
420 }
421 return false;
422 case 'globalVar':
423 $values = GeneralUtility::trimExplode(',', $value, true);
424 foreach ($values as $test) {
425 $point = strcspn($test, '!=<>');
426 $theVarName = substr($test, 0, $point);
427 $nv = $this->getVariable(trim($theVarName));
428 $testValue = substr($test, $point);
429 if ($this->compareNumber($testValue, $nv)) {
430 return true;
431 }
432 }
433 return false;
434 case 'globalString':
435 $values = GeneralUtility::trimExplode(',', $value, true);
436 foreach ($values as $test) {
437 $point = strcspn($test, '=');
438 $theVarName = substr($test, 0, $point);
439 $nv = (string)$this->getVariable(trim($theVarName));
440 $testValue = substr($test, $point + 1);
441 if ($this->searchStringWildcard($nv, trim($testValue))) {
442 return true;
443 }
444 }
445 return false;
446 case 'userFunc':
447 $matches = [];
448 preg_match_all('/^\s*([^\(\s]+)\s*(?:\((.*)\))?\s*$/', $value, $matches);
449 $funcName = $matches[1][0];
450 $funcValues = trim($matches[2][0]) !== '' ? $this->parseUserFuncArguments($matches[2][0]) : [];
451 if (is_callable($funcName) && call_user_func_array($funcName, $funcValues)) {
452 return true;
453 }
454 return false;
455 }
456 return null;
457 }
458
459 /**
460 * Evaluates a TypoScript condition given as input with a custom class name,
461 * e.g. "[MyCompany\MyPackage\ConditionMatcher\MyOwnConditionMatcher = myvalue]"
462 *
463 * @param string $condition The condition to match
464 * @return bool|null Result of the evaluation; NULL if condition could not be evaluated
465 * @throws \TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException
466 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
467 */
468 protected function evaluateCustomDefinedCondition($condition)
469 {
470 $conditionResult = null;
471
472 list($conditionClassName, $conditionParameters) = GeneralUtility::trimExplode(' ', $condition, false, 2);
473
474 // Check if the condition class name is a valid class
475 // This is necessary to not stop here for the conditions ELSE and GLOBAL
476 if (class_exists($conditionClassName)) {
477 // Use like this: [MyCompany\MyPackage\ConditionMatcher\MyOwnConditionMatcher = myvalue]
478 /** @var \TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractCondition $conditionObject */
479 $conditionObject = GeneralUtility::makeInstance($conditionClassName);
480 if (($conditionObject instanceof \TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractCondition) === false) {
481 throw new \TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException(
482 '"' . $conditionClassName . '" is not a valid TypoScript Condition object.',
483 1410286153
484 );
485 }
486
487 $conditionParameters = $this->parseUserFuncArguments($conditionParameters);
488 $conditionObject->setConditionMatcherInstance($this);
489 $conditionResult = $conditionObject->matchCondition($conditionParameters);
490 }
491
492 return $conditionResult;
493 }
494
495 /**
496 * Parses arguments to the userFunc.
497 *
498 * @param string $arguments
499 * @return array
500 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
501 */
502 protected function parseUserFuncArguments($arguments)
503 {
504 $result = [];
505 $arguments = trim($arguments);
506 while ($arguments !== '') {
507 if ($arguments[0] === ',') {
508 $result[] = '';
509 $arguments = substr($arguments, 1);
510 } else {
511 $pos = strcspn($arguments, ',\'"');
512 if ($pos == 0) {
513 // We hit a quote of some kind
514 $quote = $arguments[0];
515 $segment = preg_replace('/^(.*?[^\\\])' . $quote . '.*$/', '\1', substr($arguments, 1));
516 $segment = str_replace('\\' . $quote, $quote, $segment);
517 $result[] = $segment;
518 // shorten $arguments
519 $arguments = substr($arguments, strlen($segment) + 2);
520 $offset = strpos($arguments, ',');
521 if ($offset === false) {
522 $offset = strlen($arguments);
523 }
524 $arguments = substr($arguments, $offset + 1);
525 } else {
526 $result[] = trim(substr($arguments, 0, $pos));
527 $arguments = substr($arguments, $pos + 1);
528 }
529 }
530 $arguments = trim($arguments);
531 }
532 return $result;
533 }
534
535 /**
536 * Get variable common
537 *
538 * @param array $vars
539 * @return mixed Whatever value. If none, then NULL.
540 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
541 */
542 protected function getVariableCommon(array $vars)
543 {
544 $value = null;
545 $namespace = trim($vars[0]);
546 if (count($vars) === 1) {
547 $value = $this->getGlobal($vars[0]);
548 } elseif ($namespace === 'LIT') {
549 $value = trim($vars[1]);
550 } else {
551 $splitAgain = explode('|', $vars[1], 2);
552 $k = trim($splitAgain[0]);
553 if ($k) {
554 switch ($namespace) {
555 case 'GP':
556 $value = GeneralUtility::_GP($k);
557 break;
558 case 'GPmerged':
559 $value = GeneralUtility::_GPmerged($k);
560 break;
561 case 'ENV':
562 $value = getenv($k);
563 break;
564 case 'IENV':
565 $value = GeneralUtility::getIndpEnv($k);
566 break;
567 default:
568 return null;
569 }
570 // If array:
571 if (count($splitAgain) > 1) {
572 if (is_array($value) && trim($splitAgain[1]) !== '') {
573 $value = $this->getGlobal($splitAgain[1], $value);
574 } else {
575 $value = '';
576 }
577 }
578 }
579 }
580 return $value;
581 }
582
583 /**
584 * Evaluates a $leftValue based on an operator: "<", ">", "<=", ">=", "!=" or "="
585 *
586 * @param string $test The value to compare with on the form [operator][number]. Eg. "< 123
587 * @param float $leftValue The value on the left side
588 * @return bool If $value is "50" and $test is "< 123" then it will return TRUE.
589 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
590 */
591 protected function compareNumber($test, $leftValue)
592 {
593 if (preg_match('/^(!?=+|<=?|>=?)\\s*([^\\s]*)\\s*$/', $test, $matches)) {
594 $operator = $matches[1];
595 $rightValue = $matches[2];
596 switch ($operator) {
597 case '>=':
598 return $leftValue >= (float)$rightValue;
599 break;
600 case '<=':
601 return $leftValue <= (float)$rightValue;
602 break;
603 case '!=':
604 // multiple values may be split with '|'
605 // see if none matches ("not in list")
606 $found = false;
607 $rightValueParts = GeneralUtility::trimExplode('|', $rightValue);
608 foreach ($rightValueParts as $rightValueSingle) {
609 if ($leftValue == (float)$rightValueSingle) {
610 $found = true;
611 break;
612 }
613 }
614 return $found === false;
615 break;
616 case '<':
617 return $leftValue < (float)$rightValue;
618 break;
619 case '>':
620 return $leftValue > (float)$rightValue;
621 break;
622 default:
623 // nothing valid found except '=', use '='
624 // multiple values may be split with '|'
625 // see if one matches ("in list")
626 $found = false;
627 $rightValueParts = GeneralUtility::trimExplode('|', $rightValue);
628 foreach ($rightValueParts as $rightValueSingle) {
629 if ($leftValue == $rightValueSingle) {
630 $found = true;
631 break;
632 }
633 }
634 return $found;
635 }
636 }
637 return false;
638 }
639
640 /**
641 * Matching two strings against each other, supporting a "*" wildcard or (if wrapped in "/") PCRE regular expressions
642 *
643 * @param string $haystack The string in which to find $needle.
644 * @param string $needle The string to find in $haystack
645 * @return bool Returns TRUE if $needle matches or is found in (according to wildcards) in $haystack. Eg. if $haystack is "Netscape 6.5" and $needle is "Net*" or "Net*ape" then it returns TRUE.
646 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
647 */
648 protected function searchStringWildcard($haystack, $needle)
649 {
650 return StringUtility::searchStringWildcard($haystack, $needle);
651 }
652
653 /**
654 * Return global variable where the input string $var defines array keys separated by "|"
655 * Example: $var = "HTTP_SERVER_VARS | something" will return the value $GLOBALS['HTTP_SERVER_VARS']['something'] value
656 *
657 * @param string $var Global var key, eg. "HTTP_GET_VAR" or "HTTP_GET_VARS|id" to get the GET parameter "id" back.
658 * @param array $source Alternative array than $GLOBAL to get variables from.
659 * @return mixed Whatever value. If none, then blank string.
660 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
661 */
662 protected function getGlobal($var, $source = null)
663 {
664 $vars = explode('|', $var);
665 $c = count($vars);
666 $k = trim($vars[0]);
667 $theVar = isset($source) ? ($source[$k] ?? null) : ($GLOBALS[$k] ?? null);
668 for ($a = 1; $a < $c; $a++) {
669 if (!isset($theVar)) {
670 break;
671 }
672 $key = trim($vars[$a]);
673 if (is_object($theVar)) {
674 $theVar = $theVar->{$key};
675 } elseif (is_array($theVar)) {
676 $theVar = $theVar[$key];
677 } else {
678 return '';
679 }
680 }
681 if (!is_array($theVar) && !is_object($theVar)) {
682 return $theVar;
683 }
684 return '';
685 }
686
687 /**
688 * Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
689 *
690 * @param string $string The condition to match against its criteria.
691 * @return bool Whether the condition matched
692 * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse()
693 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
694 */
695 abstract protected function evaluateCondition($string);
696
697 /**
698 * Gets the value of a variable.
699 *
700 * Examples of names:
701 * + TSFE:id
702 * + GP:firstLevel|secondLevel
703 * + _GET|firstLevel|secondLevel
704 * + LIT:someLiteralValue
705 *
706 * @param string $name The name of the variable to fetch the value from
707 * @return mixed The value of the given variable (string) or NULL if variable did not exist
708 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
709 */
710 abstract protected function getVariable($name);
711
712 /**
713 * Gets the usergroup list of the current user.
714 *
715 * @return string The usergroup list of the current user
716 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
717 */
718 abstract protected function getGroupList();
719
720 /**
721 * Determines the current page Id.
722 *
723 * @return int The current page Id
724 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
725 */
726 abstract protected function determinePageId();
727
728 /**
729 * Gets the properties for the current page.
730 *
731 * @return array The properties for the current page.
732 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
733 */
734 abstract protected function getPage();
735
736 /**
737 * Determines the rootline for the current page.
738 *
739 * @return array The rootline for the current page.
740 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
741 */
742 abstract protected function determineRootline();
743
744 /**
745 * Gets the id of the current user.
746 *
747 * @return int The id of the current user
748 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
749 */
750 abstract protected function getUserId();
751
752 /**
753 * Determines if a user is logged in.
754 *
755 * @return bool Determines if a user is logged in
756 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
757 */
758 abstract protected function isUserLoggedIn();
759 }