- some additional changes

- fixing pm history bug (quote post)


git-svn-id: file:///svn/phpbb/trunk@5243 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-10-02 18:22:59 +00:00
parent 1d688c6b8d
commit 2a75587153
4 changed files with 55 additions and 51 deletions

View file

@ -13,9 +13,8 @@
*/ */
function mcp_forum_view($id, $mode, $action, $url, $forum_info) function mcp_forum_view($id, $mode, $action, $url, $forum_info)
{ {
global $template, $db, $user, $auth, $cache;
global $SID, $phpEx, $phpbb_root_path, $config; global $SID, $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth;
global $_POST, $_REQUEST;
if ($action == 'merge_select') if ($action == 'merge_select')
{ {
@ -84,7 +83,7 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info)
// Grab icons // Grab icons
$icons = array(); $icons = array();
obtain_icons($icons); $cache->obtain_icons($icons);
$topic_rows = array(); $topic_rows = array();

View file

@ -30,7 +30,6 @@ function compose_pm($id, $mode, $action)
$to_user_id = request_var('u', 0); $to_user_id = request_var('u', 0);
$to_group_id = request_var('g', 0); $to_group_id = request_var('g', 0);
$msg_id = request_var('p', 0); $msg_id = request_var('p', 0);
$quote_post = request_var('q', 0);
$draft_id = request_var('d', 0); $draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0); $lastclick = request_var('lastclick', 0);
@ -61,7 +60,7 @@ 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 = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;mode=view_messages&amp;action=view_message" . (($msg_id) ? "&amp;p=$msg_id" : ''); $redirect = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;mode=view&amp;action=view_message" . (($msg_id) ? "&amp;p=$msg_id" : '');
redirect($redirect); redirect($redirect);
} }
@ -81,6 +80,7 @@ function compose_pm($id, $mode, $action)
case 'reply': case 'reply':
case 'quote': case 'quote':
case 'forward': case 'forward':
case 'quotepost':
if (!$msg_id) if (!$msg_id)
{ {
trigger_error('NO_MESSAGE'); trigger_error('NO_MESSAGE');
@ -91,7 +91,7 @@ function compose_pm($id, $mode, $action)
trigger_error('NO_AUTH_SEND_MESSAGE'); trigger_error('NO_AUTH_SEND_MESSAGE');
} }
if ($quote_post) if ($mode == 'quotepost')
{ {
$sql = 'SELECT 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_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
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u
@ -180,7 +180,7 @@ function compose_pm($id, $mode, $action)
trigger_error('NO_AUTHOR'); trigger_error('NO_AUTHOR');
} }
if (($action == 'reply' || $action == 'quote') && !sizeof($address_list) && !$refresh && !$submit && !$preview) if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview)
{ {
$address_list = array('u' => array($author_id => 'to')); $address_list = array('u' => array($author_id => 'to'));
} }
@ -236,7 +236,6 @@ function compose_pm($id, $mode, $action)
$s_action = "{$phpbb_root_path}ucp.$phpEx?sid={$user->session_id}&amp;i=$id&amp;mode=$mode&amp;action=$action"; $s_action = "{$phpbb_root_path}ucp.$phpEx?sid={$user->session_id}&amp;i=$id&amp;mode=$mode&amp;action=$action";
$s_action .= ($msg_id) ? "&amp;p=$msg_id" : ''; $s_action .= ($msg_id) ? "&amp;p=$msg_id" : '';
$s_action .= ($quote_post) ? "&amp;q=1" : '';
// Delete triggered ? // Delete triggered ?
if ($action == 'delete') if ($action == 'delete')
@ -296,7 +295,7 @@ function compose_pm($id, $mode, $action)
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) if (!in_array($action, array('quote', 'quotepost', 'edit', 'delete', 'forward')))
{ {
$enable_sig = ($config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('attachsig')); $enable_sig = ($config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('attachsig'));
$enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies')); $enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies'));
@ -499,7 +498,7 @@ function compose_pm($id, $mode, $action)
// ((!$message_subject) ? $subject : $message_subject) // ((!$message_subject) ? $subject : $message_subject)
$msg_id = submit_pm($action, $subject, $pm_data, $update_message); $msg_id = submit_pm($action, $subject, $pm_data, $update_message);
$return_message_url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;mode=view_messages&amp;action=view_message&amp;p=" . $msg_id; $return_message_url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;mode=view&amp;p=" . $msg_id;
$return_folder_url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;folder=outbox"; $return_folder_url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;folder=outbox";
meta_refresh(3, $return_message_url); meta_refresh(3, $return_message_url);
@ -563,16 +562,16 @@ function compose_pm($id, $mode, $action)
} }
// Decode text for message display // Decode text for message display
$bbcode_uid = (($action == 'quote' || $action == 'forward')&& !$preview && !$refresh && !sizeof($error)) ? $bbcode_uid : $message_parser->bbcode_uid; $bbcode_uid = (($action == 'quote' || $action == 'forward' || $action == 'quotepost') && !$preview && !$refresh && !sizeof($error)) ? $bbcode_uid : $message_parser->bbcode_uid;
$message_parser->decode_message($bbcode_uid); $message_parser->decode_message($bbcode_uid);
if ($action == 'quote' && !$preview && !$refresh) if (($action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
{ {
$message_parser->message = '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; $message_parser->message = '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
} }
if (($action == 'reply' || $action == 'quote') && !$preview && !$refresh) if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
{ {
$message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject); $message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject);
} }
@ -694,23 +693,27 @@ function compose_pm($id, $mode, $action)
{ {
case 'post': case 'post':
$page_title = $user->lang['POST_NEW_PM']; $page_title = $user->lang['POST_NEW_PM'];
break; break;
case 'quote': case 'quote':
$page_title = $user->lang['POST_QUOTE_PM']; $page_title = $user->lang['POST_QUOTE_PM'];
break; break;
case 'quotepost':
$page_title = $user->lang['POST_PM_POST'];
break;
case 'reply': case 'reply':
$page_title = $user->lang['POST_REPLY_PM']; $page_title = $user->lang['POST_REPLY_PM'];
break; break;
case 'edit': case 'edit':
$page_title = $user->lang['POST_EDIT_PM']; $page_title = $user->lang['POST_EDIT_PM'];
break; break;
case 'forward': case 'forward':
$page_title = $user->lang['POST_FORWARD_PM']; $page_title = $user->lang['POST_FORWARD_PM'];
break; break;
default: default:
trigger_error('NO_ACTION_MODE'); trigger_error('NO_ACTION_MODE');

View file

@ -10,7 +10,7 @@
/** /**
* View message folder * View message folder
* Called from ucp_pm with mode == 'view_messages' && action == 'view_folder' * Called from ucp_pm with mode == 'view' && action == 'view_folder'
*/ */
function view_folder($id, $mode, $folder_id, $folder, $type) function view_folder($id, $mode, $folder_id, $folder, $type)
{ {
@ -61,7 +61,7 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
'S_MARK_OPTIONS'=> $s_mark_options) 'S_MARK_OPTIONS'=> $s_mark_options)
); );
$folder_info = get_pm_from($folder_id, $folder, $user->data['user_id'], "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id", $type); $folder_info = get_pm_from($folder_id, $folder, $user->data['user_id'], "{$phpbb_root_path}ucp.$phpEx$SID", $type);
// Okay, lets dump out the page ... // Okay, lets dump out the page ...
if (sizeof($folder_info['pm_list'])) if (sizeof($folder_info['pm_list']))
@ -116,7 +116,7 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
unset($recipient_list, $address); unset($recipient_list, $address);
} }
$url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id"; $url = "{$phpbb_root_path}ucp.$phpEx$SID";
foreach ($folder_info['pm_list'] as $message_id) foreach ($folder_info['pm_list'] as $message_id)
{ {
@ -127,8 +127,8 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
// Generate all URIs ... // Generate all URIs ...
$message_author = "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['author_id'] . '">' . $row['username'] . '</a>'; $message_author = "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['author_id'] . '">' . $row['username'] . '</a>';
$view_message_url = "$url&amp;f=$folder_id&amp;p=$message_id"; $view_message_url = "$url&amp;i=$id&amp;f=$folder_id&amp;p=$message_id";
$remove_message_url = "$url&amp;mode=compose&amp;action=delete&amp;p=$message_id"; $remove_message_url = "$url&amp;i=compose&amp;action=delete&amp;p=$message_id";
$row_indicator = ''; $row_indicator = '';
foreach ($color_rows as $var) foreach ($color_rows as $var)
@ -164,8 +164,8 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
'U_VIEW_PM' => ($row['deleted']) ? '' : $view_message_url, 'U_VIEW_PM' => ($row['deleted']) ? '' : $view_message_url,
'U_REMOVE_PM' => ($row['deleted']) ? $remove_message_url : '', 'U_REMOVE_PM' => ($row['deleted']) ? $remove_message_url : '',
'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '', 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '',
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx?sid={$user->session_id}&amp;mode=reports&amp;pm=$message_id") 'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx?sid={$user->session_id}&amp;i=reports&amp;pm=$message_id")
// 'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&amp;mode=mod_queue&amp;t=$topic_id") // 'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&amp;i=mod_queue&amp;t=$topic_id")
); );
} }
@ -269,7 +269,7 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder')
} }
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => generate_pagination("$url&amp;mode=view_messages&amp;action=view_folder&amp;f=$folder_id&amp;$u_sort_param", $pm_count, $config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("$url&amp;mode=view&amp;action=view_folder&amp;f=$folder_id&amp;$u_sort_param", $pm_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($pm_count, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($pm_count, $config['topics_per_page'], $start),
'TOTAL_MESSAGES'=> (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)), 'TOTAL_MESSAGES'=> (($pm_count == 1) ? $user->lang['VIEW_PM_MESSAGE'] : sprintf($user->lang['VIEW_PM_MESSAGES'], $pm_count)),
@ -284,8 +284,8 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder')
'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SELECT_SORT_DAYS' => $s_limit_days,
'S_TOPIC_ICONS' => ($config['enable_pm_icons']) ? true : false, 'S_TOPIC_ICONS' => ($config['enable_pm_icons']) ? true : false,
'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? "$url&amp;mode=compose&amp;action=post" : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? "$url&amp;i=compose&amp;action=post" : '',
'S_PM_ACTION' => "$url&amp;mode=view_messages&amp;action=view_folder&amp;f=$folder_id") 'S_PM_ACTION' => "$url&amp;i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id")
); );
// Grab all pm data // Grab all pm data

