From 0c57363fbc8769ef3e0774a9a03878553540bf9a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Jun 2009 10:05:44 +0000 Subject: Fix bug #46065 - Correctly show private message history Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9561 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 05653f7e3b..96400ad70d 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1827,7 +1827,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') ); - unset($rowset[$id]); + unset($rowset[$i]); $prev_id = $id; } -- cgit v1.2.1 From 9c795870f9c8d5569365d9df9cc7207988dcb609 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 24 Jun 2009 21:13:53 +0000 Subject: Fix bug #37285 - [Change] Add quote-button for own pm's in pm-history Authorised by: ToonArmy git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9671 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 96400ad70d..271cce9f42 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1781,7 +1781,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $decoded_message = false; - if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) + if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) { $decoded_message = $message; decode_message($decoded_message, $row['bbcode_uid']); @@ -1824,7 +1824,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode 'MSG_ID' => $row['msg_id'], 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], - 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id']) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') ); unset($rowset[$i]); -- cgit v1.2.1 From d39d8481cfd6a9cd1e418aaff14833a149770e71 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Jun 2009 10:07:59 +0000 Subject: Change bug #39505 - Pm history only shows pms of the receipts you currently reply to Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9677 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 271cce9f42..8851b53680 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1691,12 +1691,29 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode { global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; + // Select all receipts and the author from the pm we currently view, to only display their pm-history + $sql = 'SELECT author_id, user_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + + $recipients = array(); + while ($row = $db->sql_fetchrow($result)) + { + $recipients[] = $row['user_id']; + $recipients[] = $row['author_id']; + } + $db->sql_freeresult($result); + $recipients = array_unique($recipients); + // Get History Messages (could be newer) $sql = 'SELECT t.*, p.*, u.* FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u WHERE t.msg_id = p.msg_id AND p.author_id = u.user_id - AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ") + AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND ' . $db->sql_in_set('t.author_id', $recipients) . " AND t.user_id = $user_id"; if (!$message_row['root_level']) -- cgit v1.2.1 From 6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 21 Jul 2009 20:59:11 +0000 Subject: Users can report PMs to moderators which are then visible in a new MCP module git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9814 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 92 ++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 8851b53680..883d8ff13f 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1405,7 +1405,8 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'to_address' => implode(':', $to), - 'bcc_address' => implode(':', $bcc) + 'bcc_address' => implode(':', $bcc), + 'message_reported' => 0, ); break; @@ -1880,4 +1881,93 @@ function set_user_message_limit() $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; } +/** +* Generates an array of coloured recipient names from a list of PMs - (groups & users) +* +* @param array $pm_by_id An array of rows from PRIVMSGS_TABLE, keys are the msg_ids. +* +* @return array 2D Array: array(msg_id => array('username or group string', ...), ...) +* Usernames are generated with {@link get_username_string get_username_string} +* Groups are coloured and have a link to the membership page +*/ +function get_recipient_strings($pm_by_id) +{ + global $user, $db; + + $address_list = $recipient_list = $address = array(); + + $_types = array('u', 'g'); + + foreach ($pm_by_id as $message_id => $row) + { + $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + + foreach ($_types as $ug_type) + { + if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + { + foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) + { + $recipient_list[$ug_type][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); + } + } + } + } + + foreach ($_types as $ug_type) + { + if (!empty($recipient_list[$ug_type])) + { + if ($ug_type == 'u') + { + $sql = 'SELECT user_id as id, username as name, user_colour as colour + FROM ' . USERS_TABLE . ' + WHERE '; + } + else + { + $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE '; + } + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($ug_type == 'g') + { + $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; + } + + $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); + } + $db->sql_freeresult($result); + } + } + + foreach ($address as $message_id => $adr_ary) + { + foreach ($adr_ary as $type => $id_ary) + { + foreach ($id_ary as $ug_id => $_id) + { + if ($type == 'u') + { + $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']); + } + else + { + $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; + $link = ''; + $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '' : ''); + } + } + } + } + + return $address_list; +} + ?> \ No newline at end of file -- cgit v1.2.1 From 78b1c4caaa17cc8760b685ad41c19f15f9d89b68 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 27 Jul 2009 15:05:59 +0000 Subject: Do not send private message back to sender if sender is in the same group the private message was sent to. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9876 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 883d8ff13f..b201329b20 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1356,6 +1356,12 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) while ($row = $db->sql_fetchrow($result)) { + // Additionally, do not include the sender if he is in the group he wants to send to. ;) + if ($row['user_id'] === $user->data['user_id']) + { + continue; + } + $field = ($data['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; $recipients[$row['user_id']] = $field; } @@ -1901,7 +1907,7 @@ function get_recipient_strings($pm_by_id) foreach ($pm_by_id as $message_id => $row) { $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); - + foreach ($_types as $ug_type) { if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) -- cgit v1.2.1 From 2958890439f29b9cf45997c52c8cfa57e0f16bc8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 12:28:50 +0000 Subject: Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9905 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index b201329b20..955b310335 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1552,7 +1552,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) else { // insert attachment into db - if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) { continue; } -- cgit v1.2.1 From 0e98a3aee813b4f83b1021d8204b38ba7fd319f0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 4 Aug 2009 13:08:26 +0000 Subject: Even if the recipient of a PM is now inactive (for whatever reason) still display the information in PM recipient lists and do not hide it git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9918 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 955b310335..f6dd29cd99 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1145,8 +1145,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) { $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $u) . ' - AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + WHERE ' . $db->sql_in_set('user_id', $u); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) -- cgit v1.2.1 From 57ed7fd0886f66b9cb465f7acd60be7ee1024fed Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 3 Sep 2009 13:44:16 +0000 Subject: Bug #39505, r9677 - Add integer casting and allow array to be empty. Unset array when no longer needed. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10092 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_privmsgs.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index f6dd29cd99..848218ca83 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1707,8 +1707,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode $recipients = array(); while ($row = $db->sql_fetchrow($result)) { - $recipients[] = $row['user_id']; - $recipients[] = $row['author_id']; + $recipients[] = (int) $row['user_id']; + $recipients[] = (int) $row['author_id']; } $db->sql_freeresult($result); $recipients = array_unique($recipients); @@ -1719,9 +1719,12 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode WHERE t.msg_id = p.msg_id AND p.author_id = u.user_id AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') - AND ' . $db->sql_in_set('t.author_id', $recipients) . " + AND ' . $db->sql_in_set('t.author_id', $recipients, false, true) . " AND t.user_id = $user_id"; + // We no longer need those. + unset($recipients); + if (!$message_row['root_level']) { $sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))"; -- cgit v1.2.1