[BUGFIX] RTE internal link handling broken since FAL changes
authorSteffen Ritter <info@rs-websystems.de>
Thu, 6 Sep 2012 14:34:00 +0000 (16:34 +0200)
committerBenjamin Mack <benni@typo3.org>
Mon, 8 Oct 2012 20:03:14 +0000 (22:03 +0200)
When enabling the RTE link browser to deal with FAL the
refactoring broke the detection of internal links.

Editing an internal link resulted always in editing an
external link including the current site URL.

Change-Id: I90ea32562bf87a7cb75e65b7f3175b6f74e7b021
Fixes: #40678
Releases: 6.0
Reviewed-on: http://review.typo3.org/14419
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php

index f394c3b..c417e02 100644 (file)
@@ -1937,26 +1937,25 @@ class ElementBrowser {
                                        }
                                } else {
                                        // URL is a page (id parameter)
-                                       $uP = parse_url($rel);
-                                       if (!trim($uP['path'])) {
-                                               $pp = preg_split('/^id=/', $uP['query']);
-                                               $pp[1] = preg_replace('/&id=[^&]*/', '', $pp[1]);
-                                               $parameters = explode('&', $pp[1]);
-                                               $id = array_shift($parameters);
-                                               if ($id) {
-                                                       // Checking if the id-parameter is an alias.
-                                                       if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
-                                                               list($idPartR) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages', 'alias', $id);
-                                                               $id = intval($idPartR['uid']);
-                                                       }
-                                                       $pageRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $id);
-                                                       $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
-                                                       $info['value'] = $GLOBALS['LANG']->getLL('page', 1) . ' \'' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($pageRow['title'], $titleLen)) . '\' (ID:' . $id . ($uP['fragment'] ? ', #' . $uP['fragment'] : '') . ')';
-                                                       $info['pageid'] = $id;
-                                                       $info['cElement'] = $uP['fragment'];
-                                                       $info['act'] = 'page';
-                                                       $info['query'] = $parameters[0] ? '&' . implode('&', $parameters) : '';
+                                       $uP = parse_url($href);
+
+                                       $pp = preg_split('/^id=/', $uP['query']);
+                                       $pp[1] = preg_replace('/&id=[^&]*/', '', $pp[1]);
+                                       $parameters = explode('&', $pp[1]);
+                                       $id = array_shift($parameters);
+                                       if ($id) {
+                                               // Checking if the id-parameter is an alias.
+                                               if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
+                                                       list($idPartR) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages', 'alias', $id);
+                                                       $id = intval($idPartR['uid']);
                                                }
+                                               $pageRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $id);
+                                               $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
+                                               $info['value'] = ((((($GLOBALS['LANG']->getLL('page', 1) . ' \'') . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($pageRow['title'], $titleLen))) . '\' (ID:') . $id) . ($uP['fragment'] ? ', #' . $uP['fragment'] : '')) . ')';
+                                               $info['pageid'] = $id;
+                                               $info['cElement'] = $uP['fragment'];
+                                               $info['act'] = 'page';
+                                               $info['query'] = $parameters[0] ? '&' . implode('&', $parameters) : '';
                                        }
                                }
                        } else {