- fixing a few smaller bugs/glitches

- init user session in cron.php (else it can produce errors if functions expect the user object being set)
- fix sql escaping for mssql/mssql_odbc


git-svn-id: file:///svn/phpbb/trunk@5957 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-05-21 16:54:19 +00:00
parent 2ddac10375
commit 530b7e94c5
27 changed files with 120 additions and 71 deletions

View file

@ -234,7 +234,9 @@
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr> <tr>
<td><a href="{groups.U_EDIT}">{groups.GROUP_NAME}</a></td> <td><a href="{groups.U_EDIT}">{groups.GROUP_NAME}</a>
<!-- IF groups.S_GROUP_ALLOWED and not groups.S_ALLOWED_IN_PM --><br /><span>&raquo; {L_NOT_ALLOWED_IN_PM}</span><!-- ENDIF -->
</td>
<td>{groups.CATEGORY}</td> <td>{groups.CATEGORY}</td>
<td align="center" valign="middle" style="white-space: nowrap;">&nbsp;<a href="{groups.U_EDIT}">{L_EDIT}</a> | <a href="{groups.U_DELETE}">{L_DELETE}</a> | <a href="{groups.U_ACT_DEACT}">{groups.L_ACT_DEACT}</a>&nbsp;</td> <td align="center" valign="middle" style="white-space: nowrap;">&nbsp;<a href="{groups.U_EDIT}">{L_EDIT}</a> | <a href="{groups.U_DELETE}">{L_DELETE}</a> | <a href="{groups.U_ACT_DEACT}">{groups.L_ACT_DEACT}</a>&nbsp;</td>
</tr> </tr>

View file

@ -16,6 +16,9 @@ $phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1); $phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$cron_type = request_var('cron_type', ''); $cron_type = request_var('cron_type', '');
$use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false; $use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false;

View file

@ -249,6 +249,11 @@ class cache extends acm
$extensions = $return; $extensions = $return;
} }
if (!isset($extensions['_allowed_']))
{
$extensions['_allowed_'] = array();
}
return; return;
} }

View file

@ -786,6 +786,8 @@ class acp_attachments
$template->assign_block_vars('groups', array( $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 . "&amp;action=edit&amp;g={$row['group_id']}", 'U_EDIT' => $this->u_action . "&amp;action=edit&amp;g={$row['group_id']}",
'U_DELETE' => $this->u_action . "&amp;action=delete&amp;g={$row['group_id']}", 'U_DELETE' => $this->u_action . "&amp;action=delete&amp;g={$row['group_id']}",

View file

@ -71,8 +71,8 @@ class acp_bbcodes
case 'create': case 'create':
$display_on_posting = request_var('display_on_posting', 0); $display_on_posting = request_var('display_on_posting', 0);
$bbcode_match = (isset($_POST['bbcode_match'])) ? htmlspecialchars(stripslashes($_POST['bbcode_match'])) : ''; $bbcode_match = request_var('bbcode_match', '');
$bbcode_tpl = (isset($_POST['bbcode_tpl'])) ? stripslashes($_POST['bbcode_tpl']) : ''; $bbcode_tpl = html_entity_decode(request_var('bbcode_tpl', ''));
break; break;
} }
@ -207,19 +207,19 @@ class acp_bbcodes
/* /*
* Build regular expression for custom bbcode * 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); $bbcode_match = trim($bbcode_match);
$msg_html = trim($msg_html); $bbcode_tpl = trim($bbcode_tpl);
$fp_match = preg_quote($msg_bbcode, '!'); $fp_match = preg_quote($bbcode_match, '!');
$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $msg_bbcode); $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace); $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_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 // @todo Make sure to change this too if something changed in message parsing
$tokens = array( $tokens = array(
@ -236,7 +236,7 @@ class acp_bbcodes
'!(.*?)!es' => "str_replace('\\\"', '&quot;', str_replace('\\'', '&#39;', '\$1'))" '!(.*?)!es' => "str_replace('\\\"', '&quot;', str_replace('\\'', '&#39;', '\$1'))"
), ),
'COLOR' => array( 'COLOR' => array(
'!([a-z]+|#[0-9abcdef]+!i' => '$1' '!([a-z]+|#[0-9abcdef]+)!i' => '$1'
), ),
'NUMBER' => array( 'NUMBER' => array(
'!([0-9]+)!' => '$1' '!([0-9]+)!' => '$1'
@ -246,7 +246,7 @@ class acp_bbcodes
$pad = 0; $pad = 0;
$modifiers = 'i'; $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) foreach ($m[0] as $n => $token)
{ {
@ -311,7 +311,7 @@ class acp_bbcodes
} }
// Lowercase tags // 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_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match);
$fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace); $fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace);
$sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match); $sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match);

View file

@ -30,14 +30,14 @@ class acp_email
$usernames = request_var('usernames', ''); $usernames = request_var('usernames', '');
$group_id = request_var('g', 0); $group_id = request_var('g', 0);
$subject = request_var('subject', '', true);
$message = request_var('message', '', true);
// Do the job ... // Do the job ...
if ($submit) if ($submit)
{ {
// Error checking needs to go here ... if no subject and/or no message then skip // Error checking needs to go here ... if no subject and/or no message then skip
// over the send and return to the form // 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; $use_queue = (isset($_POST['send_immediatly'])) ? false : true;
$priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY); $priority = request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY);

View file

@ -26,13 +26,13 @@ class acp_prune
{ {
case 'forums': case 'forums':
$this->tpl_name = 'acp_prune_forums'; $this->tpl_name = 'acp_prune_forums';
$this->page_header = 'ACP_PRUNE_FORUMS'; $this->page_title = 'ACP_PRUNE_FORUMS';
$this->prune_forums($id, $mode); $this->prune_forums($id, $mode);
break; break;
case 'users': case 'users':
$this->tpl_name = 'acp_prune_users'; $this->tpl_name = 'acp_prune_users';
$this->page_header = 'ACP_PRUNE_USERS'; $this->page_title = 'ACP_PRUNE_USERS';
$this->prune_users($id, $mode); $this->prune_users($id, $mode);
break; break;
} }

View file

@ -307,13 +307,20 @@ class auth_admin extends auth
if (sizeof($roles)) 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 $sql = 'SELECT r.role_id, o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id WHERE o.auth_option_id = r.auth_option_id
AND r.role_id IN (' . implode(', ', array_keys($roles)) . ')'; AND r.role_id IN (' . implode(', ', array_keys($roles)) . ')';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$s_role_js_array = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1); $flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1);
@ -322,10 +329,6 @@ class auth_admin extends auth
continue; 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'] . '; '; $s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . $row['auth_option'] . '\'] = ' . $row['auth_setting'] . '; ';
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);

View file

@ -105,6 +105,11 @@ class bbcode
{ {
$this->template_bitfield = $user->theme['bbcode_bitfield']; $this->template_bitfield = $user->theme['bbcode_bitfield'];
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html'; $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 = ''; $sql = '';

View file

@ -312,7 +312,7 @@ class dbal_mssql extends dbal
*/ */
function sql_escape($msg) function sql_escape($msg)
{ {
return str_replace("'", "''", str_replace('\\', '\\\\', $msg)); return str_replace("'", "''", $msg);
} }
/** /**

View file

@ -319,7 +319,7 @@ class dbal_mssql_odbc extends dbal
*/ */
function sql_escape($msg) function sql_escape($msg)
{ {
return str_replace("'", "''", str_replace('\\', '\\\\', $msg)); return str_replace("'", "''", $msg);
} }
/** /**

View file

@ -1961,7 +1961,7 @@ function add_log()
$data = (!sizeof($args)) ? '' : serialize($args); $data = (!sizeof($args)) ? '' : serialize($args);
$sql_ary = array( $sql_ary = array(
'user_id' => $user->data['user_id'], 'user_id' => (empty($user->data)) ? ANONYMOUS : $user->data['user_id'],
'log_ip' => $user->ip, 'log_ip' => $user->ip,
'log_time' => time(), 'log_time' => time(),
'log_operation' => $action, 'log_operation' => $action,

View file

@ -765,7 +765,7 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
{ {
if ($config['img_link_width'] || $config['img_link_height']) 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); $display_cat = (!$width && !$height) ? ATTACHMENT_CATEGORY_IMAGE : (($width <= $config['img_link_width'] && $height <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE);
} }

View file

@ -1580,7 +1580,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{ {
if (trim($poll['poll_options'][$i])) if (trim($poll['poll_options'][$i]))
{ {
if (!$cur_poll_options[$i]) if (empty($cur_poll_options[$i]))
{ {
$sql_insert_ary[] = array( $sql_insert_ary[] = array(
'poll_option_id' => (int) $i, 'poll_option_id' => (int) $i,

View file

@ -1211,11 +1211,11 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
if (sizeof($group_attributes)) if (sizeof($group_attributes))
{ {
foreach ($attribute_ary as $attribute => $type) foreach ($attribute_ary as $attribute => $_type)
{ {
if (isset($group_attributes[$attribute])) if (isset($group_attributes[$attribute]))
{ {
settype($group_attributes[$attribute], $type); settype($group_attributes[$attribute], $_type);
$sql_ary[$attribute] = $group_attributes[$attribute]; $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) // Setting the log message before we set the group id (if group gets added)
$log = ($group_id) ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED'; $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); $db->sql_query($sql);
if (!$group_id) if (!$group_id)
@ -1236,7 +1245,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
$sql_ary = array(); $sql_ary = array();
if (sizeof($group_attributes)) 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)) 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); $db->sql_query($sql);
} }
$name = ($type == GROUP_SPECIAL) ? $user->lang['G_' . $name] : $name;
add_log('admin', $log, $name); add_log('admin', $log, $name);
} }

View file

@ -1237,6 +1237,14 @@ class user extends session
return $imgs[$img . $suffix]; return $imgs[$img . $suffix];
} }
// Do not include dimensions?
if (strpos($this->theme[$img], '*') === false)
{
$imgsrc = trim($this->theme[$img]);
$width = $height = false;
}
else
{
if ($width === false) if ($width === false)
{ {
list($imgsrc, $height, $width) = explode('*', $this->theme[$img]); list($imgsrc, $height, $width) = explode('*', $this->theme[$img]);
@ -1245,6 +1253,7 @@ class user extends session
{ {
list($imgsrc, $height) = explode('*', $this->theme[$img]); list($imgsrc, $height) = explode('*', $this->theme[$img]);
} }
}
if ($suffix !== '') if ($suffix !== '')
{ {

View file

@ -107,7 +107,7 @@ class ucp_attachments
} }
else 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( $template->assign_block_vars('attachrow', array(

View file

@ -137,7 +137,7 @@ class ucp_main
'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
'S_UNREAD' => $unread_topic, '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_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_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") '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 = ($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_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 else
{ {
@ -444,7 +444,7 @@ class ucp_main
'S_UNREAD_TOPIC' => $unread_topic, '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_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_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_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', '') : '', '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'), '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_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_TOPIC' => $view_topic_url,
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f={$forum_id}", 'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f={$forum_id}",

View file

@ -59,7 +59,11 @@ function compose_pm($id, $mode, $action)
// Was cancel pressed? If so then redirect to the appropriate page // Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || ($current_time - $lastclick < 2 && $submit)) 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 = ''; $sql = '';
@ -79,12 +83,6 @@ function compose_pm($id, $mode, $action)
case 'quote': case 'quote':
case 'forward': case 'forward':
case 'quotepost': case 'quotepost':
if ($submit)
{
// We don't need to retrieve the post text again when the user is submitting.
break;
}
if (!$msg_id) if (!$msg_id)
{ {
trigger_error('NO_MESSAGE'); trigger_error('NO_MESSAGE');
@ -167,14 +165,14 @@ function compose_pm($id, $mode, $action)
if ($sql) if ($sql)
{ {
$result = $db->sql_query_limit($sql, 1); $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'); trigger_error('NO_MESSAGE');
} }
$db->sql_freeresult($result);
$msg_id = (int) $post['msg_id']; $msg_id = (int) $post['msg_id'];
$folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0; $folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0;
$message_text = (isset($post['message_text'])) ? $post['message_text'] : ''; $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)) if ($row = $db->sql_fetchrow($result))
{ {
$_REQUEST['subject'] = $row['draft_subject']; // $_REQUEST['subject'] = $row['draft_subject'];
$_REQUEST['message'] = $row['draft_message']; // $_REQUEST['message'] = $row['draft_message'];
$refresh = true; // $refresh = false;
$message_parser->message = $row['draft_message'];
$message_subject = $row['draft_subject'];
$template->assign_var('S_DRAFT_LOADED', true); $template->assign_var('S_DRAFT_LOADED', true);
} }
else else
@ -445,7 +445,7 @@ function compose_pm($id, $mode, $action)
// Parse Attachments - before checksum is calculated // Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); $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); $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')) 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') if ($action == 'quotepost')
{ {
$post_id = request_var('p', 0); $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 else
{ {
@ -592,7 +592,7 @@ function compose_pm($id, $mode, $action)
$message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject); $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); $fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true);

View file

@ -186,7 +186,8 @@ class ucp_zebra
FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
WHERE z.user_id = ' . $user->data['user_id'] . " WHERE z.user_id = ' . $user->data['user_id'] . "
AND $sql_and 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); $result = $db->sql_query($sql);
$s_username_options = ''; $s_username_options = '';

View file

@ -104,6 +104,7 @@ $lang = array_merge($lang, array(
'MODE_INLINE' => 'Inline', 'MODE_INLINE' => 'Inline',
'MODE_PHYSICAL' => 'Physical', 'MODE_PHYSICAL' => 'Physical',
'NOT_ALLOWED_IN_PM' => 'Not allowed in private messages',
'NOT_ASSIGNED' => 'Not assigned', 'NOT_ASSIGNED' => 'Not assigned',
'NO_EXT_GROUP_NAME' => 'No Group Name entered', 'NO_EXT_GROUP_NAME' => 'No Group Name entered',
'NO_EXT_GROUP_SPECIFIED' => 'No Extension Group specified', 'NO_EXT_GROUP_SPECIFIED' => 'No Extension Group specified',

View file

@ -87,6 +87,7 @@ $lang = array_merge($lang, array(
'LIST_USER' => '1 User', 'LIST_USER' => '1 User',
'LIST_USERS' => '%d Users', 'LIST_USERS' => '%d Users',
'LOGIN_EXPLAIN_LEADERS' => 'The board administrator requires you to be registered and logged in to view the team listing.', 'LOGIN_EXPLAIN_LEADERS' => 'The board administrator requires you to be registered and logged in to view the team listing.',
'LOGIN_EXPLAIN_SEARCHUSER' => 'The board administrator requires you to be registered and logged in to search users.',
'LOGIN_EXPLAIN_VIEWPROFILE' => 'The board administrator requires you to be registered and logged in to view profiles.', 'LOGIN_EXPLAIN_VIEWPROFILE' => 'The board administrator requires you to be registered and logged in to view profiles.',
'MORE_THAN' => 'More than', 'MORE_THAN' => 'More than',

View file

@ -41,7 +41,7 @@
<!-- ENDIF --> <!-- ENDIF -->
<td class="row1"> <td class="row1">
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF --> <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> {topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED --> <!-- IF topicrow.S_TOPIC_UNAPPROVED -->
<a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>&nbsp; <a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>&nbsp;
<!-- ENDIF --> <!-- ENDIF -->
@ -161,7 +161,7 @@
<!-- ENDIF --> <!-- ENDIF -->
<td class="row1"> <td class="row1">
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF --> <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> {topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED --> <!-- IF topicrow.S_TOPIC_UNAPPROVED -->
<a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>&nbsp; <a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>&nbsp;
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -57,7 +57,7 @@
</tr> </tr>
<!-- IF S_HAS_POLL --> <!-- IF S_HAS_POLL -->
<tr> <tr>
<td class="row2" colspan="2"><br clear="all" /><form method="post" action="{S_POLL_ACTION}"> <td class="row2" colspan="2" align="center"><br clear="all" /><form method="post" action="{S_POLL_ACTION}">
<table cellspacing="0" cellpadding="4" border="0" align="center"> <table cellspacing="0" cellpadding="4" border="0" align="center">
<tr> <tr>

View file

@ -263,7 +263,9 @@ $sql = $db->sql_build_query('SELECT_DISTINCT', array(
AND z.friend = 1 AND z.friend = 1
AND u.user_id = z.zebra_id', AND u.user_id = z.zebra_id',
'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.user_allow_viewonline' 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.user_allow_viewonline',
'ORDER_BY' => 'u.username ASC',
)); ));
$result = $db->sql_query($sql); $result = $db->sql_query($sql);

View file

@ -500,6 +500,11 @@ if (sizeof($topic_list))
'S_UNREAD_TOPIC' => $unread_topic, 'S_UNREAD_TOPIC' => $unread_topic,
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_report', $forum_id)) ? true : false, 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_report', $forum_id)) ? true : false,
'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? true : false, 'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? true : false,
'S_HAS_POLL' => ($row['poll_start']) ? true : false,
'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false,
'S_POST_STICKY' => ($row['topic_type'] == POST_STICKY) ? true : false,
'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false,
'U_NEWEST_POST' => $view_topic_url . '&amp;view=unread#unread', 'U_NEWEST_POST' => $view_topic_url . '&amp;view=unread#unread',
'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], 'U_LAST_POST' => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],

View file

@ -157,7 +157,7 @@ if ($view && !$post_id)
// also allows for direct linking to a post (and the calculation of which // also allows for direct linking to a post (and the calculation of which
// page the post is on and the correct display of viewtopic) // page the post is on and the correct display of viewtopic)
$sql_array = array( $sql_array = array(
'SELECT' => 't.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, t.topic_replies_real, t.topic_replies, t.topic_first_post_id, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, t.poll_vote_change, f.forum_name, f.forum_desc, f.forum_desc_uid, f.forum_desc_bitfield, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password, f.forum_rules, f.forum_rules_link, f.forum_rules_uid, f.forum_rules_bitfield', 'SELECT' => 't.*, f.*',
'FROM' => array( 'FROM' => array(
FORUMS_TABLE => 'f', FORUMS_TABLE => 'f',