09 Shoutbox System

Started by Mindless, July 21, 2012, 07:25:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rushed

Quote from: noobKID on August 04, 2012, 05:17:27 PM
nice, i will test soon, thanks! :)...

but once question is crossing my mind...
as far as i remember, then i was installing a shoutbox from the old tbdev website, that could make a autoshout from when a torrent is uploaded or a forum post is being created or such,

is it possible here too or is it just my eyes that are blinding me?...
-thanks

yes it is possible mindless posted the code below

Quote from: Mindless@ file takeupload.php find :


$id = mysql_insert_id();



Under it add :


$message = "New Torrent : [url=http://{$TBDEV['baseurl']}/details.php?id=$id] " . htmlspecialchars($torrent) . "[/url] Uploaded by " . htmlspecialchars($CURUSER["username"]) . "";


If you install the mod as directed below it will announce signups and new forum posts

Hyperion (noobKID)

nice, i will test soon, thanks! :)...

but once question is crossing my mind...
as far as i remember, then i was installing a shoutbox from the old tbdev website, that could make a autoshout from when a torrent is uploaded or a forum post is being created or such,

is it possible here too or is it just my eyes that are blinding me?...
-thanks

Mindless

#1
Credit to all the original creators.
Xhtml valid :)
Massive thank you goes to the following for Code and improvements : pdq, sir_snugglebunny, putyn.
This post is very similiar to pdq's shoutbox apart from certain aspects.

Has some basic options such as :

power user + may edit their own shouts
Mods may delete shouts.
sysops may delete shouts and all shouts.
Moderator+ may shout as 'System'.

Staff commands added from putyn and his new addition - private message via shoutbox :)

Reworked for 09 :)

