Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

MOD ShoutBox: Change URL in message

Asked Modified Viewed 6,493 times
Y
Yuras
Y
Yuras 10
RUSSIA forever!
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
asked
Newbie

To URL in ShoutBox automatically changed in reference and looked, for instance, so - [[url=pitomnik.com]URL[/url]]
1. Open file infusions/shoutbox_panel/shoutbox_panel.php

2. Search:
$shout_message = str_replace("\n", "<br>", $shout_message);


3. Add after:
   // Added by Yuras. Scan for links in the shout. If there is, replace it with [URL]
   $i = 0;
   $ShoutNew = '';
   $ShoutArray = explode(" ",$shout_message);
   foreach($ShoutArray as $ShoutPart) {
      $ShoutPart = str_replace("<br>", "", $ShoutPart);
      if (eregi("http:\/\/", $ShoutPart)) {
         // fix for users adding text to the beginning of links: HACKhttp://www.website.com
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"http://");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
      } elseif (eregi("ftp:\/\/", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"ftp://");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a target=\"_blank\" href=\"$ShoutPart\">FTP</a>]";
      } elseif (eregi("irc:\/\/", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"irc://");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a href=\"$ShoutPart\">IRC</a>]";
      } elseif (eregi("teamspeak:\/\/", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"teamspeak://");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a href=\"$ShoutPart\">TeamSpeak</a>]";
      } elseif (eregi("aim:goim", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"aim:goim");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a href=\"$ShoutPart\">AIM</a>]";
      } elseif (eregi("gopher:\/\/", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"gopher://");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a href=\"$ShoutPart\">Gopher</a>]";
      } elseif (eregi("mailto:", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"mailto:");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutNew[$i] = "[<a href=\"$ShoutPart\">E-Mail</a>]";
      } elseif (eregi("www\.", $ShoutPart)) {
         $ShoutPartL = strtolower($ShoutPart);
         $spot = strpos($ShoutPartL,"www.");
         if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
         $ShoutPart = "http://" . $ShoutPart;
         $ShoutNew[$i] = "[<a target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
      } elseif ((eregi("\.com", $ShoutPart)) OR (eregi("\.net", $ShoutPart)) OR (eregi("\.org", $ShoutPart)) OR (eregi("\.mil", $ShoutPart)) OR (eregi("\.gov", $ShoutPart)) OR (eregi("\.info", $ShoutPart)) OR (eregi("\.us", $ShoutPart)) OR (eregi("\.biz", $ShoutPart)) OR (eregi("\.tv", $ShoutPart)) OR (eregi("\.cc", $ShoutPart)) OR (eregi("\.ws", $ShoutPart)) OR (eregi("\.name", $ShoutPart)) OR (eregi("\.pro", $ShoutPart)) OR (eregi("\.co\.uk", $ShoutPart)) OR (eregi("\.ca", $ShoutPart)) OR (eregi("\.de", $ShoutPart)) OR (eregi("\.jp", $ShoutPart)) OR (eregi("\.ro", $ShoutPart)) OR (eregi("\.be", $ShoutPart)) OR (eregi("\.fm", $ShoutPart)) OR (eregi("\.ms", $ShoutPart)) OR (eregi("\.tc", $ShoutPart)) OR (eregi("\.co\.za", $ShoutPart)) OR (eregi("\.co\.nz", $ShoutPart)) OR (eregi("\.ph", $ShoutPart)) OR (eregi("\.dk", $ShoutPart)) OR (eregi("\.st", $ShoutPart)) OR (eregi("\.ac", $ShoutPart)) OR (eregi("\.gs", $ShoutPart)) OR (eregi("\.vg", $ShoutPart)) OR (eregi("\.sh", $ShoutPart)) OR (eregi("\.kz", $ShoutPart)) OR (eregi("\.as", $ShoutPart)) OR (eregi("\.lt", $ShoutPart)) OR (eregi("\.to", $ShoutPart)) OR (eregi("\.co\.il", $ShoutPart))) {
         $ShoutPart = "http://" . $ShoutPart;
         $ShoutNew[$i] = "[<a target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
      } elseif (strlen($ShoutPart) > 21) {
         $ShoutNew[$i] = wordwrap($ShoutPart, 21, " ", 1);
      } else { $ShoutNew[$i] = $ShoutPart; }
      $i++;
   }
   $shout_message = implode(" ",$ShoutNew);
// End 


Or simply change its file on attach to message file (is made with provision for Update before version 6.00.304).

Enjoy!
Edited by Yuras on 08-02-2006 17:54,
0 replies

17 posts

S
shedrock
S
phpfusion-themes.com/siriuslogo.jpg
  • Senior Member, joined since
  • Contributed 232 posts on the community forums.
  • Started 10 threads in the forums
answered
Senior Member

Totally awesome!!!!! - I can't tell you how long I've been waiting for someone to add this to the shoutbox. This is by far one of the best MODS I've seen so far. Thank you very much for this. :)

Shedrock
Edited by shedrock on 08-02-2006 03:30,
0 replies
Y
Yuras
Y
Yuras 10
RUSSIA forever!
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
answered
Newbie

shall rejoice if this code will is added in new versions PHPFusion :)

Excuse me for bad knowledge of english :(
0 replies
Y
Yuras
Y
Yuras 10
RUSSIA forever!
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
answered
Newbie

Discovered mistake, which transformed reference in such type - <a href=<br>http://blabla<br>blabla.co<br>m>URL</a>

It Is Corrected. Attach update. (begin topic)
0 replies
S
shedrock
S
phpfusion-themes.com/siriuslogo.jpg
  • Senior Member, joined since
  • Contributed 232 posts on the community forums.
  • Started 10 threads in the forums
answered
Senior Member

Thanks for the update and I agree. It should be added to the core.

Cheers!
Shedrock
0 replies
— 3 months later —
A
AzzX
A
AzzX 10
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 1 thread in the forums
answered
Junior Member

Thanks Yuras! You are a champ!

Is it ok If I change the [URL] with something like Link in say a blue color?
0 replies
A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

if only we wuldnt have to add http:// before the link, every member doesnt know that..

thanks for this great mod :)
0 replies
A
AzzX
A
AzzX 10
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 1 thread in the forums
answered
Junior Member

Works with v6.01.2 no probs :D
0 replies
— 4 months later —
A
Arda
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

FOUND A BUG
if we write the text and that has a starting like "com" "net" "org" etc. , it parses as url

