Author |
Topic |
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 10 November 2005 : 05:15:14
|
Hm.. could you post your original thruncstring? Mine is much longer than your new one =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 10 November 2005 : 06:09:36
|
The two functions at the bottom of inc_func_common.asp:
<script language="javascript1.2" runat="server">
function truncString(sOutput, sOutput2,aLength, bLength) {
if (sOutput2.length > (aLength+bLength+3)) {
aString = sOutput2.substring(0, aLength);
bString = sOutput2.substring(sOutput2.length-bLength, sOutput2.length);
sOutput = "<a href=\""+sOutput+"\" target=\"_blank\">"+aString+"..."+bString+"</a>"
}
else
{
sOutput = "<a href=\""+sOutput+"\" target=\"_blank\">"+sOutput2+"</a>"
}
return sOutput;
}
function edit_hrefs(sURL, iType) {
sOutput = new String(sURL);
if (iType == 1) {
sOutput = sOutput.replace(/\b(http\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
function($1) { return truncString($1, $1, 30, 8); });
} else if (iType == 2) {
sOutput = sOutput.replace(/\b(https\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
function($1) { return truncString($1, $1, 30, 8); });
} else if (iType == 3) {
sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
function($1) { return truncString("http://"+$1,$1, 30, 8); });
} else if (iType == 4) {
sOutput = sOutput.replace(/\b([\w+\-\'\#\%\.\_\,\$\!\+\*]+@[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+\.[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+)/gi,
"<a href=\"mailto\:$1\">$1<\/a>");
} else if (iType == 5) {
sOutput = sOutput.replace(/\b(ftp\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
function($1) { return truncString($1, $1, 30, 8); });
} else if (iType == 6) {
sOutput = sOutput.replace(/\b(file\:\/\/\/[\w+\:\/\\]+[\w+\/\w+\.\:\/\\\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
function($1) { return truncString($1, $1, 30, 8); });
}
return sOutput;
}
</script> < |
portfolio - linkshrinker - oxle - twitter |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 10 November 2005 : 06:23:38
|
Okay! now go get your collegue so he can solve this ;) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 10 November 2005 : 07:55:57
|
Done some more investigation. I think I know what's happening:
[url]http://www.lasttest.com[/url] [url]http://www.thislinkisbig.com/bigeyornot.com/blablaww[/url]
creates this HTML code:
<a href="http://www.lasttest.com" target="_blank"><a href="http://www.lasttest.com" target="_blank">http://www.lasttest.com</a></a><br />
<a href="http://www.thislinkisbig.com/bigeyornot.com/blablaww" target="_blank"><a href="http://www.thislinkisbig.com/b...blablaww" target="_blank">http://www.thislinkisbig.com/b...blablaww</a></a>
In other words, the urls are parsed through the function twice....< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 10 November 2005 07:57:11 |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 10 November 2005 : 08:25:01
|
Sorry for the absence, emergency at work.
Marcel, what it looks like is happening there is that the link gets passed through the ReplaceURLs function when using the [url] tag, constructing the anchor tag and truncating the display text, if need be. Then, for some reason, that outputted code is being picked up by the chkURLs function and tries to pass both ocurrences of the URI through edit_hrefs.
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 10 November 2005 : 08:26:11
|
hmm... now let's just find out here =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 10 November 2005 : 09:14:27
|
quote: Originally posted by Shaggy
Sorry for the absence, emergency at work.
Marcel, what it looks like is happening there is that the link gets passed through the ReplaceURLs function when using the [url] tag, constructing the anchor tag and truncating the display text, if need be. Then, for some reason, that outputted code is being picked up by the chkURLs function and tries to pass both ocurrences of the URI through edit_hrefs.
No apologies necessary ! I know what you mean
I have the same idea....still a bit boggled by the ReplaceURLs function....I think we need to do some modifaction there...< |
portfolio - linkshrinker - oxle - twitter |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 10 November 2005 : 09:16:38
|
You guys have to look over your priorities... ;) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 10 November 2005 : 18:41:43
|
guys, the bug we're experiencing is not a side effect of this mod ; it's in the basecode for some time already, even here at Snitz. Have a look at this topic: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=60139 Quote it to see which forumcode I used for which URL. Then, have a look at the output HTML...
I've filed a bugreport in the dev section for this.< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 10 November 2005 18:42:32 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 11 November 2005 : 03:10:10
|
I hope HuwR's answer can help =) Wouldn't it be possible to redirect these urls so it's not parsed twice? < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 11 November 2005 : 06:03:33
|
Wohoo! Nice work (I hope.. ;)) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 11 November 2005 : 06:31:01
|
Good man, Marcel That was going to be my next suggestion; beat me to it.
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 11 November 2005 : 07:25:41
|
Well, I guess we just have to wait untill we hear about the final bugfix for Snitz, to assure that our nifty mod is compatible with basecode snitz.< |
portfolio - linkshrinker - oxle - twitter |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
Topic |
|