News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF Shoutbox

Started by Deep, March 15, 2006, 08:09:52 AM

Previous topic - Next topic

willtaka

Hi have followed all the instructions but I still get the following error:

<?
require("../SSI.php");

if (!defined('SMF'))
   die('Hacking attempt...');

// global variables
global $db_connection, $context, $settings, $txt, $user_info, $modSettings, $db_prefix;

// used in test scenario
//@mysql_select_db($db_name, $db_connection);

//display html header
echo '<html xmlns="http://www.w3.org/1999/xhtml"' [nofollow];, $context['right_to_left'] ? ' dir="rtl"' : '', '>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
   <meta name="description" content="Shoutbox" />
   <meta name="keywords" content="Shoutbox" />
   <title>Shoutbox</title>
   <meta http-equiv="refresh" content="'.$modSettings['sbox_RefreshTime'].';URL=sboxDB.php">
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?rc2" />
   <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
      function killYesNo()
      {
         return confirm("'.$txt['sbox_KillShout'].'");
         
      }
   // ]]></script>

   <style type="text/css"><!-- // --><![CDATA[
   <!--
      .Kill
      {
         color: #ff0000;
      }
      .OddLine
      {
         font-family: '.$modSettings['sbox_FontFamily1'].';
         font-style: normal;
         font-size: '.$modSettings['sbox_TextSize1'].';
         font-weight: normal;
         color: '.$modSettings['sbox_TextColor1'].';
      }
      .EvenLine
      {
         font-family: '.$modSettings['sbox_FontFamily2'].';
         font-style: normal;
         font-size: '.$modSettings['sbox_TextSize2'].';
         font-weight: normal;
         color: '.$modSettings['sbox_TextColor2'].';
      }
      body
      {
         padding: 0px 0px 0px 0px;
         background-color: '.$modSettings['sbox_BackgroundColor'].';
      }
      a:link
      {
         color: #ff0000;
         text-decoration: none;
      }
      //-->
   // ]]></style>';


switch ($_REQUEST['action'])
{

   case "write":
      if  ((!$context['user']['is_guest']) || ($modSettings['sbox_GuestAllowed'] == "1"))
      {
         // empty messages are not allowed
         $content=$_REQUEST['sboxText'];
         if(chop($content."") != "")
         {
            // get actual weekday
            $days = array($txt['sbox_Sunday'],$txt['sbox_Monday'],$txt['sbox_Tuesday'],$txt['sbox_Wednesday'],$txt['sbox_Thurday'],$txt['sbox_Friday'],$txt['sbox_Saturday']);
            $day=$days[date("w")];         // weekday
            $date=$day." | ". date("G:i");   // time
         
            // handle spacial characters
            $content=addslashes($content);
         
            // insert shout message into database
            $sql = "insert into ".$db_prefix."sbox_content (name,content,time) values ('".$user_info['username']."','".$content."','$date')";
            db_query($sql,__FILE__,__LINE__);
         
            // delete old shout messages (get id of last shouting and delete all shoutings as defined in settings
            $result = db_query("select id from ".$db_prefix."sbox_content where name='".$user_info['username']."' and content='".$content."' and time='$date'",__FILE__,__LINE__);
            $rows = mysql_fetch_assoc($result) ;
            $sql = "delete from ".$db_prefix."sbox_content where id < '".($rows["id"]-$modSettings['sbox_MaxLines'])."'";
            db_query($sql,__FILE__,__LINE__);
         }
      }
      break;
   case "kill":
      if  ($context['user']['is_admin'])
      {
         $id = "".$_REQUEST['kill'];
         if ($id != "")
         {
            $sql = "delete from ".$db_prefix."sbox_content where id=".$id."";
            db_query($sql,__FILE__,__LINE__);
         }
      }
      break;
}

// close header and open body
echo '
</head>
<body>';

// get smilie path
$themedir = $settings['default_theme_url'];   // smf theme path
$imgdir = $themedir."/images/";            // smilie path

