From 65d956bd81fad62d7bc2f489ea8d3d930e666049 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 5 May 2011 10:49:54 +0200 Subject: [PATCH 1/5] [ticket/10158] Add "Return to Inbox"-link to "PM send"-message. PHPBB3-10158 --- phpBB/includes/ucp/ucp_pm_compose.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index b596e72c41..d7fe0af361 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -741,10 +741,13 @@ function compose_pm($id, $mode, $action) $msg_id = submit_pm($action, $subject, $pm_data); $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id); - $return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox'); + $return_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'); meta_refresh(3, $return_message_url); - $message = $user->lang['MESSAGE_STORED'] . '

' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '', '') . '

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

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

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

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_OUTBOX']); trigger_error($message); } From 437013194a516932b6f85ba4ee355dcf5836ef19 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 9 May 2011 12:46:34 +0200 Subject: [PATCH 2/5] [ticket/10158] Add return-link to folder, when the user replied from a folder. PHPBB3-10158 --- phpBB/includes/ucp/ucp_pm.php | 4 ++-- phpBB/includes/ucp/ucp_pm_compose.php | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index e1c51170db..c675928a5b 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -115,7 +115,7 @@ class ucp_pm case 'compose': $action = request_var('action', 'post'); - get_folder($user->data['user_id']); + $user_folders = get_folder($user->data['user_id']); if (!$auth->acl_get('u_sendpm')) { @@ -130,7 +130,7 @@ class ucp_pm } include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx); - compose_pm($id, $mode, $action); + compose_pm($id, $mode, $action, $user_folders); $tpl_file = 'posting_body'; break; diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index d7fe0af361..6ea702570e 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -20,7 +20,7 @@ if (!defined('IN_PHPBB')) * Compose private message * Called from ucp_pm with mode == 'compose' */ -function compose_pm($id, $mode, $action) +function compose_pm($id, $mode, $action, $user_folders = array()) { global $template, $db, $auth, $user; global $phpbb_root_path, $phpEx, $config; @@ -398,7 +398,7 @@ function compose_pm($id, $mode, $action) unset($message_text); $s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id); - $s_action .= ($msg_id) ? "&p=$msg_id" : ''; + $s_action .= (($folder_id) ? "&f=$folder_id" : '') . (($msg_id) ? "&p=$msg_id" : ''); // Delete triggered ? if ($action == 'delete') @@ -741,13 +741,23 @@ function compose_pm($id, $mode, $action) $msg_id = submit_pm($action, $subject, $pm_data); $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id); - $return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'); + $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'); - meta_refresh(3, $return_message_url); + + $folder_return_message = ''; + $return_message_url = $inbox_folder_url; + if ($folder_id && 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']); + } $message = $user->lang['MESSAGE_STORED'] . '

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

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); + $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']); + + meta_refresh(3, $return_message_url); trigger_error($message); } From 67449f8f1b1b9eff8430a77d16d6ee2dac1210d9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 23 May 2011 12:01:11 +0200 Subject: [PATCH 3/5] [ticket/10158] Only view "Return to" links if they are useful. PHPBB3-10158 --- phpBB/includes/ucp/ucp_pm_compose.php | 42 ++++++++++++++++++++++----- phpBB/language/en/ucp.php | 1 + 2 files changed, 35 insertions(+), 8 deletions(-) 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); diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 02b8a282d9..ad7c1ccbff 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -119,6 +119,7 @@ $lang = array_merge($lang, array( 'CANNOT_REMOVE_FOLDER' => 'This folder cannot be removed.', 'CHANGE_DEFAULT_GROUP' => 'Change default group', 'CHANGE_PASSWORD' => 'Change password', + 'CLICK_GOTO_FOLDER' => '%1$sGo to your ā€œ%3$sā€ folder%2$s', 'CLICK_RETURN_FOLDER' => '%1$sReturn to your ā€œ%3$sā€ folder%2$s', 'CONFIRMATION' => 'Confirmation of registration', 'CONFIRM_CHANGES' => 'Confirm changes', From 83dfe0d22c71df8e5701c812d304ef8918c3190f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 26 May 2011 10:43:14 +0200 Subject: [PATCH 4/5] [ticket/10195] Return false in session::check_dnsbl() when IPv6 is passed. There is no support for IPv6 addresses in the blacklists we check right now. PHPBB3-10195 --- phpBB/includes/session.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index d803f8d799..2181375dc1 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1238,6 +1238,12 @@ class session $ip = $this->ip; } + // Neither Spamhaus nor Spamcop supports IPv6 addresses. + if (strpos($ip, ':') !== false) + { + return false; + } + $dnsbl_check = array( 'sbl.spamhaus.org' => 'http://www.spamhaus.org/query/bl?ip=', ); From 6b6705b852bcd2a86735fa99d00a77426bf12813 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 5 Jun 2011 01:57:43 +0200 Subject: [PATCH 5/5] [ticket/10158] Remove some code duplication from generating the message. PHPBB3-10158 --- phpBB/includes/ucp/ucp_pm_compose.php | 40 ++++++++------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 78b2e7a348..05243e3d7a 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -751,37 +751,19 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $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'], '', ''); - 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; + $return_box_url = ($action === 'post' || $action === 'edit') ? $outbox_folder_url : $inbox_folder_url; + $return_box_lang = ($action === 'post' || $action === 'edit') ? 'PM_OUTBOX' : 'PM_INBOX'; - 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; + + $message = $user->lang['MESSAGE_STORED'] . '

' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '', ''); + + $last_click_type = 'CLICK_RETURN_FOLDER'; + if ($folder_url) + { + $message .= '

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

' . sprintf($user->lang[$last_click_type], '', '', $user->lang[$return_box_lang]); meta_refresh(3, $return_message_url); trigger_error($message);