Allow trailing wildcard site searches by appending *. see #15170
git-svn-id: http://svn.automattic.com/wordpress/trunk@16169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6291fa9dc6
commit
1e95d0f38e
|
@ -30,6 +30,12 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||||
$pagenum = $this->get_pagenum();
|
$pagenum = $this->get_pagenum();
|
||||||
|
|
||||||
$s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';
|
$s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';
|
||||||
|
$wild = '';
|
||||||
|
if ( false !== strpos($s, '*') ) {
|
||||||
|
$wild = '%';
|
||||||
|
$s = trim($s, '*');
|
||||||
|
}
|
||||||
|
|
||||||
$like_s = esc_sql( like_escape( $s ) );
|
$like_s = esc_sql( like_escape( $s ) );
|
||||||
|
|
||||||
$large_network = false;
|
$large_network = false;
|
||||||
|
@ -53,15 +59,15 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||||
FROM {$wpdb->blogs}, {$wpdb->registration_log}
|
FROM {$wpdb->blogs}, {$wpdb->registration_log}
|
||||||
WHERE site_id = '{$wpdb->siteid}'
|
WHERE site_id = '{$wpdb->siteid}'
|
||||||
AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
|
AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
|
||||||
AND {$wpdb->registration_log}.IP LIKE ( '{$like_s}%' )";
|
AND {$wpdb->registration_log}.IP LIKE ( '{$like_s}$wild' )";
|
||||||
} else {
|
} else {
|
||||||
if ( is_subdomain_install() ) {
|
if ( is_subdomain_install() ) {
|
||||||
$blog_s = str_replace( '.' . $current_site->domain, '', $like_s );
|
$blog_s = str_replace( '.' . $current_site->domain, '', $like_s );
|
||||||
$blog_s .= '.' . $current_site->domain;
|
$blog_s .= $wild . '.' . $current_site->domain;
|
||||||
$query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ";
|
$query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ";
|
||||||
} else {
|
} else {
|
||||||
if ( $like_s != trim('/', $current_site->path) )
|
if ( $like_s != trim('/', $current_site->path) )
|
||||||
$blog_s = $current_site->path .= $like_s . '/';
|
$blog_s = $current_site->path .= $like_s . $wild . '/';
|
||||||
else
|
else
|
||||||
$blog_s = $like_s;
|
$blog_s = $like_s;
|
||||||
$query .= " AND ( {$wpdb->blogs}.path LIKE '$blog_s' ";
|
$query .= " AND ( {$wpdb->blogs}.path LIKE '$blog_s' ";
|
||||||
|
|
Loading…
Reference in New Issue