Add unfiltered_upload cap, and allow for admins. Props Nazgul. fixes #4136

git-svn-id: http://svn.automattic.com/wordpress/trunk@5303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rob1n 2007-04-24 23:27:20 +00:00
parent 534eeaf7bc
commit ea9d389751
4 changed files with 23 additions and 2 deletions

View File

@ -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 );

View File

@ -184,6 +184,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();
@ -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;

View File

@ -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' );
}
}
?>

View File

@ -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;
?>