phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.vfs_sql.inc.php,1.30


From: ceb
Subject: [Phpgroupware-cvs] phpgwapi/inc class.vfs_sql.inc.php,1.30
Date: Thu, 24 Feb 2005 15:54:51 -0000

Update of phpgwapi/inc

Modified Files:
     Branch: MAIN
            class.vfs_sql.inc.php lines: +45 -28

Log Message:
fix for db->Record

====================================================
Index: phpgwapi/inc/class.vfs_sql.inc.php
diff -u phpgwapi/inc/class.vfs_sql.inc.php:1.29 
phpgwapi/inc/class.vfs_sql.inc.php:1.30
--- phpgwapi/inc/class.vfs_sql.inc.php:1.29     Mon Jan 24 17:33:15 2005
+++ phpgwapi/inc/class.vfs_sql.inc.php  Tue Jan 25 02:41:42 2005
@@ -99,7 +99,7 @@
                        $this->linked_dirs = array ();
                        while ($GLOBALS['phpgw']->db->next_record ())
                        {
-                               $this->linked_dirs[] = 
$GLOBALS['phpgw']->db->Record;
+                               $this->linked_dirs[] = $this->Record();
                        }
                }

@@ -153,7 +153,6 @@

                                        $sql .= "mime_type != '$type'";
                                }
-
                                $sql .= ') OR mime_type IS NULL)';
                        }

@@ -589,7 +588,7 @@

                        while ($GLOBALS['phpgw']->db->next_record ())
                        {
-                               $rarray[] = $GLOBALS['phpgw']->db->Record;
+                               $rarray[] = $this->Record();
                        }

                        return $rarray;
@@ -687,7 +686,8 @@
                                $query = $GLOBALS['phpgw']->db->query ("SELECT 
owner_id FROM phpgw_vfs WHERE directory='".$p2->fake_leading_dirs_clean."' AND 
name='".$p2->fake_name_clean."'" . $this->extra_sql (array ('query_type' => 
VFS_SQL_SELECT)), __LINE__, __FILE__);
                                $GLOBALS['phpgw']->db->next_record ();

-                               $owner_id = 
$GLOBALS['phpgw']->db->Record['owner_id'];
+                               $record         = $this->Record();
+                               $owner_id       = $record['owner_id'];
                        }
                        else
                        {
@@ -1019,7 +1019,8 @@
                                        return False;
                                }

