mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +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'],)
|
||||
);
|
||||
|
@@ -1771,95 +1771,136 @@ function split_sql_file($sql, $delimiter)
|
||||
/**
|
||||
* Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username
|
||||
* and group names must be carried through for the moderators table
|
||||
*
|
||||
* @todo let the admin define if he wants to display moderators (forum-based) - display_on_index already present and checked for...
|
||||
*/
|
||||
function cache_moderators()
|
||||
{
|
||||
global $db, $cache;
|
||||
global $db, $cache, $auth, $phpbb_root_path, $phpEx;
|
||||
|
||||
// Clear table
|
||||
$sql = (SQL_LAYER != 'sqlite') ? 'TRUNCATE ' . MODERATOR_TABLE : 'DELETE FROM ' . MODERATOR_TABLE;
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Holding array
|
||||
$m_sql = array();
|
||||
$user_id_sql = '';
|
||||
// We add moderators who have forum moderator permissions without an explicit ACL_NO setting
|
||||
$hold_ary = $ug_id_ary = $sql_ary = array();
|
||||
|
||||
$sql = 'SELECT a.forum_id, u.user_id, u.username
|
||||
FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_USERS_TABLE . ' a, ' . USERS_TABLE . " u
|
||||
WHERE o.auth_option = 'm_'
|
||||
AND a.auth_option_id = o.auth_option_id
|
||||
AND a.auth_setting = " . ACL_YES . '
|
||||
AND u.user_id = a.user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
// Grab all users having moderative options...
|
||||
$hold_ary = $auth->acl_user_raw_data(false, 'm_%', false);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
// Add users?
|
||||
if (sizeof($hold_ary))
|
||||
{
|
||||
$m_sql['f_' . $row['forum_id'] . '_u_' . $row['user_id']] = $row['forum_id'] . ', ' . $row['user_id'] . ", '" . $row['username'] . "', NULL, NULL";
|
||||
$user_id_sql .= (($user_id_sql) ? ', ' : '') . $row['user_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
// At least one moderative option warrants a display
|
||||
$ug_id_ary = array_keys($hold_ary);
|
||||
|
||||
// Remove users who have group memberships with DENY moderator permissions
|
||||
if ($user_id_sql)
|
||||
{
|
||||
// Remove users who have group memberships with DENY moderator permissions
|
||||
$sql = 'SELECT a.forum_id, ug.user_id
|
||||
FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . " ug
|
||||
WHERE o.auth_option = 'm_'
|
||||
AND a.auth_option_id = o.auth_option_id
|
||||
AND a.auth_setting = " . ACL_NO . "
|
||||
FROM (' . ACL_OPTIONS_TABLE . ' o, ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug)
|
||||
LEFT JOIN ' . ACL_ROLES_DATA_TABLE . ' r ON (a.auth_role_id = r.role_id)
|
||||
WHERE (o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id)
|
||||
AND ((a.auth_setting = ' . ACL_NO . ' AND r.auth_setting IS NULL)
|
||||
OR r.auth_setting = ' . ACL_NO . ')
|
||||
AND a.group_id = ug.group_id
|
||||
AND ug.user_id IN ($user_id_sql)";
|
||||
AND ug.user_id IN (' . implode(', ', $ug_id_ary) . ")
|
||||
AND o.auth_option LIKE 'm\_%'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
unset($m_sql['f_' . $row['forum_id'] . '_u_' . $row['user_id']]);
|
||||
if (isset($hold_ary[$row['user_id']][$row['forum_id']]))
|
||||
{
|
||||
unset($hold_ary[$row['user_id']][$row['forum_id']]);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($hold_ary))
|
||||
{
|
||||
// Get usernames...
|
||||
$sql = 'SELECT user_id, username
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id IN (' . implode(', ', array_keys($hold_ary)) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$usernames_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$usernames_ary[$row['user_id']] = $row['username'];
|
||||
}
|
||||
|
||||
foreach ($hold_ary as $user_id => $forum_id_ary)
|
||||
{
|
||||
foreach ($forum_id_ary as $forum_id => $auth_ary)
|
||||
{
|
||||
$sql_ary[] = array(
|
||||
'forum_id' => $forum_id,
|
||||
'user_id' => $user_id,
|
||||
'username' => $usernames_ary[$user_id],
|
||||
'group_id' => 0,
|
||||
'groupname' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT a.forum_id, g.group_name, g.group_id
|
||||
FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_GROUPS_TABLE . ' a, ' . GROUPS_TABLE . " g
|
||||
WHERE o.auth_option = 'm_'
|
||||
AND a.auth_option_id = o.auth_option_id
|
||||
AND a.auth_setting = " . ACL_YES . '
|
||||
AND g.group_id = a.group_id
|
||||
AND g.group_type NOT IN (' . GROUP_HIDDEN . ', ' . GROUP_SPECIAL . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
// Now to the groups...
|
||||
$hold_ary = $auth->acl_group_raw_data(false, 'm_%', false);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
if (sizeof($hold_ary))
|
||||
{
|
||||
$m_sql['f_' . $row['forum_id'] . '_g_' . $row['group_id']] = $row['forum_id'] . ', NULL, NULL, ' . $row['group_id'] . ", '" . $row['group_name'] . "'";
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$ug_id_ary = array_keys($hold_ary);
|
||||
|
||||
if (sizeof($m_sql))
|
||||
// Make sure not hidden or special groups are involved...
|
||||
$sql = 'SELECT group_name, group_id, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_id IN (' . implode(', ', $ug_id_ary) . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$groupnames_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['group_type'] == GROUP_HIDDEN || $row['group_type'] == GROUP_SPECIAL)
|
||||
{
|
||||
unset($hold_ary[$row['group_id']]);
|
||||
}
|
||||
|
||||
$groupnames_ary[$row['group_id']] = $row['group_name'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($hold_ary as $group_id => $forum_id_ary)
|
||||
{
|
||||
foreach ($forum_id_ary as $forum_id => $auth_ary)
|
||||
{
|
||||
$sql_ary[] = array(
|
||||
'forum_id' => $forum_id,
|
||||
'user_id' => 0,
|
||||
'username' => '',
|
||||
'group_id' => $group_id,
|
||||
'groupname' => $groupnames_ary[$group_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
{
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'mysql':
|
||||
$sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname)
|
||||
VALUES ' . implode(', ', preg_replace('#^(.*)$#', '(\1)', $m_sql));
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
case 'sqlite':
|
||||
$sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname)
|
||||
' . implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \1', $m_sql));
|
||||
$db->sql_query($sql);
|
||||
break;
|
||||
$db->sql_query('INSERT INTO ' . MODERATOR_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
|
||||
break;
|
||||
|
||||
default:
|
||||
foreach ($m_sql as $k => $sql)
|
||||
foreach ($sql_ary as $ary)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . MODERATOR_TABLE . " (forum_id, user_id, username, group_id, groupname)
|
||||
VALUES ($sql)";
|
||||
$db->sql_query($sql);
|
||||
$db->sql_query('INSERT INTO ' . MODERATOR_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -490,7 +490,6 @@ function decode_message(&$message, $bbcode_uid = '')
|
||||
'#<!\-\- w \-\-><a href="http:\/\/(.*?)" target="_blank">.*?</a><!\-\- w \-\->#',
|
||||
'#<!\-\- l \-\-><a href="(.*?)">.*?</a><!\-\- l \-\->#',
|
||||
'#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#',
|
||||
'#<!\-\- h \-\-><(.*?)><!\-\- h \-\->#',
|
||||
'#<.*?>#s'
|
||||
);
|
||||
|
||||
|
@@ -1164,7 +1164,6 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr
|
||||
'author_ip' => $data['from_user_ip'],
|
||||
'message_time' => $current_time,
|
||||
'enable_bbcode' => $data['enable_bbcode'],
|
||||
'enable_html' => $data['enable_html'],
|
||||
'enable_smilies' => $data['enable_smilies'],
|
||||
'enable_magic_url' => $data['enable_urls'],
|
||||
'enable_sig' => $data['enable_sig'],
|
||||
@@ -1185,7 +1184,6 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr
|
||||
'icon_id' => $data['icon_id'],
|
||||
'message_edit_time' => $current_time,
|
||||
'enable_bbcode' => $data['enable_bbcode'],
|
||||
'enable_html' => $data['enable_html'],
|
||||
'enable_smilies' => $data['enable_smilies'],
|
||||
'enable_magic_url' => $data['enable_urls'],
|
||||
'enable_sig' => $data['enable_sig'],
|
||||
|
@@ -390,12 +390,14 @@ class custom_profile
|
||||
{
|
||||
case 'int':
|
||||
return (int) $value;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
return str_replace("\n", '<br />', $value);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
// Prepare further, censor_text, smilies, bbcode, html, whatever
|
||||
// Prepare further, censor_text, smilies, bbcode, whatever
|
||||
if ($ident_ary['data']['bbcode_bitfield'])
|
||||
{
|
||||
$bbcode = new bbcode($ident_ary['data']['bbcode_bitfield']);
|
||||
@@ -404,9 +406,11 @@ class custom_profile
|
||||
$value = censor_text($value);
|
||||
}
|
||||
return str_replace("\n", '<br />', $value);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'dropdown':
|
||||
$field_id = $ident_ary['data']['field_id'];
|
||||
$lang_id = $ident_ary['data']['lang_id'];
|
||||
@@ -416,12 +420,14 @@ class custom_profile
|
||||
}
|
||||
|
||||
return $this->options_lang[$field_id][$lang_id][(int) $value];
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'bool':
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
trigger_error('Unknown profile type');
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,6 +671,7 @@ class custom_profile
|
||||
switch ($profile_row['field_type'])
|
||||
{
|
||||
case FIELD_DATE:
|
||||
|
||||
if (!isset($_REQUEST[$var_name . '_day']))
|
||||
{
|
||||
if ($profile_row['field_default_value'] == 'now')
|
||||
@@ -682,25 +689,30 @@ class custom_profile
|
||||
}
|
||||
|
||||
$var = sprintf('%2d-%2d-%4d', $day, $month, $year);
|
||||
break;
|
||||
case FIELD_TEXT:
|
||||
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
||||
break;
|
||||
|
||||
$message_parser = new parse_message(request_var($var_name, ''));
|
||||
case FIELD_TEXT:
|
||||
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
||||
|
||||
$message_parser = new parse_message(request_var($var_name, ''));
|
||||
|
||||
// Get the allowed settings from the global settings. Magic URLs are always set to true.
|
||||
// TODO: It might be nice to make this a per field setting.
|
||||
$message_parser->parse($config['allow_html'], $config['allow_bbcode'], true, $config['allow_smilies']);
|
||||
$var = array(
|
||||
$profile_row['field_ident'] => $message_parser->message,
|
||||
$profile_row['field_ident'] . '_bbcode_uid' => $message_parser->bbcode_uid,
|
||||
$profile_row['field_ident'] . '_bbcode_bitfield' => $message_parser->bbcode_bitfield,
|
||||
'submitted' => request_var($var_name, '')
|
||||
);
|
||||
break;
|
||||
/**
|
||||
* Get the allowed settings from the global settings. Magic URLs are always set to true.
|
||||
* @todo It might be nice to make this a per field setting.
|
||||
*/
|
||||
$message_parser->parse($config['allow_bbcode'], true, $config['allow_smilies']);
|
||||
|
||||
$var = array(
|
||||
$profile_row['field_ident'] => $message_parser->message,
|
||||
$profile_row['field_ident'] . '_bbcode_uid' => $message_parser->bbcode_uid,
|
||||
$profile_row['field_ident'] . '_bbcode_bitfield' => $message_parser->bbcode_bitfield,
|
||||
'submitted' => request_var($var_name, '')
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
$var = request_var($var_name, $profile_row['field_default_value']);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return $var;
|
||||
|
@@ -1321,6 +1321,11 @@ function group_delete($group_id, $group_name = false)
|
||||
WHERE group_id = $group_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete auth entries from the groups table
|
||||
$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . "
|
||||
WHERE group_id = $group_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
add_log('admin', 'LOG_GROUP_DELETE', $group_name);
|
||||
|
||||
return false;
|
||||
|
@@ -847,7 +847,6 @@ function mcp_fork_topic($topic_ids)
|
||||
'post_approved' => 1,
|
||||
'post_reported' => 0,
|
||||
'enable_bbcode' => (int) $row['enable_bbcode'],
|
||||
'enable_html' => (int) $row['enable_html'],
|
||||
'enable_smilies' => (int) $row['enable_smilies'],
|
||||
'enable_magic_url' => (int) $row['enable_magic_url'],
|
||||
'enable_sig' => (int) $row['enable_sig'],
|
||||
|
@@ -105,13 +105,6 @@ function mcp_topic_view($id, $mode, $action)
|
||||
$message = $row['post_text'];
|
||||
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];
|
||||
|
||||
// If the board has HTML off but the post has HTML
|
||||
// on then we process it, else leave it alone
|
||||
if (!$config['allow_html'] && $row['enable_html'])
|
||||
{
|
||||
$message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\2>', $message);
|
||||
}
|
||||
|
||||
if ($row['bbcode_bitfield'])
|
||||
{
|
||||
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
|
||||
|
@@ -262,12 +262,6 @@ function mcp_warn_post_view($id, $mode, $action)
|
||||
// Parse the message and subject
|
||||
$message = $userrow['post_text'];
|
||||
|
||||
// If the board has HTML off but the post has HTML on then we process it, else leave it alone
|
||||
if (!$auth->acl_get('f_html', $userrow['forum_id']) && $row['enable_html'])
|
||||
{
|
||||
$message = preg_replace('#(<!\-\- h \-\-><)([\/]?.*?)(><!\-\- h \-\->)#is', "<\\2>", $message);
|
||||
}
|
||||
|
||||
// Second parse bbcode here
|
||||
if ($userrow['bbcode_bitfield'])
|
||||
{
|
||||
@@ -277,12 +271,6 @@ function mcp_warn_post_view($id, $mode, $action)
|
||||
// Always process smilies after parsing bbcodes
|
||||
$message = smiley_text($message);
|
||||
|
||||
if ($userrow['enable_html'] && $auth->acl_get('f_html', $userrow['forum_id']))
|
||||
{
|
||||
// Remove Comments from post content
|
||||
$message = preg_replace('#<!\-\-(.*?)\-\->#is', '', $message);
|
||||
}
|
||||
|
||||
// Replace naughty words such as farty pants
|
||||
$message = str_replace("\n", '<br />', censor_text($message));
|
||||
|
||||
@@ -391,7 +379,7 @@ function add_warning($userrow, $warning, $send_pm = true, $post_id = 0)
|
||||
$message_parser = new parse_message();
|
||||
$message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning);
|
||||
$message_md5 = md5($message_parser->message);
|
||||
$message_parser->parse(false, true, true, true, false, false, true);
|
||||
$message_parser->parse(true, true, true, false, false, true);
|
||||
|
||||
$pm_data = array(
|
||||
'from_user_id' => $user->data['user_id'],
|
||||
@@ -399,7 +387,6 @@ function add_warning($userrow, $warning, $send_pm = true, $post_id = 0)
|
||||
'from_username' => $user->data['username'],
|
||||
'enable_sig' => false,
|
||||
'enable_bbcode' => true,
|
||||
'enable_html' => false,
|
||||
'enable_smilies' => true,
|
||||
'enable_urls' => false,
|
||||
'icon_id' => 0,
|
||||
|
@@ -113,7 +113,13 @@ class bbcode_firstpass extends bbcode
|
||||
'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')"))
|
||||
);
|
||||
|
||||
$this->parsed_items = array('code' => 0, 'quote' => 0, 'attachment' => 0, 'b' => 0, 'i' => 0, 'url' => 0, 'img' => 0, 'size' => 0, 'color' => 0, 'u' => 0, 'list' => 0, 'email' => 0, 'flash' => 0);
|
||||
// Zero the parsed items array
|
||||
$this->parsed_items = array();
|
||||
|
||||
foreach ($this->bbcodes as $tag => $bbcode_data)
|
||||
{
|
||||
$this->parsed_items[$tag] = 0;
|
||||
}
|
||||
|
||||
if (!is_array($rowset))
|
||||
{
|
||||
@@ -128,8 +134,9 @@ class bbcode_firstpass extends bbcode
|
||||
{
|
||||
$rowset[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
||||
foreach ($rowset as $row)
|
||||
{
|
||||
$this->bbcodes[$row['bbcode_tag']] = array(
|
||||
@@ -279,7 +286,6 @@ class bbcode_firstpass extends bbcode
|
||||
'#<!\-\- w \-\-><a href="http:\/\/(.*?)" target="_blank">.*?</a><!\-\- w \-\->#',
|
||||
'#<!\-\- l \-\-><a href="(.*?)">.*?</a><!\-\- l \-\->#',
|
||||
'#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#',
|
||||
'#<!\-\- h \-\-><(.*?)><!\-\- h \-\->#',
|
||||
'#&\#([0-9]+);#',
|
||||
);
|
||||
$htm_replace = array('\1', '\1', '\1', '\1', '\1', '<\1>', '&#\1;');
|
||||
@@ -694,7 +700,7 @@ class bbcode_firstpass extends bbcode
|
||||
/**
|
||||
* @package phpBB3
|
||||
* Main message parser for posting, pm, etc. takes raw message
|
||||
* and parses it for attachments, html, bbcode and smilies
|
||||
* and parses it for attachments, bbcode and smilies
|
||||
*/
|
||||
class parse_message extends bbcode_firstpass
|
||||
{
|
||||
@@ -723,7 +729,7 @@ class parse_message extends bbcode_firstpass
|
||||
}
|
||||
|
||||
// Parse Message : public
|
||||
function parse($allow_html, $allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $update_this_message = true, $mode = 'post')
|
||||
function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $update_this_message = true, $mode = 'post')
|
||||
{
|
||||
global $config, $db, $user;
|
||||
|
||||
@@ -766,12 +772,6 @@ class parse_message extends bbcode_firstpass
|
||||
}
|
||||
}
|
||||
|
||||
// Parse HTML
|
||||
if ($allow_html && $config['allow_html_tags'])
|
||||
{
|
||||
$this->html($config['allow_html_tags']);
|
||||
}
|
||||
|
||||
// Parse smilies
|
||||
if ($allow_smilies)
|
||||
{
|
||||
@@ -827,7 +827,7 @@ class parse_message extends bbcode_firstpass
|
||||
}
|
||||
|
||||
// Formatting text for display
|
||||
function format_display($allow_html, $allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true)
|
||||
function format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true)
|
||||
{
|
||||
// If false, then the parsed message get returned but internal message not processed.
|
||||
if (!$update_this_message)
|
||||
@@ -839,7 +839,7 @@ class parse_message extends bbcode_firstpass
|
||||
if ($this->message_status == 'plain')
|
||||
{
|
||||
// Force updating message - of course.
|
||||
$this->parse($allow_html, $allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, true);
|
||||
$this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, true);
|
||||
}
|
||||
|
||||
// Parse BBcode
|
||||
@@ -889,19 +889,6 @@ class parse_message extends bbcode_firstpass
|
||||
$this->message_status = 'plain';
|
||||
}
|
||||
|
||||
// Parse HTML
|
||||
function html($allowed_tags)
|
||||
{
|
||||
// If $allow_html is true then "allowed_tags" are converted back from entity
|
||||
// form, others remain
|
||||
$allowed_tags = split(',', $allowed_tags);
|
||||
|
||||
if (sizeof($allowed_tags))
|
||||
{
|
||||
$this->message = preg_replace('#<(\/?)(' . str_replace('*', '.*?', implode('|', $allowed_tags)) . ')>#is', '<!-- h --><$1$2><!-- h -->', $this->message);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx.
|
||||
// Cuts down displayed size of link if over 50 chars, turns absolute links
|
||||
// into relative versions when the server/script path matches the link
|
||||
@@ -916,7 +903,7 @@ class parse_message extends bbcode_firstpass
|
||||
// Be sure to not let the matches cross over. ;)
|
||||
|
||||
// relative urls for this board
|
||||
$match[] = '#(^|[\n ]|\()(' . preg_quote($server_url, '#') . ')/([^ \t\n\r<"\'\)&]+|&(?!lt;))*)#i';
|
||||
$match[] = '#(^|[\n ]|\()(' . preg_quote($server_url, '#') . ')/([^ \t\n\r<"\'\)&]+|&(?!lt;))*#i';
|
||||
$replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->';
|
||||
|
||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||
@@ -1184,7 +1171,7 @@ class parse_message extends bbcode_firstpass
|
||||
$this->message = $poll['poll_option_text'];
|
||||
$bbcode_bitfield = $this->bbcode_bitfield;
|
||||
|
||||
$poll['poll_option_text'] = $this->parse($poll['enable_html'], $poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
|
||||
$poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
|
||||
|
||||
$this->bbcode_bitfield |= $bbcode_bitfield;
|
||||
$this->message = $tmp_message;
|
||||
@@ -1194,7 +1181,7 @@ class parse_message extends bbcode_firstpass
|
||||
$this->message = $poll['poll_title'];
|
||||
$bbcode_bitfield = $this->bbcode_bitfield;
|
||||
|
||||
$poll['poll_title'] = $this->parse($poll['enable_html'], $poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
|
||||
$poll['poll_title'] = $this->parse($poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
|
||||
|
||||
$this->bbcode_bitfield |= $bbcode_bitfield;
|
||||
$this->message = $tmp_message;
|
||||
|
@@ -772,7 +772,8 @@ class user extends session
|
||||
var $lang_path;
|
||||
var $img_lang;
|
||||
|
||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'html' => 7, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'report_pm_notify' => 11);
|
||||
// Able to add new option (id 7)
|
||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'report_pm_notify' => 11);
|
||||
var $keyvalues = array();
|
||||
|
||||
function setup($lang_set = false, $style = false)
|
||||
|
@@ -97,7 +97,7 @@ function compose_pm($id, $mode, $action)
|
||||
|
||||
if ($action == 'quotepost')
|
||||
{
|
||||
$sql = 'SELECT p.post_id as msg_id, p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_html, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username
|
||||
$sql = 'SELECT p.post_id as msg_id, p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u
|
||||
WHERE p.post_id = $msg_id
|
||||
AND t.topic_id = p.topic_id
|
||||
@@ -210,7 +210,7 @@ function compose_pm($id, $mode, $action)
|
||||
}
|
||||
else
|
||||
{
|
||||
$check_value = (($post['enable_html']+1) << 16) + (($post['enable_bbcode']+1) << 8) + (($post['enable_smilies']+1) << 4) + (($enable_urls+1) << 2) + (($post['enable_sig']+1) << 1);
|
||||
$check_value = (($post['enable_bbcode']+1) << 8) + (($post['enable_smilies']+1) << 4) + (($enable_urls+1) << 2) + (($post['enable_sig']+1) << 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -347,7 +347,6 @@ function compose_pm($id, $mode, $action)
|
||||
$message_parser->bbcode_uid = $bbcode_uid;
|
||||
}
|
||||
|
||||
$html_status = ($config['allow_html'] && $config['auth_html_pm'] && $auth->acl_get('u_pm_html'));
|
||||
$bbcode_status = ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode'));
|
||||
$smilies_status = ($config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies'));
|
||||
$img_status = ($config['auth_img_pm'] && $auth->acl_get('u_pm_img'));
|
||||
@@ -422,13 +421,11 @@ function compose_pm($id, $mode, $action)
|
||||
}
|
||||
$subject = preg_replace('#&(\#[0-9]+;)#', '&\1', $subject);
|
||||
|
||||
|
||||
$message_parser->message = (isset($_POST['message'])) ? htmlspecialchars(str_replace(array('\\\'', '\\"', '\\0', '\\\\'), array('\'', '"', '\0', '\\'), $_POST['message'])) : '';
|
||||
$message_parser->message = preg_replace('#&(\#[0-9]+;)#', '&\1', $message_parser->message);
|
||||
|
||||
$icon_id = request_var('icon', 0);
|
||||
|
||||
$enable_html = (!$html_status || isset($_POST['disable_html'])) ? false : true;
|
||||
$enable_bbcode = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;
|
||||
$enable_smilies = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true;
|
||||
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
|
||||
@@ -436,7 +433,7 @@ function compose_pm($id, $mode, $action)
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$status_switch = (($enable_html+1) << 16) + (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1);
|
||||
$status_switch = (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1);
|
||||
$status_switch = ($status_switch != $check_value);
|
||||
}
|
||||
else
|
||||
@@ -455,7 +452,7 @@ function compose_pm($id, $mode, $action)
|
||||
|
||||
if ($update_message)
|
||||
{
|
||||
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true);
|
||||
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -505,7 +502,6 @@ function compose_pm($id, $mode, $action)
|
||||
'icon_id' => (int) $icon_id,
|
||||
'enable_sig' => (bool) $enable_sig,
|
||||
'enable_bbcode' => (bool) $enable_bbcode,
|
||||
'enable_html' => (bool) $enable_html,
|
||||
'enable_smilies' => (bool) $enable_smilies,
|
||||
'enable_urls' => (bool) $enable_urls,
|
||||
'message_md5' => (int) $message_md5,
|
||||
@@ -537,7 +533,7 @@ function compose_pm($id, $mode, $action)
|
||||
{
|
||||
$post_time = ($action == 'edit') ? $post_time : $current_time;
|
||||
|
||||
$preview_message = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
|
||||
$preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
|
||||
|
||||
$preview_signature = $user->data['user_sig'];
|
||||
$preview_signature_uid = $user->data['user_sig_bbcode_uid'];
|
||||
@@ -550,7 +546,7 @@ function compose_pm($id, $mode, $action)
|
||||
$parse_sig->bbcode_uid = $preview_signature_uid;
|
||||
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;
|
||||
|
||||
$parse_sig->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
|
||||
$parse_sig->format_display($enable_bbcode, $enable_urls, $enable_smilies);
|
||||
$preview_signature = $parse_sig->message;
|
||||
unset($parse_sig);
|
||||
}
|
||||
@@ -716,7 +712,6 @@ function compose_pm($id, $mode, $action)
|
||||
}
|
||||
}
|
||||
|
||||
$html_checked = (isset($enable_html)) ? !$enable_html : (($config['allow_html'] && $auth->acl_get('u_pm_html')) ? !$user->optionget('html') : 1);
|
||||
$bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1);
|
||||
$smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1);
|
||||
$urls_checked = (isset($enable_urls)) ? !$enable_urls : 0;
|
||||
@@ -766,7 +761,6 @@ function compose_pm($id, $mode, $action)
|
||||
|
||||
'SUBJECT' => (isset($message_subject)) ? $message_subject : '',
|
||||
'MESSAGE' => $message_text,
|
||||
'HTML_STATUS' => ($html_status) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'],
|
||||
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . "faq.$phpEx$SID&mode=bbcode" . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "faq.$phpEx$SID&mode=bbcode" . '" onclick="target=\'_phpbbcode\';">', '</a>'),
|
||||
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
||||
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
||||
@@ -776,8 +770,6 @@ function compose_pm($id, $mode, $action)
|
||||
|
||||
'S_EDIT_POST' => ($action == 'edit'),
|
||||
'S_SHOW_PM_ICONS' => $s_pm_icons,
|
||||
'S_HTML_ALLOWED' => $html_status,
|
||||
'S_HTML_CHECKED' => ($html_checked) ? ' checked="checked"' : '',
|
||||
'S_BBCODE_ALLOWED' => $bbcode_status,
|
||||
'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '',
|
||||
'S_SMILIES_ALLOWED' => $smilies_status,
|
||||
@@ -789,11 +781,34 @@ function compose_pm($id, $mode, $action)
|
||||
'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts),
|
||||
'S_FORM_ENCTYPE' => $form_enctype,
|
||||
|
||||
'S_BBCODE_IMG' => $img_status,
|
||||
'S_BBCODE_FLASH' => $flash_status,
|
||||
'S_BBCODE_QUOTE' => true,
|
||||
|
||||
'S_POST_ACTION' => $s_action,
|
||||
'S_HIDDEN_ADDRESS_FIELD'=> $s_hidden_address_field,
|
||||
'S_HIDDEN_FIELDS' => $s_hidden_fields)
|
||||
);
|
||||
|
||||
// Build custom bbcodes array
|
||||
$sql = 'SELECT bbcode_id, bbcode_tag
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE display_on_posting = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$i = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('custom_tags', array(
|
||||
'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'",
|
||||
'BBCODE_ID' => 22 + ($i * 2),
|
||||
'BBCODE_TAG' => $row['bbcode_tag'])
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Attachment entry
|
||||
if ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype)
|
||||
{
|
||||
|
@@ -53,15 +53,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||
// Parse the message and subject
|
||||
$message = $message_row['message_text'];
|
||||
|
||||
// If the board has HTML off but the message has HTML on then we process it, else leave it alone
|
||||
if (!$config['auth_html_pm'] || !$auth->acl_get('u_pm_html'))
|
||||
{
|
||||
if ($message_row['enable_html'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode'))
|
||||
{
|
||||
$message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message);
|
||||
}
|
||||
}
|
||||
|
||||
// Second parse bbcode here
|
||||
if ($message_row['bbcode_bitfield'])
|
||||
{
|
||||
|
@@ -359,7 +359,6 @@ class ucp_prefs
|
||||
{
|
||||
$var_ary = array(
|
||||
'bbcode' => true,
|
||||
'html' => false,
|
||||
'smilies' => true,
|
||||
'sig' => true,
|
||||
'notify' => false,
|
||||
@@ -371,7 +370,6 @@ class ucp_prefs
|
||||
}
|
||||
|
||||
$user->optionset('bbcode', $bbcode);
|
||||
$user->optionset('html', $html);
|
||||
$user->optionset('smilies', $smilies);
|
||||
$user->optionset('attachsig', $sig);
|
||||
|
||||
@@ -399,9 +397,6 @@ class ucp_prefs
|
||||
$bbcode = (isset($bbcode)) ? $bbcode : $user->optionget('bbcode');
|
||||
$bbcode_yes = ($bbcode) ? ' checked="checked"' : '';
|
||||
$bbcode_no = (!$bbcode) ? ' checked="checked"' : '';
|
||||
$html = (isset($html)) ? $html : $user->optionget('html');
|
||||
$html_yes = ($html) ? ' checked="checked"' : '';
|
||||
$html_no = (!$html) ? ' checked="checked"' : '';
|
||||
$smilies = (isset($smilies)) ? $smilies : $user->optionget('smilies');
|
||||
$smilies_yes = ($smilies) ? ' checked="checked"' : '';
|
||||
$smilies_no = (!$smilies) ? ' checked="checked"' : '';
|
||||
@@ -417,8 +412,6 @@ class ucp_prefs
|
||||
|
||||
'DEFAULT_BBCODE_YES' => $bbcode_yes,
|
||||
'DEFAULT_BBCODE_NO' => $bbcode_no,
|
||||
'DEFAULT_HTML_YES' => $html_yes,
|
||||
'DEFAULT_HTML_NO' => $html_no,
|
||||
'DEFAULT_SMILIES_YES' => $smilies_yes,
|
||||
'DEFAULT_SMILIES_NO' => $smilies_no,
|
||||
'DEFAULT_SIG_YES' => $sig_yes,
|
||||
|
@@ -380,7 +380,6 @@ class ucp_profile
|
||||
|
||||
include($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', $user->optionget('bbcode')) : false;
|
||||
$enable_smilies = ($config['allow_sig_smilies']) ? request_var('enable_smilies', $user->optionget('smilies')) : false;
|
||||
$enable_urls = request_var('enable_urls', true);
|
||||
@@ -395,7 +394,7 @@ class ucp_profile
|
||||
$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))
|
||||
{
|
||||
@@ -428,7 +427,7 @@ class ucp_profile
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -439,12 +438,10 @@ class ucp_profile
|
||||
'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="' . "faq.$phpEx$SID&mode=bbcode" . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "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'],
|
||||
@@ -452,7 +449,6 @@ class ucp_profile
|
||||
|
||||
'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