nneonneo's Shoutbox

Started by nneonneo, December 26, 2006, 06:58:11 PM

Previous topic - Next topic

nneonneo

Link to Mod

This shoutbox is based on the excellent work of Yuri Vishnevsky. It is an AJAX-powered shoutbox, making minimal adjustments to the forum software to avoid conflicts with existing mods.

The shoutbox needs no refreshing; just a modern AJAX-compatible web browser for the client. The script has been reworked for efficiency and minimal bandwidth use.

Questions and concerns may be directed to nneonneo {at} gmail {period} com or posted to the discussion thread for this mod.

Screenshot: (administrator's view) - 1.03 version shown


This mod has been tested with SMF 1.1.7 and SMF 2.0 Beta 4, and with Opera (9.0+), Safari (2.0+), Firefox (2.0+), Camino (1+), Internet Explorer (6+) and Konqueror (3+).

Table of Contents
Advanced Shoutbox
Live Demos
Translations
Editable Options
Installation to Other Themes
Tips and Customizations
Troubleshooting
Changelog
Upgrading to the Latest Version

Advanced Shoutbox
SunKing and MrMoney, from the community forums, helped incorporate many of the more popular customizations into a modified shoutbox package, dubbed the "Advanced AJAX Shoutbox". It can be downloaded from this mod page as the AdvSB_ series of packages. The package includes the basic shoutbox, icons for the History, Commands etc. links, the sound mod, two-line display and other miscellaneous customizations.


Live Demos
Live Demo available at http://nneonneo.net46.net/smf/ for SMF 1.1.5 (and TinyPortal) and http://nneonneo.net46.net/smf2/ for the Advanced Shoutbox running in SMF 2.0. You do not need to have an account to test the shoutbox.


Translations
All translations are posted here.
Note: Translations from 1.11 onwards should work fine with 1.16, and translations for 1.20 onwards work with 1.22.
Translations from 1.16 and before are not complete for 1.2x, as a few more strings were added in 1.20.

1.01-1.16 translations (updates for 1.20 welcome)

  • Türkçe (Turkish) translation, provided by o2gr of http://www.ozgur.be/
  • Ελληνικά (Greek) translation, from petr00kos of http://www.oink.gr/
  • Português (Portuguese) translation from 4T3IG0
  • Italiano (Italian) translation from Mystiquo
  • Français (French) translation from Patriiick
  • Hrvatski (Croatian) translation from ameo

1.20+ translations (also work for 1.16 and below)

  • Polski (Polish) translation by Kangel
  • Русский (Russian) translation by EugeneLoza
  • Deutsch (German) translation by womble
  • Български (Bulgarian) translation by amorphine
  • Italiano (Italian) translation from leonardus
  • Hrvatski (Croatian) translation from ameo
  • Македонски (Macedonian) translation from Picobrain

Thanks to everyone for making translations! If you'd like to make a translation, PM me (nneonneo) on the community forums.


Editable Options
in yshout/settings.php and yshout/settings.js: read the comments
in index.template.php:

  • $shoutFile can be edited to allow different themes to use different shout files
  • CSS block in the <head> section (search for #yshout) allows customizable appearance
Permissions for the shoutbox: in the admin panel, under Membergroups->Permissions.
More information available in the official thread.


Installation to Other Themes
In the theme's "index.template.php" file:
find
// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' . $scripturl . '?board=' . $context['current_board'] . '.0" />';

After that, add

// YSHOUT HERE - <head> code
global $boardurl,$shoutFile;
$shoutFile='home';
$scripturlparsed = parse_url($scripturl);
$scriptpath=isset($scripturlparsed['path'])?$scripturlparsed['path']:'/';
$args='';
foreach($_GET as $key => $value) // passthrough $_GET
$args.='&'.urlencode($key).'='.urlencode($value);
echo '
<script src="',$boardurl,'/yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="',$boardurl,'/yshout/settings.js" type="text/javascript"></script>
<script type="text/javascript"><!-- // --><![CDATA[
window.onload=function(){loadChat();};
var shoutFile="',$shoutFile,'";
var yshout_php="',$scriptpath,'?yshout',$args,'";
// ]]></script>
<script src="',$boardurl,'/yshout/js/yshout.js?July062008" type="text/javascript"></script>
<style type="text/css">
#yshout {
font-size: 10px;
overflow: hidden;
}
#yshout #yshout-toollinks { /* tool links (History, Commands, etc.) */
}
#yshout #shouts { /* main shouts area */
}
#yshout .shout { /* one shout */
margin: 0 0 0; /* Top Bottom Linespacing */
line-height: 1;
}
#yshout .shout-timestamp {
font-style: normal;
font-weight: normal;
}
#yshout .shout-adminlinks { /* del and ban buttons */
font-size: 6pt;
color: #141414;
}
#yshout #shout-form {
margin: 0;
padding: 0;
}
#yshout #shout-form fieldset {
border: none;
}
#yshout #forum-name {
width: 70px;
margin-right: 5px;
}
#yshout #shout-text {
width: 310px;
margin-right: 5px;
}
#yshout #shout-button {
width: 55px;
}
#yshout .shout-invalid { /* invalid shout (shout textbox) */
background: #FFFDD1;
}
</style>';
// YSHOUT END - <head> code


