Archived
1
0

* use people with 'moderate_board' permission instead of only Global Moderators

* transformed from boardmod to new funky XML style
This commit is contained in:
mbirth 2006-08-28 18:30:54 +00:00
parent 36251d4fac
commit d7f8b3d423
7 changed files with 236 additions and 325 deletions

View File

@ -12,7 +12,7 @@ $txt['sbox_Guest'] = 'Gast';
// Einstellungen
$txt['sbox_Visible'] = 'Shoutbox ist sichtbar';
$txt['sbox_ModsRule'] = 'Global-Moderatoren können Shouts löschen';
$txt['sbox_ModsRule'] = 'Moderatoren können Shouts löschen';
$txt['sbox_DoHistory'] = 'Shout-Verlauf anlegen';
$txt['sbox_GuestVisible'] = 'Shoutbox ist für Gäste sichtbar';

View File

@ -42,6 +42,7 @@ $languagedir/Help.german.php
//SMF Shoutbox
$helptxt['sbox_Visible'] = 'Hier können Sie einstellen, ob die Shoutbox sichtbar ist oder nicht. Diese Einstellung gilt für ALLE Benutzer.';
$helptxt['sbox_ModsRule'] = 'Dies erlaubt jedem, der die <i>moderate_board</i>-Berechtigung auf mindestens einem Board hat, Shouts zu l&ouml;schen.';
$helptxt['sbox_DoHistory'] = 'Legt fest, ob alle Shouts auch in eine Verlaufsdatei geschrieben werden sollen, so dass ein Administrator angebliche Vorf&auml;lle nachpr&uuml;fen kann.';
$helptxt['sbox_GuestVisible'] = 'Hiermit k&ouml;nnen Sie festlegen, ob G&auml;ste die Shoutbox &uuml;berhaupt sehen k&ouml;nnen oder nicht.';

View File

@ -14,16 +14,14 @@
<require-file name="chat-inbound_GSM.wav" destination="$boarddir" />
<require-file name="sbox_v1.13_german.zip" destination="$boarddir/Packages" />
<code type="file">sbox_setup.php</code>
<readme type="inline">
<![CDATA[
<readme type="inline"><![CDATA[
This allows you to put a shoutbox on your SMF forum above the board index of the default theme.
Originally written By Deep (diem4@gmx.net), inspired by Matthew Wolf (a.k.a Grudge)
Heavily improved by Markus Birth (mbirth@webwriters.de)
Copyright 2006 - Neither this package or any of it's contents may be distributed without authorisation.
]]>
</readme>
<modification type="file" format="boardmod">sbox_11rc3.mod</modification>
]]></readme>
<modification type="file">sbox_latest.xml</modification>
</install>
<install for="1.1 RC3">
<require-file name="sbox.php" destination="$sourcedir" />
@ -34,20 +32,18 @@
<require-file name="chat-inbound_GSM.wav" destination="$boarddir" />
<require-file name="sbox_v1.13_german.zip" destination="$boarddir/Packages" />
<code type="file">sbox_setup.php</code>
<readme type="inline">
<![CDATA[
<readme type="inline"><![CDATA[
This allows you to put a shoutbox on your SMF forum above the board index of the default theme.
Originally written By Deep (diem4@gmx.net), inspired by Matthew Wolf (a.k.a Grudge)
Heavily improved by Markus Birth (mbirth@webwriters.de)
Copyright 2006 - Neither this package or any of it's contents may be distributed without authorisation.
]]>
</readme>
<modification type="file" format="boardmod">sbox_11rc3.mod</modification>
]]></readme>
<modification type="file">sbox_latest.xml</modification>
</install>
<uninstall for="1.1 RC2">
<readme type="inline">Uninstall will remove all the changes made by the shoutbox. You must do this before upgrading!</readme>
<modification type="file" format="boardmod" reverse="true">sbox_11rc3.mod</modification>
<modification type="file" reverse="true">sbox_latest.xml</modification>
<remove-file name="$sourcedir/sbox.php" />
<remove-file name="$sourcedir/sboxDB.php" />
<remove-file name="$languagedir/sbox.english.php" />
@ -60,7 +56,7 @@
</uninstall>
<uninstall for="1.1 RC3">
<readme type="inline">Uninstall will remove all the changes made by the shoutbox. You must do this before upgrading!</readme>
<modification type="file" format="boardmod" reverse="true">sbox_11rc3.mod</modification>
<modification type="file" reverse="true">sbox_latest.xml</modification>
<remove-file name="$sourcedir/sbox.php" />
<remove-file name="$sourcedir/sboxDB.php" />
<remove-file name="$languagedir/sbox.english.php" />

View File

@ -12,7 +12,7 @@ $txt['sbox_Guest'] = 'Guest';
// Settings
$txt['sbox_Visible'] = 'Shoutbox is visible';
$txt['sbox_ModsRule'] = 'Global Moderators can delete shouts';
$txt['sbox_ModsRule'] = 'Moderators can delete shouts';
$txt['sbox_DoHistory'] = 'Create history of shouts';
$txt['sbox_GuestVisible'] = 'Make Shoutbox visible to Guests';

View File

@ -199,7 +199,7 @@ if (!empty($_REQUEST['action'])) switch ($_REQUEST['action']) {
break;
case 'kill':
if (!empty($_REQUEST['kill']) && ($context['user']['is_admin'] || ($modSettings['sbox_ModsRule'] && allowedTo('manage_boards')))) {
if (!empty($_REQUEST['kill']) && ($context['user']['is_admin'] || ($modSettings['sbox_ModsRule'] && count(boardsAllowedTo('moderate_board'))>0))) {
$sql = 'DELETE FROM ' . $db_prefix . 'sbox_content WHERE id=' . intval($_REQUEST['kill']);
db_query($sql, __FILE__, __LINE__);
}
@ -303,7 +303,7 @@ if(mysql_num_rows($result)) {
echo "\n" . '<div class="' . $divclass . '" style="color: #' . $colh . '">'; */
echo "\n" . '<div class="' . $divclass . '">';
if ($context['user']['is_admin'] || ($modSettings['sbox_ModsRule'] && allowedTo('manage_boards'))) {
if ($context['user']['is_admin'] || ($modSettings['sbox_ModsRule'] && count(boardsAllowedTo('moderate_board'))>0)) {
echo '[<a title="' . $txt['sbox_KillShout'] . '" class="Kill" onClick="return kill();" href="' . $_SERVER['PHP_SELF'] . '?action=kill&kill=' . $row['id'] . '">X</a>]';
}

View File

@ -1,309 +0,0 @@
<id>
SMF Shoutbox
</id>
<version>
1.13
</version>
<mod info>
This is a shoutbox with seamless integration into SMF.
Any registered user and any guest (if you allow them to use it) can type in a message and click shout.
The shoubox appears above the board index of the default theme. To do that, BoardIndex.template.php
of the default theme will be modified.
If you are using another theme, please modify the BoardIndex.template.php of that theme manually.
Maybe you have to modify sbox.template.php a little bit if u are using an "unusual" theme.
Instructions:
1. Install SMF shoutbox using boardmod (it´s too complex to install manually)
2. Go into the Feature Settings page and choose the appropriate settings
3. Type in a message and click Shout!
If you really want to install this mod manually, please use this file as a "how to".
Author:
The SMF shoutbox was originally written by Deep, some code ist "stolen" from Matthew Wolf (a.k.a Grudge).
The current version was heavily improved by Markus Birth.
Thanks a lot, Grudge!
Please direct any questions regarding this version to Deep, either by email (diem4@gmx.net) or by posting
in the appropriate place at www.simplemachines.org (the preferred option!)
History:
Version 1.12
* made compatible with SMF 1.1rc3
* moved basic strings from Modifications.<lang>.php to sbox.<lang>.php so that there now is language fallback to English (and 1 file less to change)
+ check for lock before removing History file
x JavaScript clear() was reserved, renamed to clearHist()
x active refresh on new shout
+ included language pack into main setup package so that distribution should be easier
Version 1.11
+ added German language-pack
+ added switch to disable linking to profile pages
+ added switch to disable Refresh after there have been no posts in lastActive time
* shortened some CSS classnames
Version 1.10
1. sequential messages from one user have the same color
2. character limit for one shout has been raised to 320 chars (like one long SMS ;-)
3. displayed weekdays are now in the language the user has chosen in SMF and from SMF's language files
4. sBox-time is kept in sync with SMF's time (including all timezone-stuff)
5. there's a bar displayed showing what's new since the last refresh
6. poster's name can be clicked to show his profile
7. no HTML allowed
8. your own nick is made bold and a sound is played on first occurence
9. sbox now uses SMF's smileys and BBCode, option in settings shows the smiley-row known from posting messages in SMF
10. now user's "Display Name"s are shown instead of usernames
!! There's some experimental code commented out - maybe someone will make it work some day. It's
!! for showing who's viewing the shoutbox and for giving each user a specific unique distinguishable color.
version 1.04
1. font family is now adjustable
2. german language pack extracted
version 1.03
1. another refreshing bug fixed
2. help texts (admin interface) added
3. javascript bug (opera and netscape only) fixed
4. smilie window now can be made invisible
5. shouts can be deleted by admin
6. font color, font size and background color can be adjusted
version 1.02
1. javascript/html bugs fixed
2. error when shouting empty string fixed
version 1.01:
1. some debug code removed
2. refreshing bug fixed
3. file path bug fixed
version 1.00:
Original Version
</mod info>
<author>
Deep and Markus Birth
</author>
<homepage>
http://mods.simplemachines.org/index.php?mod=412
</homepage>
<edit file>
$sourcedir/ModSettings.php
</edit file>
<search for>
'karma' => 'ModifyKarmaSettings',
</search for>
<add after>
'sbox' => 'ModifySboxSettings',
</add after>
<search for>
'layout' => array(
'title' => $txt['mods_cat_layout'],
'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
),
</search for>
<add after>
'sbox' => array(
'title' => $txt['sbox_ModTitle'],
'href' => $scripturl . '?action=featuresettings;sa=sbox;sesc=' . $context['session_id'],
),
</add after>
<search for>
function ModifyKarmaSettings()
</search for>
<add before>
loadLanguage('sbox');
function ModifySboxSettings()
{
global $txt, $scripturl, $context, $settings, $sc;
$config_vars = array
(
// Generic stuff
array('check', 'sbox_Visible'),
array('check', 'sbox_ModsRule'),
array('check', 'sbox_DoHistory'),
'',
// Guest stuff
array('check', 'sbox_GuestVisible'),
array('check', 'sbox_GuestAllowed'),
array('check', 'sbox_GuestBBC'),
'',
// Visual
array('check', 'sbox_SmiliesVisible'),
array('check', 'sbox_UserLinksVisible'),
array('check', 'sbox_AllowBBC'),
array('check', 'sbox_NewShoutsBar'),
array('int', 'sbox_MaxLines'),
array('int', 'sbox_Height'),
'',
// Miscellaneous
array('int', 'sbox_RefreshTime'),
array('check', 'sbox_BlockRefresh'),
array('check', 'sbox_EnableSounds'),
'',
// Font stuff
array('select', 'sbox_FontFamily1', array(
'Garamond, serif' => 'Garamond, serif',
'Times, serif' => 'Times, serif',
'Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif',
'Tahoma, Helvetica, sans-sarif' => 'Tahoma, Helvetica, sans-sarif',
'Verdana, sans-serif' => 'Verdana, sans-serif',
'cursive' => 'cursive',
'Palatino, fantasy' => 'Palatino, fantasy',
'Courier, monospace' => 'Courier, monospace'
),
),
array('select', 'sbox_FontFamily2', array(
'Garamond, serif' => 'Garamond, serif',
'Times, serif' => 'Times, serif',
'Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif',
'Tahoma, Helvetica, sans-sarif' => 'Tahoma, Helvetica, sans-sarif',
'Verdana, sans-serif' => 'Verdana, sans-serif',
'cursive' => 'cursive',
'Palatino, fantasy' => 'Palatino, fantasy',
'Courier, monospace' => 'Courier, monospace'
),
),
array('select', 'sbox_TextSize1', array(
'6pt' => '6pt',
'7pt' => '7pt',
'8pt' => '8pt',
'9pt' => '9pt',
'10pt' => '10pt',
'11pt' => '11pt',
'12pt' => '12pt',
'13pt' => '13pt',
'14pt' => '14pt',
'15pt' => '15pt',
'16pt' => '16pt',
'xx-small' => 'xx-small',
'x-small' => 'x-small',
'small' => 'small',
'medium' => 'medium',
'large' => 'large',
'x-large' => 'x-large',
'xx-large' => 'xx-large'
),
),
array('text', 'sbox_TextColor1'),
array('select', 'sbox_TextSize2', array(
'6pt' => '6pt',
'7pt' => '7pt',
'8pt' => '8pt',
'9pt' => '9pt',
'10pt' => '10pt',
'11pt' => '11pt',
'12pt' => '12pt',
'13pt' => '13pt',
'14pt' => '14pt',
'15pt' => '15pt',
'16pt' => '16pt',
'xx-small' => 'xx-small',
'x-small' => 'x-small',
'small' => 'small',
'medium' => 'medium',
'large' => 'large',
'x-large' => 'x-large',
'xx-large' => 'xx-large'
),
),
array('text', 'sbox_TextColor2'),
array('text', 'sbox_BackgroundColor'),
);
// Saving?
if (isset($_GET['save']))
{
saveDBSettings($config_vars);
redirectexit('action=featuresettings;sa=sbox');
}
$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=sbox';
$context['settings_title'] = $txt['sbox_ModTitle'];
prepareDBSettingContext($config_vars);
}
</add before>
<edit file>
$sourcedir/Subs.php
</edit file>
<search for>
log_error('Copyright removed!!');
}
}
</search for>
<add after>
function sbox()
{
global $sourcedir;
include_once("$sourcedir/sbox.php");
sbox_display();
}
</add after>
<edit file>
$themedir/BoardIndex.template.php
</edit file>
<search for>
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/fader.js"></script>
</td>
</tr>
</table>';
}
</search for>
<add after>
// display shoutbox
if (function_exists('sbox')) sbox();
</add after>
<edit file>
$languagedir/Help.english.php
</edit file>
<search for>
?>
</search for>
<add before>
//SMF Shoutbox
$helptxt['sbox_Visible'] = 'Here you can decide wether the shoutbox is visible at all or not.';
$helptxt['sbox_DoHistory'] = 'Defines whether all shouts should be written to a file so that an Administrator can check what was going on.';
$helptxt['sbox_GuestVisible'] = 'Defines whether the Shoutbox is visible to guests at all.';
$helptxt['sbox_GuestAllowed'] = 'Here you can decide whether guests are allowed to post new shouts.';
$helptxt['sbox_GuestBBC'] = 'Here you can switch BBCode parsing for Guest-shouts. Note that this won\'t work if the <i>Allow BBCode</i> setting is turned off.';
$helptxt['sbox_SmiliesVisible'] = 'Here you can decide whether smileys are visible or not. They work independently of this setting, though.';
$helptxt['sbox_UserLinksVisible'] = 'Defines whether the names of shouters are linked to their profile page or not.';
$helptxt['sbox_AllowBBC'] = 'Defines whether users are allowed to use BBCode in shouts. If disabled, only plain text is displayed - no smileys, no formatting. This option also affects the <i>Allow BBCode for Guest-shouts</i>-option.';
$helptxt['sbox_NewShoutsBar'] = 'Enable to show a line between new shouts (since the last refresh) and old ones.';
$helptxt['sbox_RefreshTime'] = 'Here you can adjust the refresh time';
$helptxt['sbox_BlockRefresh'] = 'Defines whether the Shoutbox should stop refreshing after there have been no new shouts for a while. Users can still manually refresh the Shoutbox. The time treshold used is the <i>User online time treshold</i> found in the <i>Basic Features</i>-settings. (currently ' . $modSettings['lastActive'] . ' minutes)';
$helptxt['sbox_EnableSounds'] = 'Enables the notification sound, when your nickname was mentioned since the last refresh.';
</add before>

223
sbox_latest.xml Normal file
View File

@ -0,0 +1,223 @@
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "modification.dtd">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a modification file for SMF.
ATTENTION: If you are trying to install this manually, you should try
the package manager. If it will not work for you, please take a look
at the following for information on this format:
http://mods.simplemachines.org/docs/manual-install.php
================================================================================
Modification files can be used to modify files so that they do what
your package needs them to do to work properly.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<!-- This information needs to be the same as that in the package-info.xml. -->
<id>Deep:SMF_Shoutbox</id>
<version>1.13</version>
<!-- Edit BoardIndex.template.php in the SMF Default Theme. -->
<file name="$themedir/BoardIndex.template.php">
<operation>
<search position="replace"><![CDATA[
/* Each category in categories is made up of:
]]></search>
<add><![CDATA[
// display shoutbox
if (function_exists('sbox')) sbox();
/* (SMF Shoutbox added above!) Each category in categories is made up of:
]]></add>
</operation>
</file>
<!-- Edit Subs.php and add sbox(). -->
<file name="$sourcedir/Subs.php">
<operation>
<search position="end"></search>
<add><![CDATA[
function sbox() {
global $sourcedir;
include_once("$sourcedir/sbox.php");
sbox_display();
}
]]></add>
</operation>
</file>
<!-- Edit Help.english.php and add strings. -->
<file name="$languagedir/Help.english.php">
<operation>
<search position="end"></search>
<add><![CDATA[
//SMF Shoutbox
$helptxt['sbox_Visible'] = 'Here you can decide wether the shoutbox is visible at all or not.';
$helptxt['sbox_ModsRule'] = 'This enables anyone who has the <i>moderate_board</i> permission on at least one board, to delete shouts.';
$helptxt['sbox_DoHistory'] = 'Defines whether all shouts should be written to a file so that an Administrator can check what was going on.';
$helptxt['sbox_GuestVisible'] = 'Defines whether the Shoutbox is visible to guests at all.';
$helptxt['sbox_GuestAllowed'] = 'Here you can decide whether guests are allowed to post new shouts.';
$helptxt['sbox_GuestBBC'] = 'Here you can switch BBCode parsing for Guest-shouts. Note that this won\'t work if the <i>Allow BBCode</i> setting is turned off.';
$helptxt['sbox_SmiliesVisible'] = 'Here you can decide whether smileys are visible or not. They work independently of this setting, though.';
$helptxt['sbox_UserLinksVisible'] = 'Defines whether the names of shouters are linked to their profile page or not.';
$helptxt['sbox_AllowBBC'] = 'Defines whether users are allowed to use BBCode in shouts. If disabled, only plain text is displayed - no smileys, no formatting. This option also affects the <i>Allow BBCode for Guest-shouts</i>-option.';
$helptxt['sbox_NewShoutsBar'] = 'Enable to show a line between new shouts (since the last refresh) and old ones.';
$helptxt['sbox_RefreshTime'] = 'Here you can adjust the refresh time';
$helptxt['sbox_BlockRefresh'] = 'Defines whether the Shoutbox should stop refreshing after there have been no new shouts for a while. Users can still manually refresh the Shoutbox. The time treshold used is the <i>User online time treshold</i> found in the <i>Basic Features</i>-settings. (currently ' . $modSettings['lastActive'] . ' minutes)';
$helptxt['sbox_EnableSounds'] = 'Enables the notification sound, when your nickname was mentioned since the last refresh.';
]]></add>
</operation>
</file>
<!-- Edit ModSettings.php and add settings stuff. -->
<file name="$sourcedir/ModSettings.php">
<operation>
<search position="before"><![CDATA[
'karma' => 'ModifyKarmaSettings',
]]></search>
<add><![CDATA[
'sbox' => 'ModifySboxSettings',
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
'layout' => array(
'title' => $txt['mods_cat_layout'],
'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
),
]]></search>
<add><![CDATA[
'sbox' => array(
'title' => $txt['sbox_ModTitle'],
'href' => $scripturl . '?action=featuresettings;sa=sbox;sesc=' . $context['session_id'],
),
]]></add>
</operation>
<operation>
<search position="end"></search>
<add><![CDATA[
loadLanguage('sbox');
function ModifySboxSettings() {
global $txt, $scripturl, $context, $settings, $sc;
$config_vars = array(
// Generic stuff
array('check', 'sbox_Visible'),
array('check', 'sbox_ModsRule'),
array('check', 'sbox_DoHistory'),
'',
// Guest stuff
array('check', 'sbox_GuestVisible'),
array('check', 'sbox_GuestAllowed'),
array('check', 'sbox_GuestBBC'),
'',
// Visual
array('check', 'sbox_SmiliesVisible'),
array('check', 'sbox_UserLinksVisible'),
array('check', 'sbox_AllowBBC'),
array('check', 'sbox_NewShoutsBar'),
array('int', 'sbox_MaxLines'),
array('int', 'sbox_Height'),
'',
// Miscellaneous
array('int', 'sbox_RefreshTime'),
array('check', 'sbox_BlockRefresh'),
array('check', 'sbox_EnableSounds'),
'',
// Font stuff
array('select', 'sbox_FontFamily1', array(
'Garamond, serif' => 'Garamond, serif',
'Times, serif' => 'Times, serif',
'Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif',
'Tahoma, Helvetica, sans-sarif' => 'Tahoma, Helvetica, sans-sarif',
'Verdana, sans-serif' => 'Verdana, sans-serif',
'cursive' => 'cursive',
'Palatino, fantasy' => 'Palatino, fantasy',
'Courier, monospace' => 'Courier, monospace',
),
),
array('select', 'sbox_FontFamily2', array(
'Garamond, serif' => 'Garamond, serif',
'Times, serif' => 'Times, serif',
'Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif',
'Tahoma, Helvetica, sans-sarif' => 'Tahoma, Helvetica, sans-sarif',
'Verdana, sans-serif' => 'Verdana, sans-serif',
'cursive' => 'cursive',
'Palatino, fantasy' => 'Palatino, fantasy',
'Courier, monospace' => 'Courier, monospace'
),
),
array('select', 'sbox_TextSize1', array(
'6pt' => '6pt',
'7pt' => '7pt',
'8pt' => '8pt',
'9pt' => '9pt',
'10pt' => '10pt',
'11pt' => '11pt',
'12pt' => '12pt',
'13pt' => '13pt',
'14pt' => '14pt',
'15pt' => '15pt',
'16pt' => '16pt',
'xx-small' => 'xx-small',
'x-small' => 'x-small',
'small' => 'small',
'medium' => 'medium',
'large' => 'large',
'x-large' => 'x-large',
'xx-large' => 'xx-large'
),
),
array('text', 'sbox_TextColor1'),
array('select', 'sbox_TextSize2', array(
'6pt' => '6pt',
'7pt' => '7pt',
'8pt' => '8pt',
'9pt' => '9pt',
'10pt' => '10pt',
'11pt' => '11pt',
'12pt' => '12pt',
'13pt' => '13pt',
'14pt' => '14pt',
'15pt' => '15pt',
'16pt' => '16pt',
'xx-small' => 'xx-small',
'x-small' => 'x-small',
'small' => 'small',
'medium' => 'medium',
'large' => 'large',
'x-large' => 'x-large',
'xx-large' => 'xx-large'
),
),
array('text', 'sbox_TextColor2'),
array('text', 'sbox_BackgroundColor'),
);
// Saving?
if (isset($_GET['save'])) {
saveDBSettings($config_vars);
redirectexit('action=featuresettings;sa=sbox');
}
$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=sbox';
$context['settings_title'] = $txt['sbox_ModTitle'];
prepareDBSettingContext($config_vars);
}
]]></add>
</operation>
</file>
</modification>