diff options
-rw-r--r-- | phpBB/includes/functions.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 60 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 15 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm.php | 16 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_options.php | 8 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewfolder.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/ucp.php | 3 | ||||
-rw-r--r-- | phpBB/styles/subSilver/template/ucp_pm_popup.html | 11 |
9 files changed, 68 insertions, 50 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 267f9929fd..4c749eb354 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1898,6 +1898,7 @@ function page_header($page_title = '') 'U_PRIVATEMSGS' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=" . (($user->data['user_new_privmsg'] || $l_privmsgs_text_unread) ? 'unread' : 'view_messages'), 'U_RETURN_INBOX' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=inbox", + 'U_JS_RETURN_INBOX' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=inbox", 'U_POPUP_PM' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=popup", 'U_JS_POPUP_PM' => "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&mode=popup", 'U_MEMBERLIST' => "{$phpbb_root_path}memberlist.$phpEx$SID", diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index d125fe315a..2dad1e6477 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -187,10 +187,8 @@ function clean_sentbox($num_sentbox_messages) { global $db, $user, $config; - $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_message_limit']; - // Check Message Limit - - if ($message_limit && $num_sentbox_messages > $message_limit) + if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit']) { // Delete old messages $sql = 'SELECT t.msg_id @@ -199,7 +197,7 @@ function clean_sentbox($num_sentbox_messages) AND t.user_id = ' . $user->data['user_id'] . ' AND t.folder_id = ' . PRIVMSGS_SENTBOX . ' ORDER BY p.message_time ASC'; - $result = $db->sql_query_limit($sql, ($num_sentbox_messages - $message_limit)); + $result = $db->sql_query_limit($sql, ($num_sentbox_messages - $user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -441,7 +439,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) { // Determine Full Folder Action - we need the move to folder id later eventually $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; - + $sql = 'SELECT folder_id, pm_count FROM ' . PRIVMSGS_FOLDER_TABLE . ' WHERE folder_id IN (' . implode(', ', array_keys($move_into_folder)) . (($full_folder_action >= 0) ? ', ' . $full_folder_action : '') . ") @@ -471,18 +469,17 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Here we have ideally only one folder to move into foreach ($move_into_folder as $folder_id => $msg_ary) { - $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_message_limit']; $dest_folder = $folder_id; $full_folder_action = FULL_FOLDER_NONE; // Check Message Limit - we calculate with the complete array, most of the time it is one message // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) - if ($message_limit && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > $message_limit) + if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > $user->data['message_limit']) { $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; // If destination folder itself is full... - if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > $message_limit) + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > $user->data['message_limit']) { $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); } @@ -501,7 +498,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) AND t.user_id = $user_id AND t.folder_id = $dest_folder ORDER BY p.message_time ASC"; - $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - $message_limit)); + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - $user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -513,7 +510,18 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } } - if ($full_folder_action < 0) + // + if ($full_folder_action == FULL_FOLDER_HOLD) + { + $num_not_moved += sizeof($msg_ary); + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_HOLD_BOX . ' + WHERE folder_id = ' . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND msg_id IN (" . implode(', ', $msg_ary) . ')'; + $db->sql_query($sql); + } + else { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " SET folder_id = $dest_folder, new = 0 @@ -536,16 +544,6 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $num_new += $db->sql_affectedrows(); } } - else - { - $num_not_moved += sizeof($msg_ary); - $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' - SET folder_id = ' . PRIVMSGS_HOLD_BOX . ' - WHERE folder_id = ' . PRIVMSGS_NO_BOX . " - AND user_id = $user_id - AND msg_id IN (" . implode(', ', $msg_ary) . ')'; - $db->sql_query($sql); - } } if (sizeof($action_ary)) @@ -742,8 +740,12 @@ function handle_mark_actions($user_id, $mark_action) if (confirm_box(true)) { delete_pm($user_id, $msg_ids, $cur_folder_id); - // TODO: meta blabla - trigger_error('MESSAGE_DELETED'); + + $success_msg = (sizeof($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; + $redirect = "{$phpbb_root_path}ucp.$phpEx$SID&i=pm&folder=$cur_folder_id"; + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $redirect . '">', '</a>')); } else { @@ -1068,14 +1070,12 @@ function get_folder_status($folder_id, $folder) } $return = array(); - $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_message_limit']; - $return = array( 'folder_name' => $folder['folder_name'], 'cur' => $folder['num_messages'], - 'remaining' => $message_limit - $folder['num_messages'], - 'max' => $message_limit, - 'percent' => ($message_limit > 0) ? round(($folder['num_messages'] / $message_limit) * 100) : 100 + 'remaining' => $user->data['message_limit'] - $folder['num_messages'], + 'max' => $user->data['message_limit'], + 'percent' => ($user->data['message_limit'] > 0) ? round(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100 ); $return['message'] = sprintf($user->lang['FOLDER_STATUS_MSG'], $return['percent'], $return['cur'], $return['max']); @@ -1182,7 +1182,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr 'message_text' => $data['message'], 'message_checksum' => $data['message_md5'], 'message_encoding' => $user->lang['ENCODING'], - 'message_attachment'=> (isset($data['filename_data']) && sizeof($data['filename_data'])) ? 1 : 0, + 'message_attachment'=> (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'to_address' => implode(':', $to), @@ -1203,7 +1203,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr 'message_text' => $data['message'], 'message_checksum' => $data['message_md5'], 'message_encoding' => $user->lang['ENCODING'], - 'message_attachment'=> (isset($data['filename_data']) && sizeof($data['filename_data'])) ? 1 : 0, + 'message_attachment'=> (isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data'])) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'] ); @@ -1250,7 +1250,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr } $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1 + SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1, user_last_privmsg = ' . time() . ' WHERE user_id IN (' . implode(', ', array_keys($recipients)) . ')'; $db->sql_query($sql); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 413814f958..c2146d2e5a 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1077,7 +1077,7 @@ function group_create($group_id, $type, $name, $desc) 'group_type' => (int) $type, ); - $attribute_ary = array('group_colour' => 'string', 'group_rank' => 'int', 'group_avatar' => 'string', 'group_avatar_type' => 'int', 'group_avatar_width' => 'int', 'group_avatar_height' => 'int', 'group_receive_pm' => 'int', 'group_message_limit' => 'int'); + $attribute_ary = array('group_colour' => 'string', 'group_rank' => 'int', 'group_avatar' => 'string', 'group_avatar_type' => 'int', 'group_avatar_width' => 'int', 'group_avatar_height' => 'int'); $i = 4; foreach ($attribute_ary as $attribute => $type) @@ -1091,6 +1091,19 @@ function group_create($group_id, $type, $name, $desc) $i++; } + $group_only_ary = array('group_receive_pm' => 'int', 'group_message_limit' => 'int'); + + foreach ($group_only_ary as $attribute => $type) + { + if (func_num_args() > $i && ($value = func_get_arg($i)) !== false) + { + settype($value, $type); + + $sql_ary[$attribute] = $value; + } + $i++; + } + $sql = ($group_id) ? 'UPDATE ' . GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE group_id = $group_id" : 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php index ee67746592..9ce0794eca 100644 --- a/phpBB/includes/ucp/ucp_pm.php +++ b/phpBB/includes/ucp/ucp_pm.php @@ -132,9 +132,11 @@ class ucp_pm extends module FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . $user->data['group_id']; $result = $db->sql_query($sql); - $user->data['group_message_limit'] = (int) $db->sql_fetchfield('group_message_limit', 0, $result); + $message_limit = (int) $db->sql_fetchfield('group_message_limit', 0, $result); $db->sql_freeresult($result); + $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; + get_folder($user->data['user_id'], $folder); include($phpbb_root_path . 'includes/ucp/ucp_pm_options.'.$phpEx); @@ -156,9 +158,11 @@ class ucp_pm extends module FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . $user->data['group_id']; $result = $db->sql_query($sql); - $user->data['group_message_limit'] = (int) $db->sql_fetchfield('group_message_limit', 0, $result); + $message_limit = (int) $db->sql_fetchfield('group_message_limit', 0, $result); $db->sql_freeresult($result); - + + $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; + if ($folder_specified) { $folder_id = $folder_specified; @@ -188,13 +192,11 @@ class ucp_pm extends module // Move PM if (isset($_REQUEST['move_pm'])) { - $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_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)) + if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) { // Return to folder view if single message moved if ($action == 'view_message') @@ -219,7 +221,7 @@ class ucp_pm extends module place_pm_into_folder($global_privmsgs_rules, request_var('release', 0)); $num_not_moved = $user->data['user_new_privmsg']; } - + if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX && $mode != 'unread') { $folder_id = PRIVMSGS_INBOX; diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index 76ba3553f9..253547cd47 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -185,8 +185,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { // 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); + $num_moved = move_pm($user->data['user_id'], $user->data['message_limit'], $msg_ids, $move_to, $remove_folder_id); // Something went wrong, only partially moved? if ($num_moved != $folder_row['pm_count']) @@ -320,7 +319,6 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } $folder = array(); - $message_limit = (!$user->data['group_message_limit']) ? $config['pm_max_msgs'] : $user->data['group_message_limit']; $sql = 'SELECT COUNT(msg_id) as num_messages FROM ' . PRIVMSGS_TO_TABLE . ' @@ -332,7 +330,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $folder[PRIVMSGS_INBOX] = array( 'folder_name' => $user->lang['PM_INBOX'], - 'message_status'=> sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $num_messages, $message_limit) + 'message_status'=> sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $num_messages, $user->data['message_limit']) ); $sql = 'SELECT folder_id, folder_name, pm_count @@ -346,7 +344,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $num_user_folder++; $folder[$row['folder_id']] = array( 'folder_name' => $row['folder_name'], - 'message_status'=> sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $row['pm_count'], $message_limit) + 'message_status'=> sprintf($user->lang['FOLDER_MESSAGE_STATUS'], $row['pm_count'], $user->data['message_limit']) ); } $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 78607e81e8..e83ae095ea 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -191,7 +191,7 @@ function get_pm_from($folder_id, $folder, $user_id, $url, $type = 'folder') $sort_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0)); $sort_key = request_var('sk', ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't')); - $sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a')); + $sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'd')); // 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']); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 6dacb79b3b..632a148321 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -162,7 +162,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'AUTHOR_POSTS' => (!empty($user_info['user_posts'])) ? $user_info['user_posts'] : '', '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'])), + 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : ((isset($user_info['online']) && $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_MESSAGE']), 'INFO_IMG' => $user->img('btn_info', $user->lang['VIEW_PM_INFO']), 'REPORT_IMG' => $user->img('btn_report', $user->lang['REPORT_PM']), diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 0db9385d23..b134e8f0dc 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -190,11 +190,13 @@ $lang += array( 'MARKED_MESSAGE' => 'Marked Message', 'MAX_FOLDER_REACHED' => 'Maximum number of allowed user defined folder reached', 'MESSAGE_COLOURS' => 'Message Colours', + 'MESSAGE_DELETED' => 'Message successfully deleted', 'MESSAGE_HISTORY' => 'Message History', 'MESSAGE_REMOVED_FROM_OUTBOX' => 'This message has been removed by it\'s author before it was delivered', 'MESSAGE_REPORTED' => 'Click to view reports', 'MESSAGE_REPORTED_MESSAGE' => 'Reported Message', 'MESSAGE_STORED' => 'The message has been send successfully', + 'MESSAGES_DELETED' => 'Messages successfully deleted', 'MOVE_DELETED_MESSAGES_TO' => 'Move messages from removed folder to', 'MOVE_DOWN' => 'Move down', 'MOVE_PM_ERROR' => 'An error occurred while moving the messages to the new folder, only %1d from %2d messages were moved.', @@ -341,6 +343,7 @@ $lang += array( 'UCP_PM_COMPOSE' => 'Compose Message', 'UCP_PM_DRAFTS' => 'PM Drafts', 'UCP_PM_OPTIONS' => 'Options', + 'UCP_PM_POPUP' => 'Private Messages', 'UCP_PM_UNREAD' => 'Unread Messages', 'UCP_PM_VIEW_MESSAGES' => 'View Messages', diff --git a/phpBB/styles/subSilver/template/ucp_pm_popup.html b/phpBB/styles/subSilver/template/ucp_pm_popup.html index ba7421dd39..dd496cafb3 100644 --- a/phpBB/styles/subSilver/template/ucp_pm_popup.html +++ b/phpBB/styles/subSilver/template/ucp_pm_popup.html @@ -4,7 +4,7 @@ <!-- function jump_to_inbox() { - opener.document.location.href = "{U_RETURN_INBOX}"; + opener.document.location.href = "{U_JS_RETURN_INBOX}"; window.close(); } //--> @@ -13,15 +13,16 @@ function jump_to_inbox() <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td> - <table width="100%" border="0" cellspacing="1" cellpadding="4"> - <tr> - <td valign="top" class="row1" align="center"> - <br /> + <table width="100%" border="0" cellspacing="1" cellpadding="4" class="tablebg"> + <tr class="row1"> + <td valign="top" align="center"> + <br /><span class="gen"> <!-- IF S_NOT_LOGGED_IN --> {L_LOGIN_CHECK_PM} <!-- ELSE --> {MESSAGE}<br /><br />{CLICK_TO_VIEW} <!-- ENDIF --> + </span> <br /><br /><span class="genmed"><a href="javascript:window.close();">{L_CLOSE_WINDOW}</a></span><br /><br /></td> </tr> </table> |