aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acm/acm_main.php5
-rw-r--r--phpBB/includes/acp/acp_attachments.php4
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php24
-rw-r--r--phpBB/includes/acp/acp_email.php8
-rw-r--r--phpBB/includes/acp/acp_prune.php4
-rw-r--r--phpBB/includes/acp/auth.php13
-rw-r--r--phpBB/includes/bbcode.php5
-rw-r--r--phpBB/includes/db/mssql.php2
-rw-r--r--phpBB/includes/db/mssql_odbc.php2
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/functions_display.php2
-rw-r--r--phpBB/includes/functions_posting.php8
-rw-r--r--phpBB/includes/functions_user.php18
-rw-r--r--phpBB/includes/session.php23
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php2
-rw-r--r--phpBB/includes/ucp/ucp_main.php8
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php32
-rw-r--r--phpBB/includes/ucp/ucp_zebra.php3
18 files changed, 100 insertions, 65 deletions
diff --git a/phpBB/includes/acm/acm_main.php b/phpBB/includes/acm/acm_main.php
index 9c0ffc127f..b4a2669a22 100644
--- a/phpBB/includes/acm/acm_main.php
+++ b/phpBB/includes/acm/acm_main.php
@@ -249,6 +249,11 @@ class cache extends acm
$extensions = $return;
}
+ if (!isset($extensions['_allowed_']))
+ {
+ $extensions['_allowed_'] = array();
+ }
+
return;
}
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 9a5e04f787..688cb4d20f 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -785,7 +785,9 @@ class acp_attachments
$act_deact = ($row['allow_group']) ? 'deactivate' : 'activate';
$template->assign_block_vars('groups', array(
- 'S_ADD_SPACER' => $s_add_spacer,
+ 'S_ADD_SPACER' => $s_add_spacer,
+ 'S_ALLOWED_IN_PM' => ($row['allow_in_pm']) ? true : false,
+ 'S_GROUP_ALLOWED' => ($row['allow_group']) ? true : false,
'U_EDIT' => $this->u_action . "&action=edit&g={$row['group_id']}",
'U_DELETE' => $this->u_action . "&action=delete&g={$row['group_id']}",
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index ab684dd447..4586a58fe8 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -71,8 +71,8 @@ class acp_bbcodes
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']) : '';
+ $bbcode_match = request_var('bbcode_match', '');
+ $bbcode_tpl = html_entity_decode(request_var('bbcode_tpl', ''));
break;
}
@@ -207,19 +207,19 @@ class acp_bbcodes
/*
* Build regular expression for custom bbcode
*/
- function build_regexp($msg_bbcode, $msg_html)
+ function build_regexp(&$bbcode_match, &$bbcode_tpl)
{
- $msg_bbcode = trim($msg_bbcode);
- $msg_html = trim($msg_html);
+ $bbcode_match = trim($bbcode_match);
+ $bbcode_tpl = trim($bbcode_tpl);
- $fp_match = preg_quote($msg_bbcode, '!');
- $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $msg_bbcode);
+ $fp_match = preg_quote($bbcode_match, '!');
+ $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);
- $sp_match = preg_quote($msg_bbcode, '!');
+ $sp_match = preg_quote($bbcode_match, '!');
$sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match);
$sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match);
- $sp_replace = $msg_html;
+ $sp_replace = $bbcode_tpl;
// @todo Make sure to change this too if something changed in message parsing
$tokens = array(
@@ -236,7 +236,7 @@ class acp_bbcodes
'!(.*?)!es' => "str_replace('\\\"', '"', str_replace('\\'', ''', '\$1'))"
),
'COLOR' => array(
- '!([a-z]+|#[0-9abcdef]+!i' => '$1'
+ '!([a-z]+|#[0-9abcdef]+)!i' => '$1'
),
'NUMBER' => array(
'!([0-9]+)!' => '$1'
@@ -246,7 +246,7 @@ class acp_bbcodes
$pad = 0;
$modifiers = 'i';
- if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $msg_bbcode, $m))
+ if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
{
foreach ($m[0] as $n => $token)
{
@@ -311,7 +311,7 @@ class acp_bbcodes
}
// Lowercase tags
- $bbcode_tag = preg_replace('/.*?\[([a-z]+=?).*/i', '$1', $msg_bbcode);
+ $bbcode_tag = preg_replace('/.*?\[([a-z]+=?).*/i', '$1', $bbcode_match);
$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);
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index e5e10223f7..86ddd5ce56 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -28,16 +28,16 @@ class acp_email
$submit = (isset($_POST['submit'])) ? true : false;
$error = array();
- $usernames = request_var('usernames', '');
- $group_id = request_var('g', 0);
+ $usernames = request_var('usernames', '');
+ $group_id = request_var('g', 0);
+ $subject = request_var('subject', '', true);
+ $message = request_var('message', '', true);
// Do the job ...
if ($submit)
{
// Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form
- $subject = request_var('subject', '', true);
- $message = request_var('message', '', true);
$use_queue = (isset($_POST['send_immediatly'])) ? false : true;
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 913b338ad1..c4db029b8d 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -26,13 +26,13 @@ class acp_prune
{
case 'forums':
$this->tpl_name = 'acp_prune_forums';
- $this->page_header = 'ACP_PRUNE_FORUMS';
+ $this->page_title = 'ACP_PRUNE_FORUMS';
$this->prune_forums($id, $mode);
break;
case 'users':
$this->tpl_name = 'acp_prune_users';
- $this->page_header = 'ACP_PRUNE_USERS';
+ $this->page_title = 'ACP_PRUNE_USERS';
$this->prune_users($id, $mode);
break;
}
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index b1448b100c..1bfde0887c 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -307,13 +307,20 @@ class auth_admin extends auth
if (sizeof($roles))
{
+ $s_role_js_array = array();
+
+ // Make sure every role (even if empty) has its array defined
+ foreach ($roles as $_role_id => $null)
+ {
+ $s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n";
+ }
+
$sql = 'SELECT r.role_id, o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id
AND r.role_id IN (' . implode(', ', array_keys($roles)) . ')';
$result = $db->sql_query($sql);
- $s_role_js_array = array();
while ($row = $db->sql_fetchrow($result))
{
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
@@ -322,10 +329,6 @@ class auth_admin extends auth
continue;
}
- if (!isset($s_role_js_array[$row['role_id']]))
- {
- $s_role_js_array[$row['role_id']] = "\n" . 'role_options[' . $row['role_id'] . '] = new Array();' . "\n";
- }
$s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . $row['auth_option'] . '\'] = ' . $row['auth_setting'] . '; ';
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 37952d31a7..3c1e7babbf 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -105,6 +105,11 @@ class bbcode
{
$this->template_bitfield = $user->theme['bbcode_bitfield'];
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
+
+ if (!@file_exists($this->template_filename))
+ {
+ trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
+ }
}
$sql = '';
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 8e0ca2377c..2f16d6cf22 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -312,7 +312,7 @@ class dbal_mssql extends dbal
*/
function sql_escape($msg)
{
- return str_replace("'", "''", str_replace('\\', '\\\\', $msg));
+ return str_replace("'", "''", $msg);
}
/**
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 2fc4e30a25..55e1608d89 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -319,7 +319,7 @@ class dbal_mssql_odbc extends dbal
*/
function sql_escape($msg)
{
- return str_replace("'", "''", str_replace('\\', '\\\\', $msg));
+ return str_replace("'", "''", $msg);
}
/**
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 70e8cb7c6c..604d0d3870 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1961,7 +1961,7 @@ function add_log()
$data = (!sizeof($args)) ? '' : serialize($args);
$sql_ary = array(
- 'user_id' => $user->data['user_id'],
+ 'user_id' => (empty($user->data)) ? ANONYMOUS : $user->data['user_id'],
'log_ip' => $user->ip,
'log_time' => time(),
'log_operation' => $action,
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index e99e387b12..7dc2fe9a98 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -765,7 +765,7 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
{
if ($config['img_link_width'] || $config['img_link_height'])
{
- list($width, $height) = getimagesize($filename);
+ list($width, $height) = @getimagesize($filename);
$display_cat = (!$width && !$height) ? ATTACHMENT_CATEGORY_IMAGE : (($width <= $config['img_link_width'] && $height <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE);
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 2210be1ab9..5d8f1dcb90 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -688,13 +688,13 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
// If forum_id == 0 AND topic_id == 0 then this is a PM draft
if (!$topic_id && !$forum_id)
{
- $sql_and = 'AND d.forum_id = 0 AND d.topic_id = 0';
+ $sql_and = ' AND d.forum_id = 0 AND d.topic_id = 0';
}
else
{
$sql_and = '';
- $sql_and .= ($forum_id) ? 'AND d.forum_id = ' . $forum_id : '';
- $sql_and .= ($topic_id) ? 'AND d.topic_id = ' . $topic_id : '';
+ $sql_and .= ($forum_id) ? ' AND d.forum_id = ' . $forum_id : '';
+ $sql_and .= ($topic_id) ? ' AND d.topic_id = ' . $topic_id : '';
}
$sql = 'SELECT d.*, f.forum_id, f.forum_name
@@ -1580,7 +1580,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
if (trim($poll['poll_options'][$i]))
{
- if (!$cur_poll_options[$i])
+ if (empty($cur_poll_options[$i]))
{
$sql_insert_ary[] = array(
'poll_option_id' => (int) $i,
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 0b3ace62b4..d932ae312b 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1211,11 +1211,11 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
if (sizeof($group_attributes))
{
- foreach ($attribute_ary as $attribute => $type)
+ foreach ($attribute_ary as $attribute => $_type)
{
if (isset($group_attributes[$attribute]))
{
- settype($group_attributes[$attribute], $type);
+ settype($group_attributes[$attribute], $_type);
$sql_ary[$attribute] = $group_attributes[$attribute];
}
}
@@ -1224,7 +1224,16 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
// Setting the log message before we set the group id (if group gets added)
$log = ($group_id) ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED';
- $sql = ($group_id) ? 'UPDATE ' . GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE group_id = $group_id" : 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
+ if ($group_id)
+ {
+ $sql = 'UPDATE ' . GROUPS_TABLE . '
+ SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE group_id = $group_id";
+ }
+ else
+ {
+ $sql = 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
+ }
$db->sql_query($sql);
if (!$group_id)
@@ -1236,7 +1245,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
$sql_ary = array();
if (sizeof($group_attributes))
{
- foreach ($attribute_ary as $attribute => $type)
+ foreach ($attribute_ary as $attribute => $_type)
{
if (isset($group_attributes[$attribute]) && !in_array($attribute, $group_only_ary))
{
@@ -1258,6 +1267,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
$db->sql_query($sql);
}
+ $name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name;
add_log('admin', $log, $name);
}
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 306a7e36e1..21a3e7f882 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1237,13 +1237,22 @@ class user extends session
return $imgs[$img . $suffix];
}
- if ($width === false)
+ // Do not include dimensions?
+ if (strpos($this->theme[$img], '*') === false)
{
- list($imgsrc, $height, $width) = explode('*', $this->theme[$img]);
+ $imgsrc = trim($this->theme[$img]);
+ $width = $height = false;
}
else
{
- list($imgsrc, $height) = explode('*', $this->theme[$img]);
+ if ($width === false)
+ {
+ list($imgsrc, $height, $width) = explode('*', $this->theme[$img]);
+ }
+ else
+ {
+ list($imgsrc, $height) = explode('*', $this->theme[$img]);
+ }
}
if ($suffix !== '')
@@ -1262,19 +1271,19 @@ class user extends session
{
case 'src':
return $imgs[$img . $suffix]['src'];
- break;
+ break;
case 'width':
return $imgs[$img . $suffix]['width'];
- break;
+ break;
case 'height':
return $imgs[$img . $suffix]['height'];
- break;
+ break;
default:
return '<img src="' . $imgs[$img . $suffix]['src'] . '"' . (($imgs[$img . $suffix]['width']) ? ' width="' . $imgs[$img . $suffix]['width'] . '"' : '') . (($imgs[$img . $suffix]['height']) ? ' height="' . $imgs[$img . $suffix]['height'] . '"' : '') . ' alt="' . $alt . '" title="' . $alt . '" />';
- break;
+ break;
}
}
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index f48012f9a0..f8a6d1bf89 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -107,7 +107,7 @@ class ucp_attachments
}
else
{
- $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;t={$row['topic_id']}&amp;p={$row['post_msg_id']}#{$row['post_msg_id']}";
+ $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;t={$row['topic_id']}&amp;p={$row['post_msg_id']}#p{$row['post_msg_id']}";
}
$template->assign_block_vars('attachrow', array(
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 2c777e139f..7421cdd53f 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -137,7 +137,7 @@ class ucp_main
'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
'S_UNREAD' => $unread_topic,
- 'U_LAST_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
+ 'U_LAST_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['topic_last_poster_id'] : '',
'U_NEWEST_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id&amp;view=unread#unread",
'U_VIEW_TOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id")
@@ -287,7 +287,7 @@ class ucp_main
$last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST'];
$last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['forum_last_poster_id'];
- $last_post_url = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$forum_id&amp;p=" . $row['forum_last_post_id'] . '#' . $row['forum_last_post_id'];
+ $last_post_url = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$forum_id&amp;p=" . $row['forum_last_post_id'] . '#p' . $row['forum_last_post_id'];
}
else
{
@@ -444,7 +444,7 @@ class ucp_main
'S_UNREAD_TOPIC' => $unread_topic,
'U_NEWEST_POST' => "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;view=unread#unread",
- 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
+ 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u={$row['topic_last_poster_id']}" : '',
'U_VIEW_TOPIC' => $view_topic_url)
);
@@ -590,7 +590,7 @@ class ucp_main
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
- 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
+ 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u={$row['topic_last_poster_id']}" : '',
'U_VIEW_TOPIC' => $view_topic_url,
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f={$forum_id}",
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index cd6831c419..c61832c721 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -59,7 +59,11 @@ function compose_pm($id, $mode, $action)
// Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || ($current_time - $lastclick < 2 && $submit))
{
- redirect("ucp.$phpEx$SID&i=pm&mode=view&action=view_message" . (($msg_id) ? "&p=$msg_id" : ''));
+ if ($msg_id)
+ {
+ redirect("ucp.$phpEx$SID&i=pm&mode=view&action=view_message&p=$msg_id");
+ }
+ redirect("ucp.$phpEx$SID&i=pm");
}
$sql = '';
@@ -79,12 +83,6 @@ function compose_pm($id, $mode, $action)
case 'quote':
case 'forward':
case 'quotepost':
- if ($submit)
- {
- // We don't need to retrieve the post text again when the user is submitting.
- break;
- }
-
if (!$msg_id)
{
trigger_error('NO_MESSAGE');
@@ -167,14 +165,14 @@ function compose_pm($id, $mode, $action)
if ($sql)
{
$result = $db->sql_query_limit($sql, 1);
+ $post = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- if (!($post = $db->sql_fetchrow($result)))
+ if (!$post)
{
trigger_error('NO_MESSAGE');
}
- $db->sql_freeresult($result);
-
$msg_id = (int) $post['msg_id'];
$folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0;
$message_text = (isset($post['message_text'])) ? $post['message_text'] : '';
@@ -397,9 +395,11 @@ function compose_pm($id, $mode, $action)
if ($row = $db->sql_fetchrow($result))
{
- $_REQUEST['subject'] = $row['draft_subject'];
- $_REQUEST['message'] = $row['draft_message'];
- $refresh = true;
+// $_REQUEST['subject'] = $row['draft_subject'];
+// $_REQUEST['message'] = $row['draft_message'];
+// $refresh = false;
+ $message_parser->message = $row['draft_message'];
+ $message_subject = $row['draft_subject'];
$template->assign_var('S_DRAFT_LOADED', true);
}
else
@@ -445,7 +445,7 @@ function compose_pm($id, $mode, $action)
// Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);
- // Check checksum ... don't re-parse message if the same
+ // Parse message
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true);
if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood'))
@@ -578,7 +578,7 @@ function compose_pm($id, $mode, $action)
if ($action == 'quotepost')
{
$post_id = request_var('p', 0);
- $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#{$post_id}]{$message_subject}[/url]\n";
+ $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$message_subject}[/url]\n";
}
else
{
@@ -592,7 +592,7 @@ function compose_pm($id, $mode, $action)
$message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject);
}
- if ($action == 'forward' && !$preview && !$refresh)
+ if ($action == 'forward' && !$preview && !$refresh && !$submit)
{
$fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true);
diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php
index 243d55fef9..c8b4e5b66d 100644
--- a/phpBB/includes/ucp/ucp_zebra.php
+++ b/phpBB/includes/ucp/ucp_zebra.php
@@ -186,7 +186,8 @@ class ucp_zebra
FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
WHERE z.user_id = ' . $user->data['user_id'] . "
AND $sql_and
- AND u.user_id = z.zebra_id";
+ AND u.user_id = z.zebra_id
+ ORDER BY u.username ASC";
$result = $db->sql_query($sql);
$s_username_options = '';