]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15350, use penny's patch to apply default value in uploadfile function
authordongsheng <dongsheng>
Tue, 22 Jul 2008 07:24:32 +0000 (07:24 +0000)
committerdongsheng <dongsheng>
Tue, 22 Jul 2008 07:24:32 +0000 (07:24 +0000)
repository/boxnet/boxlibphp5.php

index d543f6b0091c4d91ae7ecb756b4d2d69b2bba350..01fb2b480bfed49dad0b7fc00aa0114ade8a3f93 100755 (executable)
@@ -190,8 +190,15 @@ class boxclient {
         $params['auth_token'] = $this->auth_token;
         // this param should be the full path of the file
         $params['new_file1']  = '@'.$params['file'];
-        $params['folder_id']  = 0; //Set to '0' by default. Change to create within sub-folder.
-        $params['share']      = 1; //Set to '1' by default. Set to '0' to make folder private.
+        $defaults = array(
+            'folder_id' => 0, //Set to '0' by default. Change to create within sub-folder.
+            'share'     => 1, //Set to '1' by default. Set to '0' to make folder private.
+        );
+        foreach ($defaults as $key => $value) {
+            if (!array_key_exists($key, $params)) {
+                $params[$key] = $value;
+            }
+        }
         $ret_array = array();
         $entry_count = 0;
         $data = $this->makeRequest('upload', $params);