// get shout messages out of database
$result = db_query("select * from ".$db_prefix."sbox_content order by id desc, time asc limit ".$modSettings['sbox_MaxLines'],__FILE__,__LINE__);
if(mysql_num_rows($result))
{
   $count=0;   // counter to distinguish font color
   while($row = mysql_fetch_assoc($result))
   {
      $count = $count + 1;                  // increase counter
      $name = $row["name"];                  // user name
      $date = $row["time"];                  // shouting date and time
      $content = stripslashes($row['content']);   // shouting content
      
      // replace smilie code with path to smilie image
      $content = str_replace ($txt['sbox_smilie01_code'], '<img src="'.$imgdir.$txt['sbox_smilie01_file'].'" alt="'.$txt['sbox_smilie01_text'].'" title="'.$txt['sbox_smilie01_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie02_code'], '<img src="'.$imgdir.$txt['sbox_smilie02_file'].'" alt="'.$txt['sbox_smilie02_text'].'" title="'.$txt['sbox_smilie02_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie03_code'], '<img src="'.$imgdir.$txt['sbox_smilie03_file'].'" alt="'.$txt['sbox_smilie03_text'].'" title="'.$txt['sbox_smilie03_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie04_code'], '<img src="'.$imgdir.$txt['sbox_smilie04_file'].'" alt="'.$txt['sbox_smilie04_text'].'" title="'.$txt['sbox_smilie04_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie05_code'], '<img src="'.$imgdir.$txt['sbox_smilie05_file'].'" alt="'.$txt['sbox_smilie05_text'].'" title="'.$txt['sbox_smilie05_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie06_code'], '<img src="'.$imgdir.$txt['sbox_smilie06_file'].'" alt="'.$txt['sbox_smilie06_text'].'" title="'.$txt['sbox_smilie06_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie07_code'], '<img src="'.$imgdir.$txt['sbox_smilie07_file'].'" alt="'.$txt['sbox_smilie07_text'].'" title="'.$txt['sbox_smilie07_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie08_code'], '<img src="'.$imgdir.$txt['sbox_smilie08_file'].'" alt="'.$txt['sbox_smilie08_text'].'" title="'.$txt['sbox_smilie08_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie09_code'], '<img src="'.$imgdir.$txt['sbox_smilie09_file'].'" alt="'.$txt['sbox_smilie09_text'].'" title="'.$txt['sbox_smilie09_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie10_code'], '<img src="'.$imgdir.$txt['sbox_smilie10_file'].'" alt="'.$txt['sbox_smilie10_text'].'" title="'.$txt['sbox_smilie10_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie11_code'], '<img src="'.$imgdir.$txt['sbox_smilie11_file'].'" alt="'.$txt['sbox_smilie11_text'].'" title="'.$txt['sbox_smilie11_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie12_code'], '<img src="'.$imgdir.$txt['sbox_smilie12_file'].'" alt="'.$txt['sbox_smilie12_text'].'" title="'.$txt['sbox_smilie12_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie13_code'], '<img src="'.$imgdir.$txt['sbox_smilie13_file'].'" alt="'.$txt['sbox_smilie13_text'].'" title="'.$txt['sbox_smilie13_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie14_code'], '<img src="'.$imgdir.$txt['sbox_smilie14_file'].'" alt="'.$txt['sbox_smilie14_text'].'" title="'.$txt['sbox_smilie14_text'].'" border="0" />', $content);
      $content = str_replace ($txt['sbox_smilie15_code'], '<img src="'.$imgdir.$txt['sbox_smilie15_file'].'" alt="'.$txt['sbox_smilie15_text'].'" title="'.$txt['sbox_smilie15_text'].'" border="0" />', $content);

      // display shouting message and use a different color each second row
      if ($count % 2)
      echo '
   <div class="OddLine">';
      else
      echo '
   <div class="EvenLine">';
      if ($context['user']['is_admin'])
         echo '<a title="'.$txt['sbox_KillShout'].'" class="Kill" onclick="return killYesNo();" href="sboxDB.php?action=kill&kill='.$row['id'].'">[X]</a>';

      echo '[&nbsp;'.$date.'&nbsp;]&nbsp;<b>&lt;'.$name.'&gt;</b>&nbsp;'.$content.'</div>';
   }
   
    echo '
</body>
</html>';
}
?>

This appears inside the shoutbox

