This version of the shoutbox uses the new smiley system that's currently available through the cvs on the main site and will not work with the smiley system used by the earlier versions of this shoutbox. The good news is that the new system allows you to add and remove smileys from the admin area and it installs with the shoutbox in 3 easy steps.
This package contains the following files:
If you are using the Advanced News or Forum Threads List Panel from Fuzed Themes you will need to modify them to work with the new shoutbox.
Advanced News:
Open advanced_news/news_scripts.php
Find and DELETE this line...
<script type='text/javascript' language='JavaScript' src='".BASEDIR."advanced_news/boxover.js'></script>
Save and close.
Forum Threads List Panel:
Open infusions/forum_threads_list_panel/forum_threads_list_panel.php
Find and DELETE this line...
echo "<script type='text/javascript' language='JavaScript' src='".INFUSIONS."forum_threads_list_panel/ft_boxover.js'></script>";
Save and close.
* * * Backup your website before uploading or modifying any files * * *
Please Note:
A modified version of the jscript.js file has been included. If you'd like to use your original jscript.js file, delete the copy included in this package (php-files/includes/jscript.js) and refer to the mod.html file for mod instructions.
The jscript.js file now includes the boxover script required for the balloon tips. If you have any previous versions of boxover.js which are required by the Advanced News Panel and Advanced Forum Threads List Panel, you can remove all calls for the boxover.js script within these files. If you need support on which files require editing, please use our Modification Support Forum at Fuzed Themes.
There are 3 steps to the installation and if you follow them closely, you shouldn't have any problems.
Step 1: Upload the contents of the php-files folder to the appropriate directories on your site.
Step 2: Open maincore.php and find...
// Parse smiley bbcode into HTML images
function parsesmileys($message) {
... including all of the code that's here ...
return $message;
}
// Show smiley icons in comments, forum and other post pages
function displaysmileys($textarea) {
... including all of the code that's here ...
return $smiles;
}
REPLACE it all with...
// Cache smileys mysql
function cache_smileys() {
global $smiley_cache;
$result = dbquery("SELECT * FROM ".DB_PREFIX."smileys");
if (dbrows($result)) {
$smiley_cache = array();
while ($data = dbarray($result)) {
$smiley_cache[] = array(
"smiley_code" => $data['smiley_code'],
"smiley_image" => $data['smiley_image'],
"smiley_text" => $data['smiley_text']
);
}
} else {
$smiley_cache = "";
}
}
// Parse smiley bbcode
function parsesmileys($message) {
global $smiley_cache;
if (!isset($smiley_cache)) cache_smileys();
if (is_array($smiley_cache)) {
foreach ($smiley_cache as $smiley) {
$smiley_code = preg_quote($smiley['smiley_code']);
$smiley_image = "<img src='".IMAGES."smiley/".$smiley['smiley_image']."' title='".$smiley['smiley_text']."' alt='".$smiley['smiley_text']."'>";
$message = preg_replace("#{$smiley_code}#si", $smiley_image, $message);
}
}
return $message;
}
// Show smiley icons in comments, forum and other post pages
function displaysmileys($textarea, $close="", $form="inputform") {
global $smiley_cache;
$smileys = ""; $i = 0;
if (!isset($smiley_cache)) cache_smileys();
if (is_array($smiley_cache)) {
$max_width = 340; $width = 0;
foreach ($smiley_cache as $smiley) {
if ($form == "inputform") {
$img = getimagesize(IMAGES."smiley/".$smiley['smiley_image']);
if ($width + $img[0] >= $max_width) {
$smileys .= "<br>\n";
$width = $img[0];
} else {
$width = $width + $img[0];
}
}
$smileys .= "<img src='".IMAGES."smiley/".$smiley['smiley_image']."' title='".$smiley['smiley_text']."' alt='".$smiley['smiley_text']."' onClick=\"insertText('".$textarea."', '".$smiley['smiley_code']."', '".$form."');".(!empty($close) ? " overlayclose('$close');" : "")."\">\n";
}
}
return $smileys;
}
Save and close.
Step 3: Go to Admin --> Custom Pages and paste the following code into the page content field, then preview the page... don't save it, preview only...
<?php
$result = dbquery("CREATE TABLE ".$db_prefix."smileys (
smiley_id smallint(5) unsigned NOT NULL auto_increment,
smiley_code varchar(50) NOT NULL,
smiley_image varchar(100) NOT NULL,
smiley_text varchar(100) NOT NULL,
PRIMARY KEY (smiley_id)
) TYPE=MyISAM;");
if ($result) {
echo "Smiley table was created<br>";
$smileys = array(
array(":D", "biggrin.gif", "biggrin"),
array("B)", "cool.gif", "cool"),
array(":)", "happy.gif", "happy"),
array(":@", "mad.gif", "mad"),
array(":p", "razz.gif", "razz"),
array(":(", "sad.gif", "sad"),
array("*yes*", "yes.gif", "yes"),
array("*no*", "no.gif", "no"),
array("*dull*", "dull.gif", "dull"),
array(":?", "confused.gif", "confused"),
array(":o", "embarrassed.gif", "embarrassed"),
array("*eek*", "eek.gif", "eek"),
array("*rolleyes*", "rolleyes.gif", "rolleyes"),
array(";)", "wink.gif", "wink"),
array("*rofl*", "rofl.gif", "rofl"),
array("o_O", "o_O.gif", "o_O"),
array("*annoy*", "annoy.gif", "annoy"),
array("*bye*", "bye.gif", "bye"),
array("*clap*", "clap.gif", "clap"),
array("*comfort*", "comfort.gif", "comfort"),
array("*dog*", "dog.gif", "dog"),
array("*flower*", "flower.gif", "flower"),
array("*inlove*", "inlove.gif", "in love"),
array("*kiss*", "kiss.gif", "kiss"),
array("*pissed*", "pissed.gif", "pissed"),
array("*pray*", "pray.gif", "pray"),
array("*saycheese*", "saycheese.gif", "say cheese!"),
array("*secret*", "secret.gif", "secret"),
array("*sarcasm*", "sarcasm.gif", "sarcasm"),
array("*stress*", "stress.gif", "stress"),
array("*tup*", "tup.gif", "thumbs up"),
array("*tdown*", "tdown.gif", "thumbs down"),
array("*argue*", "argue.gif", "argue"),
array("*blushing*", "blushing.gif", "blushing"),
array("*bugs*", "bugs.gif", "bugs"),
array("*finger*", "finger.gif", "middle finger"),
array("*helpless*", "helpless.gif", "helpless"),
array("*hilarious*", "hilarious.gif", "hilarious"),
array("*hmm*", "hmm.gif", "hmm!"),
array("*lol*", "lol.gif", "lol"),
array("*music*", "music.gif", "music"),
array("*neutral*", "neutral.gif", "neutral"),
array("*realsad*", "realsad.gif", "real sad"),
array("*shop*", "shop.gif", "shop"),
array("*tongue*", "tongue.gif", "tongue"),
array("*wait*", "wait.gif", "wait"),
array("*yummy*", "yummy.gif", "yummy"),
array("*zipit*", "zipit.gif", "zip it!")
);
for($i = 0; $i < count($smileys); $i ++) {
$result = dbquery("INSERT INTO ".$db_prefix."smileys (smiley_code, smiley_image, smiley_text)
VALUES ('".$smileys[$i][0]."', '".$smileys[$i][1]."', '".$smileys[$i][2]."')"
);
}
if ($i > 0) { echo "$i smileys were added to the database<br>"; }
$result = dbquery("INSERT INTO ".$db_prefix."admin (admin_rights, admin_image, admin_title,
admin_link, admin_page) VALUES ('SM', 'smileys.gif', 'Smileys', 'smileys.php', 3)"
);
$result = dbquery("SELECT user_id, user_name, user_rights FROM ".$db_prefix."users WHERE user_level = '103'");
while($data = dbarray($result)) {
$rights_array = explode(".", $data['user_rights'].".SM");
sort($rights_array);
$rights = implode(".", $rights_array);
$result2 = dbquery("UPDATE ".$db_prefix."users SET user_rights='$rights' WHERE user_id = '".$data['user_id']."'");
if ($result2) { echo "<font color='red'><b>".$data['user_name']."</b></font> has been given access rights to the smiley admin<br>"; }
}
}
?>
Q: The shoutbox gives shows this error --> Call to undefined function: mb_convert_encoding() <-- How can I fix this?
A: Copy the contents of the backup folder from this package to your website overwriting any existing files.
Q: Does the shoutbox auto refresh and if so, how can I change the refresh rate?
A: Yes, the shoutbox auto refreshes every 60 seconds.
To change the refresh rate, open infusions/shoutbox_panel/functions.js and find...
setTimeout("shoutbox_refresh()", 60000);
60000 = 60 seconds. Change the number to whatever you want, but be aware that decreasing the time between refreshes could slow your website down.
Please visit us as Fuzed Themes and post your questions regarding this version of the Shoutbox here.