Author |
Topic |
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 20 February 2003 : 02:22:27
|
problem is discussed in this topic: using - on a url
here is the fix:
in the edit_hrefs function (at the bottom of inc_func_common.asp) find this section:
} else if (iType == 3) {
sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"http://$1\" target=\"_blank\">$1<\/a>"); and replace it with this: } else if (iType == 3) {
sOutput = sOutput.replace(/\b(www\-\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"http://$1\" target=\"_blank\">$1<\/a>"); |
|
Deleted
deleted
4116 Posts |
Posted - 20 February 2003 : 02:50:36
|
Fixed in v4b04 alpha 03
|
Stop the WAR! |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 20 February 2003 : 08:27:30
|
Richard, could you explain the change you made? Does the change you made look for the - before the www? |
Support Snitz Forums
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 20 February 2003 : 08:47:50
|
quote: Originally posted by Davio
Richard, could you explain the change you made? Does the change you made look for the - before the www?
it looks for it before the first period, it can be before or after the www |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 21 February 2003 : 22:24:53
|
yes, I did make the change here. Seems the only thing this change did is to block the code that parses URLs that start with just www (no http:// etc...)
so, I am going to recommend that the above change NOT be made, and anyone who has already changed it, to change it back to the original state.
Everytime we start messing around with the code that parses URLs, something gets broken. Sometimes I think we should just make it mandatory to place tags around all URLs.
For the specific situation posted in this topic: using - on a url the following change should rectify it:
on line #73 of inc_func_common.asp find the following:
(UCase(Right(strArray(Counter-1), 5)) <> "SRC=""") and _ and insert the following lines of code just below it (on line #74)
(UCase(Right(strArray(Counter-1), 1)) <> "-") and _
(UCase(Right(strArray(Counter-1), 1)) <> "=") and _ the second line (testing for an equals sign) will allow urls such as this:
http://www.yoursite.com/refer.asp?refer=www.yahoo.com |
|
|
Deleted
deleted
4116 Posts |
Posted - 22 February 2003 : 01:48:08
|
The possibilities make it virtually impossible to be covered by a single regexp. Without re-writing the complete logic we will not be able to expand it.
Your suggested change searched for "www-." at the start to recognize it as a url, instead of "www."... This is type 3 detection, so the string does not have a protocol header.
A more general one could be:
sOutput = sOutput.replace(/\b([a-zA-Z0-9\-^.]*www[a-zA-Z0-9\-^.]*\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi, "<a href=\"http://$1\" target=\"_blank\">$1<\/a>");
and changing the
fString = ChkURLs(fString, "www.", 3)
to
fString = ChkURLs(fString, "www", 3)
It fully detects (tested): www.mysite.com www1.mysite.com www-1.mysite.com
But not: e-www.mysite.com => detected as e-www.mysite.com e-www-1.mysite.com => detected as e-www-1.mysite.com [edit]moved this here[/edit]
It does not test "e-www" because the code in ChkURLs uses the split function to handle it. The "e-" part is left in the previous array element. It can only be detected by changing the split logic IMHO. Therefore the red part marked above is no use as of now.
|
Stop the WAR! |
Edited by - Deleted on 22 February 2003 02:24:38 |
|
|
GauravBhabu
Advanced Member
4288 Posts |
|
Grandmaster
Starting Member
Brazil
46 Posts |
Posted - 24 February 2003 : 10:23:46
|
I got a little confused now. :)
What change(s) should I do to my file(s)? |
-- Renato "Grandmaster" CobiT Foundation 4.1 Certified ID: 90391725 http://www.renato.henriques.nom.br
|
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 24 February 2003 : 11:52:34
|
Are you having a problem with urls in your forum? If not, you don't need to make any change.
This bug is still being worked on, as far as I can see. Would need to remove the "FIX" from the title if we haven't found one that will work. |
Support Snitz Forums
|
|
|
Deleted
deleted
4116 Posts |
Posted - 24 February 2003 : 18:04:06
|
Davio, that would be fine. Perhaps moving this into dev-discussions is a better solution...
|
Stop the WAR! |
|
|
throwithere
Starting Member
10 Posts |
Posted - 28 February 2003 : 03:50:50
|
where exactly does the code for parsing urls with tags are? the javascript function edit_hrefs() doesn't seem to be working and i haven't changed anything yet. i have traced that messages with tags go to edit_hrefs() but it doesn't seem to do anything to the message.
please help. |
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 13 March 2003 : 00:16:47
|
What's the final census on this? Should we go with Richard's or GB's solution? GB's solution uses regular expression, which I believe you need to have the latest version of the scripting engine. |
Support Snitz Forums
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Topic |
|