Add unfiltered_upload cap, and allow for admins. Props Nazgul. fixes #4136
git-svn-id: https://develop.svn.wordpress.org/trunk@5303 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b0e84dde88
commit
215dca2430
|
@ -1948,7 +1948,7 @@ function wp_handle_upload( &$file, $overrides = false ) {
|
|||
return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
|
||||
|
||||
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
|
||||
if ( $test_type ) {
|
||||
if ( $test_type && !current_user_can( 'unfiltered_upload' ) ) {
|
||||
$wp_filetype = wp_check_filetype( $file['name'], $mimes );
|
||||
|
||||
extract( $wp_filetype );
|
||||
|
|
|
@ -185,6 +185,10 @@ function upgrade_all() {
|
|||
if ( $wp_current_db_version < 4351 )
|
||||
upgrade_old_slugs();
|
||||
|
||||
if ( $wp_current_db_version < 5200 ) {
|
||||
upgrade_230();
|
||||
}
|
||||
|
||||
$wp_rewrite->flush_rules();
|
||||
|
||||
update_option('db_version', $wp_db_version);
|
||||
|
@ -565,6 +569,14 @@ function upgrade_210() {
|
|||
}
|
||||
}
|
||||
|
||||
function upgrade_230() {
|
||||
global $wp_current_db_version;
|
||||
|
||||
if ( $wp_current_db_version < 5200 ) {
|
||||
populate_roles_230();
|
||||
}
|
||||
}
|
||||
|
||||
function upgrade_old_slugs() {
|
||||
// upgrade people who were using the Redirect Old Slugs plugin
|
||||
global $wpdb;
|
||||
|
|
|
@ -262,6 +262,7 @@ function populate_options() {
|
|||
function populate_roles() {
|
||||
populate_roles_160();
|
||||
populate_roles_210();
|
||||
populate_roles_230();
|
||||
}
|
||||
|
||||
function populate_roles_160() {
|
||||
|
@ -395,4 +396,12 @@ function populate_roles_210() {
|
|||
}
|
||||
}
|
||||
|
||||
function populate_roles_230() {
|
||||
$role = get_role( 'administrator' );
|
||||
|
||||
if ( !empty( $role ) ) {
|
||||
$role->add_cap( 'unfiltered_upload' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -3,6 +3,6 @@
|
|||
// This holds the version number in a separate file so we can bump it without cluttering the SVN
|
||||
|
||||
$wp_version = '2.3-alpha';
|
||||
$wp_db_version = 5183;
|
||||
$wp_db_version = 5200;
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue