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

View File

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

View File

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

View File

@ -280,7 +280,7 @@ if (isset($_GET['updated'])) {
<a name='menu'></a> <a name='menu'></a>
<?php <?php
$menu_perms = get_site_option( "menu_items" ); $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 ) { 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>"; 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> <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"> <form method="post" action="ms-edit.php?action=updateblog">
<?php wp_nonce_field('editblog'); ?> <?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 class='metabox-holder' style='width:49%;float:left;'>
<div id="blogedit_bloginfo" class="postbox " > <div id="blogedit_bloginfo" class="postbox " >
<h3 class='hndle'><span><?php _e('Blog info (wp_blogs)'); ?></span></h3> <h3 class='hndle'><span><?php _e('Blog info (wp_blogs)'); ?></span></h3>
<div class="inside"> <div class="inside">
<table class="form-table"> <table class="form-table">
<tr class="form-field form-required"> <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> <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"> <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;' /> <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> <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"> <tr class="form-field">
<th scope="row"><?php _e('Registered') ?></th> <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> <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details['registered']) ?>" size="40" /></td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row"><?php _e('Last Updated') ?></th> <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> <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>
<tr class="form-field"> <tr class="form-field">
<th scope="row"><?php _e('Public') ?></th> <th scope="row"><?php _e('Public') ?></th>
<td> <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='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') ?> <input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td> </td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row"><?php _e( 'Archived' ); ?></th> <th scope="row"><?php _e( 'Archived' ); ?></th>
<td> <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='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') ?> <input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td> </td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row"><?php _e( 'Mature' ); ?></th> <th scope="row"><?php _e( 'Mature' ); ?></th>
<td> <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='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') ?> <input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td> </td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row"><?php _e( 'Spam' ); ?></th> <th scope="row"><?php _e( 'Spam' ); ?></th>
<td> <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='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') ?> <input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td> </td>
</tr> </tr>
<tr class="form-field"> <tr class="form-field">
<th scope="row"><?php _e( 'Deleted' ); ?></th> <th scope="row"><?php _e( 'Deleted' ); ?></th>
<td> <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='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') ?> <input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td> </td>
</tr> </tr>
</table> </table>
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> <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>
<div id="blogedit_blogoptions" class="postbox " > <div id="blogedit_blogoptions" class="postbox " >
<h3 class='hndle'><span><?php printf( __('Blog options (wp_%s_options)'), $id ); ?></span></h3> <h3 class='hndle'><span><?php printf( __('Blog options (wp_%s_options)'), $id ); ?></span></h3>
<div class="inside"> <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") ) { if ( stristr($val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) {
?> ?>
<tr class="form-field"> <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> <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> </tr>
<?php <?php
} else { } else {
?> ?>
<tr class="form-field"> <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><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> <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> </tr>
<?php <?php
} }
} // End foreach } // 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> <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>
</div> </div>
<div class='metabox-holder' style='width:49%;float:right;'> <div class='metabox-holder' style='width:49%;float:right;'>
<?php <?php
// Blog Themes // Blog Themes
@ -199,12 +199,12 @@ switch( $_GET['action'] ) {
if( isset($allowed_themes[$theme_key] ) == false ) { if( isset($allowed_themes[$theme_key] ) == false ) {
$checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
$out .= '<tr class="form-field form-required"> $out .= '<tr class="form-field form-required">
<th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th> <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> <td><input name="theme['.$theme_key.']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>
</tr>'; </tr>';
} }
} }
if ( $out != '' ) { if ( $out != '' ) {
?> ?>
<div id="blogedit_blogthemes" class="postbox"> <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> <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>
<?php } ?> <?php } ?>
<?php <?php
// Blog users // Blog users
$blogusers = get_users_of_blog( $id ); $blogusers = get_users_of_blog( $id );
@ -236,7 +236,7 @@ switch( $_GET['action'] ) {
if( $val->user_id != $current_user->data->ID ) { if( $val->user_id != $current_user->data->ID ) {
?> ?>
<td> <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 ){ foreach( $editblog_roles as $role => $role_assoc ){
$name = translate_with_context($role_assoc['name']); $name = translate_with_context($role_assoc['name']);
$selected = ( $role == $existing_role ) ? 'selected="selected"' : ''; $selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
@ -260,7 +260,7 @@ switch( $_GET['action'] ) {
echo "</div></div>"; echo "</div></div>";
} }
?> ?>
<div id="blogedit_blogadduser" class="postbox"> <div id="blogedit_blogadduser" class="postbox">
<h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3> <h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3>
<div class="inside"> <div class="inside">
@ -274,7 +274,7 @@ switch( $_GET['action'] ) {
<th scope="row"><?php _e('Role:') ?></th> <th scope="row"><?php _e('Role:') ?></th>
<td> <td>
<select name="new_role" id="new_role"> <select name="new_role" id="new_role">
<?php <?php
reset( $editblog_roles ); reset( $editblog_roles );
foreach( $editblog_roles as $role => $role_assoc ){ foreach( $editblog_roles as $role => $role_assoc ){
$name = translate_with_context($role_assoc['name']); $name = translate_with_context($role_assoc['name']);
@ -288,7 +288,7 @@ switch( $_GET['action'] ) {
</table> </table>
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> <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>
<div id="blogedit_miscoptions" class="postbox"> <div id="blogedit_miscoptions" class="postbox">
<h3 class='hndle'><span><?php _e('Misc Blog Actions') ?></span></h3> <h3 class='hndle'><span><?php _e('Misc Blog Actions') ?></span></h3>
<div class="inside"> <div class="inside">
@ -297,9 +297,9 @@ switch( $_GET['action'] ) {
</table> </table>
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php esc_attr_e('Update Options') ?>" /></p> <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>
</div> </div>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</form> </form>
</div> </div>
@ -324,7 +324,7 @@ switch( $_GET['action'] ) {
WHERE site_id = '{$wpdb->siteid}' WHERE site_id = '{$wpdb->siteid}'
AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
AND {$wpdb->registration_log}.IP LIKE ('%{$s}%')"; AND {$wpdb->registration_log}.IP LIKE ('%{$s}%')";
} }
if( isset( $_GET['sortby'] ) == false ) { if( isset( $_GET['sortby'] ) == false ) {
$_GET['sortby'] = 'id'; $_GET['sortby'] = 'id';
@ -407,10 +407,10 @@ switch( $_GET['action'] ) {
'registered' => __('Registered'), 'registered' => __('Registered'),
'users' => __('Users') 'users' => __('Users')
); );
if( has_filter( 'wpmublogsaction' ) ) if( has_filter( 'wpmublogsaction' ) )
$posts_columns['plugins'] = __('Actions'); $posts_columns['plugins'] = __('Actions');
$posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns); $posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
$sortby_url = "s="; $sortby_url = "s=";
@ -427,7 +427,7 @@ switch( $_GET['action'] ) {
<th scope="col" class="check-column"></th> <th scope="col" class="check-column"></th>
<?php foreach($posts_columns as $column_id => $column_display_name) { <?php foreach($posts_columns as $column_id => $column_display_name) {
$column_link = "<a href='ms-blogs.php?{$sortby_url}&amp;sortby={$column_id}&amp;"; $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 .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&amp;' : 'order=DESC&amp;';
} }
$column_link .= "apage={$apage}'>{$column_display_name}</a>"; $column_link .= "apage={$apage}'>{$column_display_name}</a>";
@ -443,7 +443,7 @@ switch( $_GET['action'] ) {
if ($blog_list) { if ($blog_list) {
$bgcolor = $class = ''; $bgcolor = $class = '';
$status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" ); $status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
foreach ($blog_list as $blog) { foreach ($blog_list as $blog) {
$class = ('alternate' == $class) ? '' : 'alternate'; $class = ('alternate' == $class) ? '' : 'alternate';
reset( $status_list ); reset( $status_list );
@ -455,7 +455,7 @@ switch( $_GET['action'] ) {
} }
echo "<tr $bgcolour class='$class'>"; 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 ) { foreach( $posts_columns as $column_name=>$column_display_name ) {
switch($column_name) { switch($column_name) {
case 'id': ?> case 'id': ?>
@ -467,7 +467,7 @@ switch( $_GET['action'] ) {
</th> </th>
<?php <?php
break; break;
case 'blogname': ?> case 'blogname': ?>
<td valign="top"> <td valign="top">
<a href="ms-blogs.php?action=editblog&amp;id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; ?></a> <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 = array();
$controlActions[] = '<a href="ms-blogs.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>'; $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>'; $controlActions[] = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>';
if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) 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>'; $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 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>'; $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' ) 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>'; $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 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>'; $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' ) 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>'; $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 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=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 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>'; $controlActions[] = "<a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'>" . __('Visit') . '</a>';
?> ?>
<?php if (count($controlActions)) : ?> <?php if (count($controlActions)) : ?>
<div class="row-actions"> <div class="row-actions">
<?php echo implode(' | ', $controlActions); ?> <?php echo implode(' | ', $controlActions); ?>
@ -505,7 +505,7 @@ switch( $_GET['action'] ) {
</td> </td>
<?php <?php
break; break;
case 'lastupdated': ?> case 'lastupdated': ?>
<td valign="top"> <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']); ?> <?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': ?> case 'users': ?>
<td valign="top"> <td valign="top">
<?php <?php
$blogusers = get_users_of_blog( $blog['blog_id'] ); $blogusers = get_users_of_blog( $blog['blog_id'] );
if ( is_array( $blogusers ) ) { if ( is_array( $blogusers ) ) {
$blogusers_warning = ''; $blogusers_warning = '';
if ( count( $blogusers ) > 5 ) { 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>'; $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 ) { 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 != '' ) { if( $blogusers_warning != '' ) {
echo '<strong>' . $blogusers_warning . '</strong><br />'; echo '<strong>' . $blogusers_warning . '</strong><br />';
@ -548,7 +548,7 @@ switch( $_GET['action'] ) {
</td> </td>
<?php } ?> <?php } ?>
<?php break; <?php break;
default: ?> default: ?>
<?php if( has_filter( 'manage_blogs_custom_column' ) ) { ?> <?php if( has_filter( 'manage_blogs_custom_column' ) ) { ?>
<td valign="top"> <td valign="top">
@ -563,9 +563,9 @@ switch( $_GET['action'] ) {
<?php <?php
} }
} else { ?> } else { ?>
<tr style='background-color: <?php echo $bgcolor; ?>'> <tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="8"><?php _e('No blogs found.') ?></td> <td colspan="8"><?php _e('No blogs found.') ?></td>
</tr> </tr>
<?php <?php
} // end if ($blogs) } // end if ($blogs)
?> ?>
@ -585,10 +585,10 @@ switch( $_GET['action'] ) {
<th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th> <th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th>
<td> <td>
<?php if ( constant( "VHOST" ) == 'yes' ) { ?> <?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 { <?php } else {
echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/> 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>"; echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
?> ?>
</td> </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>" ); 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( 'after_mu_upgrade', $response );
do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
} }
} }
echo "</ul>"; echo "</ul>";
@ -54,7 +54,7 @@ switch( $_GET['action'] ) {
echo '<p>'.__('All Done!').'</p>'; echo '<p>'.__('All Done!').'</p>';
} }
break; 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><?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 <p><a class="button" href="ms-upgrade-site.php?action=upgrade"><?php _e("Upgrade Site"); ?></a></p><?php
do_action( 'wpmu_upgrade_page' ); do_action( 'wpmu_upgrade_page' );

View File

@ -26,9 +26,9 @@ if ( $_GET['updated'] == 'true' ) {
case 'all_spam': case 'all_spam':
_e('Users marked as spam !'); _e('Users marked as spam !');
break; break;
case 'all_notspam': case 'all_notspam':
_e('Users marked as not spam !'); _e('Users marked as not spam !');
break; break;
case 'all_delete': case 'all_delete':
_e('Users deleted !'); _e('Users deleted !');
break; break;
@ -85,12 +85,12 @@ if ( $_GET['updated'] == 'true' ) {
// Pagination // Pagination
$user_navigation = paginate_links( array( $user_navigation = paginate_links( array(
'total' => ceil($total / $num), 'total' => ceil($total / $num),
'current' => $apage, 'current' => $apage,
'base' => add_query_arg( 'apage', '%#%' ), 'base' => add_query_arg( 'apage', '%#%' ),
'format' => '' 'format' => ''
)); ));
if ( $user_navigation ) { if ( $user_navigation ) {
$user_navigation = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s', $user_navigation = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
number_format_i18n( ( $apage - 1 ) * $num + 1 ), number_format_i18n( ( $apage - 1 ) * $num + 1 ),
@ -99,7 +99,7 @@ if ( $_GET['updated'] == 'true' ) {
$user_navigation $user_navigation
); );
} }
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e( $current_site->site_name ); ?> <?php _e("Users"); ?></h2> <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"> <tbody id="users" class="list:user user-list">
<?php if ($user_list) { <?php if ($user_list) {
$bgcolor = ''; $bgcolor = '';
foreach ( (array) $user_list as $user) { foreach ( (array) $user_list as $user) {
$class = ('alternate' == $class) ? '' : 'alternate'; $class = ('alternate' == $class) ? '' : 'alternate';
$status_list = array( "spam" => "#faa", "deleted" => "#f55" ); $status_list = array( "spam" => "#faa", "deleted" => "#f55" );
$bgcolour = ""; $bgcolour = "";
foreach ( $status_list as $status => $col ) { foreach ( $status_list as $status => $col ) {
if( $user[$status] ) { if( $user[$status] ) {
@ -177,7 +177,7 @@ if ( $_GET['updated'] == 'true' ) {
switch($column_name) { switch($column_name) {
case 'checkbox': ?> 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> <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; break;
case 'login': case 'login':
@ -212,7 +212,7 @@ if ( $_GET['updated'] == 'true' ) {
<?php <?php
break; break;
case 'blogs': case 'blogs':
$blogs = get_blogs_of_user( $user['ID'], true ); $blogs = get_blogs_of_user( $user['ID'], true );
?> ?>
<td> <td>
@ -222,17 +222,17 @@ if ( $_GET['updated'] == 'true' ) {
$path = ($val->path == '/') ? '' : $val->path; $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 '<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">'; echo ' <small class="row-actions">';
// Edit // Edit
echo '<a href="ms-blogs.php?action=editblog&amp;id=' . $val->userblog_id . '">' . __('Edit') . '</a> | '; echo '<a href="ms-blogs.php?action=editblog&amp;id=' . $val->userblog_id . '">' . __('Edit') . '</a> | ';
// View // View
echo '<a '; echo '<a ';
if( get_blog_status( $val->userblog_id, 'spam' ) == 1 ) if( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
echo 'style="background-color: #f66" '; echo 'style="background-color: #f66" ';
echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>'; 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 endforeach
?> ?>
</tr> </tr>
<?php <?php
} }
} else { } else {
?> ?>
<tr style='background-color: <?php echo $bgcolor; ?>'> <tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td> <td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td>
</tr> </tr>
<?php <?php
} // end if ($users) } // end if ($users)
?> ?>
</tbody> </tbody>
</table> </table>
<div class="tablenav"> <div class="tablenav">
<?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?> <?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 = '' ) { function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
global $wpdb; global $wpdb;
if( $sitedomain == '' ) { if( $sitedomain == '' ) {
$site_id = $wpdb->siteid; $site_id = $wpdb->siteid;
} else { } else {
@ -187,7 +187,7 @@ function get_current_user_id() {
* Determine if user is a site admin. * Determine if user is a site admin.
* *
* @deprecated Use {@link is_keymaster()} * @deprecated Use {@link is_keymaster()}
* *
*/ */
function is_site_admin( $user_login = '' ) { function is_site_admin( $user_login = '' ) {
// This function must reside in a file included only if is_multsite() since many plugins // 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 ) { function add_blog_option( $id, $key, $value ) {
$id = (int) $id; $id = (int) $id;
switch_to_blog($id); switch_to_blog($id);
add_option( $key, $value ); add_option( $key, $value );
restore_current_blog(); restore_current_blog();
@ -278,7 +278,7 @@ function add_blog_option( $id, $key, $value ) {
function delete_blog_option( $id, $key ) { function delete_blog_option( $id, $key ) {
$id = (int) $id; $id = (int) $id;
switch_to_blog($id); switch_to_blog($id);
delete_option( $key ); delete_option( $key );
restore_current_blog(); restore_current_blog();
@ -287,7 +287,7 @@ function delete_blog_option( $id, $key ) {
function update_blog_option( $id, $key, $value, $refresh = true ) { function update_blog_option( $id, $key, $value, $refresh = true ) {
$id = (int) $id; $id = (int) $id;
switch_to_blog($id); switch_to_blog($id);
update_option( $key, $value ); update_option( $key, $value );
restore_current_blog(); restore_current_blog();
@ -308,8 +308,8 @@ function switch_to_blog( $new_blog ) {
$switched_stack[] = $blog_id; $switched_stack[] = $blog_id;
/* If we're switching to the same blog id that we're on, /* If we're switching to the same blog id that we're on,
* set the right vars, do the associated actions, but skip * set the right vars, do the associated actions, but skip
* the extra unnecessary work */ * the extra unnecessary work */
if ( $blog_id == $new_blog ) { if ( $blog_id == $new_blog ) {
do_action( 'switch_blog', $blog_id, $blog_id ); 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); 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 ); $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 );
return true; 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 ) { function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
$user_id = (int) $user_id; $user_id = (int) $user_id;
$blog_id = (int) $blog_id; $blog_id = (int) $blog_id;
if( $blog_id == 0 ) { if( $blog_id == 0 ) {
global $wpdb; global $wpdb;
$blog_id = $wpdb->blogid; $blog_id = $wpdb->blogid;
} }
$blogs = get_blogs_of_user( $user_id ); $blogs = get_blogs_of_user( $user_id );
if( is_array( $blogs ) ) { if( is_array( $blogs ) ) {
return array_key_exists( $blog_id, $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 ) { function is_email_address_unsafe( $user_email ) {
$banned_names = get_site_option( "banned_email_domains" ); $banned_names = get_site_option( "banned_email_domains" );
if ($banned_names && !is_array( $banned_names )) { if ($banned_names && !is_array( $banned_names )) {
$banned_names = explode( "\n", $banned_names); $banned_names = explode( "\n", $banned_names);
} }
if ( is_array( $banned_names ) && empty( $banned_names ) == false ) { if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
$email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) ); $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
foreach( (array) $banned_names as $banned_domain ) { 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); $domain = $wpdb->escape($domain);
$path = $wpdb->escape($path); $path = $wpdb->escape($path);
$title = $wpdb->escape($title); $title = $wpdb->escape($title);
$wpdb->insert( $wpdb->signups, array( $wpdb->insert( $wpdb->signups, array(
'domain' => $domain, 'domain' => $domain,
'path' => $path, 'path' => $path,
'title' => $title, 'title' => $title,
'user_login' => $user, 'user_login' => $user,
'user_email' => $user_email, 'user_email' => $user_email,
'registered' => current_time('mysql', true), 'registered' => current_time('mysql', true),
'activation_key' => $key, 'activation_key' => $key,
'meta' => $meta 'meta' => $meta
) ); ) );
@ -1139,15 +1139,15 @@ function wpmu_signup_user($user, $user_email, $meta = '') {
$user_email = sanitize_email( $user_email ); $user_email = sanitize_email( $user_email );
$key = substr( md5( time() . rand() . $user_email ), 0, 16 ); $key = substr( md5( time() . rand() . $user_email ), 0, 16 );
$meta = serialize($meta); $meta = serialize($meta);
$wpdb->insert( $wpdb->signups, array( $wpdb->insert( $wpdb->signups, array(
'domain' => '', 'domain' => '',
'path' => '', 'path' => '',
'title' => '', 'title' => '',
'user_login' => $user, 'user_login' => $user,
'user_email' => $user_email, 'user_email' => $user_email,
'registered' => current_time('mysql', true), 'registered' => current_time('mysql', true),
'activation_key' => $key, 'activation_key' => $key,
'meta' => $meta 'meta' => $meta
) ); ) );
@ -1343,25 +1343,25 @@ function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
global $current_site; global $current_site;
if( get_site_option( 'registrationnotification' ) != 'yes' ) if( get_site_option( 'registrationnotification' ) != 'yes' )
return false; return false;
$email = get_site_option( 'admin_email' ); $email = get_site_option( 'admin_email' );
if( is_email($email) == false ) if( is_email($email) == false )
return false; return false;
$options_site_url = clean_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php"); $options_site_url = clean_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");
switch_to_blog( $blog_id ); switch_to_blog( $blog_id );
$blogname = get_option( 'blogname' ); $blogname = get_option( 'blogname' );
$siteurl = get_option( 'siteurl' ); $siteurl = get_option( 'siteurl' );
restore_current_blog(); restore_current_blog();
$msg = sprintf( __( "New Blog: %1s $msg = sprintf( __( "New Blog: %1s
URL: %2s URL: %2s
Remote IP: %3s Remote IP: %3s
Disable these notifications: %4s"), $blogname, $siteurl, $_SERVER['REMOTE_ADDR'], $options_site_url); Disable these notifications: %4s"), $blogname, $siteurl, $_SERVER['REMOTE_ADDR'], $options_site_url);
$msg = apply_filters( 'newblog_notify_siteadmin', $msg ); $msg = apply_filters( 'newblog_notify_siteadmin', $msg );
wp_mail( $email, sprintf( __( "New Blog Registration: %s" ), $siteurl ), $msg ); wp_mail( $email, sprintf( __( "New Blog Registration: %s" ), $siteurl ), $msg );
return true; return true;
} }
@ -1370,7 +1370,7 @@ function newuser_notify_siteadmin( $user_id ) {
global $current_site; global $current_site;
if( get_site_option( 'registrationnotification' ) != 'yes' ) if( get_site_option( 'registrationnotification' ) != 'yes' )
return false; return false;
$email = get_site_option( 'admin_email' ); $email = get_site_option( 'admin_email' );
if( is_email($email) == false ) if( is_email($email) == false )
return false; return false;
@ -1381,7 +1381,7 @@ function newuser_notify_siteadmin( $user_id ) {
Remote IP: %2s Remote IP: %2s
Disable these notifications: %3s"), $user->user_login, $_SERVER['REMOTE_ADDR'], $options_site_url); Disable these notifications: %3s"), $user->user_login, $_SERVER['REMOTE_ADDR'], $options_site_url);
$msg = apply_filters( 'newuser_notify_siteadmin', $msg ); $msg = apply_filters( 'newuser_notify_siteadmin', $msg );
wp_mail( $email, sprintf(__("New User Registration: %s"), $user->user_login), $msg ); wp_mail( $email, sprintf(__("New User Registration: %s"), $user->user_login), $msg );
return true; return true;
@ -1416,7 +1416,7 @@ function install_blog($blog_id, $blog_title = '') {
require_once( ABSPATH . 'wp-admin/includes/upgrade.php'); 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>'); 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); $wpdb->suppress_errors( false);
@ -1444,7 +1444,7 @@ function install_blog($blog_id, $blog_title = '') {
// Default link category // Default link category
$cat_name = __('Blogroll'); $cat_name = __('Blogroll');
$cat_slug = sanitize_title($cat_name); $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 ) ); $blogroll_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
if( $blogroll_id == null ) { 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)) ); $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_URL", clean_url("http://" . $current_site->domain . $current_site->path), $first_post );
$first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post ); $first_post = str_replace( "SITE_NAME", $current_site->site_name, $first_post );
$wpdb->insert( $wpdb->posts, array( $wpdb->insert( $wpdb->posts, array(
'post_author' => $user_id, 'post_author' => $user_id,
'post_date' => $now, 'post_date' => $now,
'post_date_gmt' => $now_gmt, 'post_date_gmt' => $now_gmt,
'post_content' => stripslashes( $first_post ), 'post_content' => stripslashes( $first_post ),
'post_excerpt' => '', 'post_excerpt' => '',
'post_title' => __('Hello world!'), 'post_title' => __('Hello world!'),
'post_name' => __('hello-world'), 'post_name' => __('hello-world'),
'post_modified' => $now, 'post_modified' => $now,
@ -1506,11 +1506,11 @@ function install_blog_defaults($blog_id, $user_id) {
// First page // First page
$wpdb->insert( $wpdb->posts, array( $wpdb->insert( $wpdb->posts, array(
'post_author' => $user_id, 'post_author' => $user_id,
'post_date' => $now, 'post_date' => $now,
'post_date_gmt' => $now_gmt, 'post_date_gmt' => $now_gmt,
'post_content' => get_site_option( 'first_page' ), 'post_content' => get_site_option( 'first_page' ),
'post_excerpt' => '', 'post_excerpt' => '',
'post_title' => __('About'), 'post_title' => __('About'),
'post_name' => __('about'), 'post_name' => __('about'),
'post_modified' => $now, 'post_modified' => $now,
@ -1521,30 +1521,30 @@ function install_blog_defaults($blog_id, $user_id) {
'pinged' => '', 'pinged' => '',
'post_content_filtered' => '' 'post_content_filtered' => ''
) ); ) );
// Flush rules to pick up the new page. // Flush rules to pick up the new page.
$wp_rewrite->init(); $wp_rewrite->init();
$wp_rewrite->flush_rules(); $wp_rewrite->flush_rules();
// Default comment // Default comment
$wpdb->insert( $wpdb->comments, array( $wpdb->insert( $wpdb->comments, array(
'comment_post_ID' => '1', 'comment_post_ID' => '1',
'comment_author' => __( get_site_option( 'first_comment_author' ) ), 'comment_author' => __( get_site_option( 'first_comment_author' ) ),
'comment_author_email' => '', 'comment_author_email' => '',
'comment_author_url' => get_site_option( 'first_comment_url' ), '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' => $now,
'comment_date_gmt' => $now_gmt, 'comment_date_gmt' => $now_gmt,
'comment_content' => __( get_site_option( 'first_comment' ) ) 'comment_content' => __( get_site_option( 'first_comment' ) )
) ); ) );
$user = new WP_User($user_id); $user = new WP_User($user_id);
$wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') ); $wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
// Remove all perms except for the login user. // 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.'user_level') );
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') ); $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. // 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 ) 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') ); $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) ) if( !apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta) )
return false; return false;
$welcome_email = get_site_option( 'welcome_user_email' ); $welcome_email = get_site_option( 'welcome_user_email' );
$user = new WP_User($user_id); $user = new WP_User($user_id);
@ -1746,12 +1746,12 @@ function upload_is_user_over_quota( $echo = true ) {
} }
$spaceAllowed = get_space_allowed(); $spaceAllowed = get_space_allowed();
if(empty($spaceAllowed) || !is_numeric($spaceAllowed)) if(empty($spaceAllowed) || !is_numeric($spaceAllowed))
$spaceAllowed = 10; // Default space allowed is 10 MB $spaceAllowed = 10; // Default space allowed is 10 MB
$dirName = BLOGUPLOADDIR; $dirName = BLOGUPLOADDIR;
$size = get_dirsize($dirName) / 1024 / 1024; $size = get_dirsize($dirName) / 1024 / 1024;
if( ($spaceAllowed-$size) < 0 ) { if( ($spaceAllowed-$size) < 0 ) {
if( $echo ) if( $echo )
_e( "Sorry, you have used your space allocation. Please delete some files to upload more files." ); //No space left _e( "Sorry, you have used your space allocation. Please delete some files to upload more files." ); //No space left
return true; return true;
@ -1787,7 +1787,7 @@ function fix_import_form_size( $size ) {
if( upload_is_user_over_quota( false ) == true ) { if( upload_is_user_over_quota( false ) == true ) {
return 0; return 0;
} }
$spaceAllowed = 1024 * 1024 * get_space_allowed(); $spaceAllowed = 1024 * 1024 * get_space_allowed();
$dirName = BLOGUPLOADDIR; $dirName = BLOGUPLOADDIR;
$dirsize = get_dirsize($dirName) ; $dirsize = get_dirsize($dirName) ;
@ -1801,7 +1801,7 @@ function fix_import_form_size( $size ) {
if ( !function_exists('graceful_fail') ) : if ( !function_exists('graceful_fail') ) :
function graceful_fail( $message ) { function graceful_fail( $message ) {
$message = apply_filters('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"> '<!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"> <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" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@ -1843,7 +1843,7 @@ class delete_blog {
return false; return false;
if( $this->reallydeleteblog == true ) { 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 ); update_option( "delete_blog_hash", $hash );
$url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash; $url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash;
$msg = __("Dear User, $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. form on that page.
If you really want to delete your blog, click the link below. You will not 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: be asked to confirm again so only click this link if you are 100% certain:
URL_DELETE URL_DELETE
If you delete your blog, please consider opening a new blog here 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.) are gone forever.)
Thanks for using the site, Thanks for using the site,
@ -1932,8 +1932,8 @@ function global_terms( $term_id, $deprecated = '' ) {
clean_term_cache($term_id); clean_term_cache($term_id);
return $global_id; return $global_id;
} }
function redirect_this_site( $deprecated = '' ) { function redirect_this_site( $deprecated = '' ) {
global $current_site; global $current_site;
@ -1944,7 +1944,7 @@ function upload_is_file_too_big( $upload ) {
if( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) ) if( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) )
return $upload; return $upload;
if( strlen( $upload[ 'bits' ] ) > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) { 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; return $upload;
@ -2112,7 +2112,7 @@ function strtolower_usernames( $username, $raw, $strict ) {
return strtolower( $username ); 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 */ stored in wp_sitemeta rather than the options table of individual blogs */
// update_plugins (transient) // update_plugins (transient)
@ -2197,8 +2197,8 @@ function redirect_mu_dashboard() {
global $current_site, $current_blog; global $current_site, $current_blog;
$dashboard_blog = get_dashboard_blog(); $dashboard_blog = get_dashboard_blog();
if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) { if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) {
$protocol = ( is_ssl() ? 'https://' : 'http://' ); $protocol = ( is_ssl() ? 'https://' : 'http://' );
wp_redirect( $protocol . $dashboard_blog->domain . trailingslashit( $dashboard_blog->path ) . 'wp-admin/' ); wp_redirect( $protocol . $dashboard_blog->domain . trailingslashit( $dashboard_blog->path ) . 'wp-admin/' );
die(); die();
} }
@ -2222,7 +2222,7 @@ function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
$user_id = $current_user->ID; $user_id = $current_user->ID;
if( $blog_id == 0 ) if( $blog_id == 0 )
$blog_id = $wpdb->blogid; $blog_id = $wpdb->blogid;
$local_key = $wpdb->base_prefix . $blog_id . "_" . $key; $local_key = $wpdb->base_prefix . $blog_id . "_" . $key;
if( isset( $current_user->$local_key ) ) if( isset( $current_user->$local_key ) )
return true; return true;
@ -2346,7 +2346,7 @@ function mu_filter_plugins_list( $active_plugins ) {
if ( !$active_sitewide_plugins ) if ( !$active_sitewide_plugins )
return $active_plugins; return $active_plugins;
$plugins = array_merge( (array) $active_plugins, array_keys( (array) $active_sitewide_plugins ) ); $plugins = array_merge( (array) $active_plugins, array_keys( (array) $active_sitewide_plugins ) );
sort( $plugins ); sort( $plugins );
return $plugins; return $plugins;

View File

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