WordPress.org

Make WordPress Core

Changeset 12712


Ignore:
Timestamp:
01/12/2010 09:11:52 PM (8 years ago)
Author:
wpmuguru
Message:

merge multisite admin - edit links,tags,cats,options, See #11644

Location:
trunk/wp-admin
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin

    • Property svn:ignore set to
      .categories.php.swp
  • trunk/wp-admin/admin.php

    r12583 r12712  
    2828    do_action('after_db_upgrade');
    2929} elseif ( get_option('db_version') != $wp_db_version ) {
    30     wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
    31     exit;
     30    if ( !is_multisite() ) {
     31        wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
     32        exit;
     33    } elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
     34        /**
     35         * On really small MU installs run the upgrader every time,
     36         * else run it less often to reduce load.
     37         *
     38         * @since 2.8.4b
     39         */
     40        $c = get_blog_count();
     41        if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) {
     42            require_once( ABSPATH . WPINC . '/http.php' );
     43            $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) );
     44            do_action( 'after_mu_upgrade', $response );
     45        }
     46    }
    3247}
    3348
     
    4661set_screen_options();
    4762
     63$posts_per_page = get_option('posts_per_page');
    4864$date_format = get_option('date_format');
    4965$time_format = get_option('time_format');
     
    95111        }
    96112
    97         if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
     113        if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) )
    98114            wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
    99115
     
    103119            require_once(ABSPATH . 'wp-admin/admin-header.php');
    104120
    105         include(WP_PLUGIN_DIR . "/$plugin_page");
     121        if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") )
     122            include(WPMU_PLUGIN_DIR . "/$plugin_page");
     123        else
     124            include(ABSPATH . PLUGINDIR . "/$plugin_page");
    106125    }
    107126
     
    140159
    141160    define('WP_IMPORTING', true);
     161    if ( is_multisite() ) {
     162        kses_init_filters();  // Always filter imported data with kses.
     163    }
    142164
    143165    call_user_func($wp_importers[$importer][2]);
  • trunk/wp-admin/categories.php

    r12694 r12712  
    298298    <p><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></p>
    299299</div>
    300 
     300<?php if ( is_multisite() ) { ?>
    301301<div class="form-field">
    302302    <label for="category_nicename"><?php _e('Category Slug') ?></label>
     
    304304    <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
    305305</div>
    306 
     306<?php } ?>
    307307<div class="form-field">
    308308    <label for="category_parent"><?php _e('Category Parent') ?></label>
  • trunk/wp-admin/edit-category-form.php

    r12675 r12712  
    5959            <td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
    6060        </tr>
     61<?php if ( is_multisite() ) { ?>
    6162        <tr class="form-field">
    6263            <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
     
    6465            <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
    6566        </tr>
     67<?php } ?>
    6668        <tr class="form-field">
    6769            <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
  • trunk/wp-admin/edit-link-categories.php

    r12546 r12712  
    201201    <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
    202202</div>
    203 
     203<?php if ( is_multisite() ) { ?>
    204204<div class="form-field">
    205205    <label for="slug"><?php _e('Link Category slug') ?></label>
     
    207207    <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
    208208</div>
    209 
     209<?php } ?>
    210210<div class="form-field">
    211211    <label for="description"><?php _e('Description (optional)') ?></label>
  • trunk/wp-admin/edit-link-category-form.php

    r12228 r12712  
    7373            <td><input name="name" id="name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
    7474        </tr>
     75<?php if ( !is_multisite() ) { ?>
    7576        <tr class="form-field">
    7677            <th scope="row" valign="top"><label for="slug"><?php _e('Link Category slug') ?></label></th>
     
    7879            <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
    7980        </tr>
     81<?php } ?>
    8082        <tr class="form-field">
    8183            <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
  • trunk/wp-admin/edit-tag-form.php

    r12546 r12712  
    3636            <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /></td>
    3737        </tr>
     38<?php if ( !is_multisite() ) { ?>
    3839        <tr class="form-field">
    3940            <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
     
    4142            <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
    4243        </tr>
     44<?php } ?>
    4345        <tr class="form-field">
    4446            <th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
  • trunk/wp-admin/edit-tags.php

    r12683 r12712  
    301301    <p><?php _e('The name is how the tag appears on your site.'); ?></p>
    302302</div>
    303 
     303<?php if ( !is_multisite() ) { ?>
    304304<div class="form-field">
    305305    <label for="slug"><?php _e('Tag slug') ?></label>
     
    307307    <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
    308308</div>
    309 
     309<?php } ?>
    310310<div class="form-field">
    311311    <label for="description"><?php _e('Description') ?></label>
  • trunk/wp-admin/menu-header.php

    r12597 r12712  
    1616$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
    1717$self = preg_replace('|^.*/plugins/|i', '', $self);
     18$self = preg_replace('|^.*/mu-plugins/|i', '', $self);
    1819
    1920global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
     21$parent_file = apply_filters("parent_file", $parent_file); // For plugins to move submenu tabs around.
    2022
    2123get_admin_page_parent();
  • trunk/wp-admin/options-discussion.php

    r11958 r12712  
    5353<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
    5454<?php _e('Users must be registered and logged in to comment') ?>
     55<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) _e( ' (Signup has been disabled. Only members of this site can comment)' ); ?>
    5556</label>
    5657<br />
  • trunk/wp-admin/options-general.php

    r12507 r12712  
    7171<span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
    7272</tr>
     73<?php if ( !is_multisite() ) { ?>
    7374<tr valign="top">
    7475<th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
     
    9899</td>
    99100</tr>
     101<?php } else { ?>
     102<tr valign="top">
     103<th scope="row"><label for="new_admin_email"><?php _e('E-mail address') ?> </label></th>
     104<td><input name="new_admin_email" type="text" id="new_admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text code" />
     105<span class="setting-description"><?php _e('This address is used for admin purposes.') ?> <?php _e('If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></span></td>
     106</tr>
     107<?php } ?>
    100108<tr>
    101109<?php
     
    282290</tr>
    283291<?php do_settings_fields('general', 'default'); ?>
     292<?php
     293if ( is_multisite() && is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) )
     294    while( ( $lang_file = readdir( $dh ) ) !== false )
     295        if( substr( $lang_file, -3 ) == '.mo' )
     296            $lang_files[] = $lang_file;
     297$lang = get_option('WPLANG');
     298
     299if( is_array($lang_files) && !empty($lang_files) ) {
     300    ?>
     301    <tr valign="top">
     302        <th width="33%" scope="row"><?php _e('Blog language:') ?></th>
     303        <td>
     304            <select name="WPLANG" id="WPLANG">
     305                <?php mu_dropdown_languages( $lang_files, get_option('WPLANG') ); ?>
     306            </select>
     307        </td>
     308    </tr>
     309    <?php
     310} // languages
     311?>
    284312</table>
    285313
  • trunk/wp-admin/options-misc.php

    r12405 r12712  
    2626<form method="post" action="options.php">
    2727<?php settings_fields('misc'); ?>
    28 
     28<?php if ( !is_multisite() ) { ?>
    2929<h3><?php _e('Uploading Files'); ?></h3>
    3030<table class="form-table">
     
    6666
    6767</table>
    68 
     68<?php } ?>
    6969<?php do_settings_sections('misc'); ?>
    7070
  • trunk/wp-admin/options-permalink.php

    r12546 r12712  
    8383        if (! empty($permalink_structure) )
    8484            $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
     85        if ( is_multisite() && !is_subdomain_install()  && $permalink_structure != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) {
     86            $permalink_structure = '/blog' . $permalink_structure;
     87        }
    8588        $wp_rewrite->set_permalink_structure($permalink_structure);
    8689    }
     
    9093        if (! empty($category_base) )
    9194            $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
     95        if ( is_miltisite() && !is_subdomain_install() && $category_base != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) {
     96            $category_base = '/blog' . $category_base;
     97        }
    9298        $wp_rewrite->set_category_base($category_base);
    9399    }
     
    97103        if (! empty($tag_base) )
    98104            $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']);
     105        if ( is_multisite() && !is_subdomain_install() && $tag_base != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) {
     106            $tag_base = '/blog' . $tag_base;
     107        }
    99108        $wp_rewrite->set_tag_base($tag_base);
    100109    }
     
    195204        </th>
    196205        <td>
     206            <?php if ( is_multisite() && !is_subdomain_install() && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $permalink_structure ); }?>
    197207            <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
    198208        </td>
     
    210220    <tr>
    211221        <th><label for="category_base"><?php _e('Category base'); ?></label></th>
    212         <td><input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td>
     222        <td><?php if ( is_multisite() && !is_subdomain_install() && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>
    213223    </tr>
    214224    <tr>
    215225        <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
    216         <td><input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
     226        <td><?php if ( is_multisite() && !is_subdomain_install() && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $tag_base = str_replace( "/blog", "", $tag_base ); }?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
    217227    </tr>
    218228    <?php do_settings_fields('permalink', 'optional'); ?>
     
    225235</p>
    226236  </form>
     237<?php if ( !is_multisite || is_super_admin() ) { ?>
    227238<?php if ($iis7_permalinks) :
    228239    if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) :
     
    252263    <?php endif; ?>
    253264<?php endif; ?>
     265<?php } // multisite ?>
    254266
    255267</div>
  • trunk/wp-admin/options-writing.php

    r11761 r12712  
    8282</table>
    8383
     84<?php if ( !is_multisite() || defined( 'POST_BY_EMAIL' ) ) { ?>
    8485<h3><?php _e('Post via e-mail') ?></h3>
    8586<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p>
     
    113114<?php do_settings_fields('writing', 'post_via_email'); ?>
    114115</table>
    115 
     116<?php } ?>
     117<?php if ( !is_multisite() ) { ?>
    116118<h3><?php _e('Update Services') ?></h3>
    117119
     
    127129
    128130<?php endif; ?>
     131<?php } // multisite ?>
    129132
    130133<?php do_settings_sections('writing'); ?>
  • trunk/wp-admin/options.php

    r12507 r12712  
    3939    wp_die(__('Cheatin&#8217; uh?'));
    4040
     41if ( is_multisite() && is_super_admin() && $_GET[ 'adminhash' ] ) {
     42    $new_admin_details = get_option( 'adminhash' );
     43    if( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) {
     44        update_option( "admin_email", $new_admin_details[ 'newemail' ] );
     45        delete_option( "adminhash" );
     46        delete_option( "new_admin_email" );
     47        wp_redirect( get_option( "siteurl" ) . "/wp-admin/options-general.php?updated=true" );
     48        exit;
     49    } else {
     50        wp_redirect( get_option( "siteurl" ) . "/wp-admin/options-general.php?updated=false" );
     51        exit;
     52    }
     53}
     54
    4155switch($action) {
    4256
     
    5670    if ( 'options' == $option_page ) {
    5771        $options = explode(',', stripslashes( $_POST[ 'page_options' ] ));
     72        if ( !is_super_admin() )
     73            wp_die( __( 'Not allowed here' ) );
    5874    } else {
    5975        $options = $whitelist_options[ $option_page ];
     
    91107
    92108default:
     109    if ( !is_super_admin() )
     110        wp_die( __( 'Not admin' ) );
     111
    93112    include('admin-header.php'); ?>
    94113
     
    100119  <input type="hidden" name="action" value="update" />
    101120  <input type='hidden' name='option_page' value='options' />
     121<?php if ( is_multisite() ) { ?>
     122<p class="submit submit-top">
     123    <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" class="button-primary" />
     124</p>
     125<?php } ?>
    102126  <table class="form-table">
    103127<?php
     
    107131    $disabled = '';
    108132    $option->option_name = esc_attr($option->option_name);
     133    if( $option->option_name == '' )
     134        continue;
    109135    if ( is_serialized($option->option_value) ) {
    110136        if ( is_serialized_string($option->option_value) ) {
Note: See TracChangeset for help on using the changeset viewer.