Fixed bug #8192: typoLink generates wrong links
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Sat, 17 May 2008 06:45:40 +0000 (06:45 +0000)
committerDmitry Dulepov <dmitry.dulepov@gmail.com>
Sat, 17 May 2008 06:45:40 +0000 (06:45 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3659 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_content.php

index 3af909b..0ae6e05 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Fixed bug #8277: Enable tabs in sys_workspaces  (thanks to Steffen Kamper)
        * Fixed bug #8439: Help icon in function module is double  (thanks to Steffen Kamper)
+       * Fixed bug #8192: typoLink generates wrong links
 
 2008-05-15  Stanislas Rolland  <typo3@sjbr.ca>
 
index aefe60a..7a08af2 100755 (executable)
@@ -5187,14 +5187,17 @@ class tslib_cObj {
                                $fileChar=intval(strpos($link_param, '/'));
                                $urlChar=intval(strpos($link_param, '.'));
 
+                               // Firsts, test if $link_param is numeric and page with such id exists. If yes, do not attempt to link to file
+                               if (!t3lib_div::testInt($link_param) || count($GLOBALS['TSFE']->sys_page->getPage_noCheck($link_param)) == 0) {
                                        // Detects if a file is found in site-root (or is a 'virtual' simulateStaticDocument file!) and if so it will be treated like a normal file.
-                               list($rootFileDat) = explode('?',rawurldecode($link_param));
-                               $containsSlash = strstr($rootFileDat,'/');
-                               $rFD_fI = pathinfo($rootFileDat);
-                               if (trim($rootFileDat) && !$containsSlash && (@is_file(PATH_site.$rootFileDat) || t3lib_div::inList('php,html,htm',strtolower($rFD_fI['extension']))))  {
-                                       $isLocalFile = 1;
-                               } elseif ($containsSlash)       {
-                                       $isLocalFile = 2;               // Adding this so realurl directories are linked right (non-existing).
+                                       list($rootFileDat) = explode('?',rawurldecode($link_param));
+                                       $containsSlash = strstr($rootFileDat,'/');
+                                       $rFD_fI = pathinfo($rootFileDat);
+                                       if (trim($rootFileDat) && !$containsSlash && (@is_file(PATH_site.$rootFileDat) || t3lib_div::inList('php,html,htm',strtolower($rFD_fI['extension']))))  {
+                                               $isLocalFile = 1;
+                                       } elseif ($containsSlash)       {
+                                               $isLocalFile = 2;               // Adding this so realurl directories are linked right (non-existing).
+                                       }
                                }
 
                                if($pU['scheme'] || ($isLocalFile!=1 && $urlChar && (!$containsSlash || $urlChar<$fileChar)))   {       // url (external): If doubleSlash or if a '.' comes before a '/'.