web/wp-admin/network/settings.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    42 if ( $_POST ) {
    42 if ( $_POST ) {
    43 	do_action( 'wpmuadminedit' , '' );
    43 	do_action( 'wpmuadminedit' , '' );
    44 
    44 
    45 	check_admin_referer( 'siteoptions' );
    45 	check_admin_referer( 'siteoptions' );
    46 
    46 
    47 	if ( isset( $_POST['WPLANG'] ) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) )
       
    48 		update_site_option( 'WPLANG', $_POST['WPLANG'] );
       
    49 
       
    50 	if ( is_email( $_POST['admin_email'] ) )
       
    51 		update_site_option( 'admin_email', $_POST['admin_email'] );
       
    52 
       
    53 	$illegal_names = explode( ' ', $_POST['illegal_names'] );
       
    54 	foreach ( (array) $illegal_names as $name ) {
       
    55 		$name = trim( $name );
       
    56 		if ( $name != '' )
       
    57 			$names[] = trim( $name );
       
    58 	}
       
    59 	update_site_option( 'illegal_names', $names );
       
    60 
       
    61 	if ( $_POST['limited_email_domains'] != '' ) {
       
    62 		$limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] );
       
    63 		$limited_email_domains = explode( "\n", stripslashes( $limited_email_domains ) );
       
    64 		$limited_email = array();
       
    65 		foreach ( (array) $limited_email_domains as $domain ) {
       
    66 			$domain = trim( $domain );
       
    67 			if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
       
    68 				$limited_email[] = trim( $domain );
       
    69 		}
       
    70 		update_site_option( 'limited_email_domains', $limited_email );
       
    71 	} else {
       
    72 		update_site_option( 'limited_email_domains', '' );
       
    73 	}
       
    74 
       
    75 	if ( $_POST['banned_email_domains'] != '' ) {
       
    76 		$banned_email_domains = explode( "\n", stripslashes( $_POST['banned_email_domains'] ) );
       
    77 		$banned = array();
       
    78 		foreach ( (array) $banned_email_domains as $domain ) {
       
    79 			$domain = trim( $domain );
       
    80 			if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
       
    81 				$banned[] = trim( $domain );
       
    82 		}
       
    83 		update_site_option( 'banned_email_domains', $banned );
       
    84 	} else {
       
    85 		update_site_option( 'banned_email_domains', '' );
       
    86 	}
       
    87 
       
    88 	$options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' );
       
    89 	$checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
    47 	$checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
    90 	foreach ( $checked_options as $option_name => $option_unchecked_value ) {
    48 	foreach ( $checked_options as $option_name => $option_unchecked_value ) {
    91 		if ( ! isset( $_POST[$option_name] ) )
    49 		if ( ! isset( $_POST[$option_name] ) )
    92 			$_POST[$option_name] = $option_unchecked_value;
    50 			$_POST[$option_name] = $option_unchecked_value;
    93 	}
    51 	}
       
    52 
       
    53 	$options = array(
       
    54 		'registrationnotification', 'registration', 'add_new_users', 'menu_items',
       
    55 		'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name',
       
    56 		'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author',
       
    57 		'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled',
       
    58 		'illegal_names', 'limited_email_domains', 'banned_email_domains', 'WPLANG', 'admin_email',
       
    59 	);
       
    60 
    94 	foreach ( $options as $option_name ) {
    61 	foreach ( $options as $option_name ) {
    95 		if ( ! isset($_POST[$option_name]) )
    62 		if ( ! isset($_POST[$option_name]) )
    96 			continue;
    63 			continue;
    97 		$value = stripslashes_deep( $_POST[$option_name] );
    64 		$value = stripslashes_deep( $_POST[$option_name] );
    98 		update_site_option( $option_name, $value );
    65 		update_site_option( $option_name, $value );