<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }
add_to_head("<script language='JavaScript' type='text/javascript' src='".INFUSIONS."shoutbox_center_panel/ticker.js'></script>
<style type='text/css'>
.newsticker {
display: none;
list-style-type: none;
padding: 3px;
margin: 0;
font-size: 12px;
}
</style>");
echo "<script type='text/javascript'>
$(document).ready(
function() {
$('#news').newsTicker();
$('#news').show('fast');
}
);
</script>
<script type='text/javascript'>
$(document).ready(function() {
$('#postshout').hide();
$('input#post-toggle').click(function() {
$('#postshout').toggle(400);
$('#postclick').toggle(400);
return false;
});
$('input#post-cancel').click(function() {
$('#postshout').toggle(400);
$('#postclick').toggle(400);
return false;
});
});
</script>";
function sbwrap($text) {
$i = 0; $tags = 0; $chars = 0; $res = "";
$str_len = strlen($text);
for ($i = 0; $i < $str_len; $i++) {
$chr = substr($text, $i, 1);
if ($chr == "<") {
if (substr($text, ($i + 1), 6) == "a href" || substr($text, ($i + 1), 3) == "img") {
$chr = " ".$chr;
$chars = 0;
}
$tags++;
} elseif ($chr == "&") {
if (substr($text, ($i + 1), 5) == "quot;") {
$chars = $chars - 5;
} elseif (substr($text, ($i + 1), 4) == "amp;" || substr($text, ($i + 1), 4) == "#39;" || substr($text, ($i + 1), 4) == "#92;") {
$chars = $chars - 4;
} elseif (substr($text, ($i + 1), 3) == "lt;" || substr($text, ($i + 1), 3) == "gt;") {
$chars = $chars - 3;
}
} elseif ($chr == ">") {
$tags--;
} elseif ($chr == " ") {
$chars = 0;
} elseif (!$tags) {
$chars++;
}
if (!$tags && $chars == 40) {
$chr .= "<br />";
$chars = 0;
}
$res .= $chr;
}
return $res;
}
$link = FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "");
$link = preg_replace("^(&|\?)s_action=(edit|delete)&shout_id=\d*^", "", $link);
$sep = stristr($link, "?") ? "&" : "?";
opentable($locale['global_150']);
echo "<table width='100%' cellspacing='2' cellpadding='0'>";
echo "<tr>";
echo "<td align='center' valign='middle' class='tbl2'>";
$result = dbquery("SELECT count(shout_id) FROM ".DB_SHOUTBOX);
$numrows = dbresult($result, 0);
$result = dbquery(
"SELECT ts.*, tu.user_id, tu.user_name, tu.user_level, tu.user_avatar FROM ".DB_SHOUTBOX." ts
LEFT JOIN ".DB_USERS." tu ON ts.shout_name=tu.user_id
ORDER BY ts.shout_datestamp DESC LIMIT 0,".$settings['numofshouts']
);
if (dbrows($result) != 0) {
$i = 1;
echo "<ul id='news' class='newsticker'>\n";
while ($data = dbarray($result)) {
echo "<li style='".($i == 1 ? "" : "display: none; ")."'>";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n";
echo "<tr><td valign='middle' align='left' class='tbl2' width='1%' style='white-space:nowrap;'>\n";
echo "<table><tr><td align='left'>";
if (!empty($data['user_avatar']) && file_exists(IMAGES."avatars/".$data['user_avatar'])){
echo "<img height='50' width='50' src='".IMAGES."avatars/".$data['user_avatar']."' alt='".$data['user_name']."' />";
}else{
echo "<img height='50' width='50' src='".INFUSIONS."shoutbox_center_panel/images/noav.gif' alt='".($data['user_name'] ? $data['user_name'] : $data['shout_name'])."' />";
}
echo "</td><td align='left'><strong>\n";
if ($data['user_name']) {
echo "<a href='".BASEDIR."profile.php?lookup=".$data['shout_name']."' class='side' style='color:".($data['user_level'] == 103 ? "red" : ($data['user_level'] == 102 ? "green" : ($data['user_level'] == 101 ? "blue" : "")))."'>".$data['user_name']."</a>\n";
} else {
echo $data['shout_name']."\n";
}
echo "</strong><br />\n".showdate("%d/%m/%y", $data['shout_datestamp'])."<br />".showdate("%H:%M", $data['shout_datestamp'])." ";
echo "</td></tr></table>";
echo "</td>\n";
echo "<td valign='middle' align='center' class='tbl2'>";
echo "<div class='quote'>".sbwrap(parseubb(parsesmileys($data['shout_message'])))."</div>";
echo "</td></tr></table>\n";
echo "</li>\n";
$i++;
}
echo "</ul>\n";
} else {
echo "<div align='center'>".$locale['127']."</div>\n";
}
echo "</td>";
if (iMEMBER || $settings['guestposts'] == "1") {
echo "<td valign='middle' align='center' class='tbl2' width='1%' style='white-space:nowrap;'>";
include_once INCLUDES."bbcode_include.php";
if (isset($_POST['post_shout'])) {
$flood = false;
if (iMEMBER) {
$shout_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$shout_name = trim(stripinput($_POST['shout_name']));
$shout_name = preg_replace("(^[0-9]*)", "", $shout_name);
if (isnum($shout_name)) { $shout_name = ""; }
include_once INCLUDES."securimage/securimage.php";
$securimage = new Securimage();
if (!isset($_POST['sb_captcha_code']) || $securimage->check($_POST['sb_captcha_code']) == false) { redirect($link); }
}
$shout_message = str_replace("\n", " ", $_POST['shout_message']);
$shout_message = preg_replace("/^(.{255}).*$/", "$1", $shout_message);
$shout_message = trim(stripinput(censorwords($shout_message)));
if ($shout_name && $shout_message) {
require_once INCLUDES."flood_include.php";
if (!flood_control("shout_datestamp", DB_SHOUTBOX, "shout_ip='".USER_IP."'")) {
$result = dbquery("INSERT INTO ".DB_SHOUTBOX." (shout_name, shout_message, shout_datestamp, shout_ip) VALUES ('$shout_name', '$shout_message', '".time()."', '".USER_IP."')");
}
}
redirect($link);
}
echo "<div id='postclick'><input type='button' id='post-toggle' value='".$locale['global_153']."' class='button' /></div>";
echo "<div id='postshout'>";
echo "<form name='chatform' method='post' action='".$link."'>\n";
if (iGUEST) {
echo $locale['global_151']."<br />\n";
echo "<input type='text' name='shout_name' value='' class='textbox' maxlength='30' style='width:140px' /><br />\n";
echo $locale['global_152']."<br />\n";
}
echo "<textarea name='shout_message' style='width:100%;' rows='4' class='textbox' style='width:140px'></textarea><br />\n";
echo display_bbcodes("150px;", "shout_message", "chatform", "smiley|b|u|url|color")."\n";
if (iGUEST) {
echo $locale['global_158']."<br />\n";
echo "<img id='sb_captcha' src='".INCLUDES."securimage/securimage_show.php' alt='' /><br />\n";
echo "<a href='".INCLUDES."securimage/securimage_play.php'><img src='".INCLUDES."securimage/images/audio_icon.gif' alt='' class='tbl-border' style='margin-bottom:1px' /></a>\n";
echo "<a href='#' onclick=\"document.getElementById('sb_captcha').src = '".INCLUDES."securimage/securimage_show.php?sid=' + Math.random(); return false\"><img src='".INCLUDES."securimage/images/refresh.gif' alt='' class='tbl-border' /></a><br />\n";
echo $locale['global_159']."<br />\n<input type='text' name='sb_captcha_code' class='textbox' style='width:100px' /><br />\n";
}
echo "<input type='submit' name='post_shout' value='".$locale['global_153']."' class='button' /><input type='button' id='post-cancel' value='Cancel' class='button' />\n";
echo "</form>\n";
echo "</div>";
echo "</td>";
}
echo "</tr>";
if (file_exists(INFUSIONS."shoutbox_panel/shoutbox_archive.php")){
echo "<tr>";
echo "<td ".(iMEMBER || $settings['guestposts'] == "1" ? "colspan='2' " : "")."align='center' class='tbl2'><a href='".INFUSIONS."shoutbox_center_panel/shoutbox_archive.php'>".$locale['global_155']."</a></td>";
echo "</tr>";
}
echo "</table>";
echo "<div style='float:right;'><span title='© Jeepers1993 Fusion-Games'><small>©</small></span></div>\n";
closetable();
?>