]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-16384, alfresco plugin, deal with session expired issue"
authordongsheng <dongsheng>
Fri, 5 Jun 2009 08:14:57 +0000 (08:14 +0000)
committerdongsheng <dongsheng>
Fri, 5 Jun 2009 08:14:57 +0000 (08:14 +0000)
repository/alfresco/repository.class.php

index 82908b5bb2f58c46bf7b4992024243ac35192ee4..5df7f6d58f6de34dc2c9c85a7450027430e2de2b 100755 (executable)
@@ -91,7 +91,7 @@ class repository_alfresco extends repository {
     }
 
     public function get_listing($uuid = '', $path = '') {
-        global $CFG;
+        global $CFG, $SESSION;
 
         $ret = array();
         $ret['dynload'] = true;
@@ -103,26 +103,31 @@ class repository_alfresco extends repository {
 
         $ret['path'] = array(array('name'=>'Root', 'path'=>''));
 
-        if (empty($uuid)) {
-            $this->current_node = $this->store->companyHome;
-        } else {
-            $this->current_node = $this->user_session->getNode($this->store, $uuid);
-        }
-        $folder_filter = "{http://www.alfresco.org/model/content/1.0}folder";
-        $file_filter = "{http://www.alfresco.org/model/content/1.0}content";
-        foreach ($this->current_node->children as $child)
-        {
-            if ($child->child->type == $folder_filter)
+        try {
+            if (empty($uuid)) {
+                $this->current_node = $this->store->companyHome;
+            } else {
+                $this->current_node = $this->user_session->getNode($this->store, $uuid);
+            }
+            $folder_filter = "{http://www.alfresco.org/model/content/1.0}folder";
+            $file_filter = "{http://www.alfresco.org/model/content/1.0}content";
+            foreach ($this->current_node->children as $child)
             {
-                $ret['list'][] = array('title'=>$child->child->cm_name,
-                    'path'=>$child->child->id,
-                    'thumbnail'=>$CFG->httpswwwroot.'/pix/f/folder-32.png',
-                    'children'=>array());
-            } elseif ($child->child->type == $file_filter) {
-                $ret['list'][] = array('title'=>$child->child->cm_name,
-                    'thumbnail' => $CFG->httpswwwroot .'/pix/f/'. mimeinfo('icon32', $child->child->cm_name),
-                    'source'=>$child->child->id);
+                if ($child->child->type == $folder_filter)
+                {
+                    $ret['list'][] = array('title'=>$child->child->cm_name,
+                        'path'=>$child->child->id,
+                        'thumbnail'=>$CFG->httpswwwroot.'/pix/f/folder-32.png',
+                        'children'=>array());
+                } elseif ($child->child->type == $file_filter) {
+                    $ret['list'][] = array('title'=>$child->child->cm_name,
+                        'thumbnail' => $CFG->httpswwwroot .'/pix/f/'. mimeinfo('icon32', $child->child->cm_name),
+                        'source'=>$child->child->id);
+                }
             }
+        } catch (Exception $e) {
+            unset($SESSION->{$this->sessname});
+            $ret = $this->print_login();
         }
         return $ret;
     }