Changeset 702 for trunk/forum/includes/functions_privmsgs.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/functions_privmsgs.php
r400 r702 3 3 * 4 4 * @package phpBB3 5 * @version $Id : functions_privmsgs.php 8993 2008-10-10 17:38:17Z toonarmy$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 895 895 case 'delete_marked': 896 896 897 global $auth; 898 899 if (!$auth->acl_get('u_pm_delete')) 900 { 901 trigger_error('NO_AUTH_DELETE_MESSAGE'); 902 } 903 897 904 if (confirm_box(true)) 898 905 { … … 1146 1153 $sql = 'SELECT user_id, username, user_colour 1147 1154 FROM ' . USERS_TABLE . ' 1148 WHERE ' . $db->sql_in_set('user_id', $u) . ' 1149 AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; 1155 WHERE ' . $db->sql_in_set('user_id', $u); 1150 1156 $result = $db->sql_query($sql); 1151 1157 … … 1351 1357 AND ug.user_pending = 0 1352 1358 AND u.user_id = ug.user_id 1353 AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . 1359 AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . 1354 1360 $sql_allow_pm; 1355 1361 $result = $db->sql_query($sql); … … 1357 1363 while ($row = $db->sql_fetchrow($result)) 1358 1364 { 1365 // Additionally, do not include the sender if he is in the group he wants to send to. ;) 1366 if ($row['user_id'] === $user->data['user_id']) 1367 { 1368 continue; 1369 } 1370 1359 1371 $field = ($data['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; 1360 1372 $recipients[$row['user_id']] = $field; … … 1406 1418 'bbcode_uid' => $data['bbcode_uid'], 1407 1419 'to_address' => implode(':', $to), 1408 'bcc_address' => implode(':', $bcc) 1420 'bcc_address' => implode(':', $bcc), 1421 'message_reported' => 0, 1409 1422 ); 1410 1423 break; … … 1546 1559 { 1547 1560 // insert attachment into db 1548 if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . basename($orphan_rows[$attach_row['attach_id']]['physical_filename'])))1561 if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) 1549 1562 { 1550 1563 continue; … … 1572 1585 if ($space_taken && $files_added) 1573 1586 { 1574 set_config ('upload_dir_size', $config['upload_dir_size'] +$space_taken, true);1575 set_config ('num_files', $config['num_files'] +$files_added, true);1587 set_config_count('upload_dir_size', $space_taken, true); 1588 set_config_count('num_files', $files_added, true); 1576 1589 } 1577 1590 } … … 1692 1705 global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode; 1693 1706 1707 // Select all receipts and the author from the pm we currently view, to only display their pm-history 1708 $sql = 'SELECT author_id, user_id 1709 FROM ' . PRIVMSGS_TO_TABLE . " 1710 WHERE msg_id = $msg_id 1711 AND folder_id <> " . PRIVMSGS_HOLD_BOX; 1712 $result = $db->sql_query($sql); 1713 1714 $recipients = array(); 1715 while ($row = $db->sql_fetchrow($result)) 1716 { 1717 $recipients[] = (int) $row['user_id']; 1718 $recipients[] = (int) $row['author_id']; 1719 } 1720 $db->sql_freeresult($result); 1721 $recipients = array_unique($recipients); 1722 1694 1723 // Get History Messages (could be newer) 1695 1724 $sql = 'SELECT t.*, p.*, u.* … … 1697 1726 WHERE t.msg_id = p.msg_id 1698 1727 AND p.author_id = u.user_id 1699 AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ") 1728 AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') 1729 AND ' . $db->sql_in_set('t.author_id', $recipients, false, true) . " 1700 1730 AND t.user_id = $user_id"; 1731 1732 // We no longer need those. 1733 unset($recipients); 1701 1734 1702 1735 if (!$message_row['root_level']) … … 1764 1797 $next_history_pm = $previous_history_pm = $prev_id = 0; 1765 1798 1766 foreach ($rowset as $id => $row) 1767 { 1799 // Re-order rowset to be able to get the next/prev message rows... 1800 $rowset = array_values($rowset); 1801 1802 for ($i = 0, $size = sizeof($rowset); $i < $size; $i++) 1803 { 1804 $row = &$rowset[$i]; 1805 $id = (int) $row['msg_id']; 1806 1768 1807 $author_id = $row['author_id']; 1769 1808 $folder_id = (int) $row['folder_id']; … … 1776 1815 $decoded_message = false; 1777 1816 1778 if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id'])1817 if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) 1779 1818 { 1780 1819 $decoded_message = $message; … … 1796 1835 if ($id == $msg_id) 1797 1836 { 1798 $next_history_pm = next($rowset); 1799 $next_history_pm = (sizeof($next_history_pm)) ? (int) $next_history_pm['msg_id'] : 0; 1837 $next_history_pm = (isset($rowset[$i + 1])) ? (int) $rowset[$i + 1]['msg_id'] : 0; 1800 1838 $previous_history_pm = $prev_id; 1801 1839 } … … 1820 1858 'MSG_ID' => $row['msg_id'], 1821 1859 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], 1822 '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'] : '',1860 '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'] : '', 1823 1861 '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'] : '') 1824 1862 ); 1825 unset($rowset[$i d]);1863 unset($rowset[$i]); 1826 1864 $prev_id = $id; 1827 1865 } … … 1859 1897 } 1860 1898 1899 /** 1900 * Generates an array of coloured recipient names from a list of PMs - (groups & users) 1901 * 1902 * @param array $pm_by_id An array of rows from PRIVMSGS_TABLE, keys are the msg_ids. 1903 * 1904 * @return array 2D Array: array(msg_id => array('username or group string', ...), ...) 1905 * Usernames are generated with {@link get_username_string get_username_string} 1906 * Groups are coloured and have a link to the membership page 1907 */ 1908 function get_recipient_strings($pm_by_id) 1909 { 1910 global $db, $phpbb_root_path, $phpEx, $user; 1911 1912 $address_list = $recipient_list = $address = array(); 1913 1914 $_types = array('u', 'g'); 1915 1916 foreach ($pm_by_id as $message_id => $row) 1917 { 1918 $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); 1919 1920 foreach ($_types as $ug_type) 1921 { 1922 if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) 1923 { 1924 foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) 1925 { 1926 $recipient_list[$ug_type][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); 1927 } 1928 } 1929 } 1930 } 1931 1932 foreach ($_types as $ug_type) 1933 { 1934 if (!empty($recipient_list[$ug_type])) 1935 { 1936 if ($ug_type == 'u') 1937 { 1938 $sql = 'SELECT user_id as id, username as name, user_colour as colour 1939 FROM ' . USERS_TABLE . ' 1940 WHERE '; 1941 } 1942 else 1943 { 1944 $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type 1945 FROM ' . GROUPS_TABLE . ' 1946 WHERE '; 1947 } 1948 $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); 1949 1950 $result = $db->sql_query($sql); 1951 1952 while ($row = $db->sql_fetchrow($result)) 1953 { 1954 if ($ug_type == 'g') 1955 { 1956 $row['name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['name']] : $row['name']; 1957 } 1958 1959 $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); 1960 } 1961 $db->sql_freeresult($result); 1962 } 1963 } 1964 1965 foreach ($address as $message_id => $adr_ary) 1966 { 1967 foreach ($adr_ary as $type => $id_ary) 1968 { 1969 foreach ($id_ary as $ug_id => $_id) 1970 { 1971 if ($type == 'u') 1972 { 1973 $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']); 1974 } 1975 else 1976 { 1977 $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; 1978 $link = '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $ug_id) . '"' . $user_colour . '>'; 1979 $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '</a>' : ''); 1980 } 1981 } 1982 } 1983 } 1984 1985 return $address_list; 1986 } 1987 1861 1988 ?>
Note:
See TracChangeset
for help on using the changeset viewer.