Bravo List
Register
Go Back   > Bravo List > Sourcecode > TBDev > Mods & Themes
Reply
  #1  
Old 12-03-08, 15:54
Fynnon's Avatar
Fynnon Fynnon is offline
xxx
 
Join Date: Nov 2007
P2P
Posts: 958
Default Shoutbox
This a modified version of Hanne's shoutbox

Changes:

autorefresh - 3minutes
bbcode support
only latest 70 shouts are shown
blank post will not be posted (but post with a space " " will be added )


Click image for larger version

Name:	shoutbox.gif
Views:	1267
Size:	9.2 KB
ID:	903

SQL for shoutbox:.
Code:
CREATE TABLE `shoutbox` (
`id` smallint(6) NOT NULL auto_increment,
`userid` smallint(6) NOT NULL default '0',
`username` varchar(25) NOT NULL default '',
`date` int(11) NOT NULL default '0',
`text` text NOT NULL,
PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;
in global.php above
Code:
  //-------- Begins a main frame

  function begin_main_frame()
add this
Code:
function textbbcode($form,$name,$content="") {
?>

<script language=javascript>
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 PopMoreTags(form,name) {
         link='moretags.php?form='+form+'&text='+name
         newWin=window.open(link,'moresmile','height=500,width=775,resizable=no,scrollbars=yes');
         if (window.focus) {newWin.focus()}
}


function BBTag(tag,s,text,form){
switch(tag)
    {
    case '";
           document.forms[form].elements[s].value="QUOTE ";
           }
        break;
    case '[img]':
    if (document.forms[form].elements[s].value=="IMG ")
       {
        document.forms[form].elements[text].value = document.forms[form].elements[text].value+"[img]";
        document.forms[form].elements[s].value="IMG*";
        }
       else
           {
           document.forms[form].elements[text].value = document.forms[form].elements[text].value+"[/img]";
           document.forms[form].elements[s].value="IMG ";
           }
        break;
    case '[url="http://':%20%20%20%20if%20(document.forms%5bform%5d.elements%5bs%5d.value=="URL%20")%20%20%20%20%20%20%20{%20%20%20%20%20%20%20%20document.forms%5bform%5d.elements%5btext%5d.value%20=%20document.forms%5bform%5d.elements%5btext%5d.value+"%5burl%5d";%20%20%20%20%20%20%20%20document.forms%5bform%5d.elements%5bs%5d.value="URL*";%20%20%20%20%20%20%20%20}%20%20%20%20%20%20%20else%20%20%20%20%20%20%20%20%20%20%20{%20%20%20%20%20%20%20%20%20%20%20document.forms%5bform%5d.elements%5btext%5d.value%20=%20document.forms%5bform%5d.elements%5btext%5d.value+""]':
    if (document.forms[form].elements[s].value=="URL ")
       {
        document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
        document.forms[form].elements[s].value="URL*";
        }
       else
           {
           document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
           document.forms[form].elements[s].value="URL ";
           }
        break;
    case '[*]':
    if (document.forms[form].elements[s].value=="List ")
       {
        document.forms[form].elements[text].value = document.forms[form].elements[text].value+"[*]";
        }
        break;
    case '[b]':
    if (document.forms[form].elements[s].value=="B ")
       {
        document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
        document.forms[form].elements[s].value="B*";
        }
       else
           {
           document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
           document.forms[form].elements[s].value="B ";
           }
        break;
    case '[i]':
    if (document.forms[form].elements[s].value=="I ")
       {
        document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
        document.forms[form].elements[s].value="I*";
        }
       else
           {
           document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
           document.forms[form].elements[s].value="I ";
           }
        break;
    case '[u]':
    if (document.forms[form].elements[s].value=="U ")
       {
        document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
        document.forms[form].elements[s].value="U*";
        }
       else
           {
           document.forms[form].elements[text].value = document.forms[form].elements[text].value+"";
           document.forms[form].elements[s].value="U ";
           }
        break;
    }
    document.forms[form].elements[text].focus();
}

</script>

  <table width="100%" style='margin: 3px' cellpadding="0" cellspacing="0">
    <tr>
      <td class=embedded colspan=2>
      <table cellpadding="2" cellspacing="1">
      <tr>
      <td class=embedded><input style="font-weight: bold;" type="button" name="bold" value="B " onclick="java script: BBTag('[b]','bold','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded><input style="font-style: italic;" type="button" name="italic" value="I " onclick="java script: BBTag('[i]','italic','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded><input style="text-decoration: underline;" type="button" name="underline" value="U " onclick="java script: BBTag('[u]','underline','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded><input type="button" name="li" value="List " onclick="java script: BBTag('[*]','li','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded><input type="button" name="quote" value="QUOTE " onclick="java script: BBTag('[quote]','quote','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded><input type="button" name="url" value="URL " onclick="java script: BBTag('[url]','url','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded><input type="button" name="img" value="IMG " onclick="java script: BBTag('[img]','img','<? echo $name; ?>','<? echo $form; ?>')" /></td>
      <td class=embedded>*<? echo MORE_TAGS;?></td>
      </tr>
      </table>
      </td>
    </tr>
    <tr>
      <td class=embedded>
      <textarea name="<? echo $name; ?>" rows="15" cols="80"><? echo $content; ?></textarea>
      </td>
      <td class=embedded>
      <table cellpadding="3" cellspacing="1">
      <?

      global $smilies, $BASEURL;
      while ((list($code, $url) = each($smilies)) && $count<20) {
         if ($count % 4==0)
            print("<tr>");

            print("\n<td class=embedded style='padding: 3px; margin: 2px'><a href=\"java script: SmileIT('".str_replace("'","\'",$code)."','$form','$name')\"><img border=0 src=pic/smilies/".$url."></a></td>");
            $count++;

         if ($count % 4==0)
            print("</tr>");
      }
      ?>
      </table>
      <center><? echo MORE_SMILES;?></center>
      </td>
    </tr>
  </table>
<?
}
Add this code in index.php.. (i added it just below the News section)
Code:
//// Shoutbox 
 print("<h2>Shoutbox:.");

print("<table width='100%' border='1' cellspacing='0' cellpadding='1'><tr><td class=text>\n");
print("<iframe src='shoutbox.php' width='100%' height='80' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe>

\n");
print("<form action='shoutbox.php' method='get' target='sbox' name='shbox' onSubmit=\"mySubmit()\">\n");
print("<center>Message: <input type='text' maxlength=140 name='shbox_text' size='100'>  <input type='submit' value='Post it'> <input type='hidden' name='sent' value='yes'>\n");
print("</td></tr></table></form>");
////
but remember.. all the bbcodes will work on the shoubox.. it will look a bit wierd if people shout images, quote etc.. i did this to enable smilie support..
If anyone can write some code for not including tags like [img], etc.. that would be great :D

save the attached shoutbox.php from the shoutbox.rar to your site root.


ashkarkm@tbdev.net
http://www.tbdev.net/index.php?showtopic=4011&hl=
Attached Files
File Type: rar shoutbox.rar (1.4 KB, 929 views)
Reply With Quote
The Following 3 Users Say Thank You to Fynnon For This Useful Post:
al-jodtv (19-02-10), Fanatic07 (21-06-10), GuldlocK (27-12-11)
  #2  
Old 12-03-08, 16:36
Sharp's Avatar
Sharp Sharp is offline
Member
 
Join Date: Mar 2008
Posts: 1
Default Re: Shoutbox
Coool!!!
Reply With Quote
  #3  
Old 07-08-08, 23:25
NatashaRhea's Avatar
NatashaRhea NatashaRhea is offline
Senior Member
 
Join Date: Aug 2008
Posts: 48
Default
worked like a charm many thanks
Reply With Quote
  #4  
Old 01-11-09, 22:56
evaldas40's Avatar
evaldas40 evaldas40 is offline
Senior Member
 
Join Date: Jun 2009
Lithuania
Posts: 67
Default
did this mod work on YSE pre 6 ? :)
Reply With Quote
  #5  
Old 03-12-09, 18:54
mondolfo's Avatar
mondolfo mondolfo is offline
Senior Member
 
Join Date: Nov 2009
P2P
Posts: 18
Default
no not work
Reply With Quote
  #6  
Old 04-12-09, 23:39
RaZoRandrey's Avatar
RaZoRandrey RaZoRandrey is offline
Member
 
Join Date: May 2009
P2P
Posts: 8
Default
is working, thanks for this
Reply With Quote
  #7  
Old 28-02-10, 08:42
al-jodtv's Avatar
al-jodtv al-jodtv is offline
Member
 
Join Date: Jun 2009
Egypt
Posts: 9
Default
thanks for this
Reply With Quote
  #8  
Old 16-04-10, 20:27
djblackout's Avatar
djblackout djblackout is offline
Senior Member
 
Join Date: Aug 2009
Denmark
Posts: 51
Default hmm
i cant get this to work in my global.php looks like this

PHP Code:
//-------- Begins a main frame

  
function begin_main_frame() 
where to put that in this

i dont have global.php :S
Attached Files
File Type: php lang_global.php (1.1 KB, 60 views)
Reply With Quote
  #9  
Old 17-05-10, 17:33
Ecko's Avatar
Ecko Ecko is offline
Senior Member
 
Join Date: Apr 2010
Egypt
Posts: 32
Default
Quote:
Originally Posted by djblackout View Post
i cant get this to work in my global.php looks like this

PHP Code:
//-------- Begins a main frame

  
function begin_main_frame() 
where to put that in this

i dont have global.php :S

me to i dont have it
Reply With Quote
  #10  
Old 18-05-10, 07:48
Undefined's Avatar
Undefined Undefined is offline
Senior Member
 
Join Date: Jan 2009
Default
Posts: 27
Default
try html_functions then :)
Reply With Quote
Reply

Tags
shoutbox

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TorrentStrike theme engine to TBdev Kotafi Mods & Themes 6 13-05-12 04:42
Need a shoutbox on ySE pre 6 evaldas40 YSE 1 02-11-09 01:44
Shoutbox.php makaka123 YSE 0 25-07-09 18:32
Shoutbox & Bot kp380lv YSE 3 13-06-08 16:57



All times are GMT +2. The time now is 14:10. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2017, vBulletin Solutions Inc.