Archived
1
0

* raised version to 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
This commit is contained in:
mbirth 2006-08-23 06:36:45 +00:00
parent d011b2b6cd
commit 5cdb0f1d7b
8 changed files with 202 additions and 142 deletions

View File

@ -4,8 +4,9 @@
<name>SMF Shoutbox LanguagePack German</name> <name>SMF Shoutbox LanguagePack German</name>
<id>Deep:SMF_Shoutbox:LangPack_German</id> <id>Deep:SMF_Shoutbox:LangPack_German</id>
<type>modification</type> <type>modification</type>
<version>1.11</version> <version>1.12</version>
<install for="1.1 RC2"> <install>
<require-file name="sbox.german.php" destination="$languagedir" />
<readme type="inline"> <readme type="inline">
<![CDATA[ <![CDATA[
This adds the german language pack for SMF shoutbox to your SMF forum. This adds the german language pack for SMF shoutbox to your SMF forum.
@ -15,13 +16,11 @@
Copyright 2006 - Neither this package or any of it's contents may be distributed without authorization. Copyright 2006 - Neither this package or any of it's contents may be distributed without authorization.
]]> ]]>
</readme> </readme>
<modification type="file" format="boardmod">sbox_11rc2_german.mod</modification> <modification type="file" format="boardmod">sbox_11rc3_german.mod</modification>
</install> </install>
<uninstall for="1.1 RC2"> <uninstall>
<remove-file name="$languagedir/sbox.german.php" />
<readme type="inline">Uninstall will remove all the changes made by the SMF shoutbox german language pack. You must do this before upgrading!</readme> <readme type="inline">Uninstall will remove all the changes made by the SMF shoutbox german language pack. You must do this before upgrading!</readme>
<modification type="file" format="boardmod" reverse="true">sbox_11rc2_german.mod</modification> <modification type="file" format="boardmod" reverse="true">sbox_11rc3_german.mod</modification>
</uninstall> </uninstall>
<install>
<readme type="inline">Sorry, but the SMF Shoutbox Mod doesn't support your SMF version!</readme>
</install>
</package-info> </package-info>

View File

@ -0,0 +1,31 @@
<?php
//SMF Shoutbox
$txt['sbox_ModTitle'] = 'SMF Shoutbox';
$txt['sbox_Visible'] = 'Shoutbox ist sichtbar';
$txt['sbox_GuestAllowed'] = 'G&auml;ste d&uuml;rfen shouten';
$txt['sbox_GuestVisible'] = 'Shoutbox ist f&uuml;r G&auml;ste sichtbar';
$txt['sbox_MaxLines'] = 'Anzahl der angezeigten Zeilen';
$txt['sbox_Height'] = 'Shoutbox-H&ouml;he (px)';
$txt['sbox_SmiliesVisible'] = 'Smiley-Zeile ist sichtbar';
$txt['sbox_UserLinksVisible'] = 'Shouter-Namen mit Profil verlinken';
$txt['sbox_KillShout'] = 'Diesen Shout löschen?';
$txt['sbox_TextSize1'] = '1. Schriftgr&ouml;&szlig;e';
$txt['sbox_TextColor1'] = '1. Schriftfarbe';
$txt['sbox_TextSize2'] = '2. Schriftgr&ouml;&szlig;e';
$txt['sbox_TextColor2'] = '2. Schriftfarbe';
$txt['sbox_RefreshTime'] = 'Aktualisierungsintervall';
$txt['sbox_BlockRefresh'] = 'Aktualisierung nach Inaktivit&auml;t stoppen (' . $modSettings['lastActive'] . ' min)';
$txt['sbox_BackgroundColor'] = 'Hintergrundfarbe';
$txt['sbox_FontFamily1'] = '1. Schriftart';
$txt['sbox_FontFamily2'] = '2. Schriftart';
$txt['sbox_DoHistory'] = 'Shout-Verlauf anlegen';
$txt['sbox_AllowBBC'] = 'BBCode erlauben';
$txt['sbox_Refresh'] = 'Neu laden';
$txt['sbox_RefreshBlocked'] = 'Automatische Aktualisierung wegen Inaktivit&auml;t ausgeschaltet';
$txt['sbox_History'] = 'Verlauf';
$txt['sbox_HistoryClear'] = 'Verlauf l&ouml;schen';
$txt['sbox_HistoryNotFound'] = 'Kein Verlauf gefunden.';
$txt['sbox_EnableSounds'] = 'Kl&auml;nge abspielen';
?>

