Sites search improvements. fixes #18013

git-svn-id: http://svn.automattic.com/wordpress/trunk@18442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-07-15 15:42:26 +00:00
parent 1e2e87100d
commit 7f88e6ee2f
1 changed files with 6 additions and 3 deletions

View File

@ -52,8 +52,11 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
if ( empty($s) ) { if ( empty($s) ) {
// Nothing to do. // Nothing to do.
} elseif ( preg_match('/^[0-9]+\./', $s) ) { } elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) ||
// IP address preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
preg_match( '/^[0-9]{1,3}\.$/', $s ) ) {
// IPv4 address
$reg_blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE ( '{$like_s}$wild' )" ); $reg_blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE ( '{$like_s}$wild' )" );
if ( !$reg_blog_ids ) if ( !$reg_blog_ids )
@ -64,7 +67,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
WHERE site_id = '{$wpdb->siteid}' WHERE site_id = '{$wpdb->siteid}'
AND {$wpdb->blogs}.blog_id IN (" . implode( ', ', $reg_blog_ids ) . ")"; AND {$wpdb->blogs}.blog_id IN (" . implode( ', ', $reg_blog_ids ) . ")";
} else { } else {
if ( is_numeric($s) ) { if ( is_numeric($s) && empty( $wild ) ) {
$query .= " AND ( {$wpdb->blogs}.blog_id = '{$like_s}' )"; $query .= " AND ( {$wpdb->blogs}.blog_id = '{$like_s}' )";
} elseif ( is_subdomain_install() ) { } elseif ( is_subdomain_install() ) {
$blog_s = str_replace( '.' . $current_site->domain, '', $like_s ); $blog_s = str_replace( '.' . $current_site->domain, '', $like_s );