First run all this sql :
Code (sql) Select
CREATE TABLE `shoutbox` (
  `id` bigint(10) NOT NULL auto_increment,
  `userid` bigint(6) NOT NULL default '0',
  `to_user` int(10) NOT NULL default '0',
  `username` varchar(25) NOT NULL default '',
  `date` int(11) NOT NULL default '0',
  `text` text NOT NULL,
  `text_parsed` text NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `for` (`to_user`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;


Code (sql) Select
ALTER TABLE users ADD `show_shout` enum('yes','no') character set utf8 collate utf8_bin NOT NULL default 'yes';
ALTER TABLE users ADD `chatpost` int(11) NOT NULL default '1';
ALTER TABLE users ADD `shoutboxbg` enum('1','2','3') character set utf8 collate utf8_bin NOT NULL default '1';
ALTER TABLE `users` ADD `smile_until` int(10) NOT NULL default '0';



@File include/config.php add :
Code (php) Select
$TBDEV['bot_id'] = 2;


@ File include/bbcode_functions.php add if you dont have it - note that custom smilies are part of the 09 seeding bonus mod - The rest of the code is also added into the 09 Texbbcode mod for the smilies and custom smilies so check both.
Code (php) Select
//=== smilie function
function get_smile()
{
global $CURUSER;
return $CURUSER["smile_until"];
}



@ file include/user_functions.php if you dont have it
Code (php) Select
function get_user_class_color($class)
{
    switch ($class)
    {       

        case UC_USER: return "8E35EF";
        case UC_POWER_USER: return "f9a200";
        case UC_VIP: return "009F00";
        case UC_UPLOADER: return "0000FF";
        case UC_MODERATOR: return "FE2E2E";
        case UC_ADMINISTRATOR: return "B000B0";
        case UC_SYSOP: return "4080B0";
    }
    return "";
}



and add this to bittorrent.php - uses's a user account named System or change the userid and username in the query to Name and id of choice for the bot.
Code (php) Select
function autoshout($msg) {
global $TBDEV;
require_once(INCL_DIR.'bbcode_functions.php');
mysql_query('INSERT INTO shoutbox(userid,date,text,text_parsed)VALUES ('.$TBDEV['bot_id'].','.time().','.sqlesc($msg).','.sqlesc(format_comment($msg)).')');
}


@ file include/cleanup.php add :
Code (php) Select
$secs = 2 * 86400;
  $dt = sqlesc(time() - $secs);
  mysql_query("DELETE FROM shoutbox WHERE " . time() . " - date > $secs") or sqlerr(__FILE__, __LINE__);



@ file userdetails.php add this in your admin tools section :
Code (php) Select
$HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_chatpos']}</td><td colspan='2' align='left'><input type='radio' name='chatpost' value='1'" .($user["chatpost"] == "1" ? " checked='checked'" : "")." />{$lang['userdetails_yes']} <input type='radio' name='chatpost' value='0'" .($user["chatpost"] == "0" ? " checked='checked'" : "")." />{$lang['userdetails_no']}</td></tr>\n";


@ file lang/en/lang_userdetails.php add :
Code (php) Select
'userdetails_chatpos' => "Chat possible",


@ file modtask.php
Code (php) Select
// === Enable / Disable chat box rights
    if ((isset($_POST['chatpost'])) && (($chatpost = $_POST['chatpost']) != $user['chatpost'])) {
        $modcomment = get_date( time(), 'DATE', 1 ) . " {$lang['modtask_chatpos']} " . sqlesc($chatpost) .
            " {$lang['modtask_by']} " . $CURUSER['username'] . ".\n" . $modcomment;
        $updateset[] = "chatpost = " . sqlesc($chatpost);
    }



@ file lang/en/lang_modtask.php add
Code (php) Select
'modtask_chatpos' => "- Chat post rights set to",



@ file my.php add this where you want :
Code (php) Select
$HTMLOUT .= tr("".$lang['my_shoutback']."", "<input type='radio' name='shoutboxbg'" . ($CURUSER["shoutboxbg"] == "1" ? " checked='checked'" : "") . " value='1' />{$lang['my_shoutback_white']}
    <input type='radio' name='shoutboxbg'" . ($CURUSER["shoutboxbg"] == "2" ? " checked='checked'" : "") . " value='2' />{$lang['my_shoutback_grey']}<input type='radio' name='shoutboxbg'" . ($CURUSER["shoutboxbg"] == "3" ? " checked='checked'" : "") . " value='3' />{$lang['my_shoutback_black']}", 1);



@ file takeprofileedit.php add :
Code (php) Select
$shoutboxbg = 0 + $_POST["shoutboxbg"];
    $updateset[] = "shoutboxbg = " . sqlesc($shoutboxbg);



@ file lang/en/lang_my.php add :
Code (php) Select
'my_shoutback' => 'Shoutbox background',
'my_shoutback_white' => 'White',
'my_shoutback_grey' => 'Grey',
'my_shoutback_black' => 'Black',



@ file index.php add this where you want the display :
Code (php) Select
// === shoutbox 09
   if ($CURUSER['show_shout'] === "yes") {
   $commandbutton = '';
   $refreshbutton = '';
   $smilebutton = '';
   $custombutton = '';
   if(get_smile() != '0')
   $custombutton .="<span style='float:right;'><a href=\"javascript:PopCustomSmiles('shbox','shbox_text')\">{$lang['index_shoutbox_csmilies']}</a></span>";
   if ($CURUSER['class'] >= UC_ADMINISTRATOR){
   $commandbutton = "<span style='float:right;'><a href=\"javascript:popUp('shoutbox_commands.php')\">{$lang['index_shoutbox_commands']}</a></span>\n";}
   $refreshbutton = "<span style='float:right;'><a href='shoutbox.php' target='sbox'>{$lang['index_shoutbox_refresh']}</a></span>\n";
   $smilebutton = "<span style='float:right;'><a href=\"javascript:PopMoreSmiles('shbox','shbox_text')\">{$lang['index_shoutbox_smilies']}</a></span>\n";
   $HTMLOUT .= "<form action='shoutbox.php' method='get' target='sbox' name='shbox' onsubmit='mysubmit()'>
   <div class='roundedCorners' style='text-align:left;width:80%;border:1px solid black;padding:5px;'>
      <div style='background:transparent;height:25px;'><span style='font-weight:bold;font-size:12pt;'>{$lang['index_shout']}</span></div>
         <br />
   <b>{$lang['index_shoutbox']}</b> [ <a href='shoutbox.php?show_shout=1&show=no'><b>{$lang['index_shoutbox_close']}</b></a> ]
   <iframe src='shoutbox.php' width='100%' height='200' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe>
   <br />
   <br />
   <script type=\"text/javascript\" src=\"scripts/shout.js\"></script>   
   <div align='center'>
   <b>{$lang['index_shoutbox_shout']}</b>
   <input type='text' maxlength='180' name='shbox_text' size='100' />
   <input class='button' type='submit' value='{$lang['index_shoutbox_send']}' />
   <input type='hidden' name='sent' value='yes' />
   <br />
    <a href=\"javascript:SmileIT(':-)','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/smile1.gif' alt='Smile' title='Smile' /></a>
   <a href=\"javascript:SmileIT(':smile:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/smile2.gif' alt='Smiling' title='Smiling' /></a>
   <a href=\"javascript:SmileIT(':-D','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/grin.gif' alt='Grin' title='Grin' /></a>
   <a href=\"javascript:SmileIT(':lol:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/laugh.gif' alt='Laughing' title='Laughing' /></a>
   <a href=\"javascript:SmileIT(':w00t:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/w00t.gif' alt='W00t' title='W00t' /></a>
   <a href=\"javascript:SmileIT(':blum:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/blum.gif' alt='Rasp' title='Rasp' /></a>
   <a href=\"javascript:SmileIT(';-)','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/wink.gif' alt='Wink' title='Wink' /></a>
   <a href=\"javascript:SmileIT(':devil:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/devil.gif' alt='Devil' title='Devil' /></a>
   <a href=\"javascript:SmileIT(':yawn:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/yawn.gif' alt='Yawn' title='Yawn' /></a>
   <a href=\"javascript:SmileIT(':-/','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/confused.gif' alt='Confused' title='Confused' /></a>
   <a href=\"javascript:SmileIT(')','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/clown.gif' alt='Clown' title='Clown' /></a>
   <a href=\"javascript:SmileIT(':innocent:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/innocent.gif' alt='Innocent' title='innocent' /></a>
   <a href=\"javascript:SmileIT(':whistle:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/whistle.gif' alt='Whistle' title='Whistle' /></a>
   <a href=\"javascript:SmileIT(':unsure:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/unsure.gif' alt='Unsure' title='Unsure' /></a>
   <a href=\"javascript:SmileIT(':blush:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/blush.gif' alt='Blush' title='Blush' /></a>
   <a href=\"javascript:SmileIT(':hmm:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/hmm.gif' alt='Hmm' title='Hmm' /></a>
   <a href=\"javascript:SmileIT(':hmmm:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/hmmm.gif' alt='Hmmm' title='Hmmm' /></a>
   <a href=\"javascript:SmileIT(':huh:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/huh.gif' alt='Huh' title='Huh' /></a>
   <a href=\"javascript:SmileIT(':look:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/look.gif' alt='Look' title='Look' /></a>
   <a href=\"javascript:SmileIT(':rolleyes:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/rolleyes.gif' alt='Roll Eyes' title='Roll Eyes' /></a>
   <a href=\"javascript:SmileIT(':kiss:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/kiss.gif' alt='Kiss' title='Kiss' /></a>
   <a href=\"javascript:SmileIT(':blink:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/blink.gif' alt='Blink' title='Blink' /></a>
   <a href=\"javascript:SmileIT(':baby:','shbox','shbox_text')\"><img border='0' src='{$TBDEV['pic_base_url']}smilies/baby.gif' alt='Baby' title='Baby' /></a><br/>
    </div>
    <div style='background:#1f1f1f;height:25px;'><span style='font-weight:bold;font-size:8pt;'>{$refreshbutton}</span></div>
   <div style='background:#1f1f1f;height:25px;'><span style='font-weight:bold;font-size:8pt;'>{$commandbutton}</span></div>
   <div style='background:#1f1f1f;height:25px;'><span style='font-weight:bold;font-size:8pt;'>{$smilebutton}</span></div>
   <div style='background:#1f1f1f;height:25px;'><span style='font-weight:bold;font-size:8pt;float:right'>{$custombutton}</span></div>
    </div>
   </form><br />\n";
   }
   if ($CURUSER['show_shout'] === "no") {
   $HTMLOUT .="<div class='roundedCorners' style='text-align:left;width:80%;border:1px solid black;padding:5px;'><div style='background:transparent;height:25px;'><b>{$lang['index_shoutbox']} </b>[ <a href='{$TBDEV['baseurl']}/shoutbox.php?show_shout=1&show=yes'><b>{$lang['index_shoutbox_open']} ]</b></a></div></div><br />";
   }
   //==end 09 shoutbox



@ file lang/en/lang_index.php add :
Code (php) Select
'index_shoutbox_refresh'   => "[ Refresh ]",
'index_shoutbox_commands'   => "[ Commands ]",
'index_shoutbox_smilies'   => "[ More Smilies ]",
'index_shoutbox_csmilies' => "[ Custom Smilies ]",
'index_shout'   => "Shoutbox",
'index_shoutbox'   => "ShoutBox",
'index_shoutbox_shout'   => "Shout!:",
'index_shoutbox_send'   => "Send",
'index_shoutbox_close'   => "Close",
'index_shoutbox_open'   => "Open",



@ file sendmessage.php find 3 instances :
Code (php) Select
if ($_SERVER["HTTP_REFERER"] )
      {
        $HTMLOUT .= "<input type='hidden' name='returnto' value='{$_SERVER["HTTP_REFERER"]}' />";
      }



change to
Code (php) Select
if (isset($_SERVER["HTTP_REFERER"]) == './shoutbox.php')
      {
      $HTMLOUT .= "<input type='hidden' name='returnto' value='./index.php' />";
      } else {
      $HTMLOUT .= "<input type='hidden' name='returnto' value='".(isset($_GET["returnto"]) ? $_GET["returnto"]:$_SERVER["HTTP_REFERER"])."' />";
      }



Save as shout.js and upload to folder scripts :
Code (php) Select
function SmileIT(smile,form,text){
document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" ";
document.forms[form].elements[text].focus();
}
function PopMoreSmiles(form,name) {
link='moresmiles.php?form='+form+'&text='+name
newWin=window.open(link,'moresmile','height=500,width=450,resizable=no,scrollbars=yes');
if (window.focus) {newWin.focus()}
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=740,height=380,left = 340,top = 280');");
}
<!--
function mysubmit() {
setTimeout('document.shbox.reset()',100);
}
//-->
function confirm_delete()
{
   if(confirm('Are you sure you want to do this ?'))
   {
     if(confirm('Are you 100% sure ?'))
    {
      alert("Your are sure!");
      self.location.href='./shoutbox.php?delall';
    }
   }
}
function private_reply(to) {
   parent.document.forms[0].shbox_text.value='/private '+to+' ';
   parent.document.forms[0].shbox_text.focus();
}



Save and upload moresmiles.php to root :
Code (php) Select
<?php
require_once('include/bittorrent.php');
require_once(
'include/bbcode_functions.php');
dbconn(false);

$lang array_mergeload_language('global'));

loggedinorreturn();
      
$htmlout '';
    
$htmlout "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
      \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
      <html xmlns='http://www.w3.org/1999/xhtml'>
      <head>
    <meta name='generator' content='TBDev.net' />
     <meta name='MSSmartTagsPreventParsing' content='TRUE' />
      <title>More Smilies</title>
    <link rel='stylesheet' href='./1.css' type='text/css' />
    </head>
    <body>
    <script type='text/javascript'>
    function SmileIT(smile,form,text){
    window.opener.document.forms[form].elements[text].value = window.opener.document.forms[form].elements[text].value+' '+smile+' ';
    window.opener.document.forms[form].elements[text].focus();
    window.close();
    }
    </script>
    <table class='list' width='100%' cellpadding='1' cellspacing='1'>"
;
    
$count='';
    while ((list(
$code$url) = each($smilies))) {
    if (
$count == 0)
    
$htmlout .= " \n<tr>";
    
$htmlout .= "\n\t<td class=\"list\" align=\"center\"><a href=\"javascript: SmileIT('" str_replace("'""\'"$code) . "','" htmlspecialchars($_GET["form"]) . "','" htmlspecialchars($_GET["text"]) . "')\"><img border='0' src='./pic/smilies/" $url "' alt='' /></a></td>";
    
$count++;
    if (
$count == 0)
    
$htmlout .= "\n</tr>";
    }
    
$htmlout .= "</tr></table><div align='center'><a href='javascript: window.close()'>[ Close Window ]</a></div></body></html>";

print 
$htmlout;



@ file takeupload.php find :
Code (php) Select
$id = mysql_insert_id();


Under it add :
Code (php) Select
$message = "New Torrent : [url={$TBDEV['baseurl']}/details.php?id=$id] " . htmlspecialchars($torrent) . "[/url] Uploaded by " . htmlspecialchars($CURUSER["username"]) . "";


If you use anonymous uploader use this :
Code (php) Select
if ($CURUSER["anonymous"] == 'yes')
    $message = "New Torrent : [url={$TBDEV['baseurl']}/details.php?id=$id] " . htmlspecialchars($torrent) . "[/url] Uploaded - Anonymous User";
    else
    $message = "New Torrent : [url={$TBDEV['baseurl']}/details.php?id=$id] " . htmlspecialchars($torrent) . "[/url] Uploaded by " . htmlspecialchars($CURUSER["username"]) . "";



Find :
Code (php) Select
write_log(sprintf($lang['takeupload_log'], $id, $torrent, $CURUSER['username']));


Under it add :
Code (php) Select
autoshout($message);


@file takesignup.php under the main query :
Code (php) Select
$ret = mysql_query("INSERT INTO users (username, passhash, secret, editsecret, email, status, ". (!$arr[0]?"class, ":"") ."added, time_offset, dst_in_use) VALUES (" .
      implode(",", array_map("sqlesc", array($wantusername, $wantpasshash, $secret, $editsecret, $email, (!$arr[0]?'confirmed':'confirmed')))).
      ", ". (!$arr[0]?UC_SYSOP.", ":""). "". time() ." , $time_offset, {$dst_in_use['tm_isdst']})");



Add :
Code (php) Select
$message = "Welcome New {$TBDEV['site_name']} Member : - " . htmlspecialchars($wantusername) . "";


Find :
Code (php) Select
$psecret = md5($editsecret);



Under it add :
Code (php) Select
autoshout($message);

shoutbox.php

Code (php) Select
<?php
/**
 *   http://btdev.net:1337/svn/test/Installer09_Beta
 *   Licence Info: GPL
 *   Copyright (C) 2010 BTDev Installer v.1
 *   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
 *   Project Leaders: Mindless,putyn.
 **/
require_once("include/bittorrent.php");
require_once(
"include/user_functions.php");
require_once(
"include/bbcode_functions.php");
dbconnfalse );
loggedinorreturn();

$HTMLOUT ="";

// === added turn on / off shoutbox - sir snuggs
if ( ( isset( $_GET['show_shout'] ) ) && ( ( $show_shout $_GET['show'] ) !== $CURUSER['show_shout'] ) ) {
mysql_query"UPDATE users SET show_shout = " sqlesc$_GET['show'] ) . " WHERE id = $CURUSER[id]);
header"Location: " $_SERVER['HTTP_REFERER'] );
}

