Changes in trunk/wp-admin/includes/misc.php [15263:17328]
- File:
-
- 1 edited
-
trunk/wp-admin/includes/misc.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/misc.php
r15263 r17328 10 10 * {@internal Missing Short Description}} 11 11 * 12 * @since unknown12 * @since 2.0.0 13 13 * 14 14 * @return unknown … … 22 22 * {@internal Missing Short Description}} 23 23 * 24 * @since unknown24 * @since 1.5.0 25 25 * 26 26 * @param unknown_type $filename … … 58 58 * data. Creates file if none exists. 59 59 * 60 * @since unknown60 * @since 1.5.0 61 61 * 62 62 * @param unknown_type $filename … … 118 118 * blank out old rules. 119 119 * 120 * @since unknown120 * @since 1.5.0 121 121 */ 122 122 function save_mod_rewrite_rules() { … … 150 150 */ 151 151 function iis7_save_url_rewrite_rules(){ 152 if ( is_multisite() ) 153 return; 154 152 155 global $wp_rewrite; 153 156 … … 156 159 157 160 // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP 158 if ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) { 159 if ( iis7_supports_permalinks() ) { 160 $rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', ''); 161 if ( ! empty($rule) ) { 162 return iis7_add_rewrite_rule($web_config_file, $rule); 163 } else { 164 return iis7_delete_rewrite_rule($web_config_file); 165 } 161 if ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) { 162 $rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', ''); 163 if ( ! empty($rule) ) { 164 return iis7_add_rewrite_rule($web_config_file, $rule); 165 } else { 166 return iis7_delete_rewrite_rule($web_config_file); 166 167 } 167 168 } … … 172 173 * {@internal Missing Short Description}} 173 174 * 174 * @since unknown175 * @since 1.5.0 175 176 * 176 177 * @param unknown_type $file … … 194 195 * If siteurl or home changed, flush rewrite rules. 195 196 * 196 * @since unknown197 * @since 2.1.0 197 198 * 198 199 * @param unknown_type $old_value … … 213 214 214 215 /** 215 * {@internal Missing Short Description}}216 * 217 * @since unknown218 * 219 * @param unknown_type$url220 * @return unknown216 * Shorten an URL, to be used as link text 217 * 218 * @since 1.2.1 219 * 220 * @param string $url 221 * @return string 221 222 */ 222 223 function url_shorten( $url ) { … … 237 238 * if neither is defined. 238 239 * 239 * @since unknown240 * @since 2.0.0 240 241 * 241 242 * @param array $vars An array of globals to reset. … … 260 261 * {@internal Missing Short Description}} 261 262 * 262 * @since unknown263 * @since 2.1.0 263 264 * 264 265 * @param unknown_type $message … … 344 345 switch ( $map_option ) { 345 346 case 'edit_per_page': 346 case 'ms_sites_per_page': 347 case 'ms_users_per_page': 347 case 'users_per_page': 348 348 case 'edit_comments_per_page': 349 349 case 'upload_per_page': 350 350 case 'edit_tags_per_page': 351 351 case 'plugins_per_page': 352 // Network admin 353 case 'sites_network_per_page': 354 case 'users_network_per_page': 355 case 'site_users_network_per_page': 356 case 'plugins_network_per_page': 357 case 'themes_network_per_page': 358 case 'site_themes_network_per_page': 352 359 $value = (int) $value; 353 360 if ( $value < 1 || $value > 999 ) … … 373 380 exit; 374 381 } 375 }376 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 382 } 404 383 … … 562 541 * @since 2.8.0 563 542 * 564 * @param object$path543 * @param string $path 565 544 * @return bool 566 545 */ 567 function win_is_writable( $path) {546 function win_is_writable( $path ) { 568 547 /* will work in despite of Windows ACLs bug 569 548 * NOTE: use a trailing slash for folders!!! … … 572 551 */ 573 552 574 if ( $path{strlen($path)-1}== '/' ) // recursively return a temporary file path575 return win_is_writable($path . uniqid(mt_rand()) . '.tmp');576 else if ( is_dir($path) )577 return win_is_writable($path . '/' . uniqid(mt_rand()) . '.tmp');578 // check tmp file for read/write capabilities579 $rm = file_exists($path);580 $f = @fopen($path, 'a');581 if ($f===false)582 return false;583 fclose($f);584 if ( ! $rm)585 unlink($path);586 return true;553 if ( $path[strlen( $path ) - 1] == '/' ) // recursively return a temporary file path 554 return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp'); 555 else if ( is_dir( $path ) ) 556 return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' ); 557 // check tmp file for read/write capabilities 558 $should_delete_tmp_file = !file_exists( $path ); 559 $f = @fopen( $path, 'a' ); 560 if ( $f === false ) 561 return false; 562 fclose( $f ); 563 if ( $should_delete_tmp_file ) 564 unlink( $path ); 565 return true; 587 566 } 588 567
Note: See TracChangeset
for help on using the changeset viewer.