Project

General

Profile

Bug #22410 » 14050_cleaning_t3lib_matchcondition_directory.patch

Administrator Admin, 2010-11-25 00:06

View differences:

t3lib/matchcondition/class.t3lib_matchcondition_abstract.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009-2010 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
* Copyright notice
*
* (c) 2009-2010 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Matching TypoScript conditions
*
......
* (used in TypoScript object browser).
* @var boolean
*/
protected $simulateMatchResult = false;
protected $simulateMatchResult = FALSE;
/**
* Whether to simulat the behaviour and match specific conditions
* (used in TypoScript object browser).
......
/**
* Normalizes an expression and removes the first and last square bracket.
* + OR normalization: "...]OR[...", "...]||[...", "...][..." --> "...]||[..."
* + AND normalization: "...]AND[...", "...]&&[..." --> "...]&&[..."
* + AND normalization: "...]AND[...", "...]&&[..." --> "...]&&[..."
*
* @param string $expression: The expression to be normalized (e.g. "[A] && [B] OR [C]")
* @return string The normalized expression (e.g. "[A]&&[B]||[C]")
......
protected function normalizeExpression($expression) {
$normalizedExpression = preg_replace(
array(
'/\]\s*(OR|\|\|)?\s*\[/i',
'/\]\s*(AND|&&)\s*\[/i',
'/\]\s*(OR|\|\|)?\s*\[/i',
'/\]\s*(AND|&&)\s*\[/i',
),
array(
']||[',
']&&[',
']||[',
']&&[',
),
trim($expression)
);
......
$this->rootline = $this->determineRootline();
}
$result = false;
$result = FALSE;
$normalizedExpression = $this->normalizeExpression($expression);
// First and last character must be square brackets (e.g. "[A]&&[B]":
......
foreach ($andParts as $andPart) {
$result = $this->evaluateCondition($andPart);
// If condition in AND context fails, the whole block is false:
if ($result === false) {
if ($result === FALSE) {
break;
}
}
// If condition in OR context succeeds, the whole expression is true:
if ($result === true) {
if ($result === TRUE) {
break;
}
}
......
switch ($keyParts[0]) {
case 'browser':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
// take all identified browsers into account, eg chrome deliver
// webkit=>532.5, chrome=>4.1, safari=>532.5
// so comparing string will be
// "webkit532.5 chrome4.1 safari532.5"
$all = '';
foreach($browserInfo['all'] as $key => $value) {
foreach ($browserInfo['all'] as $key => $value) {
$all .= $key . $value . ' ';
}
foreach ($values as $test) {
if (stripos($all, $test) !== false) {
return true;
if (stripos($all, $test) !== FALSE) {
return TRUE;
}
}
break;
case 'version':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (strcspn($test, '=<>') == 0) {
switch (substr($test, 0, 1)) {
case '=':
if (doubleval(substr($test, 1)) == $browserInfo['version']) {
return true;
return TRUE;
}
break;
case '<':
if (doubleval(substr($test, 1)) > $browserInfo['version']) {
return true;
return TRUE;
}
break;
case '>':
if (doubleval(substr($test, 1)) < $browserInfo['version']) {
return true;
return TRUE;
}
break;
}
} else {
if (strpos(' ' . $browserInfo['version'], $test) == 1) {
return true;
} elseif (strpos(' ' . $browserInfo['version'], $test) == 1) {
return TRUE;
}
}
}
}
}
break;
case 'system':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (strpos(' ' . $browserInfo['system'], $test) == 1) {
return true;
return TRUE;
}
}
break;
......
if (!isset($this->deviceInfo)) {
$this->deviceInfo = $this->getDeviceType(t3lib_div::getIndpEnv('HTTP_USER_AGENT'));
}
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($this->deviceInfo == $test) {
return true;
return TRUE;
}
}
break;
......
}
break;
case 'language':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (preg_match('/^\*.+\*$/', $test)) {
$allLanguages = preg_split('/[,;]/', t3lib_div::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
if (in_array(substr($test, 1, -1), $allLanguages)) {
return true;
return TRUE;
}
} else if (t3lib_div::getIndpEnv('HTTP_ACCEPT_LANGUAGE') == $test) {
} elseif (t3lib_div::getIndpEnv('HTTP_ACCEPT_LANGUAGE') == $test) {
return true;
return TRUE;
}
}
break;
case 'IP':
if (t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $value)) {
return true;
return TRUE;
}
break;
case 'hostname':
if (t3lib_div::cmpFQDN(t3lib_div::getIndpEnv('REMOTE_ADDR'), $value)) {
return true;
return TRUE;
}
break;
// hour, minute, dayofweek, dayofmonth, month, year, julianday
......
case 'dayofweek':
case 'dayofmonth':
case 'dayofyear':
$theEvalTime = $GLOBALS['SIM_EXEC_TIME']; // In order to simulate time properly in templates.
$theEvalTime = $GLOBALS['SIM_EXEC_TIME']; // In order to simulate time properly in templates.
switch($key) {
switch ($key) {
case 'hour': $theTestValue = date('H', $theEvalTime); break;
case 'minute': $theTestValue = date('i', $theEvalTime); break;
case 'month': $theTestValue = date('m', $theEvalTime); break;
case 'year': $theTestValue = date('Y', $theEvalTime); break;
case 'dayofweek': $theTestValue = date('w', $theEvalTime); break;
case 'dayofmonth': $theTestValue = date('d', $theEvalTime); break;
case 'dayofyear': $theTestValue = date('z', $theEvalTime); break;
case 'hour':
$theTestValue = date('H', $theEvalTime);
break;
case 'minute':
$theTestValue = date('i', $theEvalTime);
break;
case 'month':
$theTestValue = date('m', $theEvalTime);
break;
case 'year':
$theTestValue = date('Y', $theEvalTime);
break;
case 'dayofweek':
$theTestValue = date('w', $theEvalTime);
break;
case 'dayofmonth':
$theTestValue = date('d', $theEvalTime);
break;
case 'dayofyear':
$theTestValue = date('z', $theEvalTime);
break;
}
$theTestValue = intval($theTestValue);
// comp
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (t3lib_div::testInt($test)) {
$test = '=' . $test;
}
if ($this->compareNumber($test, $theTestValue)) {
return true;
return TRUE;
}
}
break;
......
break;
case 'loginUser':
if ($this->isUserLoggedIn()) {
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($test == '*' || !strcmp($this->getUserId(), $test)) {
return true;
return TRUE;
}
}
} else {
if ($value === '') {
} elseif ($value === '') {
return TRUE;
}
return TRUE;
}
}
break;
case 'page':
if ($keyParts[1]) {
......
}
break;
case 'globalVar':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
$point = strcspn($test, '!=<>');
$theVarName = substr($test, 0, $point);
......
$testValue = substr($test, $point);
if ($this->compareNumber($testValue, $nv)) {
return true;
return TRUE;
}
}
break;
case 'globalString':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
$point = strcspn($test, '=');
$theVarName = substr($test, 0, $point);
$nv = $this->getVariable(trim($theVarName));
$testValue = substr($test, $point+1);
$testValue = substr($test, $point + 1);
if ($this->searchStringWildcard($nv, trim($testValue))) {
return true;
return TRUE;
}
}
break;
......
$prefix = $this->getUserFuncClassPrefix();
if ($prefix &&
!t3lib_div::isFirstPartOfStr(trim($funcName), $prefix) &&
!t3lib_div::isFirstPartOfStr(trim($funcName),'tx_')
!t3lib_div::isFirstPartOfStr(trim($funcName), 'tx_')
) {
) {
$this->log('Match condition: Function "' . $funcName . '" was not prepended with "' . $prefix.'"');
$this->log('Match condition: Function "' . $funcName . '" was not prepended with "' . $prefix . '"');
return false;
return FALSE;
}
if (function_exists($funcName) && call_user_func($funcName, $funcValue[0])) {
if (function_exists($funcName) && call_user_func($funcName, $funcValue[0])) {
return true;
return TRUE;
}
break;
}
......
if (count($vars) == 1) {
$value = $this->getGlobal($vars[0]);
} else {
$splitAgain = explode('|',$vars[1], 2);
$splitAgain = explode('|', $vars[1], 2);
$k = trim($splitAgain[0]);
if ($k) {
switch((string)trim($vars[0])) {
switch ((string) trim($vars[0])) {
case 'GP':
$value = t3lib_div::_GP($k);
break;
break;
case 'ENV':
$value = getenv($k);
break;
break;
case 'IENV':
$value = t3lib_div::getIndpEnv($k);
break;
// return litteral value:
break;
// return litteral value:
case 'LIT':
return trim($vars[1]);
break;
break;
default:
return NULL;
}
......
switch ($operator) {
case '>=':
return ($leftValue >= doubleval($rightValue));
break;
break;
case '<=':
return ($leftValue <= doubleval($rightValue));
break;
break;
case '!=':
return ($leftValue != doubleval($rightValue));
break;
break;
case '<':
return ($leftValue < doubleval($rightValue));
break;
break;
case '>':
return ($leftValue > doubleval($rightValue));
break;
break;
default:
// nothing valid found except '=', use '='
// nothing valid found except '=', use '='
return ($leftValue == trim($rightValue));
break;
break;
}
}
return false;
return FALSE;
}
/**
......
* @return boolean 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.
*/
protected function searchStringWildcard($haystack, $needle) {
$result = false;
$result = FALSE;
if ($needle) {
if (preg_match('/^\/.+\/$/', $needle)) {
// Regular expression, only "//" is allowed as delimiter
// Regular expression, only "//" is allowed as delimiter
$regex = $needle;
} else {
$needle = str_replace(array('*', '?'), array('###MANY###', '###ONE###'), $needle);
$regex = '/^' . preg_quote($needle, '/') . '$/';
// Replace the marker with .* to match anything (wildcard)
// Replace the marker with .* to match anything (wildcard)
$regex = str_replace(array('###MANY###', '###ONE###'), array('.*' , '.'), $regex);
$regex = str_replace(array('###MANY###', '###ONE###'), array('.*', '.'), $regex);
}
$result = (boolean)preg_match($regex, (string)$haystack);
$result = (boolean) preg_match($regex, (string) $haystack);
}
return $result;
......
* @param array Alternative array than $GLOBAL to get variables from.
* @return mixed Whatever value. If none, then blank string.
*/
protected function getGlobal($var, $source=NULL) {
protected function getGlobal($var, $source = NULL) {
$vars = explode('|', $var);
$c = count($vars);
$k = trim($vars[0]);
$theVar = isset($source) ? $source[$k] : $GLOBALS[$k];
for ($a=1;$a<$c;$a++) {
for ($a = 1; $a < $c; $a++) {
if (!isset($theVar)) { break; }
if (!isset($theVar)) {
break;
}
$key = trim($vars[$a]);
if (is_object($theVar)) {
......
}
}
if (!is_array($theVar) && !is_object($theVar)) {
if (!is_array($theVar) && !is_object($theVar)) {
return $theVar;
} else {
return '';
t3lib/matchcondition/class.t3lib_matchcondition_frontend.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009-2010 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
* Copyright notice
*
* (c) 2009-2010 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Matching TypoScript conditions for frontend disposal.
......
* @see t3lib_tsparser::parse()
*/
protected function evaluateCondition($string) {
list($key, $value) = t3lib_div::trimExplode('=', $string, false, 2);
list($key, $value) = t3lib_div::trimExplode('=', $string, FALSE, 2);
$result = parent::evaluateConditionCommon($key, $value);
......
switch ($key) {
case 'usergroup':
$groupList = $this->getGroupList();
if ($groupList != '0,-1') { // '0,-1' is the default usergroups when not logged in!
if ($groupList != '0,-1') { // '0,-1' is the default usergroups when not logged in!
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($test == '*' || t3lib_div::inList($groupList, $test)) {
return true;
return TRUE;
}
}
}
break;
case 'treeLevel':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
$treeLevel = count($this->rootline) - 1;
foreach ($values as $test) {
if ($test == $treeLevel) {
return true;
return TRUE;
}
}
break;
case 'PIDupinRootline':
case 'PIDinRootline':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
if (($key=='PIDinRootline') || (!in_array($this->pageId, $values))) {
if (($key == 'PIDinRootline') || (!in_array($this->pageId, $values))) {
foreach ($values as $test) {
foreach ($this->rootline as $rl_dat) {
if ($rl_dat['uid'] == $test) {
return true;
return TRUE;
}
}
}
......
}
}
return false;
return FALSE;
}
/**
......
protected function getBrowserInfo($userAgent) {
// Exceute deprecated hooks:
// @deprecated since TYPO3 4.3
foreach($this->deprecatedHooks as $hookObj) {
foreach ($this->deprecatedHooks as $hookObj) {
if (method_exists($hookObj, 'browserInfo')) {
$result = $hookObj->browserInfo($userAgent);
if (strlen($result)) {
......
protected function getDeviceType($userAgent) {
// Exceute deprecated hooks:
// @deprecated since TYPO3 4.3
foreach($this->deprecatedHooks as $hookObj) {
foreach ($this->deprecatedHooks as $hookObj) {
if (method_exists($hookObj, 'whichDevice')) {
$result = $hookObj->whichDevice($userAgent);
if (strlen($result)) {
......
}
}
// deprecated, see above
// deprecated, see above
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_matchcondition.php']['devices_class'])) {
foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_matchcondition.php']['devices_class'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_matchcondition.php']['devices_class'] as $_classRef) {
$_procObj = t3lib_div::getUserObj($_classRef);
return $_procObj->whichDevice_ext($userAgent);
}
......
$val = parent::getVariableCommon($vars);
if (is_null($val)) {
$splitAgain=explode('|', $vars[1], 2);
$splitAgain = explode('|', $vars[1], 2);
$k = trim($splitAgain[0]);
if ($k) {
switch((string)trim($vars[0])) {
switch ((string) trim($vars[0])) {
case 'TSFE':
$val = $this->getGlobal('TSFE|' . $vars[1]);
break;
......
* @return integer The current page Id
*/
protected function determinePageId() {
return (int)$GLOBALS['TSFE']->id;
return (int) $GLOBALS['TSFE']->id;
}
/**
......
* @return array The rootline for the current page.
*/
protected function determineRootline() {
$rootline = (array)$GLOBALS['TSFE']->tmpl->rootLine;
$rootline = (array) $GLOBALS['TSFE']->tmpl->rootLine;
return $rootline;
}
......
* @return boolean Determines if a user is logged in
*/
protected function isUserLoggedIn() {
$userLoggedIn = false;
$userLoggedIn = FALSE;
if ($GLOBALS['TSFE']->loginUser) {
$userLoggedIn = true;
$userLoggedIn = TRUE;
}
return $userLoggedIn;
}
......
*/
protected function log($message) {
if (is_object($GLOBALS['TT'])) {
$GLOBALS['TT']->setTSlogMessage($message,3);
$GLOBALS['TT']->setTSlogMessage($message, 3);
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/matchcondition/class.t3lib_matchcondition_frontend.php']) {
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/matchcondition/class.t3lib_matchcondition_frontend.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/matchcondition/class.t3lib_matchcondition_frontend.php']);
}
t3lib/matchcondition/class.t3lib_matchcondition_backend.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009-2010 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
* Copyright notice
*
* (c) 2009-2010 Oliver Hader <oliver@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Matching TypoScript conditions for backend disposal.
......
* @see t3lib_tsparser::parse()
*/
protected function evaluateCondition($string) {
list($key, $value) = t3lib_div::trimExplode('=', $string, false, 2);
list($key, $value) = t3lib_div::trimExplode('=', $string, FALSE, 2);
$result = parent::evaluateConditionCommon($key, $value);
......
switch ($key) {
case 'usergroup':
$groupList = $this->getGroupList();
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($test == '*' || t3lib_div::inList($groupList, $test)) {
return true;
return TRUE;
}
}
break;
case 'adminUser':
if ($this->isUserLoggedIn()) {
$result = !((bool)$value XOR $this->isAdminUser());
$result = !((bool) $value XOR $this->isAdminUser());
return $result;
}
break;
break;
case 'treeLevel':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
$treeLevel = count($this->rootline) - 1;
// If a new page is being edited or saved the treeLevel is higher by one:
// If a new page is being edited or saved the treeLevel is higher by one:
if ($this->isNewPageWithPageId($this->pageId)) {
$treeLevel++;
}
foreach ($values as $test) {
if ($test == $treeLevel) {
return true;
return TRUE;
}
}
break;
case 'PIDupinRootline':
case 'PIDinRootline':
$values = t3lib_div::trimExplode(',', $value, true);
$values = t3lib_div::trimExplode(',', $value, TRUE);
if (($key=='PIDinRootline') || (!in_array($this->pageId, $values)) || $this->isNewPageWithPageId($this->pageId)) {
if (($key == 'PIDinRootline') || (!in_array($this->pageId, $values)) || $this->isNewPageWithPageId($this->pageId)) {
foreach ($values as $test) {
foreach ($this->rootline as $rl_dat) {
if ($rl_dat['uid'] == $test) {
return true;
return TRUE;
}
}
}
......
}
}
return false;
return FALSE;
}
/**
......
if ($action === 'edit') {
$pageId = $this->getPageIdByRecord($table, $uid);
} elseif ($action === 'new') {
$pageId = $this->getPageIdByRecord($table, $uid, true);
$pageId = $this->getPageIdByRecord($table, $uid, TRUE);
}
// Determine id from a command statement:
} elseif (is_array($commandStatement)) {
......
if ($action === 'delete') {
$pageId = $this->getPageIdByRecord($table, $uid);
} elseif (($action === 'copy') || ($action === 'move')) {
$pageId = $this->getPageIdByRecord($table, $target, true);
$pageId = $this->getPageIdByRecord($table, $target, TRUE);
}
}
......
* id value is considered as page id without any further checks
* @return integer Id of the page the record is persisted on
*/
protected function getPageIdByRecord($table, $id, $ignoreTable = false) {
protected function getPageIdByRecord($table, $id, $ignoreTable = FALSE) {
$pageId = 0;
$id = (int)$id;
$id = (int) $id;
if ($table && $id) {
if (($ignoreTable || $table === 'pages') && $id >= 0) {
$pageId = $id;
} else {
$record = t3lib_BEfunc::getRecordWSOL($table, abs($id), '*', '', false);
$record = t3lib_BEfunc::getRecordWSOL($table, abs($id), '*', '', FALSE);
$pageId = $record['pid'];
}
}
......
if (is_array($data) && isset($data['pages']) && is_array($data['pages'])) {
foreach ($data['pages'] as $uid => $fields) {
if (strpos($uid, 'NEW') === 0 && $fields['pid'] == $pageId) {
return true;
return TRUE;
}
}
}
......
$element['pid'] = $pageRecord['pid'];
}
if ($element['pid'] == $pageId) {
return true;
return TRUE;
}
}
}
}
}
return false;
return FALSE;
}
/**
......
*/
protected function determineRootline() {
$pageId = (isset($this->pageId) ? $this->pageId : $this->determinePageId());
$rootline = t3lib_BEfunc::BEgetRootLine($pageId, '', true);
$rootline = t3lib_BEfunc::BEgetRootLine($pageId, '', TRUE);
return $rootline;
}
......
* @return boolean Determines if a user is logged in
*/
protected function isUserLoggedIn() {
$userLoggedIn = false;
$userLoggedIn = FALSE;
if ($GLOBALS['BE_USER']->user['uid']) {
$userLoggedIn = true;
$userLoggedIn = TRUE;
}
return $userLoggedIn;
}
......
* @return boolean Whether the current user is admin
*/
protected function isAdminUser() {
$isAdminUser = false;
$isAdminUser = FALSE;
if ($GLOBALS['BE_USER']->user['admin']) {
$isAdminUser = true;
$isAdminUser = TRUE;
}
return $isAdminUser;
}
......
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/matchcondition/class.t3lib_matchcondition_backend.php']) {
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/matchcondition/class.t3lib_matchcondition_backend.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/matchcondition/class.t3lib_matchcondition_backend.php']);
}
(86-86/93)