diff options
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 16 | ||||
-rw-r--r-- | phpBB/memberlist.php | 79 | ||||
-rw-r--r-- | phpBB/phpbb/user.php | 2 |
3 files changed, 85 insertions, 12 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index b1b039add1..621a945479 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -1195,7 +1195,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $controller_helper = $phpbb_container->get('controller.helper'); // Start assigning vars for main posting page ... - $template->assign_vars(array( + $template_ary = array( 'L_POST_A' => $page_title, 'L_ICON' => $user->lang['PM_ICON'], 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), @@ -1240,7 +1240,19 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']), 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup'), 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup')), - )); + ); + + /** + * Modify the default template vars + * + * @event core.ucp_pm_compose_template + * @var array template_ary Template variables + * @since 3.2.6-RC1 + */ + $vars = array('template_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_template', compact($vars))); + + $template->assign_vars($template_ary); // Build custom bbcodes array display_custom_bbcodes(); diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index d0dd70af01..da60ba1866 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -489,9 +489,31 @@ switch ($mode) } // Get user... - $sql = 'SELECT * - FROM ' . USERS_TABLE . ' - WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id"); + $sql_array = array( + 'SELECT' => 'u.*', + 'FROM' => array( + USERS_TABLE => 'u' + ), + 'WHERE' => (($username) ? "u.username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "u.user_id = $user_id"), + ); + + /** + * Modify user data SQL before member profile row is created + * + * @event core.memberlist_modify_viewprofile_sql + * @var int user_id The user ID + * @var string username The username + * @var array sql_array Array containing the main query + * @since 3.2.6-RC1 + */ + $vars = array( + 'user_id', + 'username', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_viewprofile_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $member = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -523,12 +545,37 @@ switch ($mode) $sql_uid_ary = ($auth_hidden_groups) ? array($user_id) : array($user_id, (int) $user->data['user_id']); // Do the SQL thang - $sql = 'SELECT g.group_id, g.group_name, g.group_type, ug.user_id - FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug - WHERE ' . $db->sql_in_set('ug.user_id', $sql_uid_ary) . ' - AND g.group_id = ug.group_id - AND ug.user_pending = 0'; - $result = $db->sql_query($sql); + $sql_ary = [ + 'SELECT' => 'g.group_id, g.group_name, g.group_type, ug.user_id', + + 'FROM' => [ + GROUPS_TABLE => 'g', + ], + + 'LEFT_JOIN' => [ + [ + 'FROM' => [USER_GROUP_TABLE => 'ug'], + 'ON' => 'g.group_id = ug.group_id', + ], + ], + + 'WHERE' => $db->sql_in_set('ug.user_id', $sql_uid_ary) . ' + AND ug.user_pending = 0', + ]; + + /** + * Modify the query used to get the group data + * + * @event core.modify_memberlist_viewprofile_group_sql + * @var array sql_ary Array containing the query + * @since 3.2.6-RC1 + */ + $vars = array( + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); // Divide data into profile data and current user data $profile_groups = $user_groups = array(); @@ -567,6 +614,20 @@ switch ($mode) unset($user_groups); asort($group_sort); + /** + * Modify group data before options is created and data is unset + * + * @event core.modify_memberlist_viewprofile_group_data + * @var array group_data Array containing the group data + * @var array group_sort Array containing the sorted group data + * @since 3.2.6-RC1 + */ + $vars = array( + 'group_data', + 'group_sort', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_data', compact($vars))); + $group_options = ''; foreach ($group_sort as $group_id => $null) { diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index ca0e5872e4..7363290e11 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -343,7 +343,7 @@ class user extends \phpbb\session } // Is board disabled and user not an admin or moderator? - if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + if ($config['board_disable'] && !defined('IN_INSTALL') && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) { if ($this->data['is_bot']) { |