shout.php

Créé Le diff n'expire jamais
46 suppressions
528 lignes
52 ajouts
533 lignes
<?php
<?php


function ShoutBox($ShoutSubmit, $ShoutComment, $shoutuid) {
function ShoutBox($ShoutSubmit, $ShoutComment, $shoutuid) {


global $currentlang, $cache, $top_content, $mid_content, $bottom_content, $ShoutMarqueeheight, $nsnst_const, $userinfo, $prefix, $db, $top_out, $board_config;
global $currentlang, $cache, $top_content, $mid_content, $bottom_content, $ShoutMarqueeheight, $nsnst_const, $userinfo, $prefix, $top_out, $board_config;

if (!empty($currentlang)) {
if (!empty($currentlang)) {
include_once(NUKE_MODULES_DIR.'Shout_Box/lang-block/lang-'.$currentlang.'.php');
include_once(NUKE_MODULES_DIR.'Shout_Box/lang-block/lang-'.$currentlang.'.php');
} else {
} else {
include_once(NUKE_MODULES_DIR.'Shout_Box/lang-block/lang-english.php');
include_once(NUKE_MODULES_DIR.'Shout_Box/lang-block/lang-english.php');
}
}


$PreviousShoutComment = $ShoutComment;
$PreviousShoutComment = $ShoutComment;
$BannedShouter = '';
$BannedShouter = '';


$is_user = is_user();
$is_user = is_user();
$username = $userinfo['username'];
$username = $userinfo['username'];


if ((($conf = $cache->load('conf', 'shoutbox')) == false) || empty($conf)) {
if ((($conf = $cache->load('conf', 'shoutbox')) == false) || empty($conf)) {
$sql = "SELECT * FROM `".$prefix."_shoutbox_conf`";
$sql = "SELECT * FROM `".$prefix."_shoutbox_conf`";
$result = $db->sql_query($sql);
$result = dbquery($sql);
$conf = $db->sql_fetchrow($result);
$conf = dbrow($result);
$cache->save('conf', 'shoutbox', $conf);
$cache->save('conf', 'shoutbox', $conf);
$db->sql_freeresult($result);
dbfree($result);
}
}


if ((($nameblock = $cache->load('nameblock', 'shoutbox')) == false) || empty($nameblock)) {
if ((($nameblock = $cache->load('nameblock', 'shoutbox')) == false) || empty($nameblock)) {
$sql = "SELECT `name` FROM ".$prefix."_shoutbox_nameblock";
$sql = "SELECT `name` FROM ".$prefix."_shoutbox_nameblock";
$nameresult = $db->sql_query($sql);
$nameresult = dbquery($sql);
while ($row = $db->sql_fetchrow($nameresult)) {
while ($row = dbrow($nameresult)) {
$nameblock[] = $row;
$nameblock[] = $row;
}
}
$cache->save('nameblock', 'shoutbox', $nameblock);
$cache->save('nameblock', 'shoutbox', $nameblock);
$db->sql_freeresult($nameresult);
dbfree($nameresult);
}
}


if ((($censor = $cache->load('censor', 'shoutbox')) == false) || empty($censor)) {
if ((($censor = $cache->load('censor', 'shoutbox')) == false) || empty($censor)) {
$sql = "SELECT * FROM ".$prefix."_shoutbox_censor";
$sql = "SELECT * FROM ".$prefix."_shoutbox_censor";
$result = $db->sql_query($sql);
$result = dbquery($sql);
while ($row = $db->sql_fetchrow($result)) {
while ($row = dbrow($result)) {
$censor[] = $row;
$censor[] = $row;
}
}
$cache->save('censor', 'shoutbox', $censor);
$cache->save('censor', 'shoutbox', $censor);
$db->sql_freeresult($result);
dbfree($result);
}
}


// Check if block is in center position
// Check if block is in center position
$sql = "SELECT `bposition` FROM `".$prefix."_blocks` WHERE `blockfile`='block-Shout_Box.php'";
$sql = "SELECT `bposition` FROM `".$prefix."_blocks` WHERE `blockfile`='block-Shout_Box.php'";
$SBpos = $db->sql_query($sql);
$SBpos = dbquery($sql);
$SBpos = $db->sql_fetchrow($SBpos);
$SBpos = dbrow($SBpos);
if ($SBpos['bposition'] == 'c' || $SBpos['bposition'] == 'd') {
if ($SBpos['bposition'] == 'c' || $SBpos['bposition'] == 'd') {
$SBpos = 'center';
$SBpos = 'center';
$SBborder = 1;
$SBborder = 1;
} else {
} else {
$SBpos = 'side';
$SBpos = 'side';
$SBborder = 0;
$SBborder = 0;
}
}
$db->sql_freeresult($SBpos);
dbfree($SBpos);


if (isset($nsnst_const['remote_ip']) && !empty($nsnst_const['remote_ip'])) {
if (isset($nsnst_const['remote_ip']) && !empty($nsnst_const['remote_ip'])) {
$uip = $nsnst_const['remote_ip'];
$uip = $nsnst_const['remote_ip'];
} else {
} else {
$uip = '';
$uip = '';
}
}


//do IP test then ban if on list
//do IP test then ban if on list
if($conf['ipblock']== 'yes') {
if($conf['ipblock']== 'yes') {
$sql = "SELECT `name` FROM `".$prefix."_shoutbox_ipblock`";
$sql = "SELECT `name` FROM `".$prefix."_shoutbox_ipblock`";
$ipresult = $db->sql_query($sql);
$ipresult = dbquery($sql);
while ($badips = $db->sql_fetchrow($ipresult)) {
while ($badips = dbrow($ipresult)) {
if (preg_match("/\[\*\]/i", $badips['name'])) { // Allow for Subnet bans like 123.456.*
if (preg_match("/\[\*\]/i", $badips['name'])) { // Allow for Subnet bans like 123.456.*
$badipsArray = explode(".",$badips['name']);
$badipsArray = explode(".",$badips['name']);
$uipArray = explode(".",$uip);
$uipArray = explode(".",$uip);
$i = 0;
$i = 0;
if (is_array($badipsArray)) {
if (is_array($badipsArray)) {
foreach($badipsArray as $badipsPart) {
foreach($badipsArray as $badipsPart) {
if ($badipsPart == "*") {
if ($badipsPart == "*") {
$BannedShouter = "yes";
$BannedShouter = "yes";
break;
break;
}
}
if ($badipsPart != $uipArray[$i] && $badipsPart != "*") { break; }
if ($badipsPart != $uipArray[$i] && $badipsPart != "*") { break; }
$i++;
$i++;
}
}
}
}
} else {
} else {
if($uip == $badips['name']) {
if($uip == $badips['name']) {
$BannedShouter = "yes";
$BannedShouter = "yes";
break;
break;
}
}
}
}
}
}
$db->sql_freeresult($ipresult);
dbfree($ipresult);
}
}
//do name test then ban if on list (only applies to registered users)
//do name test then ban if on list (only applies to registered users)
if ($conf['nameblock']== 'yes' && $BannedShouter != "yes") {
if ($conf['nameblock']== 'yes' && $BannedShouter != "yes") {
if (is_array($nameblock)) {
if (is_array($nameblock)) {
foreach ($nameblock as $name) {
foreach ($nameblock as $name) {
if ($username == $name['name']) {
if ($username == $name['name']) {
$BannedShouter = "yes";
$BannedShouter = "yes";
break;
break;
}
}
}
}
}
}
}
}
if ($BannedShouter != "yes") {
if ($BannedShouter != "yes") {
if ($ShoutSubmit == "ShoutPost") {
if ($ShoutSubmit == "ShoutPost") {
// start processing shout
// start processing shout
if (isset($shoutuid) && !empty($shoutuid)) {
if (isset($shoutuid) && !empty($shoutuid)) {
$username = $shoutuid;
$username = $shoutuid;
}
}

// remove whitespace off ends of nickname
// remove whitespace off ends of nickname
$username = trim($username);
$username = trim($username);

if($conf['anonymouspost']== 'yes') {
if($conf['anonymouspost']== 'yes') {
$unum = strlen($username);
$unum = strlen($username);
if ($unum < 2) { $ShoutError = _NICKTOOSHORT; }
if ($unum < 2) { $ShoutError = _NICKTOOSHORT; }
if (!$username || $username == _NAME) { $ShoutError = _NONICK; }
if (!$username || $username == _NAME) { $ShoutError = _NONICK; }
if (preg_match("/\.xxx/i", $username) && $conf['blockxxx']== 'yes') { $username = "Anonymous"; }
if (preg_match("/\.xxx/i", $username) && $conf['blockxxx']== 'yes') { $username = "Anonymous"; }
if (preg_match("#javascript:(.*)#i", $username)) { $username = "Anonymous"; }
if (preg_match("#javascript:(.*)#i", $username)) { $username = "Anonymous"; }
$username = htmlspecialchars($username, ENT_QUOTES);
$username = htmlspecialchars($username, ENT_QUOTES);
$username = str_replace("&amp;amp;", "&amp;",$username);
$username = str_replace("&amp;amp;", "&amp;",$username);
}
}
if (!$is_user && !empty($username) && $username != "Anonymous") {
if (!$is_user && !empty($username) && $username != "Anonymous") {
$username = str_replace(" ", "_",$username);
$username = str_replace(" ", "_",$username);
}
}


$ShoutComment = trim($ShoutComment); // remove whitespace off ends of shout
$ShoutComment = trim($ShoutComment); // remove whitespace off ends of shout
$ShoutComment = preg_replace('/\s+/', ' ', $ShoutComment); // convert double spaces in middle of shout to single space
$ShoutComment = preg_replace('/\s+/', ' ', $ShoutComment); // convert double spaces in middle of shout to single space
$num = strlen($ShoutComment);
$num = strlen($ShoutComment);
if ($num < 1) { $ShoutError = _SHOUTTOOSHORT; }
if ($num < 1) { $ShoutError = _SHOUTTOOSHORT; }
if ($num > 2500) { $ShoutError = _SHOUTTOOLONG; }
if ($num > 2500) { $ShoutError = _SHOUTTOOLONG; }
if (!$ShoutComment) { $ShoutError = _NOSHOUT; }
if (!$ShoutComment) { $ShoutError = _NOSHOUT; }
if ($ShoutComment == _SB_MESSAGE) { $ShoutError = _NOSHOUT; }
if ($ShoutComment == _SB_MESSAGE) { $ShoutError = _NOSHOUT; }
$ShoutComment = str_replace(" [.] ", ".",$ShoutComment);
$ShoutComment = str_replace(" [.] ", ".",$ShoutComment);
if (preg_match("/\.xxx/i", $ShoutComment) && $conf['blockxxx']== 'yes') {
if (preg_match("/\.xxx/i", $ShoutComment) && $conf['blockxxx']== 'yes') {
$ShoutError = _XXXBLOCKED;
$ShoutError = _XXXBLOCKED;
$PreviousShoutComment = '';
$PreviousShoutComment = '';
}
}
if (preg_match("#javascript:(.*)#i", $ShoutComment)) {
if (preg_match("#javascript:(.*)#i", $ShoutComment)) {
$ShoutError = _JSINSHOUT;
$ShoutError = _JSINSHOUT;
$PreviousShoutComment = '';
$PreviousShoutComment = '';
}
}


$ShoutComment = htmlspecialchars($ShoutComment, ENT_QUOTES);
$ShoutComment = htmlspecialchars($ShoutComment, ENT_QUOTES);
$ShoutComment = str_replace("&amp;amp;", "&amp;",$ShoutComment);
$ShoutComment = str_replace("&amp;amp;", "&amp;",$ShoutComment);


// Scan for links in the shout. If there is, replace it with [URL] || block it if disallowed
// Scan for links in the shout. If there is, replace it with [URL] || block it if disallowed
$i = 0;
$i = 0;
$ShoutNew = '';
$ShoutNew = '';
$ShoutArray = explode(" ",$ShoutComment);
$ShoutArray = explode(" ",$ShoutComment);
if (is_array($ShoutArray)) {
if (is_array($ShoutArray)) {
foreach($ShoutArray as $ShoutPart) {
foreach($ShoutArray as $ShoutPart) {
if (is_array($ShoutPart)) { $ShoutPart = $ShoutPart[0]; }
if (is_array($ShoutPart)) { $ShoutPart = $ShoutPart[0]; }
if (preg_match("#http://#i", $ShoutPart)) {
if (preg_match("#http://#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
// fix for users adding text to the beginning of links: HACKhttp://www.website.com
// fix for users adding text to the beginning of links: HACKhttp://www.website.com
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"http://");
$spot = strpos($ShoutPartL,"http://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>&#93;";
} elseif (preg_match("#ftp://#i", $ShoutPart)) {
} elseif (preg_match("#ftp://#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"ftp://");
$spot = strpos($ShoutPartL,"ftp://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">FTP</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">FTP</a>&#93;";
} elseif (preg_match("#irc://#i", $ShoutPart)) {
} elseif (preg_match("#irc://#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"irc://");
$spot = strpos($ShoutPartL,"irc://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">IRC</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">IRC</a>&#93;";
} elseif (preg_match("#teamspeak://#i", $ShoutPart)) {
} elseif (preg_match("#teamspeak://#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"teamspeak://");
$spot = strpos($ShoutPartL,"teamspeak://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">TeamSpeak</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">TeamSpeak</a>&#93;";
} elseif (preg_match("#aim:goim#i", $ShoutPart)) {
} elseif (preg_match("#aim:goim#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"aim:goim");
$spot = strpos($ShoutPartL,"aim:goim");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">AIM</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">AIM</a>&#93;";
} elseif (preg_match("#gopher://#i", $ShoutPart)) {
} elseif (preg_match("#gopher://#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"gopher://");
$spot = strpos($ShoutPartL,"gopher://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">Gopher</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" href=\"$ShoutPart\">Gopher</a>&#93;";
} elseif (preg_match("#mailto:#i", $ShoutPart)) {
} elseif (preg_match("#mailto:#i", $ShoutPart)) {
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"mailto:");
$spot = strpos($ShoutPartL,"mailto:");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
// email encoding to stop harvesters
// email encoding to stop harvesters
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutNew[$i] = "&#91;<a href=\"$ShoutPart\">E-Mail</a>&#93;";
$ShoutNew[$i] = "&#91;<a href=\"$ShoutPart\">E-Mail</a>&#93;";
} elseif (preg_match("#www.#i", $ShoutPart)) {
} elseif (preg_match("#www.#i", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"www.");
$spot = strpos($ShoutPartL,"www.");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutPart = "http://" . $ShoutPart;
$ShoutPart = "http://" . $ShoutPart;
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>&#93;";
} elseif (preg_match('#@#i', $ShoutPart) && preg_match('/\[\.\]/i', $ShoutPart)) {
} elseif (preg_match('#@#i', $ShoutPart) && preg_match('/\[\.\]/i', $ShoutPart)) {
// email encoding to stop harvesters
// email encoding to stop harvesters
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutNew[$i] = "&#91;<a href=\"mailto:$ShoutPart\">E-Mail</a>&#93;";
$ShoutNew[$i] = "&#91;<a href=\"mailto:$ShoutPart\">E-Mail</a>&#93;";
} elseif ((preg_match("/\.(us|tv|cc|ws|ca|de|jp|ro|be|fm|ms|tc|ph|dk|st|ac|gs|vg|sh|kz|as|lt|to)/i", substr("$ShoutPart", -3,3))) || (preg_match("/\.(com|net|org|mil|gov|biz|pro|xxx)/i", substr("$ShoutPart", -4,4))) || (preg_match("/\.(info|name|mobi)/i", substr("$ShoutPart", -5,5))) || (preg_match("/\.(co\.uk|co\.za|co\.nz|co\.il)/i", substr("$ShoutPart", -6,6)))) {
} elseif ((preg_match("/\.(us|tv|cc|ws|ca|de|jp|ro|be|fm|ms|tc|ph|dk|st|ac|gs|vg|sh|kz|as|lt|to)/i", substr("$ShoutPart", -3,3))) || (preg_match("/\.(com|net|org|mil|gov|biz|pro|xxx)/i", substr("$ShoutPart", -4,4))) || (preg_match("/\.(info|name|mobi)/i", substr("$ShoutPart", -5,5))) || (preg_match("/\.(co\.uk|co\.za|co\.nz|co\.il)/i", substr("$ShoutPart", -6,6)))) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPart = "http://" . $ShoutPart;
$ShoutPart = "http://" . $ShoutPart;
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>&#93;";
$ShoutNew[$i] = "&#91;<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>&#93;";
} elseif (strlen(html_entity_decode($ShoutPart, ENT_QUOTES)) > 21) {
} elseif (strlen(html_entity_decode($ShoutPart, ENT_QUOTES)) > 21) {
$ShoutNew[$i] = htmlspecialchars(wordwrap(html_entity_decode($ShoutPart, ENT_QUOTES), 21, " ", 1), ENT_QUOTES);
$ShoutNew[$i] = htmlspecialchars(wordwrap(html_entity_decode($ShoutPart, ENT_QUOTES), 21, " ", 1), ENT_QUOTES);


$ShoutNew[$i] = str_replace("[ b]", " [b]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ b]", " [b]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[b ]", " [b]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[b ]", " [b]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /b]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /b]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ b]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ b]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/b ]", "[/b] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/b ]", "[/b] ",$ShoutNew[$i]);


$ShoutNew[$i] = str_replace("[ i]", " [i]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ i]", " [i]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[i ]", " [i]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[i ]", " [i]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /i]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /i]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ i]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ i]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/i ]", "[/i] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/i ]", "[/i] ",$ShoutNew[$i]);


$ShoutNew[$i] = str_replace("[ u]", " [u]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ u]", " [u]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[u ]", " [u]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[u ]", " [u]",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /u]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[ /u]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ u]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/ u]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/u ]", "[/u] ",$ShoutNew[$i]);
$ShoutNew[$i] = str_replace("[/u ]", "[/u] ",$ShoutNew[$i]);
} else { $ShoutNew[$i] = $ShoutPart; }
} else { $ShoutNew[$i] = $ShoutPart; }
$i++;
$i++;
}
}
}
}
if (empty($ShoutError)) { $ShoutComment = implode(" ",$ShoutNew); }
//if (empty($ShoutError)) { $ShoutComment = implode(" ",$ShoutNew); }


//Smilies from database
//Smilies from database
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayScan = $ShoutArrayReplace;
$ShoutArrayScan = $ShoutArrayReplace;
$sql = "SELECT `text`, `image` FROM `".$prefix."_shoutbox_emoticons`";
$sql = "SELECT `text`, `image` FROM `".$prefix."_shoutbox_emoticons`";
$eresult = $db->sql_query($sql);
$eresult = dbquery($sql);
while ($emoticons = $db->sql_fetchrow($eresult)) {
while ($emoticons = dbrow($eresult)) {
$i = 0;
$i = 0;
if (is_array($ShoutArrayScan)) {
if (is_array($ShoutArrayScan)) {
foreach($ShoutArrayScan as $ShoutPart) {
foreach($ShoutArrayScan as $ShoutPart) {
if ($ShoutPart == $emoticons['text']) { $ShoutArrayReplace[$i] = $emoticons['image']; }
if ($ShoutPart == $emoticons['text']) { $ShoutArrayReplace[$i] = $emoticons['image']; }
$i++;
$i++;
}
}
}
}
}
}
$db->sql_freeresult($eresult);
dbfree($eresult);
$ShoutComment = implode(" ",$ShoutArrayReplace);
$ShoutComment = implode(" ",$ShoutArrayReplace);


//do name test then error if on list
//do name test then error if on list
if($conf['nameblock']== 'yes') {
if($conf['nameblock']== 'yes') {
if (is_array($nameblock)) {
if (is_array($nameblock)) {
foreach ($nameblock as $name) {
foreach ($nameblock as $name) {
if($username == $name['name']) {
if($username == $name['name']) {
$ShoutError = _BANNEDNICK;
$ShoutError = _BANNEDNICK;
}
}
}
}
}
}
}
}


// check for anonymous users cloning/ghosting registered users' nicknames
// check for anonymous users cloning/ghosting registered users' nicknames
if (!is_user() && !empty($username) && $username != "Anonymous") {
if (!is_user() && !empty($username) && $username != "Anonymous") {
$sql = "SELECT `username` FROM `".$prefix."_users` WHERE `username`='$username'";
$sql = "SELECT `username` FROM `".$prefix."_users` WHERE `username`='$username'";
$nameresult = $db->sql_query($sql);
$nameresult = dbquery($sql);
if ($row = $db->sql_fetchrow($nameresult)) {
if ($row = dbrow($nameresult)) {
$ShoutError = _NOCLONINGNICKS;
$ShoutError = _NOCLONINGNICKS;
}
}
$db->sql_freeresult($nameresult);
dbfree($nameresult);
}
}


//look for bad words, then censor them.
//look for bad words, then censor them.
if($conf['censor']== 'yes') {
if($conf['censor']== 'yes') {
// start Anonymous nickname censor check here. If bad, replace bad nick with 'Anonymous'
// start Anonymous nickname censor check here. If bad, replace bad nick with 'Anonymous'
if (!$is_user && !empty($username) && $username != "Anonymous") {
if (!$is_user && !empty($username) && $username != "Anonymous") {
if (is_array($censor)) {
if (is_array($censor)) {
foreach ($censor as $word) {
foreach ($censor as $word) {
if ($username != 'Anonymous') {
if ($username != 'Anonymous') {
$one = strtolower($word['text']);
$one = strtolower($word['text']);
$usernameL = strtolower($username);
$usernameL = strtolower($username);
if (stristr($usernameL, $one) !== false) {
if (stristr($usernameL, $one) !== false) {
$username = "Anonymous";
$username = "Anonymous";
}
}
}
}
}
}
}
}
}
}
// Censor of posting text
// Censor of posting text
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayScan = $ShoutArrayReplace;
$ShoutArrayScan = $ShoutArrayReplace;
if (is_array($censor)) {
if (is_array($censor)) {
foreach ($censor as $word) {
foreach ($censor as $word) {
$i = 0;
$i = 0;
if (is_array($ShoutArrayScan)) {
if (is_array($ShoutArrayScan)) {
foreach($ShoutArrayScan as $ShoutPart) {
foreach($ShoutArrayScan as $ShoutPart) {
$ShoutPart = strtolower($ShoutPart);
$ShoutPart = strtolower($ShoutPart);
$censor['text'] = strtolower($word['text']);
$censor['text'] = strtolower($word['text']);
if ($ShoutPart == $word['text']) { $ShoutArrayReplace[$i] = $word['replacement']; }
if ($ShoutPart == $word['text']) { $ShoutArrayReplace[$i] = $word['replacement']; }
$i++;
$i++;
}
}
}
}
}
}
}
}
$ShoutComment = implode(" ",$ShoutArrayReplace);
$ShoutComment = implode(" ",$ShoutArrayReplace);


}
}


// duplicate posting checker. stops repeated spam attacks
// duplicate posting checker. stops repeated spam attacks
$sql = "SELECT `comment` FROM `".$prefix."_shoutbox_shouts` ORDER BY `id` DESC LIMIT 5";
$sql = "SELECT `comment` FROM `".$prefix."_shoutbox_shouts` ORDER BY `id` DESC LIMIT 5";
$result = $db->sql_query($sql);
$result = dbquery($sql);
while ($row = $db->sql_fetchrow($result)) {
while ($row = dbrow($result)) {
if ($row['comment'] == $ShoutComment) {
if ($row['comment'] == $ShoutComment) {
$ShoutError = _DUPLICATESHOUT;
$ShoutError = _DUPLICATESHOUT;
}
}
}
}
$db->sql_freeresult($result);
dbfree($result);


if ($conf['anonymouspost'] == 'no' && $username == 'Anonymous') {
if ($conf['anonymouspost'] == 'no' && $username == 'Anonymous') {
$ShoutError = _ONLYREGISTERED2;
$ShoutError = _ONLYREGISTERED2;
}
}


if (!$ShoutError) {
if (!$ShoutError) {


if ($is_user) {
if ($is_user) {
$day = EvoDate('d/m/Y', time(), $userinfo['user_timezone']);
$day = EvoDate('d/m/Y', time(), $userinfo['user_timezone']);
$time = EvoDate('H:i', time(), $userinfo['user_timezone']);
$time = EvoDate('H:i', time(), $userinfo['user_timezone']);
} else {
} else {
$day = EvoDate('d/m/Y', time(), $board_config['board_timezone']);
$day = EvoDate('d/m/Y', time(), $board_config['board_timezone']);
$time = EvoDate('H:i', time(), $board_config['board_timezone']);
$time = EvoDate('H:i', time(), $board_config['board_timezone']);
}
}


$currentTime = time();
$currentTime = time();


$sql = "INSERT INTO ".$prefix."_shoutbox_shouts (id,name,comment,date,time,ip,timestamp) VALUES ('0','$username','$ShoutComment','$day','$time','$uip','$currentTime')";
$sql = "INSERT INTO ".$prefix."_shoutbox_shouts (id,name,comment,date,time,ip,timestamp) VALUES ('0','$username','$ShoutComment','$day','$time','$uip','$currentTime')";
$db->sql_query($sql);
dbquery($sql);


$PreviousShoutComment = '';
$PreviousShoutComment = '';
$PreviousComment = '';
$PreviousComment = '';
} else {
} else {
if ($username != _NAME) {
if ($username != _NAME) {
$PreviousUsername = $username;
$PreviousUsername = $username;
}
}
if ($PreviousShoutComment != _SB_MESSAGE) {
if ($PreviousShoutComment != _SB_MESSAGE) {
$PreviousComment = $PreviousShoutComment;
$PreviousComment = $PreviousShoutComment;
}
}
}
}


}
}


//Display Content From here on down
//Display Content From here on down


if (!is_user() && !empty($username) && $username != "Anonymous") { $username = "Anonymous"; }
if (!is_user() && !empty($username) && $username != "Anonymous") { $username = "Anonymous"; }


$ThemeSel = get_theme();
$ThemeSel = get_theme();
$sql = "SELECT * FROM `".$prefix."_shoutbox_theme_images` WHERE `themeName`='$ThemeSel'";
$sql = "SELECT * FROM `".$prefix."_shoutbox_theme_images` WHERE `themeName`='$ThemeSel'";
$result = $db->sql_query($sql);
$result = dbquery($sql);
$themeRow = $db->sql_fetchrow($result);
$themeRow = dbrow($result);
$db->sql_freeresult($result);
dbfree($result);


if (!empty($themeRow['blockBackgroundImage']) && file_exists(NUKE_MODULES_DIR.'Shout_Box/images/background/'.$themeRow['blockBackgroundImage'])) {
if (!empty($themeRow['blockBackgroundImage']) && file_exists(NUKE_MODULES_DIR.'Shout_Box/images/background/'.$themeRow['blockBackgroundImage'])) {
$showBackground = 'yes';
$showBackground = 'yes';
} else {
} else {
$showBackground = 'no';
$showBackground = 'no';
}
}


if (!empty($themeRow['blockArrowColor'])) {
if (!empty($themeRow['blockArrowColor'])) {
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/up/'.$themeRow['blockArrowColor'])) {
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/up/'.$themeRow['blockArrowColor'])) {
$up_img = 'modules/Shout_Box/images/up/'.$themeRow['blockArrowColor'];
$up_img = 'modules/Shout_Box/images/up/'.$themeRow['blockArrowColor'];
} else {
} else {
$up_img = 'modules/Shout_Box/images/up/Black.gif';
$up_img = 'modules/Shout_Box/images/up/Black.gif';
}
}
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/down/'.$themeRow['blockArrowColor'])) {
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/down/'.$themeRow['blockArrowColor'])) {
$down_img = 'modules/Shout_Box/images/down/'.$themeRow['blockArrowColor'];
$down_img = 'modules/Shout_Box/images/down/'.$themeRow['blockArrowColor'];
} else {
} else {
$down_img = 'modules/Shout_Box/images/down/Black.gif';
$down_img = 'modules/Shout_Box/images/down/Black.gif';
}
}
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/pause/'.$themeRow['blockArrowColor'])) {
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/pause/'.$themeRow['blockArrowColor'])) {
$pause_img = 'modules/Shout_Box/images/pause/'.$themeRow['blockArrowColor'];
$pause_img = 'modules/Shout_Box/images/pause/'.$themeRow['blockArrowColor'];
} else {
} else {
$pause_img = 'modules/Shout_Box/images/pause/Black.gif';
$pause_img = 'modules/Shout_Box/images/pause/Black.gif';
}
}
} else {
} else {
$up_img = 'modules/Shout_Box/images/up/Black.gif';
$up_img = 'modules/Shout_Box/images/up/Black.gif';
$down_img = 'modules/Shout_Box/images/down/Black.gif';
$down_img = 'modules/Shout_Box/images/down/Black.gif';
$pause_img = 'modules/Shout_Box/images/pause/Black.gif';
$pause_img = 'modules/Shout_Box/images/pause/Black.gif';
}
}


$sql = "SELECT * FROM `".$prefix."_shoutbox_shouts` ORDER BY `id` DESC LIMIT $conf[number]";
$sql = "SELECT * FROM `".$prefix."_shoutbox_shouts` ORDER BY `id` DESC LIMIT $conf[number]";
$result = $db->sql_query($sql);
$result = dbquery($sql);




// Top half
// Top half


// shout error reporting
// shout error reporting
$top_content = '';
$top_content = '';
if (!empty($ShoutError)) {
if (!empty($ShoutError)) {
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td style=\"background-color: #FFFFE1;\"><strong>"._SB_NOTE.":</strong> $ShoutError</td></tr></table>";
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td style=\"background-color: #FFFFE1;\"><strong>"._SB_NOTE.":</strong> $ShoutError</td></tr></table>";
$top_out = "<td style=\"background-color: #FFFFE1;\"><strong>"._SB_NOTE.":</strong> $ShoutError</td>";
$top_out = "<td style=\"background-color: #FFFFE1;\"><strong>"._SB_NOTE.":</strong> $ShoutError</td>";
}
}


// table that holds the scrolling area
// table that holds the scrolling area
if ($showBackground == 'yes') {
if ($showBackground == 'yes') {
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"$SBborder\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: url(modules/Shout_Box/images/background/".$themeRow['blockBackgroundImage'].");\" height=\"".$conf['height']."\"><div id=\"shout_top\"></div>\n";
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"$SBborder\" cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"background: url(modules/Shout_Box/images/background/".$themeRow['blockBackgroundImage'].");\" height=\"".$conf['height']."\"><div id=\"shout_top\"></div>\n";
} else {
} else {
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"$SBborder\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"".$conf['height']."\"><div id=\"shout_top\"></div>\n";
$top_content .= "<table style=\"cursor: text;\" width=\"100%\" border=\"$SBborder\" cellspacing=\"0\" cellpadding=\"0\"><tr><td height=\"".$conf['height']."\"><div id=\"shout_top\"></div>\n";
}
}
// end top content
// end top content


// table of the actual scrolling content
// table of the actual scrolling content
if ($showBackground == 'yes') {
if ($showBackground == 'yes') {
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\">";
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\">";
} else {
} else {
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"2\">";
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"2\">";
}
}
$flag = 1;
$flag = 1;
$ThemeSel = get_theme();
$ThemeSel = get_theme();
$sql = "SELECT `blockColor1`, `blockColor2` FROM `".$prefix."_shoutbox_themes` WHERE `themeName`='$ThemeSel'";
$sql = "SELECT `blockColor1`, `blockColor2` FROM `".$prefix."_shoutbox_themes` WHERE `themeName`='$ThemeSel'";
$resultT = $db->sql_query($sql);
$resultT = dbquery($sql);
$rowColor = $db->sql_fetchrow($resultT);
$rowColor = dbrow($resultT);
$db->sql_freeresult($resultT);
dbfree($resultT);


// Sticky shouts
// Sticky shouts
$sql = "SELECT `comment`, `timestamp` FROM `".$prefix."_shoutbox_sticky` WHERE `stickySlot`=0";
$sql = "SELECT `comment`, `timestamp` FROM `".$prefix."_shoutbox_sticky` WHERE `stickySlot`=0";
$stickyResult = $db->sql_query($sql);
$stickyResult = dbquery($sql);
$stickyRow0 = $db->sql_fetchrow($stickyResult);
$stickyRow0 = dbrow($stickyResult);
$db->sql_freeresult($stickyResult);
dbfree($stickyResult);
$sql = "SELECT `comment`, `timestamp` FROM `".$prefix."_shoutbox_sticky` WHERE `stickySlot`=1";
$sql = "SELECT `comment`, `timestamp` FROM `".$prefix."_shoutbox_sticky` WHERE `stickySlot`=1";
$stickyResult = $db->sql_query($sql);
$stickyResult = dbquery($sql);
$stickyRow1 = $db->sql_fetchrow($stickyResult);
$stickyRow1 = dbrow($stickyResult);
$db->sql_freeresult($stickyResult);
dbfree($stickyResult);


if ($stickyRow0) {
if ($stickyRow0) {
if ($showBackground == 'yes') {
if ($showBackground == 'yes') {
$mid_content .= "<tr><td>";
$mid_content .= "<tr><td>";
} else {
} else {
if ($flag == 1) { $flag = 2; }
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
elseif ($flag == 2) { $flag = 1; }
$mid_content .= "<tr><td style=\"background-color: ".$rowColor['blockColor1'].";\">";
$mid_content .= "<tr><td style=\"background-color: ".$rowColor['blockColor1'].";\">";
}
}
$mid_content .= "<strong>"._SB_ADMIN.":</strong> ".$stickyRow0['comment'];
$mid_content .= "<strong>"._SB_ADMIN.":</strong> ".$stickyRow0['comment'];
if ($conf['date']== 'yes') {
if ($conf['date']== 'yes') {
if ($is_user) {
if ($is_user) {
$unixTime = EvoDate($userinfo['user_dateformat'], $stickyRow0['timestamp'], $userinfo['user_timezone']);
$unixTime = EvoDate($userinfo['user_dateformat'], $stickyRow0['timestamp'], $userinfo['user_timezone']);
$mid_content .= "<br />$unixTime";
$mid_content .= "<br />$unixTime";
} else {
} else {
$unixTime = EvoDate($board_config['default_dateformat'], $stickyRow0['timestamp'], $board_config['board_timezone']);
$unixTime = EvoDate($board_config['default_dateformat'], $stickyRow0['timestamp'], $board_config['board_timezone']);
$mid_content .= "<br />$unixTime";
$mid_content .= "<br />$unixTime";
}
}
}
}
$mid_content .= "</td></tr>";
$mid_content .= "</td></tr>";
}
}
if ($stickyRow1) {
if ($stickyRow1) {
if ($showBackground == 'yes') {
if ($showBackground == 'yes') {
$mid_content .= "<tr><td>";
$mid_content .= "<tr><td>";
} else {
} else {
if ($flag == 1) { $flag = 2; }
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
elseif ($flag == 2) { $flag = 1; }
$mid_content .= "<tr><td style=\"background-color: ".$rowColor['blockColor2'].";\">";
$mid_content .= "<tr><td style=\"background-color: ".$rowColor['blockColor2'].";\">";
}
}
$mid_content .= "<strong>"._SB_ADMIN.":</strong> ".$stickyRow1['comment'];
$mid_content .= "<strong>"._SB_ADMIN.":</strong> ".$stickyRow1['comment'];
if ($conf['date']== 'yes') {
if ($conf['date']== 'yes') {
if ($is_user) {
if ($is_user) {
$unixTime = EvoDate($userinfo['user_dateformat'], $stickyRow1['timestamp'], $userinfo['user_timezone']);
$unixTime = EvoDate($userinfo['user_dateformat'], $stickyRow1['timestamp'], $userinfo['user_timezone']);
$mid_content .= "<br />$unixTime";
$mid_content .= "<br />$unixTime";
} else {
} else {
$unixTime = EvoDate($board_config['default_dateformat'], $stickyRow1['timestamp'], $board_config['board_timezone']);
$unixTime = EvoDate($board_config['default_dateformat'], $stickyRow1['timestamp'], $board_config['board_timezone']);
$mid_content .= "<br />$unixDay&nbsp;$unixTime";
$mid_content .= "<br />$unixDay&nbsp;$unixTime";
}
}
}
}
$mid_content .= "</td></tr>";
$mid_content .= "</td></tr>";
}
}
// end sticky shouts
// end sticky shouts


$i = 0;
$i = 0;
while ($row = $db->sql_fetchrow($result)) {
while ($row = dbrow($result)) {
if ($flag == 1) { $bgcolor = $rowColor['blockColor1']; }
if ($flag == 1) { $bgcolor = $rowColor['blockColor1']; }
if ($flag == 2) { $bgcolor = $rowColor['blockColor2']; }
if ($flag == 2) { $bgcolor = $rowColor['blockColor2']; }
if ($showBackground == 'yes') {
if ($showBackground == 'yes') {
$tempContent[$i] = "<tr><td>";
$tempContent[$i] = "<tr><td>";
} else {
} else {
$tempContent[$i] = "<tr><td style=\"background-color: $bgcolor;\">";
$tempContent[$i] = "<tr><td style=\"background-color: $bgcolor;\">";
}
}
$ShoutComment = str_replace('src=', 'src="', $row['comment']);
$ShoutComment = str_replace('src=', 'src="', $row['comment']);
$ShoutComment = str_replace('.gif>', '.gif" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.gif>', '.gif" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.jpg>', '.jpg" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.jpg>', '.jpg" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.png>', '.png" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.png>', '.png" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.bmp>', '.bmp" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.bmp>', '.bmp" alt="" />', $ShoutComment);


// BB code [b]word[/b] [i]word[/i] [u]word[/u]
// BB code [b]word[/b] [i]word[/i] [u]word[/u]
if ((preg_match("/\[b\]/i", $ShoutComment)) && (preg_match("/\[\/b\]/i", $ShoutComment)) && (substr_count("$ShoutComment","[b]") == substr_count("$ShoutComment","[/b]"))) {
if ((preg_match("/\[b\]/i", $ShoutComment)) && (preg_match("/\[\/b\]/i", $ShoutComment)) && (substr_count("$ShoutComment","[b]") == substr_count("$ShoutComment","[/b]"))) {
$ShoutComment = preg_replace("/\[b\]/i","<span style=\"font-weight: bold\">","$ShoutComment");
$ShoutComment = preg_replace("/\[b\]/i","<span style=\"font-weight: bold\">","$ShoutComment");
$ShoutComment = preg_replace("/\[\/b\]/i","</span>","$ShoutComment");
$ShoutComment = preg_replace("/\[\/b\]/i","</span>","$ShoutComment");
}
}
if ((preg_match("/\[i\]/i", $ShoutComment)) && (preg_match("/\[\/i\]/i", $ShoutComment)) && (substr_count("$ShoutComment","[i]") == substr_count("$ShoutComment","[/i]"))) {
if ((preg_match("/\[i\]/i", $ShoutComment)) && (preg_match("/\[\/i\]/i", $ShoutComment)) && (substr_count("$ShoutComment","[i]") == substr_count("$ShoutComment","[/i]"))) {
$ShoutComment = preg_replace("/\[i\]/i","<span style=\"font-style: italic\">","$ShoutComment");
$ShoutComment = preg_replace("/\[i\]/i","<span style=\"font-style: italic\">","$ShoutComment");
$ShoutComment = preg_replace("/\[\/i\]/i","</span>","$ShoutComment");
$ShoutComment = preg_replace("/\[\/i\]/i","</span>","$ShoutComment");
}
}
if ((preg_match("/\[u\]/i", $ShoutComment)) && (preg_match("/\[\/u\]/i", $ShoutComment)) && (substr_count("$ShoutComment","[u]") == substr_count("$ShoutComment","[/u]"))) {
if ((preg_match("/\[u\]/i", $ShoutComment)) && (preg_match("/\[\/u\]/i", $ShoutComment)) && (substr_count("$ShoutComment","[u]") == substr_count("$ShoutComment","[/u]"))) {
$ShoutComment = preg_replace("/\[u\]/i","<span style=\"text-decoration: underline\">","$ShoutComment");
$ShoutComment = preg_replace("/\[u\]/i","<span style=\"text-decoration: underline\">","$ShoutComment");
$ShoutComment = preg_replace("/\[\/u\]/i","</span>","$ShoutComment");
$ShoutComment = preg_replace("/\[\/u\]/i","</span>","$ShoutComment");
}
}


if ($username == 'Anonymous') {
if ($username == 'Anonymous') {
/*****[BEGIN]******************************************
/*****[BEGIN]******************************************
[ Mod: Advanced Username Color v1.0.5 ]
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
******************************************************/
$tempContent[$i] .= "<strong>" . UsernameColor($row['name']) . ":</strong> $ShoutComment";
$tempContent[$i] .= "<strong>" . UsernameColor($row['name']) . ":</strong> $ShoutComment";
/*****[END]********************************************
/*****[END]********************************************
[ Mod: Advanced Username Color v1.0.5 ]
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
******************************************************/
}
}
else {
else {
// check to see if nickname is a user in the DB
// check to see if nickname is a user in the DB
$sqlN = "SELECT * FROM `".$prefix."_users` WHERE `username`='".$row['name']."'";
$sqlN = "SELECT * FROM `".$prefix."_users` WHERE `username`='".$row['name']."'";
$nameresultN = $db->sql_query($sqlN);
$nameresultN = dbquery($sqlN);
$rowN = $db->sql_fetchrow($nameresultN);
$rowN = dbrow($nameresultN);
$db->sql_freeresult($nameresultN);
dbfree($nameresultN);
if ($rowN && ($row['name'] != "Anonymous")) {
/*****[BEGIN]******************************************
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
$tempContent[$i] .= "<strong><a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$row[name]\">" . UsernameColor($row['name']) . "</a>:</strong> $ShoutComment";
/*****[END]*****