X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/449d082fcc4873c1f7d363a0d9f7409be7f6e77d..312084b5d95c21feb519ff03decf948420e1f6fa:/wp-admin/options-permalink.php diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 93f1619f..c4b71d55 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -9,6 +9,9 @@ /** WordPress Administration Bootstrap */ require_once('admin.php'); +if ( ! current_user_can('manage_options') ) + wp_die(__('You do not have sufficient permissions to manage options for this blog.')); + $title = __('Permalink Settings'); $parent_file = 'options-general.php'; @@ -70,6 +73,7 @@ add_filter('admin_head', 'add_js'); include('admin-header.php'); $home_path = get_home_path(); +$iis7_permalinks = iis7_supports_permalinks(); if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { check_admin_referer('update-permalink'); @@ -100,12 +104,19 @@ $permalink_structure = get_option('permalink_structure'); $category_base = get_option('category_base'); $tag_base = get_option( 'tag_base' ); -if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') ) - $writable = true; -else - $writable = false; +if ( $iis7_permalinks ) { + if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) + $writable = true; + else + $writable = false; +} else { + if ( ( ! file_exists($home_path . '.htaccess') && is_writable($home_path) ) || is_writable($home_path . '.htaccess') ) + $writable = true; + else + $writable = false; +} -if ($wp_rewrite->using_index_permalinks()) +if ( $wp_rewrite->using_index_permalinks() ) $usingpi = true; else $usingpi = false; @@ -115,16 +126,26 @@ $wp_rewrite->flush_rules();

+if ( $iis7_permalinks ) { + if ( $permalink_structure && ! $usingpi && ! $writable ) + _e('You should update your web.config now'); + else if ( $permalink_structure && ! $usingpi && $writable) + _e('Permalink structure updated. Remove write access on web.config file now!'); + else + _e('Permalink structure updated'); +} else { + if ( $permalink_structure && ! $usingpi && ! $writable ) + _e('You should update your .htaccess now.'); + else + _e('Permalink structure updated.'); +} +?> +

-

+

@@ -134,7 +155,7 @@ else /?p=123 - + - + - + /archives/123 @@ -173,13 +194,13 @@ $structures = array( - +

- +

URLs here. For example, using topics as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

URLs here. For example, using topics as your category base would make your category links like http://example.org/index.php/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

@@ -188,11 +209,11 @@ $structures = array( - + - +
@@ -200,15 +221,35 @@ $structures = array(

- +

- -

.htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.') ?>

+ +

web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file.') ?>

+
+ +

+
+

web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?>

+ +

writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Create a new file, called web.config in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config file.') ?>

+
+ +

+
+

web.config file automatically, do not forget to revert the permissions after the file has been created.') ?>

+ + + +

.htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.') ?>

-

+

+