View file

@ -13,7 +13,8 @@
*/ */
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{ {
global $phpbb_root_path, $phpEx, $SID, $user, $template, $auth, $config, $db; global $user, $template, $auth, $db, $cache;
global $phpbb_root_path, $phpEx, $SID, $config;
$user->add_lang(array('viewtopic', 'memberlist')); $user->add_lang(array('viewtopic', 'memberlist'));
@ -35,7 +36,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
// Grab icons // Grab icons
$icons = array(); $icons = array();
obtain_icons($icons); $cache->obtain_icons($icons);
// Instantiate BBCode if need be // Instantiate BBCode if need be
if ($message_row['bbcode_bitfield']) if ($message_row['bbcode_bitfield'])
@ -369,7 +370,8 @@ function message_history($msg_id, $user_id, $message_row, $folder)
*/ */
function get_user_informations($user_id, $user_row) function get_user_informations($user_id, $user_row)
{ {
global $config, $db, $auth, $user, $phpbb_root_path, $phpEx, $SID; global $db, $auth, $user, $cache;
global $phpbb_root_path, $phpEx, $SID, $config;
if (!$user_id) if (!$user_id)
{ {
@ -383,7 +385,7 @@ function get_user_informations($user_id, $user_row)
// Grab ranks // Grab ranks
$ranks = array(); $ranks = array();
obtain_ranks($ranks); $cache->obtain_ranks($ranks);
// Generate online information for user // Generate online information for user
if ($config['load_onlinetrack']) if ($config['load_onlinetrack'])