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

URLs with special characters

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

Post a reply
5 posts • Page 1 of 1

Postby SSamiK » Thu Jan 27, 2011 8:39 pm

When passing a URL containing special characters (as ! ) in a chat window the url is not clickable. For example: http://www.facebook.com/home.php#!/vide ... 3655742042 is cut after the #! .

Anyone have a quick fix?
Last edited by SSamiK on Thu Jan 27, 2011 8:41 pm, edited 1 time in total.
SSamiK
Member
 
Posts: 14
Joined: Thu Dec 09, 2010 12:24 am
Top

Postby re*s.t.a.r.s.*2 » Fri Jan 28, 2011 1:49 am

Ok,

this worked in my local installation PFC 1.3:

in "/src/pfcurlprocessing.php"

Look for the function function pfc_make_hyperlink($text)
would be line 18 to 55

Copy that below:
Code: Select all
function pfc_make_hyperlink($text)
{
  $c =& pfcGlobalConfig::Instance();
  $openlinknewwindow = $c->openlinknewwindow;

  if ($openlinknewwindow)
    $target = " onclick="window.open(this.href,\'_blank\');return false;"";
  else
    $target = "";
 
  $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\1:", $text);

  // pad it with a space so we can match things at the start of the 1st line.
  $ret = ' ' . $text;

  // matches an "xxxx://yyyy" URL at the start of a line, or after a space.
  // xxxx can only be alpha characters.
  // yyyy is anything up to the first space, newline, comma, double quote or <
  //$ret = preg_replace("#(^|[n ])([w]+?://[w#$%&~/.-;:=,?@[]+]*)#is", "\1<a href="\2" target="_blank">\2</a>", $ret);
  $ret = preg_replace("#(^|[n ]])([w]+?://[w#$%&~/!.-;:=,?@+]*)#ise", "'\1<a href="\2"" . $target . ">' . pfc_shorten_url('\2') . '</a>'", $ret);

  // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
  // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
  // zzzz is optional.. will contain everything up to the first space, newline,
  // comma, double quote or <.
  //$ret = preg_replace("#(^|[n ])((www|ftp).[w#$%&~/.-;:=,?@[]+]*)#is", "\1<a href="http://\2" target="_blank">\2</a>", $ret);
  $ret = preg_replace("#(^|[n ]])((www|ftp).[w#$%&~/.-;:=,?@+]*)#ise", "'\1<a href="http://\2"" . $target . ">' . pfc_shorten_url('\2') . '</a>'", $ret);

  // matches an email@domain type address at the start of a line, or after a space.
  // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
  //$ret = preg_replace("#(^|[n ])([a-z0-9&-_.]+?)@([w-]+.([w-.]+.)*[w]+)#i", "\1<a href="mailto:\2@\3">\2@\3</a>", $ret);
  $ret = preg_replace("#(^|[n ]])([a-z0-9&-_.]+?)@([w-]+.([w-.]+.)*[w]+)#ie", "'\1<a href="mailto:\2@\3">' . pfc_shorten_url('\2@\3') . '</a>'", $ret);

  // Remove our padding..
  $ret = substr($ret, 1);

  return($ret);
}

Copy paste the whole function..
Hope this helps.. dont forget to "/rehash".
Last edited by re*s.t.a.r.s.*2 on Wed Feb 09, 2011 6:31 am, edited 1 time in total.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby SSamiK » Wed Feb 09, 2011 2:09 am

I do not have a /src/pfcprocessing.php, but a /src/pfcurlprocessing.php. I did your edit, and rehased, but no change in url processing. :/ Thanks for your effort though.
SSamiK
Member
 
Posts: 14
Joined: Thu Dec 09, 2010 12:24 am
Top

Postby re*s.t.a.r.s.*2 » Wed Feb 09, 2011 6:37 am

thanks for pointing out the php document name was mistyped, I just copy pasted the function again and it works for me, not sure why is not for you..

regards
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby SSamiK » Wed Feb 09, 2011 11:19 am

You know what? You are right. The example link I gave in OP, does indeed work now. My bad for not using the same link to check.

Still having some issues with some of the "norwegian" characters though.. ( ø æ å ) Like in this link: www.helt-ælj.no
SSamiK
Member
 
Posts: 14
Joined: Thu Dec 09, 2010 12:24 am
Top


Post a reply
5 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 4 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