changeset 9 | a932ce8c4827 |
parent 7 | 98bbc533541c |
8:8baccbad4a55 | 9:a932ce8c4827 |
---|---|
746 $conditions[] = 'u.registered<'.$registered_before; |
746 $conditions[] = 'u.registered<'.$registered_before; |
747 |
747 |
748 $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; |
748 $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; |
749 while (list($key, $input) = @each($form)) |
749 while (list($key, $input) = @each($form)) |
750 { |
750 { |
751 $e = ( $key == 'username' ) ? 'e' : ''; |
|
751 if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note'))) |
752 if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note'))) |
752 $conditions[] = 'u.'.$pun_db->escape($key).' '.$like_command.' \''.$pun_db->escape(str_replace('*', '%', $input)).'\''; |
753 $conditions[] = $e . 'u.'.$pun_db->escape($key).' '.$like_command.' \''.$pun_db->escape(str_replace('*', '%', $input)).'\''; |
753 } |
754 } |
754 |
755 |
755 if ($posts_greater != '') |
756 if ($posts_greater != '') |
756 $conditions[] = 'u.num_posts>'.$posts_greater; |
757 $conditions[] = 'u.num_posts>'.$posts_greater; |
757 if ($posts_less != '') |
758 if ($posts_less != '') |
767 // Load the misc.php language file |
768 // Load the misc.php language file |
768 require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php'; |
769 require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php'; |
769 |
770 |
770 // Find any users matching the conditions |
771 // Find any users matching the conditions |
771 $query = array( |
772 $query = array( |
772 'SELECT' => 'u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title', |
773 'SELECT' => 'u.id, eu.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title', |
773 'FROM' => 'users AS u', |
774 'FROM' => $pun_db->prefix . 'users AS u', |
774 'JOINS' => array( |
775 'JOINS' => array( |
775 array( |
776 array( |
776 'LEFT JOIN' => 'groups AS g', |
777 'LEFT JOIN' => $pun_db->prefix . 'groups AS g', |
777 'ON' => 'g.g_id=u.group_id' |
778 'ON' => 'g.g_id=u.group_id' |
778 ) |
779 ), |
780 array( |
|
781 'LEFT JOIN' => table_prefix . 'users AS eu', |
|
782 'ON' => 'eu.user_id = u.id' |
|
783 ) |
|
779 ), |
784 ), |
780 'WHERE' => 'u.id>1 AND '.implode(' AND ', $conditions), |
785 'WHERE' => 'u.id>1 AND '.implode(' AND ', $conditions), |
781 'ORDER BY' => $pun_db->escape($order_by).' '.$pun_db->escape($direction) |
786 'ORDER BY' => $pun_db->escape($order_by).' '.$pun_db->escape($direction), |
787 'PARAMS' => array( |
|
788 'NO_PREFIX' => '' |
|
789 ) |
|
782 ); |
790 ); |
783 |
791 |
784 ($hook = get_hook('aus_qr_find_users')) ? eval($hook) : null; |
792 ($hook = get_hook('aus_qr_find_users')) ? eval($hook) : null; |
785 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
793 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
786 $pun_page['num_users'] = $pun_db->num_rows($result); |
794 $pun_page['num_users'] = $pun_db->num_rows($result); |