$shout_message = str_replace("\n", "<br>", $shout_message);
// 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
Quote
if (iMEMBER || $settings['guestposts'] == "1" {
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";
Quote
$shout_message = str_replace("\n", "<br>", $shout_message);
} 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>]";
Category Forum
General DiscussionLabels
None yet
Statistics
9 participants
Notifications
You are not receiving notifications from this thread.
Related Questions