Make WordPress Core


Ignore:
Timestamp:
08/11/2011 10:32:35 PM (13 years ago)
Author:
nacin
Message:

Move network/settings.php POST handling out of network/edit.php. props PeteMall, see #18379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/edit.php

    r18460 r18536  
    9797
    9898switch ( $_GET['action'] ) {
    99     case 'siteoptions':
    100         check_admin_referer( 'siteoptions' );
    101         if ( ! current_user_can( 'manage_network_options' ) )
    102             wp_die( __( 'You do not have permission to access this page.' ) );
    103 
    104         if ( empty( $_POST ) )
    105             wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">options page</a>.' ), esc_url( admin_url( 'settings.php' ) ) ) );
    106 
    107         if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) )
    108             update_site_option( 'WPLANG', $_POST['WPLANG'] );
    109 
    110         if ( is_email( $_POST['admin_email'] ) )
    111             update_site_option( 'admin_email', $_POST['admin_email'] );
    112 
    113         $illegal_names = split( ' ', $_POST['illegal_names'] );
    114         foreach ( (array) $illegal_names as $name ) {
    115             $name = trim( $name );
    116             if ( $name != '' )
    117                 $names[] = trim( $name );
    118         }
    119         update_site_option( 'illegal_names', $names );
    120 
    121         if ( $_POST['limited_email_domains'] != '' ) {
    122             $limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] );
    123             $limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) );
    124             $limited_email = array();
    125             foreach ( (array) $limited_email_domains as $domain ) {
    126                     $domain = trim( $domain );
    127                 if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
    128                     $limited_email[] = trim( $domain );
    129             }
    130             update_site_option( 'limited_email_domains', $limited_email );
    131         } else {
    132             update_site_option( 'limited_email_domains', '' );
    133         }
    134 
    135         if ( $_POST['banned_email_domains'] != '' ) {
    136             $banned_email_domains = split( "\n", stripslashes( $_POST['banned_email_domains'] ) );
    137             $banned = array();
    138             foreach ( (array) $banned_email_domains as $domain ) {
    139                 $domain = trim( $domain );
    140                 if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
    141                     $banned[] = trim( $domain );
    142             }
    143             update_site_option( 'banned_email_domains', $banned );
    144         } else {
    145             update_site_option( 'banned_email_domains', '' );
    146         }
    147 
    148         $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', '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' );
    149         $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
    150         foreach ( $checked_options as $option_name => $option_unchecked_value ) {
    151             if ( ! isset( $_POST[$option_name] ) )
    152                 $_POST[$option_name] = $option_unchecked_value;
    153         }
    154         foreach ( $options as $option_name ) {
    155             if ( ! isset($_POST[$option_name]) )
    156                 continue;
    157             $value = stripslashes_deep( $_POST[$option_name] );
    158             update_site_option( $option_name, $value );
    159         }
    160 
    161         // Update more options here
    162         do_action( 'update_wpmu_options' );
    163 
    164         wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) );
    165         exit();
    166     break;
    167 
    16899    case 'updateblog':
    169100        // No longer used.
Note: See TracChangeset for help on using the changeset viewer.