unset( 
$insert );
$insert false;
$query "";
$sb = array('charset' => 'UTF-8');
// Delete single shout
if ( isset( $_GET['del'] ) && $CURUSER['class'] >= UC_STAFF && is_valid_id$_GET['del'] ) )
mysql_query"DELETE FROM shoutbox WHERE id=" sqlesc$_GET['del'] ) );
// Empty shout - sysop
if ( isset( $_GET['delall'] ) && $CURUSER['class'] == UC_SYSOP )
$query "TRUNCATE TABLE shoutbox";
mysql_query$query );
unset(
$query);

// Staff edit 
if (isset($_GET['edit']) && $CURUSER['class'] >= UC_STAFF && is_valid_id($_GET['edit']))
{   
$sql mysql_query('SELECT id, text FROM shoutbox WHERE id='.sqlesc($_GET['edit']));
$res mysql_fetch_assoc($sql);
unset(
$sql);

$HTMLOUT .="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Pragma' content='no-cache' />
<meta http-equiv='expires' content='-1' />
<html xmlns='http://www.w3.org/1999/xhtml'>
<meta http-equiv='Content-Type' content='text/html; charset=
{$sb['charset']}' />
<script type='text/javascript' src='./scripts/shout.js'></script>
<style type='text/css'>
#specialbox{
border: 1px solid gray;
width: 600px;
background: #FBFCFA;
font: 11px verdana, sans-serif;
color: #000000;
padding: 3px;   outline: none;
}
#specialbox:focus{
border: 1px solid black;
}
.btn {
cursor:pointer;
border:outset 1px #ccc;
background:#999;
color:#666;
font-weight:bold;
padding: 1px 2px;
background: #000000 repeat-x left top;
}
</style>
</head>
<body bgcolor='#F5F4EA' class='date'>
<form method='post' action='./shoutbox.php'>
<input type='hidden' name='id' value='"
.(int)$res['id']."' />
<textarea name='text' rows='3' id='specialbox'>"
.htmlspecialchars($res['text'])."</textarea>
<input type='submit' name='save' value='save' class='btn' />
</form></body></html>"
;
print 
$HTMLOUT;
die;
}