Second, find the desired location of the shoutbox and place at that location (in the index.template.php file!) *one* of the two blocks below:

For an "instant-on" shoutbox which loads with the page:
// YSHOUT HERE - shoutbox code
global $txt,$context,$boarddir;
if(allowedTo('yshout_view'))
{
echo '<br /><b>',$txt['yshout_shoutbox'],'</b><br /><br />';
echo '<div id="yshout">';
include_once($boarddir.'/yshout/yshout.php');
echo '</div>';
}
elseif($context['user']['is_guest'])
echo $txt['yshout_no_guests'];
// YSHOUT END - shoutbox code


For the original 1.16 behaviour (shoutbox loads after the page has fully loaded):
// YSHOUT HERE - shoutbox code
echo '
<br /><b>',$txt['yshout_shoutbox'],'</b><br /><br />
<div id="yshout">',$txt['yshout_loading'],'<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div>';
// YSHOUT END - shoutbox code



Tips and Customizations
Putting the shoutbox on a separate page: Copy yshout/index.php to the desired location and modify $boardurl per the instructions in the file. Note that just visiting /forum/yshout/ will get you a simple forum-less shoutbox.

Installing to TinyPortal: Follow the instructions for the "<head> code" block under Installation to Other Themes, then add either of the "shoutbox code" blocks to a new TinyPortal center phpbox.

Adding a smileys bar:
see http://www.simplemachines.org/community/index.php?topic=137508.msg1388091#msg1388091 (thank you pongsak!)

Adding a clicking sound to new/incoming posts: see http://www.simplemachines.org/community/index.php?topic=137508.msg1208212#msg1208212 for how to do this using SoundManager2.
http://www.simplemachines.org/community/index.php?topic=137508.msg1652792#msg1652792 for the user option for muting the sound.

Showing a scrollbar: see http://www.simplemachines.org/community/index.php?topic=137508.msg1532028#msg1532028

Installation to the news header: see http://www.simplemachines.org/community/index.php?topic=137508.msg1534963#msg1534963

Changing the timestamp: see http://www.simplemachines.org/community/index.php?topic=137508.msg1630065#msg1630065

Notifying users of new topics and replies in the forum: see http://www.simplemachines.org/community/index.php?topic=137508.msg1817042#msg1817042

