Archived
1
0

+ added "Please login or register to shout."-message for guests if they are not allowed to shout

x hopefully fixed bug with smileys-insertion into sbox instead of posts if sbox was included into all pages in SMF
x hopefully fixed bug with "ANSI_X3.4-1968"-charset, which is just ASCII and seems to be used for UTF-8, also suppressed error messages from htmlentities()
+ added is_not_banned() before a post is inserted
This commit is contained in:
mbirth 2006-09-24 15:49:36 +00:00
parent 2197d31f3d
commit 9763831f11
4 changed files with 13 additions and 4 deletions

View File

@ -10,6 +10,7 @@ $txt['sbox_HistoryClear'] = 'Clear history';
$txt['sbox_HistoryNotFound'] = 'No history found.';
$txt['sbox_Guest'] = 'Guest';
$txt['sbox_TypeShout'] = '<Type your message and press ENTER>';
$txt['sbox_Login'] = 'Please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a> to participate.';
// Settings
$txt['sbox_Visible'] = 'Shoutbox is visible';

View File

@ -10,6 +10,7 @@ $txt['sbox_HistoryClear'] = 'Verlauf l&ouml;schen';
$txt['sbox_HistoryNotFound'] = 'Kein Verlauf gefunden.';
$txt['sbox_Guest'] = 'Gast';
$txt['sbox_TypeShout'] = '<Geben Sie Ihre Nachricht ein und drücken Sie ENTER>';
$txt['sbox_Login'] = 'Bitte <a href="' . $scripturl . '?action=login">einloggen</a> oder <a href="' . $scripturl . '?action=register">registrieren</a> zum Teilnehmen.';
// Einstellungen
$txt['sbox_Visible'] = 'Shoutbox ist sichtbar';

View File

@ -67,6 +67,9 @@ function template_shout_box() {
echo '
<input type="hidden" name="ts" value="'.forum_time(true).'">
<input class="windowbg2" type="text" name="sboxText" size="100" maxlength="320" onFocus="if (this.value==\'' . $txt['sbox_TypeShout'] . '\') this.value = \'\';" onBlur="if (this.value==\'\') this.value=\'' . $txt['sbox_TypeShout'] . '\';" />&nbsp;<input type="submit" class="input" value="&nbsp;shout&nbsp;" />';
} else {
// guest is not allowed to shout ~~> show message
echo $txt['sbox_Login'];
}
echo '
</form>
@ -204,7 +207,7 @@ function sbox_printSmileys() {
// If the smileys popup is to be shown... show it!
if (!empty($context['smileys']['popup']))
echo '
<a href="javascript:moreSmileys();">[', $txt['more_smileys'], ']</a>';
<a href="javascript:sbox_moreSmileys();">[', $txt['more_smileys'], ']</a>';
}
// 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
?>
?>

View File

@ -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 &#123;-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();