phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc class.http_dav_client.inc.php


From: Caeies
Subject: [Phpgroupware-cvs] phpgwapi/inc class.http_dav_client.inc.php
Date: Sun, 10 Sep 2006 09:46:46 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Changes by:     Caeies <Caeies> 06/09/10 09:46:46

Modified files:
        inc            : class.http_dav_client.inc.php 

Log message:
        starting E_ALL corrections for vfs dav system !, found a bug :)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.http_dav_client.inc.php?cvsroot=phpgwapi&r1=1.17&r2=1.18

Patches:
Index: class.http_dav_client.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.http_dav_client.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- class.http_dav_client.inc.php       3 Sep 2006 06:15:27 -0000       1.17
+++ class.http_dav_client.inc.php       10 Sep 2006 09:46:46 -0000      1.18
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage network
-       * @version $Id: class.http_dav_client.inc.php,v 1.17 2006/09/03 
06:15:27 skwashd Exp $
+       * @version $Id: class.http_dav_client.inc.php,v 1.18 2006/09/10 
09:46:46 Caeies Exp $
        * @internal At the moment much of this is simply a wrapper around the 
NET_HTTP_Client class, with some other methods for parsing the returned XML etc 
Ideally this will eventually use groupware's inbuilt HTTP class
        */
 
@@ -42,7 +42,7 @@
                function davtree($branch)
                {
                        $object = array();
-                       $branch =& $branch->first_child();
+                       $branch = $branch->first_child();
                        
                        while ($branch)
                        {
@@ -59,11 +59,11 @@
                                                else
                                                {
                                                        $tmp = 
dav_parser::davtree($branch);
-                                                       $object =& $tmp;
+                                                       $object = $tmp;
                                                }
                                        }
                                }
-                               $branch =& $branch->next_sibling();
+                               $branch = $branch->next_sibling();
                        }
                        return $object;
                }
@@ -71,12 +71,12 @@
                function davproperties(&$branch)
                {
                        $properties = array();
-                       $b =& $branch->first_child();
+                       $b = $branch->first_child();
                        while($b)
                        {
                                if(!($b->is_blank_node()) && $b->node_type() == 
XML_ELEMENT_NODE)
                                {
-                                       $c =& $b->first_child();
+                                       $c = $b->first_child();
                                        switch ($attribute = $b->node_name())
                                        {
                                                case 'href':
@@ -164,13 +164,13 @@
                                                                                
        $properties[$attribute][$c->node_name()] = 
dav_parser::davproperties($c);
                                                                        
                                                                        }
-                                                                       $c =& 
$c->next_sibling();
+                                                                       $c = 
$c->next_sibling();
                                                                }
                                                        }
                                                        break;
                                        }
                                }
-                               $b =& $b->next_sibling();
+                               $b = $b->next_sibling();
                        }
                        return $properties;
                }
@@ -459,13 +459,13 @@
                */
                function get_properties(&$props, $url, $scope=1, $is_dir 
=False, $sorted=true){
                        $request_id = $url.'//'.$scope.'//'.$sorted; //A unique 
id for this request (for caching)
-                       if ($this->cached_props[$request_id])
+                       if (isset($this->cached_props[$request_id]) && 
$this->cached_props[$request_id])
                        {
 if (DEBUG_CACHE) echo'Get properties: Cache hit : cache id:'.$request_id.'<br 
/>';
                                $props = 
$this->cached_props[$request_id]['data'];
                                return 
$this->cached_props[$request_id]['status'] != 401;
                        }
-                       else if (! $sorted && 
$this->cached_props[$url.'//'.$scope.'//1'])
+                       else if (! $sorted && 
isset($this->cached_props[$url.'//'.$scope.'//1']) && 
$this->cached_props[$url.'//'.$scope.'//1'])
                        {
 if (DEBUG_CACHE) echo 'Get propetries: Cache hit : cache id: 
'.$request_id.'<br />';
                                $props = 
$this->cached_props[$url.'//'.$scope.'//1']['data'];
@@ -490,18 +490,20 @@
                                {
                                        //_debug_array('Returning empty array 
:/ for '.$url);
                                        
$this->cached_props[$request_id]['status'] = $ret;
+                                       
$this->cached_props[$request_id]['data'] = array();
                                        $props = array();
                                        return $ret != 401;
                                }
                        }
+                       $this->cached_props[$request_id]['status'] = $ret;
                        $xml_result=$this->http_client->getBody();
                        if ( !is_object($this->dav_processor) )
                        {
                                $this->dav_processor = new dav_processor();
                        }
-                       $dav_processor =& $this->dav_processor;
+                       $dav_processor = $this->dav_processor;
                        $dav_processor->parse_tree($xml_result);
-                       $result_array =& $dav_processor->tree;
+                       $result_array = $dav_processor->tree;
 
                        foreach($result_array as $name=>$item) {
 /*                             _debug_array("**".$name."**");*/
@@ -510,7 +512,7 @@
                                //Get any extra properties that may share the 
vfs name
                                foreach ($this->attributes as $num=>$vfs_name)
                                {
-                                       if ($item[$vfs_name])
+                                       if (isset($item[$vfs_name]))
                                        {
                                                if(is_string($item[$vfs_name]))
                                                {
@@ -526,7 +528,7 @@
                                //Map some DAV properties onto VFS ones.
                                foreach ($this->vfs_property_map as 
$dav_name=>$vfs_name)
                                {
-                                       if ($item[$dav_name])
+                                       if (isset($item[$dav_name]))
                                        {
                                                if(is_string($item[$dav_name]))
                                                {
@@ -540,7 +542,7 @@
                                }
 
                                $newitem['name'] = $item['name'];
-                               if ($item['getcontenttype'] == 
'httpd/unix-directory' || is_array($item['resourcetype']['collection']) )
+                               if ((isset($item['getcontenttype']) && 
$item['getcontenttype'] == 'httpd/unix-directory') || 
(isset($item['resourcetype']) && isset($item['resourcetype']['collection']) && 
is_array($item['resourcetype']['collection'])) )
                                {
                                        $newitem['is_dir'] = 1;
                                        $newitem['mime_type']='Directory';
@@ -559,7 +561,11 @@
                                        
$this->cached_props[$name.'//0//1']['data'] = array($name => $newitem);
                                        
$this->cached_props[$name.'//1//1']['status'] = 207;
                                }
-                               
+                               //for manage version
+                               if(isset($item['version-name']))
+                               {
+                                       
$newitem['version']=$item['version-name'];
+                               }
                                $this->debug('<br><br>properties:<br>');
                                $this->debug($newitem);
                                $result[$name]=$newitem;
@@ -749,7 +755,7 @@
                * @return Returns the HTTP status code
                * @internal To get the result XML call get_body()
                */
-               function propfind( $uri, $scope=0, $id_dir = False )
+               function propfind( $uri, $scope=0, $is_dir = False )
                {
                        $uri = $this->encodeurl($uri);
 //if ( DEBUG_CACHEPROP ) { _debug_array($this->cached_propfind); }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]