Code:<?php
function shout_create_date($format, $gmepoch, $tz)
{
global $board_config, $lang, $userdata, $pc_dateTime;
static $translate;
if (!defined('ANONYMOUS')) {
define('ANONYMOUS', 1);
define('MANUAL', 0);
define('MANUAL_DST', 1);
define('SERVER_SWITCH', 2);
define('FULL_SERVER', 3);
define('SERVER_PC', 4);
define('FULL_PC', 6);
}
if ( empty($translate) && $board_config['default_lang'] != 'english' && is_array($lang['datetime']))
{
@reset($lang['datetime']);
while ( list($match, $replace) = @each($lang['datetime']) )
{
$translate[$match] = $replace;
}
}
if ( $userdata['user_id'] != ANONYMOUS ) {
switch ( $userdata['user_time_mode'] ) {
case MANUAL_DST:
$dst_sec = $userdata['user_dst_time_lag'] * 60;
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec), $translate) : @gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec);
break;
case SERVER_SWITCH:
$dst_sec = date('I', $gmepoch) * $userdata['user_dst_time_lag'] * 60;
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec), $translate) : @gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec);
break;
case FULL_SERVER:
return ( !empty($translate) ) ? strtr(@date($format, $gmepoch), $translate) : @date($format, $gmepoch);
break;
case SERVER_PC:
if ( isset($pc_dateTime['pc_timezoneOffset']) )
{
$tzo_sec = $pc_dateTime['pc_timezoneOffset'];
} else
{
$user_pc_timeOffsets = explode("/", $userdata['user_pc_timeOffsets']);
$tzo_sec = $user_pc_timeOffsets[0];
}
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + $tzo_sec), $translate) : @gmdate($format, $gmepoch + $tzo_sec);
break;
case FULL_PC:
if ( isset($pc_dateTime['pc_timeOffset']) )
{
$tzo_sec = $pc_dateTime['pc_timeOffset'];
} else
{
$user_pc_timeOffsets = explode("/", $userdata['user_pc_timeOffsets']);
$tzo_sec = (isset($user_pc_timeOffsets[1])) ? $user_pc_timeOffsets[1] : '';
}
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + $tzo_sec), $translate) : @gmdate($format, $gmepoch + $tzo_sec);
break;
default:
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
break;
}
} else {
switch ( $board_config['default_time_mode'] )
{
case MANUAL_DST:
$dst_sec = $board_config['default_dst_time_lag'] * 60;
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec), $translate) : @gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec);
break;
case SERVER_SWITCH:
$dst_sec = date('I', $gmepoch) * $board_config['default_dst_time_lag'] * 60;
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec), $translate) : @gmdate($format, $gmepoch + (3600 * $tz) + $dst_sec);
break;
case FULL_SERVER:
return ( !empty($translate) ) ? strtr(@date($format, $gmepoch), $translate) : @date($format, $gmepoch);
break;
case SERVER_PC:
if ( isset($pc_dateTime['pc_timezoneOffset']) )
{
$tzo_sec = $pc_dateTime['pc_timezoneOffset'];
} else
{
$tzo_sec = 0;
}
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + $tzo_sec), $translate) : @gmdate($format, $gmepoch + $tzo_sec);
break;
case FULL_PC:
if ( isset($pc_dateTime['pc_timeOffset']) )
{
$tzo_sec = $pc_dateTime['pc_timeOffset'];
} else {
$tzo_sec = 0;
}
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + $tzo_sec), $translate) : @gmdate($format, $gmepoch + $tzo_sec);
break;
default:
return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
break;
}
}
}
function ShoutBox($ShoutSubmit, $ShoutComment, $shoutuid) {
global $currentlang, $cache, $top_content, $mid_content, $bottom_content, $ShoutMarqueeheight, $nsnst_const, $userinfo, $prefix, $db, $top_out, $board_config;
if ((is_admin()) && defined('ADMIN_FILE')) {
$preURL = 'index.php?url=';
} else {
$preURL = '';
}
if (!empty($currentlang)) {
include_once(NUKE_MODULES_DIR.'Shout_Box/lang-block/lang-'.$currentlang.'.php');
} else {
include_once(NUKE_MODULES_DIR.'Shout_Box/lang-block/lang-english.php');
}
$PreviousShoutComment = $ShoutComment;
$BannedShouter = '';
$is_user = is_user();
$username = $userinfo['username'];
if ((($conf = $cache->load('conf', 'shoutbox')) == false) || empty($conf)) {
$sql = "SELECT * FROM `".$prefix."_shoutbox_conf`";
$result = $db->sql_query($sql);
$conf = $db->sql_fetchrow($result);
$cache->save('conf', 'shoutbox', $conf);
$db->sql_freeresult($result);
}
if ((($nameblock = $cache->load('nameblock', 'shoutbox')) == false) || empty($nameblock)) {
$sql = "SELECT `name` FROM ".$prefix."_shoutbox_nameblock";
$nameresult = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($nameresult)) {
$nameblock[] = $row;
}
$cache->save('nameblock', 'shoutbox', $nameblock);
$db->sql_freeresult($nameresult);
}
if ((($censor = $cache->load('censor', 'shoutbox')) == false) || empty($censor)) {
$sql = "SELECT * FROM ".$prefix."_shoutbox_censor";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$censor[] = $row;
}
$cache->save('censor', 'shoutbox', $censor);
$db->sql_freeresult($result);
}
// Check if block is in center position
$sql = "SELECT `bposition` FROM `".$prefix."_blocks` WHERE `blockfile`='block-Shout_Box.php'";
$SBpos = $db->sql_query($sql);
$SBpos = $db->sql_fetchrow($SBpos);
if ($SBpos['bposition'] == 'c' || $SBpos['bposition'] == 'd') {
$SBpos = 'center';
$SBborder = 1;
} else {
$SBpos = 'side';
$SBborder = 1;
}
$db->sql_freeresult($SBpos);
if (isset($nsnst_const['remote_ip']) && !empty($nsnst_const['remote_ip'])) {
$uip = $nsnst_const['remote_ip'];
} else {
$uip = '';
}
//do IP test then ban if on list
if($conf['ipblock']== 'yes') {
$sql = "SELECT `name` FROM `".$prefix."_shoutbox_ipblock`";
$ipresult = $db->sql_query($sql);
while ($badips = $db->sql_fetchrow($ipresult)) {
if (eregi("\*", $badips['name'])) { // Allow for Subnet bans like 123.456.*
$badipsArray = explode(".",$badips['name']);
$uipArray = explode(".",$uip);
$i = 0;
if (is_array($badipsArray)) {
foreach($badipsArray as $badipsPart) {
if ($badipsPart == "*") {
$BannedShouter = "yes";
break;
}
if ($badipsPart != $uipArray[$i] && $badipsPart != "*") { break; }
$i++;
}
}
} else {
if($uip == $badips['name']) {
$BannedShouter = "yes";
break;
}
}
}
$db->sql_freeresult($ipresult);
}
//do name test then ban if on list (only applies to registered users)
if ($conf['nameblock']== 'yes' && $BannedShouter != "yes") {
if (is_array($nameblock)) {
foreach ($nameblock as $name) {
if ($username == $name['name']) {
$BannedShouter = "yes";
break;
}
}
}
}
if ($BannedShouter != "yes") {
if ($ShoutSubmit == "ShoutPost") {
// start processing shout
if ($shoutuid) { $username = $shoutuid; }
//shoutuid tests
$username = trim($username); // remove whitespace off ends of nickname
if($conf['anonymouspost']== 'yes') {
$unum = strlen($username);
if ($unum < 2) { $ShoutError = _NICKTOOSHORT; }
if (!$username || $username == _NAME) { $ShoutError = _NONICK; }
if (eregi(".xxx", $username) && $conf['blockxxx']== 'yes') { $username = "Anonymous"; }
if (eregi("javascript:(.*)", $username)) { $username = "Anonymous"; }
$username = htmlspecialchars($username, ENT_QUOTES);
$username = ereg_replace("&amp;", "&",$username);
}
if (!$is_user && !empty($username) && $username != "Anonymous") {
$username = ereg_replace(" ", "_",$username);
}
$ShoutComment = trim($ShoutComment); // remove whitespace off ends of shout
$ShoutComment = preg_replace('/\s+/', ' ', $ShoutComment); // convert double spaces in middle of shout to single space
$num = strlen($ShoutComment);
if ($num < 1) { $ShoutError = _SHOUTTOOSHORT; }
if ($num > 2500) { $ShoutError = _SHOUTTOOLONG; }
if (!$ShoutComment) { $ShoutError = _NOSHOUT; }
if ($ShoutComment == _SB_MESSAGE) { $ShoutError = _NOSHOUT; }
$ShoutComment = ereg_replace(" [.] ", ".",$ShoutComment);
if (eregi(".xxx", $ShoutComment) && $conf['blockxxx']== 'yes') {
$ShoutError = _XXXBLOCKED;
$PreviousShoutComment = '';
}
if (eregi("javascript:(.*)", $ShoutComment)) {
$ShoutError = _JSINSHOUT;
$PreviousShoutComment = '';
}
$ShoutComment = htmlspecialchars($ShoutComment, ENT_QUOTES);
$ShoutComment = ereg_replace("&amp;", "&",$ShoutComment);
// Scan for links in the shout. If there is, replace it with [URL] || block it if disallowed
$i = 0;
$ShoutNew = '';
$ShoutArray = explode(" ",$ShoutComment);
if (is_array($ShoutArray)) {
foreach($ShoutArray as $ShoutPart) {
if (is_array($ShoutPart)) { $ShoutPart = $ShoutPart[0]; }
if (eregi("http:\/\/", $ShoutPart)) {
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
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"http://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
} elseif (eregi("ftp:\/\/", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"ftp://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">FTP</a>]";
} elseif (eregi("irc:\/\/", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"irc://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">IRC</a>]";
} elseif (eregi("teamspeak:\/\/", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"teamspeak://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">TeamSpeak</a>]";
} elseif (eregi("aim:goim", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"aim:goim");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">AIM</a>]";
} elseif (eregi("gopher:\/\/", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"gopher://");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutNew[$i] = "[<a rel=\"nofollow\" href=\"$ShoutPart\">Gopher</a>]";
} elseif (eregi("mailto:", $ShoutPart)) {
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"mailto:");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
// email encoding to stop harvesters
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutNew[$i] = "[<a href=\"$ShoutPart\">E-Mail</a>]";
} elseif (eregi("www\.", $ShoutPart)) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPartL = strtolower($ShoutPart);
$spot = strpos($ShoutPartL,"www.");
if ($spot > 0) { $ShoutPart = substr($ShoutPart, $spot); }
$ShoutPart = "http://" . $ShoutPart;
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
} elseif (eregi('@', $ShoutPart) && eregi('\.', $ShoutPart)) {
// email encoding to stop harvesters
$ShoutPart = bin2hex($ShoutPart);
$ShoutPart = chunk_split($ShoutPart, 2, '%');
$ShoutPart = '%' . substr($ShoutPart, 0, strlen($ShoutPart) - 1);
$ShoutNew[$i] = "[<a href=\"mailto:$ShoutPart\">E-Mail</a>]";
} elseif ((eregi("\.(us|tv|cc|ws|ca|de|jp|ro|be|fm|ms|tc|ph|dk|st|ac|gs|vg|sh|kz|as|lt|to)", substr("$ShoutPart", -3,3))) || (eregi("\.(com|net|org|mil|gov|biz|pro|xxx)", substr("$ShoutPart", -4,4))) || (eregi("\.(info|name|mobi)", substr("$ShoutPart", -5,5))) || (eregi("\.(co\.uk|co\.za|co\.nz|co\.il)", substr("$ShoutPart", -6,6)))) {
if ((!$is_user && $conf['urlanononoff'] == 'no') || ($is_user && $conf['urlonoff'] == 'no')) { $ShoutError = _URLNOTALLOWED; break; }
$ShoutPart = "http://" . $ShoutPart;
$ShoutNew[$i] = "[<a rel=\"nofollow\" target=\"_blank\" href=\"$ShoutPart\">URL</a>]";
} 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] = 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("[ 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; }
$i++;
}
}
if (empty($ShoutError)) { $ShoutComment = implode(" ",$ShoutNew); }
//Smilies from database
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayScan = $ShoutArrayReplace;
$sql = "SELECT `text`, `image` FROM `".$prefix."_shoutbox_emoticons`";
$eresult = $db->sql_query($sql);
while ($emoticons = $db->sql_fetchrow($eresult)) {
$i = 0;
if (is_array($ShoutArrayScan)) {
foreach($ShoutArrayScan as $ShoutPart) {
if ($ShoutPart == $emoticons['text']) { $ShoutArrayReplace[$i] = $emoticons['image']; }
$i++;
}
}
}
$db->sql_freeresult($eresult);
$ShoutComment = implode(" ",$ShoutArrayReplace);
//do name test then error if on list
if($conf['nameblock']== 'yes'){
if (is_array($nameblock)) {
foreach ($nameblock as $name) {
if($username == $name['name']) {
$ShoutError = _BANNEDNICK;
}
}
}
}
// check for anonymous users cloning/ghosting registered users' nicknames
if (!is_user() && !empty($username) && $username != "Anonymous") {
$sql = "SELECT `username` FROM `".$prefix."_users` WHERE `username`='$username'";
$nameresult = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($nameresult)) {
$ShoutError = _NOCLONINGNICKS;
}
$db->sql_freeresult($nameresult);
}
//look for bad words, then censor them.
if($conf['censor']== 'yes') {
// start Anonymous nickname censor check here. If bad, replace bad nick with 'Anonymous'
if (!$is_user && !empty($username) && $username != "Anonymous") {
if (is_array($censor)) {
foreach ($censor as $word) {
if ($username != 'Anonymous') {
$one = strtolower($word['text']);
$usernameL = strtolower($username);
if (stristr($usernameL, $one) !== false) {
$username = "Anonymous";
}
}
}
}
}
// Censor of posting text
$ShoutArrayReplace = explode(" ",$ShoutComment);
$ShoutArrayScan = $ShoutArrayReplace;
if (is_array($censor)) {
foreach ($censor as $word) {
$i = 0;
if (is_array($ShoutArrayScan)) {
foreach($ShoutArrayScan as $ShoutPart) {
$ShoutPart = strtolower($ShoutPart);
$censor['text'] = strtolower($word['text']);
if ($ShoutPart == $word['text']) { $ShoutArrayReplace[$i] = $word['replacement']; }
$i++;
}
}
}
}
$ShoutComment = implode(" ",$ShoutArrayReplace);
}
// duplicate posting checker. stops repeated spam attacks
$sql = "SELECT `comment` FROM `".$prefix."_shoutbox_shouts` ORDER BY `id` DESC LIMIT 5";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($row['comment'] == $ShoutComment) {
$ShoutError = _DUPLICATESHOUT;
}
}
$db->sql_freeresult($result);
if ($conf['anonymouspost'] == 'no' && $username == 'Anonymous') {
$ShoutError = _ONLYREGISTERED2;
}
if (!$ShoutError) {
if ($is_user) {
$day = shout_create_date('d/m/Y', time(), $userinfo['user_timezone']);
$time = shout_create_date('H:i', time(), $userinfo['user_timezone']);
} else {
$day = shout_create_date('d/m/Y', time(), $board_config['board_timezone']);
$time = shout_create_date('H:i', time(), $board_config['board_timezone']);
}
$currentTime = time();
$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);
$PreviousShoutComment = '';
$PreviousComment = '';
} else {
if ($username != _NAME) {
$PreviousUsername = $username;
}
if ($PreviousShoutComment != _SB_MESSAGE) {
$PreviousComment = $PreviousShoutComment;
}
}
}
//Display Content From here on down
if (!is_user() && !empty($username) && $username != "Anonymous") { $username = "Anonymous"; }
$ThemeSel = get_theme();
$sql = "SELECT * FROM `".$prefix."_shoutbox_theme_images` WHERE `themeName`='$ThemeSel'";
$result = $db->sql_query($sql);
$themeRow = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!empty($themeRow['blockBackgroundImage']) && file_exists(NUKE_MODULES_DIR.'Shout_Box/images/background/'.$themeRow['blockBackgroundImage'])) {
$showBackground = 'yes';
} else {
$showBackground = 'no';
}
if (!empty($themeRow['blockArrowColor'])) {
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/up/'.$themeRow['blockArrowColor'])) {
$up_img = 'modules/Shout_Box/images/up/'.$themeRow['blockArrowColor'];
} else {
$up_img = 'modules/Shout_Box/images/up/Black.gif';
}
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/down/'.$themeRow['blockArrowColor'])) {
$down_img = 'modules/Shout_Box/images/down/'.$themeRow['blockArrowColor'];
} else {
$down_img = 'modules/Shout_Box/images/down/Black.gif';
}
if (file_exists(NUKE_MODULES_DIR.'Shout_Box/images/pause/'.$themeRow['blockArrowColor'])) {
$pause_img = 'modules/Shout_Box/images/pause/'.$themeRow['blockArrowColor'];
} else {
$pause_img = 'modules/Shout_Box/images/pause/Black.gif';
}
} else {
$up_img = 'modules/Shout_Box/images/up/Black.gif';
$down_img = 'modules/Shout_Box/images/down/Black.gif';
$pause_img = 'modules/Shout_Box/images/pause/Black.gif';
}
$sql = "SELECT * FROM `".$prefix."_shoutbox_shouts` ORDER BY `id` DESC LIMIT $conf[number]";
$result = $db->sql_query($sql);
// Top half
// shout error reporting
$top_content = '';
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_out = "<td style=\"background-color: #FFFFE1;\"><strong>"._SB_NOTE.":</strong> $ShoutError</td>";
}
// table that holds the scrolling area
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";
} 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";
}
// end top content
// table of the actual scrolling content
if ($showBackground == 'yes') {
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"5\">";
} else {
$mid_content = "<table style=\"table-layout: fixed; width: 100%;\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"2\">";
}
$flag = 1;
$ThemeSel = get_theme();
$sql = "SELECT `blockColor1`, `blockColor2` FROM `".$prefix."_shoutbox_themes` WHERE `themeName`='$ThemeSel'";
$resultT = $db->sql_query($sql);
$rowColor = $db->sql_fetchrow($resultT);
$db->sql_freeresult($resultT);
// Sticky shouts
$sql = "SELECT `comment`, `timestamp` FROM `".$prefix."_shoutbox_sticky` WHERE `stickySlot`=0";
$stickyResult = $db->sql_query($sql);
$stickyRow0 = $db->sql_fetchrow($stickyResult);
$db->sql_freeresult($stickyResult);
$sql = "SELECT `comment`, `timestamp` FROM `".$prefix."_shoutbox_sticky` WHERE `stickySlot`=1";
$stickyResult = $db->sql_query($sql);
$stickyRow1 = $db->sql_fetchrow($stickyResult);
$db->sql_freeresult($stickyResult);
if ($stickyRow0) {
if ($showBackground == 'yes') {
$mid_content .= "<tr><td>";
} else {
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
$mid_content .= "<tr><td style=\"background-color: ".$rowColor['blockColor1'].";\">";
}
$mid_content .= "<strong>"._SB_ADMIN.":</strong> ".$stickyRow0['comment'];
if ($conf['date']== 'yes') {
if ($is_user) {
$unixTime = shout_create_date($userinfo['user_dateformat'], $stickyRow0['timestamp'], $userinfo['user_timezone']);
$mid_content .= "<br />$unixTime";
} else {
$unixTime = shout_create_date($board_config['default_dateformat'], $stickyRow0['timestamp'], $board_config['board_timezone']);
$mid_content .= "<br />$unixTime";
}
}
$mid_content .= "</td></tr>";
}
if ($stickyRow1) {
if ($showBackground == 'yes') {
$mid_content .= "<tr><td>";
} else {
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
$mid_content .= "<tr><td style=\"background-color: ".$rowColor['blockColor2'].";\">";
}
$mid_content .= "<strong>"._SB_ADMIN.":</strong> ".$stickyRow1['comment'];
if ($conf['date']== 'yes') {
if ($is_user) {
$unixTime = shout_create_date($userinfo['user_dateformat'], $stickyRow1['timestamp'], $userinfo['user_timezone']);
$mid_content .= "<br />$unixTime";
} else {
$unixTime = shout_create_date($board_config['default_dateformat'], $stickyRow1['timestamp'], $board_config['board_timezone']);
$mid_content .= "<br />$unixDay $unixTime";
}
}
$mid_content .= "</td></tr>";
}
// end sticky shouts
$i = 0;
while ($row = $db->sql_fetchrow($result)) {
if ($flag == 1) { $bgcolor = $rowColor['blockColor1']; }
if ($flag == 2) { $bgcolor = $rowColor['blockColor2']; }
if ($showBackground == 'yes') {
$tempContent[$i] = "<tr><td>";
} else {
$tempContent[$i] = "<tr><td style=\"background-color: $bgcolor;\">";
}
$ShoutComment = str_replace('src=', 'src="', $row['comment']);
$ShoutComment = str_replace('.gif>', '.gif" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.jpg>', '.jpg" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.png>', '.png" alt="" />', $ShoutComment);
$ShoutComment = str_replace('.bmp>', '.bmp" alt="" />', $ShoutComment);
$ShoutComment = str_replace("http:", $preURL."http:", $ShoutComment);
$ShoutComment = str_replace("ftp:", $preURL."ftp:", $ShoutComment);
// BB code [b]word[/b] [i]word[/i] [u]word[/u]
if ((eregi("[b]", $ShoutComment)) && (eregi("[/b]", $ShoutComment)) && (substr_count("$ShoutComment","[b]") == substr_count("$ShoutComment","[/b]"))) {
$ShoutComment = eregi_replace("\[b\]","<span style=\"font-weight: bold\">","$ShoutComment");
$ShoutComment = eregi_replace("\[\/b\]","</span>","$ShoutComment");
}
if ((eregi("[i]", $ShoutComment)) && (eregi("[/i]", $ShoutComment)) && (substr_count("$ShoutComment","[i]") == substr_count("$ShoutComment","[/i]"))) {
$ShoutComment = eregi_replace("\[i\]","<span style=\"font-style: italic\">","$ShoutComment");
$ShoutComment = eregi_replace("\[\/i\]","</span>","$ShoutComment");
}
if ((eregi("[u]", $ShoutComment)) && (eregi("[/u]", $ShoutComment)) && (substr_count("$ShoutComment","[u]") == substr_count("$ShoutComment","[/u]"))) {
$ShoutComment = eregi_replace("\[u\]","<span style=\"text-decoration: underline\">","$ShoutComment");
$ShoutComment = eregi_replace("\[\/u\]","</span>","$ShoutComment");
}
if ($username == 'Anonymous') {
/*****[BEGIN]******************************************
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
$tempContent[$i] .= "<strong>" . UsernameColor($row['name']) . ":</strong> $ShoutComment";
/*****[END]********************************************
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
}
else {
// check to see if nickname is a user in the DB
$sqlN = "SELECT * FROM `".$prefix."_users` WHERE `username`='".$row['name']."'";
$nameresultN = $db->sql_query($sqlN);
$rowN = $db->sql_fetchrow($nameresultN);
$db->sql_freeresult($nameresultN);
if ($rowN && ($row['name'] != "Anonymous")) {
/*****[BEGIN]******************************************
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
$tempContent[$i] .= "<strong><a href=\"modules.php?name=Your_Account&op=userinfo&username=$row[name]\">" . UsernameColor($row['name']) . "</a>:</strong> $ShoutComment";
/*****[END]********************************************
[ Mod: Advanced Username Color v1.0.5 ]
******************************************************/
} else {
$tempContent[$i] .= "<strong>".$row['name'].":</strong> $ShoutComment";
}
}
if ($conf['date']== 'yes') {
if (!empty($row['timestamp'])) {
// reads unix timestamp && formats it to the viewer's timezone
if ($is_user) {
$unixTime = shout_create_date($userinfo['user_dateformat'], $row['timestamp'], $userinfo['user_timezone']);
$tempContent[$i] .= "<br />$unixTime";
} else {
$unixTime = shout_create_date($board_config['default_dateformat'], $row['timestamp'], $board_config['board_timezone']);
$tempContent[$i] .= "<br />$unixTime";
}
} else {
$tempContent[$i] .= "<br />".$row['date']." ".$row['time'];
}
}
$tempContent[$i] .= "</td></tr>";
if ($flag == 1) { $flag = 2; }
elseif ($flag == 2) { $flag = 1; }
$i++;
}
// Reversing the posts
if ($conf['reversePosts'] == 'no') {
for ($j = 0; $j < $conf['number']; $j++) {
if (isset($tempContent[$j]) && !empty($tempContent[$j])) {
$mid_content .= $tempContent[$j];
}
}
} else {
for ($j = $conf['number']; $j >= 0; $j = $j - 1) {
if (isset($tempContent[$j]) && !empty($tempContent[$j])) {
$mid_content .= $tempContent[$j];
}
}
}
// You may not remove or edit this copyright!!! Doing so violates the GPL license.
$mid_content .= "</table>";
// end copyright.
// end mid content
// start bottom content $bottom_content
$bottom_content = "</td></tr></table>\n";
// bottom half
if ($conf['anonymouspost'] == 'no' && $username == 'Anonymous') {
$bottom_content .= "<div style=\"padding: 1px;\" align=\"center\" class=\"content\"><a href=\"modules.php?name=Shout_Box\">"._SHOUTHISTORY."</a>";
$bottom_content .= " <span style=\"cursor: pointer;\" onmouseover=\"SBspeed=4\" onmouseout=\"SBspeed=1\"><img src=\"$up_img\" border=\"0\" alt=\"\" width=\"9\" height=\"5\" /></span>";
$bottom_content .= " <span style=\"cursor: pointer;\" onmouseover=\"SBspeed=1-5\" onmouseout=\"SBspeed=1\"><img src=\"$down_img\" border=\"0\" alt=\"\" width=\"9\" height=\"5\" /></span>";
$bottom_content .= " <span style=\"cursor: wait;\" onmouseover=\"SBspeed=0\" onmouseout=\"SBspeed=1\"><img src=\"$pause_img\" border=\"0\" alt=\"\" width=\"9\" height=\"5\" /></span>";
$bottom_content .= "</div><div style=\"padding: 1px; text-align: center;\" class=\"content\"><br />"._ONLYREGISTERED." <a href=\"account.html\">"._SHOUTLOGIN."</a> "._OR." <a href=\"modules.php?name=Your_Account&op=new_user\">"._CREATEANACCT."</a>.</div>";
} else {
$bottom_content .= "<form name=\"shoutform1\" method=\"post\" action=\"\" style=\"margin-bottom: 0px; margin-top: 0px\">";
$bottom_content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
$bottom_content .= "<tr><td align=\"center\"><a href=\"modules.php?name=Shout_Box\">"._SHOUTHISTORY."</a>";
$bottom_content .= " <span style=\"cursor: pointer;\" onmouseover=\"SBspeed=4\" onmouseout=\"SBspeed=1\"><img src=\"$up_img\" border=\"0\" alt=\"\" width=\"9\" height=\"5\" /></span>";
$bottom_content .= " <span style=\"cursor: pointer;\" onmouseover=\"SBspeed=1-5\" onmouseout=\"SBspeed=1\"><img src=\"$down_img\" border=\"0\" alt=\"\" width=\"9\" height=\"5\" /></span>";
$bottom_content .= " <span style=\"cursor: wait;\" onmouseover=\"SBspeed=0\" onmouseout=\"SBspeed=1\"><img src=\"$pause_img\" border=\"0\" alt=\"\" width=\"9\" height=\"5\" /></span>";
$bottom_content .= "</td></tr>\n";
// Start smilie Drop-Down Code
$messageDefinition = _SB_MESSAGE;
if (eregi("MSIE(.*)", $_SERVER['HTTP_USER_AGENT']) || eregi("Konqueror/3(.*)", $_SERVER['HTTP_USER_AGENT']) || (eregi("Opera(.*)", $_SERVER['HTTP_USER_AGENT']))) {
$ShoutNameWidth = $conf['textWidth'];
$ShoutTextWidth = $conf['textWidth'];
} else {
// Firefox, Mozilla, NS, && any others.
$ShoutNameWidth = $conf['textWidth'] - 4;
$ShoutTextWidth = $conf['textWidth'] - 4;
}
if ($conf['anonymouspost']== 'yes' && $username == 'Anonymous') {
if ($PreviousUsername) { $boxtext = $PreviousUsername; } else { $boxtext = _NAME; }
$bottom_content .= "<tr><td align=\"center\"><input type=\"text\" name=\"shoutuid\" id=\"shoutuid\" size=\"$ShoutNameWidth\" value=\"$boxtext\" maxlength=\"25\" onfocus=\"if ( this.value == '"._NAME."' ) { this.value=''; }\" onblur=\"if (this.value == '') { this.value='"._NAME."' }\" /></td></tr>\n";
}
if (!empty($PreviousComment)) { $boxtext = $PreviousComment; } else { $boxtext = _SB_MESSAGE; }
$bottom_content .= "<tr><td align=\"center\" nowrap=\"nowrap\"><input type=\"text\" name=\"ShoutComment\" id=\"ShoutComment\" size=\"85%\" onKeyPress=\"return OnEnter(event)\" value=\"$boxtext\" maxlength=\"2500\" onfocus=\"if ( this.value == '"._SB_MESSAGE."' ) { this.value=''; }\" onblur=\"if (this.value == '') { this.value='"._SB_MESSAGE."' }\" /><br><br></td></tr>";
$bottom_content .= "<tr><td align=\"center\"><input type=\"hidden\" name=\"ShoutSubmit\" value=\"ShoutPost\" />";
$bottom_content .= "<div id=\"smilies_hide\" style=\"display: block;\"><div class=\"content\"><input type=\"submit\" name=\"button\" value=\"Submit Shout\" /> <span onclick=\"changeBoxSize ('show'); return false;\"><input type=\"button\" value=\"Show Smiley's\" /></span></div></div>";
$bottom_content .= "<div id=\"smilies_show\" style=\"display: none;\"><div class=\"content\"><input type=\"submit\" name=\"button\" value=\"Submit Shout\" /> <span onclick=\"changeBoxSize ('hide'); return false;\"><input type=\"button\" value=\"Hide Smiley's\" /></span><br /><br />";
$sql = "SELECT distinct image FROM `".$prefix."_shoutbox_emoticons`";
$nameresult1 = $db->sql_query($sql);
$flag = 1;
while ($return = $db->sql_fetchrow($nameresult1)){
$sql = "SELECT * FROM `".$prefix."_shoutbox_emoticons` WHERE `image`='$return[0]' LIMIT 1";
$nameresult = $db->sql_query($sql);
while ($emoticons = $db->sql_fetchrow($nameresult)){
$emoticons[3] = str_replace('>', '', $emoticons['image']);
$emoticons[3] = str_replace('src=', 'src="', $emoticons[3]);
$bottom_content .= "<span style=\"cursor: pointer;\" onclick=\"DoSmilie(' $emoticons[text] ','$messageDefinition');\">$emoticons[3]\" border=\"0\" alt=\"\" /></span> ";
;
if ($flag == 17) {
$bottom_content .="<br />\n";
$flag = 1;
continue;
}
$flag++;
}
$db->sql_freeresult($nameresult);
}
$db->sql_freeresult($nameresult1);
$bottom_content .= "</div></div></td></tr>\n";
$bottom_content .= "</table></form>\n";
}
} else {
$top_content = "<p class=\"title\" align=\"center\"><strong>";
$mid_content = _YOUAREBANNED;
$bottom_content = "</strong></p>";
}
$ShoutMarqueeheight = $conf['height'];
}
$ShoutComment = (isset($_POST['ShoutComment'])) ? $_POST['ShoutComment'] : '';
$ShoutSubmit = (isset($_POST['ShoutSubmit'])) ? $_POST['ShoutSubmit'] : '';
$shoutuid = (isset($_POST['shoutuid'])) ? $_POST['shoutuid'] : '';
if (isset($_GET['Action']) && $_GET['Action'] == 'AJAX') {
if (!ereg('shout:', $_GET['ShoutComment'])) return;
$ShoutComment = (isset($_GET['ShoutComment'])) ? base64_decode(str_replace('shout:', '', $_GET['ShoutComment'])) : '';
$ShoutSubmit = (isset($_GET['ShoutSubmit'])) ? $_GET['ShoutSubmit'] : '';
$shoutuid = (isset($_GET['shoutuid'])) ? $_GET['shoutuid'] : '';
ShoutBox($ShoutSubmit, $ShoutComment, $shoutuid);
global $top_out, $mid_content;
@header("content-type: text/xml");
@header("Cache-Control: no-cache, must-revalidate, max-age=0");
@header("Pragma: no-cache");
echo "<?xml version=\"1.0\" ?>\n";
echo "<shout>\n";
echo "<top>";
echo '<![CDATA[';
echo $top_out;
echo ']]>';
echo "</top>\n";
echo "<shout_data>";
echo '<![CDATA[';
echo $mid_content;
echo ']]>';
echo "</shout_data>\n";
echo "</shout>\n";
}
?>
|