better Apache mod detection from andy. fixes #6278
git-svn-id: http://svn.automattic.com/wordpress/trunk@7441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c5e0b789f6
commit
f3e25d6df3
|
@ -779,10 +779,9 @@ function media_upload_form( $errors = null ) {
|
||||||
$flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
|
$flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
|
||||||
|
|
||||||
// If Mac and mod_security, no Flash. :(
|
// If Mac and mod_security, no Flash. :(
|
||||||
if ( function_exists('apache_getenv') && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && 'on' == strtolower(apache_getenv('MODSEC_ENABLE')) )
|
|
||||||
$flash = false;
|
|
||||||
else
|
|
||||||
$flash = true;
|
$flash = true;
|
||||||
|
if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
|
||||||
|
$flash = false;
|
||||||
|
|
||||||
$post_id = intval($_REQUEST['post_id']);
|
$post_id = intval($_REQUEST['post_id']);
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function got_mod_rewrite() {
|
function got_mod_rewrite() {
|
||||||
global $is_apache;
|
return apache_mod_loaded('mod_rewrite');
|
||||||
|
|
||||||
// take 3 educated guesses as to whether or not mod_rewrite is available
|
|
||||||
if ( !$is_apache )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( function_exists( 'apache_get_modules' ) ) {
|
|
||||||
if ( !in_array( 'mod_rewrite', apache_get_modules() ) )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array of strings from a file (.htaccess ) from between BEGIN
|
// Returns an array of strings from a file (.htaccess ) from between BEGIN
|
||||||
|
|
|
@ -1717,4 +1717,31 @@ function is_lighttpd_before_150() {
|
||||||
$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
|
$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
|
||||||
return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
|
return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apache_mod_loaded() - Does the specified module exist in the apache config?
|
||||||
|
*
|
||||||
|
* @param string $mod e.g. mod_rewrite
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function apache_mod_loaded($mod) {
|
||||||
|
global $is_apache;
|
||||||
|
|
||||||
|
if ( !$is_apache )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( function_exists('apache_get_modules') ) {
|
||||||
|
$mods = apache_get_modules();
|
||||||
|
if ( in_array($mod, $mods) )
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
ob_start();
|
||||||
|
phpinfo(8);
|
||||||
|
$phpinfo = ob_get_clean();
|
||||||
|
if ( false !== strpos($phpinfo, $mod) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue