X7 Chat Support Board
Welcome, Guest. Please login or register.
July 31, 2010, 07:25:15 PM

Login with username, password and session length
Search:     Advanced search
X7 Chat Version 3.0.0 Alpha 2 is now available (http://x7chat.com/support_forum/index.php?topic=3198.msg11497#new).
13036 Posts in 3760 Topics by 66531 Members
Latest Member: yurapro1982
* Home Help Search Login Register
+  X7 Chat Support Board
|-+  X7 Chat Development
| |-+  X7 Chat 3 Bug Reports
| | |-+  posting URLs in chat
« previous next »
Pages: [1] Reply Send this topic Print
Author Topic: posting URLs in chat  (Read 3171 times)
Charon
Member
*
Offline Offline

Posts: 28


View Profile
« on: February 09, 2008, 04:53:53 PM »
Reply with quote

when i try to post a URL in chat, as in http://www.someurl.com  i expect it to appear just like that and be clickable, so it opens in a new window.  That is what happens in Ver 2.05 and I like it that way....

In ver 3, this is what happens..... and the following is a cut and paste
[3:51:04] Charon: trying to post a clickable link
[3:51:15] Charon: $1$2

the actual text typed was http://www.someurl.com and it was converted to $1$2

Has anyone else reported this feature, and can it be addressed?

Thanks in advance.
Report to moderator   Logged
Ben2
Member
*
Offline Offline

Posts: 1


View Profile
« Reply #1 on: May 17, 2008, 08:58:57 PM »
Reply with quote

Yes I encountered the same problem. I set out to fix it. Here is a fix to your problem cheesy
Go into \themes\default\templates and edit tpl_chat.php
Go to around line 874.

The block of code that starts with:
   function write_message(INDATA){
      if(yourData['ignore'][INDATA['uid']]) return;

and ends with:

      INDATA['msg'] = INDATA['msg'].replace(/([A-z0-9_\-\.]+)@([A-z0-9\-\.]+)(?![^<>]*(>|<\/a>))/gi,"<a href=\"mailto: &dollar;1@&dollar;2\">&dollar;1@&dollar;2</a>");

Replace that entire code with this:
Code:
function write_message(INDATA){
if(yourData['ignore'][INDATA['uid']]) return;

INDATA['time'] = (yourData['settings']['show_timestamps']) ? '[' + gen_timestamp(INDATA['time']) + '] ' : '';

INDATA['msg'] = INDATA['msg'].replace(/</g,'&lt;');
INDATA['msg'] = INDATA['msg'].replace(/>/g,'&gt;');
INDATA['msg'] = INDATA['msg'].replace(/([^\/])www\./gi,'$1http://www.');
INDATA['msg'] = INDATA['msg'].replace(/\[url=(.+?)\](.+?)\[\/url\]/gi,"<a href='$1' target='_blank'>$2</a>");
INDATA['msg'] = INDATA['msg'].replace(/(http:\/\/|https:\/\/)([^ \[<]+)(?![^<>]*(>|<\/a>))/gi,"<a href=\"$1$2\" target=\"_blank\">$1$2</a>");
INDATA['msg'] = INDATA['msg'].replace(/&lt;br \/&gt;/g,"<br />");
INDATA['msg'] = INDATA['msg'].replace(/\\n/g,"<br />");
       
INDATA['msg'] = INDATA['msg'].replace(/([A-z0-9_\-\.]+)@([A-z0-9\-\.]+)(?![^<>]*(>|<\/a>))/gi,"<a href=\"mailto: $1@$2\">$1@$2</a>");

It's essentially changing '&dollar;' into an actual '$' sign.

I attached my copy of the file incase you mess up / don't understand what to do. (Don't forget to remove the .txt on the end of the file) cheesy
Report to moderator   Logged
Charon
Member
*
Offline Offline

Posts: 28


View Profile
« Reply #2 on: May 18, 2008, 12:24:02 AM »
Reply with quote

THANKS Ben2... it works well!!!
Report to moderator   Logged
Benjamin
Guest


Email
« Reply #3 on: July 01, 2008, 05:12:46 PM »
Reply with quote

Just wanted to say it worked for me too. Thanks! Smiley
Report to moderator   Logged
mawwad
Member
*
Offline Offline

Posts: 2


View Profile
« Reply #4 on: May 27, 2009, 11:04:37 AM »
Reply with quote

thanks a lot
Report to moderator   Logged
ghlad30
Member
*
Offline Offline

Posts: 1

garyhya09@gmail.com ghlad30 ghlad30
View Profile WWW Email
« Reply #5 on: February 27, 2010, 05:38:25 AM »
Reply with quote

its great that you posted it here, such a big help for me as well, thanks so much for the help, I've been experiencing also some errors and its good that everything is fine now..
Report to moderator   Logged
Terry G.
Member
*
Offline Offline

Posts: 2


View Profile Email
« Reply #6 on: March 16, 2010, 05:35:21 PM »
Reply with quote

this is what i get when posting a URL
</smilies/icon_aaarghgif"> href="http://www.left blank/indexhtml" t/smilies/icon_aaarghgif">rget="_bl/smilies/icon_aaarghgif">nk">http://www.left blank/indexhtml/smilies/icon_aaarghgif">>

BUT i dont have a \themes\default do have a \themes\templates but no "tpl_chat.php" any where  and i have 2.0.5.1

Report to moderator   Logged
Pages: [1] Reply Send this topic Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.064 seconds with 16 queries.