From 4c3235307f70d5ac422f257a433a4f9f2c5de77f Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 15:21:19 +0100 Subject: [PATCH 01/16] [TASK] Use int for makeHTML property in Nimut\Hellurl\Hooks\DataHandling\DataHandlerHook --- Classes/Hooks/DataHandling/DataHandlerHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Hooks/DataHandling/DataHandlerHook.php b/Classes/Hooks/DataHandling/DataHandlerHook.php index 24937b5..d9e3eb7 100644 --- a/Classes/Hooks/DataHandling/DataHandlerHook.php +++ b/Classes/Hooks/DataHandling/DataHandlerHook.php @@ -216,7 +216,7 @@ protected function getChildPages($pageId) /** @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */ $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView'); $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)); - $tree->makeHTML = false; + $tree->makeHTML = 0; $tree->getTree($pageId, 99, ''); foreach ($tree->tree as $data) { From d8f5a18541edde807245428369bebc9e35a40ede Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 15:24:45 +0100 Subject: [PATCH 02/16] [TASK] Fix wrong type hint for $enableDevLog in Nimut\Hellurl\Hooks\UrlRewritingHook --- Classes/Hooks/UrlRewritingHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Hooks/UrlRewritingHook.php b/Classes/Hooks/UrlRewritingHook.php index 2261943..0c3d413 100644 --- a/Classes/Hooks/UrlRewritingHook.php +++ b/Classes/Hooks/UrlRewritingHook.php @@ -122,7 +122,7 @@ class UrlRewritingHook implements SingletonInterface /** * Indicates whether devLog is enabled * - * @var true + * @var bool */ protected $enableDevLog = false; From 2c764e7f280496e9219046bfef4faaaf66d3c574 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 15:25:26 +0100 Subject: [PATCH 03/16] [TASK] Add missing property $enableChashUrlDebug in Nimut\Hellurl\Hooks\UrlRewritingHook --- Classes/Hooks/UrlRewritingHook.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Classes/Hooks/UrlRewritingHook.php b/Classes/Hooks/UrlRewritingHook.php index 0c3d413..7bfef05 100644 --- a/Classes/Hooks/UrlRewritingHook.php +++ b/Classes/Hooks/UrlRewritingHook.php @@ -141,10 +141,21 @@ class UrlRewritingHook implements SingletonInterface */ protected $mimeType = null; - public $enableStrictMode = false; - + /** + * @var bool + */ public $enableChashDebug = false; + /** + * @var bool + */ + protected $enableChashUrlDebug = false; + + /** + * @var bool + */ + public $enableStrictMode = false; + /** * If non-empty, corresponding URL query parameter will be ignored in preVars * (note: preVars only!). This is necessary for _DOMAINS feature. This value From a77e10421ad462ada198e9f6da4200ec1d0fff31 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 15:26:41 +0100 Subject: [PATCH 04/16] [TASK] Allow null for $mimeType in Nimut\Hellurl\Hooks\UrlRewritingHook --- Classes/Hooks/UrlRewritingHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Hooks/UrlRewritingHook.php b/Classes/Hooks/UrlRewritingHook.php index 7bfef05..c1b2f15 100644 --- a/Classes/Hooks/UrlRewritingHook.php +++ b/Classes/Hooks/UrlRewritingHook.php @@ -137,7 +137,7 @@ class UrlRewritingHook implements SingletonInterface /** * Mime type that can be set according to the file extension (decoding only). * - * @var string + * @var string|null */ protected $mimeType = null; From 5b6954b50e6489c63f9c89a7a57cbb8b3b292bc1 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 15:35:56 +0100 Subject: [PATCH 05/16] [TASK] Fix method returns in Nimut\Hellurl\Hooks\UrlRewritingHook --- Classes/Hooks/UrlRewritingHook.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/Hooks/UrlRewritingHook.php b/Classes/Hooks/UrlRewritingHook.php index c1b2f15..2de55a2 100644 --- a/Classes/Hooks/UrlRewritingHook.php +++ b/Classes/Hooks/UrlRewritingHook.php @@ -1350,7 +1350,7 @@ protected function decodeSpURL_settingPreVars(&$pathParts, $config) return $GET_VARS; } } - return null; + return array(); } /** @@ -1421,7 +1421,7 @@ protected function decodeSpURL_settingPostVarSets(&$pathParts, $postVarSetCfg, $ return $GET_VARS; } } - return null; + return array(); } /** @@ -1959,7 +1959,7 @@ protected function decodeSpURL_cHashCache($speakingURIpath) * @param string $value Value to match field in database to. * @param bool $aliasToUid If TRUE, the input $value is an alias-string that needs translation to an ID integer. FALSE (default) means the reverse direction * - * @return string Result value of lookup. If no value was found the $value is returned. + * @return int|string Result value of lookup. Either an int value (id) or a string (alias). If no value was found the $value is returned. */ protected function lookUpTranslation($cfg, $value, $aliasToUid = false) { @@ -2093,7 +2093,7 @@ protected function lookUp_uniqAliasToId($cfg, $aliasValue, $onlyNonExpired = fal * @param int $lang sys_language_uid to use for lookup * @param string $aliasValue Optional alias value to limit search to * - * @return string Alias string. If none is found: false + * @return string|null Alias string. If none is found: null * @see lookUpTranslation(), lookUp_uniqAliasToId() */ protected function lookUp_idToUniqAlias($cfg, $idValue, $lang, $aliasValue = '') From 2c08a9c25505caaf3b5532d3ffbc6c3d425fa9ff Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 15:43:42 +0100 Subject: [PATCH 06/16] [TASK] Fix argument casting in Nimut\Hellurl\Hooks\UrlRewritingHook --- Classes/Hooks/UrlRewritingHook.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/Hooks/UrlRewritingHook.php b/Classes/Hooks/UrlRewritingHook.php index 2de55a2..b4f8855 100644 --- a/Classes/Hooks/UrlRewritingHook.php +++ b/Classes/Hooks/UrlRewritingHook.php @@ -2047,7 +2047,7 @@ protected function lookUpTranslation($cfg, $value, $aliasToUid = false) if ($csConvObj->strlen('utf-8', $aliasValue) > $maximumAliasLength) { $aliasValue = $csConvObj->crop('utf-8', $aliasValue, $maximumAliasLength); } - return $this->lookUp_newAlias($cfg, $aliasValue, $value, $lang); + return $this->lookUp_newAlias($cfg, $aliasValue, (int)$value, $lang); } // If no cache for alias, then just return whatever value is appropriate: if (strlen($row[$cfg['alias_field']]) <= $maximumAliasLength) { return $row[$cfg['alias_field']]; @@ -2135,7 +2135,7 @@ protected function lookUp_newAlias($cfg, $newAliasValue, $idValue, $lang) $newAliasValue = $this->lookUp_cleanAlias($cfg, $newAliasValue); // If autoupdate is true we might be here even if an alias exists. Therefore we check if that alias is the $newAliasValue and if so, we return that instead of making a new, unique one. - if ($cfg['autoUpdate'] && $this->lookUp_idToUniqAlias($cfg, $idValue, $lang, $newAliasValue)) { + if ($cfg['autoUpdate'] && $this->lookUp_idToUniqAlias($cfg, (string)$idValue, $lang, $newAliasValue)) { return $newAliasValue; } @@ -2174,7 +2174,7 @@ protected function lookUp_newAlias($cfg, $newAliasValue, $idValue, $lang) ); // Checking that this alias hasn't been stored since we looked last time - $returnAlias = $this->lookUp_idToUniqAlias($cfg, $idValue, $lang, $uniqueAlias); + $returnAlias = $this->lookUp_idToUniqAlias($cfg, (string)$idValue, $lang, $uniqueAlias); if ($returnAlias) { // If we are here it is because another process managed to create this alias in the time between we looked the first time and now when we want to put it in database. $uniqueAlias = $returnAlias; @@ -2360,7 +2360,7 @@ protected function getHost() /** * Returns configuration for a postVarSet (default) based on input page id * - * @param int $pageId Page id + * @param int|string $pageId Page id or alias * @param string $mainCat Main key in hellurl configuration array. Default is "postVarSets" but could be "fixedPostVars" * * @return array Configuration array @@ -2371,7 +2371,7 @@ public function getPostVarSetConfig($pageId, $mainCat = 'postVarSets') { // If the page id is NOT an integer, it's an alias we have to look up if (!MathUtility::canBeInterpretedAsInteger($pageId)) { - $pageId = $this->pageAliasToID($pageId); + $pageId = $this->pageAliasToID((string)$pageId); } // Checking if the value is not an array but a pointer to another key From 9772503b395540ba6488a165ae856a9558354182 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 16:04:43 +0100 Subject: [PATCH 07/16] [TASK] Fix argument casting in Nimut\Hellurl\UriGeneratorAndResolver --- Classes/UriGeneratorAndResolver.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Classes/UriGeneratorAndResolver.php b/Classes/UriGeneratorAndResolver.php index 0bb8889..72494bd 100644 --- a/Classes/UriGeneratorAndResolver.php +++ b/Classes/UriGeneratorAndResolver.php @@ -173,7 +173,7 @@ private function resolveAlias($pageId) */ protected function isExcludedPage($pageId) { - return $this->conf['excludePageIds'] && GeneralUtility::inList($this->conf['excludePageIds'], $pageId); + return $this->conf['excludePageIds'] && GeneralUtility::inList($this->conf['excludePageIds'], (string)$pageId); } /** @@ -197,7 +197,7 @@ protected function mergeWithPathParts(array &$pathParts, $pagePath) * Resolves shortcuts if necessary and returns the final destination page id. * * @param int $pageId - * @param array $mpvar + * @param string $mpvar * * @return mixed false if not found or int */ @@ -280,8 +280,8 @@ protected function createPagePathAndUpdateURLCache($id, $mpvar, $lang, $cachedPa * Adds a new entry to the path cache. * * @param int $pageId - * @param int $cachedPagePath - * @param int $pagePath + * @param string $cachedPagePath + * @param string $pagePath * @param int $langId * @param int $rootPageId * @param string $mpvar @@ -291,7 +291,7 @@ protected function createPagePathAndUpdateURLCache($id, $mpvar, $lang, $cachedPa private function updateURLCache($pageId, $cachedPagePath, $pagePath, $langId, $rootPageId, $mpvar) { $canCachePaths = !$this->conf['disablePathCache'] && !$this->pObj->isBEUserLoggedIn(); - $newPathDiffers = ((string)$pagePath !== (string)$cachedPagePath); + $newPathDiffers = $pagePath !== $cachedPagePath; if ($canCachePaths && $newPathDiffers) { /** @noinspection PhpUndefinedMethodInspection */ $cacheCondition = 'page_id=' . intval($pageId) . @@ -628,7 +628,7 @@ protected function rootLineToPath($rl, $lang) // Building up the path from page title etc. if (!$page['tx_hellurl_exclude'] || count($rl) == 0) { // List of "pages" fields to traverse for a "directory title" in the speaking URL (only from RootLine!!) - $segTitleFieldArray = GeneralUtility::trimExplode(',', $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_HELLURL_SEGTITLEFIELDLIST_DEFAULT, 1); + $segTitleFieldArray = GeneralUtility::trimExplode(',', $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_HELLURL_SEGTITLEFIELDLIST_DEFAULT, true); $theTitle = ''; foreach ($segTitleFieldArray as $fieldName) { if (isset($page[$fieldName]) && $page[$fieldName] !== '') { @@ -1004,7 +1004,7 @@ protected function findIDBySegment($startPid, $mpvar, array &$urlParts, $current * when excluded segment is found * * @param array $row Row to process - * @param array $mpvar MP var + * @param string $mpvar MP var * @param array $urlParts URL segments * @param bool $foundUID * @@ -1045,7 +1045,7 @@ protected function findPageBySegmentAndPid($searchPid, $title) // List of "pages" fields to traverse for a "directory title" in the speaking URL (only from RootLine!!) $segTitleFieldList = $this->conf['segTitleFieldList'] ? $this->conf['segTitleFieldList'] : TX_HELLURL_SEGTITLEFIELDLIST_DEFAULT; $selList = GeneralUtility::uniqueList('uid,pid,doktype,mount_pid,mount_pid_ol,tx_hellurl_exclude,' . $segTitleFieldList); - $segTitleFieldArray = GeneralUtility::trimExplode(',', $segTitleFieldList, 1); + $segTitleFieldArray = GeneralUtility::trimExplode(',', $segTitleFieldList, true); // page select object - used to analyse mount points. $sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); From 208371242a026795aebe8382b3cc10747d939e3e Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 16:07:13 +0100 Subject: [PATCH 08/16] [TASK] Fix undefined variable in Nimut\Hellurl\UriGeneratorAndResolver --- Classes/UriGeneratorAndResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/UriGeneratorAndResolver.php b/Classes/UriGeneratorAndResolver.php index 72494bd..4161f87 100644 --- a/Classes/UriGeneratorAndResolver.php +++ b/Classes/UriGeneratorAndResolver.php @@ -528,7 +528,7 @@ protected function IDtoPagePathSegments($id, $mpvar, $langID) } if (!$rootFound) { // Pass #2 -- check normal page - $this->pObj->devLog('Starting to walk rootline for id=' . $id . ' from index=' . $i, $rootLine); + $this->pObj->devLog('Starting to walk rootline for id=' . $id . ' from index=0 to ' . $numberOfRootlineEntries, $rootLine); for ($i = 0; $i < $numberOfRootlineEntries; $i++) { if ($GLOBALS['TSFE']->tmpl->rootLine[0]['uid'] == $rootLine[$i]['uid']) { $this->pObj->devLog('Found rootline', array('uid' => $id, 'rootline start pid' => $rootLine[$i]['uid'])); From 85c83f2f9685fb9b2afec483c8fd7fefeab44c18 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 16:14:31 +0100 Subject: [PATCH 09/16] [TASK] Fix method returns in Nimut\Hellurl\UriGeneratorAndResolver --- Classes/UriGeneratorAndResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/UriGeneratorAndResolver.php b/Classes/UriGeneratorAndResolver.php index 4161f87..1b53ce7 100644 --- a/Classes/UriGeneratorAndResolver.php +++ b/Classes/UriGeneratorAndResolver.php @@ -656,7 +656,7 @@ protected function rootLineToPath($rl, $lang) * * @param array $pathParts Array of segments from virtual path * - * @return int Page ID + * @return array Page ID and GET_VARS * @see decodeSpURL_idFromPath() */ protected function pagePathtoID(&$pathParts) @@ -1223,7 +1223,7 @@ public function encodeTitle($title) * * @param int $offsetFromNow Offset to expiration * - * @return int Expiration time stamp + * @return int|string Expiration timestamp or SQL string if adodb is loaded */ protected function makeExpirationTime($offsetFromNow = 0) { From bcc7c348ead16982604fbdf86979644181a5f9a7 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 16:20:29 +0100 Subject: [PATCH 10/16] [TASK] Add phpstan code analysis for multiple TYPO3 versions As the code analysis depends in the TYPO3 CMS code as well, we include all supported TYPO3 CMS versions for code analysis. --- .travis.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1abe9f5..b2323ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,18 @@ matrix: - php: 5.4 - php: 5.3 - php: 7.0 - env: CODE_ANALYSIS=yes + env: TYPO3="dev-master as 8.5.0" CODE_ANALYSIS=yes + - php: 7.0 + env: TYPO3=^8.0 CODE_ANALYSIS=yes + - php: 7.0 + env: TYPO3=^7.6 CODE_ANALYSIS=yes + - php: 7.0 + env: TYPO3=^6.2 CODE_ANALYSIS=yes allow_failures: - - env: CODE_ANALYSIS=yes + - env: TYPO3="dev-master as 8.5.0" CODE_ANALYSIS=yes + - env: TYPO3=^8.0 CODE_ANALYSIS=yes + - env: TYPO3=^7.6 CODE_ANALYSIS=yes + - env: TYPO3=^6.2 CODE_ANALYSIS=yes addons: apt: @@ -28,7 +37,7 @@ script: - > if [[ "$CODE_ANALYSIS" == "yes" ]]; then - composer require typo3/cms="^7.6" + composer require typo3/cms="$TYPO3" --ignore-platform-reqs git checkout composer.json .Build/bin/phpstan analyse --level 5 ext_localconf.php ext_tables.php Classes fi From f7afa84e07301c3f6459ed63fe3f4d98e11219c6 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 16:50:26 +0100 Subject: [PATCH 11/16] [TASK] Use $GLOBALS['BACK_PATH'] instead of undefined property in Nimut\Hellurl\View\AdministrationModuleFunction The property $backPath of TYPO3\CMS\Backend\Template\DocumentTemplate was removed with TYPO3 CMS 7.6. --- Classes/View/AdministrationModuleFunction.php | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Classes/View/AdministrationModuleFunction.php b/Classes/View/AdministrationModuleFunction.php index 41af29c..80f064b 100644 --- a/Classes/View/AdministrationModuleFunction.php +++ b/Classes/View/AdministrationModuleFunction.php @@ -303,13 +303,13 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) // Add values from alternative field used to generate URL: $baseRow = $row['row']; // page row as base. - $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages][' . $row['row']['uid'] . ']=edit&columnsOnly=title,nav_title,alias,tx_hellurl_pathsegment', $this->pObj->doc->backPath); + $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages][' . $row['row']['uid'] . ']=edit&columnsOnly=title,nav_title,alias,tx_hellurl_pathsegment', $GLOBALS['BACK_PATH']); $editIcon = '' . - $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . ''; - $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $this->pObj->doc->backPath, '', '', '', ''); + $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $GLOBALS['BACK_PATH'], '', '', '', ''); $editIcon .= '' . - $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH']) . ''; if ($inf['language_id'] > 0) { // For alternative languages, show another list of fields, form page overlay record: @@ -317,13 +317,13 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) list($olRec) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $row['row']['uid'], ' AND sys_language_uid=' . intval($inf['language_id'])); if (is_array($olRec)) { $baseRow = array_merge($baseRow, $olRec); - $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages_language_overlay][' . $olRec['uid'] . ']=edit&columnsOnly=title,nav_title', $this->pObj->doc->backPath); + $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[pages_language_overlay][' . $olRec['uid'] . ']=edit&columnsOnly=title,nav_title', $GLOBALS['BACK_PATH']); $editIcon = '' . - $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . ''; - $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $this->pObj->doc->backPath, '', '', '', '&L=' . $olRec['sys_language_uid']); + $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $GLOBALS['BACK_PATH'], '', '', '', '&L=' . $olRec['sys_language_uid']); $editIcon .= '' . - $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH']) . ''; } else { $baseRow = array(); @@ -384,16 +384,16 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) } else { $tCells[] = '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete') . '' . '' . - $this->getIcon('gfx/edit2.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Edit') . + $this->getIcon('gfx/edit2.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH'], 'Edit') . '' . '' . - $this->getIcon('gfx/napshot.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Use for search') . + $this->getIcon('gfx/napshot.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH'], 'Use for search') . '' . '' . - $this->getIcon('gfx/clip_copy.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Copy entry') . + $this->getIcon('gfx/clip_copy.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH'], 'Copy entry') . '' . ''; } @@ -401,7 +401,7 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) ($inf['expire'] ? htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($inf['expire'], -1)) : '') . ($inf['expire'] ? '' . - $this->getIcon('gfx/up.gif', 'width="14" height="14"', $this->pObj->doc->backPath, 'Set expire time to 30 days') . + $this->getIcon('gfx/up.gif', 'width="14" height="14"', $GLOBALS['BACK_PATH'], 'Set expire time to 30 days') . '' : '') . ''; @@ -447,15 +447,15 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) $tCells[] = 'Pagepath:'; $tCells[] = '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . '' . '' . - $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . '' . ''; $tCells[] = 'Expires:' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Flush all expired') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Flush all expired') . '' . ''; $tCells[] = 'Errors:'; @@ -819,7 +819,7 @@ public function decodeView(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) $tCells[] = '' . $row['row']['uid'] . ''; $tCells[] = '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete entries for page') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete entries for page') . '' . ''; } @@ -836,7 +836,7 @@ public function decodeView(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) // Delete: $tCells[] = '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete entry') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete entry') . '' . ''; @@ -877,12 +877,12 @@ public function decodeView(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) $output = '

Displayed entries: ' . $countDisplayed . ' ' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete displayed entries') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete displayed entries') . '' . '
Total entries in decode cache: ' . $count_allInTable['count'] . ' ' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete WHOLE decode cache!') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete WHOLE decode cache!') . '' . '
' . $output . ' @@ -959,7 +959,7 @@ public function encodeView(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) $tCells[] = ''; $tCells[] = ''; } @@ -976,7 +976,7 @@ public function encodeView(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) // Delete: $tCells[] = ''; @@ -1034,12 +1034,12 @@ public function encodeView(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree)
Displayed entries: ' . $countDisplayed . ' ' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete displayed entries') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete displayed entries') . '' . '
Total entries in encode cache: ' . $count_allInTable['count'] . ' ' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete WHOLE encode cache!') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete WHOLE encode cache!') . '' . '
' . $row['row']['uid'] . '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete entries for page') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete entries for page') . '' . '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete entry!') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete entry!') . '' . '
' . $output . ' @@ -1136,11 +1136,11 @@ public function uniqueAlias() $tCells[] = ''; @@ -1170,15 +1170,15 @@ public function uniqueAlias() $tCells[] = ''; $tCells[] = ''; $tCells[] = ''; $tCells[] = ''; @@ -1357,7 +1357,7 @@ public function logView() $tCells[] = ''; $tCells[] = ''; $tCells[] = ''; @@ -1393,7 +1393,7 @@ public function logView() $output = '
' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete All') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete All') . ' Flush log
' . // Edit link: '' . - $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . '' . // Delete link: '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath) . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . '' . 'Lang:Expire:' . (!$search ? '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Flush expired') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Flush expired') . '' : '') . '' . (!$search ? '' . - $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Edit all') . + $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Edit all') . '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete all') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete all') . '' : '') . 'Error:' . \TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($rec['tstamp']) . '' . ($host ? $host . '/' : '') . htmlspecialchars($rec['url']) . '' . ' ' . - $this->getIcon('gfx/napshot.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Set as redirect') . + $this->getIcon('gfx/napshot.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH'], 'Set as redirect') . '' . '' . htmlspecialchars($rec['error']) . '
' . $output . ' @@ -1552,10 +1552,10 @@ protected function generateSingleRedirectContent(array $rec, $page) { $output = ''; $output .= sprintf('', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $rec['url']), htmlspecialchars($rec['url'])); @@ -1706,7 +1706,7 @@ protected function deleteRedirectEntry() protected function getNewButton() { $content = ''; return $content; } From 7b906287f4cafac01d54f15ef57e0a2f046a0505 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 16:55:22 +0100 Subject: [PATCH 12/16] [TASK] Fix argument casting in Nimut\Hellurl\View\AdministrationModuleFunction --- Classes/View/AdministrationModuleFunction.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/View/AdministrationModuleFunction.php b/Classes/View/AdministrationModuleFunction.php index 80f064b..1f1d4a6 100644 --- a/Classes/View/AdministrationModuleFunction.php +++ b/Classes/View/AdministrationModuleFunction.php @@ -307,7 +307,7 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) $editIcon = '' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . ''; - $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $GLOBALS['BACK_PATH'], '', '', '', ''); + $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $GLOBALS['BACK_PATH'], null, '', '', ''); $editIcon .= '' . $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH']) . ''; @@ -321,7 +321,7 @@ public function renderModule(\TYPO3\CMS\Backend\Tree\View\PageTreeView $tree) $editIcon = '' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH']) . ''; - $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $GLOBALS['BACK_PATH'], '', '', '', '&L=' . $olRec['sys_language_uid']); + $onClick = \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($row['row']['uid'], $GLOBALS['BACK_PATH'], null, '', '', '&L=' . $olRec['sys_language_uid']); $editIcon .= '' . $this->getIcon('gfx/zoom.gif', 'width="12" height="12"', $GLOBALS['BACK_PATH']) . ''; @@ -624,7 +624,7 @@ protected function getLanguageSelector() */ protected function getSystemLanguages() { - $languages = (array)\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('sys_language', 'pid', 0, '', '', 'title'); + $languages = (array)\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('sys_language', 'pid', '0', '', '', 'title'); $defaultLanguageLabel = $this->getDefaultLanguageName(); From 9e3c471a0405cdeb22ba0996bbd74f53b68fbe07 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 17:42:21 +0100 Subject: [PATCH 13/16] [TASK] Fix undefined variable in Nimut\Hellurl\ViewHelpers\PageBrowserViewHelper --- Classes/ViewHelpers/PageBrowserViewHelper.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Classes/ViewHelpers/PageBrowserViewHelper.php b/Classes/ViewHelpers/PageBrowserViewHelper.php index 88f506e..76bc61b 100644 --- a/Classes/ViewHelpers/PageBrowserViewHelper.php +++ b/Classes/ViewHelpers/PageBrowserViewHelper.php @@ -95,8 +95,10 @@ public static function getInlineStyles() protected function generatePageBrowser() { $markup = ''; - for ($page = 1; $page <= min($this->totalPages, $this->currentPage, self::PAGES_AFTER_START + 1); $page++) { - $markup .= $this->createCell($page); + $pageMax = min($this->totalPages, $this->currentPage, self::PAGES_AFTER_START + 1); + $page = $pageMax + 1; + for ($i = 1; $i <= $pageMax; $i++) { + $markup .= $this->createCell($i); } if ($page < $this->currentPage - self::PAGES_BEFORE) { @@ -104,17 +106,18 @@ protected function generatePageBrowser() $page = $this->currentPage - self::PAGES_BEFORE; } - for (; $page <= min($this->totalPages, $this->currentPage + self::PAGES_AFTER); $page++) { - $markup .= $this->createCell($page); + $pageMax = min($this->totalPages, $this->currentPage + self::PAGES_AFTER); + for ($i = $page; $i <= $pageMax; $i++) { + $markup .= $this->createCell($i); } - if ($page < $this->totalPages - self::PAGES_BEFORE_END) { + if ($pageMax < $this->totalPages - self::PAGES_BEFORE_END) { $markup .= $this->createEllipses(); $page = $this->totalPages - self::PAGES_BEFORE_END; } - for (; $page <= $this->totalPages; $page++) { - $markup .= $this->createCell($page); + for ($i = $page; $i <= $this->totalPages; $i++) { + $markup .= $this->createCell($i); } return $markup; From defe8ef661d5f61dec3bca01701fa6918d6f40bf Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 17:52:31 +0100 Subject: [PATCH 14/16] [TASK] Fix method return in Nimut\Hellurl\UriGeneratorAndResolver --- Classes/UriGeneratorAndResolver.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Classes/UriGeneratorAndResolver.php b/Classes/UriGeneratorAndResolver.php index 1b53ce7..b154d32 100644 --- a/Classes/UriGeneratorAndResolver.php +++ b/Classes/UriGeneratorAndResolver.php @@ -946,17 +946,15 @@ protected function fetchPagesForPath($url) * @param int $startPid Page id in which to search subpages matching first part of urlParts * @param string $mpvar MP variable string * @param array $urlParts Segments of the virtual path (passed by reference; items removed) - * @param array|string $currentIdMp Array with the current pid/mpvar to return if no processing is done. + * @param array|null $currentIdMp Array with the current pid/mpvar to return if no processing is done. * @param bool $foundUID * * @return array With resolved id and $mpvar */ - protected function findIDBySegment($startPid, $mpvar, array &$urlParts, $currentIdMp = '', $foundUID = false) + protected function findIDBySegment($startPid, $mpvar, array &$urlParts, $currentIdMp = null, $foundUID = false) { // Creating currentIdMp variable if not set - if (!is_array($currentIdMp)) { - $currentIdMp = array($startPid, $mpvar, $foundUID); - } + $currentIdMp = ($currentIdMp !== null) ? $currentIdMp : array($startPid, $mpvar, $foundUID); // No more urlparts? Return what we have. if (count($urlParts) == 0) { From 0f86be6e2da656aa65a64bb321baab9dde9e6ed6 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 22:52:45 +0100 Subject: [PATCH 15/16] [TASK] Fix unknown class in Nimut\Hellurl\Configuration\ConfigurationGenerator --- Classes/Configuration/ConfigurationGenerator.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/Configuration/ConfigurationGenerator.php b/Classes/Configuration/ConfigurationGenerator.php index e97b5ab..dcce9cf 100644 --- a/Classes/Configuration/ConfigurationGenerator.php +++ b/Classes/Configuration/ConfigurationGenerator.php @@ -28,7 +28,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use TYPO3\CMS\Core\Locking\LockingStrategyInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -58,9 +57,11 @@ public function generateConfiguration() $fileName = PATH_site . self::AUTOCONFIGURTION_FILE; if (class_exists('TYPO3\\CMS\\Core\\Locking\\LockFactory')) { $lockFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Locking\\LockFactory'); + $capabilities = constant('TYPO3\\CMS\\Core\\Locking\\LockingStrategyInterface::LOCK_CAPABILITY_EXCLUSIVE') + | constant('TYPO3\\CMS\\Core\\Locking\\LockingStrategyInterface::LOCK_CAPABILITY_NOBLOCK'); $lockObject = $lockFactory->createLocker( $fileName, - LockingStrategyInterface::LOCK_CAPABILITY_EXCLUSIVE | LockingStrategyInterface::LOCK_CAPABILITY_NOBLOCK + $capabilities ); $lockObject->acquire(); } else { From 1c64610a8343a7a82849c2d7e003a448e449e063 Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Mon, 23 Jan 2017 23:01:34 +0100 Subject: [PATCH 16/16] [TASK] Prevent to call undefined method in Nimut\Hellurl\Hooks\UrlRewritingHook --- Classes/Hooks/UrlRewritingHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Hooks/UrlRewritingHook.php b/Classes/Hooks/UrlRewritingHook.php index b4f8855..20faf83 100644 --- a/Classes/Hooks/UrlRewritingHook.php +++ b/Classes/Hooks/UrlRewritingHook.php @@ -1033,7 +1033,7 @@ public function decodeSpURL($params) $cachedInfo['GET_VARS']['id'] = $cachedInfo['id']; $_SERVER['QUERY_STRING'] = $this->decodeSpURL_createQueryString($cachedInfo['GET_VARS']); if (is_callable('TYPO3\\CMS\\Core\\Utility\\GeneralUtility::flushInternalRuntimeCaches')) { - GeneralUtility::flushInternalRuntimeCaches(); + call_user_func('TYPO3\\CMS\\Core\\Utility\\GeneralUtility::flushInternalRuntimeCaches'); } // Jump-admin if configured
' . '' . - $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Edit entry') . + $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Edit entry') . '' . '' . - $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete entry') . + $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $GLOBALS['BACK_PATH'], 'Delete entry') . '' . '/%s