// Power Users+ can edit anyones single shouts //== pdq
if (isset($_GET['edit']) && ($_GET['user'] == $CURUSER['id']) && ($CURUSER['class'] >= UC_POWER_USER && $CURUSER['class'] <= UC_STAFF) && is_valid_id($_GET['edit']))
{   
$sql mysql_query('SELECT id, text, userid FROM shoutbox WHERE userid ='.sqlesc($_GET['user']).' AND id='.sqlesc($_GET['edit']));
$res mysql_fetch_array($sql);
$HTMLOUT .="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Pragma' content='no-cache' />
<meta http-equiv='expires' content='-1' />
<html xmlns='http://www.w3.org/1999/xhtml'>
<meta http-equiv='Content-Type' content='text/html; charset=
{$sb['charset']}' />
<script type='text/javascript' src='./scripts/shout.js'></script>
<style type='text/css'>
.specialbox{
border: 1px solid gray;
width: 600px;
background: #FBFCFA;
font: 11px verdana, sans-serif;
color: #000000;
padding: 3px;   outline: none;
}
.specialbox:focus{
border: 1px solid black;
}
.btn {
cursor:pointer;
border:outset 1px #ccc;
background:#999;
color:#666;
font-weight:bold;
padding: 1px 2px;
background: #000000 repeat-x left top;
}
</style>
</head>
<body bgcolor='#F5F4EA' class='date'>
<form method='post' action='./shoutbox.php'>
<input type='hidden' name='id' value='"
.(int)$res['id']."' />
<input type='hidden' name='user' value='"
.(int)$res['userid']."' />
<textarea name='text' rows='3' id='specialbox'>"
.htmlspecialchars($res['text'])."</textarea>
<input type='submit' name='save' value='save' class='btn' />
</form></body></html>"
;
print 
$HTMLOUT;
die;
}

// Staff shout edit
if (isset($_POST['text']) && $CURUSER['class'] >= UC_STAFF && is_valid_id($_POST['id']))
{
require_once(
INCL_DIR.'bbcode_functions.php');
$text trim($_POST['text']);
$text_parsed format_comment($text);
mysql_query('UPDATE shoutbox SET text = '.sqlesc($text).', text_parsed = '.sqlesc($text_parsed).' WHERE id='.sqlesc($_POST['id']));
unset(
$text$text_parsed);
}
// Power User+ shout edit //==pdq
if (isset($_POST['text']) && (isset($_POST['user']) == $CURUSER['id']) && ($CURUSER['class'] >= UC_POWER_USER && $CURUSER['class'] < UC_STAFF) && is_valid_id($_POST['id']))
{
require_once(
INCL_DIR.'bbcode_functions.php');
$text trim($_POST['text']);
$text_parsed format_comment($text);
mysql_query('UPDATE shoutbox SET text = '.sqlesc($text).', text_parsed = '.sqlesc($text_parsed).' WHERE userid='.sqlesc($_POST['user']).' AND id='.sqlesc($_POST['id']));
unset(
$text$text_parsed);
}

