Changes in trunk/wp-admin/includes/misc.php [17328:15263]
- File:
-
- 1 edited
-
trunk/wp-admin/includes/misc.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/misc.php
r17328 r15263 10 10 * {@internal Missing Short Description}} 11 11 * 12 * @since 2.0.012 * @since unknown 13 13 * 14 14 * @return unknown … … 22 22 * {@internal Missing Short Description}} 23 23 * 24 * @since 1.5.024 * @since unknown 25 25 * 26 26 * @param unknown_type $filename … … 58 58 * data. Creates file if none exists. 59 59 * 60 * @since 1.5.060 * @since unknown 61 61 * 62 62 * @param unknown_type $filename … … 118 118 * blank out old rules. 119 119 * 120 * @since 1.5.0120 * @since unknown 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 155 152 global $wp_rewrite; 156 153 … … 159 156 160 157 // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP 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); 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 } 167 166 } 168 167 } … … 173 172 * {@internal Missing Short Description}} 174 173 * 175 * @since 1.5.0174 * @since unknown 176 175 * 177 176 * @param unknown_type $file … … 195 194 * If siteurl or home changed, flush rewrite rules. 196 195 * 197 * @since 2.1.0196 * @since unknown 198 197 * 199 198 * @param unknown_type $old_value … … 214 213 215 214 /** 216 * Shorten an URL, to be used as link text217 * 218 * @since 1.2.1219 * 220 * @param string$url221 * @return string215 * {@internal Missing Short Description}} 216 * 217 * @since unknown 218 * 219 * @param unknown_type $url 220 * @return unknown 222 221 */ 223 222 function url_shorten( $url ) { … … 238 237 * if neither is defined. 239 238 * 240 * @since 2.0.0239 * @since unknown 241 240 * 242 241 * @param array $vars An array of globals to reset. … … 261 260 * {@internal Missing Short Description}} 262 261 * 263 * @since 2.1.0262 * @since unknown 264 263 * 265 264 * @param unknown_type $message … … 345 344 switch ( $map_option ) { 346 345 case 'edit_per_page': 347 case 'users_per_page': 346 case 'ms_sites_per_page': 347 case 'ms_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 admin353 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':359 352 $value = (int) $value; 360 353 if ( $value < 1 || $value > 999 ) … … 380 373 exit; 381 374 } 375 } 376 377 /** 378 * Check if IIS 7 supports pretty permalinks 379 * 380 * @since 2.8.0 381 * 382 * @return bool 383 */ 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 it 393 * 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. When 395 * 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 runs 397 * 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); 382 403 } 383 404 … … 541 562 * @since 2.8.0 542 563 * 543 * @param string$path564 * @param object $path 544 565 * @return bool 545 566 */ 546 function win_is_writable( $path) {567 function win_is_writable($path) { 547 568 /* will work in despite of Windows ACLs bug 548 569 * NOTE: use a trailing slash for folders!!! … … 551 572 */ 552 573 553 if ( $path[strlen( $path ) - 1]== '/' ) // recursively return a temporary file path554 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 capabilities558 $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;574 if ( $path{strlen($path)-1} == '/' ) // recursively return a temporary file path 575 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 capabilities 579 $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; 566 587 } 567 588
Note: See TracChangeset
for help on using the changeset viewer.