2001-05-11 23:16:31 +00:00
< ? php
2007-06-09 11:11:20 +00:00
/**
2005-04-09 12:26:45 +00:00
*
2014-05-27 20:18:06 +02:00
* This file is part of the phpBB Forum Software package .
*
* @ copyright ( c ) phpBB Limited < https :// www . phpbb . com >
* @ license GNU General Public License , version 2 ( GPL - 2.0 )
*
* For full copyright and license information , please see
* the docs / CREDITS . txt file .
2005-04-09 12:26:45 +00:00
*
*/
/**
2006-05-05 17:56:33 +00:00
* @ ignore
2005-04-09 12:26:45 +00:00
*/
2004-09-01 17:26:28 +00:00
define ( 'IN_PHPBB' , true );
2007-07-26 15:51:11 +00:00
$phpbb_root_path = ( defined ( 'PHPBB_ROOT_PATH' )) ? PHPBB_ROOT_PATH : './' ;
2003-09-07 17:58:19 +00:00
$phpEx = substr ( strrchr ( __FILE__ , '.' ), 1 );
2006-06-06 20:53:46 +00:00
include ( $phpbb_root_path . 'common.' . $phpEx );
2007-01-02 16:35:48 +00:00
include ( $phpbb_root_path . 'includes/functions_display.' . $phpEx );
2001-05-11 23:16:31 +00:00
2015-01-04 20:41:04 +01:00
$mode = $request -> variable ( 'mode' , '' );
2011-06-05 09:40:43 +02:00
if ( $mode === 'contactadmin' )
{
define ( 'SKIP_CHECK_BAN' , true );
2014-05-20 17:31:53 +02:00
define ( 'SKIP_CHECK_DISABLED' , true );
2011-06-05 09:40:43 +02:00
}
2001-05-11 23:16:31 +00:00
// Start session management
2005-10-02 18:47:06 +00:00
$user -> session_begin ();
2002-10-20 19:19:07 +00:00
$auth -> acl ( $user -> data );
2004-09-01 15:47:46 +00:00
$user -> setup ( array ( 'memberlist' , 'groups' ));
2003-07-14 22:54:39 +00:00
2014-04-06 17:41:09 +02:00
// Setting a variable to let the style designer know where he is...
$template -> assign_var ( 'S_IN_MEMBERLIST' , true );
2002-11-12 20:55:18 +00:00
// Grab data
2015-01-04 20:41:04 +01:00
$action = $request -> variable ( 'action' , '' );
$user_id = $request -> variable ( 'u' , ANONYMOUS );
$username = $request -> variable ( 'un' , '' , true );
$group_id = $request -> variable ( 'g' , 0 );
$topic_id = $request -> variable ( 't' , 0 );
2002-11-12 20:55:18 +00:00
2014-03-24 21:05:11 +01:00
// Redirect when old mode is used
if ( $mode == 'leaders' )
{
2014-03-24 21:43:30 +01:00
send_status_line ( 301 , 'Moved Permanently' );
redirect ( append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , 'mode=team' ));
2014-03-24 21:05:11 +01:00
}
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
// Check our mode...
2011-06-05 09:40:43 +02:00
if ( ! in_array ( $mode , array ( '' , 'group' , 'viewprofile' , 'email' , 'contact' , 'contactadmin' , 'searchuser' , 'team' , 'livesearch' )))
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
{
trigger_error ( 'NO_MODE' );
}
2003-04-26 01:17:40 +00:00
switch ( $mode )
2003-03-10 17:48:08 +00:00
{
2003-04-26 01:17:40 +00:00
case 'email' :
2011-06-05 09:40:43 +02:00
case 'contactadmin' :
2006-06-06 20:53:46 +00:00
break ;
2003-05-03 23:58:45 +00:00
2014-04-12 04:26:51 -07:00
case 'livesearch' :
if ( ! $config [ 'allow_live_searches' ])
{
trigger_error ( 'LIVE_SEARCHES_NOT_ALLOWED' );
}
// No break
2003-04-26 01:17:40 +00:00
default :
2004-05-02 13:06:57 +00:00
// Can this user view profiles/memberlist?
2003-05-03 23:58:45 +00:00
if ( ! $auth -> acl_gets ( 'u_viewprofile' , 'a_user' , 'a_useradd' , 'a_userdel' ))
2003-04-26 01:17:40 +00:00
{
if ( $user -> data [ 'user_id' ] != ANONYMOUS )
{
2016-05-29 12:42:57 +02:00
send_status_line ( 403 , 'Forbidden' );
2005-04-30 14:36:33 +00:00
trigger_error ( 'NO_VIEW_USERS' );
2003-04-26 01:17:40 +00:00
}
2003-03-17 00:53:38 +00:00
2006-06-01 13:47:42 +00:00
login_box ( '' , (( isset ( $user -> lang [ 'LOGIN_EXPLAIN_' . strtoupper ( $mode )])) ? $user -> lang [ 'LOGIN_EXPLAIN_' . strtoupper ( $mode )] : $user -> lang [ 'LOGIN_EXPLAIN_MEMBERLIST' ]));
2003-04-26 01:17:40 +00:00
}
2006-06-06 20:53:46 +00:00
break ;
2003-03-10 17:48:08 +00:00
}
2015-05-28 17:31:21 +02:00
/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container -> get ( 'group_helper' );
2015-01-04 20:41:04 +01:00
$start = $request -> variable ( 'start' , 0 );
2003-10-12 11:59:23 +00:00
$submit = ( isset ( $_POST [ 'submit' ])) ? true : false ;
2002-11-12 20:55:18 +00:00
2006-10-30 16:20:11 +00:00
$default_key = 'c' ;
2015-01-04 20:41:04 +01:00
$sort_key = $request -> variable ( 'sk' , $default_key );
$sort_dir = $request -> variable ( 'sd' , 'a' );
2003-02-22 17:18:44 +00:00
2016-03-29 13:26:17 +02:00
$user_types = array ( USER_NORMAL , USER_FOUNDER );
if ( $auth -> acl_get ( 'a_user' ))
{
$user_types [] = USER_INACTIVE ;
}
2003-03-17 00:53:38 +00:00
// What do you want to do today? ... oops, I think that line is taken ...
2003-03-09 16:14:50 +00:00
switch ( $mode )
2001-07-05 00:57:28 +00:00
{
2014-03-23 16:41:14 +01:00
case 'team' :
2005-06-10 19:07:17 +00:00
// Display a listing of board admins, moderators
2017-05-24 12:58:25 -04:00
if ( ! function_exists ( 'user_get_id_name' ))
{
include ( $phpbb_root_path . 'includes/functions_user.' . $phpEx );
}
2007-10-03 15:05:54 +00:00
2005-08-19 10:48:39 +00:00
$page_title = $user -> lang [ 'THE_TEAM' ];
2014-03-23 16:41:14 +01:00
$template_html = 'memberlist_team.html' ;
2005-06-10 19:07:17 +00:00
2012-11-13 15:32:35 +01:00
$sql = ' SELECT *
FROM ' . TEAMPAGE_TABLE . '
ORDER BY teampage_position ASC ' ;
$result = $db -> sql_query ( $sql , 3600 );
$teampage_data = $db -> sql_fetchrowset ( $result );
$db -> sql_freeresult ( $result );
2011-02-09 21:06:37 +01:00
$sql_ary = array (
2012-11-13 15:32:35 +01:00
'SELECT' => 'g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id, t.teampage_id' ,
2004-01-13 01:40:25 +00:00
2011-02-09 21:06:37 +01:00
'FROM' => array ( GROUPS_TABLE => 'g' ),
2007-02-09 14:24:34 +00:00
2011-02-09 21:06:37 +01:00
'LEFT_JOIN' => array (
2012-11-13 15:32:35 +01:00
array (
'FROM' => array ( TEAMPAGE_TABLE => 't' ),
'ON' => 't.group_id = g.group_id' ,
),
2011-02-09 21:06:37 +01:00
array (
'FROM' => array ( USER_GROUP_TABLE => 'ug' ),
'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . ( int ) $user -> data [ 'user_id' ],
),
),
);
2007-10-03 15:05:54 +00:00
2011-02-09 21:06:37 +01:00
$result = $db -> sql_query ( $db -> sql_build_query ( 'SELECT' , $sql_ary ));
2008-09-01 21:33:12 +00:00
2011-02-09 21:06:37 +01:00
$group_ids = $groups_ary = array ();
while ( $row = $db -> sql_fetchrow ( $result ))
2007-03-16 21:43:11 +00:00
{
2011-02-09 21:06:37 +01:00
if ( $row [ 'group_type' ] == GROUP_HIDDEN && ! $auth -> acl_gets ( 'a_group' , 'a_groupadd' , 'a_groupdel' ) && $row [ 'ug_user_id' ] != $user -> data [ 'user_id' ])
2007-06-07 17:41:42 +00:00
{
2011-02-09 21:06:37 +01:00
$row [ 'group_name' ] = $user -> lang [ 'GROUP_UNDISCLOSED' ];
$row [ 'u_group' ] = '' ;
}
else
{
2015-05-28 17:31:21 +02:00
$row [ 'group_name' ] = $group_helper -> get_name ( $row [ 'group_name' ]);
2011-02-09 21:06:37 +01:00
$row [ 'u_group' ] = append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , 'mode=group&g=' . $row [ 'group_id' ]);
2007-06-07 17:41:42 +00:00
}
2008-01-05 16:10:10 +00:00
2012-11-13 15:32:35 +01:00
if ( $row [ 'teampage_id' ])
2011-02-09 21:06:37 +01:00
{
// Only put groups into the array we want to display.
// We are fetching all groups, to ensure we got all data for default groups.
$group_ids [] = ( int ) $row [ 'group_id' ];
}
$groups_ary [( int ) $row [ 'group_id' ]] = $row ;
2005-06-10 19:07:17 +00:00
}
2004-01-13 01:40:25 +00:00
$db -> sql_freeresult ( $result );
2011-02-09 21:06:37 +01:00
$sql_ary = array (
2015-10-10 15:57:33 +02:00
'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_type, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id' ,
2006-05-05 22:06:17 +00:00
'FROM' => array (
2011-02-09 21:06:37 +01:00
USER_GROUP_TABLE => 'ug' ,
2006-05-05 22:06:17 +00:00
),
'LEFT_JOIN' => array (
array (
2011-02-09 21:06:37 +01:00
'FROM' => array ( USERS_TABLE => 'u' ),
2018-10-29 00:28:43 +05:30
'ON' => 'ug.user_id = u.user_id' ,
2011-02-09 21:06:37 +01:00
),
array (
'FROM' => array ( GROUPS_TABLE => 'g' ),
'ON' => 'ug.group_id = g.group_id' ,
),
2006-05-05 22:06:17 +00:00
),
2018-10-29 00:28:43 +05:30
'WHERE' => $db -> sql_in_set ( 'g.group_id' , $group_ids , false , true ) . ' AND ug.user_pending = 0' ,
2011-02-09 21:06:37 +01:00
'ORDER_BY' => 'u.username_clean ASC' ,
);
2006-05-05 22:06:17 +00:00
2014-12-17 18:21:51 +01:00
/**
* Modify the query used to get the users for the team page
*
* @ event core . memberlist_team_modify_query
* @ var array sql_ary Array containing the query
* @ var array group_ids Array of group ids
* @ var array teampage_data The teampage data
* @ since 3.1 . 3 - RC1
*/
$vars = array (
'sql_ary' ,
'group_ids' ,
'teampage_data' ,
);
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_team_modify_query' , compact ( $vars )));
2011-02-09 21:06:37 +01:00
$result = $db -> sql_query ( $db -> sql_build_query ( 'SELECT' , $sql_ary ));
2005-06-10 19:07:17 +00:00
2013-04-11 16:38:14 +02:00
$user_ary = $user_ids = $group_users = array ();
2005-06-10 19:07:17 +00:00
while ( $row = $db -> sql_fetchrow ( $result ))
2004-01-13 01:40:25 +00:00
{
2011-02-09 21:06:37 +01:00
$row [ 'forums' ] = '' ;
$row [ 'forums_ary' ] = array ();
$user_ary [( int ) $row [ 'user_id' ]] = $row ;
$user_ids [] = ( int ) $row [ 'user_id' ];
$group_users [( int ) $row [ 'group_id' ]][] = ( int ) $row [ 'user_id' ];
}
$db -> sql_freeresult ( $result );
2005-06-10 19:07:17 +00:00
2013-04-11 16:38:14 +02:00
$user_ids = array_unique ( $user_ids );
if ( ! empty ( $user_ids ) && $config [ 'teampage_forums' ])
2011-02-09 21:06:37 +01:00
{
$template -> assign_var ( 'S_DISPLAY_MODERATOR_FORUMS' , true );
// Get all moderators
2013-04-11 16:38:14 +02:00
$perm_ary = $auth -> acl_get_list ( $user_ids , array ( 'm_' ), false );
2006-07-06 16:46:53 +00:00
2011-02-09 21:06:37 +01:00
foreach ( $perm_ary as $forum_id => $forum_ary )
{
foreach ( $forum_ary as $auth_option => $id_ary )
2006-07-06 16:46:53 +00:00
{
2011-02-09 21:06:37 +01:00
foreach ( $id_ary as $id )
{
if ( ! $forum_id )
{
$user_ary [ $id ][ 'forums' ] = $user -> lang [ 'ALL_FORUMS' ];
}
else
{
$user_ary [ $id ][ 'forums_ary' ][] = $forum_id ;
}
}
2006-07-06 16:46:53 +00:00
}
}
2011-02-09 21:06:37 +01:00
$sql = ' SELECT forum_id , forum_name
FROM ' . FORUMS_TABLE ;
$result = $db -> sql_query ( $sql );
2006-05-12 16:20:47 +00:00
2011-02-09 21:06:37 +01:00
$forums = array ();
while ( $row = $db -> sql_fetchrow ( $result ))
2005-06-10 19:07:17 +00:00
{
2011-02-09 21:06:37 +01:00
$forums [ $row [ 'forum_id' ]] = $row [ 'forum_name' ];
}
$db -> sql_freeresult ( $result );
foreach ( $user_ary as $user_id => $user_data )
{
if ( ! $user_data [ 'forums' ])
2005-06-10 19:07:17 +00:00
{
2011-02-09 21:06:37 +01:00
foreach ( $user_data [ 'forums_ary' ] as $forum_id )
2005-06-10 19:07:17 +00:00
{
2011-02-09 21:06:37 +01:00
$user_ary [ $user_id ][ 'forums_options' ] = true ;
2006-10-30 16:20:11 +00:00
if ( isset ( $forums [ $forum_id ]))
2006-05-12 16:20:47 +00:00
{
2006-10-30 16:20:11 +00:00
if ( $auth -> acl_get ( 'f_list' , $forum_id ))
{
2011-02-09 21:06:37 +01:00
$user_ary [ $user_id ][ 'forums' ] .= '<option value="">' . $forums [ $forum_id ] . '</option>' ;
2006-10-30 16:20:11 +00:00
}
2006-05-12 16:20:47 +00:00
}
2005-06-10 19:07:17 +00:00
}
}
}
2011-02-09 21:06:37 +01:00
}
2006-05-12 16:20:47 +00:00
2012-11-13 15:32:35 +01:00
$parent_team = 0 ;
foreach ( $teampage_data as $team_data )
2011-02-09 21:06:37 +01:00
{
2012-11-13 15:32:35 +01:00
// If this team entry has no group, it's a category
if ( ! $team_data [ 'group_id' ])
{
$template -> assign_block_vars ( 'group' , array (
'GROUP_NAME' => $team_data [ 'teampage_name' ],
));
$parent_team = ( int ) $team_data [ 'teampage_id' ];
continue ;
}
$group_data = $groups_ary [( int ) $team_data [ 'group_id' ]];
$group_id = ( int ) $team_data [ 'group_id' ];
if ( ! $team_data [ 'teampage_parent' ])
2006-10-30 16:20:11 +00:00
{
2012-11-13 15:32:35 +01:00
// If the group does not have a parent category, we display the groupname as category
2011-02-09 21:06:37 +01:00
$template -> assign_block_vars ( 'group' , array (
'GROUP_NAME' => $group_data [ 'group_name' ],
'GROUP_COLOR' => $group_data [ 'group_colour' ],
'U_GROUP' => $group_data [ 'u_group' ],
));
2011-02-24 02:05:03 +01:00
}
// Display group members.
if ( ! empty ( $group_users [ $group_id ]))
{
2011-02-09 21:06:37 +01:00
foreach ( $group_users [ $group_id ] as $user_id )
{
if ( isset ( $user_ary [ $user_id ]))
{
$row = $user_ary [ $user_id ];
2012-11-13 15:32:35 +01:00
if ( $config [ 'teampage_memberships' ] == 1 && ( $group_id != $groups_ary [ $row [ 'default_group' ]][ 'group_id' ]) && $groups_ary [ $row [ 'default_group' ]][ 'teampage_id' ])
2011-02-25 15:47:34 +01:00
{
// Display users in their primary group, instead of the first group, when it is displayed on the teampage.
continue ;
}
2006-10-30 16:20:11 +00:00
2014-08-19 22:25:01 +02:00
$user_rank_data = phpbb_get_user_rank ( $row , (( $row [ 'user_id' ] == ANONYMOUS ) ? false : $row [ 'user_posts' ]));
2011-02-09 21:06:37 +01:00
2014-12-17 18:21:51 +01:00
$template_vars = array (
2011-02-24 02:05:03 +01:00
'USER_ID' => $row [ 'user_id' ],
'FORUMS' => $row [ 'forums' ],
'FORUM_OPTIONS' => ( isset ( $row [ 'forums_options' ])) ? true : false ,
2014-08-19 22:25:01 +02:00
'RANK_TITLE' => $user_rank_data [ 'title' ],
2005-06-10 19:07:17 +00:00
2011-02-24 02:05:03 +01:00
'GROUP_NAME' => $groups_ary [ $row [ 'default_group' ]][ 'group_name' ],
'GROUP_COLOR' => $groups_ary [ $row [ 'default_group' ]][ 'group_colour' ],
'U_GROUP' => $groups_ary [ $row [ 'default_group' ]][ 'u_group' ],
2005-06-10 19:07:17 +00:00
2014-08-19 22:25:01 +02:00
'RANK_IMG' => $user_rank_data [ 'img' ],
'RANK_IMG_SRC' => $user_rank_data [ 'img_src' ],
2005-06-10 19:07:17 +00:00
2015-10-10 15:57:33 +02:00
'S_INACTIVE' => $row [ 'user_type' ] == USER_INACTIVE ,
2011-02-24 02:05:03 +01:00
'U_PM' => ( $config [ 'allow_privmsg' ] && $auth -> acl_get ( 'u_sendpm' ) && ( $row [ 'user_allow_pm' ] || $auth -> acl_gets ( 'a_' , 'm_' ) || $auth -> acl_getf_global ( 'm_' ))) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=pm&mode=compose&u=' . $row [ 'user_id' ]) : '' ,
2005-06-10 19:07:17 +00:00
2011-02-24 02:05:03 +01:00
'USERNAME_FULL' => get_username_string ( 'full' , $row [ 'user_id' ], $row [ 'username' ], $row [ 'user_colour' ]),
'USERNAME' => get_username_string ( 'username' , $row [ 'user_id' ], $row [ 'username' ], $row [ 'user_colour' ]),
'USER_COLOR' => get_username_string ( 'colour' , $row [ 'user_id' ], $row [ 'username' ], $row [ 'user_colour' ]),
'U_VIEW_PROFILE' => get_username_string ( 'profile' , $row [ 'user_id' ], $row [ 'username' ], $row [ 'user_colour' ]),
2014-12-17 18:21:51 +01:00
);
/**
* Modify the template vars for displaying the user in the groups on the teampage
*
* @ event core . memberlist_team_modify_template_vars
* @ var array template_vars Array containing the query
* @ var array row Array containing the action user row
* @ var array groups_ary Array of groups with all users that should be displayed
* @ since 3.1 . 3 - RC1
*/
$vars = array (
'template_vars' ,
'row' ,
'groups_ary' ,
);
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_team_modify_template_vars' , compact ( $vars )));
$template -> assign_block_vars ( 'group.user' , $template_vars );
2006-11-23 16:15:46 +00:00
2011-10-14 00:54:11 +02:00
if ( $config [ 'teampage_memberships' ] != 2 )
2011-02-09 21:06:37 +01:00
{
unset ( $user_ary [ $user_id ]);
}
}
}
}
2004-01-13 01:40:25 +00:00
}
2005-06-10 19:07:17 +00:00
$template -> assign_vars ( array (
2006-08-05 15:49:28 +00:00
'PM_IMG' => $user -> img ( 'icon_contact_pm' , $user -> lang [ 'SEND_PRIVATE_MESSAGE' ]))
2005-06-10 19:07:17 +00:00
);
2006-06-06 20:53:46 +00:00
break ;
2003-03-17 00:53:38 +00:00
2003-04-15 23:42:06 +00:00
case 'contact' :
2007-10-03 15:05:54 +00:00
2003-04-15 23:42:06 +00:00
$page_title = $user -> lang [ 'IM_USER' ];
$template_html = 'memberlist_im.html' ;
2003-06-19 16:13:53 +00:00
2007-03-30 14:24:55 +00:00
if ( ! $auth -> acl_get ( 'u_sendim' ))
{
2016-05-29 12:42:57 +02:00
send_status_line ( 403 , 'Forbidden' );
2007-03-30 14:24:55 +00:00
trigger_error ( 'NOT_AUTHORISED' );
}
2003-06-19 16:13:53 +00:00
$presence_img = '' ;
switch ( $action )
{
case 'jabber' :
$lang = 'JABBER' ;
$sql_field = 'user_jabber' ;
2006-05-26 15:04:27 +00:00
$s_select = ( @ extension_loaded ( 'xml' ) && $config [ 'jab_enable' ]) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER' ;
2006-06-06 20:53:46 +00:00
$s_action = append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , " mode=contact&action= $action &u= $user_id " );
break ;
2004-05-02 13:06:57 +00:00
default :
2007-05-04 12:30:21 +00:00
trigger_error ( 'NO_MODE' , E_USER_ERROR );
2006-06-06 20:53:46 +00:00
break ;
2003-06-19 16:13:53 +00:00
}
// Grab relevant data
2004-09-01 15:47:46 +00:00
$sql = " SELECT user_id, username, user_email, user_lang, $sql_field
FROM " . USERS_TABLE . "
2005-03-21 22:43:07 +00:00
WHERE user_id = $user_id
AND user_type IN ( " . USER_NORMAL . ', ' . USER_FOUNDER . ')';
2003-06-19 16:13:53 +00:00
$result = $db -> sql_query ( $sql );
2006-06-06 20:53:46 +00:00
$row = $db -> sql_fetchrow ( $result );
$db -> sql_freeresult ( $result );
2003-06-19 16:13:53 +00:00
2006-06-06 20:53:46 +00:00
if ( ! $row )
2003-06-19 16:13:53 +00:00
{
2007-07-22 13:14:36 +00:00
trigger_error ( 'NO_USER' );
}
else if ( empty ( $row [ $sql_field ]))
{
trigger_error ( 'IM_NO_DATA' );
2003-06-19 16:13:53 +00:00
}
// Post data grab actions
switch ( $action )
{
case 'jabber' :
2007-10-03 15:05:54 +00:00
add_form_key ( 'memberlist_messaging' );
2006-05-26 15:04:27 +00:00
if ( $submit && @ extension_loaded ( 'xml' ) && $config [ 'jab_enable' ])
2003-06-19 16:13:53 +00:00
{
2007-10-03 15:05:54 +00:00
if ( check_form_key ( 'memberlist_messaging' ))
{
2003-06-19 16:13:53 +00:00
2007-10-03 15:05:54 +00:00
include_once ( $phpbb_root_path . 'includes/functions_messenger.' . $phpEx );
2007-07-06 10:55:31 +00:00
2007-10-03 15:05:54 +00:00
$subject = sprintf ( $user -> lang [ 'IM_JABBER_SUBJECT' ], $user -> data [ 'username' ], $config [ 'server_name' ]);
2015-02-02 21:35:46 +01:00
$message = $request -> variable ( 'message' , '' , true );
2003-06-19 16:13:53 +00:00
2007-10-03 15:05:54 +00:00
if ( empty ( $message ))
{
trigger_error ( 'EMPTY_MESSAGE_IM' );
}
2003-06-19 16:13:53 +00:00
2007-10-03 15:05:54 +00:00
$messenger = new messenger ( false );
2003-06-19 16:13:53 +00:00
2007-10-03 15:05:54 +00:00
$messenger -> template ( 'profile_send_im' , $row [ 'user_lang' ]);
$messenger -> subject ( htmlspecialchars_decode ( $subject ));
2003-06-19 16:13:53 +00:00
2007-10-03 15:05:54 +00:00
$messenger -> replyto ( $user -> data [ 'user_email' ]);
2013-04-24 15:34:12 -05:00
$messenger -> set_addresses ( $row );
2003-08-27 16:32:44 +00:00
2007-10-03 15:05:54 +00:00
$messenger -> assign_vars ( array (
2014-05-03 16:57:04 +02:00
'BOARD_CONTACT' => phpbb_get_board_contact ( $config , $phpEx ),
2007-10-03 15:05:54 +00:00
'FROM_USERNAME' => htmlspecialchars_decode ( $user -> data [ 'username' ]),
'TO_USERNAME' => htmlspecialchars_decode ( $row [ 'username' ]),
'MESSAGE' => htmlspecialchars_decode ( $message ))
);
2003-06-19 16:13:53 +00:00
2007-10-03 15:05:54 +00:00
$messenger -> send ( NOTIFY_IM );
$s_select = 'S_SENT_JABBER' ;
}
else
{
trigger_error ( 'FORM_INVALID' );
}
2003-06-19 16:13:53 +00:00
}
2006-06-06 20:53:46 +00:00
break ;
2003-06-19 16:13:53 +00:00
}
// Send vars to the template
$template -> assign_vars ( array (
2004-09-01 15:47:46 +00:00
'IM_CONTACT' => $row [ $sql_field ],
2007-09-22 18:31:50 +00:00
'A_IM_CONTACT' => addslashes ( $row [ $sql_field ]),
2006-05-20 18:39:35 +00:00
'USERNAME' => $row [ 'username' ],
2004-09-01 15:47:46 +00:00
'CONTACT_NAME' => $row [ $sql_field ],
2006-05-20 18:39:35 +00:00
'SITENAME' => $config [ 'sitename' ],
2003-06-19 16:13:53 +00:00
2004-09-01 15:47:46 +00:00
'PRESENCE_IMG' => $presence_img ,
2003-06-19 16:13:53 +00:00
2004-09-01 15:47:46 +00:00
'L_SEND_IM_EXPLAIN' => $user -> lang [ 'IM_' . $lang ],
'L_IM_SENT_JABBER' => sprintf ( $user -> lang [ 'IM_SENT_JABBER' ], $row [ 'username' ]),
2003-06-19 16:13:53 +00:00
2004-09-01 15:47:46 +00:00
$s_select => true ,
2003-06-19 16:13:53 +00:00
'S_IM_ACTION' => $s_action )
);
2006-06-06 20:53:46 +00:00
break ;
2003-04-15 23:42:06 +00:00
2003-03-09 16:14:50 +00:00
case 'viewprofile' :
// Display a profile
2006-08-03 15:23:34 +00:00
if ( $user_id == ANONYMOUS && ! $username )
2003-03-09 16:14:50 +00:00
{
2005-04-30 14:36:33 +00:00
trigger_error ( 'NO_USER' );
2003-03-09 16:14:50 +00:00
}
2002-11-12 20:55:18 +00:00
2006-03-01 21:48:02 +00:00
// Get user...
2007-02-18 13:42:08 +00:00
$sql = ' SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . (($username) ? "username_clean = ' " . $db->sql_escape (utf8_clean_string( $username )) . " ' " : " user_id = $user_id " );
2006-03-01 21:48:02 +00:00
$result = $db -> sql_query ( $sql );
2006-06-06 20:53:46 +00:00
$member = $db -> sql_fetchrow ( $result );
$db -> sql_freeresult ( $result );
2006-03-01 21:48:02 +00:00
2006-06-06 20:53:46 +00:00
if ( ! $member )
2006-03-01 21:48:02 +00:00
{
trigger_error ( 'NO_USER' );
}
2007-03-08 15:49:13 +00:00
// a_user admins and founder are able to view inactive users and bots to be able to manage them more easily
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
// Normal users are able to see at least users having only changed their profile settings but not yet reactivated.
2007-03-08 15:49:13 +00:00
if ( ! $auth -> acl_get ( 'a_user' ) && $user -> data [ 'user_type' ] != USER_FOUNDER )
{
2007-03-09 16:24:58 +00:00
if ( $member [ 'user_type' ] == USER_IGNORE )
2007-03-08 15:49:13 +00:00
{
trigger_error ( 'NO_USER' );
}
2007-03-09 16:24:58 +00:00
else if ( $member [ 'user_type' ] == USER_INACTIVE && $member [ 'user_inactive_reason' ] != INACTIVE_PROFILE )
2007-03-08 15:49:13 +00:00
{
trigger_error ( 'NO_USER' );
}
}
2006-08-03 15:23:34 +00:00
$user_id = ( int ) $member [ 'user_id' ];
2009-12-31 16:31:57 +00:00
// Get group memberships
// Also get visiting user's groups to determine hidden group memberships if necessary.
$auth_hidden_groups = ( $user_id === ( int ) $user -> data [ 'user_id' ] || $auth -> acl_gets ( 'a_group' , 'a_groupadd' , 'a_groupdel' )) ? true : false ;
$sql_uid_ary = ( $auth_hidden_groups ) ? array ( $user_id ) : array ( $user_id , ( int ) $user -> data [ 'user_id' ]);
2003-03-09 16:14:50 +00:00
// Do the SQL thang
2009-12-31 16:31:57 +00:00
$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
2009-12-31 17:07:34 +00:00
AND ug . user_pending = 0 ' ;
2003-03-09 16:14:50 +00:00
$result = $db -> sql_query ( $sql );
2001-07-05 00:57:28 +00:00
2009-12-31 17:32:49 +00:00
// Divide data into profile data and current user data
2009-12-31 16:31:57 +00:00
$profile_groups = $user_groups = array ();
2003-03-10 17:48:08 +00:00
while ( $row = $db -> sql_fetchrow ( $result ))
2003-03-09 16:14:50 +00:00
{
2009-12-31 16:31:57 +00:00
$row [ 'user_id' ] = ( int ) $row [ 'user_id' ];
$row [ 'group_id' ] = ( int ) $row [ 'group_id' ];
if ( $row [ 'user_id' ] == $user_id )
{
$profile_groups [] = $row ;
}
else
{
$user_groups [ $row [ 'group_id' ]] = $row [ 'group_id' ];
}
2003-03-09 16:14:50 +00:00
}
2006-10-07 20:11:45 +00:00
$db -> sql_freeresult ( $result );
2009-12-31 17:07:34 +00:00
// Filter out hidden groups and sort groups by name
$group_data = $group_sort = array ();
2009-12-31 16:31:57 +00:00
foreach ( $profile_groups as $row )
{
2015-05-28 17:31:21 +02:00
if ( ! $auth_hidden_groups && $row [ 'group_type' ] == GROUP_HIDDEN && ! isset ( $user_groups [ $row [ 'group_id' ]]))
2009-12-31 16:31:57 +00:00
{
2009-12-31 17:07:34 +00:00
// Skip over hidden groups the user cannot see
2009-12-31 16:31:57 +00:00
continue ;
}
2015-05-28 17:31:21 +02:00
$row [ 'group_name' ] = $group_helper -> get_name ( $row [ 'group_name' ]);
2009-12-31 17:07:34 +00:00
$group_sort [ $row [ 'group_id' ]] = utf8_clean_string ( $row [ 'group_name' ]);
$group_data [ $row [ 'group_id' ]] = $row ;
2009-12-31 16:31:57 +00:00
}
unset ( $profile_groups );
unset ( $user_groups );
2009-12-31 17:07:34 +00:00
asort ( $group_sort );
$group_options = '' ;
foreach ( $group_sort as $group_id => $null )
{
$row = $group_data [ $group_id ];
$group_options .= '<option value="' . $row [ 'group_id' ] . '"' . (( $row [ 'group_id' ] == $member [ 'group_id' ]) ? ' selected="selected"' : '' ) . '>' . $row [ 'group_name' ] . '</option>' ;
}
unset ( $group_data );
unset ( $group_sort );
2009-12-31 16:31:57 +00:00
2006-10-07 20:11:45 +00:00
// What colour is the zebra
$sql = ' SELECT friend , foe
FROM ' . ZEBRA_TABLE . "
WHERE zebra_id = $user_id
AND user_id = { $user -> data [ 'user_id' ]} " ;
$result = $db -> sql_query ( $sql );
$row = $db -> sql_fetchrow ( $result );
$foe = ( $row [ 'foe' ]) ? true : false ;
$friend = ( $row [ 'friend' ]) ? true : false ;
$db -> sql_freeresult ( $result );
2003-03-18 22:47:50 +00:00
2006-06-24 13:37:23 +00:00
if ( $config [ 'load_onlinetrack' ])
{
$sql = ' SELECT MAX ( session_time ) AS session_time , MIN ( session_viewonline ) AS session_viewonline
FROM ' . SESSIONS_TABLE . "
WHERE session_user_id = $user_id " ;
$result = $db -> sql_query ( $sql );
$row = $db -> sql_fetchrow ( $result );
$db -> sql_freeresult ( $result );
2003-05-28 14:20:11 +00:00
2006-06-24 13:37:23 +00:00
$member [ 'session_time' ] = ( isset ( $row [ 'session_time' ])) ? $row [ 'session_time' ] : 0 ;
$member [ 'session_viewonline' ] = ( isset ( $row [ 'session_viewonline' ])) ? $row [ 'session_viewonline' ] : 0 ;
unset ( $row );
}
2003-05-03 23:58:45 +00:00
2006-03-13 18:05:12 +00:00
if ( $config [ 'load_user_activity' ])
2003-03-18 22:47:50 +00:00
{
2006-05-18 21:03:56 +00:00
display_user_activity ( $member );
2004-05-26 18:15:17 +00:00
}
2003-03-09 16:14:50 +00:00
2004-09-01 15:47:46 +00:00
// Do the relevant calculations
2003-05-28 14:20:11 +00:00
$memberdays = max ( 1 , round (( time () - $member [ 'user_regdate' ]) / 86400 ));
$posts_per_day = $member [ 'user_posts' ] / $memberdays ;
2006-03-13 18:05:12 +00:00
$percentage = ( $config [ 'num_posts' ]) ? min ( 100 , ( $member [ 'user_posts' ] / $config [ 'num_posts' ]) * 100 ) : 0 ;
2003-02-22 17:18:44 +00:00
2003-05-28 14:20:11 +00:00
2003-06-19 16:13:53 +00:00
if ( $member [ 'user_sig' ])
{
2013-07-24 11:38:04 +01:00
$parse_flags = ( $member [ 'user_sig_bbcode_bitfield' ] ? OPTION_FLAG_BBCODE : 0 ) | OPTION_FLAG_SMILIES ;
$member [ 'user_sig' ] = generate_text_for_display ( $member [ 'user_sig' ], $member [ 'user_sig_bbcode_uid' ], $member [ 'user_sig_bbcode_bitfield' ], $parse_flags , true );
2003-06-19 16:13:53 +00:00
}
2009-08-30 11:56:15 +00:00
// We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links
$zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false ;
2009-06-18 12:59:43 +00:00
// Only check if the user is logged in
if ( $user -> data [ 'is_registered' ])
{
if ( ! class_exists ( 'p_master' ))
{
include ( $phpbb_root_path . 'includes/functions_module.' . $phpEx );
}
$module = new p_master ();
$module -> list_modules ( 'ucp' );
$module -> list_modules ( 'mcp' );
2012-02-09 01:34:50 +02:00
$user_notes_enabled = ( $module -> loaded ( 'mcp_notes' , 'user_notes' )) ? true : false ;
$warn_user_enabled = ( $module -> loaded ( 'mcp_warn' , 'warn_user' )) ? true : false ;
$zebra_enabled = ( $module -> loaded ( 'ucp_zebra' )) ? true : false ;
$friends_enabled = ( $module -> loaded ( 'ucp_zebra' , 'friends' )) ? true : false ;
$foes_enabled = ( $module -> loaded ( 'ucp_zebra' , 'foes' )) ? true : false ;
2009-06-18 12:59:43 +00:00
unset ( $module );
}
2014-04-12 12:38:35 +02:00
// Custom Profile Fields
$profile_fields = array ();
if ( $config [ 'load_cpf_viewprofile' ])
{
2015-01-03 11:39:29 +01:00
/* @var $cp \phpbb\profilefields\manager */
2014-04-12 12:38:35 +02:00
$cp = $phpbb_container -> get ( 'profilefields.manager' );
$profile_fields = $cp -> grab_profile_fields_data ( $user_id );
$profile_fields = ( isset ( $profile_fields [ $user_id ])) ? $cp -> generate_profile_fields_template_data ( $profile_fields [ $user_id ]) : array ();
}
2012-08-02 21:56:35 +02:00
/**
* Modify user data before we display the profile
*
* @ event core . memberlist_view_profile
2013-08-13 16:23:54 +02:00
* @ var array member Array with user ' s data
2014-04-12 12:38:35 +02:00
* @ var bool user_notes_enabled Is the mcp user notes module enabled ?
* @ var bool warn_user_enabled Is the mcp warnings module enabled ?
* @ var bool zebra_enabled Is the ucp zebra module enabled ?
* @ var bool friends_enabled Is the ucp friends module enabled ?
* @ var bool foes_enabled Is the ucp foes module enabled ?
2014-03-26 22:26:46 +02:00
* @ var bool friend Is the user friend ?
* @ var bool foe Is the user foe ?
2014-04-12 12:38:35 +02:00
* @ var array profile_fields Array with user ' s profile field data
2014-04-25 12:15:44 +02:00
* @ since 3.1 . 0 - a1
2014-03-26 22:26:46 +02:00
* @ changed 3.1 . 0 - b2 Added friend and foe status
2014-04-12 12:38:35 +02:00
* @ changed 3.1 . 0 - b3 Added profile fields data
2012-08-02 21:56:35 +02:00
*/
2014-04-25 11:46:44 +02:00
$vars = array (
'member' ,
'user_notes_enabled' ,
'warn_user_enabled' ,
'zebra_enabled' ,
'friends_enabled' ,
'foes_enabled' ,
'friend' ,
'foe' ,
2014-04-12 12:38:35 +02:00
'profile_fields' ,
2014-04-25 11:46:44 +02:00
);
2012-08-02 21:56:35 +02:00
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_view_profile' , compact ( $vars )));
2012-03-16 00:49:38 +01:00
2014-06-23 22:34:17 +02:00
$template -> assign_vars ( phpbb_show_profile ( $member , $user_notes_enabled , $warn_user_enabled ));
2003-02-22 17:18:44 +00:00
2008-09-01 21:33:12 +00:00
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
if ( $auth -> acl_getf_global ( 'm_approve' ) || $auth -> acl_get ( 'a_user' ))
{
$sql = ' SELECT COUNT ( post_id ) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
2014-04-11 14:10:58 +02:00
AND ' . $db->sql_in_set(' post_visibility ' , array ( ITEM_UNAPPROVED , ITEM_REAPPROVE ));
2008-09-01 21:33:12 +00:00
$result = $db -> sql_query ( $sql );
$member [ 'posts_in_queue' ] = ( int ) $db -> sql_fetchfield ( 'posts_in_queue' );
$db -> sql_freeresult ( $result );
}
else
{
$member [ 'posts_in_queue' ] = 0 ;
}
2003-03-09 16:14:50 +00:00
$template -> assign_vars ( array (
2008-09-01 21:33:12 +00:00
'L_POSTS_IN_QUEUE' => $user -> lang ( 'NUM_POSTS_IN_QUEUE' , $member [ 'posts_in_queue' ]),
2011-09-20 01:33:33 +02:00
'POSTS_DAY' => $user -> lang ( 'POST_DAY' , $posts_per_day ),
'POSTS_PCT' => $user -> lang ( 'POST_PCT' , $percentage ),
2003-03-09 16:14:50 +00:00
2006-08-28 17:20:21 +00:00
'SIGNATURE' => $member [ 'user_sig' ],
2008-09-01 21:33:12 +00:00
'POSTS_IN_QUEUE' => $member [ 'posts_in_queue' ],
2003-05-28 14:20:11 +00:00
2006-08-05 15:49:28 +00:00
'PM_IMG' => $user -> img ( 'icon_contact_pm' , $user -> lang [ 'SEND_PRIVATE_MESSAGE' ]),
2014-05-03 13:28:38 +02:00
'L_SEND_EMAIL_USER' => $user -> lang ( 'SEND_EMAIL_USER' , $member [ 'username' ]),
2006-08-05 15:49:28 +00:00
'EMAIL_IMG' => $user -> img ( 'icon_contact_email' , $user -> lang [ 'EMAIL' ]),
'JABBER_IMG' => $user -> img ( 'icon_contact_jabber' , $user -> lang [ 'JABBER' ]),
'SEARCH_IMG' => $user -> img ( 'icon_user_search' , $user -> lang [ 'SEARCH' ]),
2003-03-09 16:14:50 +00:00
2006-06-06 20:53:46 +00:00
'S_PROFILE_ACTION' => append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , 'mode=group' ),
2004-09-01 15:47:46 +00:00
'S_GROUP_OPTIONS' => $group_options ,
2017-06-28 00:58:03 +07:00
'S_CUSTOM_FIELDS' => ( isset ( $profile_fields [ 'row' ]) && count ( $profile_fields [ 'row' ])) ? true : false ,
2006-04-17 13:09:50 +00:00
2012-12-09 17:01:08 -06:00
'U_USER_ADMIN' => ( $auth -> acl_get ( 'a_user' )) ? append_sid ( " { $phpbb_admin_path } index. $phpEx " , 'i=users&mode=overview&u=' . $user_id , true , $user -> session_id ) : '' ,
2008-11-30 17:45:22 +00:00
'U_USER_BAN' => ( $auth -> acl_get ( 'm_ban' ) && $user_id != $user -> data [ 'user_id' ]) ? append_sid ( " { $phpbb_root_path } mcp. $phpEx " , 'i=ban&mode=user&u=' . $user_id , true , $user -> session_id ) : '' ,
2008-09-01 21:33:12 +00:00
'U_MCP_QUEUE' => ( $auth -> acl_getf_global ( 'm_approve' )) ? append_sid ( " { $phpbb_root_path } mcp. $phpEx " , 'i=queue' , true , $user -> session_id ) : '' ,
2008-05-29 13:59:47 +00:00
2009-08-03 13:32:52 +00:00
'U_SWITCH_PERMISSIONS' => ( $auth -> acl_get ( 'a_switchperm' ) && $user -> data [ 'user_id' ] != $user_id ) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , " mode=switch_perm&u= { $user_id } &hash= " . generate_link_hash ( 'switchperm' )) : '' ,
2014-11-05 21:06:32 +01:00
'U_EDIT_SELF' => ( $user_id == $user -> data [ 'user_id' ] && $auth -> acl_get ( 'u_chgprofileinfo' )) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=ucp_profile&mode=profile_info' ) : '' ,
2003-03-10 17:48:08 +00:00
2009-06-18 11:43:16 +00:00
'S_USER_NOTES' => ( $user_notes_enabled ) ? true : false ,
'S_WARN_USER' => ( $warn_user_enabled ) ? true : false ,
2006-07-01 19:11:52 +00:00
'S_ZEBRA' => ( $user -> data [ 'user_id' ] != $user_id && $user -> data [ 'is_registered' ] && $zebra_enabled ) ? true : false ,
2009-08-30 11:56:15 +00:00
'U_ADD_FRIEND' => ( ! $friend && ! $foe && $friends_enabled ) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=zebra&add=' . urlencode ( htmlspecialchars_decode ( $member [ 'username' ]))) : '' ,
'U_ADD_FOE' => ( ! $friend && ! $foe && $foes_enabled ) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=zebra&mode=foes&add=' . urlencode ( htmlspecialchars_decode ( $member [ 'username' ]))) : '' ,
'U_REMOVE_FRIEND' => ( $friend && $friends_enabled ) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=zebra&remove=1&usernames[]=' . $user_id ) : '' ,
'U_REMOVE_FOE' => ( $foe && $foes_enabled ) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id ) : '' ,
2014-05-16 11:32:33 +02:00
'U_CANONICAL' => generate_board_url () . '/' . append_sid ( " memberlist. $phpEx " , 'mode=viewprofile&u=' . $user_id , true , '' ),
2006-10-07 20:11:45 +00:00
));
2005-04-30 14:36:33 +00:00
2006-06-06 20:53:46 +00:00
if ( ! empty ( $profile_fields [ 'row' ]))
2005-04-30 14:36:33 +00:00
{
$template -> assign_vars ( $profile_fields [ 'row' ]);
}
2006-06-06 20:53:46 +00:00
if ( ! empty ( $profile_fields [ 'blockrow' ]))
2005-04-30 14:36:33 +00:00
{
foreach ( $profile_fields [ 'blockrow' ] as $field_data )
{
$template -> assign_block_vars ( 'custom_fields' , $field_data );
}
}
2005-10-02 18:47:06 +00:00
2006-11-21 18:15:53 +00:00
// Inactive reason/account?
if ( $member [ 'user_type' ] == USER_INACTIVE )
{
$user -> add_lang ( 'acp/common' );
$inactive_reason = $user -> lang [ 'INACTIVE_REASON_UNKNOWN' ];
switch ( $member [ 'user_inactive_reason' ])
{
case INACTIVE_REGISTER :
$inactive_reason = $user -> lang [ 'INACTIVE_REASON_REGISTER' ];
break ;
case INACTIVE_PROFILE :
$inactive_reason = $user -> lang [ 'INACTIVE_REASON_PROFILE' ];
break ;
case INACTIVE_MANUAL :
$inactive_reason = $user -> lang [ 'INACTIVE_REASON_MANUAL' ];
break ;
case INACTIVE_REMIND :
$inactive_reason = $user -> lang [ 'INACTIVE_REASON_REMIND' ];
break ;
}
2007-10-03 15:05:54 +00:00
2006-11-21 18:15:53 +00:00
$template -> assign_vars ( array (
'S_USER_INACTIVE' => true ,
'USER_INACTIVE_REASON' => $inactive_reason )
);
}
2007-07-24 11:18:08 +00:00
// Now generate page title
2005-10-02 18:47:06 +00:00
$page_title = sprintf ( $user -> lang [ 'VIEWING_PROFILE' ], $member [ 'username' ]);
$template_html = 'memberlist_view.html' ;
break ;
2002-03-31 00:06:34 +00:00
2011-06-05 09:40:43 +02:00
case 'contactadmin' :
2003-03-09 16:14:50 +00:00
case 'email' :
2011-06-05 09:40:43 +02:00
if ( ! class_exists ( 'messenger' ))
2003-03-05 00:50:03 +00:00
{
2011-06-05 09:40:43 +02:00
include ( $phpbb_root_path . 'includes/functions_messenger.' . $phpEx );
2003-03-09 16:14:50 +00:00
}
2003-03-05 00:50:03 +00:00
2015-01-04 20:41:04 +01:00
$user_id = $request -> variable ( 'u' , 0 );
$topic_id = $request -> variable ( 't' , 0 );
2003-05-05 22:48:17 +00:00
2006-04-15 14:48:36 +00:00
if ( $user_id )
2003-03-09 16:14:50 +00:00
{
2014-04-11 18:09:25 +02:00
$form_name = 'user' ;
2003-05-05 22:48:17 +00:00
}
2006-04-15 14:48:36 +00:00
else if ( $topic_id )
2003-05-05 22:48:17 +00:00
{
2014-04-11 18:09:25 +02:00
$form_name = 'topic' ;
2011-06-05 09:40:43 +02:00
}
else if ( $mode === 'contactadmin' )
{
2014-04-11 18:09:25 +02:00
$form_name = 'admin' ;
2003-05-05 22:48:17 +00:00
}
2006-04-15 14:48:36 +00:00
else
{
trigger_error ( 'NO_EMAIL' );
}
2015-01-03 11:39:29 +01:00
/** @var $form \phpbb\message\form */
2014-04-11 18:09:25 +02:00
$form = $phpbb_container -> get ( 'message.form.' . $form_name );
2003-02-22 17:18:44 +00:00
2011-06-05 09:40:43 +02:00
$form -> bind ( $request );
$error = $form -> check_allow ();
if ( $error )
2003-05-05 22:48:17 +00:00
{
2011-06-05 09:40:43 +02:00
trigger_error ( $error );
2003-03-09 16:14:50 +00:00
}
2003-03-05 00:50:03 +00:00
2014-04-11 18:09:25 +02:00
if ( $request -> is_set_post ( 'submit' ))
2003-05-05 22:48:17 +00:00
{
2011-06-05 09:40:43 +02:00
$messenger = new messenger ( false );
$form -> submit ( $messenger );
2003-05-05 22:48:17 +00:00
}
2005-04-30 14:36:33 +00:00
2011-06-05 09:40:43 +02:00
$page_title = $form -> get_page_title ();
$template_html = $form -> get_template_file ();
$form -> render ( $template );
2006-04-15 14:48:36 +00:00
break ;
2002-11-12 20:55:18 +00:00
2014-02-06 18:32:59 +05:30
case 'livesearch' :
2014-04-08 03:54:10 -07:00
$username_chars = $request -> variable ( 'username' , '' , true );
$sql = ' SELECT username , user_id , user_colour
2014-02-09 21:57:44 +05:30
FROM ' . USERS_TABLE . '
2016-03-29 13:26:17 +02:00
WHERE ' . $db->sql_in_set(' user_type ', $user_types) . '
2014-06-26 17:17:35 +02:00
AND username_clean ' . $db -> sql_like_expression ( utf8_clean_string ( $username_chars ) . $db -> get_any_char ());
2014-02-09 21:57:44 +05:30
$result = $db -> sql_query_limit ( $sql , 10 );
2014-04-08 03:54:10 -07:00
$user_list = array ();
2014-02-09 21:57:44 +05:30
while ( $row = $db -> sql_fetchrow ( $result ))
2014-04-08 03:54:10 -07:00
{
$user_list [] = array (
'user_id' => ( int ) $row [ 'user_id' ],
2014-04-08 05:33:24 -07:00
'result' => $row [ 'username' ],
'username_full' => get_username_string ( 'full' , $row [ 'user_id' ], $row [ 'username' ], $row [ 'user_colour' ]),
'display' => get_username_string ( 'no_profile' , $row [ 'user_id' ], $row [ 'username' ], $row [ 'user_colour' ]),
2014-04-08 03:54:10 -07:00
);
2014-02-06 18:32:59 +05:30
}
2014-02-24 00:37:41 +05:30
$db -> sql_freeresult ( $result );
2014-02-21 13:01:22 +05:30
$json_response = new \phpbb\json_response ();
2014-04-08 03:54:10 -07:00
$json_response -> send ( array (
'keyword' => $username_chars ,
'results' => $user_list ,
));
2014-02-06 18:32:59 +05:30
break ;
2014-04-08 03:54:10 -07:00
2004-09-01 15:47:46 +00:00
case 'group' :
2003-03-09 16:14:50 +00:00
default :
// The basic memberlist
$page_title = $user -> lang [ 'MEMBERLIST' ];
$template_html = 'memberlist_body.html' ;
2015-01-03 11:39:29 +01:00
/* @var $pagination \phpbb\pagination */
2013-12-12 14:44:14 +01:00
$pagination = $phpbb_container -> get ( 'pagination' );
2003-03-05 00:50:03 +00:00
2003-03-09 16:14:50 +00:00
// Sorting
2014-07-08 00:42:01 +02:00
$sort_key_text = array ( 'a' => $user -> lang [ 'SORT_USERNAME' ], 'c' => $user -> lang [ 'SORT_JOINED' ], 'd' => $user -> lang [ 'SORT_POST_COUNT' ]);
$sort_key_sql = array ( 'a' => 'u.username_clean' , 'c' => 'u.user_regdate' , 'd' => 'u.user_posts' );
if ( $config [ 'jab_enable' ])
{
$sort_key_text [ 'k' ] = $user -> lang [ 'JABBER' ];
$sort_key_sql [ 'k' ] = 'u.user_jabber' ;
}
2006-11-21 18:15:53 +00:00
2008-03-23 17:11:43 +00:00
if ( $auth -> acl_get ( 'a_user' ))
2006-11-21 18:15:53 +00:00
{
2008-03-23 17:11:43 +00:00
$sort_key_text [ 'e' ] = $user -> lang [ 'SORT_EMAIL' ];
$sort_key_sql [ 'e' ] = 'u.user_email' ;
2006-11-21 18:15:53 +00:00
}
if ( $auth -> acl_get ( 'u_viewonline' ))
{
2008-03-23 17:11:43 +00:00
$sort_key_text [ 'l' ] = $user -> lang [ 'SORT_LAST_ACTIVE' ];
2006-11-21 18:15:53 +00:00
$sort_key_sql [ 'l' ] = 'u.user_lastvisit' ;
}
2008-03-23 17:11:43 +00:00
$sort_key_text [ 'm' ] = $user -> lang [ 'SORT_RANK' ];
2008-04-21 14:43:03 +00:00
$sort_key_sql [ 'm' ] = 'u.user_rank' ;
2003-03-09 16:14:50 +00:00
$sort_dir_text = array ( 'a' => $user -> lang [ 'ASCENDING' ], 'd' => $user -> lang [ 'DESCENDING' ]);
2003-03-17 00:53:38 +00:00
$s_sort_key = '' ;
2003-03-09 16:14:50 +00:00
foreach ( $sort_key_text as $key => $value )
2003-03-05 00:50:03 +00:00
{
2003-03-09 16:14:50 +00:00
$selected = ( $sort_key == $key ) ? ' selected="selected"' : '' ;
$s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>' ;
}
2003-03-05 00:50:03 +00:00
2003-03-17 00:53:38 +00:00
$s_sort_dir = '' ;
2003-03-09 16:14:50 +00:00
foreach ( $sort_dir_text as $key => $value )
{
$selected = ( $sort_dir == $key ) ? ' selected="selected"' : '' ;
$s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>' ;
}
2003-03-05 00:50:03 +00:00
2003-04-15 23:42:06 +00:00
// Additional sorting options for user search ... if search is enabled, if not
// then only admins can make use of this (for ACP functionality)
2007-02-28 22:14:23 +00:00
$sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = '' ;
2006-06-06 20:53:46 +00:00
2007-10-03 15:05:54 +00:00
2015-01-04 20:41:04 +01:00
$form = $request -> variable ( 'form' , '' );
$field = $request -> variable ( 'field' , '' );
$select_single = $request -> variable ( 'select_single' , false );
2007-09-22 18:31:50 +00:00
2008-10-11 18:44:53 +00:00
// Search URL parameters, if any of these are in the URL we do a search
2014-03-05 22:13:22 +01:00
$search_params = array ( 'username' , 'email' , 'jabber' , 'search_group_id' , 'joined_select' , 'active_select' , 'count_select' , 'joined' , 'active' , 'count' , 'ip' );
2008-10-11 18:44:53 +00:00
2007-09-22 18:31:50 +00:00
// We validate form and field here, only id/class allowed
$form = ( ! preg_match ( '/^[a-z0-9_-]+$/i' , $form )) ? '' : $form ;
$field = ( ! preg_match ( '/^[a-z0-9_-]+$/i' , $field )) ? '' : $field ;
2017-06-28 00:58:03 +07:00
if ((( $mode == '' || $mode == 'searchuser' ) || count ( array_intersect ( $request -> variable_names ( \phpbb\request\request_interface :: GET ), $search_params )) > 0 ) && ( $config [ 'load_search' ] || $auth -> acl_get ( 'a_' )))
2003-03-09 16:14:50 +00:00
{
2015-01-04 20:41:04 +01:00
$username = $request -> variable ( 'username' , '' , true );
$email = strtolower ( $request -> variable ( 'email' , '' ));
$jabber = $request -> variable ( 'jabber' , '' );
$search_group_id = $request -> variable ( 'search_group_id' , 0 );
2009-11-07 15:11:40 +00:00
// when using these, make sure that we actually have values defined in $find_key_match
2015-01-04 20:41:04 +01:00
$joined_select = $request -> variable ( 'joined_select' , 'lt' );
$active_select = $request -> variable ( 'active_select' , 'lt' );
$count_select = $request -> variable ( 'count_select' , 'eq' );
2009-11-07 15:11:40 +00:00
2015-01-04 20:41:04 +01:00
$joined = explode ( '-' , $request -> variable ( 'joined' , '' ));
$active = explode ( '-' , $request -> variable ( 'active' , '' ));
$count = ( $request -> variable ( 'count' , '' ) !== '' ) ? $request -> variable ( 'count' , 0 ) : '' ;
$ipdomain = $request -> variable ( 'ip' , '' );
2003-10-12 11:59:23 +00:00
2003-03-09 16:14:50 +00:00
$find_key_match = array ( 'lt' => '<' , 'gt' => '>' , 'eq' => '=' );
$find_count = array ( 'lt' => $user -> lang [ 'LESS_THAN' ], 'eq' => $user -> lang [ 'EQUAL_TO' ], 'gt' => $user -> lang [ 'MORE_THAN' ]);
$s_find_count = '' ;
foreach ( $find_count as $key => $value )
{
$selected = ( $count_select == $key ) ? ' selected="selected"' : '' ;
$s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>' ;
}
$find_time = array ( 'lt' => $user -> lang [ 'BEFORE' ], 'gt' => $user -> lang [ 'AFTER' ]);
$s_find_join_time = '' ;
foreach ( $find_time as $key => $value )
{
$selected = ( $joined_select == $key ) ? ' selected="selected"' : '' ;
$s_find_join_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>' ;
}
$s_find_active_time = '' ;
foreach ( $find_time as $key => $value )
{
$selected = ( $active_select == $key ) ? ' selected="selected"' : '' ;
$s_find_active_time .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>' ;
}
2014-06-26 17:17:35 +02:00
$sql_where .= ( $username ) ? ' AND u.username_clean ' . $db -> sql_like_expression ( str_replace ( '*' , $db -> get_any_char (), utf8_clean_string ( $username ))) : '' ;
$sql_where .= ( $auth -> acl_get ( 'a_user' ) && $email ) ? ' AND u.user_email ' . $db -> sql_like_expression ( str_replace ( '*' , $db -> get_any_char (), $email )) . ' ' : '' ;
$sql_where .= ( $jabber ) ? ' AND u.user_jabber ' . $db -> sql_like_expression ( str_replace ( '*' , $db -> get_any_char (), $jabber )) . ' ' : '' ;
2009-11-07 13:33:19 +00:00
$sql_where .= ( is_numeric ( $count ) && isset ( $find_key_match [ $count_select ])) ? ' AND u.user_posts ' . $find_key_match [ $count_select ] . ' ' . ( int ) $count . ' ' : '' ;
2011-03-07 03:55:29 +01:00
2017-06-28 00:58:03 +07:00
if ( isset ( $find_key_match [ $joined_select ]) && count ( $joined ) == 3 )
2011-03-07 03:55:29 +01:00
{
$joined_time = gmmktime ( 0 , 0 , 0 , ( int ) $joined [ 1 ], ( int ) $joined [ 2 ], ( int ) $joined [ 0 ]);
2011-03-20 23:09:24 +01:00
if ( $joined_time !== false )
2011-03-07 03:55:29 +01:00
{
$sql_where .= " AND u.user_regdate " . $find_key_match [ $joined_select ] . ' ' . $joined_time ;
}
}
2017-06-28 00:58:03 +07:00
if ( isset ( $find_key_match [ $active_select ]) && count ( $active ) == 3 && $auth -> acl_get ( 'u_viewonline' ))
2011-03-07 03:55:29 +01:00
{
$active_time = gmmktime ( 0 , 0 , 0 , ( int ) $active [ 1 ], ( int ) $active [ 2 ], ( int ) $active [ 0 ]);
2011-03-20 23:09:24 +01:00
if ( $active_time !== false )
2011-03-07 03:55:29 +01:00
{
$sql_where .= " AND u.user_lastvisit " . $find_key_match [ $active_select ] . ' ' . $active_time ;
}
}
2007-04-28 14:02:51 +00:00
$sql_where .= ( $search_group_id ) ? " AND u.user_id = ug.user_id AND ug.group_id = $search_group_id AND ug.user_pending = 0 " : '' ;
2006-06-06 20:53:46 +00:00
2005-08-19 10:48:39 +00:00
if ( $search_group_id )
{
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ' ;
}
2003-03-09 16:14:50 +00:00
2006-06-10 23:53:20 +00:00
if ( $ipdomain && $auth -> acl_getf_global ( 'm_info' ))
2003-03-09 16:14:50 +00:00
{
2006-12-09 23:52:40 +00:00
if ( strspn ( $ipdomain , 'abcdefghijklmnopqrstuvwxyz' ))
2003-03-09 16:14:50 +00:00
{
2006-07-14 12:59:55 +00:00
$hostnames = gethostbynamel ( $ipdomain );
if ( $hostnames !== false )
2003-03-09 16:14:50 +00:00
{
2006-07-14 12:59:55 +00:00
$ips = " ' " . implode ( '\', \'' , array_map ( array ( $db , 'sql_escape' ), preg_replace ( '#([0-9]{1,3}\.[0-9]{1,3}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#' , " \\ 1 " , gethostbynamel ( $ipdomain )))) . " ' " ;
}
else
{
$ips = false ;
2003-03-09 16:14:50 +00:00
}
}
else
2006-07-14 12:59:55 +00:00
{
$ips = " ' " . str_replace ( '*' , '%' , $db -> sql_escape ( $ipdomain )) . " ' " ;
}
if ( $ips === false )
2003-03-09 16:14:50 +00:00
{
// A minor fudge but it does the job :D
2006-08-12 13:14:39 +00:00
$sql_where .= " AND u.user_id = 0 " ;
2004-09-01 15:47:46 +00:00
}
2006-07-14 12:59:55 +00:00
else
{
$ip_forums = array_keys ( $auth -> acl_getf ( 'm_info' , true ));
$sql = ' SELECT DISTINCT poster_id
FROM ' . POSTS_TABLE . '
2006-12-09 23:52:40 +00:00
WHERE poster_ip ' . ((strpos($ips, ' % ') !== false) ? ' LIKE ' : ' IN ' ) . " ( $ips )
2010-03-11 16:03:14 +01:00
AND " . $db->sql_in_set ('forum_id', $ip_forums );
2015-08-18 21:44:23 +07:00
/**
* Modify sql query for members search by ip address / hostname
*
* @ event core . memberlist_modify_ip_search_sql_query
* @ var string ipdomain The host name
* @ var string ips IP address list for the given host name
* @ var string sql The SQL query for searching members by IP address
* @ since 3.1 . 7 - RC1
*/
$vars = array (
'ipdomain' ,
'ips' ,
'sql' ,
);
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_modify_ip_search_sql_query' , compact ( $vars )));
2006-07-14 12:59:55 +00:00
$result = $db -> sql_query ( $sql );
if ( $row = $db -> sql_fetchrow ( $result ))
{
$ip_sql = array ();
do
{
$ip_sql [] = $row [ 'poster_id' ];
}
while ( $row = $db -> sql_fetchrow ( $result ));
2006-08-12 13:14:39 +00:00
$sql_where .= ' AND ' . $db -> sql_in_set ( 'u.user_id' , $ip_sql );
2006-07-14 12:59:55 +00:00
}
else
{
// A minor fudge but it does the job :D
2006-08-12 13:14:39 +00:00
$sql_where .= " AND u.user_id = 0 " ;
2006-07-14 12:59:55 +00:00
}
unset ( $ip_forums );
$db -> sql_freeresult ( $result );
}
2004-09-01 15:47:46 +00:00
}
}
2015-01-04 20:41:04 +01:00
$first_char = $request -> variable ( 'first_char' , '' );
2005-06-10 19:07:17 +00:00
if ( $first_char == 'other' )
{
2006-10-29 14:59:19 +00:00
for ( $i = 97 ; $i < 123 ; $i ++ )
2005-06-10 19:07:17 +00:00
{
2014-06-26 17:17:35 +02:00
$sql_where .= ' AND u.username_clean NOT ' . $db -> sql_like_expression ( chr ( $i ) . $db -> get_any_char ());
2005-06-10 19:07:17 +00:00
}
}
else if ( $first_char )
{
2014-06-26 17:17:35 +02:00
$sql_where .= ' AND u.username_clean ' . $db -> sql_like_expression ( substr ( $first_char , 0 , 1 ) . $db -> get_any_char ());
2005-06-10 19:07:17 +00:00
}
2005-12-30 16:52:29 +00:00
2004-09-01 15:47:46 +00:00
// Are we looking at a usergroup? If so, fetch additional info
// and further restrict the user info query
if ( $mode == 'group' )
{
2005-06-10 19:07:17 +00:00
// We JOIN here to save a query for determining membership for hidden groups. ;)
2015-11-14 06:10:41 -05:00
$sql = ' SELECT g .* , ug . user_id , ug . group_leader
2005-06-10 19:07:17 +00:00
FROM ' . GROUPS_TABLE . ' g
2006-06-22 15:14:03 +00:00
LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON ( ug . user_pending = 0 AND ug . user_id = ' . $user->data[' user_id ' ] . " AND ug.group_id = $group_id )
2005-06-10 19:07:17 +00:00
WHERE g . group_id = $group_id " ;
2004-09-01 15:47:46 +00:00
$result = $db -> sql_query ( $sql );
2006-06-06 20:53:46 +00:00
$group_row = $db -> sql_fetchrow ( $result );
$db -> sql_freeresult ( $result );
2004-09-01 15:47:46 +00:00
2006-06-06 20:53:46 +00:00
if ( ! $group_row )
2004-09-01 15:47:46 +00:00
{
2005-04-30 14:36:33 +00:00
trigger_error ( 'NO_GROUP' );
2004-09-01 15:47:46 +00:00
}
2005-06-10 19:07:17 +00:00
switch ( $group_row [ 'group_type' ])
2004-09-01 15:47:46 +00:00
{
case GROUP_OPEN :
2005-08-19 10:48:39 +00:00
$group_row [ 'l_group_type' ] = 'OPEN' ;
2006-06-06 20:53:46 +00:00
break ;
2004-09-01 15:47:46 +00:00
case GROUP_CLOSED :
2005-08-19 10:48:39 +00:00
$group_row [ 'l_group_type' ] = 'CLOSED' ;
2006-06-06 20:53:46 +00:00
break ;
2004-09-01 15:47:46 +00:00
case GROUP_HIDDEN :
2005-08-19 10:48:39 +00:00
$group_row [ 'l_group_type' ] = 'HIDDEN' ;
2005-06-10 19:07:17 +00:00
// Check for membership or special permissions
if ( ! $auth -> acl_gets ( 'a_group' , 'a_groupadd' , 'a_groupdel' ) && $group_row [ 'user_id' ] != $user -> data [ 'user_id' ])
{
trigger_error ( 'NO_GROUP' );
}
2006-06-06 20:53:46 +00:00
break ;
2004-09-01 15:47:46 +00:00
case GROUP_SPECIAL :
2005-08-19 10:48:39 +00:00
$group_row [ 'l_group_type' ] = 'SPECIAL' ;
2006-06-06 20:53:46 +00:00
break ;
2004-09-01 15:47:46 +00:00
case GROUP_FREE :
2005-08-19 10:48:39 +00:00
$group_row [ 'l_group_type' ] = 'FREE' ;
2006-06-06 20:53:46 +00:00
break ;
2004-09-01 15:47:46 +00:00
}
2013-01-04 15:10:43 +01:00
$avatar_img = phpbb_get_group_avatar ( $group_row );
2004-09-01 15:47:46 +00:00
2012-02-18 23:31:31 +01:00
// ... same for group rank
2014-08-19 22:25:01 +02:00
$user_rank_data = array (
'title' => null ,
'img' => null ,
'img_src' => null ,
);
- renamed the following columns:
comment -> attach_comment
new, forwarded, unread, marked, deleted -> pm_new, pm_forwarded, pm_unread, pm_marked, pm_deleted
module_name -> module_basename
value -> lang_value
- every column is now NOT NULL
- every column is now having a DEFAULT value
- hopefully mostly consistent across every db schema
- untested schemas: sqlite, oracle, firebird
git-svn-id: file:///svn/phpbb/trunk@6177 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-07-13 12:51:56 +00:00
if ( $group_row [ 'group_rank' ])
2004-09-01 15:47:46 +00:00
{
2014-08-19 22:25:01 +02:00
$user_rank_data = phpbb_get_user_rank ( $group_row , false );
2012-02-18 23:31:31 +01:00
2014-10-27 10:00:24 +01:00
if ( $user_rank_data [ 'img' ])
2006-02-04 23:02:38 +00:00
{
2014-10-27 10:00:24 +01:00
$user_rank_data [ 'img' ] .= '<br />' ;
2006-02-04 23:02:38 +00:00
}
2004-09-01 15:47:46 +00:00
}
2015-11-14 06:10:41 -05:00
// include modules for manage groups link display or not
2015-11-14 14:48:54 -05:00
// need to ensure the module is active
2015-11-14 06:10:41 -05:00
$can_manage_group = false ;
2015-11-25 06:02:53 -05:00
if ( $user -> data [ 'is_registered' ] && $group_row [ 'group_leader' ])
2015-11-14 06:10:41 -05:00
{
2015-11-18 06:29:23 -05:00
if ( ! class_exists ( 'p_master' ))
{
include ( $phpbb_root_path . 'includes/functions_module.' . $phpEx );
}
$module = new p_master ;
$module -> list_modules ( 'ucp' );
2015-11-25 06:02:53 -05:00
if ( $module -> is_active ( 'ucp_groups' , 'manage' ))
2015-11-18 06:29:23 -05:00
{
$can_manage_group = true ;
}
unset ( $module );
2015-11-14 06:10:41 -05:00
}
2004-09-01 15:47:46 +00:00
$template -> assign_vars ( array (
2006-07-17 03:23:31 +00:00
'GROUP_DESC' => generate_text_for_display ( $group_row [ 'group_desc' ], $group_row [ 'group_desc_uid' ], $group_row [ 'group_desc_bitfield' ], $group_row [ 'group_desc_options' ]),
2015-05-29 14:40:23 +02:00
'GROUP_NAME' => $group_helper -> get_name ( $group_row [ 'group_name' ]),
2005-06-10 19:07:17 +00:00
'GROUP_COLOR' => $group_row [ 'group_colour' ],
2005-08-19 10:48:39 +00:00
'GROUP_TYPE' => $user -> lang [ 'GROUP_IS_' . $group_row [ 'l_group_type' ]],
2014-08-19 22:25:01 +02:00
'GROUP_RANK' => $user_rank_data [ 'title' ],
2004-09-01 15:47:46 +00:00
'AVATAR_IMG' => $avatar_img ,
2014-08-19 22:25:01 +02:00
'RANK_IMG' => $user_rank_data [ 'img' ],
'RANK_IMG_SRC' => $user_rank_data [ 'img_src' ],
2004-09-01 15:47:46 +00:00
2015-11-14 06:10:41 -05:00
'U_PM' => ( $auth -> acl_get ( 'u_sendpm' ) && $auth -> acl_get ( 'u_masspm_group' ) && $group_row [ 'group_receive_pm' ] && $config [ 'allow_privmsg' ] && $config [ 'allow_mass_pm' ]) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=pm&mode=compose&g=' . $group_id ) : '' ,
'U_MANAGE' => ( $can_manage_group ) ? append_sid ( " { $phpbb_root_path } ucp. $phpEx " , 'i=ucp_groups&mode=manage' ) : false ,)
2004-09-01 15:47:46 +00:00
);
2005-06-10 19:07:17 +00:00
$sql_select = ', ug.group_leader' ;
2004-09-01 15:47:46 +00:00
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ' ;
2005-06-10 19:07:17 +00:00
$order_by = 'ug.group_leader DESC, ' ;
2006-06-22 15:14:03 +00:00
$sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id " ;
2007-03-14 23:25:27 +00:00
$sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = $group_id " ;
2003-03-09 16:14:50 +00:00
}
2008-09-01 21:33:12 +00:00
2003-03-09 16:14:50 +00:00
// Sorting and order
2006-10-30 16:20:11 +00:00
if ( ! isset ( $sort_key_sql [ $sort_key ]))
{
$sort_key = $default_key ;
}
2007-01-26 16:09:51 +00:00
$order_by .= $sort_key_sql [ $sort_key ] . ' ' . (( $sort_dir == 'a' ) ? 'ASC' : 'DESC' );
2003-03-05 00:50:03 +00:00
2008-04-21 14:43:03 +00:00
// Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly
if ( $sort_key == 'm' )
{
$order_by .= ', u.user_posts DESC' ;
}
2015-08-18 21:44:23 +07:00
/**
* Modify sql query data for members search
*
* @ event core . memberlist_modify_sql_query_data
* @ var string order_by SQL ORDER BY clause condition
* @ var string sort_dir The sorting direction
* @ var string sort_key The sorting key
* @ var array sort_key_sql Arraty with the sorting conditions data
* @ var string sql_from SQL FROM clause condition
* @ var string sql_select SQL SELECT fields list
* @ var string sql_where SQL WHERE clause condition
* @ var string sql_where_data SQL WHERE clause additional conditions data
* @ since 3.1 . 7 - RC1
*/
$vars = array (
'order_by' ,
'sort_dir' ,
'sort_key' ,
'sort_key_sql' ,
'sql_from' ,
'sql_select' ,
'sql_where' ,
'sql_where_data' ,
);
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_modify_sql_query_data' , compact ( $vars )));
2016-01-22 06:03:42 -05:00
// Count the users ...
$sql = ' SELECT COUNT ( u . user_id ) AS total_users
FROM ' . USERS_TABLE . " u $sql_from
WHERE " . $db->sql_in_set ('u.user_type', $user_types ) . "
$sql_where " ;
$result = $db -> sql_query ( $sql );
$total_users = ( int ) $db -> sql_fetchfield ( 'total_users' );
$db -> sql_freeresult ( $result );
2003-03-09 16:14:50 +00:00
2003-04-20 14:36:52 +00:00
// Build a relevant pagination_url
2007-02-05 16:24:15 +00:00
$params = $sort_params = array ();
2007-08-30 21:21:16 +00:00
2015-02-03 20:56:48 +01:00
// We do not use $request->variable() here directly to save some calls (not all variables are set)
2007-08-30 21:21:16 +00:00
$check_params = array (
'g' => array ( 'g' , 0 ),
'sk' => array ( 'sk' , $default_key ),
'sd' => array ( 'sd' , 'a' ),
'form' => array ( 'form' , '' ),
'field' => array ( 'field' , '' ),
2008-03-18 13:29:57 +00:00
'select_single' => array ( 'select_single' , $select_single ),
2007-08-30 21:21:16 +00:00
'username' => array ( 'username' , '' , true ),
'email' => array ( 'email' , '' ),
'jabber' => array ( 'jabber' , '' ),
'search_group_id' => array ( 'search_group_id' , 0 ),
'joined_select' => array ( 'joined_select' , 'lt' ),
'active_select' => array ( 'active_select' , 'lt' ),
'count_select' => array ( 'count_select' , 'eq' ),
'joined' => array ( 'joined' , '' ),
'active' => array ( 'active' , '' ),
2015-01-04 20:41:04 +01:00
'count' => ( $request -> variable ( 'count' , '' ) !== '' ) ? array ( 'count' , 0 ) : array ( 'count' , '' ),
2009-06-26 11:34:27 +00:00
'ip' => array ( 'ip' , '' ),
2007-08-30 21:21:16 +00:00
'first_char' => array ( 'first_char' , '' ),
);
2011-07-14 22:29:27 +02:00
$u_first_char_params = array ();
2007-08-30 21:21:16 +00:00
foreach ( $check_params as $key => $call )
2003-03-09 16:14:50 +00:00
{
2007-08-30 21:21:16 +00:00
if ( ! isset ( $_REQUEST [ $key ]))
2003-03-17 00:53:38 +00:00
{
2007-08-30 21:21:16 +00:00
continue ;
}
2006-06-22 15:14:03 +00:00
2015-01-04 20:41:04 +01:00
$param = call_user_func_array ( array ( $request , 'variable' ), $call );
2016-03-18 12:30:16 +01:00
// Encode strings, convert everything else to int in order to prevent empty parameters.
$param = urlencode ( $key ) . '=' . (( is_string ( $param )) ? urlencode ( $param ) : ( int ) $param );
2007-08-30 21:21:16 +00:00
$params [] = $param ;
2007-02-05 16:24:15 +00:00
2011-07-14 22:29:27 +02:00
if ( $key != 'first_char' )
{
$u_first_char_params [] = $param ;
}
2007-08-30 21:21:16 +00:00
if ( $key != 'sk' && $key != 'sd' )
{
$sort_params [] = $param ;
2003-03-17 00:53:38 +00:00
}
2003-04-20 14:36:52 +00:00
}
2003-03-17 00:53:38 +00:00
2008-10-11 18:44:53 +00:00
$u_hide_find_member = append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , " start= $start " . ( ! empty ( $params ) ? '&' . implode ( '&' , $params ) : '' ));
2006-06-06 20:53:46 +00:00
2008-10-11 18:44:53 +00:00
if ( $mode )
{
$params [] = " mode= $mode " ;
2012-03-12 00:39:12 +01:00
$u_first_char_params [] = " mode= $mode " ;
2008-10-11 18:44:53 +00:00
}
2008-11-09 15:48:37 +00:00
$sort_params [] = " mode= $mode " ;
2006-06-06 20:53:46 +00:00
$pagination_url = append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , implode ( '&' , $params ));
2007-02-05 16:24:15 +00:00
$sort_url = append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , implode ( '&' , $sort_params ));
2008-10-11 18:44:53 +00:00
unset ( $search_params , $sort_params );
2005-06-10 19:07:17 +00:00
2011-07-14 22:29:27 +02:00
$u_first_char_params = implode ( '&' , $u_first_char_params );
$u_first_char_params .= ( $u_first_char_params ) ? '&' : '' ;
$first_characters = array ();
$first_characters [ '' ] = $user -> lang [ 'ALL' ];
for ( $i = 97 ; $i < 123 ; $i ++ )
{
$first_characters [ chr ( $i )] = chr ( $i - 32 );
}
$first_characters [ 'other' ] = $user -> lang [ 'OTHER' ];
foreach ( $first_characters as $char => $desc )
{
$template -> assign_block_vars ( 'first_char' , array (
'DESC' => $desc ,
'VALUE' => $char ,
'S_SELECTED' => ( $first_char == $char ) ? true : false ,
'U_SORT' => append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , $u_first_char_params . 'first_char=' . $char ) . '#memberlist' ,
));
}
2003-04-20 14:36:52 +00:00
// Some search user specific data
2012-06-26 00:37:48 -04:00
if (( $mode == '' || $mode == 'searchuser' ) && ( $config [ 'load_search' ] || $auth -> acl_get ( 'a_' )))
2003-04-20 14:36:52 +00:00
{
2015-01-04 20:41:04 +01:00
$group_selected = $request -> variable ( 'search_group_id' , 0 );
2005-08-19 10:48:39 +00:00
$s_group_select = '<option value="0"' . (( ! $group_selected ) ? ' selected="selected"' : '' ) . '> </option>' ;
2008-03-13 14:47:57 +00:00
$group_ids = array ();
2005-08-19 10:48:39 +00:00
2008-11-22 18:13:18 +00:00
/**
* @ todo add this to a separate function ( function is responsible for returning the groups the user is able to see based on the users group membership )
*/
2007-04-30 13:32:18 +00:00
if ( $auth -> acl_gets ( 'a_group' , 'a_groupadd' , 'a_groupdel' ))
{
$sql = ' SELECT group_id , group_name , group_type
2008-11-22 18:13:18 +00:00
FROM ' . GROUPS_TABLE ;
if ( ! $config [ 'coppa_enable' ])
{
$sql .= " WHERE group_name <> 'REGISTERED_COPPA' " ;
}
$sql .= ' ORDER BY group_name ASC' ;
2007-04-30 13:32:18 +00:00
}
else
{
$sql = ' SELECT g . group_id , g . group_name , g . group_type
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g . group_id = ug . group_id
AND ug . user_id = ' . $user->data[' user_id '] . '
AND ug . user_pending = 0
)
2008-11-22 18:13:18 +00:00
WHERE ( g . group_type <> ' . GROUP_HIDDEN . ' OR ug . user_id = ' . $user->data[' user_id '] . ' ) ' ;
if ( ! $config [ 'coppa_enable' ])
{
2008-12-02 18:48:25 +00:00
$sql .= " AND g.group_name <> 'REGISTERED_COPPA' " ;
2008-11-22 18:13:18 +00:00
}
$sql .= ' ORDER BY g.group_name ASC' ;
2007-04-30 13:32:18 +00:00
}
2005-08-19 10:48:39 +00:00
$result = $db -> sql_query ( $sql );
while ( $row = $db -> sql_fetchrow ( $result ))
{
2008-03-13 14:47:57 +00:00
$group_ids [] = $row [ 'group_id' ];
2015-05-28 17:31:21 +02:00
$s_group_select .= '<option value="' . $row [ 'group_id' ] . '"' . (( $group_selected == $row [ 'group_id' ]) ? ' selected="selected"' : '' ) . '>' . $group_helper -> get_name ( $row [ 'group_name' ]) . '</option>' ;
2005-08-19 10:48:39 +00:00
}
$db -> sql_freeresult ( $result );
2008-03-13 14:47:57 +00:00
if ( $group_selected !== 0 && ! in_array ( $group_selected , $group_ids ))
{
trigger_error ( 'NO_GROUP' );
}
2003-03-09 16:14:50 +00:00
$template -> assign_vars ( array (
'USERNAME' => $username ,
'EMAIL' => $email ,
2004-10-30 17:02:41 +00:00
'JABBER' => $jabber ,
2003-03-09 16:14:50 +00:00
'JOINED' => implode ( '-' , $joined ),
'ACTIVE' => implode ( '-' , $active ),
2004-09-01 15:47:46 +00:00
'COUNT' => $count ,
'IP' => $ipdomain ,
2003-03-09 16:14:50 +00:00
2007-05-13 10:19:50 +00:00
'S_IP_SEARCH_ALLOWED' => ( $auth -> acl_getf_global ( 'm_info' )) ? true : false ,
2008-03-23 17:11:43 +00:00
'S_EMAIL_SEARCH_ALLOWED' => ( $auth -> acl_get ( 'a_user' )) ? true : false ,
2014-07-07 11:25:33 +02:00
'S_JABBER_ENABLED' => $config [ 'jab_enable' ],
2007-05-12 09:11:10 +00:00
'S_IN_SEARCH_POPUP' => ( $form && $field ) ? true : false ,
2012-06-26 00:37:48 -04:00
'S_SEARCH_USER' => ( $mode == 'searchuser' || ( $mode == '' && $submit )),
2006-06-06 20:53:46 +00:00
'S_FORM_NAME' => $form ,
'S_FIELD_NAME' => $field ,
2007-01-17 18:41:49 +00:00
'S_SELECT_SINGLE' => $select_single ,
2006-06-06 20:53:46 +00:00
'S_COUNT_OPTIONS' => $s_find_count ,
'S_SORT_OPTIONS' => $s_sort_key ,
'S_JOINED_TIME_OPTIONS' => $s_find_join_time ,
'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time ,
2005-08-19 10:48:39 +00:00
'S_GROUP_SELECT' => $s_group_select ,
2007-07-19 20:38:38 +00:00
'S_USER_SEARCH_ACTION' => append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , " mode=searchuser&form= $form &field= $field " ))
2003-03-09 16:14:50 +00:00
);
2003-02-22 17:18:44 +00:00
}
2003-03-09 16:14:50 +00:00
2016-01-22 06:03:42 -05:00
$start = $pagination -> validate_start ( $start , $config [ 'topics_per_page' ], $total_users );
2013-12-12 14:44:14 +01:00
2007-02-28 22:14:23 +00:00
// Get us some users :D
$sql = " SELECT u.user_id
2005-06-10 19:07:17 +00:00
FROM " . USERS_TABLE . " u
$sql_from
2015-10-10 15:57:33 +02:00
WHERE " . $db->sql_in_set ('u.user_type', $user_types ) . "
2007-03-01 21:52:19 +00:00
$sql_where
ORDER BY $order_by " ;
2003-03-25 00:05:28 +00:00
$result = $db -> sql_query_limit ( $sql , $config [ 'topics_per_page' ], $start );
2003-03-09 16:14:50 +00:00
2007-02-28 22:14:23 +00:00
$user_list = array ();
2005-04-30 14:36:33 +00:00
while ( $row = $db -> sql_fetchrow ( $result ))
{
2007-02-28 22:14:23 +00:00
$user_list [] = ( int ) $row [ 'user_id' ];
2005-04-30 14:36:33 +00:00
}
$db -> sql_freeresult ( $result );
2014-02-06 16:32:25 +01:00
// Load custom profile fields
if ( $config [ 'load_cpf_memberlist' ])
{
2015-01-03 11:39:29 +01:00
/* @var $cp \phpbb\profilefields\manager */
2014-02-06 16:32:25 +01:00
$cp = $phpbb_container -> get ( 'profilefields.manager' );
2014-02-10 19:04:10 +01:00
$cp_row = $cp -> generate_profile_fields_template_headlines ( 'field_show_on_ml' );
2014-02-06 16:32:25 +01:00
foreach ( $cp_row as $profile_field )
{
$template -> assign_block_vars ( 'custom_fields' , $profile_field );
}
}
2008-08-14 12:36:06 +00:00
$leaders_set = false ;
2007-02-28 22:14:23 +00:00
// So, did we get any users?
2017-06-28 00:58:03 +07:00
if ( count ( $user_list ))
2007-01-17 18:41:49 +00:00
{
2007-02-28 22:14:23 +00:00
// Session time?! Session time...
$sql = ' SELECT session_user_id , MAX ( session_time ) AS session_time
FROM ' . SESSIONS_TABLE . '
WHERE session_time >= ' . (time() - $config[' session_length ']) . '
AND ' . $db->sql_in_set(' session_user_id ', $user_list) . '
GROUP BY session_user_id ' ;
$result = $db -> sql_query ( $sql );
2007-01-17 18:41:49 +00:00
2007-02-28 22:14:23 +00:00
$session_times = array ();
while ( $row = $db -> sql_fetchrow ( $result ))
2003-03-09 16:14:50 +00:00
{
2007-02-28 22:14:23 +00:00
$session_times [ $row [ 'session_user_id' ]] = $row [ 'session_time' ];
2005-04-30 14:36:33 +00:00
}
2007-02-28 22:14:23 +00:00
$db -> sql_freeresult ( $result );
2003-03-10 17:48:08 +00:00
2007-02-28 22:14:23 +00:00
// Do the SQL thang
2007-04-28 14:02:51 +00:00
if ( $mode == 'group' )
{
2018-12-29 11:43:23 +01:00
$sql_from_ary = explode ( ',' , $sql_from );
$extra_tables = [];
foreach ( $sql_from_ary as $entry )
{
$table_data = explode ( ' ' , trim ( $entry ));
if ( empty ( $table_data [ 0 ]) || empty ( $table_data [ 1 ]))
{
continue ;
}
$extra_tables [ $table_data [ 0 ]] = $table_data [ 1 ];
}
2018-11-30 04:02:13 +01:00
$sql_array = array (
'SELECT' => 'u.*' . $sql_select ,
2018-12-29 11:43:23 +01:00
'FROM' => array_merge ([ USERS_TABLE => 'u' ], $extra_tables ),
2018-11-30 04:02:13 +01:00
'WHERE' => $db -> sql_in_set ( 'u.user_id' , $user_list ) . $sql_where_data . '' ,
);
2007-04-28 14:02:51 +00:00
}
else
{
2018-11-30 04:02:13 +01:00
$sql_array = array (
2018-11-30 09:11:35 +01:00
'SELECT' => 'u.*' ,
2018-11-30 04:02:13 +01:00
'FROM' => array (
USERS_TABLE => 'u'
),
'WHERE' => $db -> sql_in_set ( 'u.user_id' , $user_list ),
);
2007-04-28 14:02:51 +00:00
}
2018-11-30 04:02:13 +01:00
/**
* Modify user data SQL before member row is created
*
* @ event core . memberlist_modify_memberrow_sql
* @ var string mode group
* @ var string sql_select Additional select statement
* @ var string sql_from Additional from statement
* @ var array sql_array Array containing the main query
2018-11-30 08:40:17 +01:00
* @ var array user_list Array containing list of users
2018-11-30 04:02:13 +01:00
* @ since 3.2 . 6 - RC1
*/
$vars = array (
'mode' ,
'sql_select' ,
'sql_from' ,
'sql_array' ,
2018-11-30 06:42:20 +01:00
'user_list' ,
2018-11-30 04:02:13 +01:00
);
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_modify_memberrow_sql' , compact ( $vars )));
2018-11-30 08:40:17 +01:00
$sql = $db -> sql_build_query ( 'SELECT' , $sql_array );
$result = $db -> sql_query ( $sql );
$id_cache = array ();
while ( $row = $db -> sql_fetchrow ( $result ))
{
$row [ 'session_time' ] = ( ! empty ( $session_times [ $row [ 'user_id' ]])) ? $session_times [ $row [ 'user_id' ]] : 0 ;
$row [ 'last_visit' ] = ( ! empty ( $row [ 'session_time' ])) ? $row [ 'session_time' ] : $row [ 'user_lastvisit' ];
$id_cache [ $row [ 'user_id' ]] = $row ;
}
2007-02-28 22:14:23 +00:00
$db -> sql_freeresult ( $result );
2007-10-03 15:05:54 +00:00
2018-12-01 00:05:15 +01:00
// Load custom profile fields if required
2007-02-28 22:14:23 +00:00
if ( $config [ 'load_cpf_memberlist' ])
2005-04-30 14:36:33 +00:00
{
2007-02-28 22:14:23 +00:00
// Grab all profile fields from users in id cache for later use - similar to the poster cache
2014-03-04 08:47:47 +01:00
$profile_fields_cache = $cp -> grab_profile_fields_data ( $user_list );
2014-02-06 16:32:25 +01:00
// Filter the fields we don't want to show
foreach ( $profile_fields_cache as $user_id => $user_profile_fields )
{
foreach ( $user_profile_fields as $field_ident => $profile_field )
{
2014-02-10 16:28:21 +01:00
if ( ! $profile_field [ 'data' ][ 'field_show_on_ml' ])
2014-02-06 16:32:25 +01:00
{
unset ( $profile_fields_cache [ $user_id ][ $field_ident ]);
}
}
}
2005-04-30 14:36:33 +00:00
}
2007-02-28 22:14:23 +00:00
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
if ( $sort_key == 'l' )
{
2008-02-01 12:45:05 +00:00
// uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
2014-06-23 22:38:58 +02:00
usort ( $user_list , 'phpbb_sort_last_active' );
2007-02-28 22:14:23 +00:00
}
2003-03-09 16:14:50 +00:00
2015-09-23 18:54:46 +02:00
// do we need to display contact fields as such
$use_contact_fields = false ;
/**
* Modify list of users before member row is created
*
* @ event core . memberlist_memberrow_before
* @ var array user_list Array containing list of users
* @ var bool use_contact_fields Should we display contact fields as such ?
* @ since 3.1 . 7 - RC1
*/
$vars = array ( 'user_list' , 'use_contact_fields' );
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_memberrow_before' , compact ( $vars )));
2017-06-28 00:58:03 +07:00
for ( $i = 0 , $end = count ( $user_list ); $i < $end ; ++ $i )
2005-04-30 14:36:33 +00:00
{
2007-03-01 21:52:19 +00:00
$user_id = $user_list [ $i ];
2011-07-13 11:32:38 +02:00
$row = $id_cache [ $user_id ];
2008-08-14 12:36:06 +00:00
$is_leader = ( isset ( $row [ 'group_leader' ]) && $row [ 'group_leader' ]) ? true : false ;
$leaders_set = ( $leaders_set || $is_leader );
2007-03-01 21:52:19 +00:00
2007-02-28 22:14:23 +00:00
$cp_row = array ();
if ( $config [ 'load_cpf_memberlist' ])
2005-04-30 14:36:33 +00:00
{
2015-09-23 18:54:46 +02:00
$cp_row = ( isset ( $profile_fields_cache [ $user_id ])) ? $cp -> generate_profile_fields_template_data ( $profile_fields_cache [ $user_id ], $use_contact_fields ) : array ();
2005-04-30 14:36:33 +00:00
}
2003-03-05 00:50:03 +00:00
2014-10-27 21:43:10 +07:00
$memberrow = array_merge ( phpbb_show_profile ( $row , false , false , false ), array (
2007-02-28 22:14:23 +00:00
'ROW_NUMBER' => $i + ( $start + 1 ),
2017-06-28 00:58:03 +07:00
'S_CUSTOM_PROFILE' => ( isset ( $cp_row [ 'row' ]) && count ( $cp_row [ 'row' ])) ? true : false ,
2008-08-14 12:36:06 +00:00
'S_GROUP_LEADER' => $is_leader ,
2015-10-10 15:57:33 +02:00
'S_INACTIVE' => $row [ 'user_type' ] == USER_INACTIVE ,
2007-02-28 22:14:23 +00:00
2014-04-01 22:03:59 +02:00
'U_VIEW_PROFILE' => get_username_string ( 'profile' , $user_id , $row [ 'username' ]),
));
2007-02-28 22:14:23 +00:00
2017-06-28 00:58:03 +07:00
if ( isset ( $cp_row [ 'row' ]) && count ( $cp_row [ 'row' ]))
2007-02-28 22:14:23 +00:00
{
$memberrow = array_merge ( $memberrow , $cp_row [ 'row' ]);
}
$template -> assign_block_vars ( 'memberrow' , $memberrow );
2017-06-28 00:58:03 +07:00
if ( isset ( $cp_row [ 'blockrow' ]) && count ( $cp_row [ 'blockrow' ]))
2007-02-28 22:14:23 +00:00
{
foreach ( $cp_row [ 'blockrow' ] as $field_data )
{
$template -> assign_block_vars ( 'memberrow.custom_fields' , $field_data );
}
}
unset ( $id_cache [ $user_id ]);
}
2005-04-30 14:36:33 +00:00
}
2007-10-03 15:05:54 +00:00
2013-12-12 14:44:14 +01:00
$pagination -> generate_template_pagination ( $pagination_url , 'pagination' , 'start' , $total_users , $config [ 'topics_per_page' ], $start );
2012-08-25 14:53:21 +02:00
2005-04-30 14:36:33 +00:00
// Generate page
2017-08-16 21:57:11 +07:00
$template_vars = array (
2011-09-14 00:28:52 +02:00
'TOTAL_USERS' => $user -> lang ( 'LIST_USERS' , ( int ) $total_users ),
2005-04-30 14:36:33 +00:00
2006-08-05 15:49:28 +00:00
'PROFILE_IMG' => $user -> img ( 'icon_user_profile' , $user -> lang [ 'PROFILE' ]),
'PM_IMG' => $user -> img ( 'icon_contact_pm' , $user -> lang [ 'SEND_PRIVATE_MESSAGE' ]),
'EMAIL_IMG' => $user -> img ( 'icon_contact_email' , $user -> lang [ 'EMAIL' ]),
'JABBER_IMG' => $user -> img ( 'icon_contact_jabber' , $user -> lang [ 'JABBER' ]),
'SEARCH_IMG' => $user -> img ( 'icon_user_search' , $user -> lang [ 'SEARCH' ]),
2005-04-30 14:36:33 +00:00
2008-10-11 18:44:53 +00:00
'U_FIND_MEMBER' => ( $config [ 'load_search' ] || $auth -> acl_get ( 'a_' )) ? append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , 'mode=searchuser' . (( $start ) ? " &start= $start " : '' ) . ( ! empty ( $params ) ? '&' . implode ( '&' , $params ) : '' )) : '' ,
2012-04-20 00:19:50 -04:00
'U_HIDE_FIND_MEMBER' => ( $mode == 'searchuser' || ( $mode == '' && $submit )) ? $u_hide_find_member : '' ,
2014-04-11 19:23:31 -07:00
'U_LIVE_SEARCH' => ( $config [ 'allow_live_searches' ]) ? append_sid ( " { $phpbb_root_path } memberlist. $phpEx " , 'mode=livesearch' ) : false ,
2007-02-05 16:24:15 +00:00
'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (( $sort_key == 'a' && $sort_dir == 'a' ) ? 'd' : 'a' ),
2015-10-19 09:53:43 -04:00
'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (( $sort_key == 'c' && $sort_dir == 'd' ) ? 'a' : 'd' ),
2015-10-26 06:31:39 -04:00
'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (( $sort_key == 'd' && $sort_dir == 'd' ) ? 'a' : 'd' ),
2015-10-19 09:53:43 -04:00
'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (( $sort_key == 'e' && $sort_dir == 'd' ) ? 'a' : 'd' ),
'U_SORT_ACTIVE' => ( $auth -> acl_get ( 'u_viewonline' )) ? $sort_url . '&sk=l&sd=' . (( $sort_key == 'l' && $sort_dir == 'd' ) ? 'a' : 'd' ) : '' ,
'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (( $sort_key == 'm' && $sort_dir == 'd' ) ? 'a' : 'd' ),
2015-10-30 13:09:55 -04:00
'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (( $sort_key == 'l' && $sort_dir == 'd' ) ? 'a' : 'd' ),
2005-04-30 14:36:33 +00:00
'S_SHOW_GROUP' => ( $mode == 'group' ) ? true : false ,
2007-06-28 14:55:48 +00:00
'S_VIEWONLINE' => $auth -> acl_get ( 'u_viewonline' ),
2008-08-14 12:36:06 +00:00
'S_LEADERS_SET' => $leaders_set ,
2005-04-30 14:36:33 +00:00
'S_MODE_SELECT' => $s_sort_key ,
'S_ORDER_SELECT' => $s_sort_dir ,
2017-08-16 21:57:11 +07:00
'S_MODE_ACTION' => $pagination_url ,
2005-04-30 14:36:33 +00:00
);
2017-08-16 21:57:11 +07:00
/**
* Modify memberlist page template vars
*
* @ event core . memberlist_modify_template_vars
* @ var array params Array containing URL parameters
* @ var string sort_url Sorting URL base
* @ var array template_vars Array containing template vars
* @ since 3.2 . 2 - RC1
*/
$vars = array ( 'params' , 'sort_url' , 'template_vars' );
extract ( $phpbb_dispatcher -> trigger_event ( 'core.memberlist_modify_template_vars' , compact ( $vars )));
$template -> assign_vars ( $template_vars );
2002-03-31 00:06:34 +00:00
}
2001-07-07 00:57:58 +00:00
2003-03-08 22:10:24 +00:00
// Output the page
2014-03-19 19:55:55 +05:30
page_header ( $page_title );
2003-03-08 22:10:24 +00:00
$template -> set_filenames ( array (
2003-03-09 16:14:50 +00:00
'body' => $template_html )
2003-03-08 22:10:24 +00:00
);
2006-06-06 20:53:46 +00:00
make_jumpbox ( append_sid ( " { $phpbb_root_path } viewforum. $phpEx " ));
2003-03-08 22:10:24 +00:00
2003-05-03 23:58:45 +00:00
page_footer ();