diff options
Diffstat (limited to 'phpBB/includes/ucp')
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 41 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 20 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_zebra.php | 23 |
3 files changed, 71 insertions, 13 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index e49edc0f7f..851c06c2b6 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -182,7 +182,7 @@ function compose_pm($id, $mode, $action) $message_attachment = (isset($post['message_attachement'])) ? $post['message_attachement'] : 0; $message_text = $post['message_text']; $message_subject = $post['message_subject']; - $quote_username = $post['quote_username']; + $quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : ''; $message_time = $post['message_time']; $icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0; @@ -821,7 +821,7 @@ function compose_pm($id, $mode, $action) */ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_to, $add_bcc) { - global $_REQUEST; + global $auth; // Delete User [TO/BCC] if ($remove_u) @@ -853,6 +853,9 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_ } } + // User ID's to add... + $user_id_ary = array(); + // Build usernames to add $usernames = (isset($_REQUEST['username'])) ? array(request_var('username', '')) : array(); $username_list = request_var('username_list', ''); @@ -866,8 +869,31 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_ { $user_id_ary = array(); user_get_id_name($user_id_ary, $usernames); + } + + // Add Friends if specified + $friend_list = (is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array(); + $user_id_ary = array_merge($user_id_ary, $friend_list); - if (sizeof($user_id_ary)) + if (sizeof($user_id_ary)) + { + // We need to check their PM status (do they want to receive PM's?) + // Only check if not a moderator or admin, since they are allowed to override this user setting + if (!$auth->acl_gets('a_', 'm_')) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_id IN (' . implode(', ', $user_id_ary) . ') + AND user_allow_pm = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $address_list['u'][$row['user_id']] = $type; + } + $db->sql_freeresult($result); + } + else { foreach ($user_id_ary as $user_id) { @@ -875,16 +901,7 @@ function handle_message_list_actions(&$address_list, $remove_u, $remove_g, $add_ } } } - - // Add Friends if specified - $friend_list = (is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array(); - - foreach ($friend_list as $user_id) - { - $address_list['u'][$user_id] = $type; - } } - } /** diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 342bdd06cf..55104a55c8 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -86,9 +86,27 @@ class ucp_profile 'user_email' => ($auth->acl_get('u_chgemail')) ? $email : $user->data['user_email'], 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? crc32(strtolower($email)) . strlen($email) : $user->data['user_email_hash'], 'user_password' => ($auth->acl_get('u_chgpasswd') && $new_password) ? md5($new_password) : $user->data['user_password'], - 'user_passchg' => time(), + 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $new_password) ? time() : 0, ); + if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $username != $user->data['username']) + { + add_log('admin', 'LOG_USER_UPDATE_NAME', $user->data['username'], $username); + add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $username); + } + + if ($auth->acl_get('u_chgpasswd') && $new_password && md5($new_password) != $user->data['user_password']) + { + add_log('admin', 'LOG_USER_NEW_PASSWORD', $username); + add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $username); + } + + if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email']) + { + add_log('admin', 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email); + add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email); + } + if ($config['email_enable'] && $email != $user->data['user_email'] && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) { include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index 76311ea9e6..99abeb7133 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -108,6 +108,29 @@ class ucp_zebra unset($perms); } + // Do not let add users to friends if the user is within the foes list of the to-be-added users + if ($mode == 'friends' && sizeof($user_id_ary)) + { + $sql = 'SELECT user_id + FROM ' . ZEBRA_TABLE . ' + WHERE user_id IN (' . implode(', ', $user_id_ary) . ') + AND zebra_id = ' . $user->data['user_id'] . ' + AND foe = 1'; + $result = $db->sql_query($sql); + + $remove_user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $remove_user_ids[] = $row['user_id']; + } + + if (sizeof($remove_user_ids)) + { + $user_id_ary = array_diff($user_id_ary, $remove_user_ids); + } + unset($remove_user_ids); + } + if (sizeof($user_id_ary)) { $sql_mode = ($mode == 'friends') ? 'friend' : 'foe'; |