News:

Join the Facebook Fan Page.

Main Menu

SMF Shoutbox

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

Previous topic - Next topic

SuperZambezi

Quote from: Psycojimi on April 14, 2008, 06:07:59 PM
I encountered a problem installing the shout box to my forum now all I see when trying to get on my forum is this error message:

Parse error: syntax error, unexpected $end in /home/wernkin8/public_html/forum/Sources/Subs.php on line 3601


I need help,I have members trying to get on the board.

This is the bottom half of my Sub.php

The error is in here..somewhere...any help would be appriciated.

}
function smfshout(){ global $sourcedir; include_once("$sourcedir/shout.php"); shout_display(true);}

// Debugging.
function db_debug_junk()
{
global $context, $scripturl, $boarddir, $modSettings;
global $db_cache, $db_count, $db_show_debug, $cache_count, $cache_hits;

// Add to Settings.php if you want to show the debugging information.
if (!isset($db_show_debug) || $db_show_debug !== true || (isset($_GET['action']) && $_GET['action'] == 'viewquery') || WIRELESS)
return;

if (empty($_SESSION['view_queries']))
$_SESSION['view_queries'] = 0;
if (empty($context['debug']['language_files']))
$context['debug']['language_files'] = array();

$files = get_included_files();
$total_size = 0;
for ($i = 0, $n = count($files); $i < $n; $i++)
{
$total_size += filesize($files[$i]);
$files[$i] = strtr($files[$i], array($boarddir => '.'));
}

$warnings = 0;
foreach ($db_cache as $q => $qq)
{
if (!empty($qq['w']))
$warnings += count($qq['w']);
}

$_SESSION['debug'] = &$db_cache;

// Gotta have valid HTML ;).
$temp = ob_get_contents();
if (function_exists('ob_clean'))
ob_clean();
else
{
ob_end_clean();
ob_start('ob_sessrewrite');
}

echo preg_replace('~</body>\s*</html>~', '', $temp), '
<div class="smalltext" style="text-align: left; margin: 1ex;">
Templates: ', count($context['debug']['templates']), ': <i>', implode('</i>, <i>', $context['debug']['templates']), '</i>.<br />
Sub templates: ', count($context['debug']['sub_templates']), ': <i>', implode('</i>, <i>', $context['debug']['sub_templates']), '</i>.<br />
Language files: ', count($context['debug']['language_files']), ': <i>', implode('</i>, <i>', $context['debug']['language_files']), '</i>.<br />
Files included: ', count($files), ' - ', round($total_size / 1024), 'KB. (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">show</a><span id="debug_include_info" style="display: none;"><i>', implode('</i>, <i>', $files), '</i></span>)<br />';

if (!empty($modSettings['cache_enable']) && !empty($cache_hits))
{
$entries = array();
$total_t = 0;
$total_s = 0;
foreach ($cache_hits as $h)
{
$entries[] = $h['d'] . ' ' . $h['k'] . ': ' . comma_format($h['t'], 5) . ' - ' . $h['s'] . ' bytes';
$total_t += $h['t'];
$total_s += $h['s'];
}

echo '
Cache hits: ', $cache_count, ': ', comma_format($total_t, 5), 's for ', comma_format($total_s), ' bytes (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_cache_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">show</a><span id="debug_cache_info" style="display: none;"><i>', implode('</i>, <i>', $entries), '</i></span>)<br />';
}

echo '
<a href="', $scripturl, '?action=viewquery" target="_blank">Queries used: ', $db_count, $warnings == 0 ? '' : ', ' . $warnings . ' warning(s)', '</a>.<br />
<br />';

if ($_SESSION['view_queries'] == 1)
foreach ($db_cache as $q => $qq)
{
$is_select = substr(trim($qq['q']), 0, 6) == 'SELECT' || preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+SELECT .+$~s', trim($qq['q'])) != 0;

echo '
<b>', $is_select ? '<a href="' . $scripturl . '?action=viewquery;qq=' . ($q + 1) . '#qq' . $q . '" target="_blank" style="text-decoration: none;">' : '', nl2br(str_replace("\t", '&nbsp;&nbsp;&nbsp;', htmlspecialchars(ltrim($qq['q'], "\n\r")))) . ($is_select ? '</a></b>' : '</b>') . '<br />
&nbsp;&nbsp;&nbsp;';
if (!empty($qq['f']) && !empty($qq['l']))
echo 'in <i>' . $qq['f'] . '</i> line <i>' . $qq['l'] . '</i>, ';
echo 'which took ' . round($qq['t'], 8) . ' seconds.<br />
<br />';
}

echo '
<a href="' . $scripturl . '?action=viewquery;sa=hide">[' . (empty($_SESSION['view_queries']) ? 'show' : 'hide') . ' queries]</a>
</div></body></html>';
}

// Get an attachment's encrypted filename.  If $new is true, won't check for file existence.
function getAttachmentFilename($filename, $attachment_id, $new = false)
{
global $modSettings;

// Remove special accented characters - ie. sí.
$clean_name = strtr($filename, 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
$clean_name = strtr($clean_name, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u'));

// Sorry, no spaces, dots, or anything else but letters allowed.
$clean_name = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $clean_name);

$enc_name = $attachment_id . '_' . strtr($clean_name, '.', '_') . md5($clean_name);
$clean_name = preg_replace('~\.[\.]+~', '.', $clean_name);

if ($attachment_id == false || ($new && empty($modSettings['attachmentEncryptFilenames'])))
return $clean_name;
elseif ($new)
return $enc_name;

if (file_exists($modSettings['attachmentUploadDir'] . '/' . $enc_name))
$filename = $modSettings['attachmentUploadDir'] . '/' . $enc_name;
else
$filename = $modSettings['attachmentUploadDir'] . '/' . $clean_name;

return $filename;
}

// Lookup an IP; try shell_exec first because we can do a timeout on it.
function host_from_ip($ip)
{
global $modSettings;

if (($host = cache_get_data('hostlookup-' . $ip, 600)) !== null)
return $host;
$t = microtime();

// If we can't access nslookup/host, PHP 4.1.x might just crash.
if (@version_compare(PHP_VERSION, '4.2.0') == -1)
$host = false;

// Try the Linux host command, perhaps?
if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && rand(0, 1) == 1)
{
if (!isset($modSettings['host_to_dis']))
$test = @shell_exec('host -W 1 ' . @escapeshellarg($ip));
else
$test = @shell_exec('host ' . @escapeshellarg($ip));

// Did host say it didn't find anything?
if (strpos($test, 'not found') !== false)
$host = '';
// Invalid server option?
elseif ((strpos($test, 'invalid option') || strpos($test, 'Invalid query name 1')) && !isset($modSettings['host_to_dis']))
updateSettings(array('host_to_dis' => 1));
// Maybe it found something, after all?
elseif (preg_match('~\s([^\s]+?)\.\s~', $test, $match) == 1)
$host = $match[1];
}

// This is nslookup; usually only Windows, but possibly some Unix?
if (!isset($host) && strpos(strtolower(PHP_OS), 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && rand(0, 1) == 1)
{
$test = @shell_exec('nslookup -timeout=1 ' . @escapeshellarg($ip));
if (strpos($test, 'Non-existent domain') !== false)
$host = '';
elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1)
$host = $match[1];
}

// This is the last try :/.
if (!isset($host) || $host === false)
$host = @gethostbyaddr($ip);

// It took a long time, so let's cache it!
if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.5)
cache_put_data('hostlookup-' . $ip, $host, 600);

return $host;
}

// Chops a string into words and prepares them to be inserted into (or searched from) the database.
function text2words($text, $max_chars = 20, $encrypt = false)
{
global $func, $context;

// Step 1: Remove entities/things we don't consider words:
$words = preg_replace('~([\x0B\0' . ($context['utf8'] ? ($context['server']['complex_preg_chars'] ? '\x{A0}' : pack('C*', 0xC2, 0xA0)) : '\xA0') . '\t\r\s\n(){}\\[\\]<>!@$%^*.,:+=`\~\?/\\\\]|&(amp|lt|gt|quot);)+~' . ($context['utf8'] ? 'u' : ''), ' ', strtr($text, array('<br />' => ' ')));

// Step 2: Entities we left to letters, where applicable, lowercase.
$words = un_htmlspecialchars($func['strtolower']($words));

// Step 3: Ready to split apart and index!
$words = explode(' ', $words);

if ($encrypt)
{
$possible_chars = array_flip(array_merge(range(46, 57), range(65, 90), range(97, 122)));
$returned_ints = array();
foreach ($words as $word)
{
if (($word = trim($word, '-_\'')) !== '')
{
$encrypted = substr(crypt($word, 'uk'), 2, $max_chars);
$total = 0;
for ($i = 0; $i < $max_chars; $i++)
$total += $possible_chars[ord($encrypted{$i})] * pow(63, $i);
$returned_ints[] = $max_chars == 4 ? min($total, 16777215) : $total;
}
}
return array_unique($returned_ints);
}
else
{
// Trim characters before and after and add slashes for database insertion.
$returned_words = array();
foreach ($words as $word)
if (($word = trim($word, '-_\'')) !== '')
$returned_words[] = addslashes($max_chars === null ? $word : substr($word, 0, $max_chars));

// Filter out all words that occur more than once.
return array_unique($returned_words);
}
}

// Creates an image/text button
function create_button($name, $alt, $label = '', $custom = '')
{
global $settings, $txt, $context;

if (!$settings['use_image_buttons'])
return $txt[$alt];
elseif (!empty($settings['use_buttons']))
return '<img src="' . $settings['images_url'] . '/buttons/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />' . ($label != '' ? '<b>' . $txt[$label] . '</b>' : '');
else
return '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />';
}

?>


I'm having this same problem. does anyone have an answer? Thanks. :)

DarkAngel612

are you sure that info is from the Subs.php
file?

// Change the seed.
updateSettings(array('rand_seed' => mt_rand()));
}

