Skip to content

Commit 8d72ad5

Browse files
committed
Don't rely on include_path to include files.
Always use dirname() or, once available, ABSPATH. props ketwaroo, hakre. fixes #17092. git-svn-id: https://develop.svn.wordpress.org/trunk@25616 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f7050da commit 8d72ad5

105 files changed

Lines changed: 225 additions & 225 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
define('WP_USE_THEMES', true);
1515

1616
/** Loads the WordPress Environment and Template */
17-
require('./wp-blog-header.php');
17+
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

src/wp-activate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/** Sets up the WordPress Environment. */
1212
require( dirname(__FILE__) . '/wp-load.php' );
1313

14-
require( './wp-blog-header.php' );
14+
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
1515

1616
if ( !is_multisite() ) {
1717
wp_redirect( site_url( '/wp-login.php?action=register' ) );
@@ -126,4 +126,4 @@ function wpmu_activate_stylesheet() {
126126
var key_input = document.getElementById('key');
127127
key_input && key_input.focus();
128128
</script>
129-
<?php get_footer(); ?>
129+
<?php get_footer(); ?>

src/wp-admin/about.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** WordPress Administration Bootstrap */
10-
require_once( './admin.php' );
10+
require_once( dirname( __FILE__ ) . '/admin.php' );
1111

1212
$title = __( 'About' );
1313

src/wp-admin/admin-header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
1010
if ( ! defined( 'WP_ADMIN' ) )
11-
require_once( './admin.php' );
11+
require_once( dirname( __FILE__ ) . '/admin.php' );
1212

1313
// In case admin-header.php is included in a function.
1414
global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,

src/wp-admin/admin-post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
if ( defined('ABSPATH') )
1515
require_once(ABSPATH . 'wp-load.php');
1616
else
17-
require_once('../wp-load.php');
17+
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
1818

1919
/** Allow for cross-domain requests (from the frontend). */
2020
send_origin_headers();

src/wp-admin/async-upload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if ( defined('ABSPATH') )
1212
require_once(ABSPATH . 'wp-load.php');
1313
else
14-
require_once('../wp-load.php');
14+
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
1515

1616
if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
1717
// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
@@ -24,7 +24,7 @@
2424
unset($current_user);
2525
}
2626

27-
require_once('./admin.php');
27+
require_once( ABSPATH . 'wp-admin/admin.php' );
2828

2929
if ( !current_user_can('upload_files') )
3030
wp_die(__('You do not have permission to upload files.'));

src/wp-admin/comment.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** Load WordPress Bootstrap */
10-
require_once('./admin.php');
10+
require_once( dirname( __FILE__ ) . '/admin.php' );
1111

1212
$parent_file = 'edit-comments.php';
1313
$submenu_file = 'edit-comments.php';
@@ -36,7 +36,7 @@
3636
*/
3737
function comment_footer_die( $msg ) {
3838
echo "<div class='wrap'><p>$msg</p></div>";
39-
include('./admin-footer.php');
39+
include( ABSPATH . 'wp-admin/admin-footer.php' );
4040
die;
4141
}
4242

@@ -60,7 +60,7 @@ function comment_footer_die( $msg ) {
6060
);
6161

6262
wp_enqueue_script('comment');
63-
require_once('./admin-header.php');
63+
require_once( ABSPATH . 'wp-admin/admin-header.php' );
6464

6565
$comment_id = absint( $_GET['c'] );
6666

@@ -75,7 +75,7 @@ function comment_footer_die( $msg ) {
7575

7676
$comment = get_comment_to_edit( $comment_id );
7777

78-
include('./edit-form-comment.php');
78+
include( ABSPATH . 'wp-admin/edit-form-comment.php' );
7979

8080
break;
8181

@@ -104,7 +104,7 @@ function comment_footer_die( $msg ) {
104104
die();
105105
}
106106

107-
require_once('./admin-header.php');
107+
require_once( ABSPATH . 'wp-admin/admin-header.php' );
108108

109109
$formaction = $action . 'comment';
110110
$nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
@@ -300,4 +300,4 @@ function comment_footer_die( $msg ) {
300300

301301
} // end switch
302302

303-
include('./admin-footer.php');
303+
include( ABSPATH . 'wp-admin/admin-footer.php' );

src/wp-admin/credits.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** WordPress Administration Bootstrap */
10-
require_once( './admin.php' );
10+
require_once( dirname( __FILE__ ) . '/admin.php' );
1111

1212
$title = __( 'Credits' );
1313

src/wp-admin/customize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
define( 'IFRAME_REQUEST', true );
1111

12-
require_once( './admin.php' );
12+
require_once( dirname( __FILE__ ) . '/admin.php' );
1313
if ( ! current_user_can( 'edit_theme_options' ) )
1414
wp_die( __( 'Cheatin&#8217; uh?' ) );
1515

src/wp-admin/edit-comments.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** WordPress Administration Bootstrap */
10-
require_once('./admin.php');
10+
require_once( dirname( __FILE__ ) . '/admin.php' );
1111
if ( !current_user_can('edit_posts') )
1212
wp_die(__('Cheatin&#8217; uh?'));
1313

@@ -136,7 +136,7 @@
136136
'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
137137
);
138138

139-
require_once('./admin-header.php');
139+
require_once( ABSPATH . 'wp-admin/admin-header.php' );
140140
?>
141141

142142
<div class="wrap">
@@ -252,4 +252,4 @@
252252
<?php
253253
wp_comment_reply('-1', true, 'detail');
254254
wp_comment_trashnotice();
255-
include('./admin-footer.php'); ?>
255+
include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>

0 commit comments

Comments
 (0)