View File

@ -3,7 +3,7 @@ SMF Shoutbox , German Language Pack
</id> </id>
<version> <version>
1.11 1.12
</version> </version>
<mod info> <mod info>

View File

@ -4,14 +4,15 @@
<name>SMF Shoutbox</name> <name>SMF Shoutbox</name>
<id>Deep:SMF_Shoutbox</id> <id>Deep:SMF_Shoutbox</id>
<type>modification</type> <type>modification</type>
<version>1.11</version> <version>1.12</version>
<install for="1.1 RC2"> <install for="1.1 RC2">
<require-file name="sbox.php" destination="$sourcedir" /> <require-file name="sbox.php" destination="$sourcedir" />
<require-file name="sboxDB.php" destination="$sourcedir" /> <require-file name="sboxDB.php" destination="$sourcedir" />
<require-file name="sbox.english.php" destination="$languagedir" />
<require-file name="sbox.template.php" destination="$themedir" /> <require-file name="sbox.template.php" destination="$themedir" />
<require-file name="sbox_refresh.gif" destination="$themedir/images" /> <require-file name="sbox_refresh.gif" destination="$themedir/images" />
<require-file name="chat-inbound_GSM.wav" destination="$boarddir" /> <require-file name="chat-inbound_GSM.wav" destination="$boarddir" />
<require-file name="sbox_v1.11_german.zip" destination="$boarddir/Packages" /> <require-file name="sbox_v1.12_german.zip" destination="$boarddir/Packages" />
<code type="file">sbox_setup.php</code> <code type="file">sbox_setup.php</code>
<readme type="inline"> <readme type="inline">
<![CDATA[ <![CDATA[
@ -22,18 +23,52 @@
Copyright 2006 - Neither this package or any of it's contents may be distributed without authorisation. Copyright 2006 - Neither this package or any of it's contents may be distributed without authorisation.
]]> ]]>
</readme> </readme>
<modification type="file" format="boardmod">sbox_11rc2.mod</modification> <modification type="file" format="boardmod">sbox_11rc3.mod</modification>
</install>
<install for="1.1 RC3">
<require-file name="sbox.php" destination="$sourcedir" />
<require-file name="sboxDB.php" destination="$sourcedir" />
<require-file name="sbox.english.php" destination="$languagedir" />
<require-file name="sbox.template.php" destination="$themedir" />
<require-file name="sbox_refresh.gif" destination="$themedir/images" />
<require-file name="chat-inbound_GSM.wav" destination="$boarddir" />
<require-file name="sbox_v1.12_german.zip" destination="$boarddir/Packages" />
<code type="file">sbox_setup.php</code>
<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>
</install> </install>
<uninstall for="1.1 RC2"> <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> <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_11rc2.mod</modification> <modification type="file" format="boardmod" reverse="true">sbox_11rc3.mod</modification>
<remove-file name="$sourcedir/sbox.php" /> <remove-file name="$sourcedir/sbox.php" />
<remove-file name="$sourcedir/sboxDB.php" /> <remove-file name="$sourcedir/sboxDB.php" />
<remove-file name="$languagedir/sbox.english.php" />
<remove-file name="$themedir/sbox.template.php" /> <remove-file name="$themedir/sbox.template.php" />
<remove-file name="$themedir/images/sbox_refresh.gif" /> <remove-file name="$themedir/images/sbox_refresh.gif" />
<remove-file name="$boarddir/chat-inbound_GSM.wav" /> <remove-file name="$boarddir/chat-inbound_GSM.wav" />
<remove-file name="$boarddir/sbox.history.html" /> <remove-file name="$boarddir/sbox.history.html" />
<remove-file name="$boarddir/Packages/sbox_v1.11_german.zip" /> <remove-file name="$boarddir/Packages/sbox_v1.12_german.zip" />
<code type="file">sbox_remove.php</code>
</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>
<remove-file name="$sourcedir/sbox.php" />
<remove-file name="$sourcedir/sboxDB.php" />
<remove-file name="$languagedir/sbox.english.php" />
<remove-file name="$themedir/sbox.template.php" />
<remove-file name="$themedir/images/sbox_refresh.gif" />
<remove-file name="$boarddir/chat-inbound_GSM.wav" />
<remove-file name="$boarddir/sbox.history.html" />
<remove-file name="$boarddir/Packages/sbox_v1.12_german.zip" />
<code type="file">sbox_remove.php</code> <code type="file">sbox_remove.php</code>
</uninstall> </uninstall>
<install> <install>

31
sbox.english.php Normal file
View File

@ -0,0 +1,31 @@
<?php
//SMF Shoutbox
$txt['sbox_ModTitle'] = 'SMF Shoutbox';
$txt['sbox_Visible'] = 'Shoutbox is visible';
$txt['sbox_GuestAllowed'] = 'Guests are allowed to shout';
$txt['sbox_GuestVisible'] = 'Make Shoutbox visible to Guests';
$txt['sbox_MaxLines'] = 'Maximum number of displayed shouts';
$txt['sbox_Height'] = 'Shoutbox height (px)';
$txt['sbox_SmiliesVisible'] = 'Smiley row is visible';
$txt['sbox_UserLinksVisible'] = 'Show profile links';
$txt['sbox_KillShout'] = 'Dou you want to kill this shout?';
$txt['sbox_TextSize1'] = '1. Font size';
$txt['sbox_TextColor1'] = '1. Font color';
$txt['sbox_TextSize2'] = '2. Font size';
$txt['sbox_TextColor2'] = '2. Font color';
$txt['sbox_RefreshTime'] = 'Refresh time';
$txt['sbox_BlockRefresh'] = 'Block Refresh after inactivity (' . $modSettings['lastActive'] . ' mins)';
$txt['sbox_BackgroundColor'] = 'Background color';
$txt['sbox_FontFamily1'] = '1. Font family';
$txt['sbox_FontFamily2'] = '2. Font family';
$txt['sbox_DoHistory'] = 'Create history of shouts';
$txt['sbox_AllowBBC'] = 'Allow BBCode';
$txt['sbox_Refresh'] = 'Refresh';
$txt['sbox_RefreshBlocked'] = 'Automatic refresh disabled due to inactivity';
$txt['sbox_History'] = 'History';
$txt['sbox_HistoryClear'] = 'Clear history';
$txt['sbox_HistoryNotFound'] = 'No history found.';
$txt['sbox_EnableSounds'] = 'Enable sounds';
?>

View File

@ -30,9 +30,10 @@ function sbox_display()
if ($modSettings['sbox_Visible'] != '0') if ($modSettings['sbox_Visible'] != '0')
{ {
// Load the template! loadLanguage('sbox');
loadTemplate('sbox'); loadTemplate('sbox');
template_shout_box(); template_shout_box();
} }
} }
?> ?>

View File

@ -8,9 +8,7 @@ require("../SSI.php");
if (!defined('SMF')) if (!defined('SMF'))
die('Hacking attempt...'); die('Hacking attempt...');
// global variables (they are always global since we're here in the main routine) loadLanguage('sbox');
// global $db_connection, $context, $settings, $txt, $user_info, $modSettings, $db_prefix, $boarddir, $boardurl;
$sbox_HistoryFile = $boarddir . '/sbox.history.html'; $sbox_HistoryFile = $boarddir . '/sbox.history.html';
// BEGIN: BORROWED FROM http://de2.php.net/manual/en/function.flock.php // BEGIN: BORROWED FROM http://de2.php.net/manual/en/function.flock.php
@ -175,8 +173,12 @@ if (!empty($_REQUEST['action'])) switch ($_REQUEST['action']) {
case 'clearhist': case 'clearhist':
if ($context['user']['is_admin']) { if ($context['user']['is_admin']) {
if (file_exists($sbox_HistoryFile)) { if (file_exists($sbox_HistoryFile)) {
// TODO: Check for existing lock, wait for lock to be released and delete then. $lockDir = $sbox_HistoryFile . '.lock';
@unlink($sbox_HistoryFile); $start = time();
while ((is_dir($lockDir)) && ((time() - $start) < 5)) {
usleep(100000); // sleep 1/10th of a second (for a PC these are ages!)
}
if (!is_dir($lockDir)) @unlink($sbox_HistoryFile);
} }
} }
break; break;
@ -202,19 +204,17 @@ if ($refreshBlocked) {
echo '</b></div>'; echo '</b></div>';
if ($context['user']['is_admin']) { if ($context['user']['is_admin']) {
echo "\n" . '<div class="Odd">';
if ($modSettings['sbox_DoHistory'] == '1') { if ($modSettings['sbox_DoHistory'] == '1') {
echo "\n" . '<div class="Odd">';
if (file_exists($sbox_HistoryFile)) { if (file_exists($sbox_HistoryFile)) {
echo '[<a href="' . str_replace($boarddir, $boardurl, $sbox_HistoryFile) . '" target="_blank">' . $txt['sbox_History'] . '</a>]'; echo '[<a href="' . str_replace($boarddir, $boardurl, $sbox_HistoryFile) . '" target="_blank">' . $txt['sbox_History'] . '</a>]';
echo ' [<a href="' . $_SERVER['PHP_SELF'] . '?action=clearhist" class="Kill" onClick="return clearHist();">' . $txt['sbox_HistoryClear'] . '</a>]'; echo ' [<a href="' . $_SERVER['PHP_SELF'] . '?action=clearhist" class="Kill" onClick="return clearHist();">' . $txt['sbox_HistoryClear'] . '</a>]';
} else { } else {
echo '[' . $txt['sbox_HistoryNotFound'] . ']'; echo '[' . $txt['sbox_HistoryNotFound'] . ']';
} }
}
// debug output for separator-bar
// echo ' ( CurTime: ' . forum_time(true) . ' / LastTime: ' . $_REQUEST['ts'] . ' )';
echo '</div>'; echo '</div>';
} }
}
/* /*
if (!empty($settings['display_who_viewing'])) { if (!empty($settings['display_who_viewing'])) {

View File

@ -3,7 +3,7 @@ SMF Shoutbox
</id> </id>
<version> <version>
1.11 1.12
</version> </version>
<mod info> <mod info>
@ -31,6 +31,9 @@ Please direct any questions regarding this version to Deep, either by email (die
in the appropriate place at www.simplemachines.org (the preferred option!) in the appropriate place at www.simplemachines.org (the preferred option!)
History: History:
Version 1.12
Version 1.11 Version 1.11
+ added German language-pack + added German language-pack
+ added switch to disable linking to profile pages + added switch to disable linking to profile pages
@ -84,72 +87,6 @@ Deep and Markus Birth
No homepage available at the moment No homepage available at the moment
</homepage> </homepage>
<edit file>
$languagedir/Modifications.english.php
</edit file>
<search for>
?>
</search for>
<add before>
//SMF Shoutbox
$txt['sbox_ModTitle'] = 'SMF Shoutbox';
$txt['sbox_Visible'] = 'Shoutbox is visible';
$txt['sbox_GuestAllowed'] = 'Guests are allowed to shout';
$txt['sbox_GuestVisible'] = 'Make Shoutbox visible to Guests';
$txt['sbox_MaxLines'] = 'Maximum number of displayed shouts';
$txt['sbox_Height'] = 'Shoutbox height (px)';
$txt['sbox_SmiliesVisible'] = 'Smiley row is visible';
$txt['sbox_UserLinksVisible'] = 'Show profile links';
$txt['sbox_KillShout'] = 'Dou you want to kill this shout?';
$txt['sbox_TextSize1'] = '1. Font size';
$txt['sbox_TextColor1'] = '1. Font color';
$txt['sbox_TextSize2'] = '2. Font size';
$txt['sbox_TextColor2'] = '2. Font color';
$txt['sbox_RefreshTime'] = 'Refresh time';
$txt['sbox_BlockRefresh'] = 'Block Refresh after inactivity (' . $modSettings['lastActive'] . ' mins)';
$txt['sbox_BackgroundColor'] = 'Background color';
$txt['sbox_FontFamily1'] = '1. Font family';
$txt['sbox_FontFamily2'] = '2. Font family';
$txt['sbox_DoHistory'] = 'Create history of shouts';
$txt['sbox_AllowBBC'] = 'Allow BBCode';
$txt['sbox_Refresh'] = 'Refresh';
$txt['sbox_RefreshBlocked'] = 'Automatic refresh disabled due to inactivity';
$txt['sbox_History'] = 'History';
$txt['sbox_HistoryClear'] = 'Clear history';
$txt['sbox_HistoryNotFound'] = 'No history found.';
$txt['sbox_EnableSounds'] = 'Enable sounds';
</add before>
<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_GuestAllowed'] = 'Here you can decide whether guests are allowed to post new shouts.';
$helptxt['sbox_GuestVisible'] = 'Defines whether the Shoutbox is visible to guests at all.';
$helptxt['sbox_MaxLines'] = 'Here you can enter the maximal count of lines displayed in the shoutbox.';
$helptxt['sbox_Height'] = 'Here you can enter the height (pixels) of the shoutbox.';
$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_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_DoHistory'] = 'Defines whether all shouts should be written to a file so that an Administrator can check what was going on.';
$helptxt['sbox_AllowBBC'] = 'Defines whether users are allowed to use BBCode in shouts. If disabled, only plain text is displayed - no smileys, no formatting.';
$helptxt['sbox_EnableSounds'] = 'Enables the notification sound, when your nickname was mentioned since the last refresh.';
</add before>
<edit file> <edit file>
$sourcedir/ModSettings.php $sourcedir/ModSettings.php
</edit file> </edit file>
@ -181,6 +118,8 @@ function ModifyKarmaSettings()
</search for> </search for>
<add before> <add before>
loadLanguage('sbox');
function ModifySboxSettings() function ModifySboxSettings()
{ {
global $txt, $scripturl, $context, $settings, $sc; global $txt, $scripturl, $context, $settings, $sc;
@ -323,3 +262,27 @@ $themedir/BoardIndex.template.php
if (function_exists('sbox')) sbox(); if (function_exists('sbox')) sbox();
</add after> </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_GuestAllowed'] = 'Here you can decide whether guests are allowed to post new shouts.';
$helptxt['sbox_GuestVisible'] = 'Defines whether the Shoutbox is visible to guests at all.';
$helptxt['sbox_MaxLines'] = 'Here you can enter the maximal count of lines displayed in the shoutbox.';
$helptxt['sbox_Height'] = 'Here you can enter the height (pixels) of the shoutbox.';
$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_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_DoHistory'] = 'Defines whether all shouts should be written to a file so that an Administrator can check what was going on.';
$helptxt['sbox_AllowBBC'] = 'Defines whether users are allowed to use BBCode in shouts. If disabled, only plain text is displayed - no smileys, no formatting.';
$helptxt['sbox_EnableSounds'] = 'Enables the notification sound, when your nickname was mentioned since the last refresh.';
</add before>