<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -410,8 +410,8 @@ Thanks!
 	$current_site-&gt;site_name = ucfirst( $domain );
 
 	wpmu_create_blog( $domain, $base, $weblog_title, $user_id, array( 'blog_public' =&gt; 1, 'public' =&gt; 1 ) );
-	update_blog_option( 1, 'template', 'portal');
-	update_blog_option( 1, 'stylesheet', 'portal');
+	update_blog_option( 1, 'template', 'home');
+	update_blog_option( 1, 'stylesheet', 'home');
 	if( constant( 'VHOST' ) == 'yes' ) {
 		update_blog_option( 1, 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
 	} else {</diff>
      <filename>index-install.php</filename>
    </modified>
    <modified>
      <diff>@@ -110,7 +110,7 @@ if ( ($is_gecko || $is_winIE) &amp;&amp; strpos(strtolower($_SERVER['HTTP_USER_AGENT']),
 
 &lt;?php } ?&gt;
 
-&lt;div id=&quot;user_info&quot;&gt;&lt;p&gt;&lt;?php printf(__('Howdy, &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;/a&gt;!'), 'profile.php', $user_identity) ?&gt; | &lt;a href=&quot;&lt;?php echo site_url('wp-login.php?action=logout', 'login') ?&gt;&quot; title=&quot;&lt;?php _e('Log Out') ?&gt;&quot;&gt;&lt;?php _e('Log Out'); ?&gt;&lt;/a&gt; | &lt;?php echo apply_filters( 'admin_header_navigation', __('&lt;a href=&quot;http://codex.wordpress.org/&quot;&gt;Help&lt;/a&gt;') . ' | ' . __('&lt;a href=&quot;http://wordpress.org/support/&quot;&gt;Forums&lt;/a&gt;') ); if ( $gears_compat ) { ?&gt; | &lt;span id=&quot;gears-menu&quot;&gt;&lt;a href=&quot;#&quot; onclick=&quot;wpGears.message(1);return false;&quot;&gt;&lt;?php _e('Turbo') ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;?php } ?&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div id=&quot;user_info&quot;&gt;&lt;p&gt;&lt;?php printf(__('Howdy, &lt;a href=&quot;%1$s&quot;&gt;%2$s&lt;/a&gt;!'), 'profile.php', $user_identity) ?&gt; | &lt;a href=&quot;&lt;?php echo site_url('wp-login.php?action=logout', 'login') ?&gt;&quot; title=&quot;&lt;?php _e('Log Out') ?&gt;&quot;&gt;&lt;?php _e('Log Out'); ?&gt;&lt;/a&gt;&lt;?php echo apply_filters( 'admin_header_navigation', __(' | &lt;a href=&quot;http://codex.wordpress.org/&quot;&gt;Help&lt;/a&gt;') . ' | ' . __('&lt;a href=&quot;http://wordpress.org/support/&quot;&gt;Forums&lt;/a&gt;') ); if ( $gears_compat ) { ?&gt; | &lt;span id=&quot;gears-menu&quot;&gt;&lt;a href=&quot;#&quot; onclick=&quot;wpGears.message(1);return false;&quot;&gt;&lt;?php _e('Turbo') ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;?php } ?&gt;&lt;/p&gt;&lt;/div&gt;
 
 &lt;?php
 require(ABSPATH . 'wp-admin/menu-header.php');</diff>
      <filename>wp-admin/admin-header.php</filename>
    </modified>
    <modified>
      <diff>@@ -33,3 +33,9 @@ form#all-my-blogs p, form#all-my-blogs p * {
 #all-my-blogs a:hover, #all-my-blogs a:active  {
 	text-decoration: none;
 }
+
+form#wpmu-search {
+	position:absolute;
+	right:0;
+	top:0;
+}</diff>
      <filename>wp-admin/css/mu.css</filename>
    </modified>
    <modified>
      <diff>@@ -663,7 +663,7 @@ remove_action( 'media_buttons', 'media_buttons' );
 function secret_salt_warning() {
 	if( !is_site_admin() )
 		return;
-	$secret_keys = array( 'SECRET_KEY', 'SECRET_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'AUTH_KEY', 'SECURE_AUTH_KEY' );
+	$secret_keys = array( 'SECRET_KEY', 'SECRET_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'AUTH_KEY', 'SECURE_AUTH_KEY', 'SECURE_AUTH_SALT' );
 	$out = '';
 	foreach( $secret_keys as $key ) {
 		if( !defined( $key ) )</diff>
      <filename>wp-admin/includes/mu.php</filename>
    </modified>
    <modified>
      <diff>@@ -312,7 +312,9 @@ function print_plugins_table($plugins, $context = '') {
 &lt;?php print_plugins_table($active_plugins, 'active') ?&gt;
 &lt;/form&gt;
 
+&lt;?php if( is_site_admin() ) { ?&gt;
 &lt;p&gt;&lt;?php printf(__('If something goes wrong with a plugin and you can&amp;#8217;t use WordPress, delete or rename that file in the &lt;code&gt;%s&lt;/code&gt; directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?&gt;&lt;/p&gt;
+&lt;?php } ?&gt;
 &lt;?php endif; ?&gt;
 
 &lt;?php if ( ! empty($recent_plugins) ) : ?&gt;</diff>
      <filename>wp-admin/plugins.php</filename>
    </modified>
    <modified>
      <diff>@@ -264,8 +264,9 @@ case 'addexistinguser':
 			if( ($username != null &amp;&amp; is_site_admin( $username ) == false ) &amp;&amp; ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
 				$location = 'users.php?update=add_existing';
 			} else {
-				add_user_to_blog('', $user_id, $_REQUEST[ 'new_role' ]);
-				do_action( &quot;added_existing_user&quot;, $user_id );
+				$newuser_key = substr( md5( $user_id ), 0, 5 );
+				add_option( 'new_user_' . $newuser_key, array( 'user_id' =&gt; $user_id, 'email' =&gt; $user-&gt;user_email, 'role' =&gt; $_REQUEST[ 'new_role' ] ) );
+				wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), &quot;Hi,\n\nYou have been invited to join '&quot; . get_option( 'blogname' ) . &quot;' at\n&quot; . site_url() . &quot;\nPlease click the following link to confirm the invite:\n&quot; . site_url( &quot;/newbloguser/$newuser_key/&quot; ) );
 				$location = 'users.php?update=add';
 			}
 			wp_redirect(&quot;$location&quot;);</diff>
      <filename>wp-admin/users.php</filename>
    </modified>
    <modified>
      <diff>@@ -294,23 +294,16 @@ switch( $_GET['action'] ) {
 		$query = &quot;SELECT * FROM {$wpdb-&gt;blogs} WHERE site_id = '{$wpdb-&gt;siteid}' &quot;;
 
 		if( isset($_GET['blog_name']) ) {
-			$query = &quot;SELECT blog_id, {$wpdb-&gt;blogs}.domain, {$wpdb-&gt;blogs}.path, registered, last_updated
-				FROM {$wpdb-&gt;blogs}, {$wpdb-&gt;site}
-				WHERE site_id = '{$wpdb-&gt;siteid}'
-				AND {$wpdb-&gt;blogs}.site_id = {$wpdb-&gt;site}.id
-				AND ( {$wpdb-&gt;blogs}.domain LIKE '%{$s}%' OR {$wpdb-&gt;blogs}.path LIKE '%{$s}%' )&quot;;
+			$query .= &quot; AND ( {$wpdb-&gt;blogs}.domain LIKE '%{$s}%' OR {$wpdb-&gt;blogs}.path LIKE '%{$s}%' ) &quot;;
 		} elseif( isset($_GET['blog_id']) ) {
-			$query = &quot;SELECT * 
-				FROM {$wpdb-&gt;blogs}
-				WHERE site_id = '{$wpdb-&gt;siteid}'
-				AND   blog_id = '&quot;.intval($_GET['s']).&quot;'&quot;;
+			$query .= &quot; AND   blog_id = '&quot;.intval($_GET['s']).&quot;' &quot;;
 		} elseif( isset($_GET['blog_ip']) ) {
 			$query = &quot;SELECT *
 				FROM {$wpdb-&gt;blogs}, {$wpdb-&gt;registration_log}
 				WHERE site_id = '{$wpdb-&gt;siteid}'
 				AND {$wpdb-&gt;blogs}.blog_id = {$wpdb-&gt;registration_log}.blog_id
 				AND {$wpdb-&gt;registration_log}.IP LIKE ('%{$s}%')&quot;;
-		}
+		} 
 
 		if( isset( $_GET['sortby'] ) == false ) {
 			$_GET['sortby'] = 'id';
@@ -328,15 +321,13 @@ switch( $_GET['action'] ) {
 
 		$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
 
-		if( !empty($_GET['s']) ) {
-			$blog_list = $wpdb-&gt;get_results( $query, ARRAY_A );
-			$total = count($blog_list);
+		if( !empty($s) ) {
+			$total = $wpdb-&gt;get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
 		} else {
-			$total = $wpdb-&gt;get_var( &quot;SELECT COUNT(*) FROM {$wpdb-&gt;blogs} WHERE site_id = '{$wpdb-&gt;siteid}' &quot;);
+			$total = $wpdb-&gt;get_var( &quot;SELECT COUNT(blog_id) FROM {$wpdb-&gt;blogs} WHERE site_id = '{$wpdb-&gt;siteid}' &quot;);
 		}
 
 		$query .= &quot; LIMIT &quot; . intval( ( $apage - 1 ) * $num) . &quot;, &quot; . intval( $num );
-
 		$blog_list = $wpdb-&gt;get_results( $query, ARRAY_A );
 
 		// Pagination
@@ -357,7 +348,7 @@ switch( $_GET['action'] ) {
 		&lt;div class=&quot;wrap&quot; style=&quot;position:relative;&quot;&gt;
 		&lt;h2&gt;&lt;?php _e('Blogs') ?&gt;&lt;/h2&gt;
 
-		&lt;form id=&quot;searchform&quot; action=&quot;wpmu-blogs.php&quot; method=&quot;get&quot; style=&quot;position:absolute;right:0;top:0;&quot;&gt;
+		&lt;form action=&quot;wpmu-blogs.php&quot; method=&quot;get&quot; id=&quot;wpmu-search&quot;&gt;
 			&lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;blogs&quot; /&gt;
 			&lt;input type=&quot;text&quot; name=&quot;s&quot; value=&quot;&lt;?php if (isset($_GET['s'])) echo stripslashes( wp_specialchars( $s, 1 ) ); ?&gt;&quot; size=&quot;17&quot; /&gt;
 			&lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;blog_name&quot; value=&quot;&lt;?php _e('Search blogs by name') ?&gt;&quot; /&gt;
@@ -396,7 +387,7 @@ switch( $_GET['action'] ) {
 			'users'        =&gt; __('Users'),
 			'plugins'      =&gt; __('Actions')
 		);
-		$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+		$posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
 
 		// you can not edit these at the moment
 		$posts_columns['control_edit']      = '';</diff>
      <filename>wp-admin/wpmu-blogs.php</filename>
    </modified>
    <modified>
      <diff>@@ -95,9 +95,9 @@ switch( $_GET['action'] ) {
 		check_admin_referer('add-blog');
 
 		$blog = $_POST['blog'];
-		$domain = ereg_replace(&quot;[^A-Za-z0-9]&quot;, &quot;&quot;, strtolower( wp_specialchars( $blog['domain'] ) ) );
-		$email = wp_specialchars( $blog['email'] );
-		$title = stripslashes( wp_specialchars( $blog['title'] ) );
+		$domain = sanitize_user( str_replace( '/', '', $blog[ 'domain' ] ) );
+		$email = sanitize_email( $blog[ 'email' ] );
+		$title = $blog[ 'title' ];
 
 		if ( empty($domain) || empty($email))
 			wp_die( __('Missing blog address or email address.') );
@@ -129,7 +129,7 @@ switch( $_GET['action'] ) {
 		if( !is_wp_error($id) ) {
 			if( get_user_option( $user_id, 'primary_blog' ) == 1 )
 				update_user_option( $user_id, 'primary_blog', $id, true );
-			$content_mail = sprintf( __( &quot;New blog created by %1s\n\nAddress: http://%2s\nName: %3s&quot;), $current_user-&gt;user_login , $newdomain.$path, $title );
+			$content_mail = sprintf( __( &quot;New blog created by %1s\n\nAddress: http://%2s\nName: %3s&quot;), $current_user-&gt;user_login , $newdomain.$path, stripslashes( $title ) );
 			wp_mail( get_site_option('admin_email'),  sprintf(__('[%s] New Blog Created'), $current_site-&gt;site_name), $content_mail, 'From: &quot;Site Admin&quot; &lt;' . get_site_option( 'admin_email' ) . '&gt;' );
 			wp_redirect( add_query_arg( array('updated' =&gt; 'true', 'action' =&gt; 'add-blog'), $_SERVER['HTTP_REFERER'] ) );
 			exit();
@@ -241,6 +241,7 @@ switch( $_GET['action'] ) {
 					$wpdb-&gt;query( &quot;INSERT INTO &quot; . $wpdb-&gt;usermeta . &quot;( `umeta_id` , `user_id` , `meta_key` , `meta_value` ) VALUES ( NULL, '$userid', '&quot; . $wpdb-&gt;base_prefix . $id . &quot;_capabilities', 'a:1:{s:&quot; . strlen( $_POST['new_role'] ) . &quot;:\&quot;&quot; . $_POST['new_role'] . &quot;\&quot;;b:1;}')&quot; );
 			}
 		}
+		do_action( 'wpmu_update_blog_options' );
 		wpmu_admin_do_redirect( &quot;wpmu-blogs.php?action=editblog&amp;updated=true&amp;id=&quot;.$id );
 	break;
 </diff>
      <filename>wp-admin/wpmu-edit.php</filename>
    </modified>
    <modified>
      <diff>@@ -49,9 +49,9 @@ if (isset($_GET['updated'])) {
 				?&gt;
 				&lt;td&gt;
 					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration1&quot; value='none' &lt;?php echo get_site_option('registration') == 'none' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Disabled'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration2&quot; value='all' &lt;?php echo get_site_option('registration') == 'all' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Enabled for all. Blogs and user accounts can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration3&quot; value='user' &lt;?php echo get_site_option('registration') == 'user' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Enabled for users only. Only user account can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration4&quot; value='blog' &lt;?php echo get_site_option('registration') == 'blog' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Enabled for blogs only. Only logged in users can create new blogs.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration2&quot; value='all' &lt;?php echo get_site_option('registration') == 'all' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Enabled. Blogs and user accounts can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration3&quot; value='user' &lt;?php echo get_site_option('registration') == 'user' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Only user account can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+					&lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration4&quot; value='blog' &lt;?php echo get_site_option('registration') == 'blog' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Only logged in users can create new blogs.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
 					&lt;?php _e('Disable or enable registration and who or what can be registered. (Default=all)') ?&gt;
 				&lt;/td&gt; 
 			&lt;/tr&gt; </diff>
      <filename>wp-admin/wpmu-options.php</filename>
    </modified>
    <modified>
      <diff>@@ -33,13 +33,17 @@ $allowed_themes = get_site_allowed_themes();
 			&lt;/thead&gt;
 			&lt;tbody id=&quot;plugins&quot;&gt;
 			&lt;?php
+			$total_theme_count = 0;
+			$activated_themes_count = 0;
 			foreach( (array) $themes as $key =&gt; $theme ) :
+                                $total_theme_count++;
 				$theme_key = wp_specialchars($theme['Stylesheet']);
 				$class = ('alt' == $class) ? '' : 'alt';
 				$class1 = $enabled = $disabled = '';
 		
 				if( isset( $allowed_themes[ $theme_key ] ) == true ) {
 					$enabled = 'checked=&quot;checked&quot; ';
+                                        $activated_themes_count++;
 					$class1 = ' active';
 				} else {
 					$disabled = 'checked=&quot;checked&quot; ';
@@ -62,6 +66,8 @@ $allowed_themes = get_site_allowed_themes();
 		&lt;p class=&quot;submit&quot;&gt;
 			&lt;input type='submit' value='&lt;?php _e('Update Themes &amp;raquo;') ?&gt;' /&gt;&lt;/p&gt;
 	&lt;/form&gt;
+&lt;p&gt;Total Themes Installed: &lt;?php echo $total_theme_count; ?&gt;&lt;br /&gt;
+Themes Activated: &lt;?php echo $activated_themes_count; ?&gt;&lt;/p&gt;
 &lt;/div&gt;
 
 &lt;?php include('admin-footer.php'); ?&gt;</diff>
      <filename>wp-admin/wpmu-themes.php</filename>
    </modified>
    <modified>
      <diff>@@ -68,10 +68,9 @@ if ( $_GET['updated'] == 'true' ) {
 	$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
 
 	if( !empty( $s )) {
-		$user_list = $wpdb-&gt;get_results( $query, ARRAY_A );
-		$total = count($user_list);
+		$total = $wpdb-&gt;get_var( str_replace('SELECT *', 'SELECT COUNT(ID)', $query) );
 	} else {
-		$total = $wpdb-&gt;get_var( &quot;SELECT COUNT(*) FROM {$wpdb-&gt;users}&quot;);
+		$total = $wpdb-&gt;get_var( &quot;SELECT COUNT(ID) FROM {$wpdb-&gt;users}&quot;);
 	}
 
 	$query .= &quot; LIMIT &quot; . intval( ( $apage - 1 ) * $num) . &quot;, &quot; . intval( $num );
@@ -87,7 +86,7 @@ if ( $_GET['updated'] == 'true' ) {
 	));
 	?&gt;
 	&lt;h2&gt;&lt;?php _e(&quot;Users&quot;); ?&gt;&lt;/h2&gt;
-	&lt;form action=&quot;wpmu-users.php&quot; method=&quot;get&quot; style=&quot;position:absolute;right:0;top:0;&quot;&gt; 
+	&lt;form action=&quot;wpmu-users.php&quot; method=&quot;get&quot; id=&quot;wpmu-search&quot;&gt; 
 		&lt;input type=&quot;text&quot; name=&quot;s&quot; value=&quot;&lt;?php if (isset($_GET['s'])) echo stripslashes( $s ); ?&gt;&quot; size=&quot;17&quot; /&gt;
 		&lt;input type=&quot;submit&quot; id=&quot;post-query-submit&quot; value=&quot;&lt;?php _e('Search Users') ?&gt;&quot; class=&quot;button&quot; /&gt;
 	&lt;/form&gt;
@@ -122,7 +121,7 @@ if ( $_GET['updated'] == 'true' ) {
 			'registered' =&gt; __('Registered'),
 			'blogs'      =&gt; ''
 		);
-		$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+		$posts_columns = apply_filters('wpmu_users_columns', $posts_columns);
 		?&gt;
 		&lt;table class=&quot;widefat&quot; cellpadding=&quot;3&quot; cellspacing=&quot;3&quot;&gt;
 			&lt;thead&gt;</diff>
      <filename>wp-admin/wpmu-users.php</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,7 @@ $base = 'BASE';
 // to get keys generated for you, or just make something up.  Each key should have a different phrase.
 define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
 define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
+define('SECURE_AUTH_SALT', 'put your unique phrase here'); // Change this to a unique phrase.
 define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.
 define('SECRET_KEY', 'put your unique phrase here'); // Change these to unique phrases.
 define('SECRET_SALT', 'put your unique phrase here');
@@ -30,7 +31,7 @@ $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
 // chosen language must be installed to wp-content/languages.
 // For example, install de.mo to wp-content/languages and set WPLANG to 'de'
 // to enable German language support.
-define ('WPLANG', 'es_ES');
+define ('WPLANG', '');
 
 // uncomment this to enable wp-content/sunrise.php support
 //define( 'SUNRISE', 'on' );</diff>
      <filename>wp-config-sample.php</filename>
    </modified>
    <modified>
      <diff>@@ -109,7 +109,7 @@ function is_main_blog() {
 
 function get_id_from_blogname( $name ) {
 	global $wpdb, $current_site;
-	if( constant( 'VHOST' ) ) {
+	if( constant( 'VHOST' ) == 'yes' ) {
 		$domain = $name . '.' . $current_site-&gt;domain;
 		$path = $current_site-&gt;path;
 	} else {
@@ -149,11 +149,11 @@ function get_blog_details( $id, $getall = true ) {
 		return $details;
 	}
 
-	$wpdb-&gt;hide_errors();
+	$wpdb-&gt;suppress_errors();
 	$details-&gt;blogname   = get_blog_option($id, 'blogname');
 	$details-&gt;siteurl    = get_blog_option($id, 'siteurl');
 	$details-&gt;post_count = get_blog_option($id, 'post_count');
-	$wpdb-&gt;show_errors();
+	$wpdb-&gt;suppress_errors( false );
 
 	$details = apply_filters('blog_details', $details);
 
@@ -360,6 +360,9 @@ function switch_to_blog( $new_blog ) {
 	if ( $blog_id == $new_blog )
 		return;
 
+	$wp_object_cache-&gt;switched_cache[ $blog_id ] = $wp_object_cache-&gt;cache;
+	unset( $wp_object_cache-&gt;cache );
+
 	$wpdb-&gt;set_blog_id($new_blog);
 	$table_prefix = $wpdb-&gt;prefix;
 	$prev_blog_id = $blog_id;
@@ -388,6 +391,9 @@ function restore_current_blog() {
 	if ( $blog_id == $blog )
 		return;
 
+	$wp_object_cache-&gt;cache = $wp_object_cache-&gt;switched_cache[ $blog ];
+	unset( $wp_object_cache-&gt;switched_cache[ $blog ] );
+
 	$wpdb-&gt;set_blog_id($blog);
 	$prev_blog_id = $blog_id;
 	$blog_id = $blog;
@@ -414,9 +420,7 @@ function get_blogs_of_user( $id, $all = false ) {
 	if ( !$user )
 		return false;
 
-	$blogs = array();
-
-	$i = 0;
+	$blogs = $match = array();
 	foreach ( (array) $user as $key =&gt; $value ) {
 		if ( strstr( $key, '_capabilities') &amp;&amp; strstr( $key, $wpdb-&gt;base_prefix) ) {
 			preg_match('/' . $wpdb-&gt;base_prefix . '(\d+)_capabilities/', $key, $match);
@@ -514,95 +518,12 @@ function get_blog_status( $id, $pref ) {
 	return $wpdb-&gt;get_var( &quot;SELECT $pref FROM {$wpdb-&gt;blogs} WHERE blog_id = '$id'&quot; );
 }
 
-function get_last_updated($num = 10, $display = false ) {
-	
-	$selection = array();
-	$offset = 0;
-	
-	$limit = false;
-	$result = get_updated_blogs($limit);
-	
-	// Update limit in second to remove long forgotten posts that has been edited recently.
-	// $update_limit = 3600*24;
-	
-	// Push valid element from DB result into selection
-	foreach ( (array) $result as $key =&gt; $details ) {
-		$post = get_last_blog_post($details['blog_id']);
-		
-		// $post_update = strtotime($post-&gt;post_modified) - strtotime($post-&gt;post_date_gmt);
-		
-		// Do not include if the post title is empty
-		if(!empty($post-&gt;post_title)) {
-			// Do not include &quot;Hello World!&quot;
-			if($post-&gt;post_title != __(&quot;Hello World!&quot;) and $post-&gt;post_status != 'private'){
-				$post-&gt;domain_url = &quot;http://&quot; . $details['domain'] . $details['path'];
-				array_push($selection, $post);
-			}
-		}
-	}
-	
-	// sort posts by modified date
-	usort($selection, &quot;sort_post_by_date&quot;);
-	// Slice array
-	$selection = array_slice($selection, 0, $num);
-	
-	if($display == true){
-		reset( $selection );
-		$list = &quot;&quot;;
-		$last = count($selection) - 1;
-		$i = 0;
-		
-		foreach ( (array) $selection as $post ) {
-				
-			$post_link = $post-&gt;guid;
-			// No guid set on last post, display homepage
-			if(strlen($post_link) == 0) $post_link = $post-&gt;domain_url;
-				
-			$list .= &quot;&lt;li&quot;;
-			// Display class for last element
-			if($i == $last) { $list .= &quot; class='last clearfix'&quot;; }
-				
-			$list .= &quot;&gt;&lt;a class='avatar' href='$post_link'&gt;&lt;img src='&quot;.author_image_path($post-&gt;post_author, $display = false).&quot;' width='48px' height='48px' alt='&quot;.strip_tags($post-&gt;post_title).&quot;'/&gt;&lt;/a&gt;&lt;h3&gt;&lt;a href='$post_link'&gt;$post-&gt;post_title&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;hace &quot;.get_time_difference($post-&gt;post_modified, $decorate=true).&quot;&lt;/p&gt;&lt;/li&gt;&quot;;
-			$i++;
-		}
-		echo &quot;&lt;ul&gt;$list&lt;/ul&gt;&quot;;
-	}
-	
-	return $result;
-}
-
-function sort_post_by_date($post_1, $post_2){
-	return ($post_1-&gt;post_modified &lt; $post_2-&gt;post_modified) ? 1 : -1;
-}
-
-function get_updated_blogs($limit = true, $count = 10, $offset = 0){
+function get_last_updated( $display = false ) {
 	global $wpdb;
-	$query = &quot;SELECT blog_id, domain, path, last_updated &quot;.
-	         &quot;FROM $wpdb-&gt;blogs WHERE site_id = '$wpdb-&gt;siteid' &quot;.
-			 &quot;AND mature = '0' AND spam = '0' AND deleted = '0' &quot;. 
-			 &quot;AND last_updated &gt;= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY) &quot;.
-			 &quot;ORDER BY last_updated DESC&quot;;
-			
-	if($limit) $query .= &quot; LIMIT $offset, $count&quot;;
-	
-	return $wpdb-&gt;get_results( $query, ARRAY_A );
-}
-
-function get_last_blog_post($blog_id) {
-	global $wpdb;
-
-	$key = $blog_id.&quot;-&quot;.$post_id.&quot;-last_blog_post&quot;;
-	$post = wp_cache_get( $key, &quot;site-options&quot; );
-	if( $post == false ) {
-		$post = $wpdb-&gt;get_row( &quot;SELECT * FROM {$wpdb-&gt;base_prefix}{$blog_id}_posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1&quot; );
-		wp_cache_add( $key, $post, &quot;site-options&quot;, 120 );
-	}
-
-	return $post;
+	return $wpdb-&gt;get_results( &quot;SELECT blog_id, domain, path FROM $wpdb-&gt;blogs WHERE site_id = '$wpdb-&gt;siteid' AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit 0,40&quot;, ARRAY_A );
 }
 
-function get_most_active_blogs( $num = 10, $display = true, $title = &quot;blogs&quot;) {
-	global $wpdb;
+function get_most_active_blogs( $num = 10, $display = true ) {
 	$most_active = get_site_option( &quot;most_active&quot; );
 	$update = false;
 	if( is_array( $most_active ) ) {
@@ -632,42 +553,17 @@ function get_most_active_blogs( $num = 10, $display = true, $title = &quot;blogs&quot;) {
 		}
 		update_site_option( &quot;most_active&quot;, $most_active );
 	}
-	
-	$most_active = array_slice( $most_active, 0, $num );
 
 	if( $display == true ) {
 		if( is_array( $most_active ) ) {
 			reset( $most_active );
-			$list = &quot;&quot;;
-			$last = count($most_active) - 1;
-			$i = 0;
-			foreach($most_active as $blog) {
-				$url = &quot;http://&quot; . $blog['domain'] . $blog['path'];
-				
-				switch ($title) {
-					case &quot;blogs&quot;: $title = get_blog_option($blog['blog_id'], 'blogname');
-					break;
-
-					case &quot;posts&quot;: $title = get_blog_option($blog['blog_id'], 'blogname');
-					break;
-
-					default: $title = get_blog_option($blog['blog_id'], 'blogname');
-					break;
-				}
-				
-				if($i != $last){
-					$list .= &quot;&lt;li&gt;&lt;a href='$url'&gt;$title&lt;/a&gt;&lt;/li&gt;&quot;;
-				} else {
-					$list .= &quot;&lt;li class='last clearfix'&gt;&lt;a href='$url'&gt;$title&lt;/a&gt;&lt;/li&gt;&quot;;
-				}
-				$i++;
+			foreach ( (array) $most_active as $key =&gt; $details ) {
+				$url = clean_url(&quot;http://&quot; . $details['domain'] . $details['path']);
+				echo &quot;&lt;li&gt;&quot; . $details['postcount'] . &quot; &lt;a href='$url'&gt;$url&lt;/a&gt;&lt;/li&gt;&quot;;
 			}
-			
-			// Display resulting list
-			echo &quot;&lt;ul&gt;$list&lt;/ul&gt;&quot;;
 		}
 	}
-	return $most_active;
+	return array_slice( $most_active, 0, $num );
 }
 
 function get_blog_list( $start = 0, $num = 10, $display = true ) {
@@ -934,7 +830,7 @@ function wpmu_validate_user_signup($user_name, $user_email) {
 
 	$errors = new WP_Error();
 
-	$user_name = sanitize_user($user_name);
+	$user_name = preg_replace( &quot;/\s+/&quot;, '', sanitize_user( $user_name, true ) );
 	$user_email = sanitize_email( $user_email );
 
 	if ( empty( $user_name ) )
@@ -1031,7 +927,7 @@ function wpmu_validate_user_signup($user_name, $user_email) {
 function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
 	global $wpdb, $domain, $base;
 
-	$blogname = sanitize_user( $blogname );
+	$blogname = preg_replace( &quot;/\s+/&quot;, '', sanitize_user( $blogname, true ) );
 	$blog_title = strip_tags( $blog_title );
 	$blog_title = substr( $blog_title, 0, 50 );
 
@@ -1130,7 +1026,7 @@ function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = ''
 function wpmu_signup_user($user, $user_email, $meta = '') {
 	global $wpdb;
 
-	$user = sanitize_user( $user );
+	$user = preg_replace( &quot;/\s+/&quot;, '', sanitize_user( $user, true ) );
 	$user_email = sanitize_email( $user_email );
 
 	$key = substr( md5( time() . rand() . $user_email ), 0, 16 );
@@ -1255,7 +1151,7 @@ function generate_random_password( $len = 8 ) {
 }
 
 function wpmu_create_user( $user_name, $password, $email) {
-	$user_name = ereg_replace(&quot;[^A-Za-z0-9]&quot;, &quot;&quot;, $user_name);
+	$user_name = preg_replace( &quot;/\s+/&quot;, '', sanitize_user( $user_name, true ) );
 	if ( username_exists($user_name) )
 		return false;
 
@@ -1275,7 +1171,9 @@ function wpmu_create_user( $user_name, $password, $email) {
 }
 
 function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) {
-	$domain = sanitize_user( $domain );
+	$domain = preg_replace( &quot;/\s+/&quot;, '', sanitize_user( $domain, true ) );
+	if( constant( 'VHOST' ) == 'yes' )
+		$domain = str_replace( '@', '', $domain );
 	$title = strip_tags( $title );
 	$user_id = (int) $user_id;
 
@@ -2006,47 +1904,6 @@ if( is_object( $wp_object_cache ) ) {
 	$wp_object_cache-&gt;non_persistent_groups = array('comment', 'counts');
 }
 
-// support a GET parameter for disabling the flash uploader
-function wpmu_upload_flash($flash) {
-	if ( array_key_exists('flash', $_REQUEST) )
-		$flash = !empty($_REQUEST['flash']);
-	return $flash;
-}   
-
-add_filter('flash_uploader', 'wpmu_upload_flash');
-
-function wpmu_upload_flash_bypass() {
-	echo '&lt;p class=&quot;upload-flash-bypass&quot;&gt;';
-	printf( __('You are using the Flash uploader.  Problems?  Try the &lt;a href=&quot;%s&quot;&gt;Browser uploader&lt;/a&gt; instead.'), add_query_arg('flash', 0) );
-	echo '&lt;/p&gt;';
-}
-
-add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass');
-
-function wpmu_upload_html_bypass() {
-	echo '&lt;p class=&quot;upload-html-bypass&quot;&gt;';
-	if ( array_key_exists('flash', $_REQUEST) )
-		// the user manually selected the browser uploader, so let them switch back to Flash
-		printf( __('You are using the Browser uploader.  Try the &lt;a href=&quot;%s&quot;&gt;Flash uploader&lt;/a&gt; instead.'), add_query_arg('flash', 1) );
-	else
-		// the user probably doesn't have Flash
-		printf( __('You are using the Browser uploader.') );
-
-	echo '&lt;/p&gt;';
-}
-
-add_action('post-flash-upload-ui', 'wpmu_upload_flash_bypass');
-add_action('post-html-upload-ui', 'wpmu_upload_html_bypass');
-
-// make sure the GET parameter sticks when we submit a form
-function wpmu_upload_bypass_url($url) {
-	if ( array_key_exists('flash', $_REQUEST) )
-		$url = add_query_arg('flash', intval($_REQUEST['flash']));
-	return $url;
-}
-
-add_filter('media_upload_form_url', 'wpmu_upload_bypass_url');
-
 function mu_locale( $locale ) {
 	if( defined('WP_INSTALLING') == false ) {
 		$mu_locale = get_option('WPLANG');
@@ -2088,43 +1945,25 @@ function maybe_redirect_404() {
 }
 add_action( 'template_redirect', 'maybe_redirect_404' );
 
-function get_time_difference($post_time, $decorate = false){
-	$timestamp = time() - strtotime($post_time);
-	
-	if($decorate == true){
-		return duration($timestamp);
-	} else {
-		return $timestamp;
+function remove_tinymce_media_button( $buttons ) {
+	unset( $buttons[ array_search( 'media', $buttons ) ] );
+	return $buttons;
+}
+add_filter( 'mce_buttons_2', 'remove_tinymce_media_button' );
+
+function add_existing_user_to_blog() {
+	if( false !== strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) {
+		$parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
+		$key = array_pop( $parts );
+		if( $key == '' )
+			$key = array_pop( $parts );
+		$details = get_option( &quot;new_user_&quot; . $key );
+		if( is_array( $details ) ) {
+			add_user_to_blog( '', $details[ 'user_id' ], $details[ 'role' ] );
+			do_action( &quot;added_existing_user&quot;, $details[ 'user_id' ] );
+			wp_die( 'You have been added to this blog. Please visit the &lt;a href=&quot;' . site_url() . '&quot;&gt;homepage&lt;/a&gt; or &lt;a href=&quot;' . site_url( '/wp-admin/' ) . '&quot;&gt;login&lt;/a&gt; using your username and password.' );
+		}
 	}
 }
-
-function duration($timestamp) {
-	
-	$years=floor($timestamp / (60*60*24*365));
-	$timestamp%=60*60*24*365;
-	
-	$weeks=floor($timestamp / (60*60*24*7));
-	$timestamp%=60*60*24*7;
-	
-	$days=floor($timestamp / (60*60*24));
-	$timestamp%=60*60*24;
-    
-	$hrs=floor($timestamp / (60*60));
-	$timestamp%=60*60;
-    
-	$mins=floor($timestamp / 60);
-	$secs=$timestamp % 60;
-   
-   $str=&quot;&quot;;
-
-   if ($secs &gt;= 1) { $str =&quot;{$secs} segundos &quot;; }
-   if ($mins &gt;= 1) { $str =&quot;{$mins} minutos &quot;; }
-   if ($hrs &gt;= 1) { $str =&quot;{$hrs} horas &quot;; }
-   if ($days &gt;= 1) { $str =&quot;{$days} d&amp;iacute;as &quot;; }
-   if ($weeks &gt;= 1) { $str =&quot;{$weeks} semanas &quot;; }
-   if ($years &gt;= 1) { $str =&quot;{$years} a&amp;ntilde;os &quot;; }
-   
-   return $str;
-}
-
+add_action( 'init', 'add_existing_user_to_blog' );
 ?&gt;</diff>
      <filename>wp-includes/wpmu-functions.php</filename>
    </modified>
    <modified>
      <diff>@@ -36,14 +36,14 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) {
 	// A config file doesn't exist
 
 	// Set a path for the link to the installer
-	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
-	else $path = 'wp-admin/';
+	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '../';
+	else $path = '';
 
 	// Die with an error message
 	require_once( ABSPATH . '/wp-includes/classes.php' );
 	require_once( ABSPATH . '/wp-includes/functions.php' );
 	require_once( ABSPATH . '/wp-includes/plugin.php' );
-	wp_die(sprintf(/*WP_I18N_NO_CONFIG*/&quot;There doesn't seem to be a &lt;code&gt;wp-config.php&lt;/code&gt; file. I need this before we can get started. Need more help? &lt;a href='http://codex.wordpress.org/Editing_wp-config.php'&gt;We got it&lt;/a&gt;. You can create a &lt;code&gt;wp-config.php&lt;/code&gt; file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.&lt;/p&gt;&lt;p&gt;&lt;a href='%ssetup-config.php' class='button'&gt;Create a Configuration File&lt;/a&gt;&quot;/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/&quot;WordPress &amp;rsaquo; Error&quot;/*/WP_I18N_ERROR_TITLE*/);
+	wp_die(sprintf(/*WP_I18N_NO_CONFIG*/&quot;There doesn't seem to be a &lt;code&gt;wp-config.php&lt;/code&gt; file. I need this before we can get started.&lt;p&gt;&lt;a href='%sindex.php' class='button'&gt;Create a Configuration File&lt;/a&gt;&quot;/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/&quot;WordPress &amp;rsaquo; Error&quot;/*/WP_I18N_ERROR_TITLE*/);
 
 }
 </diff>
      <filename>wp-load.php</filename>
    </modified>
    <modified>
      <diff>@@ -129,6 +129,13 @@ function retrieve_password() {
 	do_action('retreive_password', $user_login);  // Misspelled and deprecated
 	do_action('retrieve_password', $user_login);
 
+	$allow = apply_filters('allow_password_reset', true, $user_data-&gt;ID);
+
+	if ( ! $allow )
+		return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
+	else if ( is_wp_error($allow) )
+		return $allow;
+		
 	$key = $wpdb-&gt;get_var($wpdb-&gt;prepare(&quot;SELECT user_activation_key FROM $wpdb-&gt;users WHERE user_login = %s&quot;, $user_login));
 	if ( empty($key) ) {
 		// Generate something random for a key...</diff>
      <filename>wp-login.php</filename>
    </modified>
    <modified>
      <diff>@@ -299,7 +299,8 @@ if ( !defined('WP_PLUGIN_URL') )
 if ( !defined('PLUGINDIR') )
 	define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
 
-$current_site-&gt;site_name = get_site_option('site_name');
+if( !isset($current_site-&gt;site_name) )
+	$current_site-&gt;site_name = get_site_option('site_name');
 if( $current_site-&gt;site_name == false )
 	$current_site-&gt;site_name = ucfirst( $current_site-&gt;domain );
 </diff>
      <filename>wp-settings.php</filename>
    </modified>
    <modified>
      <diff>@@ -417,7 +417,10 @@ if( $active_signup == &quot;none&quot; ) {
 					$newblog = 'http://' . $current_site-&gt;domain . $current_site-&gt;path . $newblogname . '/';
 				else
 					$newblog = 'http://' . $newblogname . '.' . $current_site-&gt;domain . $current_site-&gt;path;
-				printf(__(&quot;&lt;p&gt;&lt;em&gt;The blog you were looking for, &lt;strong&gt;%s&lt;/strong&gt; doesn't exist but you can create it now!&lt;/em&gt;&lt;/p&gt;&quot;), $newblog );
+				if ($active_signup == 'blog' || $active_signup == 'all')
+					printf(__(&quot;&lt;p&gt;&lt;em&gt;The blog you were looking for, &lt;strong&gt;%s&lt;/strong&gt; doesn't exist but you can create it now!&lt;/em&gt;&lt;/p&gt;&quot;), $newblog );
+				else
+					printf(__(&quot;&lt;p&gt;&lt;em&gt;The blog you were looking for, &lt;strong&gt;%s&lt;/strong&gt; doesn't exist.&lt;/em&gt;&lt;/p&gt;&quot;), $newblog );
 			}
 			break;
 	}</diff>
      <filename>wp-signup.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5304c261310d3e7e4f63372f85c600111ce2a2e8</id>
    </parent>
  </parents>
  <author>
    <name>redwarrior</name>
    <email>redwarrior@debian-redwarrior.(none)</email>
  </author>
  <url>http://github.com/alx/blogsfera/commit/9cb2436ed51e1899387e2b345d8a926cfb4d7ff0</url>
  <id>9cb2436ed51e1899387e2b345d8a926cfb4d7ff0</id>
  <committed-date>2008-07-29T06:55:41-07:00</committed-date>
  <authored-date>2008-07-29T06:55:41-07:00</authored-date>
  <message>upgrade to wpmu 2.6</message>
  <tree>84113f73f22a2d7534c1b4b069a0f82d1405dec9</tree>
  <committer>
    <name>redwarrior</name>
    <email>redwarrior@debian-redwarrior.(none)</email>
  </committer>
</commit>