?>


that is the ending of mine and I don't see anything like what you have near it in mine.

also the  first line in your code asks for :
include_once("$sourcedir/shout.php")
and yet the file I found in the fodler with the shoutbox files is called sbox.php

make sure all your files are where they should be located:

Sources: sbox.php and sboxDB.php
theme directory/languages (the default core theme) You will need to put these into any other themes you have installed: sbox.englilsh.php and sbox.german.php
theme directory: sbox.template.php
theme directory/images: sbox_refresh.gif
board directory: chat-inbound_GSM.wav
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Chopper

Quote from: Chopper on October 18, 2008, 09:55:49 AM
Quote from: DarkAngel612 on October 17, 2008, 08:00:59 PM
Quote from: Chopper on October 14, 2008, 02:15:22 PM
Is there a way to alter the width of the shoutbox? It seems to take up the full width of the forum

in the sbox.template.php file:

FIND and adjust the width and height where indicated in red.:

<iframe name="sboxframe" src="' . $sourceurl . '/sboxDB.php?" width="100%" height="'.$modSettings['sbox_Height'].'" frameborder="0" style="border: 2px ridge silver;"></iframe>

that is approximately line 93

Thank you this is exactly what i was looking for.

One more question if i may, now that the shoutbox width is reduced and leaving a gap to the left hand side. Is it possible to create a list of the members who are currently using the shoutbox?

