diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-01-24 18:51:01 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-01-24 18:51:01 +0000 |
commit | c91fd8d98e0fd5260282a2cfced97d743067076e (patch) | |
tree | 8381b5ce5fab956c40e694ce6c4a136aa3c4ea54 /wp-includes/wpmu-functions.php | |
parent | 7def74bb3f619759851d10c371fea6e04c95a670 (diff) | |
download | wordpress-mu-c91fd8d98e0fd5260282a2cfced97d743067076e.tar.gz wordpress-mu-c91fd8d98e0fd5260282a2cfced97d743067076e.tar.xz wordpress-mu-c91fd8d98e0fd5260282a2cfced97d743067076e.zip |
Added "wp_upload_bits" filter to check uploaded files before writing them
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1191 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wpmu-functions.php')
-rw-r--r-- | wp-includes/wpmu-functions.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php index 76c9d7a..8f0ddda 100644 --- a/wp-includes/wpmu-functions.php +++ b/wp-includes/wpmu-functions.php @@ -1869,4 +1869,17 @@ function redirect_this_site( $hosts ) { return array( $current_site->domain ); } add_filter( 'allowed_redirect_hosts', 'redirect_this_site' ); + +function upload_is_file_too_big( $upload ) { + if( is_array( $upload ) == false ) + return $upload; + if( defined( 'WP_IMPORTING' ) ) + return $upload; + if( strlen( $upload[ 'bits' ] ) > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) { + return __( "This file is too big. Files must be less than " . get_site_option( 'fileupload_maxk', 1500 ) . "Kb in size.<br />" ); + } + + return $upload; +} +add_filter( "wp_upload_bits", "upload_is_file_too_big" ); ?> |