-                               $query = $GLOBALS['phpgw']->db->query ("INSERT 
INTO phpgw_vfs (owner_id, directory, name) VALUES ($this->working_id, 
'$p->fake_leading_dirs_clean', '$p->fake_name_clean')", __LINE__, __FILE__);
+                               $query = $GLOBALS['phpgw']->db->query ('INSERT 
INTO phpgw_vfs (owner_id, directory, name) VALUES (' . $this->working_id .',' . 
$p->fake_leading_dirs_clean . ', '
+                                                                               
                                . $p->fake_name_clean . ')', __LINE__, 
__FILE__);

                                $this->set_attributes(array(
                                        'string'        => $p->fake_full_path,
@@ -1788,8 +1789,8 @@
                                ))
                        )
                        {
-                               $query = $GLOBALS['phpgw']->db->query ("INSERT 
INTO phpgw_vfs (owner_id, name, directory) VALUES ($this->working_id, 
'$p->fake_name_clean', '$p->fake_leading_dirs_clean')", __LINE__, __FILE__);
-
+                               $query = $GLOBALS['phpgw']->db->query ('INSERT 
INTO phpgw_vfs (owner_id, name, directory) VALUES (' . $this->working_id . ", '"
+                                                                               
                                . $p->fake_name_clean . "', '" . 
$p->fake_leading_dirs_clean . "')", __LINE__, __FILE__);
                                $this->set_attributes(array(
                                        'string'        => $p->fake_full_path,
                                        'relatives'     => array ($p->mask),
@@ -2017,6 +2018,8 @@
                                $sql .= ' WHERE file_id=' . 
intval($record['file_id']);
                                $sql .= $this->extra_sql (array ('query_type' 
=> VFS_SQL_UPDATE));

+                               //echo 'sql: ' . $sql;
+
                                $query = $GLOBALS['phpgw']->db->query ($sql, 
__LINE__, __FILE__);
                                if ($query)
                                {
@@ -2100,8 +2103,8 @@
                        */
                        $db2 = $GLOBALS['phpgw']->db;
                        $db2->query ("SELECT mime_type FROM phpgw_vfs WHERE 
directory='$p->fake_leading_dirs_clean' AND name='$p->fake_name_clean'" . 
$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
-                       $db2->next_record ();
-                       $mime_type = $db2->Record['mime_type'];
+                       $db2->next_record();
+                       $mime_type = $db2->f('mime_type');
                        if(!$mime_type)
                        {
                                $mime_type = $this->get_ext_mime_type (array 
('string' => $data['string']));
@@ -2174,6 +2177,18 @@
                        return $size;
                }

+               /* temporary wrapper function for not working Record function 
in adodb layer (ceb)*/
+               function Record()
+               {
+                       $values = array();
+                       reset ($this->attributes);
+                       foreach($this->attributes as $attribute)
+                       {
+                               $values[$attribute] = 
$GLOBALS['phpgw']->db->f($attribute);
+                       }
+                       return $values;
+               }
+
                /*
                 * See vfs_shared
                 */
@@ -2185,33 +2200,32 @@
                        }

                        $default_values = array
-                               (
-                                       'relatives'     => array 
(RELATIVE_CURRENT),
-                                       'checksubdirs'  => True,
-                                       'mime_type'     => False,
-                                       'nofiles'       => False,
-                                       'orderby'       => 'directory'
-                               );
+                       (
+                               'relatives'     => array (RELATIVE_CURRENT),
+                               'checksubdirs'  => True,
+                               'mime_type'     => False,
+                               'nofiles'       => False,
+                               'orderby'       => 'directory'
+                       );

                        $data = array_merge ($this->default_values ($data, 
$default_values), $data);

-                       $p = $this->path_parts (array(
+                       $p = $this->path_parts(array(
                                        'string'        => $data['string'],
                                        'relatives'     => array 
($data['relatives'][0])
                                )
                        );
+
+                       //_debug_array($p);
+
                        $dir = $p->fake_full_path;
                        /* If they pass us a file or 'nofiles' is set, return 
the info for $dir only */
-                       if (((($type = $this->file_type (array(
-                                       'string'        => $dir,
-                                       'relatives'     => array ($p->mask)
-                               )) != 'Directory'))
-                               || ($data['nofiles'])) && !$p->outside
-                       )
+                       if (((($type = $this->file_type(array('string'  => 
$dir,'relatives'     => array ($p->mask))) != 'Directory'))|| 
($data['nofiles'])) && !$p->outside)
                        {
                                /* SELECT all, the, attributes */
                                $sql = 'SELECT ';

+                               //echo 'vfs_sql->ls: attributes: ' . 
_debug_array($this->attributes);
                                reset ($this->attributes);
                                while (list ($num, $attribute) = each 
($this->attributes))
                                {
@@ -2225,10 +2239,12 @@

                                $sql .= " FROM phpgw_vfs WHERE 
directory='".$p->fake_leading_dirs_clean."' AND 
name='".$p->fake_name_clean."'".$this->extra_sql (array ('query_type' => 
VFS_SQL_SELECT));

-                               $query = $GLOBALS['phpgw']->db->query ($sql, 
__LINE__, __FILE__);
+                               //echo 'sql-string:' . $sql;

-                               $GLOBALS['phpgw']->db->next_record ();
-                               $record = $GLOBALS['phpgw']->db->Record;
+                               $query = $GLOBALS['phpgw']->db->query ($sql, 
__LINE__, __FILE__);
+                               $GLOBALS['phpgw']->db->next_record();
+                               $record = $this->Record();
+                               //echo 'record: ' . _debug_array($record);

                                /* We return an array of one array to maintain 
the standard */
                                $rarray = array ();
@@ -2298,6 +2314,7 @@
                        $sql = 'SELECT ';

                        reset ($this->attributes);
+
                        while (list ($num, $attribute) = each 
($this->attributes))
                        {
                                if ($num)
@@ -2324,7 +2341,7 @@
                        $rarray = array ();
                        for ($i = 0; $GLOBALS['phpgw']->db->next_record (); 
$i++)
                        {
-                               $record = $GLOBALS['phpgw']->db->Record;
+                               $record = $this->Record();

                                /* Further checking on the directory.  This 
makes sure /home/user/test won't match /home/user/test22 */
                                if (address@hidden ("^$dir(/|$)", 
$record['directory']))






reply via email to

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