Strip trailing whites from ms files. see #11644

git-svn-id: http://svn.automattic.com/wordpress/trunk@12632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-07 04:27:46 +00:00
parent 7725ad61f6
commit adf017f6b9
9 changed files with 234 additions and 234 deletions

View File

@ -47,8 +47,8 @@ function wpmu_delete_blog($blog_id, $drop = false) {
update_blog_status( $blog_id, 'deleted', 1 );
if ( $drop ) {
$drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
$drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
$drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
$drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
reset( $drop_tables );
foreach ( (array) $drop_tables as $drop_table) {
@ -219,10 +219,10 @@ function update_option_new_admin_email($old_value, $value) {
"newemail" => $value
);
update_option( 'adminhash', $new_admin_email );
$content = apply_filters( 'new_admin_email_content', __("Dear user,
You recently requested to have the administration email address on
You recently requested to have the administration email address on
your blog changed.
If this is correct, please click on the following link to change it:
###ADMIN_URL###
@ -235,12 +235,12 @@ This email has been sent to ###EMAIL###
Regards,
All at ###SITENAME###
###SITEURL###"), $new_admin_email );
$content = str_replace('###ADMIN_URL###', clean_url(get_option( "siteurl" ).'/wp-admin/options.php?adminhash='.$hash), $content);
$content = str_replace('###EMAIL###', $value, $content);
$content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
$content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);
wp_mail( $value, sprintf(__('[%s] New Admin Email Address'), get_option('blogname')), $content );
}
add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2);
@ -354,7 +354,7 @@ function get_site_allowed_themes() {
function get_space_allowed() {
$spaceAllowed = get_option("blog_upload_space");
if( $spaceAllowed == false )
if( $spaceAllowed == false )
$spaceAllowed = get_site_option("blog_upload_space");
if( empty($spaceAllowed) || !is_numeric($spaceAllowed) )
$spaceAllowed = 50;
@ -376,12 +376,12 @@ function display_space_usage() {
$space .= __('MB');
}
?>
<strong><?php printf(__('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong>
<strong><?php printf(__('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong>
<?php
}
// Display File upload quota on dashboard
function dashboard_quota() {
function dashboard_quota() {
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return true;
}
@ -412,10 +412,10 @@ if( current_user_can('edit_posts') )
// Edit blog upload space setting on Edit Blog page
function upload_space_setting( $id ) {
$quota = get_blog_option($id, "blog_upload_space");
$quota = get_blog_option($id, "blog_upload_space");
if( !$quota )
$quota = '';
?>
<tr>
<th><?php _e('Blog Upload Space Quota'); ?></th>
@ -432,9 +432,9 @@ function update_user_status( $id, $pref, $value, $refresh = 1 ) {
if( $refresh == 1 )
refresh_user_details($id);
if( $pref == 'spam' ) {
if( $value == 1 )
if( $value == 1 )
do_action( "make_spam_user", $id );
else
do_action( "make_ham_user", $id );
@ -445,7 +445,7 @@ function update_user_status( $id, $pref, $value, $refresh = 1 ) {
function refresh_user_details($id) {
$id = (int) $id;
if ( !$user = get_userdata( $id ) )
return false;
@ -464,8 +464,8 @@ function wpmu_checkAvailableSpace() {
$spaceAllowed = get_space_allowed();
$dirName = trailingslashit( BLOGUPLOADDIR );
if (!(is_dir($dirName) && is_readable($dirName)))
return;
if (!(is_dir($dirName) && is_readable($dirName)))
return;
$dir = dir($dirName);
$size = 0;
@ -512,7 +512,7 @@ function redirect_user_to_blog() {
$c = 0;
if ( isset( $_GET[ 'c' ] ) )
$c = (int)$_GET[ 'c' ];
if ( $c >= 5 ) {
wp_die( __( "You don&#8217;t have permission to view this blog. Please contact the system administrator." ) );
}
@ -521,13 +521,13 @@ function redirect_user_to_blog() {
$blog = get_active_blog_for_user( $current_user->ID );
$dashboard_blog = get_dashboard_blog();
if( is_object( $blog ) ) {
$protocol = ( is_ssl() ? 'https://' : 'http://' );
$protocol = ( is_ssl() ? 'https://' : 'http://' );
wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
exit;
}
/*
If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
/*
If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
then update the primary_blog record to match the user's blog
*/
$blogs = get_blogs_of_user( $current_user->ID );
@ -540,7 +540,7 @@ function redirect_user_to_blog() {
}
}
$blog = get_blog_details( get_usermeta( $current_user->ID , 'primary_blog' ) );
$protocol = ( is_ssl() ? 'https://' : 'http://' );
$protocol = ( is_ssl() ? 'https://' : 'http://' );
wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
exit;
}
@ -558,7 +558,7 @@ function mu_options( $options ) {
} else {
$writing = array( 'ping_sites', 'mailserver_login', 'mailserver_pass', 'default_email_category', 'mailserver_port', 'mailserver_url' );
}
$removed = array(
$removed = array(
'general' => array( 'siteurl', 'home', 'admin_email', 'users_can_register', 'default_role' ),
'reading' => array( 'gzipcompression' ),
'writing' => $writing,
@ -584,12 +584,12 @@ add_filter( 'import_allow_create_users', 'check_import_new_users' );
// See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too.
function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
$flag = false;
$flag = false;
$output = array();
foreach ( (array) $lang_files as $val ) {
$code_lang = basename( $val, '.mo' );
if ( $code_lang == 'en_US' ) { // American English
$flag = true;
$ae = __('American English');
@ -602,18 +602,18 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
$translated = format_code_lang($code_lang);
$output[$translated] = '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$translated.'</option>';
}
}
}
if ( $flag === false ) { // WordPress english
$output[] = '<option value=""'.((empty($current)) ? ' selected="selected"' : '').'>'.__('English')."</option>";
}
// Order by name
uksort($output, 'strnatcasecmp');
$output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);
echo implode("\n\t", $output);
$output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);
echo implode("\n\t", $output);
}
// Only show "Media" upload icon
@ -762,10 +762,10 @@ add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2
function activate_sitewide_plugin() {
if ( !isset( $_GET['sitewide'] ) )
return false;
/* Add the plugin to the list of sitewide active plugins */
$active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
/* Add the activated plugin to the list */
$active_sitewide_plugins[ $_GET['plugin'] ] = time();
@ -775,7 +775,7 @@ function activate_sitewide_plugin() {
return true;
}
add_action( 'activate_' . $_GET['plugin'], 'activate_sitewide_plugin' );
add_action( 'activate_' . $_GET['plugin'], 'activate_sitewide_plugin' );
/**
* deactivate_sitewide_plugin()
@ -785,7 +785,7 @@ add_action( 'activate_' . $_GET['plugin'], 'activate_sitewide_plugin' );
function deactivate_sitewide_plugin( $plugin = false ) {
if ( !$plugin )
$plugin = $_GET['plugin'];
/* Get the active sitewide plugins */
$active_sitewide_plugins = (array) maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
@ -797,11 +797,11 @@ function deactivate_sitewide_plugin( $plugin = false ) {
if ( !update_site_option( 'active_sitewide_plugins', $active_sitewide_plugins ) )
wp_redirect( 'plugins.php?error=true' );
return true;
}
add_action( 'deactivate_' . $_GET['plugin'], 'deactivate_sitewide_plugin' );
add_action( 'deactivate_invalid_plugin', 'deactivate_sitewide_plugin' );
add_action( 'deactivate_' . $_GET['plugin'], 'deactivate_sitewide_plugin' );
add_action( 'deactivate_invalid_plugin', 'deactivate_sitewide_plugin' );
/**
* add_sitewide_activate_row()
@ -811,13 +811,13 @@ add_action( 'deactivate_invalid_plugin', 'deactivate_sitewide_plugin' );
function add_sitewide_activate_row( $file, $plugin_data, $context ) {
if ( !is_site_admin() )
return false;
if ( 'sitewide-active' == $context )
return false;
if ( is_plugin_active( $file ) )
return false;
echo '<tr><td colspan="5" style="background: #f5f5f5; text-align: right;">';
echo '<a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&amp;sitewide=1&amp;plugin=' . $file ), 'activate-plugin_' . $file ) . '" title="' . __( 'Activate this plugin for all blogs across the entire network' ) . '">&uarr; ' . sprintf( __( 'Activate %s Site Wide' ), strip_tags( $plugin_data["Title"] ) ) . '</a>';
@ -834,13 +834,13 @@ add_action( 'after_plugin_row', 'add_sitewide_activate_row', 9, 3 );
function is_wpmu_sitewide_plugin( $file ) {
/* Open the plugin file for reading to check if this is a ms-plugin. */
$fp = @fopen( WP_PLUGIN_DIR . '/' . $file, 'r' );
/* Pull only the first 8kiB of the file in. */
$plugin_data = @fread( $fp, 8192 );
/* PHP will close file handle, but we are good citizens. */
@fclose($fp);
if ( preg_match( '|Site Wide Only:(.*)true$|mi', $plugin_data ) )
return true;
@ -858,14 +858,14 @@ function list_activate_sitewide_plugins() {
if ( !is_site_admin() )
return false;
$active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins') );
$context = 'sitewide-active';
if ( $active_sitewide_plugins ) {
if ( $active_sitewide_plugins ) {
?>
<h3><?php _e( 'Currently Active Site Wide Plugins' ) ?></h3>
<p><?php _e( 'Plugins that appear in the list below are activate for all blogs across this installation.' ) ?></p>
<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
@ -898,7 +898,7 @@ function list_activate_sitewide_plugins() {
$action_links = apply_filters( "plugin_action_links_$plugin_file", $action_links, $plugin_file, $plugin_data, $context );
$plugin_data = $all_plugins[$plugin_file];
echo "
<tr class='$context' style='background: #eef2ff;'>
<th scope='row' class='check-column'>&nbsp;</th>
@ -931,16 +931,16 @@ function list_activate_sitewide_plugins() {
echo implode(' | ', $plugin_meta);
echo "</td>
</tr>\n";
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
}
?>
</tbody>
</table>
<p><?php _e( 'Plugins that are enabled site wide can only be disabled by a site administrator.' ) ?></p>
<?php
}
}
@ -959,14 +959,14 @@ function sitewide_filter_inactive_plugins_list( $inactive_plugins ) {
unset( $inactive_plugins[ $sitewide_plugin ] );
}
/* Now unset any sitewide only plugins if the user is not a site admin */
/* Now unset any sitewide only plugins if the user is not a site admin */
if ( !is_site_admin() ) {
foreach ( $inactive_plugins as $plugin_name => $activated_time ) {
if ( is_wpmu_sitewide_plugin( $plugin_name ) )
unset( $inactive_plugins[ $plugin_name ] );
}
}
return $inactive_plugins;
}
add_filter( 'all_plugins', 'sitewide_filter_inactive_plugins_list' );
@ -983,7 +983,7 @@ function sitewide_filter_active_plugins_list( $active_plugins ) {
foreach ( $active_sitewide_plugins as $sitewide_plugin => $activated_time ) {
unset( $active_plugins[ $sitewide_plugin ] );
}
return $active_plugins;
}
add_filter( 'all_plugins', 'sitewide_filter_active_plugins_list' );
@ -996,12 +996,12 @@ add_filter( 'all_plugins', 'sitewide_filter_active_plugins_list' );
*/
function check_is_wpmu_plugin_on_activate() {
/***
* On plugin activation on a blog level, check to see if this is actually a
* On plugin activation on a blog level, check to see if this is actually a
* site wide MU plugin. If so, deactivate and activate it site wide.
*/
if ( is_wpmu_sitewide_plugin( $_GET['plugin'] ) || isset( $_GET['sitewide'] ) ) {
deactivate_plugins( $_GET['plugin'], true );
/* Silently activate because the activate_* hook has already run. */
if ( is_site_admin() ) {
$_GET['sitewide'] = true;
@ -1022,7 +1022,7 @@ function check_wpmu_plugins_on_bulk_activate( $plugins ) {
if ( is_site_admin() )
activate_sitewide_plugin( $plugin );
}
}
}
}
}
@ -1050,10 +1050,10 @@ function choose_primary_blog() {
$found = false;
?>
<select name="primary_blog">
<?php foreach( (array) $all_blogs as $blog ) {
<?php foreach( (array) $all_blogs as $blog ) {
if( $primary_blog == $blog->userblog_id )
$found = true;
?><option value='<?php echo $blog->userblog_id ?>'<?php if( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
?><option value='<?php echo $blog->userblog_id ?>'<?php if( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
} ?>
</select>
<?php
@ -1073,7 +1073,7 @@ function choose_primary_blog() {
</td>
</tr>
</table>
<?php
<?php
}
add_action ( 'myblogs_allblogs_options', 'choose_primary_blog' );
@ -1144,7 +1144,7 @@ function blogs_listing() {
<form id="myblogs" action="" method="post">
<?php
do_action( 'myblogs_allblogs_options' );
?><table class='widefat'> <?php
?><table class='widefat'> <?php
$settings_html = apply_filters( 'myblogs_options', '', 'global' );
if ( $settings_html != '' ) {
echo "<tr><td valign='top'><h3>" . __( 'Global Settings' ) . "</h3></td><td>";
@ -1165,7 +1165,7 @@ function blogs_listing() {
$rows[] = array_slice( $blogs, $split, $cols );
$split = $split + $cols;
}
foreach( $rows as $row ) {
$c = $c == "alternate" ? "" : "alternate";
echo "<tr class='$c'>";
@ -1216,8 +1216,8 @@ function stripslashes_from_options( $blog_id ) {
while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
foreach( $rows as $row ) {
$value = $row->meta_value;
if ( !@unserialize( $value ) )
$value = stripslashes( $value );
if ( !@unserialize( $value ) )
$value = stripslashes( $value );
if ( $value !== $row->meta_value ) {
update_site_option( $row->meta_key, $value );
}
@ -1230,8 +1230,8 @@ function stripslashes_from_options( $blog_id ) {
while( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $options_table ORDER BY option_id LIMIT $start, 20" ) ) {
foreach( $rows as $row ) {
$value = $row->option_value;
if ( !@unserialize( $value ) )
$value = stripslashes( $value );
if ( !@unserialize( $value ) )
$value = stripslashes( $value );
if ( $value !== $row->option_value ) {
update_blog_option( $blog_id, $row->option_name, $value );
}

View File

@ -30,7 +30,7 @@ $title = __( 'Site Admin' );
?>
<div class="wrap">
<h2><?php echo wp_specialchars( $title ); ?></h2>
<h2><?php echo wp_specialchars( $title ); ?></h2>
<ul class="subsubsub">
<li><a href="ms-blogs.php#form-add-blog" class="rbutton"><strong><?php _e('Create a New Blog'); ?></strong></a> | </li>
@ -44,9 +44,9 @@ $title = __( 'Site Admin' );
<form name="searchform" action="ms-users.php" method="get">
<p>
<input type="hidden" name="action" value="users" />
<input type="text" name="s" value="" size="17" />
<input type="text" name="s" value="" size="17" />
<input class="button" type="submit" name="submit" value="<?php esc_attr_e("Search Users"); ?>" />
</p>
</p>
</form>
<form name="searchform" action="ms-blogs.php" method="get">

View File

@ -10,10 +10,10 @@ if( is_site_admin() == false ) {
do_action('wpmuadminedit', '');
if( isset($_GET[ 'id' ]) ) {
$id = intval( $_GET[ 'id' ] );
} elseif( isset($_POST[ 'id' ]) ) {
$id = intval( $_POST[ 'id' ] );
if( isset($_GET[ 'id' ]) ) {
$id = intval( $_GET[ 'id' ] );
} elseif( isset($_POST[ 'id' ]) ) {
$id = intval( $_POST[ 'id' ] );
}
if( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) ) {
@ -143,8 +143,8 @@ switch( $_GET['action'] ) {
if ( empty($domain) || empty($email))
wp_die( __('Missing blog address or email address.') );
if( !is_email( $email ) )
wp_die( __('Invalid email address') );
if( !is_email( $email ) )
wp_die( __('Invalid email address') );
if( constant( 'VHOST' ) == 'yes' ) {
$newdomain = $domain.".".$current_site->domain;
@ -218,7 +218,7 @@ switch( $_GET['action'] ) {
if( get_option( 'home' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] )
update_option( 'home', 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] );
}
$wp_rewrite->flush_rules();
// update blogs table
@ -317,11 +317,11 @@ switch( $_GET['action'] ) {
} elseif ( isset($_POST['allblog_spam']) ) {
$blogfunction = 'all_spam';
update_blog_status( $val, "spam", '1', 0 );
set_time_limit(60);
set_time_limit(60);
} elseif ( isset($_POST['allblog_notspam']) ) {
$blogfunction = 'all_notspam';
update_blog_status( $val, "spam", '0', 0 );
set_time_limit(60);
set_time_limit(60);
}
}
}
@ -431,7 +431,7 @@ switch( $_GET['action'] ) {
<input type='hidden' name='ref' value='<?php echo $referrer; ?>' />
<?php wp_nonce_field( $_GET['action2'] ) ?>
<p><?php echo wp_specialchars( stripslashes($_GET['msg']) ); ?></p>
<p class="submit"><input class="button" type='submit' value='<?php _e("Confirm"); ?>' /></p>
<p class="submit"><input class="button" type='submit' value='<?php _e("Confirm"); ?>' /></p>
</form>
</body>
</html>

View File

@ -280,7 +280,7 @@ if (isset($_GET['updated'])) {
<a name='menu'></a>
<?php
$menu_perms = get_site_option( "menu_items" );
$menu_items = apply_filters( 'mu_menu_items', array('plugins' => __('Plugins')) );
$menu_items = apply_filters( 'mu_menu_items', array('plugins' => __('Plugins')) );
foreach ( (array) $menu_items as $key => $val ) {
echo "<tr><th scope='row'>" . wp_specialchars($val) . "</th><td><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . (( $menu_perms[$key] == '1' ) ? ' checked="checked"' : '') . " /></td></tr>";
}

View File

@ -81,68 +81,68 @@ switch( $_GET['action'] ) {
<h2><?php _e('Edit Blog'); ?> - <a href='http://<?php echo $details['domain'].$details['path']; ?>'>http://<?php echo $details['domain'].$details['path']; ?></a></h2>
<form method="post" action="ms-edit.php?action=updateblog">
<?php wp_nonce_field('editblog'); ?>
<input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" />
<input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" />
<div class='metabox-holder' style='width:49%;float:left;'>
<div id="blogedit_bloginfo" class="postbox " >
<h3 class='hndle'><span><?php _e('Blog info (wp_blogs)'); ?></span></h3>
<div class="inside">
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><?php _e('Domain') ?></th>
<th scope="row"><?php _e('Domain') ?></th>
<td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details['domain'] ?>" size="33" /></td>
</tr>
</tr>
<tr class="form-field form-required">
<th scope="row"><?php _e('Path') ?></th>
<th scope="row"><?php _e('Path') ?></th>
<td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details['path']) ?>" size="40" style='margin-bottom:5px;' />
<br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
</tr>
</tr>
<tr class="form-field">
<th scope="row"><?php _e('Registered') ?></th>
<td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details['registered']) ?>" size="40" /></td>
</tr>
<th scope="row"><?php _e('Registered') ?></th>
<td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details['registered']) ?>" size="40" /></td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e('Last Updated') ?></th>
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details['last_updated']) ?>" size="40" /></td>
</tr>
<th scope="row"><?php _e('Last Updated') ?></th>
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details['last_updated']) ?>" size="40" /></td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e('Public') ?></th>
<th scope="row"><?php _e('Public') ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Archived' ); ?></th>
<th scope="row"><?php _e( 'Archived' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Mature' ); ?></th>
<th scope="row"><?php _e( 'Mature' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Spam' ); ?></th>
<th scope="row"><?php _e( 'Spam' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Deleted' ); ?></th>
<th scope="row"><?php _e( 'Deleted' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
</td>
</tr>
</table>
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</div></div>
<div id="blogedit_blogoptions" class="postbox " >
<h3 class='hndle'><span><?php printf( __('Blog options (wp_%s_options)'), $id ); ?></span></h3>
<div class="inside">
@ -165,16 +165,16 @@ switch( $_GET['action'] ) {
if ( stristr($val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) {
?>
<tr class="form-field">
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
<td><textarea rows="5" cols="40" name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>"<?php echo $disabled ?>><?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?></textarea></td>
</tr>
<?php
} else {
?>
<tr class="form-field">
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
<td><input name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>" value="<?php echo esc_attr( stripslashes( $val['option_value'] ), 1 ) ?>" size="40" <?php echo $disabled ?> /></td>
</tr>
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
<td><input name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>" value="<?php echo esc_attr( stripslashes( $val['option_value'] ), 1 ) ?>" size="40" <?php echo $disabled ?> /></td>
</tr>
<?php
}
} // End foreach
@ -183,7 +183,7 @@ switch( $_GET['action'] ) {
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</div></div>
</div>
<div class='metabox-holder' style='width:49%;float:right;'>
<?php
// Blog Themes
@ -199,12 +199,12 @@ switch( $_GET['action'] ) {
if( isset($allowed_themes[$theme_key] ) == false ) {
$checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
$out .= '<tr class="form-field form-required">
<th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th>
<td><input name="theme['.$theme_key.']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>
<th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th>
<td><input name="theme['.$theme_key.']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>
</tr>';
}
}
if ( $out != '' ) {
?>
<div id="blogedit_blogthemes" class="postbox">
@ -217,7 +217,7 @@ switch( $_GET['action'] ) {
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</div></div>
<?php } ?>
<?php
// Blog users
$blogusers = get_users_of_blog( $id );
@ -236,7 +236,7 @@ switch( $_GET['action'] ) {
if( $val->user_id != $current_user->data->ID ) {
?>
<td>
<select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
<select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
foreach( $editblog_roles as $role => $role_assoc ){
$name = translate_with_context($role_assoc['name']);
$selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
@ -260,7 +260,7 @@ switch( $_GET['action'] ) {
echo "</div></div>";
}
?>
<div id="blogedit_blogadduser" class="postbox">
<h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3>
<div class="inside">
@ -274,7 +274,7 @@ switch( $_GET['action'] ) {
<th scope="row"><?php _e('Role:') ?></th>
<td>
<select name="new_role" id="new_role">
<?php
<?php
reset( $editblog_roles );
foreach( $editblog_roles as $role => $role_assoc ){
$name = translate_with_context($role_assoc['name']);
@ -288,7 +288,7 @@ switch( $_GET['action'] ) {
</table>
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</div></div>
<div id="blogedit_miscoptions" class="postbox">
<h3 class='hndle'><span><?php _e('Misc Blog Actions') ?></span></h3>
<div class="inside">
@ -297,9 +297,9 @@ switch( $_GET['action'] ) {
</table>
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p>
</div></div>
</div>
<div style="clear:both;"></div>
</form>
</div>
@ -324,7 +324,7 @@ switch( $_GET['action'] ) {
WHERE site_id = '{$wpdb->siteid}'
AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
AND {$wpdb->registration_log}.IP LIKE ('%{$s}%')";
}
}
if( isset( $_GET['sortby'] ) == false ) {
$_GET['sortby'] = 'id';
@ -407,10 +407,10 @@ switch( $_GET['action'] ) {
'registered' => __('Registered'),
'users' => __('Users')
);
if( has_filter( 'wpmublogsaction' ) )
$posts_columns['plugins'] = __('Actions');
$posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
$sortby_url = "s=";
@ -427,7 +427,7 @@ switch( $_GET['action'] ) {
<th scope="col" class="check-column"></th>
<?php foreach($posts_columns as $column_id => $column_display_name) {
$column_link = "<a href='ms-blogs.php?{$sortby_url}&amp;sortby={$column_id}&amp;";
if( $_GET['sortby'] == $column_id ) {
if( $_GET['sortby'] == $column_id ) {
$column_link .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&amp;' : 'order=DESC&amp;';
}
$column_link .= "apage={$apage}'>{$column_display_name}</a>";
@ -443,7 +443,7 @@ switch( $_GET['action'] ) {
if ($blog_list) {
$bgcolor = $class = '';
$status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
foreach ($blog_list as $blog) {
foreach ($blog_list as $blog) {
$class = ('alternate' == $class) ? '' : 'alternate';
reset( $status_list );
@ -455,7 +455,7 @@ switch( $_GET['action'] ) {
}
echo "<tr $bgcolour class='$class'>";
$blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
$blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
foreach( $posts_columns as $column_name=>$column_display_name ) {
switch($column_name) {
case 'id': ?>
@ -467,7 +467,7 @@ switch( $_GET['action'] ) {
</th>
<?php
break;
case 'blogname': ?>
<td valign="top">
<a href="ms-blogs.php?action=editblog&amp;id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; ?></a>
@ -476,27 +476,27 @@ switch( $_GET['action'] ) {
$controlActions = array();
$controlActions[] = '<a href="ms-blogs.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
$controlActions[] = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>';
if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=activateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) . '">' . __('Activate') . '</a>';
else
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>';
if( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>';
else
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) . '">' . __('Archive') . '</a>';
if( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>';
else
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>';
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) . '">' . __("Delete") . '</a>';
$controlActions[] = "<a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'>" . __('Visit') . '</a>';
?>
<?php if (count($controlActions)) : ?>
<div class="row-actions">
<?php echo implode(' | ', $controlActions); ?>
@ -505,7 +505,7 @@ switch( $_GET['action'] ) {
</td>
<?php
break;
case 'lastupdated': ?>
<td valign="top">
<?php echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['last_updated']); ?>
@ -522,7 +522,7 @@ switch( $_GET['action'] ) {
case 'users': ?>
<td valign="top">
<?php
$blogusers = get_users_of_blog( $blog['blog_id'] );
$blogusers = get_users_of_blog( $blog['blog_id'] );
if ( is_array( $blogusers ) ) {
$blogusers_warning = '';
if ( count( $blogusers ) > 5 ) {
@ -530,7 +530,7 @@ switch( $_GET['action'] ) {
$blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . $protocol . $blog[ 'domain' ] . $blog[ 'path' ] . 'wp-admin/users.php">' . __( 'More' ) . '</a>';
}
foreach ( $blogusers as $key => $val ) {
echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />';
echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />';
}
if( $blogusers_warning != '' ) {
echo '<strong>' . $blogusers_warning . '</strong><br />';
@ -548,7 +548,7 @@ switch( $_GET['action'] ) {
</td>
<?php } ?>
<?php break;
default: ?>
<?php if( has_filter( 'manage_blogs_custom_column' ) ) { ?>
<td valign="top">
@ -563,9 +563,9 @@ switch( $_GET['action'] ) {
<?php
}
} else { ?>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="8"><?php _e('No blogs found.') ?></td>
</tr>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="8"><?php _e('No blogs found.') ?></td>
</tr>
<?php
} // end if ($blogs)
?>
@ -585,10 +585,10 @@ switch( $_GET['action'] ) {
<th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th>
<td>
<?php if ( constant( "VHOST" ) == 'yes' ) { ?>
<input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
<input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
<?php } else {
echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>
<?php }
<?php }
echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
?>
</td>

View File

@ -37,7 +37,7 @@ switch( $_GET['action'] ) {
wp_die( "<strong>Warning!</strong> Problem upgrading {$siteurl}. Your server may not be able to connect to blogs running on it.<br /> Error message: <em>" . $response->get_error_message() ."</em>" );
}
do_action( 'after_mu_upgrade', $response );
do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
}
}
echo "</ul>";
@ -54,7 +54,7 @@ switch( $_GET['action'] ) {
echo '<p>'.__('All Done!').'</p>';
}
break;
default:
default:
?><p><?php _e("You can upgrade all the blogs on your site through this page. It works by calling the upgrade script of each blog automatically. Hit the link below to upgrade."); ?></p>
<p><a class="button" href="ms-upgrade-site.php?action=upgrade"><?php _e("Upgrade Site"); ?></a></p><?php
do_action( 'wpmu_upgrade_page' );

View File

@ -26,9 +26,9 @@ if ( $_GET['updated'] == 'true' ) {
case 'all_spam':
_e('Users marked as spam !');
break;
case 'all_notspam':
_e('Users marked as not spam !');
break;
case 'all_notspam':
_e('Users marked as not spam !');
break;
case 'all_delete':
_e('Users deleted !');
break;
@ -85,12 +85,12 @@ if ( $_GET['updated'] == 'true' ) {
// Pagination
$user_navigation = paginate_links( array(
'total' => ceil($total / $num),
'total' => ceil($total / $num),
'current' => $apage,
'base' => add_query_arg( 'apage', '%#%' ),
'format' => ''
));
if ( $user_navigation ) {
$user_navigation = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
number_format_i18n( ( $apage - 1 ) * $num + 1 ),
@ -99,7 +99,7 @@ if ( $_GET['updated'] == 'true' ) {
$user_navigation
);
}
?>
<div class="wrap">
<h2><?php _e( $current_site->site_name ); ?> <?php _e("Users"); ?></h2>
@ -157,11 +157,11 @@ if ( $_GET['updated'] == 'true' ) {
<tbody id="users" class="list:user user-list">
<?php if ($user_list) {
$bgcolor = '';
foreach ( (array) $user_list as $user) {
foreach ( (array) $user_list as $user) {
$class = ('alternate' == $class) ? '' : 'alternate';
$status_list = array( "spam" => "#faa", "deleted" => "#f55" );
$bgcolour = "";
foreach ( $status_list as $status => $col ) {
if( $user[$status] ) {
@ -177,7 +177,7 @@ if ( $_GET['updated'] == 'true' ) {
switch($column_name) {
case 'checkbox': ?>
<th scope="row" class="check-column"><input type='checkbox' id='user_<?php echo $user['ID'] ?>' name='allusers[]' value='<?php echo esc_attr($user['ID']) ?>' /></th>
<?php
<?php
break;
case 'login':
@ -212,7 +212,7 @@ if ( $_GET['updated'] == 'true' ) {
<?php
break;
case 'blogs':
case 'blogs':
$blogs = get_blogs_of_user( $user['ID'], true );
?>
<td>
@ -222,17 +222,17 @@ if ( $_GET['updated'] == 'true' ) {
$path = ($val->path == '/') ? '' : $val->path;
echo '<a href="ms-blogs.php?action=editblog&amp;id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
echo ' <small class="row-actions">';
// Edit
echo '<a href="ms-blogs.php?action=editblog&amp;id=' . $val->userblog_id . '">' . __('Edit') . '</a> | ';
// View
echo '<a ';
echo '<a ';
if( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
echo 'style="background-color: #f66" ';
echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>';
echo '</small><br />';
echo '</small><br />';
}
}
?>
@ -247,20 +247,20 @@ if ( $_GET['updated'] == 'true' ) {
}
endforeach
?>
</tr>
</tr>
<?php
}
} else {
?>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td>
</tr>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td>
</tr>
<?php
} // end if ($users)
?>
?>
</tbody>
</table>
<div class="tablenav">
<?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?>

View File

@ -77,7 +77,7 @@ function get_sitestats() {
function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
global $wpdb;
if( $sitedomain == '' ) {
$site_id = $wpdb->siteid;
} else {
@ -187,7 +187,7 @@ function get_current_user_id() {
* Determine if user is a site admin.
*
* @deprecated Use {@link is_keymaster()}
*
*
*/
function is_site_admin( $user_login = '' ) {
// This function must reside in a file included only if is_multsite() since many plugins
@ -269,7 +269,7 @@ function get_blog_option( $blog_id, $setting, $default = false ) {
function add_blog_option( $id, $key, $value ) {
$id = (int) $id;
switch_to_blog($id);
add_option( $key, $value );
restore_current_blog();
@ -278,7 +278,7 @@ function add_blog_option( $id, $key, $value ) {
function delete_blog_option( $id, $key ) {
$id = (int) $id;
switch_to_blog($id);
delete_option( $key );
restore_current_blog();
@ -287,7 +287,7 @@ function delete_blog_option( $id, $key ) {
function update_blog_option( $id, $key, $value, $refresh = true ) {
$id = (int) $id;
switch_to_blog($id);
update_option( $key, $value );
restore_current_blog();
@ -308,8 +308,8 @@ function switch_to_blog( $new_blog ) {
$switched_stack[] = $blog_id;
/* If we're switching to the same blog id that we're on,
* set the right vars, do the associated actions, but skip
/* If we're switching to the same blog id that we're on,
* set the right vars, do the associated actions, but skip
* the extra unnecessary work */
if ( $blog_id == $new_blog ) {
do_action( 'switch_blog', $blog_id, $blog_id );
@ -407,7 +407,7 @@ function restore_current_blog() {
do_action('switch_blog', $blog_id, $prev_blog_id);
/* If we still have items in the switched stack, consider ourselves still 'switched' */
/* If we still have items in the switched stack, consider ourselves still 'switched' */
$switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 );
return true;
}
@ -511,12 +511,12 @@ function get_active_blog_for_user( $user_id ) { // get an active blog for user -
function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
$user_id = (int) $user_id;
$blog_id = (int) $blog_id;
if( $blog_id == 0 ) {
global $wpdb;
$blog_id = $wpdb->blogid;
}
$blogs = get_blogs_of_user( $user_id );
if( is_array( $blogs ) ) {
return array_key_exists( $blog_id, $blogs );
@ -906,9 +906,9 @@ function validate_email( $email, $check_domain = true) {
function is_email_address_unsafe( $user_email ) {
$banned_names = get_site_option( "banned_email_domains" );
if ($banned_names && !is_array( $banned_names )) {
$banned_names = explode( "\n", $banned_names);
}
if ($banned_names && !is_array( $banned_names )) {
$banned_names = explode( "\n", $banned_names);
}
if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
$email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
foreach( (array) $banned_names as $banned_domain ) {
@ -1116,15 +1116,15 @@ function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = ''
$domain = $wpdb->escape($domain);
$path = $wpdb->escape($path);
$title = $wpdb->escape($title);
$wpdb->insert( $wpdb->signups, array(
'domain' => $domain,
'path' => $path,
'domain' => $domain,
'path' => $path,
'title' => $title,
'user_login' => $user,
'user_email' => $user_email,
'user_login' => $user,
'user_email' => $user_email,
'registered' => current_time('mysql', true),
'activation_key' => $key,
'activation_key' => $key,
'meta' => $meta
) );
@ -1139,15 +1139,15 @@ function wpmu_signup_user($user, $user_email, $meta = '') {
$user_email = sanitize_email( $user_email );
$key = substr( md5( time() . rand() . $user_email ), 0, 16 );
$meta = serialize($meta);
$wpdb->insert( $wpdb->signups, array(
'domain' => '',
'path' => '',
'domain' => '',
'path' => '',
'title' => '',
'user_login' => $user,
'user_email' => $user_email,
'user_login' => $user,
'user_email' => $user_email,
'registered' => current_time('mysql', true),
'activation_key' => $key,
'activation_key' => $key,
'meta' => $meta
) );
@ -1343,25 +1343,25 @@ function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
global $current_site;
if( get_site_option( 'registrationnotification' ) != 'yes' )
return false;
$email = get_site_option( 'admin_email' );
if( is_email($email) == false )
return false;
$options_site_url = clean_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
switch_to_blog( $blog_id );
$blogname = get_option( 'blogname' );
$siteurl = get_option( 'siteurl' );
restore_current_blog();
$msg = sprintf( __( "New Blog: %1s
URL: %2s
Remote IP: %3s
Disable these notifications: %4s"), $blogname, $siteurl, $_SERVER['REMOTE_ADDR'], $options_site_url);
$msg = apply_filters( 'newblog_notify_siteadmin', $msg );
wp_mail( $email, sprintf( __( "New Blog Registration: %s" ), $siteurl ), $msg );
return true;
}
@ -1370,7 +1370,7 @@ function newuser_notify_siteadmin( $user_id ) {
global $current_site;
if( get_site_option( 'registrationnotification' ) != 'yes' )
return false;
$email = get_site_option( 'admin_email' );
if( is_email($email) == false )
return false;
@ -1381,7 +1381,7 @@ function newuser_notify_siteadmin( $user_id ) {
Remote IP: %2s
Disable these notifications: %3s"), $user->user_login, $_SERVER['REMOTE_ADDR'], $options_site_url);
$msg = apply_filters( 'newuser_notify_siteadmin', $msg );
wp_mail( $email, sprintf(__("New User Registration: %s"), $user->user_login), $msg );
return true;
@ -1416,7 +1416,7 @@ function install_blog($blog_id, $blog_title = '') {
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
$wpdb->suppress_errors( false);
@ -1444,7 +1444,7 @@ function install_blog($blog_id, $blog_title = '') {
// Default link category
$cat_name = __('Blogroll');
$cat_slug = sanitize_title($cat_name);
$blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
if( $blogroll_id == null ) {
$wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );
@ -1487,11 +1487,11 @@ function install_blog_defaults($blog_id, $user_id) {
$first_post = str_replace( "SITE_URL", clean_url("http://" . $current_site->domain . $current_site->path), $first_post );
$first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
$wpdb->insert( $wpdb->posts, array(
'post_author' => $user_id,
'post_date' => $now,
'post_author' => $user_id,
'post_date' => $now,
'post_date_gmt' => $now_gmt,
'post_content' => stripslashes( $first_post ),
'post_excerpt' => '',
'post_content' => stripslashes( $first_post ),
'post_excerpt' => '',
'post_title' => __('Hello world!'),
'post_name' => __('hello-world'),
'post_modified' => $now,
@ -1506,11 +1506,11 @@ function install_blog_defaults($blog_id, $user_id) {
// First page
$wpdb->insert( $wpdb->posts, array(
'post_author' => $user_id,
'post_date' => $now,
'post_author' => $user_id,
'post_date' => $now,
'post_date_gmt' => $now_gmt,
'post_content' => get_site_option( 'first_page' ),
'post_excerpt' => '',
'post_excerpt' => '',
'post_title' => __('About'),
'post_name' => __('about'),
'post_modified' => $now,
@ -1521,30 +1521,30 @@ function install_blog_defaults($blog_id, $user_id) {
'pinged' => '',
'post_content_filtered' => ''
) );
// Flush rules to pick up the new page.
$wp_rewrite->init();
$wp_rewrite->flush_rules();
// Default comment
$wpdb->insert( $wpdb->comments, array(
'comment_post_ID' => '1',
'comment_post_ID' => '1',
'comment_author' => __( get_site_option( 'first_comment_author' ) ),
'comment_author_email' => '',
'comment_author_url' => get_site_option( 'first_comment_url' ),
'comment_author_IP' => '127.0.0.1',
'comment_author_IP' => '127.0.0.1',
'comment_date' => $now,
'comment_date_gmt' => $now_gmt,
'comment_date_gmt' => $now_gmt,
'comment_content' => __( get_site_option( 'first_comment' ) )
) );
$user = new WP_User($user_id);
$wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
// Remove all perms except for the login user.
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level') );
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') );
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
if ( !is_site_admin( $user->user_login ) && $user_id != 1 )
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') );
@ -1605,7 +1605,7 @@ function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
if( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
return false;
$welcome_email = get_site_option( 'welcome_user_email' );
$welcome_email = get_site_option( 'welcome_user_email' );
$user = new WP_User($user_id);
@ -1746,12 +1746,12 @@ function upload_is_user_over_quota( $echo = true ) {
}
$spaceAllowed = get_space_allowed();
if(empty($spaceAllowed) || !is_numeric($spaceAllowed))
$spaceAllowed = 10; // Default space allowed is 10 MB
$spaceAllowed = 10; // Default space allowed is 10 MB
$dirName = BLOGUPLOADDIR;
$size = get_dirsize($dirName) / 1024 / 1024;
if( ($spaceAllowed-$size) < 0 ) {
if( ($spaceAllowed-$size) < 0 ) {
if( $echo )
_e( "Sorry, you have used your space allocation. Please delete some files to upload more files." ); //No space left
return true;
@ -1787,7 +1787,7 @@ function fix_import_form_size( $size ) {
if( upload_is_user_over_quota( false ) == true ) {
return 0;
}
$spaceAllowed = 1024 * 1024 * get_space_allowed();
$dirName = BLOGUPLOADDIR;
$dirsize = get_dirsize($dirName) ;
@ -1801,7 +1801,7 @@ function fix_import_form_size( $size ) {
if ( !function_exists('graceful_fail') ) :
function graceful_fail( $message ) {
$message = apply_filters('graceful_fail', $message);
$message_template = apply_filters( 'graceful_fail_template',
$message_template = apply_filters( 'graceful_fail_template',
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@ -1843,7 +1843,7 @@ class delete_blog {
return false;
if( $this->reallydeleteblog == true ) {
wpmu_delete_blog( $wpdb->blogid );
wpmu_delete_blog( $wpdb->blogid );
}
}
@ -1862,14 +1862,14 @@ class delete_blog {
update_option( "delete_blog_hash", $hash );
$url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash;
$msg = __("Dear User,
You recently clicked the 'Delete Blog' link on your blog and filled in a
You recently clicked the 'Delete Blog' link on your blog and filled in a
form on that page.
If you really want to delete your blog, click the link below. You will not
be asked to confirm again so only click this link if you are 100% certain:
URL_DELETE
If you delete your blog, please consider opening a new blog here
some time in the future! (But remember your current blog and username
some time in the future! (But remember your current blog and username
are gone forever.)
Thanks for using the site,
@ -1932,8 +1932,8 @@ function global_terms( $term_id, $deprecated = '' ) {
clean_term_cache($term_id);
return $global_id;
}
return $global_id;
}
function redirect_this_site( $deprecated = '' ) {
global $current_site;
@ -1944,7 +1944,7 @@ function upload_is_file_too_big( $upload ) {
if( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) )
return $upload;
if( strlen( $upload[ 'bits' ] ) > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
return sprintf(__( "This file is too big. Files must be less than %dKb in size.<br />" ), get_site_option( 'fileupload_maxk', 1500 ));
return sprintf(__( "This file is too big. Files must be less than %dKb in size.<br />" ), get_site_option( 'fileupload_maxk', 1500 ));
}
return $upload;
@ -2112,7 +2112,7 @@ function strtolower_usernames( $username, $raw, $strict ) {
return strtolower( $username );
}
/* Short circuit the update checks. Make sure update informtion is
/* Short circuit the update checks. Make sure update informtion is
stored in wp_sitemeta rather than the options table of individual blogs */
// update_plugins (transient)
@ -2197,8 +2197,8 @@ function redirect_mu_dashboard() {
global $current_site, $current_blog;
$dashboard_blog = get_dashboard_blog();
if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) {
$protocol = ( is_ssl() ? 'https://' : 'http://' );
if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) {
$protocol = ( is_ssl() ? 'https://' : 'http://' );
wp_redirect( $protocol . $dashboard_blog->domain . trailingslashit( $dashboard_blog->path ) . 'wp-admin/' );
die();
}
@ -2222,7 +2222,7 @@ function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
$user_id = $current_user->ID;
if( $blog_id == 0 )
$blog_id = $wpdb->blogid;
$local_key = $wpdb->base_prefix . $blog_id . "_" . $key;
if( isset( $current_user->$local_key ) )
return true;
@ -2346,7 +2346,7 @@ function mu_filter_plugins_list( $active_plugins ) {
if ( !$active_sitewide_plugins )
return $active_plugins;
$plugins = array_merge( (array) $active_plugins, array_keys( (array) $active_sitewide_plugins ) );
sort( $plugins );
return $plugins;

View File

@ -53,7 +53,7 @@ function wpmu_current_site() {
$current_site = wp_cache_get( "current_site", "site-options" );
if( $current_site )
return $current_site;
$wpdb->suppress_errors();
$sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
if( count( $sites ) == 1 ) {