//== begin main output
$HTMLOUT .="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>ShoutBox</title>
<meta http-equiv='REFRESH' content='60; URL=./shoutbox.php' />
<script type='text/javascript' src='./scripts/shout.js'></script>
<meta http-equiv='Content-Type' content='text/html; charset=
{$sb['charset']}' />
<style type='text/css'>
A {color: #356AA0; font-weight: bold; font-size: 9pt; }
A:hover {color: #FF0000;}
.small {color: #ff0000; font-size: 9pt; font-family: arial; }
.date {color: #ff0000; font-size: 9pt;}
.error {
 color: #990000;
 background-color: #FFF0F0;
 padding: 7px;
 margin-top: 5px;
 margin-bottom: 10px;
 border: 1px dashed #990000;
}
A {color: #FFFFFF; font-weight: bold; }
A:hover {color: #FFFFFF;}
.small {font-size: 10pt; font-family: arial; }
.date {font-size: 8pt;}
span.size1 { font-size:0.75em; }
span.size2 { font-size:1em; }
span.size3 { font-size:1.25em; }
span.size4 { font-size:1.5em; }
span.size5 { font-size:1.75em; }
span.size6 { font-size:2em; }
span.size7 { font-size:2.25em; }
</style>"
;
//==Background colours begin
//== White
if ( $CURUSER['shoutboxbg'] == ) {
$HTMLOUT .="<style type='text/css'>
A {color: #000000; font-weight: bold;  }
A:hover {color: #FF273D;}
.small {font-size: 10pt; font-family: arial; }
.date {font-size: 8pt;}
</style>"
;
$bg '#ffffff';
$fontcolor '#000000';
$dtcolor '#356AA0';
}
// == Grey
if ( $CURUSER['shoutboxbg'] == ) {
$HTMLOUT .="<style type='text/css'>
A {color: #ffffff; font-weight: bold;  }
A:hover {color: #FF273D;}
.small {font-size: 10pt; font-family: arial; }
.date {font-size: 8pt;}
</style>"
;
$bg '#777777';
$fontcolor '#000000';
$dtcolor '#FFFFFF';
}
// == Black
if ( $CURUSER['shoutboxbg'] == ) {
$HTMLOUT .="<style type='text/css'>
A {color: #FFFFFF; font-weight: bold; ; }
A:hover {color: #FFFFFF;}
.small {font-size: 10pt; font-family: arial; }
.date {font-size: 8pt;}
</style>"
;
$bg '#1f1f1f';
$fontcolor '#FFFFFF';
$dtcolor '#FFFFFF';
}
$HTMLOUT .="</head><body>";
//== Banned from shout ??
if ($CURUSER['chatpost'] == 0|| $CURUSER['chatpost'] > 1)
{
$HTMLOUT .="<div class='error' align='center'><br /><font color='red'>Sorry, you are not authorized to Shout.</font>  (<a href=\"./rules.php\" target=\"_blank\"><font color='red'>Contact Site Admin For The Reason Why</font></a>)<br /><br /></div></body></html>"
print 
$HTMLOUT;
exit;
}
//=End
if ( isset( $_GET['sent'] ) && ( $_GET['sent'] == "yes" ) ) {
    require_once(
INCL_DIR.'bbcode_functions.php');
    
$limit 5;
    
$userid $CURUSER["id"];
    
$date sqlesctime() );
    
$text = (trim$_GET["shbox_text"] ));
    
$text_parsed format_comment($text);
      
$system_pattern '/(^\/system)\s([\w\W\s]+)/is';
   if(
preg_match($system_pattern,$text,$out) && $CURUSER["class"] >= UC_STAFF)
   {
      
$userid $TBDEV['bot_id'];
      
$text $out[2];
      
$text_parsed format_comment($text);
   }
    
// ///////////////////////shoutbox command system by putyn /////////////////////////////
    
$commands = array( "\/EMPTY""\/GAG""\/UNGAG""\/WARN""\/UNWARN""\/DISABLE""\/ENABLE" ); // this / was replaced with \/ to work with the regex
    
$pattern "/(" implode"|"$commands ) . "\w+)\s([a-zA-Z0-9_:\s(?i)]+)/";
     
//== private mode by putyn
     
$private_pattern "/(^\/private)\s([a-zA-Z0-9]+)\s([\w\W\s]+)/";
    if (
preg_match$pattern$text$vars ) && $CURUSER["class"] >= UC_STAFF) {
        
$command $vars[1];
        
$user $vars[2];
        
$c mysql_query"SELECT id, class, modcomment FROM users where username=" sqlesc$user ) ) or sqlerr();
        
$a mysql_fetch_row$c );
        if ( 
mysql_num_rows$c ) == && $CURUSER["class"] > $a[1] ) {
            switch ( 
$command ) {
                case 
"/EMPTY" :
                    
$what 'deleted all shouts';
                    
$msg "[b]" $user "'s[/b] shouts have been deleted";
                    
$query "DELETE FROM shoutbox where userid = " $a[0];
                    break;
                case 
"/GAG" :
                    
$what 'gagged';
                    
$modcomment get_datetime(), 'DATE') . " - [ShoutBox] User has been gagged by " $CURUSER["username"] . "\n" $a[2];
                    
$msg "[b]" $user "[/b] - has been gagged by " $CURUSER["username"];
                    
$query "UPDATE users SET chatpost='0', modcomment = concat(" sqlesc$modcomment ) . ", modcomment) WHERE id = " $a[0];
                    break;
                case 
"/UNGAG" :
                    
$what 'ungagged';
                    
$modcomment get_datetime(), 'DATE') . " - [ShoutBox] User has been ungagged by " $CURUSER["username"] . "\n" $a[2];
                    
$msg "[b]" $user "[/b] - has been ungagged by " $CURUSER["username"];
                    
$query "UPDATE users SET chatpost='1', modcomment = concat(" sqlesc$modcomment ) . ", modcomment) WHERE id = " $a[0];
                    break;
                case 
"/WARN" :
                    
$what 'warned';
                    
$modcomment get_datetime(), 'DATE') . " - [ShoutBox] User has been warned by " $CURUSER["username"] . "\n" $a[2];
                    
$msg "[b]" $user "[/b] - has been warned by " $CURUSER["username"];
                    
$query "UPDATE users SET warned='1', modcomment = concat(" sqlesc$modcomment ) . ", modcomment) WHERE id = " $a[0];
                    break;
                case 
"/UNWARN" :
                    
$what 'unwarned';
                    
$modcomment get_datetime(), 'DATE') . " - [ShoutBox] User has been unwarned by " $CURUSER["username"] . "\n" $a[2];
                    
$msg "[b]" $user "[/b] - warning removed by " $CURUSER["username"];
                    
$query "UPDATE users SET warned='0', modcomment = concat(" sqlesc$modcomment ) . ", modcomment) WHERE id = " $a[0];
                    break;
                case 
