Fixed bug #12682: Section links coming from RTE broken in FE
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 9 Dec 2009 15:03:59 +0000 (15:03 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 9 Dec 2009 15:03:59 +0000 (15:03 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6644 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_parsehtml_proc.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php

index 3e90191..dd6fb5e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-12-09  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #12682: Section links coming from RTE broken in FE
+
 2009-12-07  Steffen Kamper  <info@sk-typo3.de>
 
        * Raised felogin version from 1.2.0 to 1.3.0
index 6f84210..8880f14 100644 (file)
@@ -709,21 +709,13 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                        } elseif($fileChar)     {       // file (internal)
                                                $href = $siteUrl.$link_param;
                                        } else {        // integer or alias (alias is without slashes or periods or commas, that is 'nospace,alphanum_x,lower,unique' according to tables.php!!)
-                                               $link_params_parts = explode('#',$link_param);
-                                               $idPart = trim($link_params_parts[0]);          // Link-data del
+                                                       // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/parameters triplet
+                                               $pairParts = t3lib_div::trimExplode(',', $link_param, TRUE);
+                                               $idPart = $pairParts[0];
+                                               $link_params_parts = explode('#', $idPart);
+                                               $idPart = trim($link_params_parts[0]);
+                                               $sectionMark = trim($link_params_parts[1]);
                                                if (!strcmp($idPart,''))        { $idPart=$this->recPid; }      // If no id or alias is given, set it to class record pid
-
-// FIXME commented because useless - what is it for?
-//                                             if ($link_params_parts[1] && !$sectionMark)     {
-//                                                     $sectionMark = '#'.trim($link_params_parts[1]);
-//                                             }
-
-                                                       // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/? pair
-                                               $pairParts = t3lib_div::trimExplode(',',$idPart);
-                                               if (count($pairParts)>1)        {
-                                                       $idPart = $pairParts[0];
-                                                       // Type ? future support for?
-                                               }
                                                        // Checking if the id-parameter is an alias.
                                                if (!t3lib_div::testInt($idPart))       {
                                                        list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','alias',$idPart);
@@ -731,8 +723,7 @@ class t3lib_parsehtml_proc extends t3lib_parsehtml {
                                                }
                                                $page = t3lib_BEfunc::getRecord('pages', $idPart);
                                                if (is_array($page))    {       // Page must exist...
-                                                       $pairParts = t3lib_div::trimExplode(',',$link_param);
-                                                       $href = $siteUrl.'?id='.$pairParts[0].($pairParts[2]?$pairParts[2]:'');
+                                                       $href = $siteUrl .'?id=' . $idPart . ($pairParts[2] ? $pairParts[2] : '') . ($sectionMark ? '#' . $sectionMark : '');
                                                        // linkHandler - allowing links to start with registerd linkHandler e.g.. "record:"
                                                } elseif (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][array_shift(explode(':', $link_param))])) {
                                                        $href = $link_param;
index 2c7d9a9..d6c60ed 100644 (file)
@@ -5964,18 +5964,18 @@ class tslib_cObj {
                                        }
                                } else {        // integer or alias (alias is without slashes or periods or commas, that is 'nospace,alphanum_x,lower,unique' according to definition in $TCA!)
                                        if ($conf['no_cache.']) $conf['no_cache']=$this->stdWrap($conf['no_cache'], $conf['no_cache.']);
-                                       $link_params_parts=explode('#',$link_param);
+                                               // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/parameters triplet
+                                       $pairParts = t3lib_div::trimExplode(',', $link_param, TRUE);
+                                       $link_param = $pairParts[0];
+                                       $link_params_parts = explode('#', $link_param);
                                        $link_param = trim($link_params_parts[0]);              // Link-data del
                                        if (!strcmp($link_param,''))    {$link_param=$GLOBALS['TSFE']->id;}     // If no id or alias is given
                                        if ($link_params_parts[1] && !$sectionMark)     {
                                                $sectionMark = trim($link_params_parts[1]);
                                                $sectionMark = (t3lib_div::testInt($sectionMark)?'#c':'#').$sectionMark;
                                        }
-                                               // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/? pair
                                        unset($theTypeP);
-                                       $pairParts = t3lib_div::trimExplode(',',$link_param);
                                        if (count($pairParts)>1)        {
-                                               $link_param = $pairParts[0];
                                                $theTypeP = isset($pairParts[1]) ? $pairParts[1] : 0;           // Overruling 'type'
                                                $conf['additionalParams'].= isset($pairParts[2]) ? $pairParts[2] : '';
                                        }
index 6fa7a2e..c7dc73a 100644 (file)
@@ -1,3 +1,7 @@
+2009-12-09  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #12682: Section links coming from RTE broken in FE
+
 2009-12-06  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Follow-up to bug #12926: RTE floods BE Log with error messages from json_encode()
index 865d7ef..63ffad0 100644 (file)
@@ -518,8 +518,8 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                        // Link setting functions
                $JScode.='
                        function link_typo3Page(id,anchor) {
-                               var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
-                               var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"")+parameters;
+                               var parameters = (document.ltargetform.query_parameters && document.ltargetform.query_parameters.value) ? (document.ltargetform.query_parameters.value.charAt(0) == "&" ? "" : "&") + document.ltargetform.query_parameters.value : "";
+                               var theLink = \'' . $this->siteURL . '?id=\' + id + parameters + (anchor ? anchor : "");
                                if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value);
                                if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value);
                                if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value);
@@ -542,7 +542,7 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                                return false;
                        }
                        function link_current() {
-                               var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
+                               var parameters = (document.ltargetform.query_parameters && document.ltargetform.query_parameters.value) ? (document.ltargetform.query_parameters.value.charAt(0) == "&" ? "" : "&") + document.ltargetform.query_parameters.value : "";
                                if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value);
                                if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value);
                                if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value);