• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

convert links and emails

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
4 posts • Page 1 of 1

Postby white_devil » Sat Jun 16, 2007 6:26 pm

Hello,

I know that phpFreeChat convert links automaticly, but only nicks starting with http:// so if i type "www.mypage.com" it doesnt work (at least for me didnt work hehe) so i made a modification to convert the words started by www. into http://www. so the chat script can convert them to clickable links, and i have added the email convertion too, so if i type my_email@server.com it will convert it to mailto:my_email@server.com

hope you guys like it.

Ok, it will be all in the file "/src/commands/send.class.php"

Code: Select all
line 4, after the "require_once.." and before the "class ..." add this function:

function convertLinks($text) {
      if(substr($text,0,4) == 'www.')
            {$text = str_replace($text,' '.$text, $text);}

       $text = eregi_replace('([[:space:]()(>)[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)','\1http://\2', $text);
       $text = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})','<a href="mailto:\1">\1</a>', $text);
       return $text;
}

//-----------------------------------

//----------------------------------
line 70, replace:
  $msgid = $ct->write($recipient, $nick, "send", $text);

with:
  $text = convertLinks($text);
  $msgid = $ct->write($recipient, $nick, "send", $text);
//--------------------------------

That should work ok, it does for me, and i havent found any bug yet so i think it must work with you too, i know is kind of simple but it works!! :D

Hope you like it.
Last edited by white_devil on Sat Jun 16, 2007 6:27 pm, edited 1 time in total.
white_devil
Member
 
Posts: 12
Joined: Wed Jun 13, 2007 5:06 am
Location: Dominican Republic
  • Website
Top

Postby spoonfed » Wed Jul 18, 2007 1:13 pm

thanks, i'll give this a try :)
spoonfed
Member
 
Posts: 10
Joined: Wed Jul 18, 2007 12:56 pm
Top

Postby machadoug » Wed Oct 31, 2007 4:25 pm

I didn't work for me!

for some reason when a URL is typed it does not show in container. Even if it is typed with the http://www. part.

I don't get any error message at all...

Can someone help me?

Does anyone can give me a tip on where to fix this?

Regards,
Last edited by machadoug on Wed Oct 31, 2007 4:55 pm, edited 1 time in total.
Douglas de Senne Machado
http://invest.fok.com.br
http://joomla.focalizaisso.com.br
machadoug
New member
 
Posts: 8
Joined: Fri Oct 19, 2007 9:17 pm
Location: Joinville - SC - Brazil
  • Website
Top

Postby King Moonraiser » Fri Nov 02, 2007 2:22 am

I'm not sure, but I believe his patch for for the older beta versions of phpfreechat. I had rewritten the code to do what he was asking and more.

If your links are not showing up, it's possible that it's due to a security module on your host's web server.

Put this in your .htaccess file:

Code: Select all
<IfModule mod_security.c>
  <Files index.php>
   SecFilterInheritance Off
  </Files>
</IfModule>
King Moonraiser
Member
 
Posts: 98
Joined: Fri Jun 22, 2007 9:42 pm
  • Website
Top


Post a reply
4 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 14 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub