"MDL-16539, fix warning when create new foler"
[moodle.git] / lib / boxlib.php
index 14aec63..8b04f2b 100755 (executable)
@@ -1,4 +1,9 @@
 <?php
+/**
+ * Modified by Dongsheng Cai <dongsheng@moodle.com>
+ * @version: $Id$
+ */
+
 /**
  * Box REST Client Library for PHP5 Developers
  *
  * Go to http://www.gnu.org/licenses/gpl-3.0.txt for full text
  */
 
-/**
- * Modified by Dongsheng Cai <dongsheng@cvs.moodle.org>
- *
- */
-
 class boxclient {
     public $auth_token = '';
 
@@ -256,29 +256,31 @@ class boxclient {
             return false;
         }
         foreach ($data as $a) {
-            switch ($a['tag']) {
-            case 'FOLDER_ID':
-                $ret_array['folder_id'] = $a['value'];
-                break;
+            if (!empty($a['value']) {
+                switch ($a['tag']) {
 
-            case 'FOLDER_NAME':
-                $ret_array['folder_name'] = $a['value'];
-                break;
+                case 'FOLDER_ID':
+                    $ret_array['folder_id'] = $a['value'];
+                    break;
 
-            case 'FOLDER_TYPE_ID':
-                $ret_array['folder_type_id'] = $a['value'];
-                break;
+                case 'FOLDER_NAME':
+                    $ret_array['folder_name'] = $a['value'];
+                    break;
+
+                case 'FOLDER_TYPE_ID':
+                    $ret_array['folder_type_id'] = $a['value'];
+                    break;
 
-            case 'SHARED':
-                if(!empty($a['value'])){
+                case 'SHARED':
                     $ret_array['shared'] = $a['value'];
-                }else{
-                    $ret_array['shared'] = false;
+                    break;
+
+                case 'PASSWORD':
+                    $ret_array['password'] = $a['value'];
+                    break;
                 }
-                break;
-            case 'PASSWORD':
-                $ret_array['password'] = $a['value'];
-                break;
+            } else {
+                $ret_array[strtolower($a['tag'])] = null;
             }
         }
         return $ret_array;
@@ -346,7 +348,7 @@ class boxclient {
         foreach ($data as $a) {
             switch ($a['tag']) {
                 case 'STATUS':
-                    if ($a['value'] == 'e_rename_node') {
+                    if ($a['value'] == 's_rename_node') {
                         return true;
                     }
             }