rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -0,0 +1,13 @@
<?php
/**
* Network Contribute administration panel.
*
* @package WordPress
* @subpackage Multisite
* @since 6.3.0
*/
/** Load WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
require ABSPATH . 'wp-admin/contribute.php';

View File

@@ -138,7 +138,8 @@ if ( $_POST ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
if ( isset( $_GET['updated'] ) ) {
?><div id="message" class="notice notice-success is-dismissible"><p><?php _e( 'Settings saved.' ); ?></p></div>
?>
<div id="message" class="notice notice-success is-dismissible"><p><?php _e( 'Settings saved.' ); ?></p></div>
<?php
}
?>

View File

@@ -83,6 +83,10 @@ if ( isset( $_REQUEST['action'] ) && 'add-site' === $_REQUEST['action'] ) {
}
}
if ( empty( $title ) ) {
wp_die( __( 'Missing site title.' ) );
}
if ( empty( $domain ) ) {
wp_die( __( 'Missing or invalid site address.' ) );
}

View File

@@ -143,7 +143,7 @@ if ( ! empty( $messages ) ) {
}
}
if ( strpos( $option->option_value, "\n" ) !== false ) {
if ( str_contains( $option->option_value, "\n" ) ) {
?>
<tr class="form-field">
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ); ?>" class="code"><?php echo esc_html( $option->option_name ); ?></label></th>

View File

@@ -173,7 +173,8 @@ $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );
$parent_file = 'sites.php';
$submenu_file = 'sites.php';
require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<h1 id="edit-site"><?php echo $title; ?></h1>

View File

@@ -213,7 +213,8 @@ if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users
wp_enqueue_script( 'user-suggest' );
}
require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<script type="text/javascript">
var current_site_id = <?php echo absint( $id ); ?>;

View File

@@ -102,7 +102,7 @@ if ( isset( $_GET['action'] ) ) {
header( 'Content-Type: text/html; charset=utf-8' );
}
if ( get_network()->site_id == $id ) {
if ( is_main_site( $id ) ) {
wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
}
@@ -142,7 +142,7 @@ if ( isset( $_GET['action'] ) ) {
}
$updated_action = 'not_deleted';
if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) {
if ( 0 !== $id && ! is_main_site( $id ) && current_user_can( 'delete_site', $id ) ) {
wpmu_delete_blog( $id, true );
$updated_action = 'delete';
}
@@ -154,7 +154,7 @@ if ( isset( $_GET['action'] ) ) {
foreach ( (array) $_POST['site_ids'] as $site_id ) {
$site_id = (int) $site_id;
if ( get_network()->site_id == $site_id ) {
if ( is_main_site( $site_id ) ) {
continue;
}
@@ -181,8 +181,10 @@ if ( isset( $_GET['action'] ) ) {
if ( isset( $_POST['action'] ) && isset( $_POST['allblogs'] ) ) {
$doaction = $_POST['action'];
foreach ( (array) $_POST['allblogs'] as $key => $val ) {
if ( '0' != $val && get_network()->site_id != $val ) {
foreach ( (array) $_POST['allblogs'] as $site_id ) {
$site_id = (int) $site_id;
if ( 0 !== $site_id && ! is_main_site( $site_id ) ) {
switch ( $doaction ) {
case 'delete':
require_once ABSPATH . 'wp-admin/admin-header.php';
@@ -197,12 +199,14 @@ if ( isset( $_GET['action'] ) ) {
<ul class="ul-disc">
<?php
foreach ( $_POST['allblogs'] as $site_id ) :
$site_id = (int) $site_id;
$site = get_site( $site_id );
$site_address = untrailingslashit( $site->domain . $site->path );
?>
<li>
<?php echo $site_address; ?>
<input type="hidden" name="site_ids[]" value="<?php echo (int) $site_id; ?>" />
<input type="hidden" name="site_ids[]" value="<?php echo esc_attr( $site_id ); ?>" />
</li>
<?php endforeach; ?>
</ul>
@@ -217,7 +221,7 @@ if ( isset( $_GET['action'] ) ) {
case 'spam':
case 'notspam':
$updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam';
update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' );
update_blog_status( $site_id, 'spam', ( 'spam' === $doaction ) ? '1' : '0' );
break;
}
} else {

View File

@@ -39,7 +39,7 @@ if ( $action ) {
case 'enable':
check_admin_referer( 'enable-theme_' . $_GET['theme'] );
WP_Theme::network_enable_theme( $_GET['theme'] );
if ( false === strpos( $referer, '/network/themes.php' ) ) {
if ( ! str_contains( $referer, '/network/themes.php' ) ) {
wp_redirect( network_admin_url( 'themes.php?enabled=1' ) );
} else {
wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );

View File

@@ -100,7 +100,8 @@ if ( isset( $_GET['update'] ) ) {
$title = __( 'Add New User' );
$parent_file = 'users.php';
require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<div class="wrap">
<h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1>

View File

@@ -94,7 +94,7 @@ if ( isset( $_GET['action'] ) ) {
$blogs = get_blogs_of_user( $user_id, true );
foreach ( (array) $blogs as $details ) {
if ( get_network()->site_id != $details->userblog_id ) { // Main blog is not a spam!
if ( ! is_main_site( $details->userblog_id ) ) { // Main site is not a spam!
update_blog_status( $details->userblog_id, 'spam', '1' );
}
}
@@ -253,7 +253,7 @@ get_current_screen()->set_screen_reader_content(
require_once ABSPATH . 'wp-admin/admin-header.php';
if ( isset( $_REQUEST['updated'] ) && 'true' == $_REQUEST['updated'] && ! empty( $_REQUEST['action'] ) ) {
if ( isset( $_REQUEST['updated'] ) && 'true' === $_REQUEST['updated'] && ! empty( $_REQUEST['action'] ) ) {
?>
<div id="message" class="notice notice-success is-dismissible"><p>
<?php