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

git-svn-id: http://svn.automattic.com/wordpress/trunk@13630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-03-09 17:06:58 +00:00
parent a40011fbb5
commit bfe35227d3
1 changed files with 8 additions and 4 deletions

View File

@ -135,12 +135,16 @@ 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' ) );