Troubleshooting
No text? If you aren't using English on your board, you will need to add the following code to Themes/default/languages/Modifications.<language>.php, right above the final "?>" in the file (you're welcome to translate and localize this text; if you do so, you can PM me with the translation and I will post it with credit to you):
// ---- Begin modification - nneonneo's Shoutbox ----
$txt['yshout_shoutbox'] = 'Shout Box';
$txt['yshout_loading'] = '...loading shoutbox...';
$txt['yshout_rp_banned'] = "Sorry, you've been banned from the shoutbox.";
$txt['yshout_no_guests'] = 'Sorry, you must be logged in to use the shoutbox!';
$txt['yshout_ban_conf'] = 'Ban Confirmation';
$txt['yshout_select_mode'] = 'Select Ban Mode:';
$txt['yshout_rp'] = 'Reading and Posting';
$txt['yshout_p'] = 'Posting only';
$txt['yshout_error'] = 'ERROR: ';
$txt['yshout_no_user'] = 'User not found.';
$txt['yshout_del_success'] = 'Shout deleted.';
$txt['yshout_no_action'] = 'Nothing to do.';
$txt['yshout_history'] = 'History';
$txt['yshout_commands'] = 'Commands';
$txt['yshout_exthistory'] = 'ExtendedHistory';
$txt['yshout_hide'] = 'Hide';
$txt['yshout_show'] = 'Show';
$txt['yshout_admlinks'] = 'AdminLinks';
$txt['yshout_return'] = 'ReturnToShoutbox';
$txt['yshout_p_banned'] = 'You are banned from posting.';
$txt['yshout_banned'] = 'Banned';
$txt['yshout_shout_button'] = 'Shout!';
$txt['yshout_banlist_caption'] = 'Shout Box Bans (click to unban)';
$txt['yshout_ip_bans'] = 'IP Bans for ';
$txt['yshout_username_bans'] = 'Username Bans for ';
$txt['yshout_ban_type_error'] = 'use /banuser or /banip!';
$txt['yshout_ban_mode_error'] = 'Must have mode argument.';
$txt['yshout_imp_slash_error'] = 'Prefix shout with "/" (slash character)! See "/help impersonate" for details.';
$txt['yshout_imp_uname_error'] = 'No username given!';
$txt['yshout_imp_max4_error'] = 'Maximum 4 arguments!';
$txt['yshout_cmd_reference'] = 'Command Reference';
$txt['yshout_cmdlist'] = array(
'/help' => ' [command]: Help on a command, or all if no command is specified.',
'/return' => ': Go back to the Shout Box.',
'/pi' => ' [digits]: What is the value of pi to the nth digit?',
'/me' => ' &lt;message&gt;: Emotes the message (e.g. <span class="meaction"> * Nathaniel likes dogs</span>)');
$txt['yshout_cmdlistadmin'] = array(
'/clear' => ': Completely empty the Shout Box.',
'/help' => ' [command]: Help on a command, or all if no command is specified.',
'/return' => ': Go back to the Shout Box.',
'/banlist' => ': List all bans currently in place. Unban the users by clicking on their names.',
'/banuser' => ' &lt;mode&gt; &lt;username&gt;: Ban a user by name. You should use the user\'s real username, otherwise the ban can be evaded. Mode can be "u" to unban, "rp" for read and post bans, or "p" for a post ban.',
'/banip' => ' &lt;mode&gt; &lt;IP&gt;: Ban a user by IP. Mode can be "u" to unban, "rp" for read and post bans, or "p" for a post ban.',
'/impersonate' => ' &lt;user&gt; [userlevel] [ip] [userid] /[shout text]: Impersonate a user. Shout text must be prefixed by a "/" or else it will fail.<blockquote><div>
&lt;user&gt;: Username to use<br />
[userlevel]: User Level to use. 0=normal, 1=mod, 2=admin<br />
[ip]: IP address to use, as 1.2.3.4<br />
[userid]: User ID from forum, to fix profile link</div></blockquote>',
'/lock' => ' &lt;message&gt;: Lock the shoutbox for maintenance with the specified message.',
'/unlock' => ': Release the shoutbox from maintenance.');
$txt['yshout_maintenance'] = 'Locked';
$txt['yshout_lock_arg_error'] = 'You need to specify a reason for maintenance!';
$txt['yshout_lock_changed'] = 'Changed maintenance reason to "%s".';
$txt['yshout_lock_success'] = 'Locked shoutbox for maintenance with reason "%s".';
$txt['yshout_unlock_already'] = 'Failed to unlock: shoutbox isn\'t locked!';
$txt['yshout_unlock_success'] = 'Successfully unlocked shoutbox.';
$txt['yshout_no_posting'] = 'Sorry, you cannot post to the shoutbox.';
$txt['yshout_smilies'] = "Smilies";
// Permissions
$txt['permissiongroup_yshout'] = 'Shoutbox';
$txt['permissionname_yshout_view'] = 'View shoutbox';
$txt['permissionname_yshout_post'] = 'Post in shoutbox';
$txt['permissionname_yshout_moderate'] = 'Moderate shoutbox';
$txt['permissionhelp_yshout_view'] = 'This permission allows access to the shoutbox. If it is enabled, users will see the shoutbox and the chats in it.';
$txt['permissionhelp_yshout_post'] = 'This permission allows users to post messages to the shoutbox. If it is disabled, users cannot enter any messages.';
$txt['permissionhelp_yshout_moderate'] = 'If this permission is set, users will be allowed to moderate the shoutbox -- deleting, banning and clearing among other features.';
$txt['permissiongroup_simple_yshout'] = 'Shoutbox';
// ---- End modification - nneonneo's Shoutbox ----

