mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Add mu only (inactive) files
git-svn-id: http://svn.automattic.com/wordpress/trunk@12603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2920185dfb
commit
d07d6c5717
88
wp-activate.php
Executable file
88
wp-activate.php
Executable file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
define( "WP_INSTALLING", true );
|
||||||
|
|
||||||
|
/** Sets up the WordPress Environment. */
|
||||||
|
require( dirname(__FILE__) . '/wp-load.php' );
|
||||||
|
|
||||||
|
require( 'wp-blog-header.php' );
|
||||||
|
require_once( ABSPATH . WPINC . '/registration.php');
|
||||||
|
|
||||||
|
if( is_object( $wp_object_cache ) )
|
||||||
|
$wp_object_cache->cache_enabled = false;
|
||||||
|
|
||||||
|
do_action("activate_header");
|
||||||
|
|
||||||
|
function wpmu_activate_stylesheet() {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
form { margin-top: 2em; }
|
||||||
|
#submit, #key { width: 90%; font-size: 24px; }
|
||||||
|
#language { margin-top: .5em; }
|
||||||
|
.error { background: #f66; }
|
||||||
|
span.h3 { padding:0 8px; font-size:1.3em; font-family:'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; font-weight:700; color:#333333; }
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
add_action( 'wp_head', 'wpmu_activate_stylesheet' );
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="content" class="widecolumn">
|
||||||
|
<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
|
||||||
|
|
||||||
|
<h2><?php _e('Activation Key Required') ?></h2>
|
||||||
|
<form name="activateform" id="activateform" method="post" action="<?php echo 'http://' . $current_site->domain . $current_site->path ?>wp-activate.php">
|
||||||
|
<p>
|
||||||
|
<label for="key"><?php _e('Activation Key:') ?></label>
|
||||||
|
<br /><input type="text" name="key" id="key" value="" size="50" />
|
||||||
|
</p>
|
||||||
|
<p class="submit">
|
||||||
|
<input id="submit" type="submit" name="Submit" class="submit" value="<?php _e('Activate »') ?>" />
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php } else {
|
||||||
|
|
||||||
|
$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
|
||||||
|
$result = wpmu_activate_signup($key);
|
||||||
|
if ( is_wp_error($result) ) {
|
||||||
|
if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
|
||||||
|
$signup = $result->get_error_data();
|
||||||
|
?>
|
||||||
|
<h2><?php _e('Your account is now active!'); ?></h2>
|
||||||
|
<?php
|
||||||
|
if( $signup->domain . $signup->path == '' ) {
|
||||||
|
printf(__('<p class="lead-in">Your account has been activated. You may now <a href="%1$s">login</a> to the site using your chosen username of "%2$s". Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.</p>'), 'http://' . $current_site->domain . $current_site->path . 'wp-login.php', $signup->user_login, $signup->user_email, 'http://' . $current_site->domain . $current_site->path . 'wp-login.php?action=lostpassword');
|
||||||
|
} else {
|
||||||
|
printf(__('<p class="lead-in">Your blog at <a href="%1$s">%2$s</a> is active. You may now login to your blog using your chosen username of "%3$s". Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.</p>'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, 'http://' . $current_site->domain . $current_site->path . 'wp-login.php?action=lostpassword');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<h2><?php _e('An error occurred during the activation'); ?></h2>
|
||||||
|
<?php
|
||||||
|
echo '<p>'.$result->get_error_message().'</p>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
extract($result);
|
||||||
|
$url = get_blogaddress_by_id( (int) $blog_id);
|
||||||
|
$user = new WP_User( (int) $user_id);
|
||||||
|
?>
|
||||||
|
<h2><?php _e('Your account is now active!'); ?></h2>
|
||||||
|
|
||||||
|
<div id="signup-welcome">
|
||||||
|
<p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
|
||||||
|
<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if( $url != 'http://' . $current_site->domain . $current_site->path ) : ?>
|
||||||
|
<p class="view"><?php printf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Login</a>'), $url, $url . 'wp-login.php' ); ?></p>
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="view"><?php printf( __( 'Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.' ), 'http://' . $current_site->domain . $current_site->path . 'wp-login.php', 'http://' . $current_site->domain . $current_site->path ); ?></p>
|
||||||
|
<?php endif;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
76
wp-admin/edit-form.php
Executable file
76
wp-admin/edit-form.php
Executable file
@ -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>
|
19
wp-admin/edit-page-drafts.php
Executable file
19
wp-admin/edit-page-drafts.php
Executable file
@ -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');
|
||||||
|
|
||||||
|
?>
|
19
wp-admin/edit-post-drafts.php
Executable file
19
wp-admin/edit-post-drafts.php
Executable file
@ -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');
|
||||||
|
|
||||||
|
?>
|
1303
wp-admin/includes/ms.php
Executable file
1303
wp-admin/includes/ms.php
Executable file
File diff suppressed because it is too large
Load Diff
144
wp-admin/link-import.php
Executable file
144
wp-admin/link-import.php
Executable file
@ -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');
|
||||||
|
|
||||||
|
?>
|
62
wp-admin/ms-admin.php
Executable file
62
wp-admin/ms-admin.php
Executable file
@ -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'); ?>
|
535
wp-admin/ms-edit.php
Executable file
535
wp-admin/ms-edit.php
Executable file
@ -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;
|
||||||
|
}
|
||||||
|
?>
|
294
wp-admin/ms-options.php
Executable file
294
wp-admin/ms-options.php
Executable file
@ -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'); ?>
|
613
wp-admin/ms-sites.php
Executable file
613
wp-admin/ms-sites.php
Executable file
@ -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'); ?>
|
62
wp-admin/ms-upgrade-site.php
Executable file
62
wp-admin/ms-upgrade-site.php
Executable file
@ -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'); ?>
|
301
wp-admin/ms-users.php
Executable file
301
wp-admin/ms-users.php
Executable file
@ -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'); ?>
|
129
wp-content/blogs.php
Executable file
129
wp-content/blogs.php
Executable file
@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
define( 'SHORTINIT', true ); // this prevents most of WP from being loaded
|
||||||
|
require_once( dirname( dirname( __FILE__) ) . '/wp-load.php' ); // absolute includes are faster
|
||||||
|
|
||||||
|
if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
|
||||||
|
status_header( 404 );
|
||||||
|
die('404 — File not found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !function_exists('wp_check_filetype') ) :
|
||||||
|
function wp_check_filetype($filename, $mimes = null) {
|
||||||
|
// Accepted MIME types are set here as PCRE unless provided.
|
||||||
|
$mimes = is_array($mimes) ? $mimes : array (
|
||||||
|
'jpg|jpeg|jpe' => 'image/jpeg',
|
||||||
|
'gif' => 'image/gif',
|
||||||
|
'png' => 'image/png',
|
||||||
|
'bmp' => 'image/bmp',
|
||||||
|
'tif|tiff' => 'image/tiff',
|
||||||
|
'ico' => 'image/x-icon',
|
||||||
|
'asf|asx|wax|wmv|wmx' => 'video/asf',
|
||||||
|
'avi' => 'video/avi',
|
||||||
|
'mov|qt' => 'video/quicktime',
|
||||||
|
'mpeg|mpg|mpe' => 'video/mpeg',
|
||||||
|
'txt|c|cc|h' => 'text/plain',
|
||||||
|
'rtx' => 'text/richtext',
|
||||||
|
'css' => 'text/css',
|
||||||
|
'htm|html' => 'text/html',
|
||||||
|
'mp3|mp4' => 'audio/mpeg',
|
||||||
|
'ra|ram' => 'audio/x-realaudio',
|
||||||
|
'wav' => 'audio/wav',
|
||||||
|
'ogg' => 'audio/ogg',
|
||||||
|
'mid|midi' => 'audio/midi',
|
||||||
|
'wma' => 'audio/wma',
|
||||||
|
'rtf' => 'application/rtf',
|
||||||
|
'js' => 'application/javascript',
|
||||||
|
'pdf' => 'application/pdf',
|
||||||
|
'doc' => 'application/msword',
|
||||||
|
'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
|
||||||
|
'wri' => 'application/vnd.ms-write',
|
||||||
|
'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
|
||||||
|
'mdb' => 'application/vnd.ms-access',
|
||||||
|
'mpp' => 'application/vnd.ms-project',
|
||||||
|
'swf' => 'application/x-shockwave-flash',
|
||||||
|
'class' => 'application/java',
|
||||||
|
'tar' => 'application/x-tar',
|
||||||
|
'zip' => 'application/zip',
|
||||||
|
'gz|gzip' => 'application/x-gzip',
|
||||||
|
'exe' => 'application/x-msdownload'
|
||||||
|
);
|
||||||
|
|
||||||
|
$type = false;
|
||||||
|
$ext = false;
|
||||||
|
|
||||||
|
foreach ( (array)$mimes as $ext_preg => $mime_match ) {
|
||||||
|
$ext_preg = '!\.(' . $ext_preg . ')$!i';
|
||||||
|
if ( preg_match($ext_preg, $filename, $ext_matches) ) {
|
||||||
|
$type = $mime_match;
|
||||||
|
$ext = $ext_matches[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return compact('ext', 'type');
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
|
||||||
|
|
||||||
|
$file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] );
|
||||||
|
if ( !is_file( $file ) ) {
|
||||||
|
status_header( 404 );
|
||||||
|
die('404 — File not found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$mime = wp_check_filetype( $_SERVER[ 'REQUEST_URI' ] );
|
||||||
|
if( $mime[ 'type' ] === false && function_exists( 'mime_content_type' ) )
|
||||||
|
$mime[ 'type' ] = mime_content_type( $file );
|
||||||
|
|
||||||
|
if( $mime[ 'type' ] != false ) {
|
||||||
|
$mimetype = $mime[ 'type' ];
|
||||||
|
} else {
|
||||||
|
$ext = substr( $_SERVER[ 'REQUEST_URI' ], strrpos( $_SERVER[ 'REQUEST_URI' ], '.' ) + 1 );
|
||||||
|
$mimetype = "image/$ext";
|
||||||
|
}
|
||||||
|
@header( 'Content-type: ' . $mimetype ); // always send this
|
||||||
|
if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
|
||||||
|
@header( 'Content-Length: ' . filesize( $file ) );
|
||||||
|
|
||||||
|
// Optional support for X-Sendfile and X-Accel-Redirect
|
||||||
|
if ( defined('WPMU_ACCEL_REDIRECT') && WPMU_ACCEL_REDIRECT ) {
|
||||||
|
@header( 'X-Accel-Redirect: ' . str_replace( WP_CONTENT_DIR, '', $file ) );
|
||||||
|
exit;
|
||||||
|
} elseif ( defined('WPMU_SENDFILE') && WPMU_SENDFILE ) {
|
||||||
|
@header( 'X-Sendfile: ' . $file );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_modified = gmdate('D, d M Y H:i:s', filemtime( $file ));
|
||||||
|
$etag = '"' . md5($last_modified) . '"';
|
||||||
|
@header( "Last-Modified: $last_modified GMT" );
|
||||||
|
@header( 'ETag: ' . $etag );
|
||||||
|
@header( 'Expires: ' . gmdate('D, d M Y H:i:s', time() + 100000000) . ' GMT' );
|
||||||
|
|
||||||
|
// Support for Conditional GET
|
||||||
|
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||||
|
$client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
|
||||||
|
else
|
||||||
|
$client_etag = false;
|
||||||
|
|
||||||
|
if( !isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
|
||||||
|
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = false;
|
||||||
|
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||||
|
// If string is empty, return 0. If not, attempt to parse into a timestamp
|
||||||
|
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
|
||||||
|
|
||||||
|
// Make a timestamp for our most recent modification...
|
||||||
|
$modified_timestamp = strtotime($last_modified);
|
||||||
|
|
||||||
|
if ( ($client_last_modified && $client_etag) ?
|
||||||
|
(($client_modified_timestamp >= $modified_timestamp) && ($client_etag == $etag)) :
|
||||||
|
(($client_modified_timestamp >= $modified_timestamp) || ($client_etag == $etag)) ) {
|
||||||
|
status_header( 304 );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we made it this far, just serve the file
|
||||||
|
|
||||||
|
readfile( $file );
|
||||||
|
|
||||||
|
?>
|
400
wp-includes/gettext.php
Executable file
400
wp-includes/gettext.php
Executable file
@ -0,0 +1,400 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP-Gettext External Library: gettext_reader class
|
||||||
|
*
|
||||||
|
* @package External
|
||||||
|
* @subpackage PHP-gettext
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
Copyright (c) 2003 Danilo Segan <danilo@kvota.net>.
|
||||||
|
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
|
||||||
|
|
||||||
|
This file is part of PHP-gettext.
|
||||||
|
|
||||||
|
PHP-gettext is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
PHP-gettext is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with PHP-gettext; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a simple gettext replacement that works independently from
|
||||||
|
* the system's gettext abilities.
|
||||||
|
* It can read MO files and use them for translating strings.
|
||||||
|
* The files are passed to gettext_reader as a Stream (see streams.php)
|
||||||
|
*
|
||||||
|
* This version has the ability to cache all strings and translations to
|
||||||
|
* speed up the string lookup.
|
||||||
|
* While the cache is enabled by default, it can be switched off with the
|
||||||
|
* second parameter in the constructor (e.g. whenusing very large MO files
|
||||||
|
* that you don't want to keep in memory)
|
||||||
|
*/
|
||||||
|
class gettext_reader {
|
||||||
|
//public:
|
||||||
|
var $error = 0; // public variable that holds error code (0 if no error)
|
||||||
|
|
||||||
|
//private:
|
||||||
|
var $BYTEORDER = 0; // 0: low endian, 1: big endian
|
||||||
|
var $STREAM = NULL;
|
||||||
|
var $short_circuit = false;
|
||||||
|
var $enable_cache = false;
|
||||||
|
var $originals = NULL; // offset of original table
|
||||||
|
var $translations = NULL; // offset of translation table
|
||||||
|
var $pluralheader = NULL; // cache header field for plural forms
|
||||||
|
var $select_string_function = NULL; // cache function, which chooses plural forms
|
||||||
|
var $total = 0; // total string count
|
||||||
|
var $table_originals = NULL; // table for original strings (offsets)
|
||||||
|
var $table_translations = NULL; // table for translated strings (offsets)
|
||||||
|
var $cache_translations = NULL; // original -> translation mapping
|
||||||
|
|
||||||
|
|
||||||
|
/* Methods */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a 32bit Integer from the Stream
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @return Integer from the Stream
|
||||||
|
*/
|
||||||
|
function readint() {
|
||||||
|
if ($this->BYTEORDER == 0) {
|
||||||
|
// low endian
|
||||||
|
$low_end = unpack('V', $this->STREAM->read(4));
|
||||||
|
return array_shift($low_end);
|
||||||
|
} else {
|
||||||
|
// big endian
|
||||||
|
$big_end = unpack('N', $this->STREAM->read(4));
|
||||||
|
return array_shift($big_end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads an array of Integers from the Stream
|
||||||
|
*
|
||||||
|
* @param int count How many elements should be read
|
||||||
|
* @return Array of Integers
|
||||||
|
*/
|
||||||
|
function readintarray($count) {
|
||||||
|
if ($this->BYTEORDER == 0) {
|
||||||
|
// low endian
|
||||||
|
return unpack('V'.$count, $this->STREAM->read(4 * $count));
|
||||||
|
} else {
|
||||||
|
// big endian
|
||||||
|
return unpack('N'.$count, $this->STREAM->read(4 * $count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param object Reader the StreamReader object
|
||||||
|
* @param boolean enable_cache Enable or disable caching of strings (default on)
|
||||||
|
*/
|
||||||
|
function gettext_reader($Reader, $enable_cache = true) {
|
||||||
|
// If there isn't a StreamReader, turn on short circuit mode.
|
||||||
|
if (! $Reader || isset($Reader->error) ) {
|
||||||
|
$this->short_circuit = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Caching can be turned off
|
||||||
|
$this->enable_cache = $enable_cache;
|
||||||
|
|
||||||
|
// $MAGIC1 = (int)0x950412de; //bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
|
||||||
|
$MAGIC1 = (int) - 1794895138;
|
||||||
|
// $MAGIC2 = (int)0xde120495; //bug
|
||||||
|
$MAGIC2 = (int) - 569244523;
|
||||||
|
// 64-bit fix
|
||||||
|
$MAGIC3 = (int) 2500072158;
|
||||||
|
|
||||||
|
$this->STREAM = $Reader;
|
||||||
|
$magic = $this->readint();
|
||||||
|
if ($magic == $MAGIC1 || $magic == $MAGIC3) { // to make sure it works for 64-bit platforms
|
||||||
|
$this->BYTEORDER = 0;
|
||||||
|
} elseif ($magic == ($MAGIC2 & 0xFFFFFFFF)) {
|
||||||
|
$this->BYTEORDER = 1;
|
||||||
|
} else {
|
||||||
|
$this->error = 1; // not MO file
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Do we care about revision? We should.
|
||||||
|
$revision = $this->readint();
|
||||||
|
|
||||||
|
$this->total = $this->readint();
|
||||||
|
$this->originals = $this->readint();
|
||||||
|
$this->translations = $this->readint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the translation tables from the MO file into the cache
|
||||||
|
* If caching is enabled, also loads all strings into a cache
|
||||||
|
* to speed up translation lookups
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
function load_tables() {
|
||||||
|
if (is_array($this->cache_translations) &&
|
||||||
|
is_array($this->table_originals) &&
|
||||||
|
is_array($this->table_translations))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* get original and translations tables */
|
||||||
|
$this->STREAM->seekto($this->originals);
|
||||||
|
$this->table_originals = $this->readintarray($this->total * 2);
|
||||||
|
$this->STREAM->seekto($this->translations);
|
||||||
|
$this->table_translations = $this->readintarray($this->total * 2);
|
||||||
|
|
||||||
|
if ($this->enable_cache) {
|
||||||
|
$this->cache_translations = array ();
|
||||||
|
/* read all strings in the cache */
|
||||||
|
for ($i = 0; $i < $this->total; $i++) {
|
||||||
|
$this->STREAM->seekto($this->table_originals[$i * 2 + 2]);
|
||||||
|
$original = $this->STREAM->read($this->table_originals[$i * 2 + 1]);
|
||||||
|
$this->STREAM->seekto($this->table_translations[$i * 2 + 2]);
|
||||||
|
$translation = $this->STREAM->read($this->table_translations[$i * 2 + 1]);
|
||||||
|
$this->cache_translations[$original] = $translation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string from the "originals" table
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param int num Offset number of original string
|
||||||
|
* @return string Requested string if found, otherwise ''
|
||||||
|
*/
|
||||||
|
function get_original_string($num) {
|
||||||
|
$length = $this->table_originals[$num * 2 + 1];
|
||||||
|
$offset = $this->table_originals[$num * 2 + 2];
|
||||||
|
if (! $length)
|
||||||
|
return '';
|
||||||
|
$this->STREAM->seekto($offset);
|
||||||
|
$data = $this->STREAM->read($length);
|
||||||
|
return (string)$data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string from the "translations" table
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param int num Offset number of original string
|
||||||
|
* @return string Requested string if found, otherwise ''
|
||||||
|
*/
|
||||||
|
function get_translation_string($num) {
|
||||||
|
$length = $this->table_translations[$num * 2 + 1];
|
||||||
|
$offset = $this->table_translations[$num * 2 + 2];
|
||||||
|
if (! $length)
|
||||||
|
return '';
|
||||||
|
$this->STREAM->seekto($offset);
|
||||||
|
$data = $this->STREAM->read($length);
|
||||||
|
return (string)$data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binary search for string
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param string string
|
||||||
|
* @param int start (internally used in recursive function)
|
||||||
|
* @param int end (internally used in recursive function)
|
||||||
|
* @return int string number (offset in originals table)
|
||||||
|
*/
|
||||||
|
function find_string($string, $start = -1, $end = -1) {
|
||||||
|
if (($start == -1) or ($end == -1)) {
|
||||||
|
// find_string is called with only one parameter, set start end end
|
||||||
|
$start = 0;
|
||||||
|
$end = $this->total;
|
||||||
|
}
|
||||||
|
if (abs($start - $end) <= 1) {
|
||||||
|
// We're done, now we either found the string, or it doesn't exist
|
||||||
|
$txt = $this->get_original_string($start);
|
||||||
|
if ($string == $txt)
|
||||||
|
return $start;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
} else if ($start > $end) {
|
||||||
|
// start > end -> turn around and start over
|
||||||
|
return $this->find_string($string, $end, $start);
|
||||||
|
} else {
|
||||||
|
// Divide table in two parts
|
||||||
|
$half = (int)(($start + $end) / 2);
|
||||||
|
$cmp = strcmp($string, $this->get_original_string($half));
|
||||||
|
if ($cmp == 0)
|
||||||
|
// string is exactly in the middle => return it
|
||||||
|
return $half;
|
||||||
|
else if ($cmp < 0)
|
||||||
|
// The string is in the upper half
|
||||||
|
return $this->find_string($string, $start, $half);
|
||||||
|
else
|
||||||
|
// The string is in the lower half
|
||||||
|
return $this->find_string($string, $half, $end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates a string
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string string to be translated
|
||||||
|
* @return string translated string (or original, if not found)
|
||||||
|
*/
|
||||||
|
function translate($string) {
|
||||||
|
if ($this->short_circuit)
|
||||||
|
return $string;
|
||||||
|
$this->load_tables();
|
||||||
|
|
||||||
|
if ($this->enable_cache) {
|
||||||
|
// Caching enabled, get translated string from cache
|
||||||
|
if (array_key_exists($string, $this->cache_translations))
|
||||||
|
return $this->cache_translations[$string];
|
||||||
|
else
|
||||||
|
return $string;
|
||||||
|
} else {
|
||||||
|
// Caching not enabled, try to find string
|
||||||
|
$num = $this->find_string($string);
|
||||||
|
if ($num == -1)
|
||||||
|
return $string;
|
||||||
|
else
|
||||||
|
return $this->get_translation_string($num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get possible plural forms from MO header
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @return string plural form header
|
||||||
|
*/
|
||||||
|
function get_plural_forms() {
|
||||||
|
// lets assume message number 0 is header
|
||||||
|
// this is true, right?
|
||||||
|
$this->load_tables();
|
||||||
|
|
||||||
|
// cache header field for plural forms
|
||||||
|
if (! is_string($this->pluralheader)) {
|
||||||
|
if ($this->enable_cache) {
|
||||||
|
$header = $this->cache_translations[""];
|
||||||
|
} else {
|
||||||
|
$header = $this->get_translation_string(0);
|
||||||
|
}
|
||||||
|
$header .= "\n"; //make sure our regex matches
|
||||||
|
if (eregi("plural-forms: ([^\n]*)\n", $header, $regs))
|
||||||
|
$expr = $regs[1];
|
||||||
|
else
|
||||||
|
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
|
||||||
|
|
||||||
|
// add parentheses
|
||||||
|
// important since PHP's ternary evaluates from left to right
|
||||||
|
$expr.= ';';
|
||||||
|
$res= '';
|
||||||
|
$p= 0;
|
||||||
|
for ($i= 0; $i < strlen($expr); $i++) {
|
||||||
|
$ch= $expr[$i];
|
||||||
|
switch ($ch) {
|
||||||
|
case '?':
|
||||||
|
$res.= ' ? (';
|
||||||
|
$p++;
|
||||||
|
break;
|
||||||
|
case ':':
|
||||||
|
$res.= ') : (';
|
||||||
|
break;
|
||||||
|
case ';':
|
||||||
|
$res.= str_repeat( ')', $p) . ';';
|
||||||
|
$p= 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$res.= $ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->pluralheader = $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->pluralheader;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects which plural form to take
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param n count
|
||||||
|
* @return int array index of the right plural form
|
||||||
|
*/
|
||||||
|
function select_string($n) {
|
||||||
|
if (is_null($this->select_string_function)) {
|
||||||
|
$string = $this->get_plural_forms();
|
||||||
|
if (preg_match("/nplurals\s*=\s*(\d+)\s*\;\s*plural\s*=\s*(.*?)\;+/", $string, $matches)) {
|
||||||
|
$nplurals = $matches[1];
|
||||||
|
$expression = $matches[2];
|
||||||
|
$expression = str_replace("n", '$n', $expression);
|
||||||
|
} else {
|
||||||
|
$nplurals = 2;
|
||||||
|
$expression = ' $n == 1 ? 0 : 1 ';
|
||||||
|
}
|
||||||
|
$func_body = "
|
||||||
|
\$plural = ($expression);
|
||||||
|
return (\$plural <= $nplurals)? \$plural : \$plural - 1;";
|
||||||
|
$this->select_string_function = create_function('$n', $func_body);
|
||||||
|
}
|
||||||
|
return call_user_func($this->select_string_function, $n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plural version of gettext
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string single
|
||||||
|
* @param string plural
|
||||||
|
* @param string number
|
||||||
|
* @return translated plural form
|
||||||
|
*/
|
||||||
|
function ngettext($single, $plural, $number) {
|
||||||
|
if ($this->short_circuit) {
|
||||||
|
if ($number != 1)
|
||||||
|
return $plural;
|
||||||
|
else
|
||||||
|
return $single;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find out the appropriate form
|
||||||
|
$select = $this->select_string($number);
|
||||||
|
|
||||||
|
// this should contains all strings separated by NULLs
|
||||||
|
$key = $single.chr(0).$plural;
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->enable_cache) {
|
||||||
|
if (! array_key_exists($key, $this->cache_translations)) {
|
||||||
|
return ($number != 1) ? $plural : $single;
|
||||||
|
} else {
|
||||||
|
$result = $this->cache_translations[$key];
|
||||||
|
$list = explode(chr(0), $result);
|
||||||
|
return $list[$select];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$num = $this->find_string($key);
|
||||||
|
if ($num == -1) {
|
||||||
|
return ($number != 1) ? $plural : $single;
|
||||||
|
} else {
|
||||||
|
$result = $this->get_translation_string($num);
|
||||||
|
$list = explode(chr(0), $result);
|
||||||
|
return $list[$select];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
46
wp-includes/ms-default-filters.php
Executable file
46
wp-includes/ms-default-filters.php
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
// Users
|
||||||
|
add_filter ( 'wpmu_validate_user_signup', 'signup_nonce_check' );
|
||||||
|
add_action ( 'init', 'maybe_add_existing_user_to_blog' );
|
||||||
|
add_filter ( 'xmlrpc_methods', 'attach_wpmu_xmlrpc' );
|
||||||
|
add_filter ( 'wp_authenticate_user', 'wordpressmu_authenticate_siteadmin', 10, 2 );
|
||||||
|
add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' );
|
||||||
|
add_action ( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
|
||||||
|
add_action ( 'sanitize_user', 'strtolower_usernames', 10, 3 );
|
||||||
|
|
||||||
|
// Blogs
|
||||||
|
add_filter ( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
|
||||||
|
add_action ( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
|
||||||
|
add_action ( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
|
||||||
|
|
||||||
|
// Register Nonce
|
||||||
|
add_action ( 'signup_hidden_fields', 'signup_nonce_fields' );
|
||||||
|
|
||||||
|
// Locale
|
||||||
|
add_filter ( 'locale', 'mu_locale' );
|
||||||
|
|
||||||
|
// Template
|
||||||
|
add_action ( 'template_redirect', 'maybe_redirect_404' );
|
||||||
|
add_filter ( 'allowed_redirect_hosts', 'redirect_this_site' );
|
||||||
|
|
||||||
|
// Administration
|
||||||
|
add_filter ( 'mce_buttons_2', 'remove_tinymce_media_button' );
|
||||||
|
add_filter ( 'term_id_filter', 'global_terms', 10, 2 );
|
||||||
|
add_action ( 'publish_post', 'update_posts_count' );
|
||||||
|
add_action ( 'delete_post', 'wpmu_update_blogs_date' );
|
||||||
|
add_action ( 'private_to_published', 'wpmu_update_blogs_date' );
|
||||||
|
add_action ( 'publish_phone', 'wpmu_update_blogs_date' );
|
||||||
|
add_action ( 'publish_post', 'wpmu_update_blogs_date' );
|
||||||
|
|
||||||
|
// Files
|
||||||
|
add_filter ( 'wp_upload_bits', 'upload_is_file_too_big' );
|
||||||
|
add_filter ( 'import_upload_size_limit', 'fix_import_form_size' );
|
||||||
|
add_filter ( 'upload_mimes', 'check_upload_mimes' );
|
||||||
|
add_filter ( 'upload_dir', 'fix_upload_details' );
|
||||||
|
|
||||||
|
// Mail
|
||||||
|
add_filter ( 'wp_mail_from', 'wordpressmu_wp_mail_from' );
|
||||||
|
|
||||||
|
|
||||||
|
add_action( "phpmailer_init", "fix_phpmailer_messageid" );
|
||||||
|
?>
|
2407
wp-includes/ms-functions.php
Executable file
2407
wp-includes/ms-functions.php
Executable file
File diff suppressed because it is too large
Load Diff
191
wp-includes/streams.php
Executable file
191
wp-includes/streams.php
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP-Gettext External Library: StreamReader classes
|
||||||
|
*
|
||||||
|
* @package External
|
||||||
|
* @subpackage PHP-gettext
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
Copyright (c) 2003, 2005 Danilo Segan <danilo@kvota.net>.
|
||||||
|
|
||||||
|
This file is part of PHP-gettext.
|
||||||
|
|
||||||
|
PHP-gettext is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
PHP-gettext is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with PHP-gettext; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Simple class to wrap file streams, string streams, etc.
|
||||||
|
// seek is essential, and it should be byte stream
|
||||||
|
class StreamReader {
|
||||||
|
// should return a string [FIXME: perhaps return array of bytes?]
|
||||||
|
function read($bytes) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// should return new position
|
||||||
|
function seekto($position) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns current position
|
||||||
|
function currentpos() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns length of entire stream (limit for seekto()s)
|
||||||
|
function length() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StringReader {
|
||||||
|
var $_pos;
|
||||||
|
var $_str;
|
||||||
|
|
||||||
|
function StringReader($str='') {
|
||||||
|
$this->_str = $str;
|
||||||
|
$this->_pos = 0;
|
||||||
|
// If string functions are overloaded, we need to use the mb versions
|
||||||
|
$this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
|
||||||
|
}
|
||||||
|
|
||||||
|
function _substr($string, $start, $length) {
|
||||||
|
if ($this->is_overloaded) {
|
||||||
|
return mb_substr($string,$start,$length,'ascii');
|
||||||
|
} else {
|
||||||
|
return substr($string,$start,$length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _strlen($string) {
|
||||||
|
if ($this->is_overloaded) {
|
||||||
|
return mb_strlen($string,'ascii');
|
||||||
|
} else {
|
||||||
|
return strlen($string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function read($bytes) {
|
||||||
|
$data = $this->_substr($this->_str, $this->_pos, $bytes);
|
||||||
|
$this->_pos += $bytes;
|
||||||
|
if ($this->_strlen($this->_str)<$this->_pos)
|
||||||
|
$this->_pos = $this->_strlen($this->_str);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function seekto($pos) {
|
||||||
|
$this->_pos = $pos;
|
||||||
|
if ($this->_strlen($this->_str)<$this->_pos)
|
||||||
|
$this->_pos = $this->_strlen($this->_str);
|
||||||
|
return $this->_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
function currentpos() {
|
||||||
|
return $this->_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
function length() {
|
||||||
|
return $this->_strlen($this->_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class FileReader {
|
||||||
|
var $_pos;
|
||||||
|
var $_fd;
|
||||||
|
var $_length;
|
||||||
|
|
||||||
|
function FileReader($filename) {
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
|
||||||
|
$this->_length=filesize($filename);
|
||||||
|
$this->_pos = 0;
|
||||||
|
$this->_fd = fopen($filename,'rb');
|
||||||
|
if (!$this->_fd) {
|
||||||
|
$this->error = 3; // Cannot read file, probably permissions
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->error = 2; // File doesn't exist
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function read($bytes) {
|
||||||
|
if ($bytes) {
|
||||||
|
fseek($this->_fd, $this->_pos);
|
||||||
|
|
||||||
|
// PHP 5.1.1 does not read more than 8192 bytes in one fread()
|
||||||
|
// the discussions at PHP Bugs suggest it's the intended behaviour
|
||||||
|
while ($bytes > 0) {
|
||||||
|
$chunk = fread($this->_fd, $bytes);
|
||||||
|
$data .= $chunk;
|
||||||
|
$bytes -= strlen($chunk);
|
||||||
|
}
|
||||||
|
$this->_pos = ftell($this->_fd);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
} else return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function seekto($pos) {
|
||||||
|
fseek($this->_fd, $pos);
|
||||||
|
$this->_pos = ftell($this->_fd);
|
||||||
|
return $this->_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
function currentpos() {
|
||||||
|
return $this->_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
function length() {
|
||||||
|
return $this->_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
fclose($this->_fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preloads entire file in memory first, then creates a StringReader
|
||||||
|
// over it (it assumes knowledge of StringReader internals)
|
||||||
|
class CachedFileReader extends StringReader {
|
||||||
|
function CachedFileReader($filename) {
|
||||||
|
parent::StringReader();
|
||||||
|
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
|
||||||
|
$length=filesize($filename);
|
||||||
|
$fd = fopen($filename,'rb');
|
||||||
|
|
||||||
|
if (!$fd) {
|
||||||
|
$this->error = 3; // Cannot read file, probably permissions
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->_str = fread($fd, $length);
|
||||||
|
fclose($fd);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->error = 2; // File doesn't exist
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
439
wp-signup.php
Executable file
439
wp-signup.php
Executable file
@ -0,0 +1,439 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/** Sets up the WordPress Environment. */
|
||||||
|
require( dirname(__FILE__) . '/wp-load.php' );
|
||||||
|
|
||||||
|
add_action( 'wp_head', 'signuppageheaders' ) ;
|
||||||
|
|
||||||
|
require( 'wp-blog-header.php' );
|
||||||
|
require_once( ABSPATH . WPINC . '/registration.php' );
|
||||||
|
|
||||||
|
if( is_array( get_site_option( 'illegal_names' )) && $_GET[ 'new' ] != '' && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
|
||||||
|
wp_redirect( "http://{$current_site->domain}{$current_site->path}" );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_signup_header() {
|
||||||
|
do_action("signup_header");
|
||||||
|
}
|
||||||
|
add_action( 'wp_head', 'do_signup_header' );
|
||||||
|
|
||||||
|
function signuppageheaders() {
|
||||||
|
echo "<meta name='robots' content='noindex,nofollow' />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path ) {
|
||||||
|
wp_redirect( "http://" . $current_site->domain . $current_site->path . "wp-signup.php" );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
function wpmu_signup_stylesheet() {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
.mu_register { width: 90%; margin:0 auto; }
|
||||||
|
.mu_register form { margin-top: 2em; }
|
||||||
|
.mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; }
|
||||||
|
.mu_register input[type="submit"],
|
||||||
|
.mu_register #blog_title,
|
||||||
|
.mu_register #user_email,
|
||||||
|
.mu_register #blogname,
|
||||||
|
.mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
|
||||||
|
.mu_register .prefix_address,
|
||||||
|
.mu_register .suffix_address {font-size: 18px;display:inline; }
|
||||||
|
.mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
|
||||||
|
.mu_register label.checkbox { display:inline; }
|
||||||
|
.mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'wp_head', 'wpmu_signup_stylesheet' );
|
||||||
|
get_header();
|
||||||
|
?>
|
||||||
|
<div id="content" class="widecolumn">
|
||||||
|
<div class="mu_register">
|
||||||
|
<?php
|
||||||
|
function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
|
||||||
|
global $current_site;
|
||||||
|
// Blog name
|
||||||
|
if( constant( "VHOST" ) == 'no' )
|
||||||
|
echo '<label for="blogname">' . __('Blog Name:') . '</label>';
|
||||||
|
else
|
||||||
|
echo '<label for="blogname">' . __('Blog Domain:') . '</label>';
|
||||||
|
|
||||||
|
if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
|
||||||
|
<p class="error"><?php echo $errmsg ?></p>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
if( constant( "VHOST" ) == 'no' ) {
|
||||||
|
echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /><br />';
|
||||||
|
} else {
|
||||||
|
echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /><span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';
|
||||||
|
}
|
||||||
|
if ( !is_user_logged_in() ) {
|
||||||
|
print '(<strong>' . __( 'Your address will be ' );
|
||||||
|
if( constant( "VHOST" ) == 'no' ) {
|
||||||
|
print $current_site->domain . $current_site->path . __( 'blogname' );
|
||||||
|
} else {
|
||||||
|
print __( 'domain.' ) . $current_site->domain . $current_site->path;
|
||||||
|
}
|
||||||
|
echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blog Title
|
||||||
|
?>
|
||||||
|
<label for="blog_title"><?php _e('Blog Title:') ?></label>
|
||||||
|
<?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
|
||||||
|
<p class="error"><?php echo $errmsg ?></p>
|
||||||
|
<?php }
|
||||||
|
echo '<input name="blog_title" type="text" id="blog_title" value="'.wp_specialchars($blog_title, 1).'" /></p>';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="privacy">
|
||||||
|
<p class="privacy-intro">
|
||||||
|
<label for="blog_public_on"><?php _e('Privacy:') ?></label>
|
||||||
|
<?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.'); ?>
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<label class="checkbox" for="blog_public_on">
|
||||||
|
<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
|
||||||
|
<strong><?php _e( 'Yes' ); ?></strong>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox" for="blog_public_off">
|
||||||
|
<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
|
||||||
|
<strong><?php _e( 'No' ); ?></strong>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
do_action('signup_blogform', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate_blog_form() {
|
||||||
|
$user = '';
|
||||||
|
if ( is_user_logged_in() )
|
||||||
|
$user = wp_get_current_user();
|
||||||
|
|
||||||
|
return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_user_form($user_name = '', $user_email = '', $errors = '') {
|
||||||
|
// User name
|
||||||
|
echo '<label for="user_name">' . __('Username:') . '</label>';
|
||||||
|
if ( $errmsg = $errors->get_error_message('user_name') ) {
|
||||||
|
echo '<p class="error">'.$errmsg.'</p>';
|
||||||
|
}
|
||||||
|
echo '<input name="user_name" type="text" id="user_name" value="'.$user_name.'" maxlength="50" /><br />';
|
||||||
|
_e('(Must be at least 4 characters, letters and numbers only.)');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<label for="user_email"><?php _e('Email Address:') ?></label>
|
||||||
|
<?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
|
||||||
|
<p class="error"><?php echo $errmsg ?></p>
|
||||||
|
<?php } ?>
|
||||||
|
<input name="user_email" type="text" id="user_email" value="<?php echo wp_specialchars($user_email, 1) ?>" maxlength="200" /><br /><?php _e('(We’ll send your password to this address, so <strong>triple-check it</strong>.)') ?>
|
||||||
|
<?php
|
||||||
|
if ( $errmsg = $errors->get_error_message('generic') ) {
|
||||||
|
echo '<p class="error">'.$errmsg.'</p>';
|
||||||
|
}
|
||||||
|
do_action( 'signup_extra_fields', $errors );
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate_user_form() {
|
||||||
|
return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function signup_another_blog($blogname = '', $blog_title = '', $errors = '') {
|
||||||
|
global $current_user, $current_site;
|
||||||
|
|
||||||
|
if ( ! is_wp_error($errors) ) {
|
||||||
|
$errors = new WP_Error();
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow definition of default variables
|
||||||
|
$filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
|
||||||
|
$blogname = $filtered_results['blogname'];
|
||||||
|
$blog_title = $filtered_results['blog_title'];
|
||||||
|
$errors = $filtered_results['errors'];
|
||||||
|
|
||||||
|
echo '<h2>' . sprintf( __('Get <em>another</em> %s blog in seconds'), $current_site->site_name ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $errors->get_error_code() ) {
|
||||||
|
echo "<p>" . __('There was a problem, please correct the form below and try again.') . "</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<p><?php printf(__("Welcome back, %s. By filling out the form below, you can <strong>add another blog to your account</strong>. There is no limit to the number of blogs you can have, so create to your heart's content, but blog responsibly."), $current_user->display_name) ?></p>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$blogs = get_blogs_of_user($current_user->ID);
|
||||||
|
if ( !empty($blogs) ) { ?>
|
||||||
|
<p>
|
||||||
|
<?php _e('Blogs you are already a member of:') ?>
|
||||||
|
<ul>
|
||||||
|
<?php foreach ( $blogs as $blog ) {
|
||||||
|
echo "<li><a href='http://" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>";
|
||||||
|
} ?>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<p><?php _e("If you’re not going to use a great blog domain, leave it for a new user. Now have at it!") ?></p>
|
||||||
|
<form id="setupform" method="post" action="wp-signup.php">
|
||||||
|
<input type="hidden" name="stage" value="gimmeanotherblog" />
|
||||||
|
<?php do_action( "signup_hidden_fields" ); ?>
|
||||||
|
<?php show_blog_form($blogname, $blog_title, $errors); ?>
|
||||||
|
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php _e('Create Blog »') ?>" /></p>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate_another_blog_signup() {
|
||||||
|
global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path;
|
||||||
|
$current_user = wp_get_current_user();
|
||||||
|
if( !is_user_logged_in() )
|
||||||
|
die();
|
||||||
|
|
||||||
|
$result = validate_blog_form();
|
||||||
|
extract($result);
|
||||||
|
|
||||||
|
if ( $errors->get_error_code() ) {
|
||||||
|
signup_another_blog($blogname, $blog_title, $errors);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$public = (int) $_POST['blog_public'];
|
||||||
|
$meta = apply_filters('signup_create_blog_meta', array ('lang_id' => 1, 'public' => $public)); // depreciated
|
||||||
|
$meta = apply_filters( "add_signup_meta", $meta );
|
||||||
|
|
||||||
|
wpmu_create_blog( $domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid );
|
||||||
|
confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = '') {
|
||||||
|
?>
|
||||||
|
<h2><?php printf(__('The blog %s is yours.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
|
||||||
|
<p>
|
||||||
|
<?php printf(__('<a href="http://%1$s">http://%2$s</a> is your new blog. <a href="%3$s">Login</a> as "%4$s" using your existing password.'), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name) ?>
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
do_action('signup_finished');
|
||||||
|
}
|
||||||
|
|
||||||
|
function signup_user($user_name = '', $user_email = '', $errors = '') {
|
||||||
|
global $current_site, $active_signup;
|
||||||
|
|
||||||
|
if ( !is_wp_error($errors) )
|
||||||
|
$errors = new WP_Error();
|
||||||
|
if( isset( $_POST[ 'signup_for' ] ) ) {
|
||||||
|
$signup[ wp_specialchars( $_POST[ 'signup_for' ] ) ] = 'checked="checked"';
|
||||||
|
} else {
|
||||||
|
$signup[ 'blog' ] = 'checked="checked"';
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow definition of default variables
|
||||||
|
$filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors ));
|
||||||
|
$user_name = $filtered_results['user_name'];
|
||||||
|
$user_email = $filtered_results['user_email'];
|
||||||
|
$errors = $filtered_results['errors'];
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h2><?php printf( __('Get your own %s account in seconds'), $current_site->site_name ) ?></h2>
|
||||||
|
<form id="setupform" method="post" action="wp-signup.php">
|
||||||
|
<input type="hidden" name="stage" value="validate-user-signup" />
|
||||||
|
<?php do_action( "signup_hidden_fields" ); ?>
|
||||||
|
<?php show_user_form($user_name, $user_email, $errors); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?php if( $active_signup == 'blog' ) { ?>
|
||||||
|
<input id="signupblog" type="hidden" name="signup_for" value="blog" />
|
||||||
|
<?php } elseif( $active_signup == 'user' ) { ?>
|
||||||
|
<input id="signupblog" type="hidden" name="signup_for" value="user" />
|
||||||
|
<?php } else { ?>
|
||||||
|
<input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup['blog'] ?> />
|
||||||
|
<label class="checkbox" for="signupblog"><?php _e('Gimme a blog!') ?></label>
|
||||||
|
<br />
|
||||||
|
<input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup['user'] ?> />
|
||||||
|
<label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
|
||||||
|
<?php } ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php _e('Next »') ?>" /></p>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate_user_signup() {
|
||||||
|
$result = validate_user_form();
|
||||||
|
extract($result);
|
||||||
|
|
||||||
|
if ( $errors->get_error_code() ) {
|
||||||
|
signup_user($user_name, $user_email, $errors);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'blog' == $_POST['signup_for'] ) {
|
||||||
|
signup_blog($user_name, $user_email);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wpmu_signup_user($user_name, $user_email, apply_filters( "add_signup_meta", array() ) );
|
||||||
|
|
||||||
|
confirm_user_signup($user_name, $user_email);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirm_user_signup($user_name, $user_email) {
|
||||||
|
?>
|
||||||
|
<h2><?php printf(__('%s is your new username'), $user_name) ?></h2>
|
||||||
|
<p><?php _e('But, before you can start using your new username, <strong>you must activate it</strong>.') ?></p>
|
||||||
|
<p><?php printf(__('Check your inbox at <strong>%1$s</strong> and click the link given.'), $user_email) ?></p>
|
||||||
|
<p><?php _e('If you do not activate your username within two days, you will have to sign up again.'); ?></p>
|
||||||
|
<?php
|
||||||
|
do_action('signup_finished');
|
||||||
|
}
|
||||||
|
|
||||||
|
function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
|
||||||
|
if ( !is_wp_error($errors) )
|
||||||
|
$errors = new WP_Error();
|
||||||
|
|
||||||
|
// allow definition of default variables
|
||||||
|
$filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
|
||||||
|
$user_name = $filtered_results['user_name'];
|
||||||
|
$user_email = $filtered_results['user_email'];
|
||||||
|
$blogname = $filtered_results['blogname'];
|
||||||
|
$blog_title = $filtered_results['blog_title'];
|
||||||
|
$errors = $filtered_results['errors'];
|
||||||
|
|
||||||
|
if ( empty($blogname) )
|
||||||
|
$blogname = $user_name;
|
||||||
|
?>
|
||||||
|
<form id="setupform" method="post" action="wp-signup.php">
|
||||||
|
<input type="hidden" name="stage" value="validate-blog-signup" />
|
||||||
|
<input type="hidden" name="user_name" value="<?php echo $user_name ?>" />
|
||||||
|
<input type="hidden" name="user_email" value="<?php echo $user_email ?>" />
|
||||||
|
<?php do_action( "signup_hidden_fields" ); ?>
|
||||||
|
<?php show_blog_form($blogname, $blog_title, $errors); ?>
|
||||||
|
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php _e('Signup »') ?>" /></p>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate_blog_signup() {
|
||||||
|
// Re-validate user info.
|
||||||
|
$result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
|
||||||
|
extract($result);
|
||||||
|
|
||||||
|
if ( $errors->get_error_code() ) {
|
||||||
|
signup_user($user_name, $user_email, $errors);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
|
||||||
|
extract($result);
|
||||||
|
|
||||||
|
if ( $errors->get_error_code() ) {
|
||||||
|
signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$public = (int) $_POST['blog_public'];
|
||||||
|
$meta = array ('lang_id' => 1, 'public' => $public);
|
||||||
|
$meta = apply_filters( "add_signup_meta", $meta );
|
||||||
|
|
||||||
|
wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
|
||||||
|
confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta) {
|
||||||
|
?>
|
||||||
|
<h2><?php printf(__('Congratulations! Your new blog, %s, is almost ready.'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
|
||||||
|
|
||||||
|
<p><?php _e('But, before you can start using your blog, <strong>you must activate it</strong>.') ?></p>
|
||||||
|
<p><?php printf(__('Check your inbox at <strong>%s</strong> and click the link given. It should arrive within 30 minutes.'), $user_email) ?></p>
|
||||||
|
<p><?php _e('If you do not activate your blog within two days, you will have to sign up again.'); ?></p>
|
||||||
|
<h2><?php _e('Still waiting for your email?'); ?></h2>
|
||||||
|
<p>
|
||||||
|
<?php _e("If you haven't received your email yet, there are a number of things you can do:") ?>
|
||||||
|
<ul id="noemail-tips">
|
||||||
|
<li><p><strong><?php _e('Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.') ?></strong></p></li>
|
||||||
|
<li><p><?php _e('Check the junk email or spam folder of your email client. Sometime emails wind up there by mistake.') ?></p></li>
|
||||||
|
<li><?php printf(__("Have you entered your email correctly? We think it's %s but if you've entered it incorrectly, you won't receive it."), $user_email) ?></li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
do_action('signup_finished');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main
|
||||||
|
$active_signup = get_site_option( 'registration' );
|
||||||
|
if( !$active_signup )
|
||||||
|
$active_signup = 'all';
|
||||||
|
|
||||||
|
$active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return "all", "none", "blog" or "user"
|
||||||
|
|
||||||
|
if( is_site_admin() )
|
||||||
|
echo '<div class="mu_alert">' . sprintf( __( "Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your <a href='wp-admin/wpmu-options.php'>Options page</a>." ), $active_signup ) . '</div>';
|
||||||
|
|
||||||
|
$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
|
||||||
|
|
||||||
|
$current_user = wp_get_current_user();
|
||||||
|
if( $active_signup == "none" ) {
|
||||||
|
_e( "Registration has been disabled." );
|
||||||
|
} elseif( $active_signup == 'blog' && !is_user_logged_in() ){
|
||||||
|
if( is_ssl() ) {
|
||||||
|
$proto = 'https://';
|
||||||
|
} else {
|
||||||
|
$proto = 'http://';
|
||||||
|
}
|
||||||
|
$login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . '/wp-signup.php' ));
|
||||||
|
echo sprintf( __( "You must first <a href=\"%s\">login</a>, and then you can create a new blog."), $login_url );
|
||||||
|
} else {
|
||||||
|
switch ($_POST['stage']) {
|
||||||
|
case 'validate-user-signup' :
|
||||||
|
if( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
|
||||||
|
validate_user_signup();
|
||||||
|
else
|
||||||
|
_e( "User registration has been disabled." );
|
||||||
|
break;
|
||||||
|
case 'validate-blog-signup':
|
||||||
|
if( $active_signup == 'all' || $active_signup == 'blog' )
|
||||||
|
validate_blog_signup();
|
||||||
|
else
|
||||||
|
_e( "Blog registration has been disabled." );
|
||||||
|
break;
|
||||||
|
case 'gimmeanotherblog':
|
||||||
|
validate_another_blog_signup();
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
$user_email = $_POST[ 'user_email' ];
|
||||||
|
do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
|
||||||
|
if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
|
||||||
|
signup_another_blog($newblogname);
|
||||||
|
} elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
|
||||||
|
signup_user( $newblogname, $user_email );
|
||||||
|
} elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) {
|
||||||
|
_e( "I'm sorry. We're not accepting new registrations at this time." );
|
||||||
|
} else {
|
||||||
|
_e( "You're logged in already. No need to register again!" );
|
||||||
|
}
|
||||||
|
if ($newblogname) {
|
||||||
|
if( constant( "VHOST" ) == 'no' )
|
||||||
|
$newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/';
|
||||||
|
else
|
||||||
|
$newblog = 'http://' . $newblogname . '.' . $current_site->domain . $current_site->path;
|
||||||
|
if ($active_signup == 'blog' || $active_signup == 'all')
|
||||||
|
printf(__("<p><em>The blog you were looking for, <strong>%s</strong> doesn't exist but you can create it now!</em></p>"), $newblog );
|
||||||
|
else
|
||||||
|
printf(__("<p><em>The blog you were looking for, <strong>%s</strong> doesn't exist.</em></p>"), $newblog );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
Loading…
Reference in New Issue
Block a user