mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-18 22:41:28 +02:00
- added "display_on_posting" setting to custom bbcodes (creates a button with the bbcode tag)
- fixed forum editing and parent id selection - completely removed HTML support (it only creates security problems) - changed cache_moderators() to reflect permission changes git-svn-id: file:///svn/phpbb/trunk@5603 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -34,10 +34,11 @@ class acp_bbcodes
|
||||
{
|
||||
case 'add':
|
||||
$bbcode_match = $bbcode_tpl = '';
|
||||
$display_on_posting = 0;
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$sql = 'SELECT bbcode_match, bbcode_tpl
|
||||
$sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE bbcode_id = ' . $bbcode_id;
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -50,6 +51,7 @@ class acp_bbcodes
|
||||
|
||||
$bbcode_match = $row['bbcode_match'];
|
||||
$bbcode_tpl = htmlspecialchars($row['bbcode_tpl']);
|
||||
$display_on_posting = $row['display_on_posting'];
|
||||
break;
|
||||
|
||||
case 'modify':
|
||||
@@ -67,6 +69,8 @@ class acp_bbcodes
|
||||
// No break here
|
||||
|
||||
case 'create':
|
||||
$display_on_posting = request_var('display_on_posting', 0);
|
||||
|
||||
$bbcode_match = (isset($_POST['bbcode_match'])) ? htmlspecialchars(stripslashes($_POST['bbcode_match'])) : '';
|
||||
$bbcode_tpl = (isset($_POST['bbcode_tpl'])) ? stripslashes($_POST['bbcode_tpl']) : '';
|
||||
break;
|
||||
@@ -83,9 +87,9 @@ class acp_bbcodes
|
||||
'U_BACK' => $this->u_action,
|
||||
'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : ''),
|
||||
|
||||
'BBCODE_MATCH' => $bbcode_match,
|
||||
'BBCODE_TPL' => $bbcode_tpl,
|
||||
)
|
||||
'BBCODE_MATCH' => $bbcode_match,
|
||||
'BBCODE_TPL' => $bbcode_tpl,
|
||||
'DISPLAY_ON_POSTING' => $display_on_posting)
|
||||
);
|
||||
|
||||
foreach ($user->lang['tokens'] as $token => $token_explain)
|
||||
@@ -109,6 +113,7 @@ class acp_bbcodes
|
||||
'bbcode_tag' => $data['bbcode_tag'],
|
||||
'bbcode_match' => $bbcode_match,
|
||||
'bbcode_tpl' => $bbcode_tpl,
|
||||
'display_on_posting' => $display_on_posting,
|
||||
'first_pass_match' => $data['first_pass_match'],
|
||||
'first_pass_replace' => $data['first_pass_replace'],
|
||||
'second_pass_match' => $data['second_pass_match'],
|
||||
@@ -170,6 +175,7 @@ class acp_bbcodes
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
$sql = 'SELECT bbcode_tag
|
||||
FROM ' . BBCODES_TABLE . "
|
||||
WHERE bbcode_id = $bbcode_id";
|
||||
@@ -186,7 +192,7 @@ class acp_bbcodes
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action . '&mode=add')
|
||||
'U_ACTION' => $this->u_action . '&action=add')
|
||||
);
|
||||
|
||||
$sql = 'SELECT *
|
||||
@@ -312,7 +318,7 @@ class acp_bbcodes
|
||||
}
|
||||
|
||||
// Lowercase tags
|
||||
$bbcode_tag = preg_replace('/.*?\[([a-z]+).*/i', '$1', $msg_bbcode);
|
||||
$bbcode_tag = preg_replace('/.*?\[([a-z]+=?).*/i', '$1', $msg_bbcode);
|
||||
$fp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match);
|
||||
$fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace);
|
||||
$sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match);
|
||||
|
@@ -117,7 +117,6 @@ class acp_board
|
||||
'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'type' => 'text::255', 'explain' => true),
|
||||
'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
|
||||
'board_dst' => array('lang' => 'SYSTEM_DST', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_html_tags' => array('lang' => 'ALLOWED_TAGS', 'type' => 'text:30:255', 'explain' => true),
|
||||
'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'type' => 'text:5:4', 'explain' => true),
|
||||
'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'type' => 'text:5:4', 'explain' => true),
|
||||
'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'type' => 'text:5:4', 'explain' => true),
|
||||
@@ -131,14 +130,12 @@ class acp_board
|
||||
'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_html' => array('lang' => 'ALLOW_HTML', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_sig' => array('lang' => 'ALLOW_SIG', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_sig_html' => array('lang' => 'ALLOW_SIG_HTML', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'type' => 'radio:yes_no', 'explain' => true)
|
||||
@@ -253,7 +250,6 @@ class acp_board
|
||||
|
||||
'legend2' => 'GENERAL_OPTIONS',
|
||||
'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'auth_html_pm' => array('lang' => 'ALLOW_HTML_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false),
|
||||
|
@@ -91,7 +91,7 @@ class acp_forums
|
||||
case 'add':
|
||||
|
||||
$forum_data += array(
|
||||
'parent_id' => $this->parent_id,
|
||||
'parent_id' => request_var('forum_parent_id', $this->parent_id),
|
||||
'forum_type' => request_var('forum_type', FORUM_POST),
|
||||
'type_action' => request_var('type_action', ''),
|
||||
'forum_status' => request_var('forum_status', ITEM_UNLOCKED),
|
||||
@@ -132,7 +132,7 @@ class acp_forums
|
||||
$forum_data['forum_rules_flags'] = (($allow_bbcode) ? 1 : 0) + (($allow_smilies) ? 2 : 0) + (($allow_urls) ? 4 : 0);
|
||||
|
||||
$message_parser = new parse_message($forum_data['forum_rules']);
|
||||
$message_parser->parse(false, $allow_bbcode, $allow_urls, $allow_smilies);
|
||||
$message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies);
|
||||
|
||||
$forum_data['forum_rules'] = $message_parser->message;
|
||||
$forum_data['forum_rules_bbcode_uid'] = $message_parser->bbcode_uid;
|
||||
@@ -363,7 +363,7 @@ class acp_forums
|
||||
$forum_data = $row;
|
||||
}
|
||||
|
||||
$parents_list = make_forum_select($this->parent_id, $forum_id, false, false, false);
|
||||
$parents_list = make_forum_select($forum_data['parent_id'], $forum_id, false, false, false);
|
||||
|
||||
$forum_data['forum_password_confirm'] = $forum_data['forum_password'];
|
||||
}
|
||||
@@ -421,10 +421,10 @@ class acp_forums
|
||||
}
|
||||
else
|
||||
{
|
||||
$message_parser->parse(false, ($forum_data['forum_rules_flags'] & 1), ($forum_data['forum_rules_flags'] & 4), ($forum_data['forum_rules_flags'] & 2));
|
||||
$message_parser->parse(($forum_data['forum_rules_flags'] & 1), ($forum_data['forum_rules_flags'] & 4), ($forum_data['forum_rules_flags'] & 2));
|
||||
}
|
||||
|
||||
$forum_rules_preview = $message_parser->format_display(false, ($forum_data['forum_rules_flags'] & 1), ($forum_data['forum_rules_flags'] & 4), ($forum_data['forum_rules_flags'] & 2), false);
|
||||
$forum_rules_preview = $message_parser->format_display(($forum_data['forum_rules_flags'] & 1), ($forum_data['forum_rules_flags'] & 4), ($forum_data['forum_rules_flags'] & 2), false);
|
||||
$forum_rules_plain = $message_parser->decode_message('', false);
|
||||
}
|
||||
|
||||
@@ -449,17 +449,17 @@ class acp_forums
|
||||
if ($db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_MOVE_FORUM_OPTIONS' => make_forum_select($this->parent_id, $forum_id, false, true, false))
|
||||
'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$s_show_display_on_index = false;
|
||||
|
||||
if ($action == 'edit' && $this->parent_id > 0)
|
||||
if ($action == 'edit' && $forum_data['parent_id'] > 0)
|
||||
{
|
||||
// if this forum is a subforum put the "display on index" checkbox
|
||||
if ($parent_info = $this->get_forum_info($this->parent_id))
|
||||
if ($parent_info = $this->get_forum_info($forum_data['parent_id']))
|
||||
{
|
||||
if ($parent_info['parent_id'] > 0 || $parent_info['forum_type'] == FORUM_CAT)
|
||||
{
|
||||
@@ -469,10 +469,11 @@ class acp_forums
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT_FORUM' => true,
|
||||
'S_ERROR' => (sizeof($errors)) ? true : false,
|
||||
'S_PARENT_ID' => $this->parent_id,
|
||||
'S_ADD_ACTION' => ($action == 'add') ? true : false,
|
||||
'S_EDIT_FORUM' => true,
|
||||
'S_ERROR' => (sizeof($errors)) ? true : false,
|
||||
'S_PARENT_ID' => $this->parent_id,
|
||||
'S_FORUM_PARENT_ID' => $forum_data['parent_id'],
|
||||
'S_ADD_ACTION' => ($action == 'add') ? true : false,
|
||||
|
||||
'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id,
|
||||
'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$action&f=$forum_id",
|
||||
@@ -545,7 +546,7 @@ class acp_forums
|
||||
$subforums_id[] = $row['forum_id'];
|
||||
}
|
||||
|
||||
$forums_list = make_forum_select($this->parent_id, $subforums_id);
|
||||
$forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
|
||||
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
@@ -556,14 +557,16 @@ class acp_forums
|
||||
if ($db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_MOVE_FORUM_OPTIONS' => make_forum_select($this->parent_id, $subforums_id)) // , false, true, false???
|
||||
'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false???
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$parent_id = ($this->parent_id == $forum_id) ? 0 : $this->parent_id;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DELETE_FORUM' => true,
|
||||
'U_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=delete&f=$forum_id",
|
||||
'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&f=$forum_id",
|
||||
'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id,
|
||||
|
||||
'FORUM_NAME' => $forum_data['forum_name'],
|
||||
@@ -1209,6 +1212,10 @@ class acp_forums
|
||||
case 'POSTS_':
|
||||
add_log('admin', 'LOG_FORUM_DEL_POSTS', $forum_data['forum_name']);
|
||||
break;
|
||||
|
||||
default:
|
||||
add_log('admin', 'LOG_FORUM_DEL_FORUM', $forum_data['forum_name']);
|
||||
break;
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
@@ -1015,7 +1015,6 @@ class acp_users
|
||||
'view_wordcensor' => false,
|
||||
|
||||
'bbcode' => true,
|
||||
'html' => false,
|
||||
'smilies' => true,
|
||||
'sig' => true,
|
||||
'notify' => false,
|
||||
@@ -1050,7 +1049,6 @@ class acp_users
|
||||
$this->optionset($user_row, 'viewavatars', $data['view_avatars']);
|
||||
$this->optionset($user_row, 'viewcensors', $data['view_wordcensor']);
|
||||
$this->optionset($user_row, 'bbcode', $data['bbcode']);
|
||||
$this->optionset($user_row, 'html', $data['html']);
|
||||
$this->optionset($user_row, 'smilies', $data['smilies']);
|
||||
$this->optionset($user_row, 'attachsig', $data['sig']);
|
||||
|
||||
@@ -1181,7 +1179,6 @@ class acp_users
|
||||
'REPORT_PM_NOTIFY' => (isset($data['report_pm_notify'])) ? $data['report_pm_notify'] : $this->optionget($user_row, 'report_pm_notify'),
|
||||
'DST' => (isset($data['dst'])) ? $data['dst'] : $user_row['user_dst'],
|
||||
'BBCODE' => (isset($data['bbcode'])) ? $data['bbcode'] : $this->optionget($user_row, 'bbcode'),
|
||||
'HTML' => (isset($data['html'])) ? $data['html'] : $this->optionget($user_row, 'html'),
|
||||
'SMILIES' => (isset($data['smilies'])) ? $data['smilies'] : $this->optionget($user_row, 'smilies'),
|
||||
'ATTACH_SIG' => (isset($data['sig'])) ? $data['sig'] : $this->optionget($user_row, 'attachsig'),
|
||||
'NOTIFY' => (isset($data['notify'])) ? $data['notify'] : $user_row['user_notify'],
|
||||
@@ -1398,7 +1395,6 @@ class acp_users
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
||||
|
||||
$enable_html = ($config['allow_sig_html']) ? request_var('enable_html', false) : false;
|
||||
$enable_bbcode = ($config['allow_sig_bbcode']) ? request_var('enable_bbcode', $this->optionget($user_row, 'bbcode')) : false;
|
||||
$enable_smilies = ($config['allow_sig_smilies']) ? request_var('enable_smilies', $this->optionget($user_row, 'smilies')) : false;
|
||||
$enable_urls = request_var('enable_urls', true);
|
||||
@@ -1413,7 +1409,7 @@ class acp_users
|
||||
$message_parser = new parse_message($signature);
|
||||
|
||||
// Allowing Quote BBCode
|
||||
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
|
||||
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
|
||||
|
||||
if (sizeof($message_parser->warn_msg))
|
||||
{
|
||||
@@ -1445,7 +1441,7 @@ class acp_users
|
||||
if ($preview)
|
||||
{
|
||||
// Now parse it for displaying
|
||||
$signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
|
||||
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
|
||||
unset($message_parser);
|
||||
}
|
||||
|
||||
@@ -1457,12 +1453,10 @@ class acp_users
|
||||
'SIGNATURE' => $signature,
|
||||
'SIGNATURE_PREVIEW' => $signature_preview,
|
||||
|
||||
'S_HTML_CHECKED' => (!$enable_html) ? 'checked="checked"' : '',
|
||||
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? 'checked="checked"' : '',
|
||||
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
|
||||
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
|
||||
|
||||
'HTML_STATUS' => ($config['allow_sig_html']) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'],
|
||||
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . $phpbb_root_path . "faq.$phpEx$SID&mode=bbcode" . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "{$phpbb_root_path}faq.$phpEx$SID&mode=bbcode" . '" onclick="target=\'_phpbbcode\';">', '</a>'),
|
||||
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
||||
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
||||
@@ -1470,7 +1464,6 @@ class acp_users
|
||||
|
||||
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
|
||||
|
||||
'S_HTML_ALLOWED' => $config['allow_sig_html'],
|
||||
'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
|
||||
'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],)
|
||||
);
|
||||
|
Reference in New Issue
Block a user