above the final "?>" in your version of Themes/default/languages/Modifications.XXXX.php (where XXXX represents your localization/language)

PortaMx warnings in shoutbox: If warnings like this:
Notice: Undefined index: forum in /home/.../public_html/smf/Sources/Subs.php on line 3936
Notice: Undefined index: PortaMx in /home/.../public_html/smf/Sources/Subs.php on line 3938
Notice: Undefined index: pmx_settings in /home/.../public_html/smf/Sources/Subs.php on line 4000
Notice: Undefined index: pmx_blocks in /home/.../public_html/smf/Sources/Subs.php on line 4005
Notice: Undefined index: PortaMx in /home/.../public_html/smf/Sources/Subs.php on line 4207

are showing up in the shoutbox, see http://www.simplemachines.org/community/index.php?topic=137508.msg1829501#msg1829501 for a fix.

High bandwidth use for large forums: This shoutbox was never designed for very large forums. The limitations of PHP make it difficult, if not impossible to implement real ("live") chatting features without being resource-heavy.

That said, there is something you can do about it. The shoutbox can be made less taxing, at the cost of less interactivity.

The basic procedure is to set refreshTime in yshout/settings.js to something higher, like 20000 (milliseconds). After that, reduce $updateTimeout in yshout/settings.php to 10 seconds or less (0 will make the shoutbox behave like an autorefreshing shoutbox (with a delay controlled by refreshTime), rather than a shoutbox that updates automatically on new shouts).

You might also want to try enabling compression in the settings file: change $gzipCompression to true.

Changelog
Changes in 1.03 [announcement]:
Fixed incompatibility with PHP <= 4. This package can be upgraded directly over the previous version (1.02).

Changes in 1.04 [announcement]:
Fixed timezone issues (all times formatted according to user data with timeformat). Times shown will be according to user and forum time offsets.

Changes in 1.05 [announcement]:
Added a "del" option to shouts for administrators/moderators to allow for the deletion of shouts.
Added "$gzipCompression" option; this defaults to true but can be set to false if you experience issues.
Increased the security of a few functions as a precaution.
Fixed some bugs related to not using "home.txt" as the chat file. Now, it is possible to use a different file for each theme, or, if you're intrepid, a different file for different boards/users/etc. See index.template.php and search for "shoutFile".

Changes in 1.06 [description] [announcement]:
Guest support added by popular request.
Character encodings bug fixed.
Word filtering added (filters according to SMF settings)
1.1.2 support added and tested
New options to limit chat command usage (e.g. blocking commands or entirely disabling them; see yshout.php options)
Internationalization support added: default language is English (though translations are certainly welcome)
Added support for search-engine friendly pages.

Changes in 1.07 [announcement]:
Fixed long standing smileys issue.
Fixed minor bug with line counting (off-by-one)
Added CSS class "adminlink" to allow for customization of the administrative links.
1.1.3 support added.

Changes in 1.08 [announcement]:
Major bugfix and enhancement to auto-refreshing; the shoutbox should now be suitable for big forums as well as small. The basic gist of the upgrade is at http://www.simplemachines.org/community/index.php?topic=137508.msg996154;topicseen#msg996154 (thank you very much Sarke) coupled with a few minor changes that make the "push" shoutbox work :)

Changes in 1.09 [announcement]:
Addition of "$maxShoutChars" and "$maxUsernameChars" parameters for controlling shout and username lengths respectively; note that the username limit does NOT apply to registered users.
Addition of a maintenance/lock mode, activated by the /lock command and deactivated by /unlock, which makes the shoutbox read-only for everyone except admins & mods.

Changes in 1.10 [announcement]:
Compatibility with SMF 1.1.4.

Changes in 1.11 [announcement]:
Option to prevent guests from posting added. If allowGuests is true, they can still see the shoutbox, and if the new allowGuestsPosts is false, then they will be barred from posting.
The bug for pressing "Cancel" on the Extended History dialog is fixed (it now appropriately cancels, rather than redirecting to an empty history page) - thanks to pongsak for discovering this.
Users who have multiple domains or use both "www." and no-www versions of their domain names can now do so without having the shoutbox fail. The shoutbox now uses absolute paths from the server root, instead of including a domain name.

Changes in 1.12 [announcement]:
Added the option to set certain membergroups as moderators of the shoutbox.
Made the shoutbox use usergroup colors by default
One more fix for stubborn "...loading shoutbox..." problems. I've tested this on a number of configurations, and I think it should work for everyone properly now.
Fix to prevent long page loads on IE 7. Basically, on any page load request, the shoutbox aborts the current connection, using an IE-7 specific detection of that. It's a serious kludge, but it does resolve the lag on IE 7.

Changes in 1.13 [announcement]:
Removed yshout/js/prototype.js and replaced it with a much smaller file containing only the necessary components. The old prototype.js caused problems with SMF's stats page.
Moved CSS out of index.template.php and yshout.php into their own files, Themes/default/yshout-style.css and yshout/yshout-style.css respectively. This makes upgrading, installation and uninstallation much easier. Other themes don't need to be updated.

Changes in 1.14 [announcement]:
Fixed a refresh bug that could cause many requests to be sent to the server.
Merged SMF1 and SMF2 versions together. One package now works for both versions of SMF.

Changes in 1.14b [announcement]:
Fixed non-ASCII character support (regression in 1.14). Thanks to dannbass for spotting it.

Changes in 1.15 [announcement]:
Compatibility with SMF 1.15 and 2.0b3.1.
Proper support for SMF 2: fixed membergroup detection and user banning.
Installation to SMF2 via the Package Manager should work again.

Changes in 1.16 [announcement]:
Fixed storage of foreign usernames in shoutbox
Fixed postgroup bug that could cause shoutbox to fail to load

Changes in 1.20 [announcement]:
Instant-on capability for quick loading
Security fixes
Guest name url-encoding bug fixed
Settings and documentation moved to a separate files
Permissions implemented as SMF membergroup permissions
Full XHTML-compliance
Additional functions to make modifying the shoutbox easier
Additional CSS classes for more customizability
Changed /yshout/ to act as a standalone shoutbox
Hooked index.php to fix the majority of "loading shoutbox" problems with previous versions
Added a warning for missing language files to alleviate problems with foreign boards
Many miscellaneous fixes

Changes in 1.17 (last planned release of 1.1x) [announcement]:
Security fix

Changes in 1.21 [announcement]:
Removed dependencies on the Behaviour, Prototype and domFunction libraries.
Fixed a few bugs in form submission and flood control.
Fixed a bug that broke Whos Online (reported by bocco83).
Fixed security bug
Added postgroup colors

Changes in 1.22 [announcement]:
Proper SMF 2.0 Beta 4 compatibility
$gzipCompression now defaults to off, to avoid common issues with forums
Shoutbox no longer restarts session if forced to refresh

Upgrading to the Latest Version
1.2x versions are not backwards-compatible with 1.1x or 1.0x shoutbox versions. Previous versions should be uninstalled prior to installing 1.22.

1.22 includes an updater from 1.21 which you can use to update without having to uninstall.

Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

RoarinRow

Do you have a demo of this mod?   :)

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

L.G.S

#2
Does this mod have permissions?

Installed:

Fatal error: Call to undefined function: date_default_timezone_set() in /home/tscar/public_html/board/yshout/yshout.php on line 154
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


IPForums

i get the same: -

Fatal error: Call to undefined function: date_default_timezone_set() in /hsphere/local/home/iptorren/ipforums.org/forum/yshout/yshout.php on line 154

boolprop_net

boolprop.net [nofollow] - Under Construction
boolprop.net Family Forums [nofollow] - Active

Daniel15

This will only work on PHP 5.1.0 or higher, as it's using  date_default_timezone_set (A PHP 5 function) :(
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

boolprop_net

Can the date part be edited to work for 4.4.4  ???
boolprop.net [nofollow] - Under Construction
boolprop.net Family Forums [nofollow] - Active

L.G.S

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Daniel15

I didn't actually check the code, I just recognised the error. I'll look through it later and see if it can be modified to support PHP 4 :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Gobo

installed and uninstalled for me just fine

but the position of the shoutbox is a bit awkward in my opinion

tapirul


sleepy127

I have the same problem also

Gobo

if ur host isnt offering the latest software then its time to say ba-bye to them

nneonneo

OK, quick fix:
Change the line
date_default_timezone_set('America/Regina');

to
if(function_exists('date_default_timezone_set')) date_default_timezone_set('America/Regina');


I'll hopefully have a new version uploaded in the next few days. In the interim, please use that fix.

As for positioning, if you do not like the location where it is installed by default (in the header of the default template), you can move it easily.
There are three code blocks (marked with "// YSHOUT HERE" in the PHP source code, and ended with "// YSHOUT END") which are relevant: the first is a <head> block, containing both a JS include/setup section and a CSS section for the appearance, the second is a JS block to handle a collapsed header, and the third is the block for the position of the shoutbox.
The file "Themes/default/index.template.php" is modified. If you prefer the shoutbox elsewhere, simply move the aforementioned three blocks to a new file (or move the third block to a new location within the index).

Note that the second (JS) block may not apply to other files, because it is strictly for positioning the shoutbox in the header. If you do not place the shoutbox there, this block can be omitted.

Thanks for testing!
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

Geoff Mendicino

It works absolutely wonderful. I have 0 complaints about your mod after doing the fix you mentioned above. Thanks for supporting the community. *thumbs up*

If you are interested, my site has it up at:
http://pangya-hq.com/forum

I look forward towards your next release!

nneonneo

New version (1.03) uploaded.

For 1.02 users, simply download and install the new one (it's an upgrade), this should hopefully ensure that it works with PHP 4 and below.

Changes:
Added function check for date_default_timezone_set
Fixed minor typo in installation (doesn't affect existing installations)
Check out the AJAX Shoutbox (my one and only mod to date :P)
Do you like SMF? Are you using ProBoards, InvisionFree, ActiveBoards or some other web-hosted forum? I can help you convert to SMF (without having to purchase a DB conversion)...contact me [nneonneo {at} gmail *dot* com], and see this topic
spammers here!

Geoff Mendicino

Spotted an urk.

It won't allow me to load 2 shoutboxes at the same time; it seems intentional, but it is inconvenient for me.

donmusido

file SB_1.03.tgz (30KB) failed... it's no go decompress?
I used WinRAR  :(

RoarinRow

After I uploaded, there was an error I could not remember, and now I can't get to my packages sections of the Admin Control Panel.  very strange. 

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Gobo

delete the package file via FTP from ur Packages folder if u are getting an intrnal server error
that should fix it

otherwise if its another error, then post it here and maybe i or someone else can help out

Advertisement: