mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Add mu only (inactive) files
git-svn-id: https://develop.svn.wordpress.org/trunk@12603 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Executable
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Edit post form for Write Post and for the Bookmarklet mode.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Administration
|
||||
*/
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Write Post'); ?></h2>
|
||||
<form name="post" action="post.php" method="post" id="simple">
|
||||
|
||||
<?php if (isset($mode) && 'bookmarklet' == $mode) : ?>
|
||||
<input type="hidden" name="mode" value="bookmarklet" />
|
||||
<?php endif; ?>
|
||||
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
|
||||
<input type="hidden" name="action" value='post' />
|
||||
|
||||
<div id="poststuff">
|
||||
<fieldset id="titlediv">
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
|
||||
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="categorydiv">
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
|
||||
<div><?php dropdown_categories($post->post_category); ?></div>
|
||||
</fieldset>
|
||||
|
||||
<br />
|
||||
<fieldset id="postdiv">
|
||||
<legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
|
||||
<?php
|
||||
$rows = get_option('default_post_edit_rows');
|
||||
if (($rows < 3) || ($rows > 100)) {
|
||||
$rows = 10;
|
||||
}
|
||||
?>
|
||||
<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div>
|
||||
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
edCanvas = document.getElementById('content');
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<input type="hidden" name="post_pingback" value="<?php echo (int) get_option('default_pingback_flag') ?>" id="post_pingback" />
|
||||
|
||||
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)'), 'http://wordpress.org/docs/reference/post/#trackback'); echo '<br />'; ?>
|
||||
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
|
||||
|
||||
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
|
||||
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
|
||||
|
||||
<?php if ( current_user_can('edit_posts') ) : ?>
|
||||
<input name="publish" type="submit" id="publish" tabindex="6" value="<?php _e('Publish') ?>" class="button button-highlighted" />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ('bookmarklet' != $mode) {
|
||||
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing') . '" />';
|
||||
} ?>
|
||||
<input name="referredby" type="hidden" id="referredby" value="<?php if ( $refby = wp_get_referer() ) echo urlencode($refby); ?>" />
|
||||
</p>
|
||||
|
||||
<?php do_action('simple_edit_form', ''); ?>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
try{document.getElementById('title').focus();}catch(e){}
|
||||
</script>
|
||||
</div>
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Draft Page Administration Panel.
|
||||
*
|
||||
* This was created for the administration navigation instead of using a query
|
||||
* for the drafts.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
/** Locks the post status to draft to prevent premature posting. */
|
||||
$locked_post_status = 'draft';
|
||||
$_GET['post_status'] = 'draft';
|
||||
require_once('admin.php');
|
||||
$title = __('View Draft Pages');
|
||||
require_once('edit-pages.php');
|
||||
|
||||
?>
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Draft Post Administration Panel.
|
||||
*
|
||||
* This was created for the administration navigation instead of using a query
|
||||
* for the drafts.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
/** Locks the post status to draft to prevent premature posting. */
|
||||
$locked_post_status = 'draft';
|
||||
$_GET['post_status'] = 'draft';
|
||||
require_once('admin.php');
|
||||
$title = __('View Drafts');
|
||||
require_once('edit.php');
|
||||
|
||||
?>
|
||||
Executable
+1303
File diff suppressed because it is too large
Load Diff
Executable
+144
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* Links Import Administration Panel.
|
||||
*
|
||||
* @copyright 2002 Mike Little <mike@zed1.com>
|
||||
* @author Mike Little <mike@zed1.com>
|
||||
* @package WordPress
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
/** Load WordPress Administration Bootstrap */
|
||||
require_once('admin.php');
|
||||
$parent_file = 'edit.php';
|
||||
$title = __('Import Blogroll');
|
||||
|
||||
$step = $_POST['step'];
|
||||
if (!$step) $step = 0;
|
||||
?>
|
||||
<?php
|
||||
switch ($step) {
|
||||
case 0: {
|
||||
include_once('admin-header.php');
|
||||
if ( !current_user_can('manage_links') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
$opmltype = 'blogrolling'; // default.
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<h2><?php _e('Import your blogroll from another system') ?> </h2>
|
||||
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
|
||||
<?php wp_nonce_field('import-bookmarks') ?>
|
||||
|
||||
<p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?></p>
|
||||
<div style="width: 70%; margin: auto; height: 8em;">
|
||||
<input type="hidden" name="step" value="1" />
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
|
||||
<div style="width: 48%;" class="alignleft">
|
||||
<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
|
||||
<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
|
||||
</div>
|
||||
|
||||
<div style="width: 48%;" class="alignleft">
|
||||
<h3><label for="userfile"><?php _e('Or choose from your local disk:'); ?></label></h3>
|
||||
<input id="userfile" name="userfile" type="file" size="30" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br />
|
||||
<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
|
||||
<?php
|
||||
$categories = get_terms('link_category', 'get=all');
|
||||
foreach ($categories as $category) {
|
||||
?>
|
||||
<option value="<?php echo $category->term_id; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->name)); ?></option>
|
||||
<?php
|
||||
} // end foreach
|
||||
?>
|
||||
</select></p>
|
||||
|
||||
<p class="submit"><input type="submit" name="submit" value="<?php _e('Import OPML File') ?>" /></p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
} // end case 0
|
||||
|
||||
case 1: {
|
||||
check_admin_referer('import-bookmarks');
|
||||
|
||||
include_once('admin-header.php');
|
||||
if ( !current_user_can('manage_links') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
?>
|
||||
<div class="wrap">
|
||||
|
||||
<h2><?php _e('Importing...') ?></h2>
|
||||
<?php
|
||||
$cat_id = abs( (int) $_POST['cat_id'] );
|
||||
if ( $cat_id < 1 )
|
||||
$cat_id = 1;
|
||||
|
||||
$opml_url = $_POST['opml_url'];
|
||||
if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
|
||||
$blogrolling = true;
|
||||
} else { // try to get the upload file.
|
||||
$overrides = array('test_form' => false, 'test_type' => false);
|
||||
$file = wp_handle_upload($_FILES['userfile'], $overrides);
|
||||
|
||||
if ( isset($file['error']) )
|
||||
wp_die($file['error']);
|
||||
|
||||
$url = $file['url'];
|
||||
$opml_url = $file['file'];
|
||||
$blogrolling = false;
|
||||
}
|
||||
|
||||
if ( isset($opml_url) && $opml_url != '' ) {
|
||||
if ( $blogrolling === true ) {
|
||||
$opml = wp_remote_fopen($opml_url);
|
||||
} else {
|
||||
$opml = file_get_contents($opml_url);
|
||||
}
|
||||
|
||||
/** Load OPML Parser */
|
||||
include_once('link-parse-opml.php');
|
||||
|
||||
$link_count = count($names);
|
||||
for ( $i = 0; $i < $link_count; $i++ ) {
|
||||
if ('Last' == substr($titles[$i], 0, 4))
|
||||
$titles[$i] = '';
|
||||
if ( 'http' == substr($titles[$i], 0, 4) )
|
||||
$titles[$i] = '';
|
||||
$link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
|
||||
wp_insert_link($link);
|
||||
echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
|
||||
}
|
||||
?>
|
||||
|
||||
<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
|
||||
|
||||
<?php
|
||||
} // end if got url
|
||||
else
|
||||
{
|
||||
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
|
||||
} // end else
|
||||
|
||||
if ( ! $blogrolling )
|
||||
do_action( 'wp_delete_file', $opml_url);
|
||||
@unlink($opml_url);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
} // end case 1
|
||||
} // end switch
|
||||
|
||||
include('admin-footer.php');
|
||||
|
||||
?>
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('WordPress MU › Admin');
|
||||
$parent_file = 'wpmu-admin.php';
|
||||
|
||||
function index_css() {
|
||||
wp_admin_css( 'css/dashboard' );
|
||||
}
|
||||
add_action( 'admin_head', 'index_css' );
|
||||
|
||||
require_once('admin-header.php');
|
||||
|
||||
if( is_site_admin() == false ) {
|
||||
wp_die( __('You do not have permission to access this page.') );
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$c_users = $wpdb->get_var("SELECT COUNT(id) FROM {$wpdb->users}");
|
||||
$c_blogs = $wpdb->get_var("SELECT COUNT(blog_id) FROM {$wpdb->blogs}");
|
||||
|
||||
$user_text = sprintf( __ngettext( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
|
||||
$blog_text = sprintf( __ngettext( '%s blog', '%s blogs', $c_blogs ), number_format_i18n( $c_blogs ) );
|
||||
|
||||
$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
|
||||
$title = __( 'WordPress MU : Admin' );
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php echo wp_specialchars( $title ); ?></h2>
|
||||
|
||||
<ul class="subsubsub">
|
||||
<li><a href="wpmu-blogs.php#form-add-blog" class="rbutton"><strong><?php _e('Create a New Blog'); ?></strong></a> | </li>
|
||||
<li><a href="wpmu-users.php#form-add-user" class="rbutton"><?php _e('Create a New User'); ?></a></li>
|
||||
</ul>
|
||||
<br clear='all' />
|
||||
|
||||
<p class="youhave"><?php echo $sentence; ?></p>
|
||||
<?php do_action('wpmuadminresult', ''); ?>
|
||||
|
||||
<form name="searchform" action="wpmu-users.php" method="get">
|
||||
<p>
|
||||
<input type="hidden" name="action" value="users" />
|
||||
<input type="text" name="s" value="" size="17" />
|
||||
<input class="button" type="submit" name="submit" value="<?php _e("Search Users »"); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<form name="searchform" action="wpmu-blogs.php" method="get">
|
||||
<p>
|
||||
<input type="hidden" name="action" value="blogs" />
|
||||
<input type="text" name="s" value="" size="17" />
|
||||
<input class="button" type="submit" name="blog_name" value="<?php _e("Search Blogs »"); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<?php do_action( 'mu_rightnow_end' ); ?>
|
||||
<?php do_action( 'mu_activity_box_end' ); ?>
|
||||
</div><!-- rightnow -->
|
||||
</div>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
Executable
+535
@@ -0,0 +1,535 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
if( is_site_admin() == false ) {
|
||||
wp_die( __('You do not have permission to access this page.') );
|
||||
}
|
||||
|
||||
do_action('wpmuadminedit', '');
|
||||
|
||||
if( isset($_GET[ 'id' ]) ) {
|
||||
$id = intval( $_GET[ 'id' ] );
|
||||
} elseif( isset($_POST[ 'id' ]) ) {
|
||||
$id = intval( $_POST[ 'id' ] );
|
||||
}
|
||||
|
||||
if( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) ) {
|
||||
$_POST['ref'] = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
switch( $_GET['action'] ) {
|
||||
case "siteoptions":
|
||||
check_admin_referer('siteoptions');
|
||||
if( empty( $_POST ) )
|
||||
wp_die( __("You probably need to go back to the <a href='wpmu-options.php'>options page</a>") );
|
||||
|
||||
update_site_option( "WPLANG", $_POST['WPLANG'] );
|
||||
|
||||
if( is_email( $_POST['admin_email'] ) )
|
||||
update_site_option( "admin_email", $_POST['admin_email'] );
|
||||
|
||||
$illegal_names = split( ' ', $_POST['illegal_names'] );
|
||||
foreach( (array) $illegal_names as $name ) {
|
||||
$name = trim( $name );
|
||||
if( $name != '' )
|
||||
$names[] = trim( $name );
|
||||
}
|
||||
update_site_option( "illegal_names", $names );
|
||||
|
||||
if( $_POST['limited_email_domains'] != '' ) {
|
||||
$limited_email_domains = str_replace( ' ', "\n", $_POST[ 'limited_email_domains' ] );
|
||||
$limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) );
|
||||
foreach( (array) $limited_email_domains as $domain ) {
|
||||
$limited_email[] = trim( $domain );
|
||||
}
|
||||
update_site_option( "limited_email_domains", $limited_email );
|
||||
} else {
|
||||
update_site_option( "limited_email_domains", '' );
|
||||
}
|
||||
|
||||
if( $_POST['banned_email_domains'] != '' ) {
|
||||
$banned_email_domains = split( "\n", stripslashes( $_POST[ 'banned_email_domains' ] ) );
|
||||
foreach( (array) $banned_email_domains as $domain ) {
|
||||
$banned[] = trim( $domain );
|
||||
}
|
||||
update_site_option( "banned_email_domains", $banned );
|
||||
} else {
|
||||
update_site_option( "banned_email_domains", '' );
|
||||
}
|
||||
update_site_option( 'default_user_role', $_POST[ 'default_user_role' ] );
|
||||
if( trim( $_POST[ 'dashboard_blog_orig' ] ) == '' )
|
||||
$_POST[ 'dashboard_blog_orig' ] = $current_site->blog_id;
|
||||
if( trim( $_POST[ 'dashboard_blog' ] ) == '' ) {
|
||||
$_POST[ 'dashboard_blog' ] = $current_site->blog_id;
|
||||
$dashboard_blog_id = $current_site->blog_id;
|
||||
} else {
|
||||
$dashboard_blog = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $_POST[ 'dashboard_blog' ] ) ) ) );
|
||||
$blog_details = get_blog_details( $dashboard_blog );
|
||||
if ( false === $blog_details ) {
|
||||
if ( is_numeric( $dashboard_blog ) )
|
||||
wp_die( __( 'Dashboard blog_id must be a blog that already exists' ) );
|
||||
if ( constant( 'VHOST' ) == 'yes' ) {
|
||||
$domain = $dashboard_blog . '.' . $current_site->domain;
|
||||
$path = $current_site->path;
|
||||
} else {
|
||||
$domain = $current_site->domain;
|
||||
$path = trailingslashit( $current_site->path . $dashboard_blog );
|
||||
}
|
||||
$wpdb->hide_errors();
|
||||
$dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( "public" => 0 ), $current_site->id );
|
||||
$wpdb->show_errors();
|
||||
} else {
|
||||
$dashboard_blog_id = $blog_details->blog_id;
|
||||
}
|
||||
}
|
||||
if ( is_wp_error( $dashboard_blog_id ) ) {
|
||||
wp_die( __( 'Problem creating dashboard blog: ' ) . $dashboard_blog_id->get_error_message() );
|
||||
}
|
||||
if( $_POST[ 'dashboard_blog_orig' ] != $_POST[ 'dashboard_blog' ] ) {
|
||||
$users = get_users_of_blog( get_site_option( 'dashboard_blog' ) );
|
||||
$move_users = array();
|
||||
foreach ( (array)$users as $user ) {
|
||||
if( array_pop( array_keys( unserialize( $user->meta_value ) ) ) == 'subscriber' )
|
||||
$move_users[] = $user->user_id;
|
||||
}
|
||||
if ( false == empty( $move_users ) ) {
|
||||
foreach ( (array)$move_users as $user_id ) {
|
||||
remove_user_from_blog($user_id, get_site_option( 'dashboard_blog' ) );
|
||||
add_user_to_blog( $dashboard_blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
|
||||
update_usermeta( $user_id, 'primary_blog', $dashboard_blog_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
update_site_option( "dashboard_blog", $dashboard_blog_id );
|
||||
$options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed' );
|
||||
foreach( $options as $option_name ) {
|
||||
$value = stripslashes_deep( $_POST[ $option_name ] );
|
||||
update_site_option( $option_name, $value );
|
||||
}
|
||||
|
||||
$site_admins = explode( ' ', str_replace( ",", " ", $_POST['site_admins'] ) );
|
||||
if ( is_array( $site_admins ) ) {
|
||||
$mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
|
||||
if( $mainblog_id ) {
|
||||
reset( $site_admins );
|
||||
foreach( (array) $site_admins as $site_admin ) {
|
||||
$uid = $wpdb->get_var( "SELECT ID FROM {$wpdb->users} WHERE user_login='{$site_admin}'" );
|
||||
if( $uid )
|
||||
add_user_to_blog( $mainblog_id, $uid, 'administrator' );
|
||||
}
|
||||
}
|
||||
update_site_option( 'site_admins' , $site_admins );
|
||||
}
|
||||
|
||||
// Update more options here
|
||||
do_action( 'update_wpmu_options' );
|
||||
|
||||
wp_redirect( add_query_arg( "updated", "true", 'wpmu-options.php' ) );
|
||||
exit();
|
||||
break;
|
||||
case "addblog":
|
||||
check_admin_referer('add-blog');
|
||||
|
||||
if( is_array( $_POST[ 'blog' ] ) == false ) {
|
||||
wp_die( "Can't create an empty blog." );
|
||||
}
|
||||
$blog = $_POST['blog'];
|
||||
$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.') );
|
||||
if( !is_email( $email ) )
|
||||
wp_die( __('Invalid email address') );
|
||||
|
||||
if( constant( 'VHOST' ) == 'yes' ) {
|
||||
$newdomain = $domain.".".$current_site->domain;
|
||||
$path = $base;
|
||||
} else {
|
||||
$newdomain = $current_site->domain;
|
||||
$path = $base.$domain.'/';
|
||||
}
|
||||
|
||||
$password = 'N/A';
|
||||
$user_id = email_exists($email);
|
||||
if( !$user_id ) { // Create a new user with a random password
|
||||
$password = generate_random_password();
|
||||
$user_id = wpmu_create_user( $domain, $password, $email );
|
||||
if(false == $user_id) {
|
||||
wp_die( __('There was an error creating the user') );
|
||||
} else {
|
||||
wp_new_user_notification($user_id, $password);
|
||||
}
|
||||
}
|
||||
|
||||
$wpdb->hide_errors();
|
||||
$id = wpmu_create_blog($newdomain, $path, $title, $user_id , array( "public" => 1 ), $current_site->id);
|
||||
$wpdb->show_errors();
|
||||
if( !is_wp_error($id) ) {
|
||||
$dashboard_blog = get_dashboard_blog();
|
||||
if( get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id )
|
||||
update_user_option( $user_id, 'primary_blog', $id, true );
|
||||
$content_mail = sprintf( __( "New blog created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain.$path, stripslashes( $title ) );
|
||||
wp_mail( get_site_option('admin_email'), sprintf(__('[%s] New Blog Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
|
||||
wpmu_welcome_notification( $id, $user_id, $password, $title, array( "public" => 1 ) );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add-blog'), $_SERVER['HTTP_REFERER'] ) );
|
||||
exit();
|
||||
} else {
|
||||
wp_die( $id->get_error_message() );
|
||||
}
|
||||
break;
|
||||
|
||||
case "updateblog":
|
||||
check_admin_referer('editblog');
|
||||
if( empty( $_POST ) )
|
||||
wp_die( __('You probably need to go back to the <a href="wpmu-blogs.php">blogs page</a>') );
|
||||
|
||||
// themes
|
||||
if( is_array( $_POST[ 'theme' ] ) ) {
|
||||
$_POST[ 'option' ][ 'allowedthemes' ] = $_POST[ 'theme' ];
|
||||
} else {
|
||||
$_POST[ 'option' ][ 'allowedthemes' ] = '';
|
||||
}
|
||||
|
||||
switch_to_blog( $id );
|
||||
if( is_array( $_POST[ 'option' ] ) ) {
|
||||
$c = 1;
|
||||
$count = count( $_POST[ 'option' ] );
|
||||
foreach ( (array) $_POST['option'] as $key => $val ) {
|
||||
if( $key === 0 )
|
||||
continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
|
||||
if( $c == $count ) {
|
||||
update_option( $key, $val );
|
||||
} else {
|
||||
update_option( $key, $val, false ); // no need to refresh blog details yet
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
if( $_POST['update_home_url'] == 'update' ) {
|
||||
if( get_option( 'siteurl' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] )
|
||||
update_option( 'siteurl', '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'] );
|
||||
}
|
||||
|
||||
$wp_rewrite->flush_rules();
|
||||
|
||||
// update blogs table
|
||||
$result = $wpdb->query( "UPDATE {$wpdb->blogs} SET
|
||||
domain = '".$_POST[ 'blog' ][ 'domain' ]."',
|
||||
path = '".$_POST[ 'blog' ][ 'path' ]."',
|
||||
registered = '".$_POST[ 'blog' ][ 'registered' ]."',
|
||||
public = '".$_POST[ 'blog' ][ 'public' ]."',
|
||||
archived = '".$_POST[ 'blog' ][ 'archived' ]."',
|
||||
mature = '".$_POST[ 'blog' ][ 'mature' ]."',
|
||||
deleted = '".$_POST[ 'blog' ][ 'deleted' ]."',
|
||||
spam = '".$_POST[ 'blog' ][ 'spam' ]."'
|
||||
WHERE blog_id = '$id'" );
|
||||
|
||||
update_blog_status( $id, 'spam', $_POST[ 'blog' ][ 'spam' ] );
|
||||
update_option( 'blog_public', $_POST[ 'blog' ][ 'public' ] );
|
||||
|
||||
// get blog prefix
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $id );
|
||||
// user roles
|
||||
if( is_array( $_POST[ 'role' ] ) == true ) {
|
||||
$newroles = $_POST[ 'role' ];
|
||||
reset( $newroles );
|
||||
foreach ( (array) $newroles as $userid => $role ) {
|
||||
$role_len = strlen( $role );
|
||||
$existing_role = $wpdb->get_var( "SELECT meta_value FROM $wpdb->usermeta WHERE user_id = '$userid' AND meta_key = '" . $blog_prefix. "capabilities'" );
|
||||
if( false == $existing_role ) {
|
||||
$wpdb->query( "INSERT INTO " . $wpdb->usermeta . "( `umeta_id` , `user_id` , `meta_key` , `meta_value` ) VALUES ( NULL, '$userid', '" . $blog_prefix . "capabilities', 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}')" );
|
||||
} elseif( $existing_role != "a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}" ) {
|
||||
$wpdb->query( "UPDATE $wpdb->usermeta SET meta_value = 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}' WHERE user_id = '$userid' AND meta_key = '" . $blog_prefix . "capabilities'" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// remove user
|
||||
if( is_array( $_POST[ 'blogusers' ] ) ) {
|
||||
reset( $_POST[ 'blogusers' ] );
|
||||
foreach ( (array) $_POST[ 'blogusers' ] as $key => $val )
|
||||
remove_user_from_blog( $key, $id );
|
||||
}
|
||||
|
||||
// change password
|
||||
if( is_array( $_POST[ 'user_password' ] ) ) {
|
||||
reset( $_POST[ 'user_password' ] );
|
||||
$newroles = $_POST[ 'role' ];
|
||||
foreach ( (array) $_POST[ 'user_password' ] as $userid => $pass ) {
|
||||
unset( $_POST[ 'role' ] );
|
||||
$_POST[ 'role' ] = $newroles[ $userid ];
|
||||
if( $pass != '' ) {
|
||||
$cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
|
||||
$userdata = get_userdata($userid);
|
||||
$_POST[ 'pass1' ] = $_POST[ 'pass2' ] = $pass;
|
||||
$_POST[ 'email' ] = $userdata->user_email;
|
||||
$_POST[ 'rich_editing' ] = $userdata->rich_editing;
|
||||
edit_user( $userid );
|
||||
if( $cap == null )
|
||||
$wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
|
||||
}
|
||||
}
|
||||
unset( $_POST[ 'role' ] );
|
||||
$_POST[ 'role' ] = $newroles;
|
||||
}
|
||||
|
||||
// add user?
|
||||
if( $_POST[ 'newuser' ] != '' ) {
|
||||
$newuser = $_POST[ 'newuser' ];
|
||||
$userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) );
|
||||
if( $userid ) {
|
||||
$user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='wp_" . $id . "_capabilities'" );
|
||||
if( $user == false )
|
||||
add_user_to_blog($id, $userid, $_POST[ 'new_role' ]);
|
||||
}
|
||||
}
|
||||
do_action( 'wpmu_update_blog_options' );
|
||||
restore_current_blog();
|
||||
wpmu_admin_do_redirect( "wpmu-blogs.php?action=editblog&updated=true&id=".$id );
|
||||
break;
|
||||
|
||||
case "deleteblog":
|
||||
check_admin_referer('deleteblog');
|
||||
if( $id != '0' && $id != $current_site->blog_id )
|
||||
wpmu_delete_blog( $id, true );
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST[ 'ref' ] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "allblogs":
|
||||
check_admin_referer('allblogs');
|
||||
foreach ( (array) $_POST[ 'allblogs' ] as $key => $val ) {
|
||||
if( $val != '0' && $val != $current_site->blog_id ) {
|
||||
if ( isset($_POST['allblog_delete']) ) {
|
||||
$blogfunction = 'all_delete';
|
||||
wpmu_delete_blog( $val, true );
|
||||
} elseif ( isset($_POST['allblog_spam']) ) {
|
||||
$blogfunction = 'all_spam';
|
||||
update_blog_status( $val, "spam", '1', 0 );
|
||||
set_time_limit(60);
|
||||
} elseif ( isset($_POST['allblog_notspam']) ) {
|
||||
$blogfunction = 'all_notspam';
|
||||
update_blog_status( $val, "spam", '0', 0 );
|
||||
set_time_limit(60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $blogfunction), $_SERVER['HTTP_REFERER'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "archiveblog":
|
||||
check_admin_referer('archiveblog');
|
||||
update_blog_status( $id, "archived", '1' );
|
||||
do_action( "archive_blog", $id );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'archive'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "unarchiveblog":
|
||||
check_admin_referer('unarchiveblog');
|
||||
do_action( "unarchive_blog", $id );
|
||||
update_blog_status( $id, "archived", '0' );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unarchive'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "activateblog":
|
||||
check_admin_referer('activateblog');
|
||||
update_blog_status( $id, "deleted", '0' );
|
||||
do_action( "activate_blog", $id );
|
||||
wp_redirect( add_query_arg( "updated", array('updated' => 'true', 'action' => 'activate'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "deactivateblog":
|
||||
check_admin_referer('deactivateblog');
|
||||
do_action( "deactivate_blog", $id );
|
||||
update_blog_status( $id, "deleted", '1' );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'deactivate'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "unspamblog":
|
||||
check_admin_referer('unspamblog');
|
||||
update_blog_status( $id, "spam", '0' );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unspam'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "spamblog":
|
||||
check_admin_referer('spamblog');
|
||||
update_blog_status( $id, "spam", '1' );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'spam'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "mature":
|
||||
update_blog_status( $id, 'mature', '1' );
|
||||
do_action( 'mature_blog', $id );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'mature'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "unmature":
|
||||
update_blog_status( $id, 'mature', '0' );
|
||||
do_action( 'unmature_blog', $id );
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'umature'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
// Themes
|
||||
case "updatethemes":
|
||||
if( is_array( $_POST['theme'] ) ) {
|
||||
$themes = get_themes();
|
||||
reset( $themes );
|
||||
foreach( (array) $themes as $key => $theme ) {
|
||||
if( $_POST['theme'][ wp_specialchars( $theme['Stylesheet'] ) ] == 'enabled' )
|
||||
$allowed_themes[ wp_specialchars( $theme['Stylesheet'] ) ] = true;
|
||||
}
|
||||
update_site_option( 'allowedthemes', $allowed_themes );
|
||||
}
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'themes'), $_SERVER['HTTP_REFERER'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
// Common
|
||||
case "confirm":
|
||||
$referrer = ( isset($_GET['ref']) ) ? stripslashes($_GET['ref']) : $_SERVER['HTTP_REFERER'];
|
||||
$referrer = clean_url($referrer);
|
||||
if( !headers_sent() ){
|
||||
nocache_headers();
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
}
|
||||
?>
|
||||
<!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" <?php if ( function_exists('language_attributes') ) language_attributes(); ?>>
|
||||
<head>
|
||||
<title><?php _e("WordPress MU › Confirm your action"); ?></title>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<?php wp_admin_css( 'install', true ); ?>
|
||||
</head>
|
||||
<body id="error-page">
|
||||
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
||||
<form action='wpmu-edit.php?action=<?php echo wp_specialchars( $_GET[ 'action2' ] ) ?>' method='post'>
|
||||
<input type='hidden' name='action' value='<?php echo wp_specialchars( $_GET['action2'] ) ?>' />
|
||||
<input type='hidden' name='id' value='<?php echo wp_specialchars( $id ); ?>' />
|
||||
<input type='hidden' name='ref' value='<?php echo $referrer; ?>' />
|
||||
<?php wp_nonce_field( $_GET['action2'] ) ?>
|
||||
<p><?php echo wp_specialchars( stripslashes($_GET['msg']) ); ?></p>
|
||||
<p class="submit"><input class="button" type='submit' value='<?php _e("Confirm"); ?>' /></p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
break;
|
||||
|
||||
// Users (not used any more)
|
||||
case "deleteuser":
|
||||
check_admin_referer('deleteuser');
|
||||
if( $id != '0' && $id != '1' )
|
||||
wpmu_delete_user($id);
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'delete'), $_POST['ref'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "allusers":
|
||||
check_admin_referer('allusers');
|
||||
if ( isset($_POST['alluser_delete']) ) {
|
||||
require_once('admin-header.php');
|
||||
echo '<div class="wrap" style="position:relative;">';
|
||||
confirm_delete_users( $_POST['allusers'] );
|
||||
echo '</div>';
|
||||
} elseif( isset( $_POST[ 'alluser_transfer_delete' ] ) ) {
|
||||
if( is_array( $_POST[ 'blog' ] ) && !empty( $_POST[ 'blog' ] ) ) {
|
||||
foreach( $_POST[ 'blog' ] as $id => $users ) {
|
||||
foreach( $users as $blogid => $user_id ) {
|
||||
remove_user_from_blog( $id, $blogid, $user_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( is_array( $_POST[ 'user' ] ) && !empty( $_POST[ 'user' ] ) )
|
||||
foreach( $_POST[ 'user' ] as $id )
|
||||
wpmu_delete_user( $id );
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_delete'), 'wpmu-users.php' ) );
|
||||
} else {
|
||||
foreach ( (array) $_POST['allusers'] as $key => $val ) {
|
||||
if( $val == '' || $val == '0' ) {
|
||||
continue;
|
||||
}
|
||||
$user = new WP_User( $val );
|
||||
if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) {
|
||||
wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a site admnistrator.' ), $user->user_login ) );
|
||||
}
|
||||
if ( isset($_POST['alluser_spam']) ) {
|
||||
$userfunction = 'all_spam';
|
||||
$blogs = get_blogs_of_user( $val, true );
|
||||
foreach ( (array) $blogs as $key => $details ) {
|
||||
if ( $details->userblog_id == $current_site->blog_id ) { continue; } // main blog not a spam !
|
||||
update_blog_status( $details->userblog_id, "spam", '1' );
|
||||
}
|
||||
update_user_status( $val, "spam", '1', 1 );
|
||||
} elseif ( isset($_POST['alluser_notspam']) ) {
|
||||
$userfunction = 'all_notspam';
|
||||
$blogs = get_blogs_of_user( $val, true );
|
||||
foreach ( (array) $blogs as $key => $details ) {
|
||||
update_blog_status( $details->userblog_id, "spam", '0' );
|
||||
}
|
||||
update_user_status( $val, "spam", '0', 1 );
|
||||
}
|
||||
}
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => $userfunction), $_SERVER['HTTP_REFERER'] ) );
|
||||
}
|
||||
exit();
|
||||
break;
|
||||
|
||||
case "adduser":
|
||||
check_admin_referer('add-user');
|
||||
|
||||
if( is_array( $_POST[ 'user' ] ) == false ) {
|
||||
wp_die( __( "Cannot create an empty user." ) );
|
||||
}
|
||||
$user = $_POST['user'];
|
||||
if ( empty($user['username']) && empty($user['email']) ) {
|
||||
wp_die( __('Missing username and email.') );
|
||||
} elseif ( empty($user['username']) ) {
|
||||
wp_die( __('Missing username.') );
|
||||
} elseif ( empty($user['email']) ) {
|
||||
wp_die( __('Missing email.') );
|
||||
}
|
||||
|
||||
$password = generate_random_password();
|
||||
$user_id = wpmu_create_user(wp_specialchars( strtolower( $user['username'] ) ), $password, wp_specialchars( $user['email'] ) );
|
||||
|
||||
if( false == $user_id ) {
|
||||
wp_die( __('Duplicated username or email address.') );
|
||||
} else {
|
||||
wp_new_user_notification($user_id, $password);
|
||||
}
|
||||
if ( get_site_option( 'dashboard_blog' ) == false ) {
|
||||
add_user_to_blog( $current_site->blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
|
||||
} else {
|
||||
add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
|
||||
}
|
||||
|
||||
wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'add'), $_SERVER['HTTP_REFERER'] ) );
|
||||
exit();
|
||||
break;
|
||||
|
||||
default:
|
||||
wpmu_admin_do_redirect( "wpmu-admin.php" );
|
||||
break;
|
||||
}
|
||||
?>
|
||||
Executable
+294
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
$title = __('WordPress MU › Admin › Site Options');
|
||||
$parent_file = 'wpmu-admin.php';
|
||||
|
||||
include('admin-header.php');
|
||||
|
||||
if( is_site_admin() == false ) {
|
||||
wp_die( __('You do not have permission to access this page.') );
|
||||
}
|
||||
|
||||
if (isset($_GET['updated'])) {
|
||||
?>
|
||||
<div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Site Options') ?></h2>
|
||||
<form method="post" action="wpmu-edit.php?action=siteoptions">
|
||||
<?php wp_nonce_field( "siteoptions" ); ?>
|
||||
<h3><?php _e('Operational Settings <em>(These settings cannot be modified by blog owners)</em>') ?></h3>
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Site Name') ?></th>
|
||||
<td>
|
||||
<input name="site_name" type="text" id="site_name" style="width: 95%" value="<?php echo $current_site->site_name ?>" size="45" />
|
||||
<br />
|
||||
<?php _e('What you would like to call this website.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Site Admin Email') ?></th>
|
||||
<td>
|
||||
<input name="admin_email" type="text" id="admin_email" style="width: 95%" value="<?php echo stripslashes( get_site_option('admin_email') ) ?>" size="45" />
|
||||
<br />
|
||||
<?php printf( __( 'Registration and support mails will come from this address. Make it generic like "support@%s"' ), $current_site->domain ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Allow new registrations') ?></th>
|
||||
<?php
|
||||
if( !get_site_option('registration') )
|
||||
update_site_option( 'registration', 'all' );
|
||||
?>
|
||||
<td>
|
||||
<label><input name="registration" type="radio" id="registration1" value='none' <?php echo get_site_option('registration') == 'none' ? 'checked="checked"' : ''; ?> /> <?php _e('Disabled'); ?></label><br />
|
||||
<label><input name="registration" type="radio" id="registration2" value='all' <?php echo get_site_option('registration') == 'all' ? 'checked="checked"' : ''; ?> /> <?php _e('Enabled. Blogs and user accounts can be created.'); ?></label><br />
|
||||
<label><input name="registration" type="radio" id="registration3" value='user' <?php echo get_site_option('registration') == 'user' ? 'checked="checked"' : ''; ?> /> <?php _e('Only user account can be created.'); ?></label><br />
|
||||
<label><input name="registration" type="radio" id="registration4" value='blog' <?php echo get_site_option('registration') == 'blog' ? 'checked="checked"' : ''; ?> /> <?php _e('Only logged in users can create new blogs.'); ?></label><br />
|
||||
<p><?php _e('Disable or enable registration and who or what can be registered. (Default=all)'); ?></p>
|
||||
<?php if( constant( 'VHOST' ) == 'yes' ) {
|
||||
echo "<p>" . __('If registration is disabled, please set "NOBLOGREDIRECT" in wp-config.php to a url you will redirect visitors to if they visit a non existant blog.') . "</p>";
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Registration notification') ?></th>
|
||||
<?php
|
||||
if( !get_site_option('registrationnotification') )
|
||||
update_site_option( 'registrationnotification', 'yes' );
|
||||
?>
|
||||
<td>
|
||||
<input name="registrationnotification" type="radio" id="registrationnotification1" value='yes' <?php echo get_site_option('registrationnotification') == 'yes' ? 'checked="checked"' : ''; ?> /> <?php _e('Yes'); ?><br />
|
||||
<input name="registrationnotification" type="radio" id="registrationnotification2" value='no' <?php echo get_site_option('registrationnotification') == 'no' ? 'checked="checked"' : ''; ?> /> <?php _e('No'); ?><br />
|
||||
<?php _e('Send the site admin an email notification every time someone registers a blog or user account.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Add New Users') ?></th>
|
||||
<td>
|
||||
<a name='addnewusers'></a>
|
||||
<input name="add_new_users" type="radio" id="add_new_users1" value='1' <?php echo get_site_option('add_new_users') == 1 ? 'checked="checked"' : ''; ?> /> <?php _e('Yes'); ?><br />
|
||||
<input name="add_new_users" type="radio" id="add_new_users2" value='0' <?php echo get_site_option('add_new_users') == 0 ? 'checked="checked"' : ''; ?> /> <?php _e('No'); ?><br />
|
||||
<?php _e('Allow blog administrators to add new users to their blog via the Users->Add New page.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Dashboard Blog') ?></th>
|
||||
<td>
|
||||
<?php
|
||||
if ( $dashboard_blog = get_site_option( 'dashboard_blog' ) ) {
|
||||
$details = get_blog_details( $dashboard_blog );
|
||||
$blogname = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $details->domain . $details->path ) ) ) );
|
||||
} else {
|
||||
$blogname = '';
|
||||
}?>
|
||||
<input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo $blogname; ?>" />
|
||||
<input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo $blogname; ?>" size="30" />
|
||||
<br />
|
||||
<?php _e( "Blogname ('dashboard', 'control', 'manager', etc) or blog id.<br />New users are added to this blog as subscribers (or the user role defined below) if they don't have a blog. Leave blank for the main blog. 'Subscriber' users on old blog will be moved to the new blog if changed. New blog will be created if it does not exist." ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Dashboard User Default Role') ?></th>
|
||||
<td>
|
||||
<select name="default_user_role" id="role"><?php
|
||||
wp_dropdown_roles( get_site_option( 'default_user_role', 'subscriber' ) );
|
||||
?>
|
||||
</select>
|
||||
<br />
|
||||
<?php _e( "The default role for new users on the Dashboard blog. This should probably be 'Subscriber' or maybe 'Contributor'." ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Banned Names') ?></th>
|
||||
<td>
|
||||
<input name="illegal_names" type="text" id="illegal_names" style="width: 95%" value="<?php echo implode( " ", get_site_option('illegal_names') ); ?>" size="45" />
|
||||
<br />
|
||||
<?php _e('Users are not allowed to register these blogs. Separate names by spaces.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Limited Email Registrations') ?></th>
|
||||
<td>
|
||||
<?php $limited_email_domains = get_site_option('limited_email_domains');
|
||||
$limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?>
|
||||
<textarea name="limited_email_domains" id="limited_email_domains" cols='40' rows='5'><?php echo $limited_email_domains == '' ? '' : @implode( "\n", $limited_email_domains ); ?></textarea>
|
||||
<br />
|
||||
<?php _e('If you want to limit blog registrations to certain domains. One domain per line.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Banned Email Domains') ?></th>
|
||||
<td>
|
||||
<textarea name="banned_email_domains" id="banned_email_domains" cols='40' rows='5'><?php echo get_site_option('banned_email_domains') == '' ? '' : @implode( "\n", get_site_option('banned_email_domains') ); ?></textarea>
|
||||
<br />
|
||||
<?php _e('If you want to ban certain email domains from blog registrations. One domain per line.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Welcome Email') ?></th>
|
||||
<td>
|
||||
<textarea name="welcome_email" id="welcome_email" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('welcome_email') ) ?></textarea>
|
||||
<br />
|
||||
<?php _e('The welcome email sent to new blog owners.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Welcome User Email') ?></th>
|
||||
<td>
|
||||
<textarea name="welcome_user_email" id="welcome_user_email" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('welcome_user_email') ) ?></textarea>
|
||||
<br />
|
||||
<?php _e('The welcome email sent to new users.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('First Post') ?></th>
|
||||
<td>
|
||||
<textarea name="first_post" id="first_post" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('first_post') ) ?></textarea>
|
||||
<br />
|
||||
<?php _e('First post on a new blog.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('First Page') ?></th>
|
||||
<td>
|
||||
<textarea name="first_page" id="first_page" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('first_page') ) ?></textarea>
|
||||
<br />
|
||||
<?php _e('First page on a new blog.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('First Comment') ?></th>
|
||||
<td>
|
||||
<textarea name="first_comment" id="first_comment" rows='5' cols='45' style="width: 95%"><?php echo stripslashes( get_site_option('first_comment') ) ?></textarea>
|
||||
<br />
|
||||
<?php _e('First comment on a new blog.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('First Comment Author') ?></th>
|
||||
<td>
|
||||
<input type="text" size='40' name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
|
||||
<br />
|
||||
<?php _e('Author of first comment on a new blog.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('First Comment URL') ?></th>
|
||||
<td>
|
||||
<input type="text" size='40' name="first_comment_url" id="first_comment_url" value="<?php echo get_site_option('first_comment_url') ?>" />
|
||||
<br />
|
||||
<?php _e('URL on first comment on a new blog.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Upload media button') ?></th>
|
||||
<?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?>
|
||||
<td><label><input type='checkbox' id="mu_media_buttons_image" name="mu_media_buttons[image]" value='1' <?php if( $mu_media_buttons[ 'image' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Images' ); ?></label><br />
|
||||
<label><input type='checkbox' id="mu_media_buttons_video" name="mu_media_buttons[video]" value='1' <?php if( $mu_media_buttons[ 'video' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Videos' ); ?></label><br />
|
||||
<label><input type='checkbox' id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value='1' <?php if( $mu_media_buttons[ 'audio' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Music' ); ?></label><br />
|
||||
<?php _e( 'The media upload buttons to display on the "Write Post" page. Make sure you update the "Upload File Types" below as well.' ); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Blog upload space check') ?></th>
|
||||
<td>
|
||||
<label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='0' <?php if( !get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Enabled' ); ?></label><br />
|
||||
<label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='1' <?php if( get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Disabled' ); ?></label><br />
|
||||
<?php _e( 'By default there is a limit on the total size of files uploaded but it can be disabled here.' ); ?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Blog upload space') ?></th>
|
||||
<td><input name="blog_upload_space" type="text" id="blog_upload_space" value="<?php echo get_site_option('blog_upload_space', 10) ?>" size="3" /> MB</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Upload File Types') ?></th>
|
||||
<td><input name="upload_filetypes" type="text" id="upload_filetypes" value="<?php echo get_site_option('upload_filetypes', 'jpg jpeg png gif') ?>" size="45" /></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Max upload file size') ?></th>
|
||||
<td><input name="fileupload_maxk" type="text" id="fileupload_maxk" value="<?php echo get_site_option('fileupload_maxk', 300) ?>" size="5" /> KB</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Admin Notice Feed') ?></th>
|
||||
<td><input name="admin_notice_feed" style="width: 95%" type="text" id="admin_notice_feed" value="<?php echo get_site_option( 'admin_notice_feed' ) ?>" size="80" /><br />
|
||||
<?php _e( 'Display the latest post from this RSS or Atom feed on all blog dashboards. Leave blank to disable.' ); ?><br />
|
||||
<?php if( get_site_option( 'admin_notice_feed' ) != 'http://' . $current_site->domain . $current_site->path . 'feed/' )
|
||||
echo __( "A good one to use would be the feed from your main blog: " ) . 'http://' . $current_site->domain . $current_site->path . 'feed/'; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3><?php _e('Administration Settings') ?></h3>
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Site Admins') ?></th>
|
||||
<td>
|
||||
<input name="site_admins" type="text" id="site_admins" style="width: 95%" value="<?php echo implode(' ', get_site_option( 'site_admins', array( 'admin' ) ) ) ?>" size="45" />
|
||||
<br />
|
||||
<?php _e('These users may login to the main blog and administer the site. Space separated list of usernames.') ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3><?php _e('Site Wide Settings <em>(These settings may be overridden by blog owners)</em>') ?></h3>
|
||||
<table class="form-table">
|
||||
<?php
|
||||
if( is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) )
|
||||
while( ( $lang_file = readdir( $dh ) ) !== false )
|
||||
if( substr( $lang_file, -3 ) == '.mo' )
|
||||
$lang_files[] = $lang_file;
|
||||
$lang = get_site_option('WPLANG');
|
||||
if( is_array($lang_files) && !empty($lang_files) ) {
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th width="33%"><?php _e('Default Language') ?></th>
|
||||
<td>
|
||||
<select name="WPLANG" id="WPLANG">
|
||||
<?php mu_dropdown_languages( $lang_files, get_site_option('WPLANG') ); ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // languages
|
||||
?>
|
||||
</table>
|
||||
|
||||
<h3><?php _e('Menus <em>(Enable or disable WP Backend Menus)</em>') ?></h3>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><?php _e("Menu"); ?></th>
|
||||
<th scope="row"><?php _e("Enabled"); ?></th>
|
||||
</tr>
|
||||
<a name='menu'></a>
|
||||
<?php
|
||||
$menu_perms = get_site_option( "menu_items" );
|
||||
$menu_items = apply_filters( 'mu_menu_items', array('plugins' => __('Plugins')) );
|
||||
foreach ( (array) $menu_items as $key => $val ) {
|
||||
echo "<tr><th scope='row'>" . wp_specialchars($val) . "</th><td><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . (( $menu_perms[$key] == '1' ) ? ' checked="checked"' : '') . " /></td></tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'wpmu_options' ); // Add more options here ?>
|
||||
|
||||
<p class="submit">
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options') ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php include('./admin-footer.php'); ?>
|
||||
Executable
+613
@@ -0,0 +1,613 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('WordPress MU › Admin › Blogs');
|
||||
$parent_file = 'wpmu-admin.php';
|
||||
|
||||
wp_enqueue_script( 'admin-forms' );
|
||||
|
||||
require_once('admin-header.php');
|
||||
if( is_site_admin() == false ) {
|
||||
wp_die( __('You do not have permission to access this page.') );
|
||||
}
|
||||
$id = intval( $_GET['id'] );
|
||||
$protocol = is_ssl() ? 'https://' : 'http://';
|
||||
|
||||
if ( $_GET['updated'] == 'true' ) {
|
||||
?>
|
||||
<div id="message" class="updated fade"><p>
|
||||
<?php
|
||||
switch ($_GET['action']) {
|
||||
case 'all_notspam':
|
||||
_e('Blogs mark as not spam !');
|
||||
break;
|
||||
case 'all_spam':
|
||||
_e('Blogs mark as spam !');
|
||||
break;
|
||||
case 'all_delete':
|
||||
_e('Blogs deleted !');
|
||||
break;
|
||||
case 'delete':
|
||||
_e('Blog deleted !');
|
||||
break;
|
||||
case 'add-blog':
|
||||
_e('Blog added !');
|
||||
break;
|
||||
case 'archive':
|
||||
_e('Blog archived !');
|
||||
break;
|
||||
case 'unarchive':
|
||||
_e('Blog unarchived !');
|
||||
break;
|
||||
case 'activate':
|
||||
_e('Blog activated !');
|
||||
break;
|
||||
case 'deactivate':
|
||||
_e('Blog deactivated !');
|
||||
break;
|
||||
case 'unspam':
|
||||
_e('Blog mark as not spam !');
|
||||
break;
|
||||
case 'spam':
|
||||
_e('Blog mark as spam !');
|
||||
break;
|
||||
case 'umature':
|
||||
_e('Blog mark as not mature !');
|
||||
break;
|
||||
case 'mature':
|
||||
_e('Blog mark as mature !');
|
||||
break;
|
||||
default:
|
||||
_e('Options saved !');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</p></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
switch( $_GET['action'] ) {
|
||||
// Edit blog
|
||||
case "editblog":
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $id );
|
||||
$options = $wpdb->get_results( "SELECT * FROM {$blog_prefix}options WHERE option_name NOT LIKE '_transient_rss%' AND option_name NOT LIKE '%user_roles'", ARRAY_A );
|
||||
$details = $wpdb->get_row( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$id}'", ARRAY_A );
|
||||
$editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" );
|
||||
?>
|
||||
<div class="wrap">
|
||||
<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="wpmu-edit.php?action=updateblog">
|
||||
<?php wp_nonce_field('editblog'); ?>
|
||||
<input type="hidden" name="id" value="<?php echo $id ?>" />
|
||||
<div class='metabox-holder' style='width:49%;float:left;'>
|
||||
<div id="blogedit_bloginfo" class="postbox " >
|
||||
<h3 class='hndle'><span><?php _e('Blog info (wp_blogs)'); ?></span></h3>
|
||||
<div class="inside">
|
||||
<table class="form-table">
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row"><?php _e('Domain') ?></th>
|
||||
<td>http://<input name="blog[domain]" type="text" id="domain" value="<?php echo $details['domain'] ?>" size="33" /></td>
|
||||
</tr>
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row"><?php _e('Path') ?></th>
|
||||
<td><input name="blog[path]" type="text" id="path" value="<?php echo $details['path'] ?>" size="40" style='margin-bottom:5px;' />
|
||||
<br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e('Registered') ?></th>
|
||||
<td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details['registered'] ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e('Last Updated') ?></th>
|
||||
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details['last_updated'] ?>" size="40" /></td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e('Public') ?></th>
|
||||
<td>
|
||||
<input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
|
||||
<input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e( 'Archived' ); ?></th>
|
||||
<td>
|
||||
<input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
|
||||
<input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e( 'Mature' ); ?></th>
|
||||
<td>
|
||||
<input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
|
||||
<input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e( 'Spam' ); ?></th>
|
||||
<td>
|
||||
<input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
|
||||
<input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php _e( 'Deleted' ); ?></th>
|
||||
<td>
|
||||
<input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
|
||||
<input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
</div></div>
|
||||
|
||||
<div id="blogedit_blogoptions" class="postbox " >
|
||||
<h3 class='hndle'><span><?php printf( __('Blog options (wp_%s_options)'), $id ); ?></span></h3>
|
||||
<div class="inside">
|
||||
<table class="form-table">
|
||||
<?php
|
||||
$editblog_default_role = 'subscriber';
|
||||
foreach ( $options as $key => $val ) {
|
||||
if( $val['option_name'] == 'default_role' ) {
|
||||
$editblog_default_role = $val['option_value'];
|
||||
}
|
||||
$disabled = '';
|
||||
if ( is_serialized($val['option_value']) ) {
|
||||
if ( is_serialized_string($val['option_value']) ) {
|
||||
$val['option_value'] = wp_specialchars(maybe_unserialize($val['option_value']), 'single');
|
||||
} else {
|
||||
$val['option_value'] = "SERIALIZED DATA";
|
||||
$disabled = ' disabled="disabled"';
|
||||
}
|
||||
}
|
||||
if ( stristr($val['option_value'], "\r") || stristr($val['option_value'], "\n") || stristr($val['option_value'], "\r\n") ) {
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
|
||||
<td><textarea rows="5" cols="40" name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>"<?php echo $disabled ?>><?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?></textarea></td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row"><?php echo ucwords( str_replace( "_", " ", $val['option_name'] ) ) ?></th>
|
||||
<td><input name="option[<?php echo $val['option_name'] ?>]" type="text" id="<?php echo $val['option_name'] ?>" value="<?php echo wp_specialchars( stripslashes( $val['option_value'] ), 1 ) ?>" size="40" <?php echo $disabled ?> /></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} // End foreach
|
||||
?>
|
||||
</table>
|
||||
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
</div></div>
|
||||
</div>
|
||||
|
||||
<div class='metabox-holder' style='width:49%;float:right;'>
|
||||
<?php
|
||||
// Blog Themes
|
||||
$themes = get_themes();
|
||||
$blog_allowed_themes = wpmu_get_blog_allowedthemes( $id );
|
||||
$allowed_themes = get_site_option( "allowedthemes" );
|
||||
if( $allowed_themes == false ) {
|
||||
$allowed_themes = array_keys( $themes );
|
||||
}
|
||||
$out = '';
|
||||
foreach( $themes as $key => $theme ) {
|
||||
$theme_key = wp_specialchars( $theme['Stylesheet'] );
|
||||
if( isset($allowed_themes[$theme_key] ) == false ) {
|
||||
$checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
|
||||
$out .= '<tr class="form-field form-required">
|
||||
<th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th>
|
||||
<td><input name="theme['.$theme_key.']" type="checkbox" style="width:20px;" value="on" '.$checked.'/>' . __( 'Active' ) . '</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $out != '' ) {
|
||||
?>
|
||||
<div id="blogedit_blogthemes" class="postbox">
|
||||
<h3 class='hndle'><span><?php _e('Blog Themes'); ?></span></h3>
|
||||
<div class="inside">
|
||||
<table class="form-table">
|
||||
<tr><th style="font-weight:bold;"><?php _e('Theme'); ?></th></tr>
|
||||
<?php echo $out; ?>
|
||||
</table>
|
||||
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
</div></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
// Blog users
|
||||
$blogusers = get_users_of_blog( $id );
|
||||
if( is_array( $blogusers ) ) {
|
||||
echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __('Blog Users') . '</span></h3><div class="inside">';
|
||||
echo '<table class="form-table">';
|
||||
echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th></tr>";
|
||||
reset($blogusers);
|
||||
foreach ( (array) $blogusers as $key => $val ) {
|
||||
$t = @unserialize( $val->meta_value );
|
||||
if( is_array( $t ) ) {
|
||||
reset( $t );
|
||||
$existing_role = key( $t );
|
||||
}
|
||||
echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
|
||||
if( $val->user_id != $current_user->data->ID ) {
|
||||
?>
|
||||
<td>
|
||||
<select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
|
||||
foreach( $editblog_roles as $role => $role_assoc ){
|
||||
$name = translate_with_context($role_assoc['name']);
|
||||
$selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
|
||||
echo "<option {$selected} value=\"{$role}\">{$name}</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type='text' name='user_password[<?php echo $val->user_id ?>]' />
|
||||
</td>
|
||||
<?php
|
||||
echo '<td><input title="' . __('Click to remove user') . '" type="checkbox" name="blogusers[' . $val->user_id . ']" /></td>';
|
||||
} else {
|
||||
echo "<td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __ ('N/A') . "</strong></td><td><strong>" . __('N/A') . "</strong></td>";
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
echo "</table>";
|
||||
echo '<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="' . __('Update Options »') . '" /></p>';
|
||||
echo "</div></div>";
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="blogedit_blogadduser" class="postbox">
|
||||
<h3 class='hndle'><span><?php _e('Add a new user'); ?></span></h3>
|
||||
<div class="inside">
|
||||
<p style="margin:10px 0 0px;padding:0px 10px 10px;border-bottom:1px solid #DFDFDF;"><?php _e('Enter the username of an existing user and hit <em>Update Options</em> to add the user.') ?></p>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><?php _e('User Login:') ?></th>
|
||||
<td><input type="text" name="newuser" id="newuser" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Role:') ?></th>
|
||||
<td>
|
||||
<select name="new_role" id="new_role">
|
||||
<?php
|
||||
reset( $editblog_roles );
|
||||
foreach( $editblog_roles as $role => $role_assoc ){
|
||||
$name = translate_with_context($role_assoc['name']);
|
||||
$selected = ( $role == $editblog_default_role ) ? 'selected="selected"' : '';
|
||||
echo "<option {$selected} value=\"{$role}\">{$name}</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
</div></div>
|
||||
|
||||
<div id="blogedit_miscoptions" class="postbox">
|
||||
<h3 class='hndle'><span><?php _e('Misc Blog Actions') ?></span></h3>
|
||||
<div class="inside">
|
||||
<table class="form-table">
|
||||
<?php do_action( 'wpmueditblogaction', $id ); ?>
|
||||
</table>
|
||||
<p class="submit" style="margin:-15px 0 -5px 230px;"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
</div></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="clear:both;"></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
|
||||
// List blogs
|
||||
default:
|
||||
$apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1;
|
||||
$num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 15;
|
||||
$s = wp_specialchars( trim( $_GET[ 's' ] ) );
|
||||
|
||||
$query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
|
||||
|
||||
if( isset($_GET['blog_name']) ) {
|
||||
$query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$s}%' OR {$wpdb->blogs}.path LIKE '%{$s}%' ) ";
|
||||
} elseif( isset($_GET['blog_id']) ) {
|
||||
$query .= " AND blog_id = '".intval($_GET['s'])."' ";
|
||||
} elseif( isset($_GET['blog_ip']) ) {
|
||||
$query = "SELECT *
|
||||
FROM {$wpdb->blogs}, {$wpdb->registration_log}
|
||||
WHERE site_id = '{$wpdb->siteid}'
|
||||
AND {$wpdb->blogs}.blog_id = {$wpdb->registration_log}.blog_id
|
||||
AND {$wpdb->registration_log}.IP LIKE ('%{$s}%')";
|
||||
}
|
||||
|
||||
if( isset( $_GET['sortby'] ) == false ) {
|
||||
$_GET['sortby'] = 'id';
|
||||
}
|
||||
|
||||
if( $_GET['sortby'] == 'registered' ) {
|
||||
$query .= ' ORDER BY registered ';
|
||||
} elseif( $_GET['sortby'] == 'id' ) {
|
||||
$query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
|
||||
} elseif( $_GET['sortby'] == 'lastupdated' ) {
|
||||
$query .= ' ORDER BY last_updated ';
|
||||
} elseif( $_GET['sortby'] == 'blogname' ) {
|
||||
$query .= ' ORDER BY domain ';
|
||||
}
|
||||
|
||||
$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
|
||||
|
||||
if( !empty($s) ) {
|
||||
$total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
|
||||
} else {
|
||||
$total = $wpdb->get_var( "SELECT COUNT(blog_id) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ");
|
||||
}
|
||||
|
||||
$query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num );
|
||||
$blog_list = $wpdb->get_results( $query, ARRAY_A );
|
||||
|
||||
// Pagination
|
||||
$url2 = "&order=" . $_GET['order'] . "&sortby=" . $_GET['sortby'] . "&s=";
|
||||
if( $_GET[ 'blog_ip' ] ) {
|
||||
$url2 .= "&ip_address=" . urlencode( $s );
|
||||
} else {
|
||||
$url2 .= $s . "&ip_address=" . urlencode( $s );
|
||||
}
|
||||
$blog_navigation = paginate_links( array(
|
||||
'base' => add_query_arg( 'apage', '%#%' ).$url2,
|
||||
'format' => '',
|
||||
'total' => ceil($total / $num),
|
||||
'current' => $apage
|
||||
));
|
||||
?>
|
||||
|
||||
<div class="wrap" style="position:relative;">
|
||||
<h2><?php _e('Blogs') ?></h2>
|
||||
|
||||
<form action="wpmu-blogs.php" method="get" id="wpmu-search">
|
||||
<input type="hidden" name="action" value="blogs" />
|
||||
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo stripslashes( wp_specialchars( $s, 1 ) ); ?>" size="17" />
|
||||
<input type="submit" class="button" name="blog_name" value="<?php _e('Search blogs by name') ?>" />
|
||||
<input type="submit" class="button" name="blog_id" value="<?php _e('by blog ID') ?>" />
|
||||
<input type="submit" class="button" name="blog_ip" value="<?php _e('by IP address') ?>" />
|
||||
</form>
|
||||
|
||||
<form id="form-blog-list" action="wpmu-edit.php?action=allblogs" method="post">
|
||||
|
||||
<div class="tablenav">
|
||||
<?php if ( $blog_navigation ) echo "<div class='tablenav-pages'>$blog_navigation</div>"; ?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete') ?>" name="allblog_delete" class="button-secondary delete" />
|
||||
<input type="submit" value="<?php _e('Mark as Spam') ?>" name="allblog_spam" class="button-secondary" />
|
||||
<input type="submit" value="<?php _e('Not Spam') ?>" name="allblog_notspam" class="button-secondary" />
|
||||
<?php wp_nonce_field( 'allblogs' ); ?>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
<?php if( isset($_GET['s']) && !empty($_GET['s']) ) : ?>
|
||||
<p><a href="wpmu-users.php?action=users&s=<?php echo urlencode( stripslashes( $s ) ) ?>"><?php _e('Search Users:') ?> <strong><?php echo stripslashes( $s ); ?></strong></a></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||
$blogname_columns = ( constant( "VHOST" ) == 'yes' ) ? __('Domain') : __('Path');
|
||||
$posts_columns = array(
|
||||
'id' => __('ID'),
|
||||
'blogname' => $blogname_columns,
|
||||
'lastupdated' => __('Last Updated'),
|
||||
'registered' => __('Registered'),
|
||||
'users' => __('Users')
|
||||
);
|
||||
|
||||
if( has_filter( 'wpmublogsaction' ) )
|
||||
$posts_columns['plugins'] = __('Actions');
|
||||
|
||||
$posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
|
||||
|
||||
$sortby_url = "s=";
|
||||
if( $_GET[ 'blog_ip' ] ) {
|
||||
$sortby_url .= "&ip_address=" . urlencode( $s );
|
||||
} else {
|
||||
$sortby_url .= urlencode( $s ) . "&ip_address=" . urlencode( $s );
|
||||
}
|
||||
?>
|
||||
|
||||
<table width="100%" cellpadding="3" cellspacing="3" class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"></th>
|
||||
<?php foreach($posts_columns as $column_id => $column_display_name) {
|
||||
$column_link = "<a href='wpmu-blogs.php?{$sortby_url}&sortby={$column_id}&";
|
||||
if( $_GET['sortby'] == $column_id ) {
|
||||
$column_link .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&' : 'order=DESC&';
|
||||
}
|
||||
$column_link .= "apage={$apage}'>{$column_display_name}</a>";
|
||||
|
||||
$col_url = ($column_id == 'users' || $column_id == 'plugins') ? $column_display_name : $column_link;
|
||||
?>
|
||||
<th scope="col"><?php echo $col_url ?></th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
if ($blog_list) {
|
||||
$bgcolor = $class = '';
|
||||
$status_list = array( "archived" => "#fee", "spam" => "#faa", "deleted" => "#f55" );
|
||||
foreach ($blog_list as $blog) {
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
reset( $status_list );
|
||||
|
||||
$bgcolour = "";
|
||||
foreach ( $status_list as $status => $col ) {
|
||||
if( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
|
||||
$bgcolour = "style='background: $col'";
|
||||
}
|
||||
}
|
||||
echo "<tr $bgcolour class='$class'>";
|
||||
|
||||
$blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path'];
|
||||
foreach( $posts_columns as $column_name=>$column_display_name ) {
|
||||
switch($column_name) {
|
||||
case 'id': ?>
|
||||
<th scope="row" class="check-column">
|
||||
<input type='checkbox' id='blog_<?php echo $blog['blog_id'] ?>' name='allblogs[]' value='<?php echo $blog['blog_id'] ?>' />
|
||||
</th>
|
||||
<th scope="row">
|
||||
<?php echo $blog['blog_id'] ?>
|
||||
</th>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'blogname': ?>
|
||||
<td valign="top">
|
||||
<a href="wpmu-blogs.php?action=editblog&id=<?php echo $blog['blog_id'] ?>" class="edit"><?php echo $blogname; ?></a>
|
||||
<br/>
|
||||
<?php
|
||||
$controlActions = array();
|
||||
$controlActions[] = '<a href="wpmu-blogs.php?action=editblog&id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
|
||||
$controlActions[] = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>';
|
||||
|
||||
if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=activateblog&ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) . '">' . __('Activate') . '</a>';
|
||||
else
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=deactivateblog&ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>';
|
||||
|
||||
if( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>';
|
||||
else
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) . '">' . __('Archive') . '</a>';
|
||||
|
||||
if( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>';
|
||||
else
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>';
|
||||
|
||||
$controlActions[] = '<a class="delete" href="wpmu-edit.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( "You are about to delete the blog %s" ), $blogname ) ) . '">' . __("Delete") . '</a>';
|
||||
|
||||
$controlActions[] = "<a href='http://{$blog['domain']}{$blog['path']}' rel='permalink'>" . __('Visit') . '</a>';
|
||||
?>
|
||||
|
||||
<?php if (count($controlActions)) : ?>
|
||||
<div class="row-actions">
|
||||
<?php echo implode(' | ', $controlActions); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'lastupdated': ?>
|
||||
<td valign="top">
|
||||
<?php echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __("Never") : mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['last_updated']); ?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
case 'registered': ?>
|
||||
<td valign="top">
|
||||
<?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i:s a'), $blog['registered']); ?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'users': ?>
|
||||
<td valign="top">
|
||||
<?php
|
||||
$blogusers = get_users_of_blog( $blog['blog_id'] );
|
||||
if ( is_array( $blogusers ) ) {
|
||||
$blogusers_warning = '';
|
||||
if ( count( $blogusers ) > 5 ) {
|
||||
$blogusers = array_slice( $blogusers, 0, 5 );
|
||||
$blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . $protocol . $blog[ 'domain' ] . $blog[ 'path' ] . 'wp-admin/users.php">' . __( 'More' ) . '</a>';
|
||||
}
|
||||
foreach ( $blogusers as $key => $val ) {
|
||||
echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />';
|
||||
}
|
||||
if( $blogusers_warning != '' ) {
|
||||
echo '<strong>' . $blogusers_warning . '</strong><br />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'plugins': ?>
|
||||
<?php if( has_filter( 'wpmublogsaction' ) ) { ?>
|
||||
<td valign="top">
|
||||
<?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php break;
|
||||
|
||||
default: ?>
|
||||
<?php if( has_filter( 'manage_blogs_custom_column' ) ) { ?>
|
||||
<td valign="top">
|
||||
<?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} else { ?>
|
||||
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
||||
<td colspan="8"><?php _e('No blogs found.') ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if ($blogs)
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="wrap">
|
||||
<a name="form-add-blog"></a>
|
||||
<h2><?php _e('Add Blog') ?></h2>
|
||||
<form method="post" action="wpmu-edit.php?action=addblog">
|
||||
<?php wp_nonce_field('add-blog') ?>
|
||||
<table class="form-table">
|
||||
<tr class="form-field form-required">
|
||||
<th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th>
|
||||
<td>
|
||||
<?php if ( constant( "VHOST" ) == 'yes' ) { ?>
|
||||
<input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?>
|
||||
<?php } else {
|
||||
echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>
|
||||
<?php }
|
||||
echo "<p>" . __( 'Only the characters a-z and 0-9 recommended.' ) . "</p>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field form-required">
|
||||
<th style="text-align:center;" scope='row'><?php _e('Blog Title') ?></th>
|
||||
<td><input name="blog[title]" type="text" size="20" title="<?php _e('Title') ?>"/></td>
|
||||
</tr>
|
||||
<tr class="form-field form-required">
|
||||
<th style="text-align:center;" scope='row'><?php _e('Admin Email') ?></th>
|
||||
<td><input name="blog[email]" type="text" size="20" title="<?php _e('Email') ?>"/></td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<td colspan='2'><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input class="button" type="submit" name="go" value="<?php _e('Add Blog') ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
} // end switch( $action )
|
||||
|
||||
include('admin-footer.php'); ?>
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
require_once( ABSPATH . WPINC . '/http.php' );
|
||||
|
||||
$title = __('WordPress MU › Admin › Upgrade Site');
|
||||
$parent_file = 'wpmu-admin.php';
|
||||
require_once('admin-header.php');
|
||||
|
||||
if( is_site_admin() == false ) {
|
||||
wp_die( __('You do not have permission to access this page.') );
|
||||
}
|
||||
|
||||
echo '<div class="wrap">';
|
||||
echo '<h2>'.__('Upgrade Site').'</h2>';
|
||||
switch( $_GET['action'] ) {
|
||||
case "upgrade":
|
||||
$n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
|
||||
|
||||
if ( $n < 5 ) {
|
||||
global $wp_db_version;
|
||||
update_site_option( 'wpmu_upgrade_site', $wp_db_version );
|
||||
}
|
||||
|
||||
$blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
|
||||
if( is_array( $blogs ) ) {
|
||||
echo "<ul>";
|
||||
foreach( (array) $blogs as $details ) {
|
||||
if( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) {
|
||||
$siteurl = $wpdb->get_var("SELECT option_value from {$wpdb->base_prefix}{$details['blog_id']}_options WHERE option_name = 'siteurl'");
|
||||
echo "<li>$siteurl</li>";
|
||||
$response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=1", array( 'timeout' => 120, 'httpversion' => '1.1' ) );
|
||||
if( is_wp_error( $response ) ) {
|
||||
wp_die( "<strong>Warning!</strong> Problem upgrading {$siteurl}. Your server may not be able to connect to blogs running on it.<br /> Error message: <em>" . $response->get_error_message() ."</em>" );
|
||||
}
|
||||
do_action( 'after_mu_upgrade', $response );
|
||||
do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
|
||||
}
|
||||
}
|
||||
echo "</ul>";
|
||||
?><p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a class="button" href="wpmu-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>"><?php _e("Next Blogs"); ?></a></p>
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
function nextpage() {
|
||||
location.href = "wpmu-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>";
|
||||
}
|
||||
setTimeout( "nextpage()", 250 );
|
||||
//-->
|
||||
</script><?php
|
||||
} else {
|
||||
echo '<p>'.__('All Done!').'</p>';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
?><p><?php _e("You can upgrade all the blogs on your site through this page. It works by calling the upgrade script of each blog automatically. Hit the link below to upgrade."); ?></p>
|
||||
<p><a class="button" href="wpmu-upgrade-site.php?action=upgrade"><?php _e("Upgrade Site"); ?></a></p><?php
|
||||
do_action( 'wpmu_upgrade_page' );
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
Executable
+301
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('WordPress MU › Admin › Users');
|
||||
$parent_file = 'wpmu-admin.php';
|
||||
|
||||
wp_enqueue_script( 'admin-forms' );
|
||||
|
||||
require_once('admin-header.php');
|
||||
|
||||
if( is_site_admin() == false ) {
|
||||
wp_die( __('You do not have permission to access this page.') );
|
||||
}
|
||||
|
||||
if ( $_GET['updated'] == 'true' ) {
|
||||
?>
|
||||
<div id="message" class="updated fade"><p>
|
||||
<?php
|
||||
switch ($_GET['action']) {
|
||||
case 'delete':
|
||||
_e('User deleted !');
|
||||
break;
|
||||
case 'all_spam':
|
||||
_e('Users marked as spam !');
|
||||
break;
|
||||
case 'all_notspam':
|
||||
_e('Users marked as not spam !');
|
||||
break;
|
||||
case 'all_delete':
|
||||
_e('Users deleted !');
|
||||
break;
|
||||
case 'add':
|
||||
_e('User added !');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</p></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wrap" style="position:relative;">
|
||||
<?php
|
||||
$apage = isset( $_GET['apage'] ) ? intval( $_GET['apage'] ) : 1;
|
||||
$num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : 15;
|
||||
$s = wp_specialchars( trim( $_GET[ 's' ] ) );
|
||||
|
||||
$query = "SELECT * FROM {$wpdb->users}";
|
||||
|
||||
if( !empty( $s ) ) {
|
||||
$search = '%' . trim( $s ) . '%';
|
||||
$query .= " WHERE user_login LIKE '$search' OR user_email LIKE '$search'";
|
||||
}
|
||||
|
||||
if( !isset($_GET['sortby']) ) {
|
||||
$_GET['sortby'] = 'id';
|
||||
}
|
||||
|
||||
if( $_GET['sortby'] == 'email' ) {
|
||||
$query .= ' ORDER BY user_email ';
|
||||
} elseif( $_GET['sortby'] == 'id' ) {
|
||||
$query .= ' ORDER BY ID ';
|
||||
} elseif( $_GET['sortby'] == 'login' ) {
|
||||
$query .= ' ORDER BY user_login ';
|
||||
} elseif( $_GET['sortby'] == 'name' ) {
|
||||
$query .= ' ORDER BY display_name ';
|
||||
} elseif( $_GET['sortby'] == 'registered' ) {
|
||||
$query .= ' ORDER BY user_registered ';
|
||||
}
|
||||
|
||||
$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
|
||||
|
||||
if( !empty( $s )) {
|
||||
$total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(ID)', $query) );
|
||||
} else {
|
||||
$total = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users}");
|
||||
}
|
||||
|
||||
$query .= " LIMIT " . intval( ( $apage - 1 ) * $num) . ", " . intval( $num );
|
||||
|
||||
$user_list = $wpdb->get_results( $query, ARRAY_A );
|
||||
|
||||
// Pagination
|
||||
$user_navigation = paginate_links( array(
|
||||
'total' => ceil($total / $num),
|
||||
'current' => $apage,
|
||||
'base' => add_query_arg( 'apage', '%#%' ),
|
||||
'format' => ''
|
||||
));
|
||||
|
||||
if ( $user_navigation ) {
|
||||
$user_navigation = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
|
||||
number_format_i18n( ( $apage - 1 ) * $num + 1 ),
|
||||
number_format_i18n( min( $apage * $num, $total ) ),
|
||||
number_format_i18n( $total ),
|
||||
$user_navigation
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php _e( $current_site->site_name ); ?> <?php _e("Users"); ?></h2>
|
||||
<form action="wpmu-users.php" method="get" class="search-form">
|
||||
<p class="search-box">
|
||||
<input type="text" name="s" value="<?php if (isset($_GET['s'])) _e( stripslashes( $s ) ); ?>" class="search-input" id="user-search-input" />
|
||||
<input type="submit" id="post-query-submit" value="<?php _e('Search Users') ?>" class="button" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form id="form-user-list" action='wpmu-edit.php?action=allusers' method='post'>
|
||||
<div class="tablenav">
|
||||
<?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?>
|
||||
|
||||
<div class="alignleft actions">
|
||||
<input type="submit" value="<?php _e('Delete') ?>" name="alluser_delete" class="button-secondary delete" />
|
||||
<input type="submit" value="<?php _e('Mark as Spammers') ?>" name="alluser_spam" class="button-secondary" />
|
||||
<input type="submit" value="<?php _e('Not Spam') ?>" name="alluser_notspam" class="button-secondary" />
|
||||
<?php wp_nonce_field( 'allusers' ); ?>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if( isset($_GET['s']) && $_GET['s'] != '' ) : ?>
|
||||
<p><a href="wpmu-blogs.php?action=blogs&s=<?php echo urlencode( stripslashes( $s ) ); ?>&blog_name=Search+blogs+by+name"><?php _e('Search Blogs for') ?> <strong><?php echo stripslashes( $s ) ?></strong></a></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||
$posts_columns = array(
|
||||
'checkbox' => '',
|
||||
'login' => __('Username'),
|
||||
'name' => __('Name'),
|
||||
'email' => __('E-mail'),
|
||||
'registered' => __('Registered'),
|
||||
'blogs' => ''
|
||||
);
|
||||
$posts_columns = apply_filters('wpmu_users_columns', $posts_columns);
|
||||
?>
|
||||
<table class="widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach( (array) $posts_columns as $column_id => $column_display_name) {
|
||||
if( $column_id == 'blogs' ) {
|
||||
echo '<th scope="col">'.__('Blogs').'</th>';
|
||||
} elseif( $column_id == 'checkbox') {
|
||||
echo '<th scope="col" class="check-column"><input type="checkbox" /></th>';
|
||||
} else { ?>
|
||||
<th scope="col"><a href="wpmu-users.php?sortby=<?php echo $column_id ?>&<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&" ; } else { echo "order=DESC&"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a></th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="users" class="list:user user-list">
|
||||
<?php if ($user_list) {
|
||||
$bgcolor = '';
|
||||
foreach ( (array) $user_list as $user) {
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
|
||||
$status_list = array( "spam" => "#faa", "deleted" => "#f55" );
|
||||
|
||||
$bgcolour = "";
|
||||
foreach ( $status_list as $status => $col ) {
|
||||
if( $user[$status] ) {
|
||||
$bgcolour = "style='background: $col'";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr <?php echo $bgcolour; ?> class="<?php echo $class; ?>">
|
||||
<?php
|
||||
foreach( (array) $posts_columns as $column_name=>$column_display_name) :
|
||||
switch($column_name) {
|
||||
case 'checkbox': ?>
|
||||
<th scope="row" class="check-column"><input type='checkbox' id='user_<?php echo $user['ID'] ?>' name='allusers[]' value='<?php echo $user['ID'] ?>' /></th>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'login':
|
||||
$avatar = get_avatar( $user['user_email'], 32 );
|
||||
$edit = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=".$user['ID'] ) );
|
||||
// @todo Make delete link work like delete button with transfering users (in wpmu-edit.php)
|
||||
//$delete = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), wp_nonce_url( 'wpmu-edit.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user['ID'] ) );
|
||||
?>
|
||||
<td class="username column-username">
|
||||
<?php echo $avatar; ?><strong><a href="<?php echo $edit; ?>" class="edit"><?php echo stripslashes($user['user_login']); ?></a></strong>
|
||||
<br/>
|
||||
<div class="row-actions">
|
||||
<span class="edit"><a href="<?php echo $edit; ?>">Edit</a></span>
|
||||
<?php /*<span class="delete"><a href="<?php echo $delete; ?>" class="delete">Delete</a></span> */ ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'name': ?>
|
||||
<td class="name column-name"><?php echo $user['display_name'] ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'email': ?>
|
||||
<td class="email column-email"><a href="mailto:<?php echo $user['user_email'] ?>"><?php echo $user['user_email'] ?></a></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'registered': ?>
|
||||
<td><?php echo mysql2date(__('Y-m-d \<\b\r \/\> g:i a'), $user['user_registered']); ?></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'blogs':
|
||||
$blogs = get_blogs_of_user( $user['ID'], true );
|
||||
?>
|
||||
<td>
|
||||
<?php
|
||||
if( is_array( $blogs ) ) {
|
||||
foreach ( (array) $blogs as $key => $val ) {
|
||||
$path = ($val->path == '/') ? '' : $val->path;
|
||||
echo '<a href="wpmu-blogs.php?action=editblog&id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
|
||||
echo ' <small class="row-actions">';
|
||||
|
||||
// Edit
|
||||
echo '<a href="wpmu-blogs.php?action=editblog&id=' . $val->userblog_id . '">' . __('Edit') . '</a> | ';
|
||||
|
||||
// View
|
||||
echo '<a ';
|
||||
if( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
|
||||
echo 'style="background-color: #f66" ';
|
||||
echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . '</a>';
|
||||
|
||||
echo '</small><br />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
default: ?>
|
||||
<td><?php do_action('manage_users_custom_column', $column_name, $user['ID']); ?></td>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
endforeach
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
||||
<td colspan="<?php echo (int) count($posts_columns); ?>"><?php _e('No users found.') ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if ($users)
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="tablenav">
|
||||
<?php if ( $user_navigation ) echo "<div class='tablenav-pages'>$user_navigation</div>"; ?>
|
||||
|
||||
<div class="alignleft">
|
||||
<input type="submit" value="<?php _e('Delete') ?>" name="alluser_delete" class="button-secondary delete" />
|
||||
<input type="submit" value="<?php _e('Mark as Spammers') ?>" name="alluser_spam" class="button-secondary" />
|
||||
<input type="submit" value="<?php _e('Not Spam') ?>" name="alluser_notspam" class="button-secondary" />
|
||||
<?php wp_nonce_field( 'allusers' ); ?>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if( apply_filters('show_adduser_fields', true) ) :
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Add user') ?></h2>
|
||||
<form action="wpmu-edit.php?action=adduser" method="post">
|
||||
<table class="form-table">
|
||||
<tr class="form-field form-required">
|
||||
<th scope='row'><?php _e('Username') ?></th>
|
||||
<td><input type="text" name="user[username]" /></td>
|
||||
</tr>
|
||||
<tr class="form-field form-required">
|
||||
<th scope='row'><?php _e('Email') ?></th>
|
||||
<td><input type="text" name="user[email]" /></td>
|
||||
</tr>
|
||||
<tr class="form-field">
|
||||
<td colspan='2'><?php _e('Username and password will be mailed to the above email address.') ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<?php wp_nonce_field('add-user') ?>
|
||||
<input class="button" type="submit" name="Add user" value="<?php _e('Add user') ?>" /></p>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
Reference in New Issue
Block a user