Added module configs for unzip mode and upload user defaults
authorJamie Cameron <jcameron@webmin.com>
Fri, 18 May 2007 17:52:16 +0000 (17:52 +0000)
committerJamie Cameron <jcameron@webmin.com>
Fri, 18 May 2007 17:52:16 +0000 (17:52 +0000)
file/CHANGELOG
file/config
file/config-*-linux
file/config-irix
file/config-solaris
file/config.info
file/upform.cgi

index 049a149..825f5ae 100644 (file)
@@ -36,3 +36,4 @@ When editing an HTML file, the <head> section is preserved.
 Added a link in the HTML editor window to swich to plain text mode.
 Files in the right-hand list are now sorted case-insensitively.
 When uploading a file, you can now select which Unix user it gets uploaded as.
+Added Module Config options for the default unzip mode and default user to upload as.
index ca12645..7cc8034 100644 (file)
@@ -3,3 +3,5 @@ iconsize=0
 nocharset=0
 extract=1
 force_text=0
+defzip=0
+defuser=root
index 172d018..bb3c03d 100644 (file)
@@ -14,3 +14,5 @@ iconsize=0
 nocharset=0
 extract=1
 force_text=0
+defzip=0
+defuser=root
index fe0330a..56c8bf3 100644 (file)
@@ -7,3 +7,5 @@ iconsize=0
 nocharset=0
 extract=1
 force_text=0
+defzip=0
+defuser=root
index 1f3020c..5dfc214 100644 (file)
@@ -8,3 +8,5 @@ iconsize=0
 nocharset=0
 extract=1
 force_text=0
+defzip=0
+defuser=root
index 9d062a2..a795241 100644 (file)
@@ -6,3 +6,5 @@ width=Width for scaled images,3,Default (300 pixels)
 fixed=Font size for text,3,Default (12 points)
 small_fixed=Font size for buttons,3,Default (10 points)
 force_text=Editor for HTML files,1,1-Text editor,0-HTML editor
+defzip=Default archive mode for uploads,1,2-Extract and delete,1-Extract,0-Do nothing
+defuser=Default user for uploads,10,root-root,*-Same as directory,Other user
index ec5ff36..dec684f 100755 (executable)
@@ -29,7 +29,7 @@ if ($dostounix == 1) {
 if ($unarchive == 1) {
        # Unzip file?
        print &ui_table_row($text{'upload_zip'},
-                           &ui_radio("zip", 0,
+                           &ui_radio("zip", int($config{'defzip'}),
                                [ [ 2, $text{'upload_yes'} ],
                                  [ 1, $text{'yes'} ],
                                  [ 0, $text{'no'} ] ]));
@@ -37,8 +37,14 @@ if ($unarchive == 1) {
 
 if ($running_as_root) {
        # Upload as user
+       $user = $config{'defuser'} || "root";
+       if ($user eq "*") {
+               # Get from parent directory
+               local @st = stat(&unmake_chroot($in{'dir'}));
+               $user = getpwuid($st[4]);
+               }
        print &ui_table_row($text{'upload_user'},
-                           &ui_user_textbox("user", "root"));
+                           &ui_user_textbox("user", $user));
        }
 
 print &ui_table_end();