Thanks for your help mate.

Is this feature possible?

trekkie2444

How do you change the background of the shoutbox?

qubbah

Quote from: trekkie2444 on November 21, 2008, 09:17:16 AM
How do you change the background of the shoutbox?

This is what im looking for a long time.. hope anybody here can tell about that.

SpelingMistakes

There is a huge difference between living and being alive!

DarkAngel612

changing background of shoutbox:

Please work off a duplicate file and  have the original handy for just in case this fails....


I am not sure for it has been a long time since I used the standalone shoutbox, I have the one with the Tiny Portal now.

In the sbox.template.php file (might be in the default smf theme folder) look for this on approximately line 70 and add what is in red to it, you substitute the hex code for the color you want it to be.

Upload it to overwrite the one on the server then check to see if it worked, if not then put back the original, when I changed one of mine I used the templates style.css file  :


<div id="upshrinkHeaderSB"', empty($options['collapse_header_sb']) ? '' : ' style="display: none;"', '>
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr class="windowbg" align="right" style="width:13%" color="#ffffff">
<td class="windowbg" style="width:87%">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

SpelingMistakes

Will this work for forbid some of people using SB who have some kind of position groups?

Quoteif ($user_settings['position'] != "forbiden1" || $user_settings['position'] != "forbiden2")
   sbox();


Spel
There is a huge difference between living and being alive!

SpelingMistakes

I have lots of errors :( and that dont work - Any help
There is a huge difference between living and being alive!

trekkie2444

DarkAngel: That had no effect.

DarkAngel612

Quote from: trekkie2444 on November 23, 2008, 01:52:05 AM
DarkAngel: That had no effect.

You may need to play around with the style.css file from the theme you are using. I had to change mine from that file too cause it was a red background and hurt the eyes. I can't remember which one it was in there that I changed but think it was one of the windowbg entries.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

trekkie2444

Are you saying change the sbox_template file or the style.css?

DarkAngel612

Quote from: trekkie2444 on November 23, 2008, 07:57:34 PM
Are you saying change the sbox_template file or the style.css?


go to the theme you are using and change the color hex number in its style.css
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

trekkie2444

I don't have any of that text in the style.css of my theme.

DarkAngel612

no you won't have any of that code in there...that code came from the shoutbox.

what you do have in the style file is the hex codes for the particular section and you need to find which one of those codes govern it...try looking for windowbg

of course not knowing what file or a link would be helpful to get better info too.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

qubbah

#1735
when i set refresh second to 40 second, with firefox it going exactly time what i want. but with ie its going refresh i think every 5 or 6 second.

maybe the auto refresh not working properly with ie.

robbie93

the sbox gives errors in ie any idea why this is?  and how to fix?

trekkie2444

The background image is the background for my shoutbox! How do I disconnect them from each other on this theme?

DarkAngel612

Quote from: trekkie2444 on December 01, 2008, 02:49:41 AM
The background image is the background for my shoutbox! How do I disconnect them from each other on this theme?

I probably can't help but just in case...what theme are you using?

A link to see the site would be helpful too for if there is someone else with the same theme that may have had the same problem...might see and help too
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

qubbah

why chat-inbound_GSM.wav cannot running?

Advertisement: