[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.vfs_dav.inc.php class.vfs.in...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.vfs_dav.inc.php class.vfs.in... |
Date: |
Wed, 16 Aug 2006 14:18:46 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/08/16 14:18:45
Modified files:
inc : class.vfs_dav.inc.php class.vfs.inc.php
class.vfs_shared.inc.php class.vfs_sql.inc.php
Log message:
fixes, cleanups and phpedoc compliant docs
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.vfs_dav.inc.php?cvsroot=phpgwapi&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.vfs.inc.php?cvsroot=phpgwapi&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.vfs_shared.inc.php?cvsroot=phpgwapi&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.vfs_sql.inc.php?cvsroot=phpgwapi&r1=1.32&r2=1.33
Patches:
Index: class.vfs_dav.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.vfs_dav.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- class.vfs_dav.inc.php 1 Feb 2006 17:26:01 -0000 1.8
+++ class.vfs_dav.inc.php 16 Aug 2006 14:18:45 -0000 1.9
@@ -7,7 +7,7 @@
* @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage vfs
- * @version $Id: class.vfs_dav.inc.php,v 1.8 2006/02/01 17:26:01 Caeies
Exp $
+ * @version $Id: class.vfs_dav.inc.php,v 1.9 2006/08/16 14:18:45 skwashd
Exp $
*/
/**
@@ -75,9 +75,9 @@
'getetag' => 'file_id',
);
- /*!
- @function vfs
- @abstract constructor, sets up variables
+ /**
+ * constructor, sets up variables
+ *
*/
function vfs ()
@@ -104,7 +104,7 @@
$this->dav_root .= $this->dav_host;
$this->dav_root .= (empty($this->dav_port)) ? '' :
':'.$this->dav_port;
- $this->dav_client =
CreateObject('phpgwapi.http_dav_client');
+ $this->dav_client =&
CreateObject('phpgwapi.http_dav_client');
$this->dav_client->set_credentials($this->dav_user,$this->dav_pwd);
$this->dav_client->set_attributes($this->attributes,$this->vfs_property_map);
$result =
$this->dav_client->connect($this->dav_host,$this->dav_port,$parsed_url['scheme']
== 'https');
@@ -149,9 +149,9 @@
}
}
- /*!
- @function dav_path
- @abstract Apaches mod_dav in particular requires that the path
sent in a dav request NOT be a URI
+ /**
+ * Apaches mod_dav in particular requires that the path sent in
a dav request NOT be a URI
+ *
*/
function dav_path($uri) {
//$this->debug('DAV path');
@@ -159,11 +159,11 @@
return $parsed['path'];
}
- /*!
- @function glue_url
- @abstract glues a parsed url (ie parsed using PHP's parse_url)
back
- together
- @param $url The parsed url (its an array)
+ /**
+ * glues a parsed url (ie parsed using PHP's parse_url) back
+ *
+ * together
+ * @param $url The parsed url (its an array)
*/
function glue_url ($url){
if (!is_array($url))
@@ -214,30 +214,30 @@
}
- /*!
- @function add_journal
- @abstract Add a journal entry after (or before) completing an
operation,
- and increment the version number. This function
should be used internally only
- @discussion Note that state_one and state_two are ignored for
some VFS_OPERATION's, for others
- they are required. They are ignored for any
"custom" operation
- The two operations that require state_two:
- operation state_two
- VFS_OPERATION_COPIED fake_full_path of
copied to
- VFS_OPERATION_MOVED fake_full_path of moved
to
-
- If deleting, you must call add_journal () before
you delete the entry from the database
- @param string File or directory to add entry for
- @param relatives Relativity array
- @param operation The operation that was performed. Either a
VFS_OPERATION define or
- a non-integer descriptive text string
- @param state_one The first "state" of the file or directory.
Can be a file name, size,
- location, whatever is appropriate for the
specific operation
- @param state_two The second "state" of the file or directory
- @param incversion Boolean True/False. Increment the version
for the file? Note that this is
- handled automatically for the VFS_OPERATION
defines.
- i.e. VFS_OPERATION_EDITED would increment
the version, VFS_OPERATION_COPIED
- would not
- @result Boolean True/False
+ /**
+ * Add a journal entry after (or before) completing an
operation,
+ *
+ * and increment the version number. This function
should be used internally only
+ * Note that state_one and state_two are ignored for some
VFS_OPERATION's, for others
+ * * they are required. They are ignored for any
"custom" operation
+ * * The two operations that require state_two:
+ * * operation * state_two
+ * * VFS_OPERATION_COPIED fake_full_path of
copied to
+ * * VFS_OPERATION_MOVED *
fake_full_path of moved to
+
+ * * If deleting, you must call add_journal ()
before you delete the entry from the database
+ * @param string File or directory to add entry for
+ * @param relatives Relativity array
+ * @param operation The operation that was performed. Either a
VFS_OPERATION define or
+ * * a non-integer descriptive text string
+ * @param state_one The first "state" of the file or directory.
Can be a file name, size,
+ * * location, whatever is appropriate for the
specific operation
+ * @param state_two The second "state" of the file or directory
+ * @param incversion Boolean True/False. Increment the version
for the file? Note that this is
+ * * handled automatically for the
VFS_OPERATION defines.
+ * * i.e. VFS_OPERATION_EDITED would increment
the version, VFS_OPERATION_COPIED
+ * * would not
+ * @return Boolean True/False
*/
function add_journal ($data) {
//The journalling dont work :( Ideally this will become
"versioning"
@@ -415,7 +415,7 @@
}
}
- $acl = CreateObject ('phpgwapi.acl', $owner_id);
+ $acl =& CreateObject ('phpgwapi.acl', $owner_id);
$acl->account_id = $owner_id;
$acl->read_repository ();
@@ -437,7 +437,7 @@
}
elseif (!$rights && $group_ok)
{
- $conf = CreateObject('phpgwapi.config',
'phpgwapi');
+ $conf =& CreateObject('phpgwapi.config',
'phpgwapi');
$conf->read_repository();
if ($conf->config_data['acl_default'] ==
'grant')
{
@@ -1456,7 +1456,7 @@
$homedir = $this->fakebase.'/'.$this->dav_user;
if ( substr($p->fake_leading_dirs, 0,
strlen($homedir)) == $homedir)
{
- $conf = CreateObject('phpgwapi.config',
'phpgwapi');
+ $conf =&
CreateObject('phpgwapi.config', 'phpgwapi');
$conf->read_repository();
if ($conf->config_data['acl_default']
!= 'grant')
{
@@ -1709,19 +1709,19 @@
}
}
- /*!
- @function ls
- @abstract get directory listing or info about a single file
- @discussion Note: The entries are not guaranteed to be returned
in any logical order
- Note: The size for directories does not include
subfiles/subdirectories.
- If you need that, use $this->get_size ()
- @param string File or Directory
- @param relatives Relativity array
- @param checksubdirs Boolean, recursively list all sub
directories as well?
- @param mime_type Only return entries matching MIME-type
'mime_type'. Can be any MIME-type, "Directory" or "\ " for those without MIME
types
- @param nofiles Boolean. True means you want to return just the
information about the directory $dir. If $dir is a file, $nofiles is implied.
This is the equivalent of 'ls -ld $dir'
- @param orderby How to order results. Note that this only works
for directories inside the virtual root
- @result array of arrays. Subarrays contain full info for each
file/dir.
+ /**
+ * get directory listing or info about a single file
+ *
+ * Note: The entries are not guaranteed to be returned in any
logical order
+ * * Note: The size for directories does not
include subfiles/subdirectories.
+ * * If you need that, use $this->get_size ()
+ * @param string File or Directory
+ * @param relatives Relativity array
+ * @param checksubdirs Boolean, recursively list all sub
directories as well?
+ * @param mime_type Only return entries matching MIME-type
'mime_type'. Can be any MIME-type, "Directory" or "\ " for those without MIME
types
+ * @param nofiles Boolean. True means you want to return just
the information about the directory $dir. If $dir is a file, $nofiles is
implied. This is the equivalent of 'ls -ld $dir'
+ * @param orderby How to order results. Note that this only
works for directories inside the virtual root
+ * @return array of arrays. Subarrays contain full info for
each file/dir.
*/
function ls ($data)
{
@@ -1884,24 +1884,23 @@
/* Below are helpers */
- /*!
- * @access : Private
- * @function get_properties
- * @param string $uri : the $p->real_full_path of the file/dir
- * @param mixed $scope : 0 = the uri itself, 1 = the uri and
one-level
- * under it, Infinity = the uri and all the sub-tree (not always ok
- * depends on WebServer configuration (DavDepthInfinity on/off)
- * @param boolean $is_dir : If you know that uri is a directory
put
- * it to True, so only one propfind is needed against some kind
of
- * Dav implementation (if not you will get a 301 Moved
Permanently,
- * The function follow it)
- * @param string $prop_name : a property name (first level !);
- * @return mixed $props : the full array of needed properties or
- * an array corresponding to the requested $prop_name if $scope
== 0
- * => the value itself, else an array indexed by path and
containing
- * only the prop_name
- * @discussion : This is a helper for the dav_properties.
WARNING :
- * NO ACL CHECKS ARE DONE !!!
+ /**
+ * * @access : Private
+ * * @param string $uri : the $p->real_full_path of the file/dir
+ * * @param mixed $scope : 0 = the uri itself, 1 = the uri and
one-level
+ * * under it, Infinity = the uri and all the sub-tree (not
always ok
+ * * depends on WebServer configuration (DavDepthInfinity
on/off)
+ * * @param boolean $is_dir : If you know that uri is a
directory put
+ * * it to True, so only one propfind is needed against some
kind of
+ * * Dav implementation (if not you will get a 301 Moved
Permanently,
+ * * The function follow it)
+ * * @param string $prop_name : a property name (first level !);
+ * * @return mixed $props : the full array of needed properties
or
+ * * an array corresponding to the requested $prop_name if
$scope == 0
+ * * => the value itself, else an array indexed by path and
containing
+ * * only the prop_name
+ * * : This is a helper for the dav_properties. WARNING :
+ * * NO ACL CHECKS ARE DONE !!!
*/
function get_properties($uri, $scope = 0 , $is_dir = False,
$prop_name = '#ALL#')
{
Index: class.vfs.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.vfs.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- class.vfs.inc.php 30 Dec 2004 09:00:31 -0000 1.14
+++ class.vfs.inc.php 16 Aug 2006 14:18:45 -0000 1.15
@@ -5,10 +5,11 @@
* @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage vfs
- * @version $Id: class.vfs.inc.php,v 1.14 2004/12/30 09:00:31 skwashd
Exp $
+ * @version $Id: class.vfs.inc.php,v 1.15 2006/08/16 14:18:45 skwashd
Exp $
*/
- if (empty ($GLOBALS['phpgw_info']['server']['file_repository']))
+ if ( !isset($GLOBALS['phpgw_info']['server']['file_repository'])
+ || empty($GLOBALS['phpgw_info']['server']['file_repository']) )
{
$GLOBALS['phpgw_info']['server']['file_repository'] = 'sql';
}
Index: class.vfs_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.vfs_shared.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- class.vfs_shared.inc.php 30 Dec 2004 09:00:31 -0000 1.6
+++ class.vfs_shared.inc.php 16 Aug 2006 14:18:45 -0000 1.7
@@ -8,7 +8,7 @@
* @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage vfs
- * @version $Id: class.vfs_shared.inc.php,v 1.6 2004/12/30 09:00:31
skwashd Exp $
+ * @version $Id: class.vfs_shared.inc.php,v 1.7 2006/08/16 14:18:45
skwashd Exp $
*/
/**
@@ -204,17 +204,17 @@
'version' /* Version of file. May be 0 */
);
- /*!
- * @function vfs_shared
- * @abstract constructor
- * @description All derived classes should call this function
in their
+ /**
+ * * constructor
+ * *
+ * * All derived classes should call this function in their
* constructor ($this->vfs_shared())
*/
function vfs_shared ()
{
$this->basedir =
$GLOBALS['phpgw_info']['server']['files_dir'];
$this->working_id =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->working_lid =
$GLOBALS['phpgw']->accounts->id2name($this->working_id);
+ $this->working_lid =
$GLOBALS['phpgw_info']['user']['account_lid'];
$this->now = date ('Y-m-d');
/* These are stored in the MIME-type field and should
normally
* be ignored.
@@ -262,16 +262,16 @@
function add_journal ($data) {}
function flush_journal ($data) {}
- /*!
- * @function get_journal
- * @abstract Get journal entries for a location
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @optional type [0|1|2]
+ /**
+ * * Get journal entries for a location
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * type [0|1|2]
* 0 = any journal entries
* 1 = current journal entries
* 2 = deleted journal entries
- * @result Array of arrays of journal entries
+ * * @return Array of arrays of journal entries
* The keys will vary depending on the implementation,
* with most attributes in this->attributes being valid,
* and these keys being mandatory:
@@ -308,76 +308,76 @@
* locks_save_session - Save the ovveride_locks array into
session
* locks_restore_session - Restore the override_locks array
from session
*/
- /*!
- * string str_error : contains an error about lock
+ /**
+ * * string str_error : contains an error about lock
*/
var $str_lock_error = '';
- /*!
- * array override_locks
- * @discussion : This array contains all our locks to override
automatically the locks
- * when we are writing/deleting etc... and we are the locker.
+ /**
+ * * array override_locks
+ * * : This array contains all our locks to override
automatically the locks
+ * * when we are writing/deleting etc... and we are the locker.
*/
var $override_locks = array();
- /*!
- * @function lock
- * @abstract put a WRITE lock on the file. The lock is EXCLUSIVE
- * @param array data : 'string' => the filename / dirname
- * 'relatives'=> an array(0 => RETATIVITY)
containing the relativity.
- * 'owner_lid' => the phpgw owner of the
lock (lid)
- * 'timeout' => In second the time for the
lock, or 'Infinite' for a notimeout lock
- * @return True on Success False otherwise and
$this->str_lock_error SHOULD contains an indication
+ /**
+ * * put a WRITE lock on the file. The lock is EXCLUSIVE
+ * *
+ * * @param array data : 'string' => the filename / dirname
+ * * 'relatives'=> an array(0 =>
RETATIVITY) containing the relativity.
+ * * 'owner_lid' => the phpgw owner of the
lock (lid)
+ * * 'timeout' => In second the time for
the lock, or 'Infinite' for a notimeout lock
+ * * @return True on Success False otherwise and
$this->str_lock_error SHOULD contains an indication
*/
function lock ($data) {
$this->str_lock_error = 'Method not implemented';
return False;
}
- /*!
- * @function unlock
- * @abstract remove the WRITE lock on the file.
- * @param array data : 'string' => the filename / dirname
- * 'relatives' => the relativity array,
- * 'token' => the lock token to remove
- * @param string token : the token string to remove.
- * @return True on Success, False otherwise, in which case
$this->str_lock_error SHOULD contains an indication
+ /**
+ * * remove the WRITE lock on the file.
+ * *
+ * * @param array data : 'string' => the filename / dirname
+ * * 'relatives' => the relativity array,
+ * * 'token' => the lock token to remove
+ * * @param string token : the token string to remove.
+ * * @return True on Success, False otherwise, in which case
$this->str_lock_error SHOULD contains an indication
*/
function unlock ($data) {
$this->str_lock_error = 'Method not implemented';
return False;
}
- /*!
- * @function lock_token
- * @abstract retrieve a lock token from a given file /dir
- * @param array data : 'string' => the filename / dirname
- * 'relatives' => the relativity array
- * 'owner_lid' => (optional) the matching
owner_lid, if this is SET and Empty
- * then lock_token will only
return a token for the current user,
- * if it's not empty, only
this owner_lid will be matched. Thus we permit
- * Group lock_token.
- * @return string lock_token or boolean False if no token was
mathed / or present.
- * @discussion : If no owner_lid is specified nor set, it will
return the last token of the file Only if the user have any right
- * on this dir/file.
+ /**
+ * * retrieve a lock token from a given file /dir
+ * *
+ * * @param array data : 'string' => the filename / dirname
+ * * 'relatives' => the relativity array
+ * * 'owner_lid' => (optional) the
matching owner_lid, if this is SET and Empty
+ * * then lock_token will
only return a token for the current user,
+ * * if it's not empty,
only this owner_lid will be matched. Thus we permit
+ * * Group lock_token.
+ * * @return string lock_token or boolean False if no token
was mathed / or present.
+ * * : If no owner_lid is specified nor set, it will return
the last token of the file Only if the user have any right
+ * * on this dir/file.
*/
function lock_token($data) { return False; }
/*
* Lock SHARED Function, you don't need to overload these
*/
- /*!
- * @function add_lock_override
- * @abstract override a lock
- * @param string filename
- * @param relatives Relativity array
- * @param token (optional) a token for the lock we want to
override
- * @result None
- * @discussion locks are no good unless you can write to a file
you yourself locked:
- * to do this call add_lock_override with the lock token (or
without it - it will
- * find it itself, so long as there is only one). lock_override
info is stored in
- * the groupware session, so it will persist between page loads,
but will be lost
- * when the browser is closed
+ /**
+ * * override a lock
+ * *
+ * * @param string filename
+ * * @param relatives Relativity array
+ * * @param token (optional) a token for the lock we want to
override
+ * * @return None
+ * * locks are no good unless you can write to a file you
yourself locked:
+ * * to do this call add_lock_override with the lock token (or
without it - it will
+ * * find it itself, so long as there is only one).
lock_override info is stored in
+ * * the groupware session, so it will persist between page
loads, but will be lost
+ * * when the browser is closed
*/
function add_lock_override($data)
{
@@ -409,12 +409,12 @@
$this->locks_save_session();
}
- /*!
- * @function remove_lock_override
- * @abstract stops overriding a lock
- * @param string filename
- * @param relatives Relativity array
- * @result None
+ /**
+ * * stops overriding a lock
+ * *
+ * * @param string filename
+ * * @param relatives Relativity array
+ * * @return None
*/
function remove_lock_override($data)
{
@@ -495,23 +495,23 @@
* acl_check() - Check access for a user to a given
*/
- /*!
- * @function acl_check
- * @abstract Check access for a user to a given location
- * @discussion If $this->override_acl is set, always return True
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @required operation Operation to check access for. Any
combination
+ /**
+ * * Check access for a user to a given location
+ * *
+ * * If $this->override_acl is set, always return True
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * operation Operation to check access for. Any combination
* of the PHPGW_ACL_* defines, for example:
* PHPGW_ACL_READ
* PHPGW_ACL_READ|PHPGW_ACL_WRITE
- * @optional owner_id phpGW ID to check access for.
- * Default:
$GLOBALS['phpgw_info']['user']['account_id']
- * @optional must_exist If set, string must exist, and
acl_check() must
+ * * owner_id phpGW ID to check access for.
+ * * Default:
$GLOBALS['phpgw_info']['user']['account_id']
+ * * must_exist If set, string must exist, and
acl_check() must
* return False if it doesn't. If
must_exist isn't
* passed, and string doesn't exist, check
the owner_id's
* access to the parent directory, if it
exists.
- * @result Boolean. True if access is ok, False otherwise.
+ * * @return Boolean. True if access is ok, False otherwise.
*/
function acl_check ($data) { return True; }
@@ -540,25 +540,25 @@
* mkdir - Create directory
*/
- /*!
- * @function read
- * @abstract Retreive file contents
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result String. Contents of 'string', or False on error.
+ /**
+ * * Retreive file contents
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return String. Contents of 'string', or False on error.
*/
function read ($data) { return False; }
- /*!
- @function view
- @abstract Views the specified file (does not return!)
- @param string filename
- @param relatives Relativity array
- @result None (doesnt return)
- @discussion By default this function just reads the file and
- outputs it too the browser, after setting the content-type
header
- appropriately. For some other VFS implementations though, there
- may be some more sensible way of viewing the file.
+ /**
+ * Views the specified file (does not return!)
+ *
+ * @param string filename
+ * @param relatives Relativity array
+ * @return None (doesnt return)
+ * By default this function just reads the file and
+ * outputs it too the browser, after setting the content-type
header
+ * appropriately. For some other VFS implementations though,
there
+ * may be some more sensible way of viewing the file.
*/
function view($data)
{
@@ -599,61 +599,61 @@
exit();
}
- /*!
- * @function write
- * @abstract Store file contents
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ /**
+ * * Store file contents
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function write ($data) { return False; }
- /*!
- * @function touch
- * @abstract Create a file if it doesn't exist.
+ /**
+ * * Create a file if it doesn't exist.
+ * *
* Optionally, update the modified time and
* modified user if the file exists.
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function touch ($data) { return False; }
- /*!
- * @function cp
- * @abstract Copy location
- * @required from Path to location to copy from
- * @required to Path to location to copy to
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT, RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ /**
+ * * Copy location
+ * *
+ * * from Path to location to copy from
+ * * to Path to location to copy to
+ * * relatives Relativity array (default: RELATIVE_CURRENT,
RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function cp ($data) { return False; }
- /*!
- * @function mv
- * @abstract Move location
- * @required from Path to location to move from
- * @required to Path to location to move to
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT, RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ /**
+ * * Move location
+ * *
+ * * from Path to location to move from
+ * * to Path to location to move to
+ * * relatives Relativity array (default: RELATIVE_CURRENT,
RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function mv ($data) { return False; }
- /*!
- * @function rm
- * @abstract Delete location
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ /**
+ * * Delete location
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function rm ($data) { return False; }
- /*!
- * @function mkdir
- * @abstract Create directory
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ /**
+ * * Create directory
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function mkdir ($data) { return False; }
@@ -676,25 +676,25 @@
* ls - Return detailed information for location(s)
*/
- /*!
- * @function set_attributes
- * @abstract Set attributes for a location
- * @discussion Valid attributes are listed in vfs->attributes,
+ /**
+ * * Set attributes for a location
+ * *
+ * * Valid attributes are listed in vfs->attributes,
* which may be extended by each derived class
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @optional attributes Keyed array of attributes. Key is
attribute
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * attributes Keyed array of attributes. Key is
attribute
* name, value is attribute value.
- * @result Boolean. True on success, False otherwise.
+ * * @return Boolean. True on success, False otherwise.
*/
function set_attributes ($data) { return False; }
- /*!
- @function correct_attributes
- @abstract Set the correct attributes for 'string' (e.g. owner)
- @param string File/directory to correct attributes of
- @param relatives Relativity array
- @result Boolean True/False
+ /**
+ * Set the correct attributes for 'string' (e.g. owner)
+ *
+ * @param string File/directory to correct attributes of
+ * @param relatives Relativity array
+ * @return Boolean True/False
*/
function correct_attributes ($data)
{
@@ -752,23 +752,23 @@
return True;
}
- /*!
- * @function file_exists
- * @abstract Check if a location (file or directory) exists
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result Boolean. True if file exists, False otherwise.
+ /**
+ * * Check if a location (file or directory) exists
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return Boolean. True if file exists, False otherwise.
*/
function file_exists ($data) { return False; }
- /*!
- * @function get_size
- * @abstract Determine size of location
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @optional checksubdirs Boolean. If set, include the
size of
+ /**
+ * * Determine size of location
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * checksubdirs Boolean. If set, include the size of
* all subdirectories recursively.
- * @result Integer. Size of location in bytes.
+ * * @return Integer. Size of location in bytes.
*/
function get_size ($data)
{
@@ -845,20 +845,20 @@
return $size;
}
- /*!
- * @function ls
- * @abstract Return detailed information for location(s)
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @optional checksubdirs Boolean. If set, return
information for all
+ /**
+ * * Return detailed information for location(s)
+ * *
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * checksubdirs Boolean. If set, return information
for all
* subdirectories recursively.
- * @optional mime String. Only return information for
locations with MIME type
+ * * mime String. Only return information for locations
with MIME type
* specified. VFS classes must recogize
these special types:
* "Directory" - Location is a
directory
* " " - Location doesn't not have
a MIME type
- * @optional nofiles Boolean. If set and 'string' is a
directory, return
+ * * nofiles Boolean. If set and 'string' is a directory,
return
* information about the directory, not
the files in it.
- * @result Array of arrays of file information.
+ * * @return Array of arrays of file information.
* Keys may vary depending on the implementation, but
must include
* at least those attributes listed in
$this->attributes.
*/
@@ -891,13 +891,13 @@
* make_link - Create a real to virtual directory link
*/
- /*!
- * @function make_link
- * @abstract Create a real to virtual directory link
- * @required rdir Real directory to make link from/to
- * @required vdir Virtual directory to make link to/from
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT, RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ /**
+ * * Create a real to virtual directory link
+ * *
+ * * rdir Real directory to make link from/to
+ * * vdir Virtual directory to make link to/from
+ * * relatives Relativity array (default: RELATIVE_CURRENT,
RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function make_link ($data) { return False; }
@@ -910,17 +910,17 @@
* up-to-date
*/
- /*!
- * @function update_real
- * @abstract Ensure that information about a location is
up-to-date
- * @discussion Some VFS backends store information about
locations
+ /**
+ * * Ensure that information about a location is up-to-date
+ * *
+ * * Some VFS backends store information about locations
* in a secondary location, for example in a
database
* or in a cache file. update_real() can be called
to
* ensure that the information in the secondary
location
* is up-to-date.
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @result Boolean. True on success, False otherwise.
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * @return Boolean. True on success, False otherwise.
*/
function update_real ($data) { return False; }
@@ -984,13 +984,13 @@
/* PRIVATE functions */
- /*!
- @function checkperms
- @abstract Check if $this->working_id has write access to create
files in $dir
- @discussion Simple call to acl_check
- @param string Directory to check access of
- @param relatives Relativity array
- @result Boolean True/False
+ /**
+ * Check if $this->working_id has write access to create files
in $dir
+ *
+ * Simple call to acl_check
+ * @param string Directory to check access of
+ * @param relatives Relativity array
+ * @return Boolean True/False
*/
function checkperms ($data)
{
@@ -1027,13 +1027,13 @@
}
}
- /*!
- * @function securitycheck
- * @abstract Check if location string is ok to use in VFS
functions
- * @discussion Checks for basic violations such as ..
+ /**
+ * * Check if location string is ok to use in VFS functions
+ * *
+ * * Checks for basic violations such as ..
* If securitycheck () fails, run your string
through $this->sanitize ()
- * @required string Path to location
- * @result Boolean. True if string is ok, False otherwise.
+ * * string Path to location
+ * * @return Boolean. True if string is ok, False otherwise.
*/
function securitycheck ($data)
{
@@ -1052,16 +1052,16 @@
}
}
- /*!
- * @function sanitize
- * @abstract Remove any possible security problems from a
location
+ /**
+ * * Remove any possible security problems from a location
+ * *
* string (i.e. remove leading '..')
- * @discussion You should not pass all filenames through
sanitize ()
+ * * You should not pass all filenames through sanitize ()
* unless you plan on rejecting .files. Instead,
pass
* the name through securitycheck () first, and if
it fails,
* pass it through sanitize.
- * @required string Path to location
- * @result String. 'string' with any security problems fixed.
+ * * string Path to location
+ * * @return String. 'string' with any security problems fixed.
*/
function sanitize ($data)
{
@@ -1080,15 +1080,15 @@
return (ereg_replace ("^\.+", '', $p->fake_name));
}
- /*!
- * @function clean_string
- * @abstract Clean location string. This function is used if
+ /**
+ * * Clean location string. This function is used if
+ * *
* any special characters need to be escaped or
removed
* before accessing a database, network protocol, etc.
* The default is to escape characters before doing
an SQL
* query.
- * @required string Location string to clean
- * @result String. Cleaned version of 'string'.
+ * * string Location string to clean
+ * * @return String. Cleaned version of 'string'.
*/
function clean_string ($data)
{
@@ -1102,22 +1102,22 @@
return $string;
}
- /*!
- * @function getabsolutepath
- * @abstract Translate a location string depending on the
+ /**
+ * * Translate a location string depending on the
+ * *
* relativity. This is the only function that is
* directly concerned with relativity.
- * @optional string Path to location, relative to mask[0].
- * Defaults to empty string.
- * @optional mask Relativity array (default:
RELATIVE_CURRENT)
- * @optional fake Boolean. If set, returns the 'fake'
path,
+ * * string Path to location, relative to mask[0].
+ * * Defaults to empty string.
+ * * mask Relativity array (default: RELATIVE_CURRENT)
+ * * fake Boolean. If set, returns the 'fake' path,
* i.e. /home/user/dir/file. This is not
always
* possible, use path_parts() instead.
- * @result String. Full fake or real path, or False on error.
+ * * @return String. Full fake or real path, or False on error.
*/
- function getabsolutepath ($data)
+ function getabsolutepath ($data = array())
{
- if (!is_array ($data))
+ if ( !is_array ($data) )
{
$data = array ();
}
@@ -1225,13 +1225,13 @@
return $basedir;
}
- /*!
- * @function get_ext_mime_type
- * @abstract Return MIME type based on file extension
- * @description Internal use only. Applications should call
vfs->file_type ()
- * @author skeeter
- * @required string Real path to file, with or without
leading paths
- * @result String. MIME type based on file extension.
+ /**
+ * * Return MIME type based on file extension
+ * *
+ * * Internal use only. Applications should call
vfs->file_type ()
+ * * @author skeeter
+ * * string Real path to file, with or without leading paths
+ * * @return String. MIME type based on file extension.
*/
function get_ext_mime_type ($data)
{
@@ -1274,26 +1274,26 @@
until you want to overload them ! (except file_type)
*/
- /*!
- * @function file_type
- * @abstract Return a string contianing the mime-type of the
given data
- * @param array $data : contains 'string' => path to what we
want to get the mimetype
- * 'relatives' (optional) =>
array of relatives
- * @return string $mime-type, could be empty if we don't know
the file type,
- * or perhaps a default mime-type (what about
'application/octet-stream' ?)
+ /**
+ * * Return a string contianing the mime-type of the given data
+ * *
+ * * @param array $data : contains 'string' => path to what we
want to get the mimetype
+ * * 'relatives' (optional) =>
array of relatives
+ * * @return string $mime-type, could be empty if we don't
know the file type,
+ * * or perhaps a default mime-type (what about
'application/octet-stream' ?)
*/
function file_type($data)
{
return 'application/octet-stream';
}
- /*!
- * @function set_relative
- * @abstract Sets the current relativity, the relativity used
+ /**
+ * * Sets the current relativity, the relativity used
+ * *
* when RELATIVE_CURRENT is passed to a function
- * @optional mask Relative bitmask. If not set,
relativity
+ * * mask Relative bitmask. If not set, relativity
* will be returned to the default.
- * @result Void
+ * * @return Void
*/
function set_relative ($data)
{
@@ -1312,12 +1312,12 @@
}
}
- /*!
- * @function get_relative
- * @abstract Return the current relativity
- * @discussion Returns relativity bitmask, or the default
+ /**
+ * * Return the current relativity
+ * *
+ * * Returns relativity bitmask, or the default
* of "completely relative" if unset
- * @result Integer. One of the RELATIVE_* defines.
+ * * @return Integer. One of the RELATIVE_* defines.
*/
function get_relative ()
{
@@ -1331,19 +1331,19 @@
}
}
- /*!
- * @function path_parts
- * @abstract Return information about the component parts of a
location string
- * @discussion Most VFS functions call path_parts() with their
'string' and
+ /**
+ * * Return information about the component parts of a
location string
+ * *
+ * * Most VFS functions call path_parts() with their 'string'
and
* 'relatives' arguments before doing their work,
in order to
* determine the file/directory to work on.
- * @required string Path to location
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
- * @optional object If set, return an object instead of an
array
- * @optional nolinks Don't check for linked directories
(made with
+ * * string Path to location
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
+ * * object If set, return an object instead of an array
+ * * nolinks Don't check for linked directories (made with
* make_link()). Used internally to
prevent recursion.
- * @result Array or object. Contains the fake and real
component parts of the path.
- * @discussion Returned values are:
+ * * @return Array or object. Contains the fake and real
component parts of the path.
+ * * Returned values are:
* mask
* outside
* fake_full_path
@@ -1530,7 +1530,7 @@
if ($data['object'])
{
- $robject = new path_class;
+ $robject =& new path_class;
reset ($rarray);
while (list ($key, $value) = each ($rarray))
@@ -1560,22 +1560,22 @@
}
}
- /*!
- * @function cd
- * @abstract Change current directory. This function is used
to store the
+ /**
+ * * Change current directory. This function is used to store
the
+ * *
* current directory in a standard way, so that it
may be accessed
* throughout phpGroupWare to provide a consistent
view for the user.
- * @discussion To cd to the root '/', use:
+ * * To cd to the root '/', use:
* cd (array(
* 'string' => '/',
* 'relative' => False,
* 'relatives' => array (RELATIVE_NONE)
* ));
- * @optional string Directory location to cd into. Default
is '/'.
- * @optional relative If set, add target to current path.
+ * * string Directory location to cd into. Default is '/'.
+ * * relative If set, add target to current path.
* Else, pass 'relative' as mask to
getabsolutepath()
* Default is True.
- * @optional relatives Relativity array (default:
RELATIVE_CURRENT)
+ * * relatives Relativity array (default: RELATIVE_CURRENT)
*/
function cd ($data = '')
{
@@ -1641,13 +1641,13 @@
return True;
}
- /*!
- * @function pwd
- * @abstract Return current directory
- * @optional full If set, return full fake path, else just
+ /**
+ * * Return current directory
+ * *
+ * * full If set, return full fake path, else just
* the extra dirs (False strips the
leading /).
* Default is True.
- * @result String. The current directory.
+ * * @return String. The current directory.
*/
function pwd ($data = '')
{
@@ -1680,53 +1680,53 @@
return $currentdir;
}
- /*!
- * @function copy
- * @abstract shortcut to cp
+ /**
+ * * shortcut to cp
+ * *
*/
function copy ($data)
{
return $this->cp ($data);
}
- /*!
- * @function move
- * @abstract shortcut to mv
+ /**
+ * * shortcut to mv
+ * *
*/
function move ($data)
{
return $this->mv ($data);
}
- /*!
- * @function delete
- * @abstract shortcut to rm
+ /**
+ * * shortcut to rm
+ * *
*/
function delete ($data)
{
return $this->rm ($data);
}
- /*!
- * @function dir
- * @abstract shortcut to ls
+ /**
+ * * shortcut to ls
+ * *
*/
function dir ($data)
{
return $this->ls ($data);
}
- /*!
- * @function command_line
- * @abstract Process and run a Unix-sytle command line
- * @discussion EXPERIMENTAL. DANGEROUS. DO NOT USE THIS
UNLESS YOU
+ /**
+ * * Process and run a Unix-sytle command line
+ * *
+ * * EXPERIMENTAL. DANGEROUS. DO NOT USE THIS UNLESS YOU
* KNOW WHAT YOU'RE DOING!
- * This is mostly working, but the command parser
needs
+ * * This is mostly working, but the command parser
needs
* to be improved to take files with spaces into
* consideration (those should be in "").
- * @required command_line Unix-style command line with
one of the
+ * * command_line Unix-style command line with one of the
* commands in the $args array
- * @result The return value of the actual VFS call
+ * * @return The return value of the actual VFS call
*/
function command_line ($data)
{
@@ -1830,21 +1830,23 @@
}
/* Helper functions, not public */
-
function default_values ($data, $default_values)
{
if(!is_array($data))
{
- $data=array();
+ $data = array();
}
- for ($i = 0; list ($key, $value) = each
($default_values); $i++)
+
+ if ( is_array($default_values) &&
count($default_values) )
{
- if (!isset ($data[$key]))
+ foreach ( $default_values as $key => $value )
+ {
+ if ( !isset($data[$key]) )
{
$data[$key] = $value;
}
}
-
+ }
return $data;
}
}
Index: class.vfs_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.vfs_sql.inc.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- class.vfs_sql.inc.php 26 Apr 2005 10:55:25 -0000 1.32
+++ class.vfs_sql.inc.php 16 Aug 2006 14:18:45 -0000 1.33
@@ -8,7 +8,7 @@
* @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage vfs
- * @version $Id: class.vfs_sql.inc.php,v 1.32 2005/04/26 10:55:25
powerstat Exp $
+ * @version $Id: class.vfs_sql.inc.php,v 1.33 2006/08/16 14:18:45
skwashd Exp $
*/
/**
@@ -39,13 +39,13 @@
{
var $file_actions;
- /*!
- @function vfs
- @abstract constructor, sets up variables
+ /**
+ * constructor, sets up variables
+ *
*/
function vfs ()
{
- $this->vfs_shared ();
+ parent::vfs_shared();
/*
File/dir attributes, each corresponding to a
database field. Useful for use in loops
If an attribute was added to the table, add it here
and possibly add it to
@@ -62,7 +62,7 @@
unlink(), rmdir(), touch(), etc.). If not, then
we're working completely
in the database.
*/
- $conf = CreateObject('phpgwapi.config', 'phpgwapi');
+ $conf =& CreateObject('phpgwapi.config', 'phpgwapi');
$conf->read_repository();
if ($conf->config_data['file_store_contents'] ==
'filesystem' || !$conf->config_data['file_store_contents'])
{
@@ -104,13 +104,13 @@
}
}
- /*!
- @function in_docroot
- @abstract test if $path lies within the webservers document-root
+ /**
+ * test if $path lies within the webservers document-root
+ *
*/
function in_docroot($path)
{
- $docroots =
array(PHPGW_SERVER_ROOT,$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']);
+ $docroots = array(PHPGW_SERVER_ROOT,
$_SERVER['DOCUMENT_ROOT']);
foreach ($docroots as $docroot)
{
@@ -129,11 +129,11 @@
return False;
}
- /*!
- @function extra_sql
- @abstract Return extra SQL code that should be appended to
certain queries
- @param query_type The type of query to get extra SQL code for,
in the form of a VFS_SQL define
- @result Extra SQL code
+ /**
+ * Return extra SQL code that should be appended to certain
queries
+ *
+ * @param query_type The type of query to get extra SQL code
for, in the form of a VFS_SQL define
+ * @return Extra SQL code
*/
function extra_sql ($data)
{
@@ -160,30 +160,30 @@
return ($sql);
}
- /*!
- @function add_journal
- @abstract Add a journal entry after (or before) completing an
operation,
- and increment the version number. This function
should be used internally only
- @discussion Note that state_one and state_two are ignored for
some VFS_OPERATION's, for others
- they are required. They are ignored for any
"custom" operation
- The two operations that require state_two:
- operation state_two
- VFS_OPERATION_COPIED fake_full_path of
copied to
- VFS_OPERATION_MOVED fake_full_path of moved
to
-
- If deleting, you must call add_journal () before
you delete the entry from the database
- @param string File or directory to add entry for
- @param relatives Relativity array
- @param operation The operation that was performed. Either a
VFS_OPERATION define or
- a non-integer descriptive text string
- @param state_one The first "state" of the file or directory.
Can be a file name, size,
- location, whatever is appropriate for the
specific operation
- @param state_two The second "state" of the file or directory
- @param incversion Boolean True/False. Increment the version
for the file? Note that this is
- handled automatically for the VFS_OPERATION
defines.
- i.e. VFS_OPERATION_EDITED would increment
the version, VFS_OPERATION_COPIED
- would not
- @result Boolean True/False
+ /**
+ * Add a journal entry after (or before) completing an
operation,
+ *
+ * and increment the version number. This function
should be used internally only
+ * Note that state_one and state_two are ignored for some
VFS_OPERATION's, for others
+ * * they are required. They are ignored for any
"custom" operation
+ * * The two operations that require state_two:
+ * * operation * state_two
+ * * VFS_OPERATION_COPIED fake_full_path of
copied to
+ * * VFS_OPERATION_MOVED *
fake_full_path of moved to
+
+ * * If deleting, you must call add_journal ()
before you delete the entry from the database
+ * @param string File or directory to add entry for
+ * @param relatives Relativity array
+ * @param operation The operation that was performed. Either a
VFS_OPERATION define or
+ * * a non-integer descriptive text string
+ * @param state_one The first "state" of the file or directory.
Can be a file name, size,
+ * * location, whatever is appropriate for the
specific operation
+ * @param state_two The second "state" of the file or directory
+ * @param incversion Boolean True/False. Increment the version
for the file? Note that this is
+ * * handled automatically for the
VFS_OPERATION defines.
+ * * i.e. VFS_OPERATION_EDITED would increment
the version, VFS_OPERATION_COPIED
+ * * would not
+ * @return Boolean True/False
*/
function add_journal ($data)
{
@@ -476,17 +476,17 @@
return True;
}
- /*!
- @function flush_journal
- @abstract Flush journal entries for $string. Used before
adding $string
- @discussion flush_journal () is an internal function and should
be called from add_journal () only
- @param string File/directory to flush journal entries of
- @param relatives Realtivity array
- @param deleteall Delete all types of journal entries, including
the active Create entry.
- Normally you only want to delete the Create
entry when replacing the file
- Note that this option does not effect
$deleteonly
- @param deletedonly Only flush 'journal-deleted' entries
(created when $string was deleted)
- @result Boolean True/False
+ /**
+ * Flush journal entries for $string. Used before adding
$string
+ *
+ * flush_journal () is an internal function and should be
called from add_journal () only
+ * @param string File/directory to flush journal entries of
+ * @param relatives Realtivity array
+ * @param deleteall Delete all types of journal entries,
including the active Create entry.
+ * * Normally you only want to delete the
Create entry when replacing the file
+ * * Note that this option does not effect
$deleteonly
+ * @param deletedonly Only flush 'journal-deleted' entries
(created when $string was deleted)
+ * @return Boolean True/False
*/
function flush_journal ($data)
{
@@ -600,6 +600,7 @@
*/
function acl_check ($data)
{
+ //echo 'checking vfs_sql::acl_check(' . print_r($data,
true) . '</pre>';
if (!is_array ($data))
{
$data = array ();
@@ -725,7 +726,7 @@
}
}
- $acl = CreateObject ('phpgwapi.acl', $owner_id);
+ $acl =& CreateObject ('phpgwapi.acl', $owner_id);
$acl->account_id = $owner_id;
$acl->read_repository ();
@@ -747,7 +748,7 @@
}
elseif (!$rights && $group_ok)
{
- $conf = CreateObject('phpgwapi.config',
'phpgwapi');
+ $conf =& CreateObject('phpgwapi.config',
'phpgwapi');
$conf->read_repository();
if ($conf->config_data['acl_default'] ==
'grant')
{
@@ -797,7 +798,7 @@
return False;
}
- $conf = CreateObject('phpgwapi.config', 'phpgwapi');
+ $conf =& CreateObject('phpgwapi.config', 'phpgwapi');
$conf->read_repository();
if ($this->file_actions || $p->outside)
{
@@ -885,7 +886,7 @@
)
);
- $conf = CreateObject('phpgwapi.config', 'phpgwapi');
+ $conf =& CreateObject('phpgwapi.config', 'phpgwapi');
$conf->read_repository();
if ($this->file_actions)
{
@@ -2102,15 +2103,15 @@
We don't use ls () because it calls file_type () to
determine if it has been
passed a directory
*/
- $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 = clone($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->f('mime_type');
if(!$mime_type)
{
$mime_type = $this->get_ext_mime_type (array
('string' => $data['string']));
{
- $db2->query ("UPDATE phpgw_vfs SET
mime_type='".$mime_type."' 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->query ("UPDATE phpgw_vfs SET
mime_type='{$mime_type}' WHERE directory='{$p->fake_leading_dirs_clean}' AND
name='{$p->fake_name_clean}'" . $this->extra_sql (array ('query_type' =>
VFS_SQL_SELECT)), __LINE__, __FILE__);
}
}
@@ -2147,8 +2148,8 @@
return $rr;
}
- $db2 = $GLOBALS['phpgw']->db;
- $db2->query ("SELECT name 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 = clone($GLOBALS['phpgw']->db);
+ $db2->query ("SELECT name 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__);
if ($db2->next_record ())
{
@@ -2182,7 +2183,6 @@
function Record()
{
$values = array();
- reset ($this->attributes);
foreach($this->attributes as $attribute)
{
$values[$attribute] =
$GLOBALS['phpgw']->db->f($attribute);
@@ -2210,6 +2210,7 @@
);
$data = array_merge ($this->default_values ($data,
$default_values), $data);
+ //_debug_array($data);
$p = $this->path_parts(array(
'string' => $data['string'],
@@ -2219,28 +2220,15 @@
//_debug_array($p);
- $dir = $p->fake_full_path;
+ $ftype = $this->file_type( array('string' =>
$p->fake_full_path, 'relatives' => array ($p->mask) ) );
/* 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 ( ($ftype != 'Directory' || $data['nofiles'] ) &&
!$p->outside)
{
/* SELECT all, the, attributes */
- $sql = 'SELECT ';
+ $sql = 'SELECT ' . $sql .= implode(', ',
$this->attributes)
+ . " 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));
- //echo 'vfs_sql->ls: attributes: ' .
_debug_array($this->attributes);
- reset ($this->attributes);
- while (list ($num, $attribute) = each
($this->attributes))
- {
- if ($num)
- {
- $sql .= ', ';
- }
-
- $sql .= $attribute;
- }
-
- $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));
-
- //echo 'sql-string:' . $sql;
$query = $GLOBALS['phpgw']->db->query ($sql,
__LINE__, __FILE__);
$GLOBALS['phpgw']->db->next_record();
@@ -2254,7 +2242,7 @@
{
if ($attribute == 'mime_type' &&
!$record[$attribute])
{
- $db2 = $GLOBALS['phpgw']->db;
+ $db2 =
clone($GLOBALS['phpgw']->db);
$record[$attribute] =
$this->get_ext_mime_type (array(
'string' =>
$p->fake_name_clean
)
@@ -2262,7 +2250,7 @@
if($record[$attribute])
{
- $db2->query ("UPDATE
phpgw_vfs SET mime_type='".$record[$attribute]."' 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->query ("UPDATE
phpgw_vfs SET mime_type='{$record[$attribute]}' WHERE
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" .
$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
}
}
@@ -2312,21 +2300,9 @@
/* $dir's not a file, is inside the virtual root, and
they want to check subdirs */
/* SELECT all, the, attributes FROM phpgw_vfs WHERE
file=$dir */
- $sql = 'SELECT ';
+ $sql = 'SELECT ' . implode(',', $this->attributes);
- reset ($this->attributes);
-
- while (list ($num, $attribute) = each
($this->attributes))
- {
- if ($num)
- {
- $sql .= ", ";
- }
-
- $sql .= $attribute;
- }
-
- $dir_clean = $this->clean_string (array ('string' =>
$dir));
+ $dir_clean = $this->clean_string (array ('string' =>
$p->fake_full_path));
$sql .= " FROM phpgw_vfs WHERE directory LIKE
'$dir_clean%'";
$sql .= $this->extra_sql (array ('query_type' =>
VFS_SQL_SELECT));
@@ -2340,43 +2316,36 @@
$query = $GLOBALS['phpgw']->db->query ($sql, __LINE__,
__FILE__);
$rarray = array ();
- for ($i = 0; $GLOBALS['phpgw']->db->next_record ();
$i++)
+ while ( $GLOBALS['phpgw']->db->next_record() )
{
$record = $this->Record();
+ //_debug_array($record);
/* Further checking on the directory. This
makes sure /home/user/test won't match /home/user/test22 */
- if (address@hidden ("^$dir(/|$)",
$record['directory']))
+ if (address@hidden
("^{$p->fake_full_path}(/|$)", $record['directory']))
{
continue;
}
/* If they want only this directory, then $dir
should end without a trailing / */
- if (!$data['checksubdirs'] && ereg ("^$dir/",
$record['directory']))
+ if (!$data['checksubdirs'] && ereg
("^{$p->fake_full_path}/", $record['directory']))
{
continue;
}
- reset ($this->attributes);
- while (list ($num, $attribute) = each
($this->attributes))
+ $db2 = clone($GLOBALS['phpgw']->db);
+ if ( isset($this->attributes['mime_type']) &&
!isset($record['mime_type']) )
{
- if ($attribute == 'mime_type' &&
!$record[$attribute])
- {
- $db2 = $GLOBALS['phpgw']->db;
- $record[$attribute] =
$this->get_ext_mime_type (array(
- 'string'
=> $p->fake_name_clean
- )
- );
+ $record['mime_type'] ==
$this->get_ext_mime_type(array('string' => $p->fake_name_clean));
- if($record[$attribute])
+ if ( $record['mime_type'] )
{
- $db2->query ("UPDATE
phpgw_vfs SET mime_type='".$record[$attribute]."' 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->query ("UPDATE phpgw_vfs
SET mime_type='{$record[$attribute]}' WHERE
directory='{$p->fake_leading_dirs_clean}' AND name='{$p->fake_name_clean}'" .
$this->extra_sql(array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__);
- $rarray[$i][$attribute] =
$record[$attribute];
}
}
-
+ $rarray[] = $record;
+ }
return $rarray;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.vfs_dav.inc.php class.vfs.in...,
Dave Hall <=