summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-08-10 20:07:33 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-08-10 20:07:33 +0000
commite11d193dd1cf98976ea7ac9e684c53d690485f77 (patch)
treebd2ef09769137798aee0e80a21f62e3e4f207aeb
parentdd60ae2008f7cbeb452b46f28fde9002ec598f25 (diff)
Allow site admin to change upload space settings and file types
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@155 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-inst/wp-admin/upload.php3
-rw-r--r--wp-inst/wp-admin/wpmu-edit.php2
-rw-r--r--wp-inst/wp-admin/wpmu-options.php8
-rw-r--r--wp-inst/wp-includes/wpmu-functions.php8
4 files changed, 17 insertions, 4 deletions
diff --git a/wp-inst/wp-admin/upload.php b/wp-inst/wp-admin/upload.php
index ae305ee..d1f02ec 100644
--- a/wp-inst/wp-admin/upload.php
+++ b/wp-inst/wp-admin/upload.php
@@ -11,7 +11,8 @@ if (!get_settings('use_fileupload')) //Checks if file upload is enabled in the c
if ( ! current_user_can('upload_files') )
die (__("You are not allowed to upload files"));
-$allowed_types = explode(' ', "jpg jpeg png gif");
+$allowed_types = get_site_option( 'upload_filetypes' ) == false ? 'jpg jpeg png gif' : get_site_option( 'upload_filetypes' );
+$allowed_types = explode(' ', $allowed_types );
if ($_POST['submit']) {
$action = 'upload';
diff --git a/wp-inst/wp-admin/wpmu-edit.php b/wp-inst/wp-admin/wpmu-edit.php
index 9d9eef6..e0ec07f 100644
--- a/wp-inst/wp-admin/wpmu-edit.php
+++ b/wp-inst/wp-admin/wpmu-edit.php
@@ -14,6 +14,8 @@ switch( $_GET[ 'action' ] ) {
update_site_option( "illegal_names", split( ' ', $wpdb->escape( $_POST[ 'illegal_names' ] ) ) );
update_site_option( "limited_email_domains", split( ' ', $wpdb->escape( $_POST[ 'limited_email_domains' ] ) ) );
update_site_option( "menu_items", $_POST[ 'menu_items' ] );
+ update_site_option( "blog_upload_space", $_POST[ 'blog_upload_space' ] );
+ update_site_option( "upload_filetypes", $_POST[ 'upload_filetypes' ] );
header( "Location: wpmu-options.php?updated=true" );
exit;
break;
diff --git a/wp-inst/wp-admin/wpmu-options.php b/wp-inst/wp-admin/wpmu-options.php
index d24c19f..a98e69b 100644
--- a/wp-inst/wp-admin/wpmu-options.php
+++ b/wp-inst/wp-admin/wpmu-options.php
@@ -59,6 +59,14 @@ if (isset($_GET['updated'])) {
<br />
<?php _e('If you want to limit blog registrations to certain domains. Separate domains by spaces.') ?></td>
</tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Blog upload space:') ?></th>
+ <td><input name="blog_upload_space" type="text" id="blog_upload_space" value="<?php echo get_site_option('blog_upload_space') == false ? 10 : get_site_option('blog_upload_space') ; ?>" size="3" /> MB
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Upload File Types:') ?></th>
+ <td><input name="upload_filetypes" type="text" id="upload_filetypes" value="<?php echo get_site_option('upload_filetypes') == false ? 'jpg jpeg png gif' : get_site_option('upload_filetypes') ; ?>" size="45" />
+ </tr>
</table>
</fieldset>
<fieldset class="options">
diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php
index 2046e98..5ed4a09 100644
--- a/wp-inst/wp-includes/wpmu-functions.php
+++ b/wp-inst/wp-includes/wpmu-functions.php
@@ -194,7 +194,9 @@ function wpmu_checkAvailableSpace($action) {
global $wpblog, $blog_id;
// Default space allowed is 10 MB
- $spaceAllowed = ( wpmu_adminOption_get("wpmu_space_allocated", 10485760 ) / 1024 );
+ $spaceAllowed = get_site_option("blog_upload_space" );
+ if( $spaceAllowed == false )
+ $spaceAllowed = 10;
$dirName = ABSPATH."wp-content/blogs.dir/".$blog_id."/files/";
@@ -211,12 +213,12 @@ function wpmu_checkAvailableSpace($action) {
}
}
$dir->close();
- $size = $size / 1024;
+ $size = $size / 1024 / 1024;
?>
<table align="center" width="20%" cellpadding="0" cellspacing="0">
<tr>
- <td>Space Available (<?php printf( "%2.2f", ( ($spaceAllowed-$size) / 1024 ) ) ?><i>MB)</i></td>
+ <td>Space Available (<?php printf( "%2.2f", ( ($spaceAllowed-$size) ) ) ?><i>MB)</i></td>
</tr>
<tr>
<td bgcolor="<?php echo ((($size/$spaceAllowed)*100)<70)?"Green":"Red"; ?>">&nbsp;</td><td bgcolor="Black" width="<?php echo (($size/$spaceAllowed)*100); ?>%"></td>