From 67449f8f1b1b9eff8430a77d16d6ee2dac1210d9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 23 May 2011 12:01:11 +0200 Subject: [ticket/10158] Only view "Return to" links if they are useful. PHPBB3-10158 --- phpBB/includes/ucp/ucp_pm_compose.php | 42 ++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/ucp/ucp_pm_compose.php') diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 6ea702570e..78b2e7a348 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -135,6 +135,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } $sql = ''; + $folder_id = 0; // What is all this following SQL for? Well, we need to know // some basic information in all cases before we do anything. @@ -744,18 +745,43 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $inbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'); $outbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox'); - $folder_return_message = ''; - $return_message_url = $inbox_folder_url; - if ($folder_id && isset($user_folders[$folder_id])) + $folder_url = ''; + if (($folder_id > 0) && isset($user_folders[$folder_id])) { - $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id); - $folder_return_message = '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user_folders[$folder_id]['folder_name']); + $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id); } $message = $user->lang['MESSAGE_STORED'] . '

' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '', ''); - $message .= $folder_return_message; - $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); - $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_OUTBOX']); + switch ($action) + { + case 'post': + case 'edit': + if ($folder_url) + { + $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user_folders[$folder_id]['folder_name']); + $message .= '

' . sprintf($user->lang['CLICK_GOTO_FOLDER'], '', '', $user->lang['PM_OUTBOX']); + } + else + { + $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_OUTBOX']); + } + break; + + case 'quote': + case 'quotepost': + case 'reply': + case 'forward': + if ($folder_url) + { + $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user_folders[$folder_id]['folder_name']); + $message .= '

' . sprintf($user->lang['CLICK_GOTO_FOLDER'], '', '', $user->lang['PM_INBOX']); + } + else + { + $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); + } + break; + } meta_refresh(3, $return_message_url); trigger_error($message); -- cgit v1.2.1