General: Stop direct loading of files in /wp-admin that should only be included.

This changeset restricts direct access call in `/wp-admin` and its sub directories.

Follow-up to [11768].

Props deepakrohilla.
See #61314.



Built from https://develop.svn.wordpress.org/trunk@59678


git-svn-id: http://core.svn.wordpress.org/trunk@59021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2025-01-22 14:06:22 +00:00
parent a79b4ef4c9
commit 0619c6d95a
10 changed files with 46 additions and 1 deletions

View File

@ -9,6 +9,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
_deprecated_file( basename( __FILE__ ), '2.5.0', 'wp-admin/includes/admin.php' );
/** WordPress Administration API: Includes all Administration functions. */

View File

@ -6,6 +6,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
if ( ! defined( 'WP_ADMIN' ) ) {
require_once __DIR__ . '/admin.php';

View File

@ -9,6 +9,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
_deprecated_file( basename( __FILE__ ), '5.3.0', 'wp-admin/includes/class-custom-background.php' );
/** Custom_Background class */

View File

@ -9,6 +9,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
_deprecated_file( basename( __FILE__ ), '5.3.0', 'wp-admin/includes/class-custom-image-header.php' );
/** Custom_Image_Header class */

View File

@ -6,6 +6,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* The current page.
*

View File

@ -6,6 +6,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/**
* Constructs the admin menu.
*

View File

@ -7,6 +7,11 @@
* @since 3.1.0
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
/* translators: Network menu item. */
$menu[2] = array( __( 'Dashboard' ), 'manage_network', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );

View File

@ -8,6 +8,11 @@
* @subpackage Administration
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$action = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {

View File

@ -7,6 +7,11 @@
* @since 3.1.0
*/
// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
$menu[2] = array( __( 'Dashboard' ), 'exist', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
$menu[4] = array( '', 'exist', 'separator1', '', 'wp-menu-separator' );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-alpha-59677';
$wp_version = '6.8-alpha-59678';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.