diff options
Diffstat (limited to 'wp-includes')
| -rw-r--r-- | wp-includes/functions.php | 7 | ||||
| -rw-r--r-- | wp-includes/wpmu-functions.php | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php index a067a8a..ac36fd4 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1021,6 +1021,13 @@ function wp_upload_bits($name, $type, $bits) { if ( $upload['error'] !== false ) return $upload; + /* WPMU check file before writing it */ + $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) ); + if( is_array( $upload_bits_error ) == false ) { + $upload[ 'error' ] = $upload_bits_error; + return $upload; + } + $number = ''; $filename = $name; $path_parts = pathinfo($filename); 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" ); ?> |