"/DISABLE" :
                    
$what 'disabled';
                    
$modcomment get_datetime(), 'DATE') . " - [ShoutBox] User has been disabled by " $CURUSER["username"] . "\n" $a[2];
                    
$msg "[b]" $user "[/b] - has been disabled by " $CURUSER["username"];
                    
$query "UPDATE users SET enabled='no', modcomment = concat(" sqlesc$modcomment ) . ", modcomment) WHERE id = " $a[0];
                    break;
                case 
"/ENABLE" :
                    
$what 'enabled';
                    
$modcomment get_datetime(), 'DATE') . " - [ShoutBox] User has been enabled by " $CURUSER["username"] . "\n" $a[2];
                    
$msg "[b]" $user "[/b] - has been enabled by " $CURUSER["username"];
                    
$query "UPDATE users SET enabled='yes', modcomment = concat(" sqlesc$modcomment ) . ", modcomment) WHERE id = " $a[0];
                    break;
            }
            if ( 
mysql_query$query ) )
                
autoshout($msg);
            
$HTMLOUT .="<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";
            
write_log("Shoutbox user " $user " has been " $what " by " $CURUSER["username"] );
            unset(
$text$text_parsed$query$date$modcomment$what$msg$commands);
        }
    }
     elseif(
preg_match($private_pattern,$text,$vars)) {
      
$to_user mysql_result(mysql_query('select id from users WHERE username = '.sqlesc($vars[2])),0) or exit(mysql_error());
      if(
$to_user != && $to_user != $CURUSER['id']) {
         
$text $vars[2]." - ".$vars[3];
         
$text_parsed format_comment($text);
         
mysql_query"INSERT INTO shoutbox (userid, date, text, text_parsed,to_user) VALUES (".sqlesc($userid).", $date, " sqlesc$text ) . ",".sqlesc$text_parsed) .",".sqlesc($to_user).")") or sqlerr__FILE____LINE__ );
      }      
        
$HTMLOUT .="<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";
   } else {
        
$a mysql_fetch_rowmysql_query"SELECT userid,date FROM shoutbox ORDER by id DESC LIMIT 1 " ) ) or print( "First shout or an error" );
        if ( empty( 
$text ) || strlen$text ) == )
            
$HTMLOUT .="<font class=\"small\" color=\"red\">Shout can't be empty</font>";
        elseif ( 
$a[0] == $userid && ( time() - $a[1] ) < $limit && $CURUSER['class'] < UC_STAFF )
            
$HTMLOUT .="<font class=\"small\" color=\"red\">$limit seconds between shouts <font class=\"small\">Seconds Remaining : (" . ( $limit - ( time() - $a[1] ) ) . ")</font></font>";
        else {
            
mysql_query"INSERT INTO shoutbox (id, userid, date, text, text_parsed) VALUES ('id'," sqlesc$userid ) . ", $date, " sqlesc$text ) . ",".sqlesc$text_parsed ) .")" ) or sqlerr__FILE____LINE__ );
            
$HTMLOUT .="<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";
        }
    }
}
// //////////////////////

$res mysql_query"SELECT s.id, s.userid, s.date , s.text,s.to_user, u.username, u.pirate, u.king, u.class, u.donor, u.warned, u.leechwarn, u.enabled, u.chatpost, (SELECT count(id) FROM messages WHERE receiver = ".$CURUSER['id']." AND unread = 'yes') as pms FROM shoutbox as s LEFT JOIN users as u ON s.userid=u.id ORDER BY s.date DESC LIMIT 30" ) or sqlerr__FILE____LINE__ );

if ( 
mysql_num_rows$res ) == )
    
$HTMLOUT .="No shouts here";
else {
   
$HTMLOUT .="<table border='0' cellspacing='0' cellpadding='2' width='100%' align='left' class='small'>\n";
      
$gotpm 0;
    while ( 
$arr mysql_fetch_assoc$res ) ) {
         
         if(
$arr['pms'] > && $gotpm == 0){
         
$HTMLOUT .= '<tr><td align=\'center\'><a href=\''.$TBDEV['baseurl'].'/messages.php\' target=\'_parent\'><font color=\'blue\'>You have '.$arr['pms'].' new message'.($arr['pms'] > 's' '').'</font></a></td></tr>';
         
$gotpm++;
   }
   
   if((
$arr['to_user'] != $CURUSER['id'] && $arr['to_user'] != 0) && $arr['userid'] != $CURUSER['id']) 
      continue;
   elseif(
$arr['to_user'] == $CURUSER['id'] || ($arr['userid'] == $CURUSER['id'] && $arr['to_user'] !=0) )
      
$private "<a href=\"javascript:private_reply('".$arr['username']."')\"><img src=\"{$TBDEV['pic_base_url']}private-shout.png\" alt=\"Private shout\" title=\"Private shout! click to reply to ".$arr['username']."\" width=\"16\" style=\"padding-left:2px;padding-right:2px;\" border=\"0\" /></a>";
   else
      
$private '';
        
$edit = ($CURUSER['class'] >= UC_STAFF || ($arr['userid'] == $CURUSER['id']) && ($CURUSER['class'] >= UC_POWER_USER && $CURUSER['class'] <= UC_STAFF) ? "<a href='{$TBDEV['baseurl']}/shoutbox.php?edit=" $arr['id'] . "&amp;user=".$arr['userid']."'><img src='{$TBDEV['pic_base_url']}button_edit2.gif' border='0' alt=\"Edit Shout\"  title=\"Edit Shout\" /></a> " "" );
        
$del = ( $CURUSER['class'] >= UC_STAFF "<a href='./shoutbox.php?del=" $arr['id'] . "'><img src='{$TBDEV['pic_base_url']}button_delete2.gif' border='0' alt=\"Delete Single Shout\" title=\"Delete Single Shout\" /></a> " "" );
        
$delall = ( $CURUSER['class'] >= UC_SYSOP "<a href='./shoutbox.php?delall' onclick=\"confirm_delete(); return false;\"><img src='{$TBDEV['pic_base_url']}del.png' border='0' alt=\"Empty Shout\" title=\"Empty Shout\" /></a> " "" );      
        
$pm "<span class='date' style=\"color:$dtcolor\"><a target='_blank' href='./sendmessage.php?receiver=$arr[userid]'><img src='{$TBDEV['pic_base_url']}button_pm2.gif' border='0' alt=\"Pm User\" title=\"Pm User\" /></a></span>\n";
        
$date get_date($arr["date"], 0,1);
        
$user_stuff $arr;
        
$user_stuff['id'] = $arr['userid'];
        
$HTMLOUT .="<tr style='background-color:$bg;'><td><span class='size1' style='color:$fontcolor; '>[$date]</span>\n$del $delall $edit $pm $private ".format_username($user_stuff)."<span class='size2' style='color:$fontcolor;'> " format_comment$arr["text"] ) . "\n</span></td></tr>\n";
    }
    
$HTMLOUT .="</table>";
}
$HTMLOUT .="</body></html>";
print 
$HTMLOUT;


shoutbox_commands.php :

Code (php) Select
<?php
/**
 *   http://btdev.net:1337/svn/test/Installer09_Beta
 *   Licence Info: GPL
 *   Copyright (C) 2010 BTDev Installer v.1
 *   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
 *   Project Leaders: Mindless,putyn.
 **/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
dbconn(false);   
loggedinorreturn();

$lang array_mergeload_language('global'));

if (
$CURUSER['class'] < UC_MODERATOR)
die();

    
$htmlout '';
    
$htmlout "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
      \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
      <html xmlns='http://www.w3.org/1999/xhtml'>
      <head>
    <meta name='generator' content='TBDev.net' />
     <meta name='MSSmartTagsPreventParsing' content='TRUE' />
      <title>Shoutbox Commands</title>
    <link rel='stylesheet' href='./templates/1/itunes.css' type='text/css' />
    </head>
    <body>
    <script type='text/javascript'>
    function command(command,form,text){
    window.opener.document.forms[form].elements[text].value = window.opener.document.forms[form].elements[text].value+command+' ';
    window.opener.document.forms[form].elements[text].focus();
    window.close();
    }
    </script>
    <table class='list' width='100%' cellpadding='1' cellspacing='1'>
  <tr>
  <td align='center'><b>empty</b>. To use type /EMPTY [username here without the brackets]</td>
   <td align='center'><b>gag</b>. To use type /GAG [username here without the brackets]</td>
   </tr>
   <tr>
   <td align='center'><b><input type='text' size='20' value='/EMPTY' onclick=\"command('/EMPTY','shbox','shbox_text')\" /></b></td>
   <td align='center'><b><input type='text' size='20' value='/GAG' onclick=\"command('/GAG','shbox','shbox_text')\" /></b></td>
   </tr>
  <tr>
   <td align='center'><b>ungag</b>. To use type /UNGAG [username here without the brackets]</td>
   <td align='center'><b>disable</b>. To use type /DISABLE [username here without the brackets]</td>
   </tr>
   <tr>
   <td align='center'><b><input type='text' size='20' value='/UNGAG' onclick=\"command('/UNGAG','shbox','shbox_text')\" /></b></td>
   <td align='center'><b><input type='text' size='20' value='/DISABLE' onclick=\"command('/DISABLE','shbox','shbox_text')\" /></b></td>
   </tr>
   <tr>
   <td align='center'><b>enable</b>. To use type /ENABLE [username here without the brackets]</td>
   <td align='center'><b>warn</b>. To use type /WARN [username here without the brackets]</td>
   </tr>
   <tr>
   <td align='center'><b><input type='text' size='20' value='/ENABLE' onclick=\"command('/ENABLE','shbox','shbox_text')\" /></b></td>
   <td align='center'><b><input type='text' size='20' value='/WARN' onclick=\"command('/WARN','shbox','shbox_text')\" /></b></td>
   </tr>
   <tr>
   <td align='center'><b>unwarn</b>. To use type /UNWARN [username here without the brackets]</td>
  <td align='center'><b>System</b>. To use type /System [text here without the brackets]</td>
   </tr>
   <tr>
   <td align='center'><b><input type='text' size='20' value='/UNWARN' onclick=\"command('/UNWARN','shbox','shbox_text')\" /></b></td>
   <td align='center'><b><input type='text' size='20' value='/System' onclick=\"command('/System','shbox','shbox_text')\" /></b></td>
   </tr>
   <tr>
   <td align='center'><b>private</b>. To use type /private [username here without the brackets] then rest of your text</td>
   </tr>
   <tr>
   <td align='center'><b><input type='text' size='20' value='/private' onclick=\"command('/private','shbox','shbox_text')\" /></b></td>
   </tr></table><br /><div align='center'><a class='altlink' href='javascript: window.close()'><b>[ Close window ]</b></a></div></body></html>"
;
   
print 
$htmlout;





Finally save and shoutbox.php and shoutbox_commands.php to root and 4 attached images to pic folder.
Not sure if the last part for sendmessage.php is correct as it redirects ok back to index when sending from shout but it also does that from inbox as well lol - if anyone spots any stuff then please post so i can update the thread - Again massive thank you to pdq - snuggs and putyn for the main updates to this shoutbox :)



