Project

General

Profile

Actions

Bug #14746

closed

Linking to internal urls with extra parameters fails

Added by old_robbo almost 19 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2005-05-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.6.2
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I had a problem when linking to newsitems and other
extention redcords from a tt_content object. You cannot
link to it with the 'internal link browser' from the rte
editor so you have to use the external link browser. After
saving, the link is saved as a '<LINK' tag and the site
part from the url is removed. The following link:

http://www.snellerbeter.nl/index.php?id=nieuwsitem&tx_ttnews[tt_news]=452x%x%

is saved as:

<LINK nieuwsitem&tx_ttnews[tt_news]=452&tx_ttnews[backPid]=54&cHash=731a90

When the tt_content record is opened again it shows that
the link is invalid by coloring it yellow and giving it
a red border.

I traced it back to the class.t3lib_parsehtml_proc.php file
in the t3lib direcory. Here's the code that checks the url:

[snip]
// Splitting the parameter by ',' and if the array counts more tha
$pairParts = t3lib_div::trimExplode(',',$idPart);
if (count($pairParts)>1) {
$idPart = $pairParts0;
// Type ? future support for?
}
// Checking if the id-parameter is an alias.
if (t3lib_div::testInt($idPart)) {
list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','
$idPart = intval($idPartR['uid']);
}
$page = t3lib_BEfunc::getRecord('pages', $idPart);
if (is_array($page)) { // Page must exist...
$href = $siteUrl.'?id='.$link_param;
} else {
#$href = '';
$href = $siteUrl.'?id='.$link_param;
$error = 'No page found: '.$idPart;
}
[/snip]

And there is where it goes wrong. The $idPart variabele contains
the complete link like this:

nieuwsitem&tx_ttnews[tt_news]=452&tx_ttnews[backPid]=54&cHash=731a901ff6

And it expects only the id (nieuwsitem in this case)

I don't know why this line:

$pairParts = t3lib_div::trimExplode(',',$idPart);

explodes on ','

It seems that you can add a ',' with a 'type' parameter
but i can't figure out where that is used.

If you use '&' instead, it will extract the id from all the parameters.
I don't know if you are allowed to use a ',' in an url.

The same code is used in typo3\sysext\cms\tslib\class.tslib_content.php
to make it a link again for showing on the page:

[snip]
$pairParts = t3lib_div::trimExplode(',',$link_param);
if (count($pairParts)>1) {
$link_param = $pairParts0;
$theTypeP = $pairParts1; // Overruling 'typ
}
// Checking if the id-parameter is an alias.
if (t3lib_div::testInt($link_param)) {
$link_param = $GLOBALS['TSFE']->sys_page->getPageIdFromAli
}

// Looking up the page record to verify its existence:    
$page = $GLOBALS['TSFE']->sys_page->getPage($link_param);
if (count($page)) {
// This checks if the linked id is in the rootline
[/snip]

I have a couple of questions:

Is 'type' used in this url context?
If a 'type' parameter is used, shouldn't you add an explode on '&' aswell?

(issue imported from #M1094)

Actions #1

Updated by Mathias Schreiber over 17 years ago

Closed due to general Bugtracker Cleanup.

TYPO3 Version 3.6.2 will no longer be supported.

Actions

Also available in: Atom PDF