Ticket #10187: 10187-10435-merged.2.patch
File 10187-10435-merged.2.patch, 4.8 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/misc.php
375 375 } 376 376 377 377 /** 378 * Check if IIS 7 supports pretty permalinks379 *380 * @since 2.8.0381 *382 * @return bool383 */384 function iis7_supports_permalinks() {385 global $is_iis7;386 387 $supports_permalinks = false;388 if ( $is_iis7 ) {389 /* First we check if the DOMDocument class exists. If it does not exist,390 * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,391 * hence we just bail out and tell user that pretty permalinks cannot be used.392 * This is not a big issue because PHP 4.X is going to be depricated and for IIS it393 * is recommended to use PHP 5.X NTS.394 * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When395 * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.396 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs397 * via ISAPI then pretty permalinks will not work.398 */399 $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );400 }401 402 return apply_filters('iis7_supports_permalinks', $supports_permalinks);403 }404 405 /**406 378 * Check if rewrite rule for WordPress already exists in the IIS 7 configuration file 407 379 * 408 380 * @since 2.8.0 -
wp-includes/canonical.php
37 37 function redirect_canonical($requested_url=null, $do_redirect=true) { 38 38 global $wp_rewrite, $is_IIS, $wp_query, $wpdb; 39 39 40 if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS|| ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )40 if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || ( $is_IIS && !iis7_supports_permalinks() ) || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() ) 41 41 return; 42 42 43 43 if ( !$requested_url ) { -
wp-includes/pluggable.php
861 861 862 862 if ( !function_exists('wp_redirect') ) : 863 863 /** 864 * Redirects to another page , with a workaround for the IIS Set-Cookie bug.864 * Redirects to another page 865 865 * 866 * @link http://support.microsoft.com/kb/q176113/867 866 * @since 1.5.1 868 867 * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status. 869 868 * … … 872 871 * @return bool False if $location is not set 873 872 */ 874 873 function wp_redirect($location, $status = 302) { 875 global $is_IIS;876 877 874 $location = apply_filters('wp_redirect', $location, $status); 878 875 $status = apply_filters('wp_redirect_status', $status, $location); 879 876 … … 881 878 return false; 882 879 883 880 $location = wp_sanitize_redirect($location); 884 885 if ( $is_IIS ) { 886 header("Refresh: 0;url=$location"); 887 } else { 888 if ( php_sapi_name() != 'cgi-fcgi' ) 889 status_header($status); // This causes problems on IIS and some FastCGI setups 890 header("Location: $location", true, $status); 891 } 881 header("Location: $location", true, $status); 892 882 } 893 883 endif; 894 884 -
wp-includes/vars.php
82 82 */ 83 83 $is_iis7 = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false); 84 84 85 /** 86 * Check if IIS 7 supports pretty permalinks 87 * 88 * @since 2.8.0 89 * 90 * @return bool 91 */ 92 function iis7_supports_permalinks() { 93 global $is_iis7; 85 94 95 $supports_permalinks = false; 96 if ( $is_iis7 ) { 97 /* First we check if the DOMDocument class exists. If it does not exist, 98 * which is the case for PHP 4.X, then we cannot easily update the xml configuration file, 99 * hence we just bail out and tell user that pretty permalinks cannot be used. 100 * This is not a big issue because PHP 4.X is going to be depricated and for IIS it 101 * is recommended to use PHP 5.X NTS. 102 * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When 103 * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'. 104 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs 105 * via ISAPI then pretty permalinks will not work. 106 */ 107 $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' ); 108 } 109 110 return apply_filters('iis7_supports_permalinks', $supports_permalinks); 111 } 86 112 ?> 113 No newline at end of file