* moved collapsing-JavaScript to sbox.template.php (one file less to be changed by package manager)
x fixed selectable font-sizes (were "xp" instead of "px", changed them to point(pt) though) + added BBCode-option in settings + added option to switch off sbox completely for Guests * centered input area so that the Refresh-button is also centered for Guests + added History-option in settings, but no code to handle it for now
This commit is contained in:
@ -7,16 +7,35 @@ function template_shout_box() {
|
||||
$themedir = $settings['default_theme_url'];
|
||||
$imgdir = $themedir."/images/";
|
||||
$sourceurl = str_replace($boarddir, $boardurl, $sourcedir);
|
||||
|
||||
if ($context['user']['is_guest'] && $modSettings['sbox_GuestVisible'] != '1') return;
|
||||
|
||||
echo '
|
||||
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
|
||||
function clearSbox()
|
||||
{
|
||||
// Delete shoutbox message text after shout has been submitted
|
||||
if (document.sbox)
|
||||
document.sbox.sboxText.value="";
|
||||
}
|
||||
// ]]></script>
|
||||
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
|
||||
var current_header_sb = ' . ((empty($options['collapse_header_sb']))?'false':'true') . ';
|
||||
|
||||
function shrinkHeaderSB(mode) {';
|
||||
|
||||
if ($context['user']['is_guest']) {
|
||||
echo '
|
||||
document.cookie = "upshrinkSB=" + (mode ? 1 : 0);';
|
||||
} else {
|
||||
echo '
|
||||
smf_setThemeOption("collapse_header_sb", mode?1:0, null, "' . $context['session_id'] . '");';
|
||||
}
|
||||
|
||||
echo '
|
||||
document.getElementById("upshrink_sb").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");
|
||||
document.getElementById("upshrinkHeaderSB").style.display = mode ? "none" : "";
|
||||
current_header_sb = mode;
|
||||
}
|
||||
|
||||
function clearSbox() {
|
||||
// Delete shoutbox message text after shout has been submitted
|
||||
if (document.sbox)
|
||||
document.sbox.sboxText.value="";
|
||||
}
|
||||
// ]]></script>
|
||||
<div class="tborder"', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
|
||||
<div class="catbg" style="padding: 6px; vertical-align: middle; text-align: center;">
|
||||
<a href="#" onclick="shrinkHeaderSB(!current_header_sb); return false;"><img id="upshrink_sb" src="', $settings['images_url'], '/', empty($options['collapse_header_sp']) ? 'collapse.gif' : 'expand.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin-right: 2ex;" align="right" /></a>'.$txt['sbox_ModTitle'].'
|
||||
@ -27,7 +46,7 @@ function template_shout_box() {
|
||||
<td class="windowbg" style="width:87%">
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="0">
|
||||
<tr>
|
||||
<td align="right" valign="middle">
|
||||
<td align="center" valign="middle">
|
||||
<form name="sbox" action="' . $sourceurl . '/sboxDB.php?action=write" method="post" target="sboxframe" style="margin: 0;" onsubmit="setTimeout(\'clearSbox()\', 500);">
|
||||
<a href="' . $sourceurl . '/sboxDB.php?" target="sboxframe"><img src="'.$imgdir.'sbox_refresh.gif" border="0" width="16" height="17" align="absmiddle" alt="' . $txt['sbox_Refresh'] . '" /></a>';
|
||||
if ((!$context['user']['is_guest']) || ($modSettings['sbox_GuestAllowed'] == "1")) {
|
||||
|
@ -11,9 +11,6 @@ if (!defined('SMF'))
|
||||
// global variables
|
||||
global $db_connection, $context, $settings, $txt, $user_info, $modSettings, $db_prefix;
|
||||
|
||||
// used in test scenario
|
||||
//@mysql_select_db($db_name, $db_connection);
|
||||
|
||||
//display html header
|
||||
echo '<html xmlns="http://www.w3.org/1999/xhtml"' . ($context['right_to_left']?' dir="rtl"':'') . '>
|
||||
<head>
|
||||
@ -67,7 +64,7 @@ echo '<html xmlns="http://www.w3.org/1999/xhtml"' . ($context['right_to_left']?'
|
||||
switch ($_REQUEST['action']) {
|
||||
|
||||
case 'write':
|
||||
if (((!$context['user']['is_guest']) || ($modSettings['sbox_GuestAllowed'] == "1")) && !empty($_REQUEST['sboxText'])) {
|
||||
if (((!$context['user']['is_guest']) || ($modSettings['sbox_GuestAllowed'] == '1')) && !empty($_REQUEST['sboxText'])) {
|
||||
$content=$_REQUEST['sboxText'];
|
||||
// get current timestamp
|
||||
$date = time();
|
||||
@ -134,7 +131,9 @@ if(mysql_num_rows($result)) {
|
||||
$date = forum_time(true, $row['time']); // shouting date and time
|
||||
$content = stripslashes($row['content']); // shouting content
|
||||
$content = htmlentities($content);
|
||||
$content = parse_bbc($content);
|
||||
if ($modSettings['sbox_AllowBBC'] == '1') {
|
||||
$content = parse_bbc($content);
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['ts']) && !$div && $date<$_REQUEST['ts']) {
|
||||
if ($count > 0) {
|
||||
|
@ -21,7 +21,10 @@ $overwrite_old_settings = false;
|
||||
$mod_settings = array(
|
||||
'sbox_Visible' => '1',
|
||||
'sbox_GuestAllowed' => '0',
|
||||
'sbox_GuestVisible' => '1',
|
||||
'sbox_SmiliesVisible' => '1',
|
||||
'sbox_AllowBBC' => '1',
|
||||
'sbox_DoHistory' => '0',
|
||||
'sbox_MaxLines' => '50',
|
||||
'sbox_Height' => '180',
|
||||
'sbox_RefreshTime' => '20',
|
||||
@ -43,8 +46,6 @@ if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
|
||||
elseif (!defined('SMF'))
|
||||
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
|
||||
|
||||
|
||||
|
||||
// Turn the array defined above into a string of MySQL data.
|
||||
$string = '';
|
||||
foreach ($mod_settings as $k => $v)
|
||||
@ -62,8 +63,6 @@ if ($string != '')
|
||||
if ($result === false)
|
||||
echo '<b>Error:</b> Settings insertion failed!<br />';
|
||||
|
||||
|
||||
|
||||
$result = db_query("
|
||||
CREATE TABLE `{$db_prefix}sbox_content` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
|
@ -92,6 +92,7 @@ $languagedir/Modifications.english.php
|
||||
$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 lines';
|
||||
$txt['sbox_Height'] = 'Shoutbox height';
|
||||
$txt['sbox_SmiliesVisible'] = 'Smiley row is visible';
|
||||
@ -104,6 +105,8 @@ $txt['sbox_RefreshTime'] = 'Refresh time';
|
||||
$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';
|
||||
</add before>
|
||||
|
||||
@ -121,17 +124,13 @@ $languagedir/Help.english.php
|
||||
//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.';
|
||||
$helptxt['sbox_TextSize1'] = 'Here you can adjust the 1. font size';
|
||||
$helptxt['sbox_TextColor1'] = 'Here you can adjust the 1. font color';
|
||||
$helptxt['sbox_TextSize2'] = 'Here you can adjust the 2. font size';
|
||||
$helptxt['sbox_TextColor2'] = 'Here you can adjust the 2. font color';
|
||||
$helptxt['sbox_SmiliesVisible'] = 'Here you can decide whether smileys are visible or not. They work independently of this setting, though.';
|
||||
$helptxt['sbox_RefreshTime'] = 'Here you can adjust the refresh time';
|
||||
$helptxt['sbox_BackgroundColor'] = 'Here you can adjust the background color';
|
||||
$helptxt['sbox_FontFamily1'] = 'Here you can adjust the 1. font family.';
|
||||
$helptxt['sbox_FontFamily2'] = 'Here you can adjust the 2. font family.';
|
||||
$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.';
|
||||
</add before>
|
||||
|
||||
|
||||
@ -174,7 +173,10 @@ function ModifySboxSettings()
|
||||
(
|
||||
array('check', 'sbox_Visible'),
|
||||
array('check', 'sbox_GuestAllowed'),
|
||||
array('check', 'sbox_GuestVisible'),
|
||||
array('check', 'sbox_SmiliesVisible'),
|
||||
array('check', 'sbox_AllowBBC'),
|
||||
array('check', 'sbox_DoHistory'),
|
||||
array('int', 'sbox_MaxLines'),
|
||||
array('int', 'sbox_Height'),
|
||||
array('int', 'sbox_RefreshTime'),
|
||||
@ -201,15 +203,17 @@ function ModifySboxSettings()
|
||||
),
|
||||
),
|
||||
array('select', 'sbox_TextSize1', array(
|
||||
'8px' => '8xp',
|
||||
'9px' => '9xp',
|
||||
'10px' => '10xp',
|
||||
'11px' => '11xp',
|
||||
'12px' => '12xp',
|
||||
'13px' => '13xp',
|
||||
'14px' => '14xp',
|
||||
'15px' => '15xp',
|
||||
'16px' => '16xp',
|
||||
'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',
|
||||
@ -221,15 +225,17 @@ function ModifySboxSettings()
|
||||
),
|
||||
array('text', 'sbox_TextColor1'),
|
||||
array('select', 'sbox_TextSize2', array(
|
||||
'8px' => '8xp',
|
||||
'9px' => '9xp',
|
||||
'10px' => '10xp',
|
||||
'11px' => '11xp',
|
||||
'12px' => '12xp',
|
||||
'13px' => '13xp',
|
||||
'14px' => '14xp',
|
||||
'15px' => '15xp',
|
||||
'16px' => '16xp',
|
||||
'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',
|
||||
@ -298,36 +304,3 @@ $themedir/BoardIndex.template.php
|
||||
if (function_exists('sbox')) sbox();
|
||||
</add after>
|
||||
|
||||
<edit file>
|
||||
$themedir/index.template.php
|
||||
</edit file>
|
||||
|
||||
<search for>
|
||||
echo $context['html_headers'], '
|
||||
</search for>
|
||||
|
||||
<add after>
|
||||
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
|
||||
var current_header_sb = ', empty($options['collapse_header_sb']) ? 'false' : 'true', ';
|
||||
|
||||
function shrinkHeaderSB(mode)
|
||||
{';
|
||||
|
||||
if ($context['user']['is_guest'])
|
||||
echo '
|
||||
document.cookie = "upshrinkSB=" + (mode ? 1 : 0);';
|
||||
else
|
||||
echo '
|
||||
smf_setThemeOption("collapse_header_sb", mode ? 1 : 0, null, "', $context['session_id'], '");';
|
||||
|
||||
echo '
|
||||
document.getElementById("upshrink_sb").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");
|
||||
|
||||
document.getElementById("upshrinkHeaderSB").style.display = mode ? "none" : "";
|
||||
|
||||
current_header_sb = mode;
|
||||
}
|
||||
// ]]></script>
|
||||
|
||||
</add after>
|
||||
|
||||
|
Reference in New Issue
Block a user