Use SCRIPT_FILENAME instead of PATH_TRANSLATED since PATH_TRANSLATED is not always set. Consolidate home path logic into get_home_path().
git-svn-id: http://svn.automattic.com/wordpress/trunk@1995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f9b77bb837
commit
0b79658085
|
@ -495,15 +495,7 @@ function extract_from_markers($filename, $marker) {
|
||||||
|
|
||||||
function save_mod_rewrite_rules() {
|
function save_mod_rewrite_rules() {
|
||||||
global $is_apache, $wp_rewrite;
|
global $is_apache, $wp_rewrite;
|
||||||
$home = get_settings('home');
|
$home_path = get_home_path();
|
||||||
if ( $home != '' && $home != get_settings('siteurl') ) {
|
|
||||||
$home_path = parse_url($home);
|
|
||||||
$home_path = $home_root['path'];
|
|
||||||
$root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["PATH_TRANSLATED"]);
|
|
||||||
$home_path = $root . $home_path . "/";
|
|
||||||
} else {
|
|
||||||
$home_path = ABSPATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
|
if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
|
||||||
$writable = true;
|
$writable = true;
|
||||||
|
@ -787,17 +779,24 @@ function validate_file_to_edit($file, $allowed_files = '') {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_real_file_to_edit($file) {
|
function get_home_path() {
|
||||||
$home = get_settings('home');
|
$home = get_settings('home');
|
||||||
if (($home != '')
|
if ( $home != '' && $home != get_settings('siteurl') ) {
|
||||||
&& ($home != get_settings('siteurl')) &&
|
$home_path = parse_url($home);
|
||||||
('index.php' == $file || get_settings('blogfilename') == $file ||
|
$home_path = $home_root['path'];
|
||||||
'.htaccess' == $file)) {
|
$root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"]);
|
||||||
$home_root = parse_url($home);
|
$home_path = $root . $home_path . "/";
|
||||||
$home_root = $home_root['path'];
|
} else {
|
||||||
$root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["PATH_TRANSLATED"]);
|
$home_path = ABSPATH;
|
||||||
$home_root = $root . $home_root;
|
}
|
||||||
$real_file = $home_root . '/' . $file;
|
|
||||||
|
return $home_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_real_file_to_edit($file) {
|
||||||
|
if ('index.php' == $file || get_settings('blogfilename') == $file ||
|
||||||
|
'.htaccess' == $file) {
|
||||||
|
$real_file = get_home_path() . $file;
|
||||||
} else {
|
} else {
|
||||||
$real_file = ABSPATH . $file;
|
$real_file = ABSPATH . $file;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,7 @@ $parent_file = 'options-general.php';
|
||||||
|
|
||||||
include('admin-header.php');
|
include('admin-header.php');
|
||||||
|
|
||||||
$home = get_settings('home');
|
$home_path = get_home_path();
|
||||||
if ( $home != '' && $home != get_settings('siteurl') ) {
|
|
||||||
$home_path = parse_url($home);
|
|
||||||
$home_path = $home_root['path'];
|
|
||||||
$root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["PATH_TRANSLATED"]);
|
|
||||||
$home_path = $root . $home_path . "/";
|
|
||||||
} else {
|
|
||||||
$home_path = ABSPATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isset($_POST) ) {
|
if ( isset($_POST) ) {
|
||||||
if ( isset($_POST['permalink_structure']) ) {
|
if ( isset($_POST['permalink_structure']) ) {
|
||||||
|
|
Loading…
Reference in New Issue