From 813c3ab5cd6ebbc8b84abddba01871e67deed023 Mon Sep 17 00:00:00 2001 From: zone Date: Mon, 24 Sep 2001 18:17:26 +0000 Subject: [PATCH] Removed array () as default value in function prototypes per loic's patch #464195 --- phpgwapi/inc/class.vfs_sql.inc.php | 187 ++++++++++++++++++++++++----- 1 file changed, 154 insertions(+), 33 deletions(-) diff --git a/phpgwapi/inc/class.vfs_sql.inc.php b/phpgwapi/inc/class.vfs_sql.inc.php index e90f8d102f..4841c8c6a3 100644 --- a/phpgwapi/inc/class.vfs_sql.inc.php +++ b/phpgwapi/inc/class.vfs_sql.inc.php @@ -283,10 +283,15 @@ @result Boolean True/False */ - function add_journal ($string, $relatives = array (RELATIVE_CURRENT), $operation, $state_one = False, $state_two = False, $incversion = True) + function add_journal ($string, $relatives = '', $operation, $state_one = False, $state_two = False, $incversion = True) { global $phpgw, $phpgw_info; - + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $account_id = $phpgw_info["user"]["account_id"]; $p = $this->path_parts ($string, array ($relatives[0])); @@ -529,9 +534,14 @@ @result Boolean True/False */ - function flush_journal ($string, $relatives = array (RELATIVE_CURRENT), $deleteall = False, $deletedonly = False) + function flush_journal ($string, $relatives = '', $deleteall = False, $deletedonly = False) { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } $p = $this->path_parts ($string, array ($relatives[0])); @@ -572,9 +582,14 @@ @result Array of arrays of journal entries */ - function get_journal ($string, $relatives = array (RELATIVE_CURRENT), $type = False) + function get_journal ($string, $relatives = '', $type = False) { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } $p = $this->path_parts ($string, array ($relatives[0])); @@ -644,9 +659,15 @@ outside is boolean, True if $relatives contains VFS_REAL */ - function path_parts ($string, $relatives = array (RELATIVE_CURRENT), $object = True, $nolinks = False) + function path_parts ($string, $relatives = '', $object = True, $nolinks = False) { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $sep = SEP; $rarray["mask"] = RELATIVE_NONE; @@ -807,10 +828,10 @@ @result $basedir Full fake or real path */ - function getabsolutepath ($target = False, $relatives = array (RELATIVE_CURRENT), $fake = True) + function getabsolutepath ($target = False, $relatives = '', $fake = True) { global $phpgw, $phpgw_info; - + $currentdir = $this->pwd (False); if (!is_array ($relatives)) @@ -912,9 +933,14 @@ @result Boolean. True if access is ok, False otherwise */ - function acl_check ($file, $relatives = array (RELATIVE_CURRENT), $operation = PHPGW_ACL_READ, $must_exist = False) + function acl_check ($file, $relatives = '', $operation = PHPGW_ACL_READ, $must_exist = False) { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } /* Accommodate special situations */ if ($this->override_acl) @@ -1034,9 +1060,14 @@ @param $relatives Relativity array */ - function cd ($target = "/", $relative = True, $relatives = array (RELATIVE_CURRENT)) + function cd ($target = "/", $relative = True, $relatives = '') { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } if ($relatives[0] & VFS_REAL) { @@ -1105,10 +1136,15 @@ @result $contents Contents of $file, or False if file cannot be read */ - function read ($file, $relatives = array (RELATIVE_CURRENT)) + function read ($file, $relatives = '') { global $phpgw; global $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } $p = $this->path_parts ($file, array ($relatives[0])); @@ -1139,11 +1175,16 @@ @result Boolean True/False */ - function write ($file, $relatives = array (RELATIVE_CURRENT), $contents) + function write ($file, $relatives = '', $contents) { global $phpgw; global $phpgw_info; - + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($file, array ($relatives[0])); if ($this->file_exists ($p->fake_full_path, array ($p->mask))) @@ -1197,10 +1238,15 @@ @result Boolean True/False */ - function touch ($file, $relatives = array (RELATIVE_CURRENT)) + function touch ($file, $relatives = '') { global $phpgw, $phpgw_info; - + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $account_id = $phpgw_info["user"]["account_id"]; $currentapp = $phpgw_info["flags"]["currentapp"]; @@ -1263,10 +1309,15 @@ @result boolean True/False */ - function cp ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT)) + function cp ($from, $to, $relatives = '') { global $phpgw; global $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT); + } $account_id = $phpgw_info["user"]["account_id"]; @@ -1367,10 +1418,10 @@ return True; } - function copy ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT)) + function copy ($from, $to, $relatives = '') { umask (000); - return $this->cp ($from, $to); + return $this->cp ($from, $to, $relatives); } /*! @@ -1382,11 +1433,16 @@ @result boolean True/False */ - function mv ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT)) + function mv ($from, $to, $relatives = '') { global $phpgw; global $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT); + } + $account_id = $phpgw_info["user"]["account_id"]; $f = $this->path_parts ($from, array ($relatives[0])); @@ -1498,7 +1554,7 @@ @abstract shortcut to mv */ - function move ($from, $to, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT)) + function move ($from, $to, $relatives = '') { umask (000); return $this->mv ($from, $to, $relatives); @@ -1512,11 +1568,16 @@ @result boolean True/False */ - function rm ($string, $relatives = array (RELATIVE_CURRENT)) + function rm ($string, $relatives = '') { global $phpgw; global $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($string, array ($relatives[0])); if (!$this->acl_check ($p->fake_full_path, array ($p->mask), PHPGW_ACL_DELETE)) @@ -1608,7 +1669,7 @@ @abstract shortcut to rm */ - function delete ($string, $relatives = array (RELATIVE_CURRENT)) + function delete ($string, $relatives = '') { return $this->rm ($string, $relatives); } @@ -1621,11 +1682,16 @@ @result boolean True on success */ - function mkdir ($dir, $relatives = array (RELATIVE_CURRENT)) + function mkdir ($dir, $relatives = '') { global $phpgw; global $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $account_id = $phpgw_info["user"]["account_id"]; $currentapp = $phpgw_info["flags"]["currentapp"]; @@ -1678,11 +1744,16 @@ @result Boolean True/False */ - function make_link ($vdir, $rdir, $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT)) + function make_link ($vdir, $rdir, $relatives = '') { global $phpgw; global $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT, RELATIVE_CURRENT); + } + $account_id = $phpgw_info["user"]["account_id"]; $currentapp = $phpgw_info["flags"]["currentapp"]; @@ -1736,11 +1807,21 @@ version */ - function set_attributes ($file, $relatives = array (RELATIVE_CURRENT), $attributes = array ()) + function set_attributes ($file, $relatives = '', $attributes = '') { global $phpgw; global $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + + if (!is_array ($attributes)) + { + $attributes = array (); + } + $p = $this->path_parts ($file, array ($relatives[0])); /* @@ -1826,10 +1907,15 @@ @result Boolean True/False */ - function correct_attributes ($string, $relatives = array (RELATIVE_CURRENT)) + function correct_attributes ($string, $relatives = '') { global $phpgw; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($string, array ($relatives[0])); if ($p->fake_leading_dirs != $this->fakebase && $p->fake_leading_dirs != "/") @@ -1861,10 +1947,15 @@ @result MIME type, "Directory", or nothing if MIME type is not known */ - function file_type ($file, $relatives = array (RELATIVE_CURRENT)) + function file_type ($file, $relatives = '') { global $phpgw; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($file, array ($relatives[0])); if (!$this->acl_check ($p->fake_full_path, array ($p->mask), PHPGW_ACL_READ, True)) @@ -1904,10 +1995,15 @@ @result Boolean True/False */ - function file_exists ($string, $relatives = array (RELATIVE_CURRENT)) + function file_exists ($string, $relatives = '') { global $phpgw; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($string, array ($relatives[0])); if ($p->outside) @@ -1938,10 +2034,15 @@ @result Size of $string in bytes */ - function get_size ($string, $relatives = array (RELATIVE_CURRENT), $checksubdirs = True) + function get_size ($string, $relatives = '', $checksubdirs = True) { global $phpgw, $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($string, array ($relatives[0])); if (!$this->acl_check ($p->fake_full_path, array ($p->mask), PHPGW_ACL_READ, True)) @@ -1995,10 +2096,15 @@ @result Boolean True/False */ - function checkperms ($dir, $relatives = array (RELATIVE_CURRENT)) + function checkperms ($dir, $relatives = '') { global $phpgw, $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($dir, array ($relatives[0])); if (!$this->acl_check ($p->fake_full_path, array ($p->mask), PHPGW_ACL_ADD)) @@ -2026,10 +2132,15 @@ @result array of arrays. Subarrays contain full info for each file/dir. */ - function ls ($dir = False, $relatives = array (RELATIVE_CURRENT), $checksubdirs = True, $mime_type = False, $nofiles = False, $orderby = "directory") + function ls ($dir = False, $relatives = '', $checksubdirs = True, $mime_type = False, $nofiles = False, $orderby = "directory") { global $phpgw, $phpgw_info; + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } + $p = $this->path_parts ($dir, array ($relatives[0])); $dir = $p->fake_full_path; @@ -2155,7 +2266,7 @@ @abstract shortcut to ls */ - function dir ($dir = False, $relatives = array (RELATIVE_CURRENT), $checksubdirs = True, $mime_type = False, $nofiles = False, $orderby = "directory") + function dir ($dir = False, $relatives = '', $checksubdirs = True, $mime_type = False, $nofiles = False, $orderby = "directory") { return $this->ls ($dir, $relatives, $checksubdirs, $mime_type, $nofiles, $orderby); } @@ -2264,9 +2375,14 @@ @result Boolean True/False */ - function update_real ($string, $relatives = array (RELATIVE_CURRENT)) + function update_real ($string, $relatives = '') { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } $p = $this->path_parts ($string, array ($relatives[0])); @@ -2320,9 +2436,14 @@ /* Helper functions */ /* This fetchs all available file system information for $string (not using the database) */ - function get_real_info ($string, $relatives = array (RELATIVE_CURRENT)) + function get_real_info ($string, $relatives = '') { global $phpgw, $phpgw_info; + + if (!is_array ($relatives)) + { + $relatives = array (RELATIVE_CURRENT); + } $p = $this->path_parts ($string, array ($relatives[0]));