for instance:
write i like my.computer
my.computer is parsed as url
my...computer, my.network, my.generation; all the same :(
Edited by Arda on 25-10-2006 10:54,
0 replies
E
eskindian
E
  • Junior Member, joined since
  • Contributed 22 posts on the community forums.
  • Started 7 threads in the forums
answered
Junior Member

I can't open a .rar file. Can you repost the corrected code?
0 replies
W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

E
eskindian
E
  • Junior Member, joined since
  • Contributed 22 posts on the community forums.
  • Started 7 threads in the forums
answered
Junior Member

cool. Thanks WEC. I was able to open up the file.

But...

There are some strange symbols in the code and I don't know why. They look like this:

Quote

if (iMEMBER || $settings['guestposts'] == "1"wink {
echo "<center><img src='".THEME."images/bullet.gif' alt=''> <a href='".INFUSIONS."shoutbox_panel/shoutboxchat.php' class='side'>Ëàéò-âåðñèÿ ÷àòà</a> <img src='".THEME."images/bulletb.gif' alt=''></center>\n";


What does "Ëàéò-âåðñèÿ ÷àòà" mean? Is the file corrupt?
Edited by eskindian on 06-11-2006 19:32,
0 replies
W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

It's a hardcoded Russian hyperlink name, probably as you see it in the screenshot above between >"#¤%&/<

Change it to whatever you like and see if you can find a proper english word for it once you get confirmed where it appears.
0 replies
E
eskindian
E
  • Junior Member, joined since
  • Contributed 22 posts on the community forums.
  • Started 7 threads in the forums
answered
Junior Member

After examining the code some more, I found where the fix was. It works now. I just added this line to the top of the original code above and it worked.

Quote

$shout_message = str_replace("\n", "<br>", $shout_message);


My bad, peeps.
Edited by eskindian on 06-11-2006 20:11,
0 replies
— 1 year later —
G
gencgonullu
G
  • Junior Member, joined since
  • Contributed 15 posts on the community forums.
  • Started 6 threads in the forums
answered
Junior Member

the thread was very old but, my problem with this mod is that it converts some irrelevant words sentence to [URL].
i couldnt find out exactly in what phrases does it make this error but, the irrelevant, not being a URL, words beginning ".de", and ".be" are phrased as URL.
how can i fix this?
actually, i think the correct way should be that the phrases that begin with "http://" or "www" are converted to URL.
how this is possible?
thnx.
0 replies
J
Josso
J
Josso 10
–––
Without faith, nothing is possible. With it, nothing is impossible
  • Senior Member, joined since
  • Contributed 309 posts on the community forums.
  • Started 1 thread in the forums
answered
Senior Member

Delete this, for not including words with domain endings. (.be, .com, etc.)

} elseif ((eregi("\.com", $ShoutPart)) OR (eregi("\.net", $ShoutPart)) OR (eregi("\.org", $ShoutPart)) OR (eregi("\.mil", $ShoutPart)) OR (eregi("\.gov", $ShoutPart)) OR (eregi("\.info", $ShoutPart)) OR (eregi("\.us", $ShoutPart)) OR (eregi("\.biz", $ShoutPart)) OR (eregi("\.tv", $ShoutPart)) OR (eregi("\.cc", $ShoutPart)) OR (eregi("\.ws", $ShoutPart)) OR (eregi("\.name", $ShoutPart)) OR (eregi("\.pro", $ShoutPart)) OR (eregi("\.co\.uk", $ShoutPart)) OR (eregi("\.ca", $ShoutPart)) OR (eregi("\.de", $ShoutPart)) OR (eregi("\.jp", $ShoutPart)) OR (eregi("\.ro", $ShoutPart)) OR (eregi("\.be", $ShoutPart)) OR (eregi("\.fm", $ShoutPart)) OR (eregi("\.ms", $ShoutPart)) OR (eregi("\.tc", $ShoutPart)) OR (eregi("\.co\.za", $ShoutPart)) OR (eregi("\.co\.nz", $ShoutPart)) OR (eregi("\.ph", $ShoutPart)) OR (eregi("\.dk", $ShoutPart)) OR (eregi("\.st", $ShoutPart)) OR (eregi("\.ac", $ShoutPart)) OR (eregi("\.gs", $ShoutPart)) OR (eregi("\.vg", $ShoutPart)) OR (eregi("\.sh", $ShoutPart)) OR (eregi("\.kz", $ShoutPart)) OR (eregi("\.as", $ShoutPart)) OR (eregi("\.lt", $ShoutPart)) OR (eregi("\.to", $ShoutPart)) OR (eregi("\.co\.il", $ShoutPart))) {
         $ShoutPart = "http://" . $ShoutPart;
         $ShoutNew[$i] = "[<a target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
0 replies
G
gencgonullu
G
  • Junior Member, joined since
  • Contributed 15 posts on the community forums.
  • Started 6 threads in the forums
answered
Junior Member

ok. but that itself ddnt solve the problem. but i solved it. u should modify infusions/shoutbox_panel/post.php also in that way.
thanx anyway.
0 replies
W
Wooya
W
Wooya 10
PHP-Fusion DEV Team
It's not a bug, it's undocumented feature...
  • Senior Member, joined since
  • Contributed 205 posts on the community forums.
  • Started 11 threads in the forums
answered
Senior Member

Oki, nice... But it can be done much easier with regexp like in autolink bbcode ;) [autolink not supports irc, gopher etc but can be easy added]
0 replies

Category Forum

General Discussion

Labels

None yet

Statistics

  • Views 0 views
  • Posts 17 posts
  • Votes 0 votes
  • Topic users 9 members

9 participants

S
S
phpfusion-themes.com/siriuslogo.jpg
  • Senior Member, joined since
  • Contributed 232 posts on the community forums.
  • Started 10 threads in the forums
W
W
Wooya 10
PHP-Fusion DEV Team
It's not a bug, it's undocumented feature...
  • Senior Member, joined since
  • Contributed 205 posts on the community forums.
  • Started 11 threads in the forums
W
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
Y
Y
Yuras 10
RUSSIA forever!
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
A
A
AzzX 10
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 1 thread in the forums
E
E
  • Junior Member, joined since
  • Contributed 22 posts on the community forums.
  • Started 7 threads in the forums
A
A
Arda 10
  • Member, joined since
  • Contributed 150 posts on the community forums.
  • Started 11 threads in the forums
J
J
Josso 10
–––
Without faith, nothing is possible. With it, nothing is impossible
  • Senior Member, joined since
  • Contributed 309 posts on the community forums.
  • Started 1 thread in the forums
G
G
  • Junior Member, joined since
  • Contributed 15 posts on the community forums.
  • Started 6 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet