diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2004-10-08 11:13:01 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-10-08 11:13:01 +0000 |
commit | 2fcb764f3e4cba372e44397395b395f3a928ad03 (patch) | |
tree | 423c13e49dbbad096a6279075295284ba67b9a86 /phpBB/includes/ucp | |
parent | 3f85d0134174a453d707de1a1b6975c6bf54ae14 (diff) | |
download | forums-2fcb764f3e4cba372e44397395b395f3a928ad03.tar forums-2fcb764f3e4cba372e44397395b395f3a928ad03.tar.gz forums-2fcb764f3e4cba372e44397395b395f3a928ad03.tar.bz2 forums-2fcb764f3e4cba372e44397395b395f3a928ad03.tar.xz forums-2fcb764f3e4cba372e44397395b395f3a928ad03.zip |
- more pm updates
git-svn-id: file:///svn/phpbb/trunk@4998 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp')
-rw-r--r-- | phpBB/includes/ucp/ucp_pm.php | 43 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 92 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_options.php | 165 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewfolder.php | 11 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewmessage.php | 8 |
5 files changed, 239 insertions, 80 deletions
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index d0eb0d8eae..964077a2c1 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -48,7 +48,7 @@ class ucp_pm extends module if ($user->data['user_id'] == ANONYMOUS) { - trigger_error('NO_PM'); + trigger_error('NO_MESSAGE'); } // Is PM disabled? @@ -60,7 +60,9 @@ class ucp_pm extends module $user->add_lang('posting'); $template->assign_var('S_PRIVMSGS', true); + // Folder directly specified? $folder_specified = request_var('folder', ''); + if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) { $folder_specified = (int) $folder_specified; @@ -98,16 +100,13 @@ class ucp_pm extends module { $l_new_message = $user->lang['YOU_NO_NEW_PM']; } - - $l_new_message .= '<br /><br />' . sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . $phpbb_root_path . 'ucp.' . $phpEx . $SID . '&i=pm&folder=inbox" onclick="jump_to_inbox();return false;" target="_new">', '</a>'); - } - else - { - $l_new_message = $user->lang['LOGIN_CHECK_PM']; } $template->assign_vars(array( - 'MESSAGE' => $l_new_message) + 'MESSAGE' => $l_new_message, + 'S_NOT_LOGGED_IN' => ($user->data['user_id'] == ANONYMOUS) ? true : false, + 'CLICK_TO_VIEW' => sprintf($user->lang['CLICK_VIEW_PRIVMSG'], '<a href="' . $phpbb_root_path . 'ucp.' . $phpEx . $SID . '&i=pm&folder=inbox" onclick="jump_to_inbox();return false;" target="_new">', '</a>'), + 'U_INBOX' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=inbox") ); break; @@ -118,7 +117,7 @@ class ucp_pm extends module if (!$auth->acl_get('u_sendpm')) { - trigger_error('NOT_AUTHORIZED'); + trigger_error('NO_AUTH_SEND_MESSAGE'); } include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.'.$phpEx); @@ -162,7 +161,7 @@ class ucp_pm extends module if (!$auth->acl_get('u_readpm')) { - trigger_error('NOT_AUTHORIZED'); + trigger_error('NO_AUTH_READ_MESSAGE'); } // First Handle Mark actions and moving messages @@ -172,7 +171,11 @@ class ucp_pm extends module { $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_message_limit']; - if (move_pm($user->data['user_id'], $message_limit)) + $move_msg_ids = (isset($_POST['marked_msg_id'])) ? array_map('intval', $_POST['marked_msg_id']) : array(); + $dest_folder = request_var('dest_folder', PRIVMSGS_NO_BOX); + $cur_folder_id = request_var('cur_folder_id', PRIVMSGS_NO_BOX); + + if (move_pm($user->data['user_id'], $message_limit, $move_msg_ids, $dest_folder, $cur_folder_id)) { // Return to folder view if single message moved if ($action == 'view_message') @@ -211,7 +214,7 @@ class ucp_pm extends module $result = $db->sql_query_limit($sql, 1); if (!($row = $db->sql_fetchrow($result))) { - trigger_error('MESSAGE_NO_LONGER_AVAILABLE'); + trigger_error('NO_MESSAGE'); } $folder_id = (int) $row['folder_id']; } @@ -258,7 +261,7 @@ class ucp_pm extends module if (!($message_row = $db->sql_fetchrow($result))) { - trigger_error('MESSAGE_NO_LONGER_AVAILABLE'); + trigger_error('NO_MESSAGE'); } // Update unread status @@ -294,7 +297,7 @@ class ucp_pm extends module // Header for message view - folder and so on $folder_status = get_folder_status($folder_id, $folder); $url = "{$phpbb_root_path}ucp.$phpEx$SID&i=$id"; - + $template->assign_vars(array( 'CUR_FOLDER_ID' => $folder_id, 'CUR_FOLDER_NAME' => $folder_status['folder_name'], @@ -307,11 +310,15 @@ class ucp_pm extends module 'S_FOLDER_ACTION' => "$url&mode=view_messages&action=view_folder", 'S_PM_ACTION' => "$url&mode=$mode&action=$action", - 'U_INBOX' => ($folder_id != PRIVMSGS_INBOX) ? "$url&folder=inbox" : '', - 'U_OUTBOX' => ($folder_id != PRIVMSGS_OUTBOX) ? "$url&folder=outbox" : '', - 'U_SENTBOX' => ($folder_id != PRIVMSGS_SENTBOX) ? "$url&folder=sentbox" : '', + 'U_INBOX' => "$url&folder=inbox", + 'U_OUTBOX' => "$url&folder=outbox", + 'U_SENTBOX' => "$url&folder=sentbox", 'U_CREATE_FOLDER' => "$url&mode=options", + 'S_IN_INBOX' => ($folder_id == PRIVMSGS_INBOX) ? true : false, + 'S_IN_OUTBOX' => ($folder_id == PRIVMSGS_OUTBOX) ? true : false, + 'S_IN_SENTBOX' => ($folder_id == PRIVMSGS_SENTBOX) ? true : false, + 'FOLDER_STATUS' => $folder_status['message'], 'FOLDER_MAX_MESSAGES' => $folder_status['max'], 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], @@ -347,7 +354,7 @@ class ucp_pm extends module break; default: - trigger_error('NOT_AUTHORIZED'); + trigger_error('NO_ACTION_MODE'); } $template->assign_vars(array( diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 7f1c87efdc..60dd4b33b9 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -75,7 +75,7 @@ function compose_pm($id, $mode, $action) case 'post': if (!$auth->acl_get('u_sendpm')) { - trigger_error('NOT_AUTHORIZED_POST_PM'); + trigger_error('NO_AUTH_SEND_MESSAGE'); } break; @@ -85,7 +85,7 @@ function compose_pm($id, $mode, $action) case 'forward': if (!$msg_id) { - trigger_error('NO_PM'); + trigger_error('NO_MESSAGE'); } if ($quote_post) @@ -110,7 +110,7 @@ function compose_pm($id, $mode, $action) case 'edit': if (!$msg_id) { - trigger_error('NO_PM'); + trigger_error('NO_MESSAGE'); } // check for outbox (not read) status, we do not allow editing if one user already having the message @@ -125,15 +125,15 @@ function compose_pm($id, $mode, $action) case 'delete': if (!$auth->acl_get('u_pm_delete')) { - trigger_error('NOT_AUTHORIZED_DELETE_PM'); + trigger_error('NO_AUTH_DELETE_MESSAGE'); } if (!$msg_id) { - trigger_error('NO_PM'); + trigger_error('NO_MESSAGE'); } - $sql = 'SELECT msg_id, unread, new, author_id + $sql = 'SELECT msg_id, unread, new, author_id, folder_id FROM ' . PRIVMSGS_TO_TABLE . ' WHERE user_id = ' . $user->data['user_id'] . " AND msg_id = $msg_id"; @@ -144,27 +144,27 @@ function compose_pm($id, $mode, $action) break; default: - trigger_error('NO_POST_MODE'); + trigger_error('NO_ACTION_MODE'); } if ($action == 'reply' && !$auth->acl_get('u_sendpm')) { - trigger_error('NOT_AUTHORIZED_REPLY_PM'); + trigger_error('NO_AUTH_REPLY_MESSAGE'); } if ($action == 'quote' && (!$config['auth_quote_pm'] || !$auth->acl_get('u_sendpm'))) { - trigger_error('NOT_AUTHORIZED_QUOTE_PM'); + trigger_error('NO_AUTH_QUOTE_MESSAGE'); } if ($action == 'forward' && (!$config['forward_pm'] || !$auth->acl_get('u_pm_forward'))) { - trigger_error('NOT_AUTHORIZED_FORWARD_PM'); + trigger_error('NO_AUTH_FORWARD_MESSAGE'); } if ($action == 'edit' && !$auth->acl_get('u_pm_edit')) { - trigger_error('NOT_AUTHORIZED_EDIT_PM'); + trigger_error('NO_AUTH_EDIT_MESSAGE'); } if ($sql) @@ -173,7 +173,7 @@ function compose_pm($id, $mode, $action) if (!($row = $db->sql_fetchrow($result))) { - trigger_error('NOT_AUTHORIZED'); + trigger_error('NO_MESSAGE'); } extract($row); @@ -184,7 +184,7 @@ function compose_pm($id, $mode, $action) if (!$author_id && $msg_id) { - trigger_error('NO_USER'); + trigger_error('NO_AUTHOR'); } if (($action == 'reply' || $action == 'quote') && !sizeof($address_list) && !$refresh && !$submit && !$preview) @@ -217,14 +217,14 @@ function compose_pm($id, $mode, $action) if (($to_group_id || isset($address_list['g'])) && !$config['allow_mass_pm']) { - trigger_error('NOT_ALLOWED_MASS_PM'); + trigger_error('NO_AUTH_GROUP_MESSAGE'); } if ($action == 'edit' && !$refresh && !$preview && !$submit) { if (!($message_time > time() - $config['pm_edit_time'] || !$config['pm_edit_time'])) { - trigger_error('NOT_AUTHORIZED_EDIT_TIME'); + trigger_error('CANNOT_EDIT_MESSAGE_TIME'); } } @@ -233,6 +233,8 @@ function compose_pm($id, $mode, $action) $icon_id = 0; } + + $message_parser = new parse_message(); $message_subject = (isset($message_subject)) ? $message_subject : ''; @@ -243,6 +245,34 @@ function compose_pm($id, $mode, $action) $s_action .= ($msg_id) ? "&p=$msg_id" : ''; $s_action .= ($quote_post) ? "&q=1" : ''; + // Delete triggered ? + if ($action == 'delete') + { + // Folder id has been determined by the SQL Statement + // $folder_id = request_var('f', PRIVMSGS_NO_BOX); + + $s_hidden_fields = '<input type="hidden" name="p" value="' . $msg_id . '" /><input type="hidden" name="f" value="' . $folder_id . '" /><input type="hidden" name="action" value="delete" />'; + + // Do we need to confirm ? + if (confirm_box(true)) + { + delete_pm($user->data['user_id'], $msg_id, $folder_id); + + // TODO - jump to next message in "history"? + $meta_info = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=$folder_id"; + $message = $user->lang['MESSAGE_DELETED']; + + meta_refresh(3, $meta_info); + $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); + trigger_error($message); + } + else + { + // "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=compose" + confirm_box(false, 'DELETE_MESSAGE', $s_hidden_fields); + } + } + // Handle User/Group adding/removing handle_message_list_actions($address_list, $remove_u, $remove_g, $add_to, $add_bcc); @@ -301,34 +331,6 @@ function compose_pm($id, $mode, $action) $message_parser->bbcode_uid = $bbcode_uid; } - // Delete triggered ? - if ($action == 'delete') - { - // Get Folder ID - $folder_id = request_var('f', PRIVMSGS_NO_BOX); - - $s_hidden_fields = '<input type="hidden" name="p" value="' . $msg_id . '" /><input type="hidden" name="f" value="' . $folder_id . '" /><input type="hidden" name="action" value="delete" />'; - - // Do we need to confirm ? - if (confirm_box(true)) - { - delete_pm($user->data['user_id'], $msg_id, $folder_id); - - // TODO - jump to next message in "history"? - $meta_info = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=$folder_id"; - $message = $user->lang['PM_DELETED']; - - meta_refresh(3, $meta_info); - $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>'); - trigger_error($message); - } - else - { - // "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=compose" - confirm_box(false, 'DELETE_PM', $s_hidden_fields); - } - } - $html_status = ($config['allow_html'] && $config['auth_html_pm'] && $auth->acl_get('u_pm_html')); $bbcode_status = ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')); $smilies_status = ($config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies')); @@ -716,7 +718,7 @@ function compose_pm($id, $mode, $action) break; default: - trigger_error('NOT_AUTHORIZED'); + trigger_error('NO_ACTION_MODE'); } $s_hidden_fields = '<input type="hidden" name="lastclick" value="' . $current_time . '" />'; @@ -738,7 +740,7 @@ function compose_pm($id, $mode, $action) 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], - 'MINI_POST_IMG' => $user->img('icon_post', $user->lang['POST']), + 'MINI_POST_IMG' => $user->img('icon_post', $user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'S_EDIT_POST' => ($action == 'edit'), diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index 69e802b4da..7b4a213e0b 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -17,6 +17,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $redirect_url = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=options"; + // Change "full folder" setting - what to do if folder is full if (isset($_POST['fullfolder'])) { $full_action = request_var('full_action', 0); @@ -52,6 +53,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } } + // Add Folder if (isset($_POST['addfolder'])) { $folder_name = request_var('foldername', ''); @@ -60,7 +62,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { $sql = 'SELECT folder_name FROM ' . PRIVMSGS_FOLDER_TABLE . " - WHERE folder_name = '$folder_name' + WHERE folder_name = '" . $db->sql_escape($folder_name) . "' AND user_id = " . $user->data['user_id']; $result = $db->sql_query_limit($sql, 1); @@ -88,10 +90,148 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $message = $user->lang['FOLDER_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); meta_refresh(3, $redirect_url); trigger_error($message); - } } + // Rename folder + if (isset($_POST['rename_folder'])) + { + $new_folder_name = request_var('new_folder_name', ''); + $rename_folder_id= request_var('rename_folder_id', 0); + + if (!$new_folder_name) + { + trigger_error('NO_NEW_FOLDER_NAME'); + } + + // Select custom folder + $sql = 'SELECT folder_name, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND folder_id = $rename_folder_id"; + $result = $db->sql_query_limit($sql, 1); + $folder_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$folder_row) + { + trigger_error('CANNOT_RENAME_FOLDER'); + } + + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET folder_name = '" . $db->sql_escape($new_folder_name) . "' + WHERE folder_id = $rename_folder_id + AND user_id = {$user->data['user_id']}"; + $db->sql_query($sql); + + $message = $user->lang['FOLDER_RENAMED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $redirect_url . '">', '</a>'); + meta_refresh(3, $redirect_url); + trigger_error($message); + } + + // Remove Folder + if (isset($_POST['remove_folder'])) + { + $remove_folder_id = request_var('remove_folder_id', 0); + + // Default to "move all messages to inbox" + $remove_action = request_var('remove_action', 1); + $move_to = request_var('move_to', PRIVMSGS_INBOX); + + // Move to same folder? + if ($remove_action == 1 && $remove_folder_id == $move_to) + { + trigger_error('CANNOT_MOVE_TO_SAME_FOLDER'); + } + + // Select custom folder + $sql = 'SELECT folder_name, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND folder_id = $remove_folder_id"; + $result = $db->sql_query_limit($sql, 1); + $folder_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$folder_row) + { + trigger_error('CANNOT_REMOVE_FOLDER'); + } + + $s_hidden_fields = '<input type="hidden" name="remove_folder_id" value="' . $remove_folder_id . '" />'; + $s_hidden_fields .= '<input type="hidden" name="remove_action" value="' . $remove_action . '" />'; + $s_hidden_fields .= '<input type="hidden" name="move_to" value="' . $move_to . '" />'; + $s_hidden_fields .= '<input type="hidden" name="remove_folder" value="1" />'; + + // Do we need to confirm? + if (confirm_box(true)) + { + // Gather message ids + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . " + AND folder_id = $remove_folder_id"; + $result = $db->sql_query($sql); + + $msg_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $msg_ids[] = (int) $row['msg_id']; + } + $db->sql_freeresult($result); + + // First of all, copy all messages to another folder... or delete all messages + switch ($remove_action) + { + // Move Messages + case 1: + $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_message_limit']; + $num_moved = move_pm($user->data['user_id'], $message_limit, $msg_ids, $move_to, $remove_folder_id); + + // Something went wrong, only partially moved? + if ($num_moved != $folder_row['pm_count']) + { + trigger_error(sprintf($user->lang['MOVE_PM_ERROR'], $num_moved, $folder_row['pm_count'])); + } + break; + + // Remove Messages + case 2: + delete_pm($user->data['user_id'], $msg_ids, $remove_folder_id); + break; + } + + // Remove folder + $sql = 'DELETE FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND folder_id = $remove_folder_id"; + $db->sql_query($sql); + + // Check full folder option. If the removed folder has been specified as destination switch back to inbox + if ($user->data['user_full_folder'] == $remove_folder_id) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_full_folder = ' . PRIVMSGS_INBOX . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + $user->data['user_full_folder'] = PRIVMSGS_INBOX; + } + + $meta_info = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=$mode"; + $message = $user->lang['FOLDER_REMOVED']; + + meta_refresh(3, $meta_info); + $message .= '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $meta_info . '">', '</a>'); + trigger_error($message); + } + else + { + confirm_box(false, 'REMOVE_FOLDER', $s_hidden_fields); + } + } + + // Add Rule if (isset($_POST['add_rule'])) { $check_option = request_var('check_option', 0); @@ -116,14 +256,14 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } $rule_ary = array( - 'user_id' => $user->data['user_id'], - 'rule_check' => $check_option, + 'user_id' => $user->data['user_id'], + 'rule_check' => $check_option, 'rule_connection' => $rule_option, - 'rule_string' => $rule_string, - 'rule_user_id' => $rule_user_id, - 'rule_group_id' => $rule_group_id, - 'rule_action' => $action, - 'rule_folder_id'=> $folder_id + 'rule_string' => $rule_string, + 'rule_user_id' => $rule_user_id, + 'rule_group_id' => $rule_group_id, + 'rule_action' => $action, + 'rule_folder_id' => $folder_id ); $sql = 'SELECT rule_id @@ -145,6 +285,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit trigger_error($message); } + // Remove Rule if (isset($_POST['delete_rule']) && !isset($_POST['cancel'])) { $delete_id = array_map('intval', array_keys($_POST['delete_rule'])); @@ -157,7 +298,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $s_hidden_fields = '<input type="hidden" name="delete_rule[' . $delete_id . ']" value="1" />'; - // Do we need to confirm ? + // Do we need to confirm? if (confirm_box(true)) { $sql = 'DELETE FROM ' . PRIVMSGS_RULES_TABLE . ' @@ -176,7 +317,6 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { confirm_box(false, 'DELETE_RULE', $s_hidden_fields); } - } $folder = array(); @@ -216,7 +356,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit if ($user->data['user_full_folder'] == FULL_FOLDER_NONE) { // -3 here to let the correct folder id be selected - $to_folder_id = $config['full_folder_action']-3; + $to_folder_id = $config['full_folder_action'] - 3; } else { @@ -245,6 +385,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit case 1: $s_delete_checked = ' checked="checked"'; break; + case 2: $s_hold_checked = ' checked="checked"'; break; diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 9e186f4ca4..059760c500 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -129,6 +129,7 @@ function view_folder($id, $mode, $folder_id, $folder, $type) // Generate all URIs ... $message_author = "<a href=\"{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['author_id'] . '">' . $row['username'] . '</a>'; $view_message_url = "$url&f=$folder_id&p=$message_id"; + $remove_message_url = "$url&mode=compose&action=delete&p=$message_id"; $row_indicator = ''; foreach ($color_rows as $var) @@ -159,8 +160,10 @@ function view_folder($id, $mode, $folder_id, $folder, $type) 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment'] && $config['allow_pm_attach'] && $config['auth_download_pm']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['message_attachment'])) : '', 'S_PM_REPORTED' => (!empty($row['message_reported']) && $auth->acl_get('m_')) ? true : false, + 'S_PM_DELETED' => ($row['deleted']) ? true : false, - 'U_VIEW_PM' => $view_message_url, + 'U_VIEW_PM' => ($row['deleted']) ? '' : $view_message_url, + 'U_REMOVE_PM' => ($row['deleted']) ? $remove_message_url : '', '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}&mode=reports&pm=$message_id") // 'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&mode=mod_queue&t=$topic_id") @@ -182,7 +185,7 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder') { global $user, $db, $template, $config, $auth, $_POST; - $start = request_var('start', 0); + $start = request_var('start', 0); $sort_days = (isset($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0); $sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't'); @@ -191,7 +194,7 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder') // PM ordering options $limit_days = array(0 => $user->lang['ALL_MESSAGES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username', 't' => 'p.message_time', 's' => 'p.subject'); + $sort_by_sql = array('a' => 'u.username', 't' => 'p.message_time', 's' => 'p.message_subject'); $sort_key = (!in_array($sort_key, array('a', 't', 's'))) ? 't' : $sort_key; @@ -319,7 +322,7 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder') $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); - while($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { $rowset[$row['msg_id']] = $row; $pm_list[] = $row['msg_id']; diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 2e7115e842..b8edbcc0db 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -21,6 +21,12 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $folder_id = (int) $folder_id; $author_id = (int) $message_row['author_id']; + // Not able to view message, it was deleted by the sender + if ($message_row['deleted']) + { + trigger_error('NO_AUTH_READ_REMOVED_MESSAGE'); + } + // Grab icons $icons = array(); obtain_icons($icons); @@ -157,7 +163,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'AUTHOR_FROM' => (!empty($user_info['user_from'])) ? $user_info['user_from'] : '', 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($user_info['online']) ? $user->img('btn_online', $user->lang['ONLINE']) : $user->img('btn_offline', $user->lang['OFFLINE'])), - 'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_PM']), + 'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_MESSAGE']), 'INFO_IMG' => $user->img('btn_info', $user->lang['VIEW_PM_INFO']), 'REPORT_IMG' => $user->img('btn_report', $user->lang['REPORT_PM']), 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['MESSAGE_REPORTED_MESSAGE']), |