@@ -495,15 +495,7 @@ function extract_from_markers($filename, $marker) {
495495
496496function save_mod_rewrite_rules () {
497497 global $ is_apache , $ wp_rewrite ;
498- $ home = get_settings ('home ' );
499- if ( $ home != '' && $ home != get_settings ('siteurl ' ) ) {
500- $ home_path = parse_url ($ home );
501- $ home_path = $ home_root ['path ' ];
502- $ root = str_replace ($ _SERVER ["PHP_SELF " ], '' , $ _SERVER ["PATH_TRANSLATED " ]);
503- $ home_path = $ root . $ home_path . "/ " ;
504- } else {
505- $ home_path = ABSPATH ;
506- }
498+ $ home_path = get_home_path ();
507499
508500 if ( (!file_exists ($ home_path .'.htaccess ' ) && is_writable ($ home_path )) || is_writable ($ home_path .'.htaccess ' ) )
509501 $ writable = true ;
@@ -787,17 +779,24 @@ function validate_file_to_edit($file, $allowed_files = '') {
787779 return $ file ;
788780}
789781
790- function get_real_file_to_edit ( $ file ) {
782+ function get_home_path ( ) {
791783 $ home = get_settings ('home ' );
792- if (($ home != '' )
793- && ($ home != get_settings ('siteurl ' )) &&
794- ('index.php ' == $ file || get_settings ('blogfilename ' ) == $ file ||
795- '.htaccess ' == $ file )) {
796- $ home_root = parse_url ($ home );
797- $ home_root = $ home_root ['path ' ];
798- $ root = str_replace ($ _SERVER ["PHP_SELF " ], '' , $ _SERVER ["PATH_TRANSLATED " ]);
799- $ home_root = $ root . $ home_root ;
800- $ real_file = $ home_root . '/ ' . $ file ;
784+ if ( $ home != '' && $ home != get_settings ('siteurl ' ) ) {
785+ $ home_path = parse_url ($ home );
786+ $ home_path = $ home_root ['path ' ];
787+ $ root = str_replace ($ _SERVER ["PHP_SELF " ], '' , $ _SERVER ["SCRIPT_FILENAME " ]);
788+ $ home_path = $ root . $ home_path . "/ " ;
789+ } else {
790+ $ home_path = ABSPATH ;
791+ }
792+
793+ return $ home_path ;
794+ }
795+
796+ function get_real_file_to_edit ($ file ) {
797+ if ('index.php ' == $ file || get_settings ('blogfilename ' ) == $ file ||
798+ '.htaccess ' == $ file ) {
799+ $ real_file = get_home_path () . $ file ;
801800 } else {
802801 $ real_file = ABSPATH . $ file ;
803802 }
0 commit comments