Ticket #27224: 27224.3.diff
File 27224.3.diff, 2.9 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/ms.php
31 31 if ( $space_left < $file_size ) 32 32 $file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ($file_size - $space_left) /1024 ) ); 33 33 if ( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) 34 $file['error'] = sprintf( __('This file is too big. Files must be less than %1$s KB in size.'), get_site_option( 'fileupload_maxk', 1500) );34 $file['error'] = sprintf( __( 'This file is too big. Files must be less than %1$s MB in size.' ), ceil( get_site_option( 'fileupload_maxk', 1500 ) / 1024 ) ); 35 35 if ( upload_is_user_over_quota( false ) ) { 36 36 $file['error'] = __( 'You have used your space quota. Please delete files before uploading.' ); 37 37 } -
src/wp-admin/network/settings.php
59 59 ); 60 60 61 61 foreach ( $options as $option_name ) { 62 if ( ! isset( $_POST[$option_name]) )62 if ( ! isset( $_POST[ $option_name ] ) ) { 63 63 continue; 64 $value = wp_unslash( $_POST[$option_name] ); 64 } 65 66 // Convert the saved file upload maximum from MB to KB before storing. 67 if ( 'fileupload_maxk' === $option_name ) { 68 $value = absint( wp_unslash( $_POST[ $option_name] ) * 1024 ); 69 } else { 70 $value = wp_unslash( $_POST[ $option_name ] ); 71 } 65 72 update_site_option( $option_name, $value ); 66 73 } 67 74 … … 269 276 270 277 <tr> 271 278 <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th> 272 <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 )) . '" />' ); ?></td>279 <td><?php printf( _x( '%s MB', 'File size in MB' ), '<input name="fileupload_maxk" type="number" min="0" step="1" style="width: 100px" id="fileupload_maxk" value="' . ceil( get_site_option( 'fileupload_maxk', 1500 ) / 1024 ) . '" />' ); ?></td> 273 280 </tr> 274 281 </table> 275 282 -
src/wp-includes/ms-functions.php
1880 1880 return $upload; 1881 1881 1882 1882 if ( strlen( $upload['bits'] ) > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) 1883 return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ));1883 return sprintf( __( 'This file is too big. Files must be less than %d MB in size.' ) . '<br />', ceil( get_site_option( 'fileupload_maxk', 1500 ) / 1024 ) ); 1884 1884 1885 1885 return $upload; 1886 1886 }