To stop links opening inside shout then you have to alter the default format_url function

Credits to putyn for this mod its posted :)

@ File include/bbcode_functions.php add
Code (php) Select
function islocal($link)
        {
            global $TBDEV;
            $flag = false;
            $baseurl  = str_replace(array('http://','www','http://www'),'',$TBDEV['baseurl']);
            $limit = 60;

            if (false !== stristr($link[0], '[url=')) {
                $url = trim($link[1]);
                $title = trim($link[2]);
                if (false !== stristr($link[2], '[img]')) {
                    $flag = true;
                    $title = preg_replace("/\[img](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "<img src=\"\\1\" alt=\"\" border=\"0\" />", $title);
                }
            } elseif (false !== stristr($link[0], '[url]'))
                $url = $title = trim($link[1]);
            else
                $url = $title = trim($link[2]);

            if (strlen($title) > $limit && $flag == false) {
                $l[0] = substr($title, 0, ($limit / 2));
                $l[1] = substr($title, strlen($title) - round($limit / 3));
                $lshort = $l[0] . "..." . $l[1];
            } else $lshort = $title;
            return " <a href=\"" . ((stristr($url, $baseurl) !== false) ? "" : "http://anonym.to?") . $url . "\" target=\"_blank\">" . $lshort . "</a>";
        }

        function format_urls($s)
        {
            return preg_replace_callback("/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^<>\s]+)/i", "islocal", $s);
        }



Find :
Code (php) Select
// [url=http://www.example.com]Text[/url]
   $s = preg_replace(
      "/\[url=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
      "<a href=\"\\1\">\\2</a>", $s);

   // [url]http://www.example.com[/url]
   $s = preg_replace(
      "/\[url\]([^()<>\s]+?)\[\/url\]/i",
      "<a href=\"\\1\">\\1</a>", $s);



Replace with :
Code (php) Select
// [url=http://www.example.com]Text[/url]
            $s = preg_replace_callback("/\[url=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i", "islocal", $s);
            // [url]http://www.example.com[/url]
            $s = preg_replace_callback("/\[url\]([^()<>\s]+?)\[\/url\]/i", "islocal", $s);



new addition - shouthistory :

Save and upload shistory to /admin folder :
Code (php) Select
<?php
/*
+------------------------------------------------
|   $Date$
|   $Revision$
|   $Author$
|   $URL$
|   $shistory
|   $Bigjoos
+------------------------------------------------
*/
if ( ! defined'IN_TBDEV_ADMIN' ) )
{
   
$HTMLOUT='';
   
$HTMLOUT .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
      \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
      <html xmlns='http://www.w3.org/1999/xhtml'>
      <head>
      <title>Error!</title>
      </head>
      <body>
   <div style='font-size:33px;color:white;background-color:red;text-align:center;'>Incorrect access<br />You cannot access this file directly.</div>
   </body></html>"
;
   print 
$HTMLOUT;
   exit();
}
require_once 
"include/html_functions.php";
require_once 
"include/pager_functions.php";
require_once 
"include/bbcode_functions.php";

$lang array_merge$lang );

if (
$CURUSER["class"] < UC_ADMINISTRATOR)
header"Location: {$TBDEV['baseurl']}/index.php");

$HTMLOUT ="";

// //////////////////////
$count1 get_row_count('shoutbox');
$perpage 15;
$pager pager($perpage$count1'admin.php?action=shistory&');


$res mysql_query"SELECT s.id, s.userid, s.date, s.text, s.to_user, u.username, u.enabled, u.class, u.donor, u.warned, u.chatpost FROM shoutbox as s LEFT JOIN users as u ON s.userid=u.id ORDER BY s.date DESC ".$pager['limit']."" ) or sqlerr__FILE____LINE__ );

if (
$count1 $perpage)
$HTMLOUT .= $pager['pagertop'];

$HTMLOUT .= begin_main_frame();

  if ( 
mysql_num_rows$res ) == )
  
$HTMLOUT .="No shouts here";
  else {
  
$HTMLOUT .="<table align='center' border='0' cellspacing='0' cellpadding='2' width='100%' class='small'>\n";
  while ( 
$arr mysql_fetch_assoc$res ) ) {
  if((
$arr['to_user'] != $CURUSER['id'] && $arr['to_user'] != 0) && $arr['userid'] != $CURUSER['id']) 
  continue;
   if(
$arr['to_user'] == $CURUSER['id'] || ($arr['userid'] == $CURUSER['id'] && $arr['to_user'] !=0) )
   
$private "<img src='{$TBDEV['pic_base_url']}private-shout.png' alt='Private shout' title='Private shout!' width='16' style='padding-left:2px;padding-right:2px;' border='0' />";
   else
   
$private "<img src='{$TBDEV['pic_base_url']}group.png' alt='Public shout' title='Public shout!' width='16' style='padding-left:2px;padding-right:2px;' border='0' />";
  
$date get_date($arr["date"], 0,1);
  
$HTMLOUT .="<tr style='background-color:grey;'><td><span class='size1' style='color:white; '>[$date] [$private]</span>\n <a href='userdetails.php?id=" $arr["userid"] . "' target='_blank'><font color='#" get_user_class_color$arr['class'] ) . "'>" htmlspecialchars$arr['username'] ) . "</font></a><span class='size2' style='color:white;'> " format_comment$arr["text"] ) . "\n</span></td></tr>\n";
  }
  
$HTMLOUT .="</table>";
  }

if (
$count1 $perpage)
$HTMLOUT .= $pager['pagerbottom'];

$HTMLOUT .= end_main_frame();

print 
stdhead('Shout History') . $HTMLOUT stdfoot();
?>



The above will filter out private shouts that are not your own :)

@ file admin/index.php add :
Code (php) Select
<span class='btn'><a href='admin.php?action=shistory'>{$lang['index_shout_history']}</a></span>


@file admin.php add :
Code (php) Select
'shistory'  => 'shistory',


@ file lang/en/lang_ad_index.php add :
Code (php) Select
'index_shout_history' => 'Shout History',
[attachment deleted by admin]