mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 01:42:29 +02:00
fixes #1162 filter users on a specific group
This commit is contained in:
@@ -16,6 +16,8 @@ check_status(ACCESS_ADMINISTRATOR);
|
||||
check_input_parameter('iDisplayStart', $_REQUEST, false, PATTERN_ID);
|
||||
check_input_parameter('iDisplayLength', $_REQUEST, false, PATTERN_ID);
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
@@ -91,11 +93,39 @@ if ( isset( $_REQUEST['iSortCol_0'] ) )
|
||||
$sWhere = "";
|
||||
if ( $_REQUEST['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
$user_ids = null;
|
||||
|
||||
if (preg_match('/group:(\d+)/', $_REQUEST['sSearch'], $matches))
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string( $_REQUEST['sSearch'] )."%' OR ";
|
||||
$group_id = $matches[1];
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
`user_id`
|
||||
FROM '.USER_GROUP_TABLE.'
|
||||
WHERE `group_id` = '.$group_id.'
|
||||
';
|
||||
$user_ids = query2array($query, null, 'user_id');
|
||||
$user_ids[] = -1;
|
||||
|
||||
$_REQUEST['sSearch'] = preg_replace('/group:(\d+)/', '', $_REQUEST['sSearch']);
|
||||
}
|
||||
|
||||
$sWhere = "WHERE (";
|
||||
|
||||
if (is_array($user_ids))
|
||||
{
|
||||
$sWhere.= '`user_id` IN ('.implode(',', $user_ids).') OR ';
|
||||
}
|
||||
|
||||
if ($_REQUEST['sSearch'] != "")
|
||||
{
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
$sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string( $_REQUEST['sSearch'] )."%' OR ";
|
||||
}
|
||||
}
|
||||
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user