summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wp-inst/wp-admin/wpmu-blogs.php15
-rw-r--r--wp-inst/wp-admin/wpmu-edit.php19
-rw-r--r--wp-inst/wp-includes/wpmu-functions.php49
-rw-r--r--wp-inst/wp-settings.php9
4 files changed, 44 insertions, 48 deletions
diff --git a/wp-inst/wp-admin/wpmu-blogs.php b/wp-inst/wp-admin/wpmu-blogs.php
index 3c5a3f8..6f61463 100644
--- a/wp-inst/wp-admin/wpmu-blogs.php
+++ b/wp-inst/wp-admin/wpmu-blogs.php
@@ -23,9 +23,6 @@ switch( $_GET[ 'action' ] ) {
FROM ".$wpdb->blogs."
WHERE blog_id = '".$_GET[ 'id' ]."'";
$details = $wpdb->get_row( $query, ARRAY_A );
- $is_archived = get_settings( "is_archived" );
- if( $is_archived == '' )
- $is_archived = 'no';
print "<h2>Edit Blog</h2>";
?>
@@ -51,14 +48,14 @@ switch( $_GET[ 'action' ] ) {
</tr>
<tr valign="top">
<th scope="row">Public</th>
- <td><input type='radio' name='blog[is_public]' value='yes'<?php if( $details[ 'is_public' ] == 'yes' ) echo " checked"?>> Yes&nbsp;&nbsp;
- <input type='radio' name='blog[is_public]' value='no'<?php if( $details[ 'is_public' ] == 'no' ) echo " checked"?>> No &nbsp;&nbsp;
+ <td><input type='radio' name='blog[public]' value='yes'<?php if( $details[ 'public' ] == '1' ) echo " checked"?>> Yes&nbsp;&nbsp;
+ <input type='radio' name='blog[public]' value='no'<?php if( $details[ 'public' ] == '0' ) echo " checked"?>> No &nbsp;&nbsp;
</td>
</tr>
<tr valign="top">
<th scope="row">Archived</th>
- <td><input type='radio' name='option[is_archived]' value='yes'<?php if( $is_archived == 'yes' ) echo " checked"?>> Yes&nbsp;&nbsp;
- <input type='radio' name='option[is_archived]' value='no'<?php if( $is_archived == 'no' ) echo " checked"?>> No &nbsp;&nbsp;
+ <td><input type='radio' name='option[archived]' value='yes'<?php if( $archived == '1' ) echo " checked"?>> Yes&nbsp;&nbsp;
+ <input type='radio' name='option[archived]' value='no'<?php if( $archived == '0' ) echo " checked"?>> No &nbsp;&nbsp;
</td>
</tr>
<tr><td colspan='2'>
@@ -325,7 +322,7 @@ if ($blog_list) {
$bgcolor = '';
foreach ($blog_list as $blog) {
$class = ('alternate' == $class) ? '' : 'alternate';
- if( get_blog_option( $blog[ 'blog_id' ], "is_archived" ) == 'yes' ) {
+ if( is_archived( $blog[ 'blog_id' ] ) == '1' ) {
?>
<tr style='background: #fee' class='<?php echo $class; ?>'>
<?php
@@ -389,7 +386,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
break;
case 'control_deactivate':
- if( get_blog_option( $blog[ 'blog_id' ], "is_archived" ) == 'yes' ) {
+ if( is_archived( $blog[ 'blog_id' ] ) == '1' ) {
?>
<td valign='top'><?php echo "<a href='wpmu-edit.php?action=activateblog&amp;id=".$blog[ 'blog_id' ]."' class='edit' onclick=\"return confirm('" . sprintf(__("You are about to activate this blog?\\n \'OK\' to activate, \'Cancel\' to stop.") ) . "')\">" . __('Activate') . "</a>"; ?></td>
<?php
diff --git a/wp-inst/wp-admin/wpmu-edit.php b/wp-inst/wp-admin/wpmu-edit.php
index 91ae613..8b84764 100644
--- a/wp-inst/wp-admin/wpmu-edit.php
+++ b/wp-inst/wp-admin/wpmu-edit.php
@@ -133,8 +133,8 @@ switch( $_GET[ 'action' ] ) {
path = '".$_POST[ 'blog' ][ 'path' ]."',
registered = '".$_POST[ 'blog' ][ 'registered' ]."',
last_updated = '".$_POST[ 'blog' ][ 'last_updated' ]."',
- is_public = '".$_POST[ 'blog' ][ 'is_public' ]."'
- WHERE blog_id = '".$id."'";
+ public = '".$_POST[ 'blog' ][ 'public' ]."'
+ WHERE blog_id = '".$id."'";
$wpdb->query( $query );
}
@@ -202,25 +202,14 @@ switch( $_GET[ 'action' ] ) {
if( is_site_admin() == false ) {
die( __('<p>You do not have permission to access this page.</p>') );
}
- $is_archived = $wpdb->get_row( "SELECT option_value FROM {$wpmuBaseTablePrefix}{$_GET[ 'id' ]}_options WHERE option_name = 'is_archived'" );
- $is_archived = get_blog_option( $_GET[ 'id' ], "is_archived" );
- if( $is_archived ) {
- update_blog_option( $_GET[ 'id' ], "is_archived", "no" );
- } else {
- add_blog_option( $_GET[ 'id' ], "is_archived", "no" );
- }
+ update_archived( $_GET[ 'id' ], '0' );
header( "Location: wpmu-blogs.php?updated=true" );
break;
case "deactivateblog":
if( is_site_admin() == false ) {
die( __('<p>You do not have permission to access this page.</p>') );
}
- $is_archived = get_blog_option( $_GET[ 'id' ], "is_archived" );
- if( $is_archived ) {
- update_blog_option( $_GET[ 'id' ], "is_archived", "yes" );
- } else {
- add_blog_option( $_GET[ 'id' ], "is_archived", "yes" );
- }
+ update_archived( $_GET[ 'id' ], '1' );
header( "Location: wpmu-blogs.php?updated=true" );
break;
case "updateuser":
diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php
index f2310ee..88ea1e6 100644
--- a/wp-inst/wp-includes/wpmu-functions.php
+++ b/wp-inst/wp-includes/wpmu-functions.php
@@ -337,21 +337,21 @@ function get_blogaddress_by_name( $blogname ) {
}
function get_sitestats() {
- global $wpdb, $basedomain, $base;
+ global $wpdb, $basedomain, $base;
- $query = "SELECT count(*) as c
- FROM ".$wpdb->blogs."
- WHERE site_id = '".$wpdb->siteid."'";
- $blogs = $wpdb->get_var( $query );
- $stats[ 'blogs' ] = $blogs;
+ $stats[ 'blogs' ] = get_blog_count();
- $query = "SELECT count(*) as c
- FROM ".$wpdb->users;
- $users = $wpdb->get_var( $query );
- $stats[ 'users' ] = $users;
-
- return $stats;
+ $count_ts = get_site_option( "get_user_count_ts" );
+ if( time() - $count_ts > 3600 ) {
+ $count = $wpdb->get_var( "SELECT count(*) as c FROM {$wpdb->users}" );
+ update_site_option( "user_count", $count );
+ update_site_option( "user_count_ts", time() );
+ } else {
+ $count = get_site_option( "user_count" );
+ }
+ $stats[ 'users' ] = $count;
+ return $stats;
}
function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
@@ -635,12 +635,17 @@ function get_blogs_of_user( $id ) {
}
function is_archived( $id ) {
- global $wpdb, $wpmuBaseTablePrefix;
- $is_archived = $wpdb->get_var( "SELECT option_value FROM " . $wpmuBaseTablePrefix . $id . "_options WHERE option_name = 'is_archived'" );
- if( $is_archived == false )
- $is_archived = 'no';
+ global $wpdb;
+ $archived = $wpdb->get_var( "SELECT archived FROM {$wpdb->blogs} WHERE blog_id = '$id'" );
+
+ return $archived;
+}
+
+function update_archived( $id, $archived ) {
+ global $wpdb;
+ $wpdb->query( "UPDATE {$wpdb->blogs} SET archived = '{$archived}' WHERE blog_id = '$id'" );
- return $is_archived;
+ return $archived;
}
function get_last_updated( $display = false ) {
@@ -719,7 +724,7 @@ function get_blog_list( $start = 0, $num = 10, $display = true ) {
$blogs = $wpdb->get_results( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = '$wpdb->siteid' ORDER BY registered DESC", ARRAY_A );
if( is_array( $blogs ) ) {
while( list( $key, $details ) = each( $blogs ) ) {
- if( is_archived( $details[ 'blog_id' ] ) == 'yes' )
+ if( is_archived( $details[ 'blog_id' ] ) == '1' )
unset( $blogs[ $key ] );
$blog_list[ $details[ 'blog_id' ] ] = $details;
@@ -743,13 +748,13 @@ function get_blog_count( $id = 0 ) {
if( $id == 0 )
$id = $wpdb->siteid;
- $count_ts = get_site_option( "get_blog_count_ts" );
+ $count_ts = get_site_option( "blog_count_ts" );
if( time() - $count_ts > 86400 ) {
$count = $wpdb->get_var( "SELECT count(*) as c FROM $wpdb->blogs WHERE site_id = '$id'" );
- update_site_option( "get_blog_count", $count );
- update_site_option( "get_blog_count_ts", time() );
+ update_site_option( "blog_count", $count );
+ update_site_option( "blog_count_ts", time() );
} else {
- $count = get_site_option( "get_blog_count" );
+ $count = get_site_option( "blog_count" );
}
return $count;
diff --git a/wp-inst/wp-settings.php b/wp-inst/wp-settings.php
index b999593..fe52c46 100644
--- a/wp-inst/wp-settings.php
+++ b/wp-inst/wp-settings.php
@@ -117,7 +117,7 @@ if( $current_blog == false ) {
is_installed();
}
$blog_id = $current_blog->blog_id;
-$is_public = $current_blog->is_public;
+$public = $current_blog->public;
$site_id = $current_blog->site_id;
if( $site_id == 0 )
$site_id = 1;
@@ -157,7 +157,7 @@ if( $blog_id == false ) {
}
}
-if( $is_public == 'no' ) {
+if( $public == '0' ) {
// need to put checks in here?
// A hook?
die( "This blog is private." );
@@ -265,6 +265,11 @@ $wpdb->show_errors();
$is_archived = get_settings( "is_archived" );
if( $is_archived == 'yes' ) {
+ update_archived( $wpdb->blogid, 1 );
+ die( "This blog has been archived or suspended temporarily. Please check back later." );
+}
+
+if( $current_blog->archived == '1' ) {
die( "This blog has been archived or suspended temporarily. Please check back later." );
}