Bug #6080
CoolURI builds wrong Cal-Links
| Status: | Resolved | Start date: | 2010-01-18 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | Spent time: | - | |
| Target version: | - | |||
| Votes: | 2 (View) |
Description
Hi everybody.
We use cal 1.4 and cooluri 1.0.19. Cal generates links like:
<a href="index.php?id=309& tx_cal_controller[view]=event& tx_cal_controller[type]=tx_cal_phpicalendar& tx_cal_controller[uid]=7& tx_cal_controller[year]=2010& tx_cal_controller[month]=01& tx_cal_controller[day]=19& tx_cal_controller[lastview]=view-list%7Cpage_id-142& cHash=0af902bd70681c58bb2530a69ead0c78" title="workshop" >19.01.2010 workshop</a>
which are working. Cooluri with no explicit configuration for cal builds the following for the same event-link:
<a href="unirz/calendar/singleevent? tx_cal_controller[view]=event& tx_cal_controller[type]=tx_cal_phpicalendar& tx_cal_controller[uid]=7& tx_cal_controller[year]=2010& tx_cal_controller[month]=01& tx_cal_controller[day]=19& tx_cal_controller[lastview]=view-list19.01.2010 workshoppage_id-142" title="workshop" >
The linktext is merged in the link and the a-tag is not closed. Maybe it's a problem with the 7C (pipe)?
History
Updated by Stano Paska over 3 years ago
Problem is in class.tx_cooluri.php in function params2cool.
There is a line
array_walk($pars,array($this,'array_urldecode'));
directly before converting pars into totalURL with $lt->params2cool.
Link parameters from cal has in one parameter | encoded as %7C and this is rawurldecoded into | and after $lt->params2cool it is leaved as is (|).
And this does problems while processing coolurilized link later in TS (wrapping with some text). Pipes in url are processed with stdWrap.
After $lt->params2cool it must be again rawurlencoded.
array_urldecode may be "raw", because in linkData all parameters are rawurlencoded.
Hope this help.
Updated by Jan Bednarik almost 2 years ago
- Status changed from New to Resolved
I think it's fixed. Please verify.
Updated by Martin Becker about 1 year ago
Sorry, but not resolved.
CoolURI 1.0.28 together with cal 1.4.3 still shows wrong behavior.
This is one of the produced links (title would be "Foobar"):<a href="aktuelles/termine/einzelansicht/87c4ff7172a0f2e78ff09b3988255d4b/?tx_cal_controller%5Bview%5D=event&tx_cal_controller%5Btype%5D=tx_cal_phpicalendar&tx_cal_controller%5Buid%5D=25&tx_cal_controller%5Blastview%5D=view-listFoobarpage_id-36&tx_cal_controller%5Byear%5D=2012&tx_cal_controller%5Bmonth%5D=03&tx_cal_controller%5Bday%5D=17" title="Foobar" class="url"></b><br />...
I'd say it's pretty annoying, since no titles are shown at all and with the unclosed <a>-tag everything gets linked...
Let me know if I can provide you with any more data.
Updated by Jan Bednarik about 1 year ago
- Status changed from Resolved to Needs Feedback
I believe that if you'd map all parameters it would solve the problem.
Besides, I don't see any problem in the URL, what do you think causes it?
I'm running cal extension on a site myself and there are no problems, so I don't know.
Updated by Martin Becker about 1 year ago
The URL in the link seems fine at first glance (look closer around "view-list"), but the HTML Tag is never closed and the content between opening and closing tags (i.e. my title "Foobar") does not get inserted. I think it is still the same issue with the pipe character.
Compare these:
correct (CoolURI deactivated):<a href="...?tx_cal_controller%5Bview%5D=event&tx_cal_controller%5Btype%5D=tx_cal_phpicalendar&tx_cal_controller%5Buid%5D=25&tx_cal_controller%5Blastview%5D=view-list%7Cpage_id-36&tx_cal_controller%5Byear%5D=2012&tx_cal_controller%5Bmonth%5D=03&tx_cal_controller%5Bday%5D=17&cHash=87c4ff7172a0f2e78ff09b3988255d4b" title="Foobar" class="url">Foobar</a></b><br />...
wrong:<a href="...?tx_cal_controller%5Bview%5D=event&tx_cal_controller%5Btype%5D=tx_cal_phpicalendar&tx_cal_controller%5Buid%5D=25&tx_cal_controller%5Blastview%5D=view-listFoobarpage_id-36&tx_cal_controller%5Byear%5D=2012&tx_cal_controller%5Bmonth%5D=03&tx_cal_controller%5Bday%5D=17" title="Foobar" class="url"></b><br />...
- note the <a>-tag gets never closed with CoolURI
- the ampersand gets NOT transformed into an HTML entity with CoolURI, which I think is correct though...
- "viewlist" should be followed by %7C (pipe), but CoolURI seems to turn it into a pipe character and subsequently cal does insert the link text "Foobar" to there
- Cal seems to expect exactly two pipe characters: the second one appears correctly in the "title"-attribute of the <a>-tag, so it gets replaced with "Foobar" correctly.
- Cal also seems to ignore any further pipe characters, leaving the <a>-tag open.
I tried to map the parts, but I can't see a way around, since the pipe is in the way. Can this be done with regexp somehow?
Nevertheless, even if such a mapping is possible, it should work out of the box with cal. But I have to say that the way cal is passing parameters is just ugly in this case...
Updated by Fabian Beiner about 1 year ago
I can confirm this problem. We're running CoolURI (v1.0.29) and Calendar Base (v1.4.2).
As already mentioned, the problem is the pipe ("|") in the "Result URL". This gets substituted with the link name - which breaks the output. Sadly, I couldn't find the place where the substitution is done. But there are two ways to fix this problem, both to be done in class.tx_cooluri.php.
First, and probably the best solution, is to replace line 269 with
$parts[1] = strtr($parts[1],array('['=>'%5B',']'=>'%5D','|'=>'%7C'));
Which replaces all the pipes with it's hexadecimal escape sequence (%7C) (just as it's already done for "[" and "]").
As I don't know (since I only tested it for around 2 minutes :)) if this breaks something else, you could also check if the link is actually a cal link. Easily done by adding
if (strstr($params['LD']['totalURL'], 'tx_cal_controller')) {
$params['LD']['totalURL'] = str_replace('|', '%7C', $params['LD']['totalURL']);
}
right before "t3lib_div::devLog('Result URL: '.$params['LD']['totalURL'],'CoolUri');" at around line 298.
Best,
Fabian
Updated by Martin Becker about 1 year ago
Meanwhile the workaround suggested here http://www.mail-archive.com/typo3-english@lists.netfielders.de/msg20094.html helps; I guess this is what Stano meant.
Cheers.
Updated by Jan Bednarik 2 months ago
Updated by Jan Bednarik 2 months ago
- Status changed from Needs Feedback to Resolved