Link: http://cdcoverhideout.com/forum [nofollow]

User: test
Pass: test1

Any help would be great

Regards, will :D

Kettu

 :o Did you add the code by hand or by package manager?
This is almost the whole code of different files of the shoutbox. And still your smilies work. So the code is in the correct files, but also in wrong files, I think.
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

willtaka

I added the mod by package manager & then added the extra coding through the steps given on the mod page. ;D

nitecrawler

Quote from: squirrelof09
QuoteThink you can make the submitable text longer? or have a text field to specify how much you can insert per shout?

Find in sbox.template.php
<input class="windowbg2" type="text" name="sboxText" size="70" maxlength="100" />&nbsp;<input type="submit" class="input" value="&nbsp;shout&nbsp;" />';

You can change the shout length there. I guess the character length validation is done using the $shoutChunkSize in sbox_setup.php (not sure though). I'm not good at PHP :D

I have some issue with the time being displayed. The shout time offset is some (-) 10hours 30 minutes. Maybe if there is a provision for this setting by adding or subtracting this offset from the time being added to database would help. I think it is fetching the time from the server, but in my case, the forum is country specific, and the server is not hosted in that country.. so trouble with time.  :(

haktanir2

Hi I got no answer to this question yet:

How can I make the smilies show when using another theme?

Kettu

Quote from: haktanir2 on June 25, 2006, 07:53:16 AM
Hi I got no answer to this question yet:

How can I make the smilies show when using another theme?
I already answered this question to Drea yesterday. See my posts before (page 12).

Quote from: willtaka on June 25, 2006, 06:55:56 AM
I added the mod by package manager & then added the extra coding through the steps given on the mod page. ;D
What kind of themes do you use? I didn't have to add the code to my themes. It is a bit confusing on the mod page. Lots of themes take the information from the default theme as Enterprise in example. So maybe you added it twice.
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

willtaka

I'm using smfox theme, in the mod page it tells that if you are using a different theme, then you need to add the additional coding :)

gasg

Anybody have installed it ona Joomla + SMF 1.1 RC2 + Ostrio's bridge and make it Working with all features?

Kettu

Quote from: willtaka on June 25, 2006, 04:38:52 PM
I'm using smfox theme, in the mod page it tells that if you are using a different theme, then you need to add the additional coding :)
Yes, thats true. But this is only for some themes. Deep should add the info that you should check after installation if this code is already there.

I would recommend: deinstall the mod and reinstall it by the package manager and then let's see, what happens. If it doesn't work, we go through the modifications step by step together. Okay?
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

willtaka

Cool, okay, I will reinstall :D

willtaka

Its still the same, shall I delete the coding I added the first time :D

Kettu

Quote from: willtaka on June 26, 2006, 07:31:57 AM
Its still the same, shall I delete the coding I added the first time :D
Yes, of course. This is very important. Then we can start new.
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

willtaka

Right I have reinstalled the mod and added the following coding to my boardindex.template.php

// display shoutbox
if (function_exists('sbox')) sbox();

I haven't added anymore coding and Its still the same :(

Kettu

Quote from: willtaka on June 26, 2006, 11:07:19 AM
Right I have reinstalled the mod and added the following coding to my boardindex.template.php

// display shoutbox
if (function_exists('sbox')) sbox();

I haven't added anymore coding and Its still the same :(
What about the default theme? Is there the same error?
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

willtaka

Yes, still get the same error :(

tL0z

Quote from: tL0z on June 18, 2006, 11:32:09 AM
Hello,

How can I change the shoutbox backgorund color to white?
Also, when I click on a link in the forum, it also opens in the shoutbox's iframe, how can I avoid that?  ::)

Thanks
help

carola0102



It's very strange, even if we dont shout at my site, there appears a zero ::)
and also if we shout something I can only see a zero :'(

can anyone help?

carola0102

Quote from: carola0102 on June 29, 2006, 02:26:41 AM


It's very strange, even if we dont shout at my site, there appears a zero ::)
and also if we shout something I can only see a zero :'(

can anyone help?

sorry for the trouble but can anyone help pls?


tL0z

Could anyone make a "Delete all shouts" function for me please?

moTaro

More like CLEAR all shouts.

Advertisement: