diff --git a/sbox.english.php b/sbox.english.php index 4a8c909..cba1e7d 100644 --- a/sbox.english.php +++ b/sbox.english.php @@ -10,6 +10,7 @@ $txt['sbox_HistoryClear'] = 'Clear history'; $txt['sbox_HistoryNotFound'] = 'No history found.'; $txt['sbox_Guest'] = 'Guest'; $txt['sbox_TypeShout'] = ''; +$txt['sbox_Login'] = 'Please login or register to participate.'; // Settings $txt['sbox_Visible'] = 'Shoutbox is visible'; diff --git a/sbox.german.php b/sbox.german.php index 0ac88b3..43966bc 100644 --- a/sbox.german.php +++ b/sbox.german.php @@ -10,6 +10,7 @@ $txt['sbox_HistoryClear'] = 'Verlauf löschen'; $txt['sbox_HistoryNotFound'] = 'Kein Verlauf gefunden.'; $txt['sbox_Guest'] = 'Gast'; $txt['sbox_TypeShout'] = ''; +$txt['sbox_Login'] = 'Bitte einloggen oder registrieren zum Teilnehmen.'; // Einstellungen $txt['sbox_Visible'] = 'Shoutbox ist sichtbar'; diff --git a/sbox.template.php b/sbox.template.php index c650c33..ba4c6c2 100644 --- a/sbox.template.php +++ b/sbox.template.php @@ -67,6 +67,9 @@ function template_shout_box() { echo '  '; + } else { + // guest is not allowed to shout ~~> show message + echo $txt['sbox_Login']; } echo ' @@ -204,7 +207,7 @@ function sbox_printSmileys() { // If the smileys popup is to be shown... show it! if (!empty($context['smileys']['popup'])) echo ' - [', $txt['more_smileys'], ']'; + [', $txt['more_smileys'], ']'; } // If there are additional smileys then ensure we provide the javascript for them. @@ -234,7 +237,7 @@ function sbox_printSmileys() { echo ']; var smileyPopupWindow; - function moreSmileys() + function sbox_moreSmileys() { var row, i; @@ -264,4 +267,4 @@ function sbox_printSmileys() { } // END: Borrowed from template_postbox(&$message) in Post.template.php -?> \ No newline at end of file +?> diff --git a/sboxDB.php b/sboxDB.php index 845b4e6..56691a1 100644 --- a/sboxDB.php +++ b/sboxDB.php @@ -83,12 +83,15 @@ function locked_filewrite($filename, $data, $timeLimit = 300000, $staleAge = 5) // END: BORROWED FROM http://de2.php.net/manual/en/function.flock.php function missinghtmlentities($text) { + global $context; // entitify missing characters, ignore entities already there (Unicode / UTF8) (hopefully in {-notation) $split = preg_split('/(&#[\d]+;)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); $result = ''; foreach ($split as $s) { if (substr($s, 0, 2) != '&#' || substr($s, -1, 1) != ';') { - $result .= @htmlentities($s, ENT_NOQUOTES, $context['character_set']); + // filter out "ANSI_X3.4-1968" charset, which just means plain old ASCII ... replace by UTF-8 + if (strpos($context['character_set'], 'ANSI_') !== false) $charset = 'UTF-8'; else $charset = $context['character_set']; + $result .= @htmlentities($s, ENT_NOQUOTES, $charset); } else { $result .= $s; } @@ -165,6 +168,7 @@ if (!empty($_REQUEST['action'])) switch ($_REQUEST['action']) { case 'write': if (((!$context['user']['is_guest']) || ($modSettings['sbox_GuestAllowed'] == '1')) && !empty($_REQUEST['sboxText'])) { + is_not_banned(true); // die with message, if user is banned, let him read everything though $content = $_REQUEST['sboxText']; // get current timestamp $date = time();