Index: modules/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload.module,v
retrieving revision 1.72
diff -u -r1.72 upload.module
--- modules/upload.module	8 Jan 2006 12:20:55 -0000	1.72
+++ modules/upload.module	14 Jan 2006 19:16:36 -0000
@@ -93,26 +93,42 @@
 }
 
 function upload_settings() {
-  $form['settings_general'] = array('#type' => 'fieldset', '#title' => t('General settings'));
+  $upload_extensions_default = variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps');
+  $upload_uploadsize_default = variable_get('upload_uploadsize_default', 1);
+  $upload_usersize_default = variable_get('upload_usersize_default', 10);
+
+  $form['settings_general'] = array('#type' => 'fieldset', '#title' => t('General settings'), '#collapsible' => TRUE);
   $form['settings_general']['upload_max_resolution'] = array(
     '#type' => 'textfield', '#title' => t('Maximum resolution for uploaded images'), '#default_value' => variable_get('upload_max_resolution', 0),
     '#size' => 15, '#maxlength' => 10, '#description' => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.')
   );
+  $form['settings_general']['upload_extensions_default'] = array(
+    '#type' => 'textfield', '#title' => t('Default permitted file extensions'), '#default_value' => $upload_extensions_default,
+    '#maxlength' => 255, '#description' => t('Default extensions that users can upload. Separate extensions with a space and do not include the leading dot.')
+  );
+  $form['settings_general']['upload_uploadsize_default'] = array(
+    '#type' => 'textfield', '#title' => t('Default maximum file size per upload'), '#default_value' => $upload_uploadsize_default,
+    '#size' => 5, '#maxlength' => 5, '#description' => t('The default maximum file size a user can upload (in megabytes).')
+  );
+  $form['settings_general']['upload_usersize_default'] = array(
+    '#type' => 'textfield', '#title' => t('Default total file size per user'), '#default_value' => $upload_usersize_default,
+    '#size' => 5, '#maxlength' => 5, '#description' => t('The default maximum size of all files a user can have on the site (in megabytes).')
+  );
 
   $roles = user_roles(0, 'upload files');
 
   foreach ($roles as $rid => $role) {
     $form["settings_role_$rid"] = array('#type' => 'fieldset', '#title' => t('Settings for %role', array('%role' => theme('placeholder', $role))), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form["settings_role_$rid"]["upload_extensions_$rid"] = array(
-      '#type' => 'textfield', '#title' => t('Permitted file extensions'), '#default_value' => variable_get("upload_extensions_$rid", "jpg jpeg gif png txt html doc xls pdf ppt pps"),
+      '#type' => 'textfield', '#title' => t('Permitted file extensions'), '#default_value' => variable_get("upload_extensions_$rid", $upload_extensions_default),
       '#maxlength' => 255, '#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.')
     );
     $form["settings_role_$rid"]["upload_uploadsize_$rid"] = array(
-      '#type' => 'textfield', '#title' => t('Maximum file size per upload'), '#default_value' => variable_get("upload_uploadsize_$rid", 1),
-      '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of a file a user can upload (in megabytes).')
+      '#type' => 'textfield', '#title' => t('Maximum file size per upload'), '#default_value' => variable_get("upload_uploadsize_$rid", $upload_uploadsize_default),
+      '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum file size a user can upload (in megabytes).')
     );
     $form["settings_role_$rid"]["upload_usersize_$rid"] = array(
-      '#type' => 'textfield', '#title' => t('Total file size per user'), '#default_value' => variable_get("upload_usersize_$rid", 10),
+      '#type' => 'textfield', '#title' => t('Total file size per user'), '#default_value' => variable_get("upload_usersize_$rid", $upload_usersize_default),
       '#size' => 5, '#maxlength' => 5, '#description' => t('The maximum size of all files a user can have on the site (in megabytes).')
     );
   }
@@ -217,9 +233,9 @@
           // all roles prevent it.
           $total_usersize = upload_space_used($user->uid) + $filesize;
           foreach ($user->roles as $rid => $name) {
-            $extensions = variable_get("upload_extensions_$rid", 'jpg jpeg gif png txt html doc xls pdf ppt pps');
-            $uploadsize = variable_get("upload_uploadsize_$rid", 1) * 1024 * 1024;
-            $usersize = variable_get("upload_usersize_$rid", 1) * 1024 * 1024;
+            $extensions = variable_get("upload_extensions_$rid", variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps'));
+            $uploadsize = variable_get("upload_uploadsize_$rid", variable_get('upload_uploadsize_default', 1)) * 1024 * 1024;
+            $usersize = variable_get("upload_usersize_$rid", variable_get('upload_usersize_default', 10)) * 1024 * 1024;
 
             $regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
 
