Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   what im looking for is a staffshoutbox (http://www.bvlist.com/showthread.php?t=4433)

xDev 5th February 2010 11:15

what im looking for is a staffshoutbox
 
hello anyone out there have a staff shoutbox for tbv code please post here with php code and stuff please:drink:

Fynnon 5th February 2010 12:00

7 Attachment(s)
Quote:

Shoutbox - 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'.

First run all this sql :

PHP Code:

CREATE TABLE `shoutbox` (
  `
idbigint(10NOT NULL auto_increment,
  `
useridbigint(6NOT NULL default '0',
  `
to_userint(10NOT NULL default '0',
  `
usernamevarchar(25NOT NULL default '',
  `
dateint(11NOT NULL default '0',
  `
texttext NOT NULL,
  `
text_parsedtext NOT NULL,
  
PRIMARY KEY  (`id`),
  
KEY `for` (`to_user`)
ENGINE=MyISAM  DEFAULT CHARSET=utf8

PHP Code:

ALTER TABLE users ADD `show_shoutenum('yes','no'character set utf8 collate utf8_bin NOT NULL default 'yes';
ALTER TABLE users ADD `chatpostenum('yes','no'character set utf8 collate utf8_bin NOT NULL default 'yes';
ALTER TABLE users ADD `shoutboxbgenum('1','2','3'character set utf8 collate utf8_bin NOT NULL default '1'

@ file include/user_functions.php if you dont have it

PHP Code:

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.
PHP Code:

function autoshout($msg '')
{
    
$message $msg;
    
mysql_query("INSERT INTO shoutbox (date, text, userid, username) VALUES (" implode(", "array_map("sqlesc", array(time(), $message'2''System'))) . ")") or sqlerr(__FILE____LINE__);





@ file include/cleanup.php add:

PHP Code:

$secs 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 :

PHP Code:

$HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_chatpos']}</td><td colspan='2' align='left'><input type='radio' name='chatpost' value='yes'" .($user["chatpost"] == "yes" " checked='checked'" "")." />{$lang['userdetails_yes']} <input type='radio' name='chatpost' value='no'" .($user["chatpost"] == "no" " checked='checked'" "")." />{$lang['userdetails_no']}</td></tr>\n"




@ file lang/en/lang_userdetails.php add :

PHP Code:

'userdetails_chatpos' => "Chat possible"




@ file modtask.php

PHP Code:

 // === Enable / Disable chat box rights
    
if ((isset($_POST['chatpost'])) && (($chatpost $_POST['chatpost']) != $user['chatpost'])) {
        
$modcomment get_datetime(), 'DATE') . {$lang['modtask_chatpos']} " sqlesc($chatpost) .
            
{$lang['modtask_by']} " $CURUSER['username'] . ".\n" $modcomment;
        
$updateset[] = "chatpost = " sqlesc($chatpost);
    } 

@ file lang/en/lang_modtask.php add

PHP Code:

'modtask_chatpos' => "- Chat post rights set to"




@ file my.php add this where you want :

PHP Code:

$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 :

PHP Code:

$shoutboxbg $_POST["shoutboxbg"];
    
$updateset[] = "shoutboxbg = " sqlesc($shoutboxbg); 




@ file lang/en/lang_my.php add :

PHP Code:

'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 :


PHP Code:

   // === TBDev 2010 Shoutbox 
   
if ($CURUSER['show_shout'] === "yes") {
   
$commandbutton '';
   
$refreshbutton '';
   
$smilebutton '';
   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 style='text-align:left;width:80%;border:1px solid blue;padding:5px;'><div style='background:lightgrey;height:25px;'><span style='font-weight:bold;font-size:12pt;'>
{$lang['index_shout']}</span></div>
   <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/>
   <div align='center'>
   <b>
{$lang['index_shoutbox_shout']}</b>
   <script type=\"text/javascript\" src=\"scripts/shout.js\"></script> 
   <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' />
   
     <a href=\"javascript:SmileIT(':-)','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/smile1.gif' alt='Smile' title='Smile' /></a> 
   <a href=\"javascript:SmileIT(':smile:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/smile2.gif' alt='Smiling' title='Smiling' /></a> 
   <a href=\"javascript:SmileIT(':-D','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/grin.gif' alt='Grin' title='Grin' /></a> 
   <a href=\"javascript:SmileIT(':lol:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/laugh.gif' alt='Laughing' title='Laughing' /></a> 
   <a href=\"javascript:SmileIT(':w00t:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/w00t.gif' alt='W00t' title='W00t' /></a> 
   <a href=\"javascript:SmileIT(':blum:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/blum.gif' alt='Rasp' title='Rasp' /></a> 
   <a href=\"javascript:SmileIT(';-)','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/wink.gif' alt='Wink' title='Wink' /></a> 
   <a href=\"javascript:SmileIT(':devil:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/devil.gif' alt='Devil' title='Devil' /></a> 
   <a href=\"javascript:SmileIT(':yawn:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/yawn.gif' alt='Yawn' title='Yawn' /></a> 
   <a href=\"javascript:SmileIT(':-/','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/confused.gif' alt='Confused' title='Confused' /></a> 
   <a href=\"javascript:SmileIT(':o)','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/clown.gif' alt='Clown' title='Clown' /></a> 
   <a href=\"javascript:SmileIT(':innocent:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/innocent.gif' alt='Innocent' title='innocent' /></a> 
   <a href=\"javascript:SmileIT(':whistle:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/whistle.gif' alt='Whistle' title='Whistle' /></a> 
   <a href=\"javascript:SmileIT(':unsure:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/unsure.gif' alt='Unsure' title='Unsure' /></a> 
   <a href=\"javascript:SmileIT(':blush:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/blush.gif' alt='Blush' title='Blush' /></a> 
   <a href=\"javascript:SmileIT(':hmm:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/hmm.gif' alt='Hmm' title='Hmm' /></a> 
   <a href=\"javascript:SmileIT(':hmmm:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/hmmm.gif' alt='Hmmm' title='Hmmm' /></a> 
   <a href=\"javascript:SmileIT(':huh:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/huh.gif' alt='Huh' title='Huh' /></a> 
   <a href=\"javascript:SmileIT(':look:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/look.gif' alt='Look' title='Look' /></a> 
   <a href=\"javascript:SmileIT(':rolleyes:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/rolleyes.gif' alt='Roll Eyes' title='Roll Eyes' /></a> 
   <a href=\"javascript:SmileIT(':kiss:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/kiss.gif' alt='Kiss' title='Kiss' /></a> 
   <a href=\"javascript:SmileIT(':blink:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/blink.gif' alt='Blink' title='Blink' /></a> 
   <a href=\"javascript:SmileIT(':baby:','shbox','shbox_text')\"><img border='0' src='
{$TBDEV['baseurl']}/pic/smilies/baby.gif' alt='Baby' title='Baby' /></a><br/>
     <div style='background:lightgrey;height:25px;'><span style='font-weight:bold;font-size:8pt;'>
{$refreshbutton}</span></div>
   <div style='background:lightgrey;height:25px;'><span style='font-weight:bold;font-size:8pt;'>
{$smilebutton}</span></div>
   <div style='background:lightgrey;height:25px;'><span style='font-weight:bold;font-size:8pt;'>
{$commandbutton}</span></div>
   </div>
    
     </div>
   \n"
;
   }
   if (
$CURUSER['show_shout'] === "no") {
   
$HTMLOUT .="<div style='text-align:left;width:80%;border:1px solid blue;padding:5px;'><div style='background:lightgrey;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>";
   }
   
//==end 2010 shoutbox 





@ file lang/en/lang_index.php add :

PHP Code:

'index_shoutbox_refresh'    => "[ Refresh ]",
'index_shoutbox_commands'    => "[ Commands ]",
'index_shoutbox_smilies'    => "[ More 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 :


PHP Code:

if ($_SERVER["HTTP_REFERER"] ) 
      { 
        
$HTMLOUT .= "<input type='hidden' name='returnto' value='{$_SERVER["HTTP_REFERER"]}' />";
      }[/
code]      change to
      
      
[code]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 :

PHP Code:

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();





@ file takeupload.php find :

PHP Code:

$id mysql_insert_id(); 

Under it add :

PHP Code:

$message "New Torrent : }/details.php?id=$id] " htmlspecialchars($torrent) . " Uploaded by " htmlspecialchars($CURUSER["username"]) . ""

If you use anonymous uploader use this :
PHP Code:

if ($CURUSER["anonymous"] == 'yes')
    
$message "New Torrent : }/details.php?id=$id] " htmlspecialchars($torrent) . " Uploaded - Anonymous User";
    else
    
$message "New Torrent : }/details.php?id=$id] " htmlspecialchars($torrent) . " Uploaded by " htmlspecialchars($CURUSER["username"]) . ""

Find :
PHP Code:

write_log(sprintf($lang['takeupload_log'], $id$torrent$CURUSER['username'])); 

Under it add :
PHP Code:

autoshout($message); 



@file takesignup.php under the main query :

PHP Code:

$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 :
PHP Code:

$message "Welcome New {$TBDEV['site_name']} Member : - " htmlspecialchars($wantusername) . ""



Find :

PHP Code:

$psecret md5($editsecret); 




Under it add :

PHP Code:

autoshout($message); 

Finally upload the attached shoutbox.php and shoutbox_commands.php to root and 4 attached images to pic folder.


MOD from TBDev: Board Message

xDev 5th February 2010 13:54

thank you fynnon:drink:


All times are GMT +2. The time now is 00:19.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.