block invalid site names/urls in add site, see #11777

git-svn-id: https://develop.svn.wordpress.org/trunk@13630 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ron Rennick 2010-03-09 17:06:58 +00:00
parent e9d9581eba
commit 372f453254
1 changed files with 8 additions and 4 deletions

View File

@ -135,14 +135,18 @@ switch ( $_GET['action'] ) {
if ( is_array( $_POST[ 'blog' ] ) == false )
wp_die( "Can't create an empty site." );
$blog = $_POST['blog'];
$domain = sanitize_user( str_replace( '/', '', $blog[ 'domain' ] ) );
$domain = '';
if ( ! preg_match( '/(--)/', $blog[ 'domain' ] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog[ 'domain' ] ) )
$domain = strtolower( $blog[ 'domain' ] );
$email = sanitize_email( $blog[ 'email' ] );
$title = $blog[ 'title' ];
if ( empty($domain) || empty($email) )
wp_die( __('Missing site address or email address.') );
if ( empty( $domain ) )
wp_die( __( 'Missing or invalid site address.' ) );
if ( empty( $email ) )
wp_die( __( 'Missing email address.' ) );
if ( !is_email( $email ) )
wp_die( __('Invalid email address') );
wp_die( __( 'Invalid email address' ) );
if ( is_subdomain_install() ) {
$newdomain = $domain.".".$current_site->domain;