diff options
author | Henry Sudhof <kellanved@phpbb.com> | 2009-12-13 14:03:45 +0000 |
---|---|---|
committer | Henry Sudhof <kellanved@phpbb.com> | 2009-12-13 14:03:45 +0000 |
commit | d779e1267d9b3a202f6f0abd85cdbbda46c9058c (patch) | |
tree | 9ab10f2a5d13840721e17d6b39703ddd41960b8d /phpBB | |
parent | b6f9a1a6e881241fa16b24a3a7bd30017fb52d0e (diff) | |
download | forums-d779e1267d9b3a202f6f0abd85cdbbda46c9058c.tar forums-d779e1267d9b3a202f6f0abd85cdbbda46c9058c.tar.gz forums-d779e1267d9b3a202f6f0abd85cdbbda46c9058c.tar.bz2 forums-d779e1267d9b3a202f6f0abd85cdbbda46c9058c.tar.xz forums-d779e1267d9b3a202f6f0abd85cdbbda46c9058c.zip |
#50985 - fix XML export of private messages sent to deleted users
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10329 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewfolder.php | 30 | ||||
-rw-r--r-- | phpBB/language/en/ucp.php | 1 |
3 files changed, 25 insertions, 7 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 071e98a641..de6a6fcadd 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -116,6 +116,7 @@ <li>[Fix] Correctly check for empty strings in custom profile fields. (Bug #55335)</li> <li>[Fix] Use correct options to parse BBCodes in signatures when previewing PMs.</li> <li>[Fix] Correct rendering of prosilver quick reply under IE6. (Bug #54115 - Patch by Raimon)</li> + <li>[Fix] Handle export of private messages where all recipients were deleted. (Bug #50985)</li> <li>[Change] Log activation through inactive users ACP. (Bug #30145)</li> <li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li> <li>[Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li> diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 06852db591..665dd2c83f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -200,13 +200,15 @@ function view_folder($id, $mode, $folder_id, $folder) else { // Build Recipient List if in outbox/sentbox - $address = $data = array(); + + $address_temp = $address = $data = array(); if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { foreach ($folder_info['rowset'] as $message_id => $row) { - $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + $address_temp[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + $address[$message_id] = array(); } } @@ -230,8 +232,12 @@ function view_folder($id, $mode, $folder_id, $folder) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + if (isset($address_temp[$message_id][$ug_type]) && sizeof($address_temp[$message_id][$ug_type])) { + if (!isset($address[$message_id][$ug_type])) + { + $address[$message_id][$ug_type] = array(); + } if ($ug_type == 'u') { $sql = 'SELECT user_id as id, username as name @@ -244,21 +250,31 @@ function view_folder($id, $mode, $folder_id, $folder) FROM ' . GROUPS_TABLE . ' WHERE '; } - $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address[$message_id][$ug_type]))); + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address_temp[$message_id][$ug_type]))); $result = $db->sql_query($sql); while ($info_row = $db->sql_fetchrow($result)) { - $address[$message_id][$ug_type][$address[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; - unset($address[$message_id][$ug_type][$info_row['id']]); + $address[$message_id][$ug_type][$address_temp[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; + unset($address_temp[$message_id][$ug_type][$info_row['id']]); } $db->sql_freeresult($result); } } - decode_message($message_row['message_text'], $message_row['bbcode_uid']); + // There is the chance that all recipients of the message got deleted. To avoid creating + // exports without recipients, we add a bogus "undisclosed recipient". + if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) && + !(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u']))) + { + $address[$message_id]['u'] = array(); + $address[$message_id]['u']['to'] = array(); + $address[$message_id]['u']['to'][] = $user->lang['UNDISCLOSED_RECIPIENT']; + } + decode_message($message_row['message_text'], $message_row['bbcode_uid']); + $data[] = array( 'subject' => censor_text($row['message_subject']), 'sender' => $row['username'], diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 4b79a4b6ca..02b8a282d9 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -460,6 +460,7 @@ $lang = array_merge($lang, array( 'UCP_ZEBRA' => 'Friends & Foes', 'UCP_ZEBRA_FOES' => 'Manage foes', 'UCP_ZEBRA_FRIENDS' => 'Manage friends', + 'UNDISCLOSED_RECIPIENT' => 'Undisclosed Recipient', 'UNKNOWN_FOLDER' => 'Unknown folder', 'UNWATCH_MARKED' => 'Unwatch marked', 'UPLOAD_AVATAR_FILE' => 'Upload from your machine', |