package.xml0000664000175000017500000014743012654104001011301 0ustar janjan Horde_Vfs pear.horde.org VFS Virtual File System API A Virtual File System API, with backends for: * SQL * FTP * Local filesystems * Hybrid SQL and filesystem * Samba * SSH2/SFTP * MongoDB Reading, writing and listing of files are all supported. Chuck Hagenbuch chuck chuck@horde.org yes Jan Schneider jan jan@horde.org yes 2016-02-02 2.3.1 2.3.0 stable stable LGPL-2.1 * [jan] Mark PHP 7 as supported. 5.3.0 8.0.0alpha1 8.0.0alpha1 1.7.0 Horde_Exception pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Translation pear.horde.org 2.2.0 3.0.0alpha1 3.0.0alpha1 Horde_Util pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Auth pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Core pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Db pear.horde.org 2.2.0 3.0.0alpha1 3.0.0alpha1 Horde_Kolab_Session pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Mime pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Perms pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Test pear.horde.org 2.1.0 3.0.0alpha1 3.0.0alpha1 ssh2 pecl.php.net 0.12 ssh2 ftp 0.0.1 0.0.1 alpha alpha 2002-09-24 LGPL-2.1 Initial release as a PEAR package 0.0.2 0.0.2 alpha alpha 2002-10-22 LGPL-2.1 Added an ObjectVFS wrapper class, returns a ListItem on each call to listFolder, until no items are left. 0.0.3 0.0.3 beta beta 2003-07-03 LGPL-2.1 Added a class for providing garbage collection; removed all Horde dependancies. 0.0.4 0.0.4 beta beta 2003-09-09 LGPL-2.1 * Default ftp driver to port 21. * Distinguish between connection and authentication errors in the ftp driver. * Clean up temporary files if the FTP driver wasn't able to retrieve a file. * Add exists() method. * Add emptyFolder() method. * Add $recursive parameter to all deleteFolder() implementations. * Add FTPS support. 0.0.5 0.0.5 beta beta 2005-04-07 LGPL-2.1 * Fix typo that prevented the sql_file driver to load its parameters. * PHP 5 compatibility fixes. * Add 'pasv' parameter for FTP driver. * Add writeData() method to sql_file driver. * Support ~/path when a 'home' parameter is defined. * Add a CLI script for accessing and modifying VFS backends. * Added getCurrentDirectory() method. * phpdoc has been updated and should now generate correctly in all files. * Return error if trying to copy a file onto itself with the file driver (http://bugs.horde.org/ticket/?id=168). * Several bug fixes to listFolders() method in SQL drivers. * A PEAR Log object can now be specified for logging messages to. * Added getParam() method. * Allow recursive listings in listFolder(). * Several fixes with zero length files. * Fixed autocreating of directories and updating of existing files in the sql_file VFS driver (http://bugs.horde.org/ticket/?id=1552, http://bugs.horde.org/ticket/?id=1553). * Added SQL scripts to create tables for SQL backends. 0.1.0 0.1.0 beta beta 2006-04-12 LGPL-2.1 * SQL drivers now return empty values if the particular parameter does not exist on the server (instead of '-'). * Add initial VFS quota support. * Fix autocreatePath() to work with directory paths that begin with the base directory. * Add 'maplocalids' and 'timeout' parameters to the FTP driver. * In SQL driver, allow '/' to indicate the base directory. * Fix return value of deleteFile() in File and SQLFile drivers (PEAR Bug #4425). * Fix listFolders() in File driver (PEAR Bug #4533). * Add size() and readByteRange(), with File and SQL implementations. * Add support for NetWare FTP server listings (Lukas Macura <macura@opf.slu.cz>). * Add support for separate read and write DB servers for the SQL driver. * Add copy() and move() fallback implementations for all drivers. * Add parameters to copy() and move() to automatically create destination directories. * Add SSH2/SFTP driver (Cliff Green <green@umdnj.edu>). * Let rename() automatically create the destination path. * Make sure copy/move doesn't result in infinite recursion (Horde Bug #3680). 0.2.0 0.2.0 beta beta 2008-02-16 LGPL-2.1 * Fix listing of folders with whitespace in the name using the SSH2 VFS driver (Horde Bug #6227). * Fix some string parsing on systems that don't have the 'en' or 'en_US' locales installed (Horde Bug #6194). * PHP 4.3.0+ is now required and we make unconditional use of file_get_contents(). * Use strlen() instead of empty() to check for paths and filenames being set, to allow for potential names of 0 (zero). * Converted to package.xml 2.0. * Fix saving files in the root directory of an SQL backend. * Never generate paths with double slashes in them (//) (Horde Bug #5821) * Improve Netware FTP support (Horde Bug #5821) * Add read stream support to some backends (Horde Bug #5913) * Make the smb backend compatible with samba versions after samba-3.0.25-pre2 (felix.leimbach@gmx.net, Horde Bug #5931) 2009-10-15 0.3.0 0.3.0 beta beta LGPL-2.1 * Allow access to files with multiple consecutive dots in the name (valentin.vidic@carnet.hr; Horde Bug #7646). * Rename fixes for SMB driver (leena.heino@uta.fi, Horde Bug #7933). * Set LC_TIME to C for consistency in date parsing in the SSH2 backend (michael-dev@fami-braun.de, Horde Bug #6396) * Pass -n for numeric UIDs/GIDs in the SSH2 backend when mapping to local user ids (Horde Request #6579) * Fix readByteRange() (wrong method name) in SQL backend * Add readFile() support, with optimizations for file, ftp, ssh2, and smb backends * Add readStream() support to backends that can get a stream resource efficiently * Add delete() as a shorter name for deleteFile() * Add a Kolab VFS driver. * Use streams for file transfers in VFS_ssh2 (jives@jives.ixum.net, Horde Request #8323) * Check quota when copying files (Horde Bug #8643). 1.0.0alpha1 1.0.0 alpha alpha 2011-03-08 LGPL-2.1 * First alpha release for Horde 4. 1.0.0beta1 1.0.0 beta beta 2011-03-16 LGPL-2.1 * Convert to PHP 5 and Horde 4 package layout. 1.0.0RC1 1.0.0 beta beta 2011-03-22 LGPL-2.1 * First release candidate for Horde 4. 1.0.0RC2 1.0.0 beta beta 2011-03-29 LGPL-2.1 * Second release candidate for Horde 4. * Fixed VFS folder creation (Bug #9711). 1.0.0 1.0.0 stable stable 2011-04-06 LGPL-2.1 * First stable release for Horde 4. 1.0.1 1.0.0 stable stable 2011-04-20 LGPL-2.1 * [jan] Fix creating folders with SQL driver (Bug #9894). * [jan] Fix creating temporary files with open_basedir restrictions. 1.0.2 1.0.0 stable stable 2011-05-18 LGPL-2.1 * [mms] Fix call to setAuth() (Bug #10027). 1.0.3 1.0.0 stable stable 2011-06-14 LGPL-2.1 * [jan] Fix garbage collection with SQL driver (Bug #10242). 1.0.4 1.0.0 stable stable 2011-07-27 LGPL-2.1 * [jan] Update Latvian translation. * [jan] Fix listing files with SSH2 driver if not using a bourne-style shell (lstewart@room52.net, Bug #9497). * [jan] Update Brazilian Portuguese translation. 1.0.5 1.0.0 stable stable 2011-09-20 LGPL-2.1 * [jan] Fix renaming and catching errors while reading sizes in SQL driver. * [jan] Fix reading file contents from FTP. 1.0.6 1.0.0 stable stable 2011-10-11 LGPL-2.1 * [jan] Fix setting permissions with File driver (Bug #10630). * [mms] Fix using File driver if vfsroot directory already exists (Bug #10584). * [mms] Fix internal reference to QUOTA_METRIC_* constants (Bug #10585). * [jan] Fix parsing of directory listings on /dev file systems in the SSH driver. 1.0.7 1.0.0 stable stable 2011-10-18 LGPL-2.1 * [jan] Fix reading file sizes from Samba backends. * [jan] Catch output from smbclient during error conditions (Bug #10638). * [jan] Implement size() method in Samba driver. 1.0.8 1.0.0 stable stable 2011-11-08 LGPL-2.1 * [gwr] Make unit tests timezone independent. 1.0.9 1.0.0 stable stable 2012-03-20 LGPL-2.1 * [jan] Fix inconsistent behavior of the different backend drivers. * [jan] Fix double unlink() of temporary files. * [jan] Fix ignored $dotfolder argument for listFolders() in SQL driver. * [jan] Fix several issues with quota calculation. * [jan] Fix recursive listFolder() on base directory. * [jan] Fix calculating folder sizes with similar folder names in SQL driver. 1.0.10 1.0.0 stable stable 2012-03-20 LGPL-2.1 * 2012-07-06 2.0.0alpha1 2.0.0alpha1 alpha alpha LGPL-2.1 * First alpha release for Horde 5. * [jan] Add hasFeature(). * [jan] Drop listFolders() method. * [jan] Remove Horde_Vfs_Browser, Horde_Vfs_ListItem, Horde_Vfs_Object classes. 2.0.0beta1 2.0.0beta1 beta beta 2012-07-19 LGPL-2.1 * First beta release for Horde 5. * [jan] Fix finding locale directory if installed with PEAR. 2.0.0beta2 2.0.0beta1 beta beta 2012-10-12 LGPL-2.1 * [jan] Fix sending and reading files in SSH2 driver if vfsroot is not set (Bug #11451). 2.0.0RC1 2.0.0beta1 beta beta 2012-10-26 LGPL-2.1 * [jan] Fix check whether quota limit is set (Bug #11455). 2.0.0 2.0.0 stable stable 2012-10-30 LGPL-2.1 * First stable release for Horde 5. 2.0.1 2.0.0 stable stable 2012-11-06 LGPL-2.1 * [jan] Update Dutch translation (Arjen de Korte <build+horde@de-korte.org>). 2.0.2 2.0.0 stable stable 2012-11-14 LGPL-2.1 * [jan] Fix old folder not being removed when moving a folder (Bug #11703). * [jan] Fix checking source and destination paths being the same (Bug #11702). 2.0.3 2.0.0 stable stable 2012-11-27 LGPL-2.1 * [jan] Fix deleting folders from absolute path in FTP backend (Bug #11761). 2.0.4 2.0.0 stable stable 2013-01-10 LGPL-2.1 * [jan] Update Basque translation (Ibon Igartua <ibon.igartua@ehu.es>). * [jan] Don't rely on PEAR to determine Windows OS in Samba backend. * [jan] Implement vfsroot parameter in Samba backend. 2.1.0 2.0.0 stable stable 2013-05-06 LGPL-2.1 * [mms] Add MongoDB storage driver. * [jan] Use ssh2_sftp_chmod() if available (ssh2 0.12). 2.1.1 2.0.0 stable stable 2013-07-16 LGPL-2.1 * [jan] Return more detailed error messages from File driver. 2.1.2 2.0.0 stable stable 2013-10-28 LGPL-2.1 * [jan] Bump minimum version of SSH2 extension to 0.12. 2.2.0 2.0.0 stable stable 2014-03-03 LGPL-2.1 * [jan] Remove broken Kolab driver. * [mms] Add null VFS driver. * [jan] Support Oracle with SQL driver. 2.2.1 2.0.0 stable stable 2015-01-09 LGPL-2.1 * [jan] Support loading translations from Composer-installed package. * [jan] Improve PSR-2 compatibility. 2.2.2 2.0.0 stable stable 2015-02-10 LGPL-2.1 * [jan] Fix updating quota when overwriting existing files. * [jan] Fix updating quota when using writeData() with FTP driver. * [jan] Fix setting permissions in Ssh2 driver (Bug #13783). 2.3.0 2.3.0 stable stable 2015-07-31 LGPL-2.1 * [jan] Make 'port' parameter of Smb driver optional. * [jan] Add 'domain' parameter to Smb driver. * [jan] Allow to specify a fixed leading directory in Smb driver. 2.3.1 2.3.0 stable stable 2016-02-02 LGPL-2.1 * [jan] Mark PHP 7 as supported. Horde_Vfs-2.3.1/bin/horde-vfs0000664000175000017500000002615012654104000014064 0ustar janjan#!/usr/bin/env php getMessage()); } $cmd = array_shift($argv); $options = Console_Getopt::getopt2($argv, '', array()); if (is_a($options, 'PEAR_Error')) { usage($options->getMessage()); } /* Show help? */ if (!count($options[1]) || in_array('help', $options[1])) { usage(); } /* Get and execute the command. */ $command = array_shift($options[1]); switch ($command) { case 'ls': if (!count($options[1])) { usage($command); } $params = Console_Getopt::getopt2($options[1], 'alR'); if (is_a($params, 'PEAR_Error')) { usage($params->getMessage()); } $path = array_shift($params[1]); ls($path, mergeOptions($params[0]), $params[1]); break; case 'cp': if (!count($options[1])) { usage($command); } $params = Console_Getopt::getopt2($options[1], 'arv'); if (is_a($params, 'PEAR_Error')) { usage($params->getMessage()); } $source = array_shift($params[1]); $target = array_shift($params[1]); cp($source, $target, mergeOptions($params[0]), $params[1]); break; default: usage(); break; } /** * Lists the contents of the specified directory. * * @param string $url The URL of the VFS backend * @param array $argv Additional options * @param string $filter Additional parameters */ function ls($url, $argv, $filter) { $params = url2params($url); $recursive = in_array('R', $argv); $vfs = vfs($params); try { $list = $vfs->listFolder($params['path'], count($filter) ? $filter[0] : null, in_array('a', $argv)); } catch (Horde_Vfs_Exception $e) { usage($e); } if (in_array('a', $argv)) { $list = array_merge(array('.' => array('name' => '.'), '..' => array('name' => '..')), $list); } $list = array_keys($list); $max = max(array_map(create_function('$a', 'return strlen($a);'), $list)) + 2; $line = ''; $dirs = array(); if ($recursive) { echo $params['path'] . ":\n"; } foreach ($list as $entry) { if ($vfs->isFolder($params['path'], $entry)) { $dirs[] = $entry; } $entry = sprintf('%-' . $max . 's', $entry); if (strlen($line . $entry) > 80 && !empty($line)) { echo $line . "\n"; $line = ''; } $line .= $entry; } if (!empty($line)) { echo $line . "\n"; } if ($recursive && count($dirs)) { foreach ($dirs as $dir) { echo "\n"; ls($url . '/' . $dir, $argv, $filter); } } } /** * Copies one or several files to a different location. * * @param string $source The source file(s) or directory. * @param string $target The target file or directory. * @param array $argv Additional options * @param string $filter Additional parameters */ function cp($source, $target, $argv, $filter) { $source_params = url2params($source); $source_path = rtrim($source_params['path'], '/'); unset($source_params['path']); $target_params = url2params($target); $target_path = rtrim($target_params['path'], '/'); unset($target_params['path']); if ($source_params == $target_params) { // TODO: Shortcut with Horde_Vfs::copy() } $source_vfs = vfs($source_params); $target_vfs = vfs($target_params); _cp($source_vfs, $target_vfs, $source_path, $target_path, $argv, $filter); } /** * Copies one or several files to a different location. * * @param VFS $source_vfs The source VFS object. * @param VFS $target_vfs The The target VFS object. * @param string $source_path The source file(s) or directory. * @param string $target_path The target file or directory. * @param array $argv Additional options * @param string $filter Additional parameters */ function _cp(&$source_vfs, &$target_vfs, $source_path, $target_path, $argv, $filter) { $source_object = basename($source_path); $source_parent_path = dirname($source_path); $target_object = basename($target_path); $target_parent_path = dirname($target_path); $recursive = in_array('r', $argv); if ($source_vfs->isFolder($source_parent_path, $source_object)) { if (!$recursive) { echo "Skipping directory $source_path\n"; return; } if (!$target_vfs->isFolder($target_parent_path, $target_object)) { if ($target_vfs->exists($target_parent_path, $target_object)) { usage(PEAR::raiseError('You can\'t copy a folder on a file.')); } else { $target_vfs->createFolder($target_parent_path, $target_object); } } if (!$target_vfs->isFolder($target_path, $source_object)) { if ($target_vfs->exists($target_path, $source_object)) { usage(PEAR::raiseError('You can\'t copy a folder on a file.')); } elseif (!$target_vfs->exists($target_path, $source_object)) { $target_vfs->createFolder($target_path, $source_object); } } $list = $source_vfs->listFolder($source_path, count($filter) ? $filter[0] : null, in_array('a', $argv)); foreach ($list as $item) { _cp($source_vfs, $target_vfs, $source_path . '/' . $item['name'], $target_path . '/' . $source_object, $argv, $filter); } return; } try { $data = &$source_vfs->read($source_parent_path, $source_object); } catch (Horde_Vfs_Exception $e) { usage($e); } if ($target_vfs->isFolder($target_parent_path, $target_object)) { if (in_array('v', $argv)) { echo '`' . $source_path . '\' -> `' . $target_path . '/' . $source_object . "'\n"; } try { $target_vfs->writeData($target_path, $source_object, $data, true); } catch (Horde_Vfs_Exception $e) { usage($e); } } elseif ($target_vfs->isFolder(dirname($target_parent_path), basename($target_parent_path))) { if (in_array('v', $argv)) { echo '`' . $source_path . '\' -> `' . $target_path . "'\n"; } try { $target_vfs->writeData($target_parent_path, $target_object, $data, true); } catch (Horde_Vfs_Exception $e) { usage($e); } } else { usage(new Horde_Vfs_Exception('"' . $target_parent_path . '" does not exist or is not a folder.')); } } /** * Shows some error and usage information. * * @param PEAR_Error $error If specified its error messages will be displayed. */ function usage($error = null) { if ($error instanceof Horde_Vfs_Exception) { echo $error->getMessage() . "\n"; } else { switch ($error) { case 'ls': echo 'Usage: vfs.php ls [-alR] '; break; case 'cp': echo 'Usage: vfs.php cp [-arv] '; break; } } $cmd = basename($GLOBALS['cmd']); echo << ... Available commands: ls - lists a folders content. cp - copies a file or folder to a different location. can be paths specified like an URL, e.g.: file:///var/lib/horde/vfs/foo/bar ftp://john:secret@ftp.example.com/foo/bar ssh2://john:secret@ssh.example.com/foo/bar sql://john:secret@localhost/mysql/horde/horde_vfs/foo/bar The SQL URL is build with the following scheme: sql://[[:]@]///[/] USAGE; exit; } /** * Returns a VFS instance. * * @param array $params A complete parameter set including the driver name * for the requested VFS instance. * * @return VFS An instance of the requested VFS backend. */ function vfs($params) { return Horde_Vfs::factory($params['driver'], $params); } /** * Merges a set of options as returned by Console_Getopt::getopt2() into a * single array. * * @param array $options A two dimensional array with the options. * * @return array A flat array with the options. */ function mergeOptions($options) { $result = array(); foreach ($options as $param) { $result = array_merge($result, $param); } return $result; } /** * Parses a URL into a set of parameters that can be used to instantiate a * VFS object. * * @todo Document the possible URL formats. * * @param string $url A URL with all necessary information for a VFS driver. * * @return array A hash with the parsed information. */ function url2params($url) { $params = array('path' => ''); $url = @parse_url($url); if (!is_array($url)) { usage(PEAR::raiseError($php_errormsg)); } $params['driver'] = $url['scheme']; if (isset($url['host'])) { $params['hostspec'] = $url['host']; } if (isset($url['port'])) { $params['port'] = $url['port']; } if (isset($url['user'])) { $params['username'] = $url['user']; } if (isset($url['pass'])) { $params['password'] = $url['pass']; } if (isset($url['path'])) { switch ($url['scheme']) { case 'ftp': $params['path'] = $url['path']; break; case 'file': $params['vfsroot'] = $url['path']; break; case 'sql': $path = explode('/', trim($url['path'], '/')); if (count($path) == 2) { usage(PEAR::raiseError('No table specified for SQL driver.')); } if (count($path) == 1) { usage(PEAR::raiseError('No database and no table specified for SQL driver.')); } if (!count($path)) { usage(PEAR::raiseError('No database type, database, and table specified for SQL driver.')); } $params['phptype'] = array_shift($path); $params['database'] = array_shift($path); $params['table'] = array_shift($path); $params['path'] = implode('/', $path); break; case 'ssh2': $params['path'] = $url['path']; break; default: usage(PEAR::raiseError('Only the SQL, File, and FTP drivers are supported at the moment.')); break; } if (isset($url['query'])) { $queries = explode('&', $url['query']); foreach ($queries as $query) { $pair = explode('=', $query); $params[$pair[0]] = isset($pair[1]) ? $pair[1] : true; } } } return $params; } Horde_Vfs-2.3.1/doc/Horde/Vfs/COPYING0000664000175000017500000005764612654104000015111 0ustar janjan GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Horde_Vfs-2.3.1/doc/Horde/Vfs/UPGRADING0000664000175000017500000000113212654104000015274 0ustar janjan===================== Upgrading Horde_Vfs ===================== :Contact: dev@lists.horde.org .. contents:: Contents .. section-numbering:: This lists the API changes between releases of the package. Upgrading to 2.0 ================ - Horde_Vfs_Browser, Horde_Vfs_ListItem, Horde_Vfs_Object These classes have been removed. - Horde_Vfs_Base#getFolderSize() The $name argument has been removed, specify the full path with the first argument instead. - Horde_Vfs_Base#listFolders() The method has been removed. Use listFolder() with the $dironly argument instead. Horde_Vfs-2.3.1/lib/Horde/Vfs/Base.php0000664000175000017500000005541612654104000015433 0ustar janjan * @package Vfs */ abstract class Horde_Vfs_Base { /** * Hash containing connection parameters. * * @var array */ protected $_params = array(); /** * List of additional credentials required for this VFS backend (example: * For FTP, we need a username and password to log in to the server with). * * @var array */ protected $_credentials = array(); /** * List of permissions and if they can be changed in this VFS backend. * * @var array */ protected $_permissions = array( 'owner' => array( 'read' => false, 'write' => false, 'execute' => false ), 'group' => array( 'read' => false, 'write' => false, 'execute' => false ), 'all' => array( 'read' => false, 'write' => false, 'execute' => false ) ); /** * List of features that the VFS driver supports. * * @var array */ protected $_features = array( 'readByteRange' => false, ); /** * The current size, in bytes, of the VFS tree. * * @var integer */ protected $_vfsSize = null; /** * Constructor. * * @param array $params A hash containing connection parameters. */ public function __construct($params = array()) { $this->setParams(array( 'user' => '', 'vfs_quotalimit' => -1, 'vfs_quotaroot' => '' )); $this->setParams($params); } /** * Returns whether the drivers supports a certain feature. * * @param string $feature A feature name. See {@link $_features} for a * list of possible features. * * @return boolean True if the feature is supported. */ public function hasFeature($feature) { return !empty($this->_features[$feature]); } /** * Checks the credentials that we have by calling _connect(), to see if * there is a valid login. * * @throws Horde_Vfs_Exception */ public function checkCredentials() { $this->_connect(); } /** * TODO * * @throws Horde_Vfs_Exception */ protected function _connect() { } /** * Sets configuration parameters. * * @param array $params An associative array with parameter names as * keys. */ public function setParams($params = array()) { $this->_params = array_merge($this->_params, $params); } /** * Returns configuration parameters. * * @param string $name The parameter to return. * * @return mixed The parameter value or null if it doesn't exist. */ public function getParam($name) { return isset($this->_params[$name]) ? $this->_params[$name] : null; } /** * Retrieves the size of a file from the VFS. * * @abstract * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return integer The file size. * @throws Horde_Vfs_Exception */ public function size($path, $name) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Returns the size of a folder. * * @param string $path The path of the folder. * * @return integer The size of the folder, in bytes. * @throws Horde_Vfs_Exception */ public function getFolderSize($path = null) { $size = 0; $root = !is_null($path) ? $path . '/' : ''; $object_list = $this->listFolder($root, null, true, false, true); foreach ($object_list as $key => $val) { $size += isset($val['subdirs']) ? $this->getFolderSize($root . '/' . $key) : $this->size($root, $key); } return $size; } /** * Retrieves a file from the VFS. * * @abstract * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function read($path, $name) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Retrieves a file from the VFS as an on-disk local file. * * This function provides a file on local disk with the data of a VFS file * in it. This file cannot be modified! The behavior if you do * modify it is undefined. It will be removed at the end of the request. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string A local filename. * @throws Horde_Vfs_Exception */ public function readFile($path, $name) { // Create a temporary file and register it for deletion at the // end of this request. if (!($localFile = Horde_Util::getTempFile('vfs'))) { throw new Horde_Vfs_Exception('Unable to create temporary file.'); } if (is_callable(array($this, 'readStream'))) { // Use a stream from the VFS if possible, to avoid reading all data // into memory. $stream = $this->readStream($path, $name); if (!($localStream = fopen($localFile, 'w'))) { throw new Horde_Vfs_Exception('Unable to open temporary file.'); } stream_copy_to_stream($stream, $localStream); fclose($localStream); } else { // We have to read all of the data in one shot. $data = $this->read($path, $name); file_put_contents($localFile, $data); } // $localFile now has $path/$name's data in it. return $localFile; } /** * Retrieves a part of a file from the VFS. Particularly useful when * reading large files which would exceed the PHP memory limits if they * were stored in a string. * * @abstract * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * @param integer $offset The offset of the part. (The new offset will * be stored in here). * @param integer $length The length of the part. If the length = -1, * the whole part after the offset is retrieved. * If more bytes are given as exists after the * given offset. Only the available bytes are * read. * @param integer $remaining The bytes that are left, after the part that * is retrieved. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function readByteRange($path, $name, &$offset, $length, &$remaining) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Stores a file in the VFS. * * @abstract * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to * be stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Stores a file in the VFS from raw data. * * @abstract * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Moves a file through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The destination file name. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function move($path, $name, $dest, $autocreate = false) { $this->copy($path, $name, $dest, $autocreate); if ($this->isFolder($path, $name)) { $this->deleteFolder($path, $name, true); } else { $this->deleteFile($path, $name); } } /** * Copies a file through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The name of the destination directory. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function copy($path, $name, $dest, $autocreate = false) { $this->_checkDestination($path, $dest); if ($autocreate) { $this->autocreatePath($dest); } if ($this->isFolder($path, $name)) { $this->_copyRecursive($path, $name, $dest); } else { $this->writeData($dest, $name, $this->read($path, $name), $autocreate); } } /** * Checks whether a source and destination directory are the same. * * @param string $path A source path. * @param string $dest A destination path. * * @throws Horce_Vfs_Exception of both paths are the same. */ protected function _checkDestination($path, $dest) { if (preg_match('|^' . preg_quote(rtrim($path, '/'), '|') . '/?$|', $dest)) { throw new Horde_Vfs_Exception('Cannot copy file(s) - source and destination are the same.'); } } /** * Recursively copies a directory through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The name of the destination directory. * * @throws Horde_Vfs_Exception */ protected function _copyRecursive($path, $name, $dest) { $this->createFolder($dest, $name); $file_list = $this->listFolder($this->_getPath($path, $name)); foreach ($file_list as $file) { $this->copy($this->_getPath($path, $name), $file['name'], $this->_getPath($dest, $name)); } } /** * Alias to deleteFile() */ public function delete($path, $name) { $this->deleteFile($path, $name); } /** * Deletes a file from the VFS. * * @abstract * * @param string $path The path to delete the file from. * @param string $name The filename to delete. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Renames a file in the VFS. * * @abstract * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Returns if a given file or folder exists in a folder. * * @param string $path The path to the folder. * @param string $name The file or folder name. * * @return boolean True if it exists, false otherwise. */ public function exists($path, $name) { try { $list = $this->listFolder($path); return isset($list[$name]); } catch (Horde_Vfs_Exception $e) { return false; } } /** * Creates a folder in the VFS. * * @abstract * * @param string $path The parent folder. * @param string $name The name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Automatically creates any necessary parent directories in the specified * $path. * * @param string $path The VFS path to autocreate. * * @throws Horde_Vfs_Exception */ public function autocreatePath($path) { $dirs = explode('/', $path); $cur = '/'; foreach ($dirs as $dir) { if (!strlen($dir)) { continue; } if (!$this->isFolder($cur, $dir)) { $this->createFolder($cur, $dir); } if ($cur != '/') { $cur .= '/'; } $cur .= $dir; } } /** * Checks if a given item is a folder. * * @param string $path The parent folder. * @param string $name The item name. * * @return boolean True if it is a folder, false otherwise. */ public function isFolder($path, $name) { try { $folderList = $this->listFolder($path, null, true, true); return isset($folderList[$name]); } catch (Horde_Vfs_Exception $e) { return false; } } /** * Deletes a folder from the VFS. * * @abstract * * @param string $path The parent folder. * @param string $name The name of the folder to delete. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Recursively remove all files and subfolders from the given * folder. * * @param string $path The path of the folder to empty. * * @throws Horde_Vfs_Exception */ public function emptyFolder($path) { // Get and delete the subfolders. foreach ($this->listFolder($path, null, true, true) as $folder) { $this->deleteFolder($path, $folder['name'], true); } // Only files are left, get and delete them. foreach ($this->listFolder($path) as $file) { $this->deleteFile($path, $file['name']); } } /** * Returns a file list of the directory passed in. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * @param boolean $recursive Return all directory levels recursively? * * @return array File list. * @throws Horde_Vfs_Exception */ public function listFolder($path, $filter = null, $dotfiles = true, $dironly = false, $recursive = false) { $list = $this->_listFolder($path, $filter, $dotfiles, $dironly); if (!$recursive) { return $list; } if (strlen($path)) { $path .= '/'; } foreach ($list as $name => $values) { if ($values['type'] == '**dir') { $list[$name]['subdirs'] = $this->listFolder($path . $name, $filter, $dotfiles, $dironly, $recursive); } } return $list; } /** * Returns an an unsorted file list of the specified directory. * * @abstract * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Returns the current working directory of the VFS backend. * * @return string The current working directory. */ public function getCurrentDirectory() { return ''; } /** * Returns whether or not a file or directory name matches an filter * element. * * @param string|array $filter Regular expression(s) to build the filter * from. * @param string $filename String containing the file/directory name * to match. * * @return boolean True on match, false on no match. */ protected function _filterMatch($filter, $filename) { if (is_array($filter)) { $filter = implode('|', $filter); } if (!strlen($filter)) { return false; } return preg_match('/' . $filter . '/', $filename); } /** * Changes permissions for an item on the VFS. * * @abstract * * @param string $path The parent folder of the item. * @param string $name The name of the item. * @param string $permission The permission to set. * * @throws Horde_Vfs_Exception */ public function changePermissions($path, $name, $permission) { throw new Horde_Vfs_Exception('Not supported.'); } /** * Returns the list of additional credentials required, if any. * * @return array Credential list. */ public function getRequiredCredentials() { return array_diff($this->_credentials, array_keys($this->_params)); } /** * Returns an array specifying what permissions are changeable for this * VFS implementation. * * @return array Changeable permisions. */ public function getModifiablePermissions() { return $this->_permissions; } /** * Returns the size of the VFS item. * * @return integer The size, in bytes, of the VFS item. */ public function getVFSSize() { if (is_null($this->_vfsSize)) { $this->_vfsSize = $this->getFolderSize($this->_params['vfs_quotaroot']); } return $this->_vfsSize; } /** * Sets the VFS quota limit. * * @param integer $quota The limit to apply. * @param integer $metric The metric to multiply the quota into. */ public function setQuota($quota, $metric = Horde_Vfs::QUOTA_METRIC_BYTE) { switch ($metric) { case Horde_Vfs::QUOTA_METRIC_KB: $quota *= pow(2, 10); break; case Horde_Vfs::QUOTA_METRIC_MB: $quota *= pow(2, 20); break; case Horde_Vfs::QUOTA_METRIC_GB: $quota *= pow(2, 30); break; } $this->_params['vfs_quotalimit'] = $quota; } /** * Sets the VFS quota root. * * @param string $dir The root directory for the quota determination. */ public function setQuotaRoot($dir) { $this->_params['vfs_quotaroot'] = $dir; } /** * Get quota information (used/allocated), in bytes. * * @return mixed An associative array. *
     * 'limit' = Maximum quota allowed
     * 'usage' = Currently used portion of quota (in bytes)
     * 
* @throws Horde_Vfs_Exception */ public function getQuota() { if ($this->_params['vfs_quotalimit'] == -1) { throw new Horde_Vfs_Exception('No quota set.'); } return array( 'limit' => $this->_params['vfs_quotalimit'], 'usage' => $this->getVFSSize() ); } /** * Checks the quota when preparing to write data. * * @param string $mode Either 'string' or 'file'. If 'string', $data is * the data to be written. If 'file', $data is the * filename containing the data to be written. * @param string $data Either the data or the filename to the data. * @param string $path The path the file is located in. * @param string $name The filename. * * @throws Horde_Vfs_Exception */ protected function _checkQuotaWrite($mode, $data, $path = null, $name = null) { if ($this->_params['vfs_quotalimit'] == -1 && is_null($this->_vfsSize)) { return; } if ($mode == 'file') { $filesize = filesize($data); if ($filesize === false) { throw new Horde_Vfs_Exception('Unable to read VFS file (filesize() failed).'); } } else { $filesize = strlen($data); } $oldsize = 0; if ($name) { try { $oldsize = $this->size($path, $name); } catch (Horde_Vfs_Exception $e) { } } $vfssize = $this->getVFSSize(); if ($this->_params['vfs_quotalimit'] > -1 && ($vfssize + $filesize - $oldsize) > $this->_params['vfs_quotalimit']) { throw new Horde_Vfs_Exception('Unable to write VFS file, quota will be exceeded.'); } if (!is_null($this->_vfsSize)) { $this->_vfsSize += $filesize - $oldsize; } } /** * Checks the quota when preparing to delete data. * * @param string $path The path the file is located in. * @param string $name The filename. * * @throws Horde_Vfs_Exception */ protected function _checkQuotaDelete($path, $name) { if (!is_null($this->_vfsSize)) { $this->_vfsSize -= $this->size($path, $name); } } /** * Returns the full path of an item. * * @param string $path The path of directory of the item. * @param string $name The name of the item. * * @return mixed Full path when $path isset and just $name when not set. */ protected function _getPath($path, $name) { if (strlen($path) > 0) { if (substr($path, -1) == '/') { return $path . $name; } return $path . '/' . $name; } return $name; } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Exception.php0000664000175000017500000000060612654104000016506 0ustar janjan * @package Vfs */ class Horde_Vfs_Exception extends Horde_Exception_Wrapped { } Horde_Vfs-2.3.1/lib/Horde/Vfs/File.php0000664000175000017500000005763612654104000015446 0ustar janjan array( 'read' => true, 'write' => true, 'execute' => true ), 'group' => array( 'read' => true, 'write' => true, 'execute' => true ), 'all' => array( 'read' => true, 'write' => true, 'execute' => true ) ); /** * List of features that the VFS driver supports. * * @var array */ protected $_features = array( 'readByteRange' => true, ); /** * Constructs a new Filesystem based VFS object. * * @param array $params A hash containing connection parameters. REQUIRED * parameters: * - vfsroot: (string) The root path. * Note: The user that your webserver runs as MUST have * read/write permission to this directory. */ public function __construct($params = array()) { parent::__construct($params); if (!empty($this->_params['vfsroot']) && ((substr($this->_params['vfsroot'], -1) == '/') || (substr($this->_params['vfsroot'], -1) == '\\'))) { $this->_params['vfsroot'] = substr($this->_params['vfsroot'], 0, strlen($this->_params['vfsroot']) - 1); } $this->_connect(); } /** * Retrieves the filesize from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return integer The file size. * @throws Horde_Vfs_Exception */ public function size($path, $name) { if (($size = @filesize($this->_getNativePath($path, $name))) === false) { $e = new Horde_Vfs_Exception(sprintf('Unable to check file size of "%s/%s".', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } return $size; } /** * Retrieve a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function read($path, $name) { if (($data = @file_get_contents($this->_getNativePath($path, $name))) === false) { $e = new Horde_Vfs_Exception(sprintf('Unable to open VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } return $data; } /** * Retrieves a file from the VFS as an on-disk local file. * * This function provides a file on local disk with the data of a VFS file * in it. This file cannot be modified! The behavior if you do * modify it is undefined. It will be removed at the end of the request. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string A local filename. */ public function readFile($path, $name) { return $this->_getNativePath($path, $name); } /** * Open a read-only stream to a file in the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return resource The stream. * @throws Horde_Vfs_Exception */ public function readStream($path, $name) { $stream = @fopen($this->_getNativePath($path, $name), 'rb'); if (!is_resource($stream)) { $e = new Horde_Vfs_Exception(sprintf('Unable to open VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } return $stream; } /** * Retrieves a part of a file from the VFS. Particularly useful when * reading large files which would exceed the PHP memory limits if they * were stored in a string. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * @param integer $offset The offset of the part. (The new offset will * be stored in here). * @param integer $length The length of the part. If the length = -1, * the whole part after the offset is retrieved. * If more bytes are given as exists after the * given offset. Only the available bytes are * read. * @param integer $remaining The bytes that are left, after the part that * is retrieved. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function readByteRange($path, $name, &$offset, $length, &$remaining) { if ($offset < 0) { throw new Horde_Vfs_Exception(sprintf('Wrong offset %d while reading VFS file %s/%s.', $offset, $path, $name)); } // Calculate how many bytes MUST be read, so the remainging // bytes and the new offset can be calculated correctly. $file = $this->_getNativePath($path, $name); $size = filesize ($file); if (($length == -1) || (($length + $offset) > $size)) { $length = $size - $offset; } if ($remaining < 0) { $remaining = 0; } $fp = @fopen($file, 'rb'); if (!$fp) { $e = new Horde_Vfs_Exception(sprintf('Unable to open VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } fseek($fp, $offset); $data = fread($fp, $length); $offset = ftell($fp); $remaining = $size - $offset; fclose($fp); return $data; } /** * Store a file in the VFS, with the data copied from a temporary * file. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to be * stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { if (!@is_dir($this->_getNativePath($path))) { if ($autocreate) { $this->autocreatePath($path); } else { throw new Horde_Vfs_Exception(sprintf('VFS directory %s does not exist.', $path)); } } $this->_checkQuotaWrite('file', $tmpFile, $path, $name); // Since we already have the data in a file, don't read it // into PHP's memory at all - just copy() it to the new // location. We leave it to the caller to clean up the // temporary file, so we don't use rename(). if (!@copy($tmpFile, $this->_getNativePath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to write VFS file %s/%s (copy() failed).', $path, $name)); } } /** * Moves a file in the database and the file system. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function move($path, $name, $dest, $autocreate = false) { $orig = $this->_getNativePath($path, $name); if (preg_match('|^' . preg_quote($orig) . '/?$|', $dest)) { throw new Horde_Vfs_Exception(sprintf('Unable to move VFS file %s/%s - destination is within source.', $path, $name)); } if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, false) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('Unable to move VFS file %s/%s - destination exists already.', $path, $name)); } } if (!@rename($orig, $this->_getNativePath($dest, $name))) { $e = new Horde_Vfs_Exception(sprintf('Unable to move VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Copies a file through the backend. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function copy($path, $name, $dest, $autocreate = false) { $this->_checkDestination($path, $dest); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, false) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception('Unable to copy VFS file.'); } } $orig = $this->_getNativePath($path, $name); $this->_checkQuotaWrite('file', $orig, $dest, $name); if (!@copy($orig, $this->_getNativePath($dest, $name))) { $e = new Horde_Vfs_Exception(sprintf('Unable to copy VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Store a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { if (!@is_dir($this->_getNativePath($path))) { if ($autocreate) { $this->autocreatePath($path); } else { throw new Horde_Vfs_Exception(sprintf('VFS directory %s does not exist.', $path)); } } // Treat an attempt to write an empty file as a touch() call, // since otherwise the file will not be created at all. if (!strlen($data)) { if (@touch($this->_getNativePath($path, $name))) { return; } $e = new Horde_Vfs_Exception(sprintf('Unable to create empty VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } $this->_checkQuotaWrite('string', $data, $path, $name); // Otherwise we go ahead and try to write out the file. if (!@file_put_contents($this->_getNativePath($path, $name), $data)) { $e = new Horde_Vfs_Exception(sprintf('Unable to write data to VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Delete a file from the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $this->_checkQuotaDelete($path, $name); if (!@unlink($this->_getNativePath($path, $name))) { $e = new Horde_Vfs_Exception(sprintf('Unable to delete VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Delete a folder from the VFS. * * @param string $path The path to delete the folder from. * @param string $name The foldername to use. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { if ($recursive) { $this->emptyFolder($path . '/' . $name); } else { $list = $this->listFolder($path . '/' . $name); if (count($list)) { throw new Horde_Vfs_Exception(sprintf('Unable to delete %s/%s, the directory is not empty', $path, $name)); } } if (!@rmdir($this->_getNativePath($path, $name))) { $e = new Horde_Vfs_Exception(sprintf('Unable to delete VFS directory %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Creates a folder on the VFS. * * @param string $path The path to create the folder in. * @param string $name The foldername to use. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { if (!@mkdir($this->_getNativePath($path, $name))) { $e = new Horde_Vfs_Exception(sprintf('Unable to create VFS directory %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Check if a given pathname is a folder. * * @param string $path The path to the folder. * @param string $name The file/folder name. * * @return boolean True if it is a folder, false otherwise. */ public function isFolder($path, $name) { return @is_dir($this->_getNativePath($path, $name)); } /** * Changes permissions for an item in the VFS. * * @param string $path The path of directory of the item. * @param string $name The name of the item. * @param string $permission The permission to set in octal notation. * * @throws Horde_Vfs_Exception */ public function changePermissions($path, $name, $permission) { if (!@chmod($this->_getNativePath($path, $name), base_convert($permission, 8, 10))) { $e = new Horde_Vfs_Exception(sprintf('Unable to change permission for VFS file %s/%s.', $path, $name)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Returns an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { $files = array(); $dir = $this->_getNativePath(strlen($path) ? $path : ''); if (!@is_dir($dir)) { throw new Horde_Vfs_Exception(sprintf('%s is not a VFS directory', $path)); } if (!@chdir($dir)) { $e = new Horde_Vfs_Exception(sprintf('Unable to access VFS directory %s.', $path)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } $d = dir($dir); while (($entry = $d->read()) !== false) { // Filter out '.' and '..' entries. if ($entry == '.' || $entry == '..') { continue; } // Filter out dotfiles if they aren't wanted. if (!$dotfiles && substr($entry, 0, 1) == '.') { continue; } // File name $file['name'] = $entry; // Unix style file permissions $file['perms'] = $this->_getUnixPerms(fileperms($entry)); // Owner $file['owner'] = fileowner($entry); if (function_exists('posix_getpwuid')) { $owner = posix_getpwuid($file['owner']); $file['owner'] = $owner['name']; } // Group $file['group'] = filegroup($entry); if (function_exists('posix_getgrgid')) { $group = posix_getgrgid($file['group']); $file['group'] = $group['name']; } // Size $file['size'] = filesize($entry); // Date $file['date'] = filemtime($entry); // Type if (@is_dir($entry) && !is_link($entry)) { $file['perms'] = 'd' . $file['perms']; $file['type'] = '**dir'; $file['size'] = -1; } elseif (is_link($entry)) { $file['perms'] = 'l' . $file['perms']; $file['type'] = '**sym'; $file['link'] = readlink($entry); $file['linktype'] = '**none'; if (file_exists($file['link'])) { if (is_dir($file['link'])) { $file['linktype'] = '**dir'; } elseif (is_link($file['link'])) { $file['linktype'] = '**sym'; } elseif (is_file($file['link'])) { $ext = explode('.', $file['link']); if (!(count($ext) == 1 || ($ext[0] === '' && count($ext) == 2))) { $file['linktype'] = Horde_String::lower($ext[count($ext) - 1]); } } } else { $file['linktype'] = '**broken'; } } elseif (is_file($entry)) { $file['perms'] = '-' . $file['perms']; $ext = explode('.', $entry); if (count($ext) == 1 || (substr($file['name'], 0, 1) === '.' && count($ext) == 2)) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($ext[count($ext) - 1]); } } else { $file['type'] = '**none'; if ((fileperms($entry) & 0xC000) == 0xC000) { $file['perms'] = 's' . $file['perms']; } elseif ((fileperms($entry) & 0x6000) == 0x6000) { $file['perms'] = 'b' . $file['perms']; } elseif ((fileperms($entry) & 0x2000) == 0x2000) { $file['perms'] = 'c' . $file['perms']; } elseif ((fileperms($entry) & 0x1000) == 0x1000) { $file['perms'] = 'p' . $file['perms']; } else { $file['perms'] = '?' . $file['perms']; } } // Filtering. if ($this->_filterMatch($filter, $file['name'])) { unset($file); continue; } if ($dironly && $file['type'] !== '**dir') { unset($file); continue; } $files[$file['name']] = $file; unset($file); } $d->close(); return $files; } /** * Return Unix style perms. * * @param integer $perms The permissions to set. * * @return string Unix style perms. */ protected function _getUnixPerms($perms) { // Determine permissions $owner['read'] = ($perms & 00400) ? 'r' : '-'; $owner['write'] = ($perms & 00200) ? 'w' : '-'; $owner['execute'] = ($perms & 00100) ? 'x' : '-'; $group['read'] = ($perms & 00040) ? 'r' : '-'; $group['write'] = ($perms & 00020) ? 'w' : '-'; $group['execute'] = ($perms & 00010) ? 'x' : '-'; $world['read'] = ($perms & 00004) ? 'r' : '-'; $world['write'] = ($perms & 00002) ? 'w' : '-'; $world['execute'] = ($perms & 00001) ? 'x' : '-'; // Adjust for SUID, SGID and sticky bit if ($perms & 0x800) { $owner['execute'] = ($owner['execute'] == 'x') ? 's' : 'S'; } if ($perms & 0x400) { $group['execute'] = ($group['execute'] == 'x') ? 's' : 'S'; } if ($perms & 0x200) { $world['execute'] = ($world['execute'] == 'x') ? 't' : 'T'; } return $owner['read'] . $owner['write'] . $owner['execute'] . $group['read'] . $group['write'] . $group['execute'] . $world['read'] . $world['write'] . $world['execute']; } /** * Rename a file or folder in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { if (!@is_dir($this->_getNativePath($newpath))) { $this->autocreatePath($newpath); } if (!@rename($this->_getNativePath($oldpath, $oldname), $this->_getNativePath($newpath, $newname))) { $e = new Horde_Vfs_Exception(sprintf('Unable to rename VFS file %s/%s.', $oldpath, $oldname)); if (isset($php_errormsg)) { $e->details = $php_errormsg; } throw $e; } } /** * Returns if a given file or folder exists in a folder. * * @param string $path The path to the folder. * @param string $name The file or folder name. * * @return boolean True if it exists, false otherwise. */ public function exists($path, $name) { return file_exists($this->_getNativePath($path, $name)); } /** * Return a full filename on the native filesystem, from a VFS * path and name. * * @param string $path The VFS file path. * @param string $name The VFS filename. * * @return string The full native filename. */ protected function _getNativePath($path = '', $name = '') { $name = basename($name); if (strlen($name)) { if ($name == '..') { $name = ''; } if (substr($name, 0, 1) != '/') { $name = '/' . $name; } } if (strlen($path)) { if (isset($this->_params['home']) && preg_match('|^~/?(.*)$|', $path, $matches)) { $path = $this->_params['home'] . '/' . $matches[1]; } $path = str_replace('..', '', $path); if (substr($path, 0, 1) == '/') { return $this->_params['vfsroot'] . rtrim($path, '/') . $name; } else { return $this->_params['vfsroot'] . '/' . rtrim($path, '/') . $name; } } return $this->_params['vfsroot'] . $name; } /** * Make sure that the vfsroot is readable. * * @throws Horde_Vfs_Exception */ protected function _connect() { if (!@is_dir($this->_params['vfsroot'])) { @mkdir($this->_params['vfsroot']); } if (!is_readable($this->_params['vfsroot'])) { throw new Horde_Vfs_Exception('Unable to read the vfsroot directory.'); } } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Ftp.php0000664000175000017500000007053612654104000015312 0ustar janjan * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @author Chuck Hagenbuch * @author Michael Varghese * @package Vfs */ class Horde_Vfs_Ftp extends Horde_Vfs_Base { /** * Hash containing connection parameters. * * @var array */ protected $_params = array('port' => 21); /** * List of additional credentials required for this VFS backend. * * @var array */ protected $_credentials = array('username', 'password'); /** * List of permissions and if they can be changed in this VFS backend. * * @var array */ protected $_permissions = array( 'owner' => array( 'read' => true, 'write' => true, 'execute' => true ), 'group' => array( 'read' => true, 'write' => true, 'execute' => true ), 'all' => array( 'read' => true, 'write' => true, 'execute' => true ) ); /** * Variable holding the connection to the ftp server. * * @var resource */ protected $_stream = false; /** * Local cache array for user IDs. * * @var array */ protected $_uids = array(); /** * Local cache array for group IDs. * * @var array */ protected $_gids = array(); /** * The FTP server type. * * @var string */ protected $_type; /** * Returns the size of a file. * * @param string $path The path of the file. * @param string $name The filename. * * @return integer The size of the file in bytes. * @throws Horde_Vfs_Exception */ public function size($path, $name) { $this->_connect(); if (($size = @ftp_size($this->_stream, $this->_getPath($path, $name))) === -1) { throw new Horde_Vfs_Exception(sprintf('Unable to check file size of "%s".', $this->_getPath($path, $name))); } return $size; } /** * Retrieves a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. */ public function read($path, $name) { $file = $this->readFile($path, $name); clearstatcache(); $size = filesize($file); return ($size === 0) ? '' : file_get_contents($file); } /** * Retrieves a file from the VFS as an on-disk local file. * * This function provides a file on local disk with the data of a VFS file * in it. This file cannot be modified! The behavior if you do * modify it is undefined. It will be removed at the end of the request. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string A local filename. * @throws Horde_Vfs_Exception */ public function readFile($path, $name) { $this->_connect(); // Create a temporary file and register it for deletion at the // end of this request. if (!($localFile = Horde_Util::getTempFile('vfs'))) { throw new Horde_Vfs_Exception('Unable to create temporary file.'); } $result = @ftp_get( $this->_stream, $localFile, $this->_getPath($path, $name), FTP_BINARY); if ($result === false) { throw new Horde_Vfs_Exception(sprintf('Unable to open VFS file "%s".', $this->_getPath($path, $name))); } clearstatcache(); return $localFile; } /** * Open a stream to a file in the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return resource The stream. * @throws Horde_Vfs_Exception */ public function readStream($path, $name) { if (!empty($this->_params['ssl'])) { if (function_exists('ftp_ssl_connect')) { $url = 'ftps://'; } else { throw new Horde_Vfs_Exception('Unable to connect with SSL.'); } } else { $url = 'ftp://'; } $url .= $this->_params['username'] . ':' . $this->_params['password'] . '@' . $this->_params['hostspec'] . ':' . $this->_params['port'] . '/' . $this->_getPath($path, $name); $stream = @fopen($url, 'r'); if (!is_resource($stream)) { throw new Horde_Vfs_Exception('Unable to open VFS file.'); } return $stream; } /** * Stores a file in the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to * be stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { $this->_connect(); $this->_checkQuotaWrite('file', $tmpFile, $path, $name); if (!@ftp_put($this->_stream, $this->_getPath($path, $name), $tmpFile, FTP_BINARY)) { if ($autocreate) { $this->autocreatePath($path); if (@ftp_put($this->_stream, $this->_getPath($path, $name), $tmpFile, FTP_BINARY)) { return; } } throw new Horde_Vfs_Exception(sprintf('Unable to write VFS file "%s".', $this->_getPath($path, $name))); } } /** * Stores a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { $tmpFile = Horde_Util::getTempFile('vfs'); file_put_contents($tmpFile, $data); try { $this->write($path, $name, $tmpFile, $autocreate); unlink($tmpFile); } catch (Horde_Vfs_Exception $e) { unlink($tmpFile); throw $e; } } /** * Deletes a file from the VFS. * * @param string $path The path to delete the file from. * @param string $name The filename to delete. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $this->_connect(); $this->_checkQuotaDelete($path, $name); if (!@ftp_delete($this->_stream, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to delete VFS file "%s".', $this->_getPath($path, $name))); } } /** * Checks if a given item is a folder. * * @param string $path The parent folder. * @param string $name The item name. * * @return boolean True if it is a folder, false otherwise. */ public function isFolder($path, $name) { $result = false; try { $this->_connect(); $olddir = $this->getCurrentDirectory(); /* See if we can change to the given path. */ $result = @ftp_chdir($this->_stream, $this->_getPath($path, $name)); $this->_setPath($olddir); } catch (Horde_Vfs_Exception $e) { } return $result; } /** * Deletes a folder from the VFS. * * @param string $path The parent folder. * @param string $name The name of the folder to delete. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { $this->_connect(); $isDir = false; foreach ($this->listFolder($path) as $file) { if ($file['name'] == $name && $file['type'] == '**dir') { $isDir = true; break; } } if ($isDir) { $dir = $path . '/' . $name; $file_list = $this->listFolder($dir); if (count($file_list) && !$recursive) { throw new Horde_Vfs_Exception(sprintf('Unable to delete "%s", as the directory is not empty.', $this->_getPath($path, $name))); } foreach ($file_list as $file) { if ($file['type'] == '**dir') { $this->deleteFolder($dir, $file['name'], $recursive); } else { $this->deleteFile($dir, $file['name']); } } if (!@ftp_rmdir($this->_stream, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Cannot remove directory "%s".', $this->_getPath($path, $name))); } } elseif (!@ftp_delete($this->_stream, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Cannot delete file "%s".', $this->_getPath($path, $name))); } } /** * Renames a file in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { $this->_connect(); $this->autocreatePath($newpath); if (!@ftp_rename($this->_stream, $this->_getPath($oldpath, $oldname), $this->_getPath($newpath, $newname))) { throw new Horde_Vfs_Exception(sprintf('Unable to rename VFS file "%s".', $this->_getPath($oldpath, $oldname))); } } /** * Creates a folder on the VFS. * * @param string $path The parent folder. * @param string $name The name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { $this->_connect(); if (!@ftp_mkdir($this->_stream, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to create VFS directory "%s".', $this->_getPath($path, $name))); } } /** * Changes permissions for an item on the VFS. * * @param string $path The parent folder of the item. * @param string $name The name of the item. * @param string $permission The permission to set in octal notation. * * @throws Horde_Vfs_Exception */ public function changePermissions($path, $name, $permission) { $this->_connect(); if (!@ftp_site($this->_stream, 'CHMOD ' . $permission . ' ' . $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to change permission for VFS file "%s".', $this->_getPath($path, $name))); } } /** * Returns an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path = '', $filter = null, $dotfiles = true, $dironly = false) { $this->_connect(); if (empty($this->_type)) { if (!empty($this->_params['type'])) { $this->_type = $this->_params['type']; } else { $type = Horde_String::lower(@ftp_systype($this->_stream)); if ($type == 'unknown') { // Go with unix-style listings by default. $type = 'unix'; } elseif (strpos($type, 'win') !== false) { $type = 'win'; } elseif (strpos($type, 'netware') !== false) { $type = 'netware'; } $this->_type = $type; } } $olddir = $this->getCurrentDirectory(); $path = $this->_getPath('', $path); if (strlen($path)) { $this->_setPath($path); } if ($this->_type == 'unix') { // If we don't want dotfiles, We can save work here by not // doing an ls -a and then not doing the check later (by // setting $dotfiles to true, the if is short-circuited). if ($dotfiles) { $list = ftp_rawlist($this->_stream, '-al'); $dotfiles = true; } else { $list = ftp_rawlist($this->_stream, '-l'); } } else { $list = ftp_rawlist($this->_stream, ''); } if (!is_array($list)) { if (isset($olddir)) { $this->_setPath($olddir); } return array(); } /* If 'maplocalids' is set, check for the POSIX extension. */ $mapids = (!empty($this->_params['maplocalids']) && extension_loaded('posix')); $currtime = time(); $files = array(); foreach ($list as $line) { $file = array(); $item = preg_split('/\s+/', $line); if (($this->_type == 'unix') || (($this->_type == 'win') && !preg_match('|\d\d-\d\d-\d\d|', $item[0]))) { if (count($item) < 8 || substr($line, 0, 5) == 'total') { continue; } $file['perms'] = $item[0]; if ($mapids) { if (!isset($this->_uids[$item[2]])) { $entry = posix_getpwuid($item[2]); $this->_uids[$item[2]] = (empty($entry)) ? $item[2] : $entry['name']; } $file['owner'] = $this->_uids[$item[2]]; if (!isset($this->_uids[$item[3]])) { $entry = posix_getgrgid($item[3]); $this->_uids[$item[3]] = (empty($entry)) ? $item[3] : $entry['name']; } $file['group'] = $this->_uids[$item[3]]; } else { $file['owner'] = $item[2]; $file['group'] = $item[3]; } if (!empty($this->_params['lsformat']) && ($this->_params['lsformat'] == 'aix')) { $file['name'] = substr($line, strpos($line, sprintf("%s %2s %-5s", $item[5], $item[6], $item[7])) + 13); } else { $file['name'] = substr($line, strpos($line, sprintf("%s %2s %5s", $item[5], $item[6], $item[7])) + 13); } // Filter out '.' and '..' entries. if (preg_match('/^\.\.?\/?$/', $file['name'])) { continue; } // Filter out dotfiles if they aren't wanted. if (!$dotfiles && substr($file['name'], 0, 1) == '.') { continue; } $p1 = substr($file['perms'], 0, 1); if ($p1 === 'l') { $file['link'] = substr($file['name'], strpos($file['name'], '->') + 3); $file['name'] = substr($file['name'], 0, strpos($file['name'], '->') - 1); $file['type'] = '**sym'; if ($this->isFolder('', $file['link'])) { $file['linktype'] = '**dir'; } else { $parts = explode('/', $file['link']); $name = explode('.', array_pop($parts)); if (count($name) == 1 || ($name[0] === '' && count($name) == 2)) { $file['linktype'] = '**none'; } else { $file['linktype'] = Horde_String::lower(array_pop($name)); } } } elseif ($p1 === 'd') { $file['type'] = '**dir'; } else { $name = explode('.', $file['name']); if (count($name) == 1 || (substr($file['name'], 0, 1) === '.' && count($name) == 2)) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } } if ($file['type'] == '**dir') { $file['size'] = -1; } else { $file['size'] = $item[4]; } if (strpos($item[7], ':') !== false) { $file['date'] = strtotime($item[7] . ':00' . $item[5] . ' ' . $item[6] . ' ' . date('Y', $currtime)); // If the ftp server reports a file modification date more // less than one day in the future, don't try to subtract // a year from the date. There is no way to know, for // example, if the VFS server and the ftp server reside // in different timezones. We should simply report to the // user what the FTP server is returning. if ($file['date'] > ($currtime + 86400)) { $file['date'] = strtotime($item[7] . ':00' . $item[5] . ' ' . $item[6] . ' ' . (date('Y', $currtime) - 1)); } } else { $file['date'] = strtotime('00:00:00' . $item[5] . ' ' . $item[6] . ' ' . $item[7]); } } elseif ($this->_type == 'netware') { if (count($item) < 8 || substr($line, 0, 5) == 'total') { continue; } $file = array(); $file['perms'] = $item[1]; $file['owner'] = $item[2]; if ($item[0] == 'd') { $file['type'] = '**dir'; } else { $file['type'] = '**none'; } $file['size'] = $item[3]; // We don't know the timezone here. Just report what the FTP server says. if (strpos($item[6], ':') !== false) { $file['date'] = strtotime($item[6] . ':00 ' . $item[5] . ' ' . $item[4] . ' ' . date('Y')); } else { $file['date'] = strtotime('00:00:00 ' . $item[5] . ' ' . $item[4] . ' ' . $item[6]); } $file['name'] = $item[7]; for ($index = 8, $c = count($item); $index < $c; $index++) { $file['name'] .= ' ' . $item[$index]; } } else { /* Handle Windows FTP servers returning DOS-style file * listings. */ $file['perms'] = ''; $file['owner'] = ''; $file['group'] = ''; $file['name'] = $item[3]; for ($index = 4, $c = count($item); $index < $c; $index++) { $file['name'] .= ' ' . $item[$index]; } $file['date'] = strtotime($item[0] . ' ' . $item[1]); if ($item[2] == '') { $file['type'] = '**dir'; $file['size'] = -1; } else { $file['size'] = $item[2]; $name = explode('.', $file['name']); if (count($name) == 1 || (substr($file['name'], 0, 1) === '.' && count($name) == 2)) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } } } // Filtering. if ($this->_filterMatch($filter, $file['name'])) { unset($file); continue; } if ($dironly && $file['type'] !== '**dir') { unset($file); continue; } $files[$file['name']] = $file; unset($file); } if (isset($olddir)) { $this->_setPath($olddir); } return $files; } /** * Copies a file through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The name of the destination directory. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function copy($path, $name, $dest, $autocreate = false) { $this->_checkDestination($path, $dest); $this->_connect(); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, true) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('%s already exists.', $this->_getPath($dest, $name))); } } if ($this->isFolder($path, $name)) { $this->_copyRecursive($path, $name, $dest); } else { $tmpFile = Horde_Util::getTempFile('vfs'); $orig = $this->_getPath($path, $name); $fetch = @ftp_get($this->_stream, $tmpFile, $orig, FTP_BINARY); if (!$fetch) { unlink($tmpFile); throw new Horde_Vfs_Exception(sprintf('Failed to copy from "%s".', $orig)); } clearstatcache(); $this->_checkQuotaWrite('file', $tmpFile, $dest, $name); if (!@ftp_put($this->_stream, $this->_getPath($dest, $name), $tmpFile, FTP_BINARY)) { unlink($tmpFile); throw new Horde_Vfs_Exception(sprintf('Failed to copy to "%s".', $this->_getPath($dest, $name))); } unlink($tmpFile); } } /** * Moves a file through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The destination file name. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function move($path, $name, $dest, $autocreate = false) { $orig = $this->_getPath($path, $name); if (preg_match('|^' . preg_quote($orig) . '/?$|', $dest)) { throw new Horde_Vfs_Exception('Cannot move file(s) - destination is within source.'); } $this->_connect(); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, true) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('%s already exists.', $this->_getPath($dest, $name))); } } if (!@ftp_rename($this->_stream, $orig, $this->_getPath($dest, $name))) { throw new Horde_Vfs_Exception(sprintf('Failed to move to "%s".', $this->_getPath($dest, $name))); } } /** * Returns the current working directory on the FTP server. * * @return string The current working directory. * @throws Horde_Vfs_Exception */ public function getCurrentDirectory() { $this->_connect(); return @ftp_pwd($this->_stream); } /** * Returns the full path of an item. * * @param string $path The path of directory of the item. * @param string $name The name of the item. * * @return mixed Full path when $path isset and just $name when not set. */ protected function _getPath($path, $name) { if (isset($this->_params['vfsroot']) && strlen($this->_params['vfsroot'])) { if (strlen($path)) { $path = $this->_params['vfsroot'] . '/' . $path; } else { $path = $this->_params['vfsroot']; } } return parent::_getPath($path, $name); } /** * Changes the current directory on the server. * * @param string $path The path to change to. * * @throws Horde_Vfs_Exception */ protected function _setPath($path) { if (!@ftp_chdir($this->_stream, $path)) { throw new Horde_Vfs_Exception(sprintf('Unable to change to %s.', $path)); } } /** * Attempts to open a connection to the FTP server. * * @throws Horde_Vfs_Exception */ protected function _connect() { if ($this->_stream !== false) { return; } if (!extension_loaded('ftp')) { throw new Horde_Vfs_Exception('The FTP extension is not available.'); } if (!is_array($this->_params)) { throw new Horde_Vfs_Exception('No configuration information specified for FTP VFS.'); } $required = array('hostspec', 'username', 'password'); foreach ($required as $val) { if (!isset($this->_params[$val])) { throw new Horde_Vfs_Exception(sprintf('Required "%s" not specified in VFS configuration.', $val)); } } /* Connect to the ftp server using the supplied parameters. */ if (!empty($this->_params['ssl'])) { if (function_exists('ftp_ssl_connect')) { $this->_stream = @ftp_ssl_connect($this->_params['hostspec'], $this->_params['port']); } else { throw new Horde_Vfs_Exception('Unable to connect with SSL.'); } } else { $this->_stream = @ftp_connect($this->_params['hostspec'], $this->_params['port']); } if (!$this->_stream) { throw new Horde_Vfs_Exception('Connection to FTP server failed.'); } if (!@ftp_login($this->_stream, $this->_params['username'], $this->_params['password'])) { @ftp_quit($this->_stream); $this->_stream = false; throw new Horde_Vfs_Exception('Authentication to FTP server failed.'); } if (!empty($this->_params['pasv'])) { @ftp_pasv($this->_stream, true); } if (!empty($this->_params['timeout'])) { ftp_set_option($this->_stream, FTP_TIMEOUT_SEC, $this->_params['timeout']); } if (!empty($this->_params['vfsroot']) && !@ftp_chdir($this->_stream, $this->_params['vfsroot']) && !@ftp_mkdir($this->_stream, $this->_params['vfsroot'])) { throw new Horde_Vfs_Exception(sprintf('Unable to create VFS root directory "%s".', $this->_params['vfsroot'])); } } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Gc.php0000664000175000017500000000267412654104000015110 0ustar janjan * @package Vfs */ class Horde_Vfs_Gc { /** * Garbage collect files in the VFS storage system. * * @param VFS $vfs The VFS object to perform garbage collection on. * @param string $path The VFS path to clean. * @param integer $secs The minimum amount of time (in seconds) required * before a file is removed. */ public static function gc($vfs, $path, $secs = 345600) { /* A 0.1% chance we will run garbage collection during a call. */ if (substr(time(), -3) !== '000') { return; } /* Use a backend-specific method if one exists. */ if (is_callable(array($vfs, 'gc'))) { $vfs->gc($path, $secs); } /* Make sure cleaning is done recursively. */ try { $modtime = time() - $secs; foreach ($vfs->listFolder($path, null, true, false, true) as $val) { if ($val['date'] < $modtime) { $vfs->deleteFile($path, $val['name']); } } } catch (Horde_Vfs_Exception $e) { } } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Horde.php0000664000175000017500000001204712654104000015613 0ustar janjan * 'horde_base' Filesystem location of a local Horde installation. * * Optional parameters:
 *   'user'      A valid Horde user name.
 *   'password'  The user's password.
* * Copyright 2006-2016 Horde LLC (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @author Jan Schneider * @package Vfs */ class Horde_Vfs_Horde extends Horde_Vfs_Base { /** * Reference to a Horde Registry instance. * * @var Horde_Registry */ protected $_registry; /** * Constructor. * * @param array $params A hash containing connection parameters. * @throws Horde_Vfs_Exception */ public function __construct($params = array()) { parent::__construct($params); if (!isset($this->_params['horde_base'])) { throw new Horde_Vfs_Exception('Required "horde_base" not specified in VFS configuration.'); } require_once $this->_params['horde_base'] . '/lib/Application.php'; Horde_Registry::appInit('horde'); // Create the Registry object. $this->_registry = $GLOBALS['registry']; } /** */ protected function _connect() { if (!empty($this->_params['user']) && !empty($this->_params['password'])) { $GLOBALS['registry']->setAuth($this->_params['user'], array('password' => $this->_params['password'])); } } /** * Retrieves a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. */ public function read($path, $name) { if (substr($path, 0, 1) == '/') { $path = substr($path, 1); } $pieces = explode('/', $path); try { $data = $this->_registry->callByPackage($pieces[0], 'browse', array('path' => $path . '/' . $name)); } catch (Horde_Exception $e) { return ''; } return is_object($data) ? $data : $data['data']; } /** * Returns an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { $list = array(); if ($path == '/') { try { $apps = $this->_registry->listApps(null, false, Horde_Perms::READ); } catch (Horde_Exception $e) { throw new Horde_Vfs_Exception($e->getMessage()); } foreach ($apps as $app) { if ($this->_registry->hasMethod('browse', $app)) { $file = array( //'name' => $this->_registry->get('name', $app), 'name' => $app, 'date' => time(), 'type' => '**dir', 'size' => -1 ); $list[] = $file; } } return $list; } if (substr($path, 0, 1) == '/') { $path = substr($path, 1); } $pieces = explode('/', $path); try { $items = $this->_registry->callByPackage($pieces[0], 'browse', array('path' => $path, 'properties' => array('name', 'browseable', 'contenttype', 'contentlength', 'modified'))); } catch (Horde_Exception $e) { throw new Horde_Vfs_Exception($e->getMessage()); } if (!is_array(reset($items))) { /* We return an object's content. */ throw new Horde_Vfs_Exception('Unknown error'); } foreach ($items as $sub_path => $i) { if ($dironly && !$i['browseable']) { continue; } $name = basename($sub_path); if ($this->_filterMatch($filter, $name)) { continue; } $type = class_exists('Horde_Mime_Magic') ? Horde_Mime_Magic::mimeToExt(empty($i['contenttype']) ? 'application/octet-stream' : $i['contenttype']) : '**none'; $file = array( //'name' => $i['name'], 'name' => $name, 'date' => empty($i['modified']) ? 0 : $i['modified'], 'type' => $i['browseable'] ? '**dir' : $type, 'size' => empty($i['contentlength']) ? 0 : $i['contentlength'] ); $list[] = $file; } return $list; } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Mongo.php0000664000175000017500000003337012654104000015633 0ustar janjan * @category Horde * @copyright 2013-2016 Horde LLC * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package Vfs */ class Horde_Vfs_Mongo extends Horde_Vfs_Base { /* Metadata subdocument identifier. */ const MD = 'metadata'; /* Field (metadata) names. */ const FNAME = 'vfile'; const OWNER = 'owner'; const PATH = 'vpath'; /* Field (folders) names. */ const FOLDER_OWNER = 'owner'; const FOLDER_PATH = 'path'; const FOLDER_TS = 'ts'; /** * The MongoDB GridFS object for the VFS data. * * @var MongoGridFS */ protected $_files; /** * The MongoDB collection for the VFS folder data. * * @var MongoGridCollection */ protected $_folders; /** * Constructor. * * @param array $params Additional parameters: *
     *   - collection: (string) The collection name for the folders data.
     *   - gridfs: (string) The GridFS name.
     *   - mongo_db: [REQUIRED] (Horde_Mongo_Client) A MongoDB client object.
     * 
*/ public function __construct(array $params = array()) { if (!isset($params['mongo_db'])) { throw new InvalidArgumentException('Missing mongo_db parameter.'); } parent::__construct(array_merge(array( 'collection' => 'horde_vfs_folders', 'gridfs' => 'horde_vfs' ), $params)); $this->_files = $this->_params['mongo_db']->selectDB(null)->getGridFS($this->_params['gridfs']); $this->_folders = $this->_params['mongo_db']->selectDB(null)->selectCollection($this->_params['collection']); } /** */ public function size($path, $name) { if ($res = $this->_getFile($path, $name)) { return $res->getSize(); } throw new Horde_Vfs_Exception(sprintf('Unable to retrieve file size of "%s/%s".', $path, $name)); } /** */ public function getFolderSize($path = null) { $query = array(); if (!is_null($path)) { $query[$this->_mdKey(self::PATH)] = array( '$regex' => '^' . $this->_convertPath($path) ); } $size = 0; try { foreach ($this->_files->find($query) as $val) { $size += $val->getSize(); } } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } return $size; } /** */ public function read($path, $name) { if ($res = $this->_getFile($path, $name)) { return $res->getBytes(); } throw new Horde_Vfs_Exception(sprintf('Unable to read file "%s/%s".', $path, $name)); } /** */ public function readByteRange($path, $name, &$offset, $length, &$remaining) { if (!($res = $this->_getFile($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to read file "%s/%s".', $path, $name)); } $stream = $res->getResource(); $data = stream_get_contents($stream, $length, $offset); $curr = ftell($stream); fclose($stream); $offset = min($curr, $offset + $length); $remaining = max(0, $res->getSize() - $curr); return $data; } /** * Open a read-only stream to a file in the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return resource The stream. * @throws Horde_Vfs_Exception */ public function readStream($path, $name) { if ($res = $this->_getFile($path, $name)) { return $res->getResource(); } throw new Horde_Vfs_Exception(sprintf('Unable to read file "%s/%s".', $path, $name)); } /** */ public function write($path, $name, $tmpFile, $autocreate = false) { $this->_write('file', $path, $name, $tmpFile, $autocreate); } /** */ public function writeData($path, $name, $data, $autocreate = false) { $this->_write('string', $path, $name, $data, $autocreate); } /** */ protected function _write($type, $path, $name, $data, $autocreate) { $this->_checkQuotaWrite($type, $data, $path, $name); if ($autocreate) { $this->autocreatePath($path); } elseif (!$this->_isFolder($path)) { throw new Horde_Vfs_Exception(sprintf('Folder "%s" does not exist', $path)); } $orig = $this->_getFile($path, $name); $mdata = array( self::MD => array( self::FNAME => $name, self::OWNER => $this->_params['user'], self::PATH => $this->_convertPath($path) ) ); try { switch ($type) { case 'file': $this->_files->storeFile($data, $mdata); break; case 'string': $this->_files->storeBytes($data, $mdata); break; } } catch (MongoException $e) { throw new Horde_Vfs_Exception('Unable to write file data.'); } if ($orig) { $this->_files->delete($orig->file['_id']); } } /** */ public function deleteFile($path, $name) { if ($orig = $this->_getFile($path, $name)) { $this->_checkQuotaDelete($path, $name); $this->_files->delete($orig->file['_id']); } else { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } } /** */ public function rename($oldpath, $oldname, $newpath, $newname) { if (!($res = $this->_getFile($oldpath, $oldname))) { throw new Horde_Vfs_Exception('Unable to rename VFS file.'); } $this->autocreatePath($newpath); $res->file[self::MD][self::FNAME] = $newname; $res->file[self::MD][self::PATH] = $newpath; try { $this->_files->save($res->file); } catch (MongoException $e) { throw new Horde_Vfs_Exception(sprintf('Unable to rename VFS file %s/%s.', $oldpath, $oldname)); } } /** */ public function createFolder($path, $name) { $query = array( self::FOLDER_OWNER => $this->_params['user'], self::FOLDER_PATH => $this->_convertPath($path . '/' . $name), self::FOLDER_TS => new MongoDate() ); try { $this->_folders->insert($query); } catch (MongoException $e) {} } /** */ public function isFolder($path, $name) { return $this->_isFolder($path . '/' . $name); } /** */ protected function _isFolder($path) { $path = $this->_convertPath($path); if (!strlen($path)) { return true; } $query = array( self::FOLDER_PATH => $path ); try { return (bool) $this->_folders->find($query)->limit(1)->count(); } catch (MongoException $e) { return false; } } /** */ public function deleteFolder($path, $name, $recursive = false) { $fullpath = $path . '/' . $name; if ($recursive) { $this->emptyFolder($fullpath); } else { $query = array( $this->_mdKey(self::PATH) => array( '$regex' => '^' . $this->_convertPath($fullpath) ) ); if ($this->_files->find($query)->limit(1)->count()) { throw new Horde_Vfs_Exception(sprintf('Unable to delete %s/%s; the directory is not empty.', $path, $name)); } } try { $this->_folders->remove(array( self::FOLDER_PATH => $this->_convertPath($fullpath) )); } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } } /** */ public function emptyFolder($path) { $query = array( $this->_mdKey(self::PATH) => array( '$regex' => '^' . $this->_convertPath($path) ) ); $size = null; try { if (!is_null($this->_vfsSize)) { $files = $this->_files->find($query); $ids = array(); foreach ($files as $val) { $ids[] = $val->file['_id']; $size += $val->getSize(); } $query = array( '_id' => array( '$in' => $ids ) ); } $this->_files->remove($query); $this->_folders->remove(array( self::FOLDER_PATH => array( '$regex' => '^' . $this->_convertPath($path) . '/' ) )); } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } if (!is_null($size)) { $this->_vfsSize -= $size; } } /** * Returns an an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param mixed $filter String/hash to filter file/dirname on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { if (!$this->_isFolder($path)) { throw new Horde_Vfs_Exception(sprintf('Folder "%s" does not exist', $path)); } $out = array(); $path = $this->_convertPath($path); if (!$dironly) { try { $files = $this->_files->find(array( $this->_mdKey(self::PATH) => $this->_convertPath($path) )); } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } foreach ($files as $val) { $name = $val->file[self::MD][self::FNAME]; // Filter out dotfiles if they aren't wanted. if (!$dotfiles && ($name[0] == '.')) { continue; } // Filtering. if ($this->_filterMatch($filter, $name)) { continue; } $tmp = array( 'date' => $val->file['uploadDate']->sec, 'group' => '', 'name' => $name, 'owner' => $val->file[self::MD][self::OWNER], 'perms' => '', 'size' => $val->getSize() ); $type = explode('.', $name); $tmp['type'] = (count($type) == 1) ? '**none' : Horde_String::lower(array_pop($type)); $out[$name] = $tmp; } } try { $folders = $this->_folders->find(array( self::FOLDER_PATH => array( '$regex' => '^' . (strlen($path) ? $path . '/' : '') . '[^\/]+$' ) )); } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } foreach ($folders as $val) { $tmp = explode('/', $val[self::FOLDER_PATH]); $path = array_pop($tmp); if (isset($out[$path]) || $this->_filterMatch($filter, $path)) { continue; } $out[$path] = array( 'date' => $val[self::FOLDER_TS]->sec, 'group' => '', 'name' => $path, 'owner' => $val[self::FOLDER_OWNER], 'perms' => '', 'size' => -1, 'type' => '**dir' ); } return $out; } /** */ public function gc($path, $secs = 345600) { $query = array( $this->_mdKey(self::PATH) => array( '$regex' => '^' . $this->_convertPath($path) ), 'uploadDate' => array( '$lt' => new MongoDate(time() - $secs) ) ); try { $this->_files->remove($query); } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } } /** * Converts the path name from regular filesystem form to the internal * format needed to access the file in the database. * * Namely, we will treat '/' as a base directory as this is pretty much * the standard way to access base directories over most filesystems. * * @param string $path A VFS path. * * @return string The path with any surrouding slashes stripped off. */ protected function _convertPath($path) { return trim($path, '/'); } /** */ protected function _getFile($path, $name) { $query = array( $this->_mdKey(self::FNAME) => $name, $this->_mdKey(self::PATH) => $this->_convertPath($path) ); try { return $this->_files->findOne($query); } catch (MongoException $e) { throw new Horde_Vfs_Exception($e); } } /** */ protected function _mdKey($key) { return self::MD . '.' . $key; } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Musql.php0000664000175000017500000004145112654104000015654 0ustar janjan * @author Mike Cochrane * @package Vfs */ class Horde_Vfs_Musql extends Horde_Vfs_Sql { /* Permission for read access. */ const FLAG_READ = 1; /* Permission for read access. */ const FLAG_WRITE = 2; /** * List of permissions and if they can be changed in this VFS * * @var array */ protected $_permissions = array( 'owner' => array( 'read' => false, 'write' => false, 'execute' => false ), 'group' => array( 'read' => false, 'write' => false, 'execute' => false ), 'all' => array( 'read' => true, 'write' => true, 'execute' => false ) ); /** * Stores a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { /* Make sure we have write access to this and all parent paths. */ if ($path != '') { $paths = explode('/', $path); $path_name = array_pop($paths); if (!$this->isFolder(implode('/', $paths), $path_name)) { if (!$autocreate) { throw new Horde_Vfs_Exception(sprintf('Folder "%s" does not exist'), $path); } else { $this->autocreatePath($path); } } $paths[] = $path_name; $previous = ''; foreach ($paths as $thispath) { $sql = sprintf('SELECT vfs_owner, vfs_perms FROM %s WHERE vfs_path = ? AND vfs_name= ?', $this->_params['table']); try { $results = $this->_db->selectAll($sql, array($previous, $thispath)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if (!is_array($results) || count($results) < 1) { throw new Horde_Vfs_Exception('Unable to create VFS file.'); } $allowed = false; foreach ($results as $result) { if ($result['vfs_owner'] == $this->_params['user'] || $result['vfs_perm'] & self::FLAG_WRITE) { $allowed = true; break; } } if (!$allowed) { throw new Horde_Vfs_Exception('Access denied creating VFS file.'); } $previous = $thispath; } } return parent::writeData($path, $name, $data, $autocreate); } /** * Deletes a file from the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $sql = sprintf('SELECT vfs_id, vfs_owner, vfs_perms FROM %s WHERE vfs_path = ? AND vfs_name= ? AND vfs_type = ?', $this->_params['table']); try { $fileList = $this->_db->selectAll($sql, array($path, $name, self::FILE)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if (!is_array($fileList) || count($fileList) < 1) { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } /* There may be one or more files with the same name but the user may * not have read access to them, so doesn't see them. So we have to * delete the one they have access to. */ foreach ($fileList as $file) { if ($file['vfs_owner'] == $this->_params['user'] || $file['vfs_perms'] & self::FLAG_WRITE) { $sql = sprintf('DELETE FROM %s WHERE vfs_id = ?', $this->_params['table']); try { $result = $this->_db->delete($sql, array($file['vfs_id'])); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($result == 0) { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } return; } } // FIXME: 'Access Denied deleting file %s/%s' throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } /** * Renames a file or folder in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { $sql = sprintf('SELECT vfs_id, vfs_owner, vfs_perms FROM %s WHERE vfs_path = ? AND vfs_name= ?', $this->_params['table']); try { $fileList = $this->_db->selectAll($sql, array($oldpath, $oldname)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if (!is_array($fileList) || count($fileList) < 1) { throw new Horde_Vfs_Exception('Unable to rename VFS file.'); } if (strpos($newpath, '/') === false) { $parent = ''; $path = $newpath; } else { list($parent, $path) = explode('/', $newpath, 2); } if (!$this->isFolder($parent, $path)) { $this->autocreatePath($newpath); } /* There may be one or more files with the same name but the user may * not have read access to them, so doesn't see them. So we have to * rename the one they have access to. */ foreach ($fileList as $file) { if ($file['vfs_owner'] == $this->_params['user'] || $file['vfs_perms'] & self::FLAG_WRITE) { $sql = sprintf('UPDATE %s SET vfs_path = ?, vfs_name = ?, vfs_modified = ? WHERE vfs_id = ?', $this->_params['table']); try { $this->_db->update( $sql, array($newpath, $newname, time(), $file['vfs_id'])); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } } throw new Horde_Vfs_Exception(sprintf('Unable to rename VFS file %s/%s.', $oldpath, $oldname)); } /** * Creates a folder on the VFS. * * @param string $path Holds the path of directory to create folder. * @param string $name Holds the name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { /* Make sure we have write access to this and all parent paths. */ if (strlen($path)) { $paths = explode('/', $path); $previous = ''; foreach ($paths as $thispath) { $sql = sprintf('SELECT vfs_owner, vfs_perms FROM %s WHERE vfs_path = ? AND vfs_name= ?', $this->_params['table']); try { $results = $this->_db->selectAll($sql, array($previous, $thispath)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if (!is_array($results) || count($results) < 1) { throw new Horde_Vfs_Exception('Unable to create VFS directory.'); } $allowed = false; foreach ($results as $result) { if ($result['vfs_owner'] == $this->_params['user'] || $result['vfs_perms'] & self::FLAG_WRITE) { $allowed = true; break; } } if (!$allowed) { throw new Horde_Vfs_Exception('Access denied creating VFS directory.'); } $previous = $thispath; } } $sql = sprintf('INSERT INTO %s (vfs_type, vfs_path, vfs_name, vfs_modified, vfs_owner, vfs_perms) VALUES (?, ?, ?, ?, ?, ?)', $this->_params['table']); try { $this->_db->insert( $sql, array(self::FOLDER, $path, $name, time(), $this->_params['user'], 0)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * Deletes a folder from the VFS. * * @param string $path The path to delete the folder from. * @param string $name The foldername to use. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { if ($recursive) { $this->emptyFolder($path . '/' . $name); } else { $list = $this->listFolder($path . '/' . $name); if (count($list)) { throw new Horde_Vfs_Exception(sprintf('Unable to delete %s, the directory is not empty', $path . '/' . $name)); } } $sql = sprintf('SELECT vfs_id, vfs_owner, vfs_perms FROM %s WHERE vfs_path = ? AND vfs_name= ? AND vfs_type = ?', $this->_params['table']); try { $fileList = $this->_db->selectAll($sql, array($path, $name, self::FOLDER)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if (!is_array($fileList) || count($fileList) < 1) { throw new Horde_Vfs_Exception('Unable to delete VFS directory.'); } /* There may be one or more folders with the same name but as the user * may not have read access to them, they don't see them. So we have * to delete the one they have access to */ foreach ($fileList as $file) { if ($file['vfs_owner'] == $this->_params['user'] || $file['vfs_perms'] & self::FLAG_WRITE) { $sql = sprintf('DELETE FROM %s WHERE vfs_id = ?', $this->_params['table']); try { $result = $this->_db->delete($sql, array($file['vfs_id'])); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($result == 0) { throw new Horde_Vfs_Exception('Unable to delete VFS directory.'); } return $result; } } // FIXME: 'Access Denied deleting folder %s/%s' throw new Horde_Vfs_Exception('Unable to delete VFS directory.'); } /** * Returns an an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param mixed $filter String/hash to filter file/dirname on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { $length_op = $this->_getFileSizeOp(); $sql = sprintf('SELECT vfs_name, vfs_type, vfs_modified, vfs_owner, vfs_perms, %s(vfs_data) length FROM %s WHERE vfs_path = ? AND (vfs_owner = ? OR vfs_perms \&\& ?)', $length_op, $this->_params['table']); try { $fileList = $this->_db->selectAll( $sql, array($path, $this->_params['user'], self::FLAG_READ)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } $files = array(); foreach ($fileList as $line) { // Filter out dotfiles if they aren't wanted. if (!$dotfiles && substr($line['vfs_name'], 0, 1) == '.') { continue; } $file['name'] = stripslashes($line['vfs_name']); if ($line['vfs_type'] == self::FILE) { $name = explode('.', $line['vfs_name']); if (count($name) == 1) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } $file['size'] = $line['length']; } elseif ($line['vfs_type'] == self::FOLDER) { $file['type'] = '**dir'; $file['size'] = -1; } $file['date'] = $line['vfs_modified']; $file['owner'] = $line['vfs_owner']; $line['vfs_perms'] = intval($line['vfs_perms']); $file['perms'] = ($line['vfs_type'] == self::FOLDER) ? 'd' : '-'; $file['perms'] .= 'rw-'; $file['perms'] .= ($line['vfs_perms'] & self::FLAG_READ) ? 'r' : '-'; $file['perms'] .= ($line['vfs_perms'] & self::FLAG_WRITE) ? 'w' : '-'; $file['perms'] .= '-'; $file['group'] = ''; // Filtering. if ($this->_filterMatch($filter, $file['name'])) { unset($file); continue; } if ($dironly && $file['type'] !== '**dir') { unset($file); continue; } $files[$file['name']] = $file; unset($file); } return $files; } /** * Changes permissions for an Item on the VFS. * * @param string $path The path of directory of the item. * @param string $name The name of the item. * @param string $permission The permission to set in octal notation. * * @throws Horde_Vfs_Exception */ public function changePermissions($path, $name, $permission) { $val = intval(substr($permission, -1)); $perm = 0; $perm |= ($val & 4) ? self::FLAG_READ : 0; $perm |= ($val & 2) ? self::FLAG_WRITE : 0; $sql = sprintf('SELECT vfs_id, vfs_owner, vfs_perms FROM %s WHERE vfs_path = ? AND vfs_name= ?', $this->_params['table']); try { $fileList = $this->_db->selectAll($sql, array($path, $name)); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if (!is_array($fileList) || count($fileList) < 1) { throw new Horde_Vfs_Exception('Unable to rename VFS file.'); } /* There may be one or more files with the same name but the user may * not have read access to them, so doesn't see them. So we have to * chmod the one they have access to. */ foreach ($fileList as $file) { if ($file['vfs_owner'] == $this->_params['user'] || $file['vfs_perms'] & self::FLAG_WRITE) { $sql = sprintf('UPDATE %s SET vfs_perms = ? WHERE vfs_id = ?', $this->_params['table']); try { $this->_db->update($sql, array($perm, $file['vfs_id'])); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } } throw new Horde_Vfs_Exception(sprintf('Unable to change permission for VFS file %s/%s.', $path, $name)); } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Null.php0000664000175000017500000000415012654104000015460 0ustar janjan * @category Horde * @copyright 2014-2016 Horde LLC * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package Vfs * @since 2.1.3 */ class Horde_Vfs_Null extends Horde_Vfs_Base { /** */ public function size($path, $name) { return 0; } /** */ public function read($path, $name) { return ''; } /** */ public function readFile($path, $name) { throw new Horde_Vfs_Exception('Unable to create temporary file.'); } /** */ public function readByteRange($path, $name, &$offset, $length, &$remaining) { $remaining = 0; return ''; } /** */ public function write($path, $name, $tmpFile, $autocreate = false) { } /** */ public function writeData($path, $name, $data, $autocreate = false) { } /** */ public function deleteFile($path, $name) { } /** */ public function rename($oldpath, $oldname, $newpath, $newname) { } /** */ public function createFolder($path, $name) { } /** */ public function deleteFolder($path, $name, $recursive = false) { } /** */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { return array(); } /** */ public function changePermissions($path, $name, $permission) { } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Smb.php0000664000175000017500000005476612654104000015311 0ustar janjan. Adapted with * permission by Patrice Levesque from phpsmb-0.8 code, and * converted to the LGPL. Please do not taunt original author, contact * Patrice Levesque or dev@lists.horde.org. * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @author Paul Gareau * @author Patrice Levesque * @package Vfs * @todo Add driver for smbclient extension https://github.com/eduardok/libsmbclient-php */ /** * Stateless VFS implementation for a SMB server, based on smbclient. * * Required values for $params: * - username: (string) The username with which to connect to the SMB server. * - password: (string) The password with which to connect to the SMB server. * - hostspec: (string) The SMB server to connect to. * - share: (string) The share to access on the SMB server. Any trailing * paths will removed from the share and prepended to each path * in further requests. Example: a share of 'myshare/basedir' and * a request to 'dir/subdir' will result in a request to * 'basedir/dir/subdir' on myshare. * - smbclient: (string) The path to the 'smbclient' executable. * * Optional values for $params: * - port: (integer) The SMB port number to connect to. * - ipaddress: (string) The address of the server to connect to. * * Functions not implemented: * - changePermissions(): The SMB permission style does not fit with the * module. * * All paths need to use forward slashes! * * @author Paul Gareau * @author Patrice Levesque * @package Vfs */ class Horde_Vfs_Smb extends Horde_Vfs_Base { /** * List of additional credentials required for this VFS backend. * * @var array */ protected $_credentials = array('username', 'password'); /** * Has the vfsroot already been created? * * @var boolean */ protected $_rootCreated = false; /** * Retrieves the size of a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return integer The file size. * @throws Horde_Vfs_Exception */ public function size($path, $name) { $file = $this->readFile($path, $name); return filesize($file); } /** * Retrieves a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. */ public function read($path, $name) { $file = $this->readFile($path, $name); $size = filesize($file); return ($size === 0) ? '' : file_get_contents($file); } /** * Retrieves a file from the VFS as an on-disk local file. * * This function provides a file on local disk with the data of a VFS file * in it. This file cannot be modified! The behavior if you do * modify it is undefined. It will be removed at the end of the request. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string A local filename. */ public function readFile($path, $name) { // Create a temporary file and register it for deletion at the // end of this request. if (!($localFile = Horde_Util::getTempFile('vfs'))) { throw new Horde_Vfs_Exception('Unable to create temporary file.'); } $this->_createRoot(); list($npath, $name) = $this->_escapeShellCommand($this->_getNativePath($path), $name); $cmd = array('get \"' . $name . '\" ' . $localFile); $this->_command($npath, $cmd); if (!file_exists($localFile)) { throw new Horde_Vfs_Exception(sprintf('Unable to open VFS file "%s".', $this->_getPath($path, $name))); } clearstatcache(); return $localFile; } /** * Open a stream to a file in the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return resource The stream. */ public function readStream($path, $name) { return fopen($this->readFile($path, $name), substr(PHP_OS, 0, 3) == 'WIN' ? 'rb' : 'r'); } /** * Stores a file in the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to be * stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { $this->_createRoot(); // Double quotes not allowed in SMB filename. $name = str_replace('"', "'", $name); list($npath, $name) = $this->_escapeShellCommand($this->_getNativePath($path), $name); $cmd = array('put \"' . $tmpFile . '\" \"' . $name . '\"'); // do we need to first autocreate the directory? if ($autocreate) { $this->autocreatePath($path); } $this->_command($npath, $cmd); } /** * Stores a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { $tmpFile = Horde_Util::getTempFile('vfs'); file_put_contents($tmpFile, $data); try { $this->write($path, $name, $tmpFile, $autocreate); unlink($tmpFile); } catch (Horde_Vfs_Exception $e) { unlink($tmpFile); throw $e; } } /** * Deletes a file from the VFS. * * @param string $path The path to delete the file from. * @param string $name The filename to use. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $this->_createRoot(); list($path, $name) = $this->_escapeShellCommand($this->_getNativePath($path), $name); $cmd = array('del \"' . $name . '\"'); $this->_command($path, $cmd); } /** * Checks if a given pathname is a folder. * * @param string $path The path to the folder. * @param string $name The file or folder name. * * @return boolean True if it is a folder, false otherwise. */ public function isFolder($path, $name) { $this->_createRoot(); list($path, $name) = $this->_escapeShellCommand($this->_getNativePath($path), $name); try { $this->_command($this->_getPath($path, $name), array('quit')); return true; } catch (Horde_Vfs_Exception $e) { return false; } } /** * Deletes a folder from the VFS. * * @param string $path The path to delete the folder from. * @param string $name The name of the folder to delete. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { $this->_createRoot(); if (!$this->isFolder($path, $name)) { throw new Horde_Vfs_Exception(sprintf('"%s" is not a directory.', $path . '/' . $name)); } $file_list = $this->listFolder($this->_getPath($path, $name)); if ($file_list && !$recursive) { throw new Horde_Vfs_Exception(sprintf('Unable to delete "%s", the directory is not empty.', $this->_getPath($path, $name))); } foreach ($file_list as $file) { if ($file['type'] == '**dir') { $this->deleteFolder($this->_getPath($path, $name), $file['name'], $recursive); } else { $this->deleteFile($this->_getPath($path, $name), $file['name']); } } // Really delete the folder. list($npath, $name) = $this->_escapeShellCommand($this->_getNativePath($path), $name); $cmd = array('rmdir \"' . $name . '\"'); try { $this->_command($npath, $cmd); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception(sprintf('Unable to delete VFS folder "%s".', $this->_getPath($path, $name))); } } /** * Renames a file in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { $this->_createRoot(); $this->autocreatePath($newpath); // Double quotes not allowed in SMB filename. The '/' character should // also be removed from the beginning/end of the names. $oldname = str_replace('"', "'", trim($oldname, '/')); $newname = str_replace('"', "'", trim($newname, '/')); if (empty($oldname)) { throw new Horde_Vfs_Exception('Unable to rename VFS file to same name.'); } /* If the path was not empty (i.e. the path is not the root path), * then add the trailing '/' character to path. */ if (!empty($oldpath)) { $oldpath .= '/'; } if (!empty($newpath)) { $newpath .= '/'; } list($file, $name) = $this->_escapeShellCommand($oldname, $newname); $cmd = array( 'rename \"' . str_replace('/', '\\\\', $this->_getNativePath($oldpath)) . $file . '\" \"' . str_replace('/', '\\\\', $this->_getNativePath($newpath)) . $name . '\"' ); try { $this->_command('', $cmd); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception(sprintf('Unable to rename VFS file "%s".', $this->_getPath($oldpath, $oldname))); } } /** * Creates a folder on the VFS. * * @param string $path The path of directory to create folder. * @param string $name The name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { $this->_createRoot(); // Double quotes not allowed in SMB filename. $name = str_replace('"', "'", $name); list($dir, $mkdir) = $this->_escapeShellCommand($this->_getNativePath($path), $name); $cmd = array('mkdir \"' . $mkdir . '\"'); try { $this->_command($dir, $cmd); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception(sprintf('Unable to create VFS folder "%s".', $this->_getPath($path, $name))); } } /** * Returns a file list of the directory passed in. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * @param boolean $recursive Return all directory levels recursively? * * @return array File list. * @throws Horde_Vfs_Exception */ public function listFolder($path = '', $filter = null, $dotfiles = true, $dironly = false, $recursive = false) { $this->_createRoot(); list($path) = $this->_escapeShellCommand($this->_getNativePath($path)); return $this->parseListing($this->_command($path, array('ls')), $filter, $dotfiles, $dironly); } /** */ public function parseListing($res, $filter, $dotfiles, $dironly) { $num_lines = count($res); $files = array(); for ($r = 0; $r < $num_lines; $r++) { // Match file listing. if (!preg_match('/^ (.+?) +([A-Z]*) +(\d+) (\w\w\w \w\w\w [ \d]\d \d\d:\d\d:\d\d \d\d\d\d)$/', $res[$r], $match)) { continue; } // If the file name isn't . or .. if ($match[1] == '.' || $match[1] == '..') { continue; } $my_name = $match[1]; // Filter out dotfiles if they aren't wanted. if (!$dotfiles && substr($my_name, 0, 1) == '.') { continue; } $my_size = $match[3]; $ext_name = explode('.', $my_name); if ((strpos($match[2], 'D') !== false)) { $my_type = '**dir'; $my_size = -1; } else { $my_type = Horde_String::lower($ext_name[count($ext_name) - 1]); } $my_date = strtotime($match[4]); $filedata = array('owner' => '', 'group' => '', 'perms' => '', 'name' => $my_name, 'type' => $my_type, 'date' => $my_date, 'size' => $my_size); // watch for filters and dironly if ($this->_filterMatch($filter, $my_name)) { unset($file); continue; } if ($dironly && $my_type !== '**dir') { unset($file); continue; } $files[$filedata['name']] = $filedata; } return $files; } /** * Copies a file through the backend. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function copy($path, $name, $dest, $autocreate = false) { $this->_checkDestination($path, $dest); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, true) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('%s already exists.', $this->_getPath($dest, $name))); } } if ($this->isFolder($path, $name)) { $this->_copyRecursive($path, $name, $dest); } else { try { $this->write($dest, $name, $this->readFile($path, $name)); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception(sprintf('Copy failed: %s', $this->_getPath($dest, $name))); } } } /** * Moves a file through the backend. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function move($path, $name, $dest, $autocreate = false) { $orig = $this->_getPath($path, $name); if (preg_match('|^' . preg_quote($orig) . '/?$|', $dest)) { throw new Horde_Vfs_Exception('Cannot copy file(s) - destination is within source.'); } if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, true) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('%s already exists.', $this->_getPath($dest, $name))); } } try { $this->rename($path, $name, $dest, $name); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception(sprintf('Failed to move to "%s".', $this->_getPath($dest, $name))); } } /** * Returns the full path of a directory. * * @param string $path The directory. * * @return string Full path to the directory. */ protected function _getNativePath($path) { if (isset($this->_params['vfsroot']) && strlen($this->_params['vfsroot'])) { if (strlen($path)) { $path = $this->_params['vfsroot'] . '/' . $path; } else { $path = $this->_params['vfsroot']; } } // In some samba versions after samba-3.0.25-pre2, $path must // end in a trailing slash. if (substr($path, -1) != '/') { $path .= '/'; } return $path; } /** * Replacement for escapeshellcmd(), variable length args, as we only want * certain characters escaped. * * @param array $array Strings to escape. * * @return array TODO */ protected function _escapeShellCommand() { $ret = array(); $args = func_get_args(); foreach ($args as $arg) { $ret[] = str_replace(array(';', '\\'), array('\;', '\\\\'), $arg); } return $ret; } /** * Executes a command and returns output lines in array. * * @param string $cmd Command to be executed. * * @return array Array on success. * @throws Horde_Vfs_Exception */ protected function _execute($cmd) { $cmd = str_replace('"-U%"', '-N', $cmd); $proc = proc_open( $cmd, array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes); if (!is_resource($proc)) { // This should never happen. throw new Horde_Vfs_Exception('Failed to call proc_open().'); } $out = explode("\n", trim(stream_get_contents($pipes[1]))); $error = explode("\n", trim(stream_get_contents($pipes[2]))); $ret = proc_close($proc); // In some cases, (like trying to delete a nonexistant file), // smbclient will return success (at least on 2.2.7 version I'm // testing on). So try to match error strings, even after success. if ($ret != 0) { $err = ''; foreach ($error as $line) { if (strpos($line, 'Usage:') === 0) { $err = 'Command syntax incorrect'; break; } if (strpos($line, 'ERRSRV') !== false || strpos($line, 'ERRDOS') !== false) { $err = preg_replace('/.*\((.+)\).*/', '\\1', $line); if (!$err) { $err = $line; } break; } } if (!$err) { $err = $out ? $out[count($out) - 1] : $ret; } throw new Horde_Vfs_Exception($err); } // Check for errors even on success. $err = ''; foreach ($out as $line) { if (strpos($line, 'NT_STATUS_NO_SUCH_FILE') !== false || strpos($line, 'NT_STATUS_OBJECT_NAME_NOT_FOUND') !== false) { $err = Horde_Vfs_Translation::t("No such file"); break; } elseif (strpos($line, 'NT_STATUS_ACCESS_DENIED') !== false) { $err = Horde_Vfs_Translation::t("Permission Denied"); break; } } if ($err) { throw new Horde_Vfs_Exception($err); } return $out; } /** * Executes SMB commands - without authentication - and returns output * lines in array. * * @param array $path Base path for command. * @param array $cmd Commands to be executed. * * @return array Array on success. * @throws Horde_Vfs_Exception */ protected function _command($path, $cmd) { $share_parts = explode('/', $this->_params['share']); list($share) = $this->_escapeShellCommand(array_shift($share_parts)); if ($share_parts) { $path = implode('/', $share_parts) . '/' . $path; } putenv('PASSWD=' . $this->_params['password']); $port = isset($this->_params['port']) ? (' "-p' . $this->_params['port'] . '"') : ''; $ipoption = isset($this->_params['ipaddress']) ? (' -I ' . $this->_params['ipaddress']) : ''; $domain = isset($this->_params['domain']) ? (' -W ' . $this->_params['domain']) : ''; $fullcmd = $this->_params['smbclient'] . ' "//' . $this->_params['hostspec'] . '/' . $share . '"' . $port . ' "-U' . $this->_params['username'] . '"' . ' -D "' . $path . '" ' . $ipoption . $domain . ' -c "'; foreach ($cmd as $c) { $fullcmd .= $c . ";"; } $fullcmd .= '"'; return $this->_execute($fullcmd); } /** * Authenticates a user on the SMB server and share. * * @throws Horde_Vfs_Exception */ protected function _connect() { try { $this->_command('', array('quit')); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception('Authentication to the SMB server failed.'); } } /** * Creates the vfsroot. */ protected function _createRoot() { if ($this->_rootCreated) { return; } if (!empty($this->_params['vfsroot'])) { $path = ''; foreach (explode('/', $this->_params['vfsroot']) as $dir) { try { $this->_command($path . $dir, array()); } catch (Horde_Vfs_Exception $e) { try { $this->_command($path, array('mkdir \"' . $dir . '\"')); } catch (Horde_Vfs_Exception $e) { throw new Horde_Vfs_Exception(sprintf('Unable to create VFS root directory "%s".', $this->_params['vfsroot'])); } } $path .= '/' . $dir; } } $this->_rootCreated = true; } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Sql.php0000664000175000017500000006265412654104000015322 0ustar janjan * @author Jan Schneider * @category Horde * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package VFS */ class Horde_Vfs_Sql extends Horde_Vfs_Base { /* File value for vfs_type column. */ const FILE = 1; /* Folder value for vfs_type column. */ const FOLDER = 2; /** * Handle for the current database connection. * * @var Horde_Db */ protected $_db = false; /** * List of permissions and if they can be changed in this VFS backend. * * @var array */ protected $_permissions = array(); /** * List of features that the VFS driver supports. * * @var array */ protected $_features = array( 'readByteRange' => true, ); /** * Constructor. * * @param array $params A hash containing connection parameters. */ public function __construct($params = array()) { $params = array_merge(array('table' => 'horde_vfs'), $params); parent::__construct($params); $this->_db = $this->_params['db']; unset($this->_params['db']); } /** * Retrieves the filesize from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return integer The file size. * @throws Horde_Vfs_Exception */ public function size($path, $name) { $length_op = $this->_getFileSizeOp(); $path = $this->_convertPath($path); list($op, $values) = $this->_nullString($path); $sql = sprintf( 'SELECT %s(vfs_data) FROM %s WHERE vfs_path %s AND vfs_name = ?', $length_op, $this->_params['table'], $op ); $values[] = $name; try { $size = $this->_db->selectValue($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($size === false) { throw new Horde_Vfs_Exception(sprintf('Unable to check file size of "%s/%s".', $path, $name)); } return $size; } /** * Returns the size of a folder. * * @param string $path The path of the folder. * * @return integer The size of the folder in bytes. * @throws Horde_Vfs_Exception */ public function getFolderSize($path = null) { try { $where = null; $params = array(); if (strlen($path)) { $where = 'WHERE vfs_path = ? OR vfs_path LIKE ?'; $path = $this->_convertPath($path); $params = array($path, $path . '/%'); } $sql = sprintf('SELECT SUM(%s(vfs_data)) FROM %s %s', $this->_getFileSizeOp(), $this->_params['table'], $where); $size = $this->_db->selectValue($sql, $params); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } return (int)$size; } /** * Retrieves a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function read($path, $name) { return $this->_readBlob($this->_params['table'], 'vfs_data', array( 'vfs_path' => $this->_convertPath($path), 'vfs_name' => $name )); } /** * Retrieves a part of a file from the VFS. Particularly useful * when reading large files which would exceed the PHP memory * limits if they were stored in a string. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * @param integer $offset The offset of the part. (The new offset will * be stored in here). * @param integer $length The length of the part. If the length = -1, * the whole part after the offset is * retrieved. If more bytes are given as exists * after the given offset. Only the available * bytes are read. * @param integer $remaining The bytes that are left, after the part that * is retrieved. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function readByteRange($path, $name, &$offset, $length, &$remaining) { $data = $this->_readBlob($this->_params['table'], 'vfs_data', array( 'vfs_path' => $this->_convertPath($path), 'vfs_name' => $name )); // Calculate how many bytes MUST be read, so the remainging // bytes and the new offset can be calculated correctly. $size = strlen ($data); if ($length == -1 || (($length + $offset) > $size)) { $length = $size - $offset; } if ($remaining < 0) { $remaining = 0; } $data = substr($data, $offset, $length); $offset = $offset + $length; $remaining = $size - $offset; return $data; } /** * Stores a file in the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to * be stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { /* Don't need to check quota here since it will be checked when * writeData() is called. */ return $this->writeData($path, $name, file_get_contents($tmpFile), $autocreate); } /** * Store a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { $this->_checkQuotaWrite('string', $data, $path, $name); $path = $this->_convertPath($path); list($op, $values) = $this->_nullString($path); /* Check to see if the data already exists. */ try { $sql = sprintf( 'SELECT vfs_id FROM %s WHERE vfs_path %s AND vfs_name = ?', $this->_params['table'], $op ); $values[] = $name; $id = $this->_db->selectValue($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($id) { $this->_updateBlob($this->_params['table'], 'vfs_data', $data, array('vfs_id' => $id), array('vfs_modified' => time())); return; } /* Check to see if the folder already exists. */ $dirs = explode('/', $path); $path_name = array_pop($dirs); $parent = implode('/', $dirs); if (!$this->isFolder($parent, $path_name)) { if (!$autocreate) { throw new Horde_Vfs_Exception(sprintf('Folder "%s" does not exist', $path)); } $this->autocreatePath($path); } return $this->_insertBlob($this->_params['table'], 'vfs_data', $data, array( 'vfs_type' => self::FILE, 'vfs_path' => strlen($path) ? $path : null, 'vfs_name' => $name, 'vfs_modified' => time(), 'vfs_owner' => $this->_params['user'] )); } /** * Delete a file from the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $this->_checkQuotaDelete($path, $name); $path = $this->_convertPath($path); list($op, $values) = $this->_nullString($path); try { $sql = sprintf( 'DELETE FROM %s WHERE vfs_type = ? AND vfs_path %s AND vfs_name = ?', $this->_params['table'], $op ); array_unshift($values, self::FILE); array_push($values, $name); $result = $this->_db->delete($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($result == 0) { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } } /** * Rename a file or folder in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { if (strpos($newpath, '/') === false) { $parent = ''; $path = $newpath; } else { list($parent, $path) = explode('/', $newpath, 2); } if (!$this->isFolder($parent, $path)) { $this->autocreatePath($newpath); } $oldpath = $this->_convertPath($oldpath); $newpath = $this->_convertPath($newpath); if (!strlen($newpath)) { $newpath = null; } list($op, $values) = $this->_nullString($oldpath); $sql = sprintf( 'UPDATE %s SET vfs_path = ?, vfs_name = ?, vfs_modified = ? WHERE vfs_path %s AND vfs_name = ?', $this->_params['table'], $op ); $values = array_merge( array($newpath, $newname, time()), $values, array($oldname) ); try { $result = $this->_db->update($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($result == 0) { throw new Horde_Vfs_Exception('Unable to rename VFS file.'); } $this->_recursiveRename($oldpath, $oldname, $newpath, $newname); } /** * Creates a folder on the VFS. * * @param string $path Holds the path of directory to create folder. * @param string $name Holds the name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { $path = $this->_convertPath($path); if (!strlen($path)) { $path = null; } $sql = sprintf( 'INSERT INTO %s (vfs_type, vfs_path, vfs_name, vfs_modified, vfs_owner) VALUES (?, ?, ?, ?, ?)', $this->_params['table'] ); $values = array(self::FOLDER, $path, $name, time(), $this->_params['user'] ?: null); try { $this->_db->insert($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * Horde_Vfs_Sql override of isFolder() to check for root folder. * * @param string $path Path to possible folder * @param string $name Name of possible folder * * @return boolean True if $path/$name is a folder */ public function isFolder($path, $name) { $path = $this->_convertPath($path); if ($path == '' && $name == '') { // The root of VFS is always a folder. return true; } $path = $this->_getNativePath($path, $name); $name = basename($path); $path = dirname($path); if ($path == '.') { $path = ''; } list($op, $values) = $this->_nullString($path); try { return (bool)$this->_db->selectValue( sprintf( 'SELECT 1 FROM %s WHERE vfs_type = ? AND vfs_path %s AND vfs_name = ?', $this->_params['table'], $op ), array_merge(array(self::FOLDER), $values, array($name)) ); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * Delete a folder from the VFS. * * @param string $path The path of the folder. * @param string $name The folder name to use. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { $path = $this->_convertPath($path); $folderPath = $this->_getNativePath($path, $name); /* Check if not recursive and fail if directory not empty */ if (!$recursive) { $folderList = $this->listFolder($folderPath, null, true); if (!empty($folderList)) { throw new Horde_Vfs_Exception(sprintf('Unable to delete %s, the directory is not empty', $path . '/' . $name)); } } /* Remember the size of the folder. */ if (!is_null($this->_vfsSize)) { $size = $this->getFolderSize($folderPath); } /* First delete everything below the folder, so if error we get no * orphans. */ try { $sql = sprintf('DELETE FROM %s WHERE vfs_path %s', $this->_params['table'], ' LIKE ' . $this->_db->quote($this->_getNativePath($folderPath, '%'))); $this->_db->delete($sql); } catch (Horde_Db_Exception $e) { $this->_vfsSize = null; throw new Horde_Vfs_Exception('Unable to delete VFS recursively: ' . $e->getMessage()); } /* Now delete everything inside the folder. */ list ($op, $values) = $this->_nullString($folderPath); try { $sql = sprintf( 'DELETE FROM %s WHERE vfs_path %s', $this->_params['table'], $op ); $this->_db->delete($sql, $values); } catch (Horde_Db_Exception $e) { $this->_vfsSize = null; throw new Horde_Vfs_Exception('Unable to delete VFS directory: ' . $e->getMessage()); } /* All ok now delete the actual folder */ list($op, $values) = $this->_nullString($path); try { $sql = sprintf( 'DELETE FROM %s WHERE vfs_path %s AND vfs_name = ?', $this->_params['table'], $op ); $values[] = $name; $this->_db->delete($sql, $values); } catch (Horde_Db_Exception $e) { $this->_vfsSize = null; throw new Horde_Vfs_Exception('Unable to delete VFS directory: ' . $e->getMessage()); } /* Update VFS size. */ if (!is_null($this->_vfsSize)) { $this->_vfsSize -= $size; } } /** * Returns an an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { if (!$this->isFolder(dirname($path), basename($path))) { throw new Horde_Vfs_Exception(sprintf('"%s" is not a folder.', $path)); } $path = $this->_convertPath($path); list($op, $values) = $this->_nullString($path); try { $length_op = $this->_getFileSizeOp(); $sql = sprintf( 'SELECT vfs_name, vfs_type, %s(vfs_data) length, vfs_modified, vfs_owner FROM %s WHERE vfs_path %s', $length_op, $this->_params['table'], $op ); $fileList = $this->_db->select($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } $files = array(); foreach ($fileList as $line) { // Filter out dotfiles if they aren't wanted. if (!$dotfiles && substr($line['vfs_name'], 0, 1) == '.') { continue; } $file['name'] = $line['vfs_name']; if ($line['vfs_type'] == self::FILE) { $name = explode('.', $line['vfs_name']); if (count($name) == 1) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } $file['size'] = $line['length']; } elseif ($line['vfs_type'] == self::FOLDER) { $file['type'] = '**dir'; $file['size'] = -1; } $file['date'] = $line['vfs_modified']; $file['owner'] = isset($line['vfs_owner']) ? $line['vfs_owner'] : ''; $file['perms'] = ''; $file['group'] = ''; // filtering if ($this->_filterMatch($filter, $file['name'])) { unset($file); continue; } if ($dironly && $file['type'] !== '**dir') { unset($file); continue; } $files[$file['name']] = $file; unset($file); } return $files; } /** * Garbage collect files in the VFS storage system. * * @param string $path The VFS path to clean. * @param integer $secs The minimum amount of time (in seconds) required * before a file is removed. * * @throws Horde_Vfs_Exception */ public function gc($path, $secs = 345600) { $path = $this->_convertPath($path); list($op, $values) = $this->_nullString($path); $sql = sprintf( 'DELETE FROM %s WHERE vfs_type = ? AND vfs_modified < ? AND (vfs_path %s OR vfs_path LIKE ?)', $this->_params['table'], $op ); $values = array_merge( array(self::FILE, time() - $secs), $values, array($path . '/%') ); try { $this->_db->delete($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * Renames all child paths. * * @param string $path The path of the folder to rename. * @param string $name The foldername to use. * * @throws Horde_Vfs_Exception */ protected function _recursiveRename($oldpath, $oldname, $newpath, $newname) { $oldpath = $this->_convertPath($oldpath); $newpath = $this->_convertPath($newpath); $sql = sprintf( 'SELECT vfs_name FROM %s WHERE vfs_type = ? AND vfs_path = ?', $this->_params['table'] ); $values = array(self::FOLDER, $this->_getNativePath($oldpath, $oldname)); try { $folderList = $this->_db->selectValues($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } foreach ($folderList as $folder) { $this->_recursiveRename($this->_getNativePath($oldpath, $oldname), $folder, $this->_getNativePath($newpath, $newname), $folder); } $sql = sprintf( 'UPDATE %s SET vfs_path = ? WHERE vfs_path = ?', $this->_params['table'] ); $values = array( $this->_getNativePath($newpath, $newname), $this->_getNativePath($oldpath, $oldname) ); try { $this->_db->update($sql, $values); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * Return a full filename on the native filesystem, from a VFS * path and name. * * @param string $path The VFS file path. * @param string $name The VFS filename. * * @return string The full native filename. */ protected function _getNativePath($path, $name) { if (!strlen($path)) { return $name; } if (isset($this->_params['home']) && preg_match('|^~/?(.*)$|', $path, $matches)) { $path = $this->_params['home'] . '/' . $matches[1]; } return $path . '/' . $name; } /** * Read file data from the SQL VFS backend. * * @param string $table The VFS table name. * @param string $field TODO * @param array $criteria TODO * * @return mixed TODO * @throws Horde_Vfs_Exception */ protected function _readBlob($table, $field, $criteria) { if (!count($criteria)) { throw new Horde_Vfs_Exception('You must specify the fetch criteria'); } $where = ''; foreach ($criteria as $key => $value) { if (!empty($where)) { $where .= ' AND '; } $where .= $key . ' = ' . $this->_db->quote($value); } $sql = sprintf('SELECT %s FROM %s WHERE %s', $field, $table, $where); try { $result = $this->_db->selectValue($sql); $columns = $this->_db->columns($table); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } if ($result === false) { throw new Horde_Vfs_Exception('Unable to load SQL data.'); } return $columns[$field]->binaryToString($result); } /** * TODO * * @param string $table TODO * @param string $field TODO * @param string $data TODO * @param string $attributes TODO * * @return mixed TODO * @throws Horde_Vfs_Exception */ protected function _insertBlob($table, $field, $data, $attributes) { $attributes[$field] = new Horde_Db_Value_Binary($data); /* Execute the query. */ try { $this->_db->insertBlob($table, $attributes); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * TODO * * @param string $table TODO * @param string $field TODO * @param string $data TODO * @param string $where TODO * @param array $alsoupdate TODO * * @return mixed TODO * @throws Horde_Vfs_Exception */ protected function _updateBlob($table, $field, $data, $where, $alsoupdate) { $wherestring = ''; $wherevalues = array(); foreach ($where as $key => $value) { if (!empty($wherestring)) { $wherestring .= ' AND '; } $wherestring .= $key . ' = ?'; $wherevalues[] = $value; } /* Execute the query. */ try { $this->_db->updateBlob( $table, array_merge( $alsoupdate, array($field => new Horde_Db_Value_Binary($data)) ), array($wherestring, $wherevalues) ); } catch (Horde_Db_Exception $e) { throw new Horde_Vfs_Exception($e); } } /** * Converts the path name from regular filesystem form to the internal * format needed to access the file in the database. * * Namely, we will treat '/' as a base directory as this is pretty much * the standard way to access base directories over most filesystems. * * @param string $path A VFS path. * * @return string The path with any surrouding slashes stripped off. */ protected function _convertPath($path) { return trim($path, '/'); } /** * TODO * * @return string TODO */ protected function _getFileSizeOp() { switch ($this->_db->adapterName()) { case 'PostgreSQL': case 'PDO_PostgreSQL': return 'OCTET_LENGTH'; default: return 'LENGTH'; } } /** * Returns a comparison for a possibly empty string. * * Returns IS NULL instead of an equals operator if the string is empty. * * @param string $value A string. * * @return array */ protected function _nullString($value) { return strlen($value) ? array('= ?', array($value)) : array('IS NULL', array()); } } Horde_Vfs-2.3.1/lib/Horde/Vfs/SqlFile.php0000664000175000017500000005145212654104000016114 0ustar janjan * db - (DB) The DB object. * vfsroot - (string) The root directory of where the files should be * actually stored. * * Optional values:
 * table - (string) The name of the vfs table in 'database'. Defaults to
 *         'horde_vfs'.
* * The table structure for the VFS can be found in data/vfs.sql. * * @author Michael Varghese * @category Horde * @package VFS */ class Horde_Vfs_SqlFile extends Horde_Vfs_File { /* File value for vfs_type column. */ const FILE = 1; /* Folder value for vfs_type column. */ const FOLDER = 2; /** * Handle for the current database connection. * * @var DB */ protected $_db = false; /** * Constructor. * * @param array $params A hash containing connection parameters. */ public function __construct($params = array()) { throw new Horde_Vfs_Exception('The SqlFile VFS driver needs to be refactored to a real composite driver.'); } /** * Store a file in the VFS, with the data copied from a temporary * file. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to be * stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { /* No need to check quota here as we will check it when we call * writeData(). */ $data = file_get_contents($tmpFile); return $this->writeData($path, $name, $data, $autocreate); } /** * Store a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { $this->_checkQuotaWrite('string', $data, $path, $name); $fp = @fopen($this->_getNativePath($path, $name), 'w'); if (!$fp) { if ($autocreate) { $this->autocreatePath($path); $fp = @fopen($this->_getNativePath($path, $name), 'w'); if (!$fp) { throw new Horde_Vfs_Exception('Unable to open VFS file for writing.'); } } else { throw new Horde_Vfs_Exception('Unable to open VFS file for writing.'); } } if (!@fwrite($fp, $data)) { throw new Horde_Vfs_Exception('Unable to write VFS file data.'); } if ($this->_writeSQLData($path, $name) instanceof PEAR_Error) { @unlink($this->_getNativePath($path, $name)); throw new Horde_Vfs_Exception('Unable to write VFS file data.'); } } /** * Moves a file in the database and the file system. * * @param string $path The path to store the file in. * @param string $name The old filename. * @param string $dest The new filename. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function move($path, $name, $dest, $autocreate = false) { $orig = $this->_getNativePath($path, $name); if (preg_match('|^' . preg_quote($orig) . '/?$|', $dest)) { throw new Horde_Vfs_Exception('Cannot move file(s) - destination is within source.'); } if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, false) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception('Unable to move VFS file.'); } } if (strpos($dest, $this->_getSQLNativePath($path, $name)) !== false) { throw new Horde_Vfs_Exception('Unable to move VFS file.'); } $this->rename($path, $name, $dest, $name); } /** * Copies a file through the backend. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function copy($path, $name, $dest, $autocreate = false) { $this->_checkDestination($path, $dest); $this->_connect(); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, false) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception('Unable to copy VFS file.'); } } if (strpos($dest, $this->_getSQLNativePath($path, $name)) !== false) { throw new Horde_Vfs_Exception('Unable to copy VFS file.'); } if (is_dir($orig)) { return $this->_recursiveCopy($path, $name, $dest); } $this->_checkQuotaWrite('file', $orig, $dest, $name); if (!@copy($orig, $this->_getNativePath($dest, $name))) { throw new Horde_Vfs_Exception('Unable to copy VFS file.'); } $id = $this->_db->nextId($this->_params['table']); $query = sprintf('INSERT INTO %s (vfs_id, vfs_type, vfs_path, vfs_name, vfs_modified, vfs_owner) VALUES (?, ?, ?, ?, ?, ?)', $this->_params['table']); $values = array($id, self::FILE, $dest, $name, time(), $this->_params['user']); $result = $this->_db->query($query, $values); if ($result instanceof PEAR_Error) { unlink($this->_getNativePath($dest, $name)); throw new Horde_Vfs_Exception($result->getMessage()); } } /** * Creates a folder on the VFS. * * @param string $path Holds the path of directory to create folder. * @param string $name Holds the name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { $this->_connect(); $id = $this->_db->nextId($this->_params['table']); $result = $this->_db->query(sprintf('INSERT INTO %s (vfs_id, vfs_type, vfs_path, vfs_name, vfs_modified, vfs_owner) VALUES (?, ?, ?, ?, ?, ?)', $this->_params['table']), array($id, self::FOLDER, $path, $name, time(), $this->_params['user'])); if ($result instanceof PEAR_Error) { throw new Horde_Vfs_Exception($result->getMessage()); } if (!@mkdir($this->_getNativePath($path, $name))) { $result = $this->_db->query(sprintf('DELETE FROM %s WHERE vfs_id = ?', $this->_params['table']), array($id)); throw new Horde_Vfs_Exception('Unable to create VFS directory.'); } } /** * Rename a file or folder in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { $this->_connect(); if (strpos($newpath, '/') === false) { $parent = ''; $path = $newpath; } else { list($parent, $path) = explode('/', $newpath, 2); } if (!$this->isFolder($parent, $path)) { $this->autocreatePath($newpath); } $this->_db->query(sprintf('UPDATE %s SET vfs_path = ?, vfs_name = ?, vfs_modified = ? WHERE vfs_path = ? AND vfs_name = ?', $this->_params['table']), array($newpath, $newname, time(), $oldpath, $oldname)); if ($this->_db->affectedRows() == 0) { throw new Horde_Vfs_Exception('Unable to rename VFS file.'); } if (is_a($this->_recursiveSQLRename($oldpath, $oldname, $newpath, $newname), 'PEAR_Error')) { $this->_db->query(sprintf('UPDATE %s SET vfs_path = ?, vfs_name = ? WHERE vfs_path = ? AND vfs_name = ?', $this->_params['table']), array($oldpath, $oldname, $newpath, $newname)); throw new Horde_Vfs_Exception('Unable to rename VFS directory.'); } if (!@is_dir($this->_getNativePath($newpath))) { $this->autocreatePath($newpath); } if (!@rename($this->_getNativePath($oldpath, $oldname), $this->_getNativePath($newpath, $newname))) { $this->_db->query(sprintf('UPDATE %s SET vfs_path = ?, vfs_name = ? WHERE vfs_path = ? AND vfs_name = ?', $this->_params['table']), array($oldpath, $oldname, $newpath, $newname)); return PEAR::raiseError(Horde_Vfs_Translation::t("Unable to rename VFS file.")); } } /** * Delete a folder from the VFS. * * @param string $path The path to delete the folder from. * @param string $name The foldername to use. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { $this->_connect(); if ($recursive) { $this->emptyFolder($path . '/' . $name); } else { $list = $this->listFolder($path . '/' . $name); if (count($list)) { throw new Horde_Vfs_Exception(sprintf('Unable to delete %s, the directory is not empty', $path . '/' . $name)); } } $result = $this->_db->query(sprintf('DELETE FROM %s WHERE vfs_type = ? AND vfs_path = ? AND vfs_name = ?', $this->_params['table']), array(self::FOLDER, $path, $name)); if ($this->_db->affectedRows() == 0 || ($result instanceof PEAR_Error)) { throw new Horde_Vfs_Exception('Unable to delete VFS directory.'); } if ($this->_recursiveSQLDelete($path, $name) instanceof PEAR_Error || $this->_recursiveLFSDelete($path, $name) instanceof PEAR_Error) { throw new Horde_Vfs_Exception('Unable to delete VFS directory recursively.'); } } /** * Delete a file from the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $this->_checkQuotaDelete($path, $name); $this->_connect(); $result = $this->_db->query(sprintf('DELETE FROM %s WHERE vfs_type = ? AND vfs_path = ? AND vfs_name = ?', $this->_params['table']), array(self::FILE, $path, $name)); if ($this->_db->affectedRows() == 0) { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } if ($result instanceof PEAR_Error) { throw new Horde_Vfs_Exception($result->getMessage()); } if (!@unlink($this->_getNativePath($path, $name))) { throw new Horde_Vfs_Exception('Unable to delete VFS file.'); } } /** * Returns an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { $this->_connect(); $files = array(); $fileList = $this->_db->getAll(sprintf('SELECT vfs_name, vfs_type, vfs_modified, vfs_owner FROM %s WHERE vfs_path = ?', $this->_params['table']), array($path)); if ($fileList instanceof PEAR_Error) { throw new Horde_Vfs_Exception($fileList->getMessage()); } foreach ($fileList as $line) { // Filter out dotfiles if they aren't wanted. if (!$dotfiles && substr($line[0], 0, 1) == '.') { continue; } $file['name'] = $line[0]; if ($line[1] == self::FILE) { $name = explode('.', $line[0]); if (count($name) == 1) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } $file['size'] = filesize($this->_getNativePath($path, $line[0])); } elseif ($line[1] == self::FOLDER) { $file['type'] = '**dir'; $file['size'] = -1; } $file['date'] = $line[2]; $file['owner'] = $line[3]; $file['perms'] = ''; $file['group'] = ''; // Filtering. if ($this->_filterMatch($filter, $file['name'])) { unset($file); continue; } if ($dironly && $file['type'] !== '**dir') { unset($file); continue; } $files[$file['name']] = $file; unset($file); } return $files; } /** * Recursively copies the contents of a folder to a destination. * * @param string $path The path to store the directory in. * @param string $name The name of the directory. * @param string $dest The destination of the directory. * * @throws Horde_Vfs_Exception */ protected function _recursiveCopy($path, $name, $dest) { $this->createFolder($dest, $name); $file_list = $this->listFolder($this->_getSQLNativePath($path, $name)); foreach ($file_list as $file) { $this->copy($this->_getSQLNativePath($path, $name), $file['name'], $this->_getSQLNativePath($dest, $name)); } } /** * Store a files information within the database. * * @param string $path The path to store the file in. * @param string $name The filename to use. * * @throws Horde_Vfs_Exception */ protected function _writeSQLData($path, $name) { $this->_connect(); // File already exists in database if ($this->exists($path, $name)) { $query = 'UPDATE ' . $this->_params['table'] . ' SET vfs_modified = ?' . ' WHERE vfs_path = ? AND vfs_name = ?'; $values = array(time(), $path, $name); } else { $id = $this->_db->nextId($this->_params['table']); $query = 'INSERT INTO ' . $this->_params['table'] . ' (vfs_id, vfs_type, vfs_path, vfs_name, vfs_modified,' . ' vfs_owner) VALUES (?, ?, ?, ?, ?, ?)'; $values = array($id, self::FILE, $path, $name, time(), $this->_params['user']); } return $this->_db->query($query, $values); } /** * Renames all child paths. * * @param string $oldpath The old path of the folder to rename. * @param string $oldname The old name. * @param string $newpath The new path of the folder to rename. * @param string $newname The new name. * * @throws Horde_Vfs_Exception */ protected function _recursiveSQLRename($oldpath, $oldname, $newpath, $newname) { $folderList = $this->_db->getCol(sprintf('SELECT vfs_name FROM %s WHERE vfs_type = ? AND vfs_path = ?', $this->_params['table']), 0, array(self::FOLDER, $this->_getSQLNativePath($oldpath, $oldname))); foreach ($folderList as $folder) { $this->_recursiveSQLRename($this->_getSQLNativePath($oldpath, $oldname), $folder, $this->_getSQLNativePath($newpath, $newname), $folder); } $result = $this->_db->query(sprintf('UPDATE %s SET vfs_path = ? WHERE vfs_path = ?', $this->_params['table']), array($this->_getSQLNativePath($newpath, $newname), $this->_getSQLNativePath($oldpath, $oldname))); if ($result instanceof PEAR_Error) { throw new Horde_Vfs_Exception($result->getMessage()); } } /** * Delete a folders contents from the VFS in the SQL database, * recursively. * * @param string $path The path of the folder. * @param string $name The foldername to use. * * @throws Horde_Vfs_Exception */ protected function _recursiveSQLDelete($path, $name) { $result = $this->_db->query(sprintf('DELETE FROM %s WHERE vfs_type = ? AND vfs_path = ?', $this->_params['table']), array(self::FILE, $this->_getSQLNativePath($path, $name))); if ($result instanceof PEAR_Error) { throw new Horde_Vfs_Exception($result->getMessage()); } $folderList = $this->_db->getCol(sprintf('SELECT vfs_name FROM %s WHERE vfs_type = ? AND vfs_path = ?', $this->_params['table']), 0, array(self::FOLDER, $this->_getSQLNativePath($path, $name))); foreach ($folderList as $folder) { $this->_recursiveSQLDelete($this->_getSQLNativePath($path, $name), $folder); } $this->_db->query(sprintf('DELETE FROM %s WHERE vfs_type = ? AND vfs_name = ? AND vfs_path = ?', $this->_params['table']), array(self::FOLDER, $name, $path)); } /** * Delete a folders contents from the VFS, recursively. * * @param string $path The path of the folder. * @param string $name The foldername to use. * * @throws Horde_Vfs_Exception */ protected function _recursiveLFSDelete($path, $name) { $dir = $this->_getNativePath($path, $name); $dh = @opendir($dir); while (false !== ($file = readdir($dh))) { if ($file != '.' && $file != '..') { if (is_dir($dir . '/' . $file)) { $this->_recursiveLFSDelete(!strlen($path) ? $name : $path . '/' . $name, $file); } else { @unlink($dir . '/' . $file); } } } @closedir($dh); rmdir($dir); } /** * Attempts to open a persistent connection to the SQL server. * * @throws Horde_Vfs_Exception */ protected function _connect() { if ($this->_db !== false) { return; } $required = array('db', 'vfsroot'); foreach ($required as $val) { if (!isset($this->_params[$val])) { throw new Horde_Vfs_Exception(sprintf('Required "%s" not specified in VFS configuration.', $val)); } } $this->_params = array_merge(array( 'table' => 'horde_vfs', ), $this->_params); $this->_db = $this->_params['db']; } /** * Return a full filename on the native filesystem, from a VFS * path and name. * * @param string $path The VFS file path. * @param string $name The VFS filename. * * @return string The full native filename. */ protected function _getNativePath($path, $name) { if (strlen($name)) { $name = '/' . $name; } if (strlen($path)) { if (isset($this->_params['home']) && preg_match('|^~/?(.*)$|', $path, $matches)) { $path = $this->_params['home'] . '/' . $matches[1]; } return $this->_params['vfsroot'] . '/' . $path . $name; } return $this->_params['vfsroot'] . $name; } /** * Return a full SQL filename on the native filesystem, from a VFS * path and name. * * @param string $path The VFS file path. * @param string $name The VFS filename. * * @return string The full native filename. */ protected function _getSQLNativePath($path, $name) { return strlen($path) ? $path . '/' . $name : $name; } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Ssh2.php0000664000175000017500000007171612654104000015401 0ustar janjan * username - (string) The username with which to connect to the ssh2 server. * password - (string) The password with which to connect to the ssh2 server. * hostspec - (string) The ssh2 server to connect to. * * Optional values for $params:
 * port - (integer) The port used to connect to the ssh2 server if other than
 *        22.
* * Copyright 2006-2016 Horde LLC (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @editor Cliff Green * @package Vfs */ class Horde_Vfs_Ssh2 extends Horde_Vfs_Base { /** * List of additional credentials required for this VFS backend. * * @var array */ protected $_credentials = array('username', 'password'); /** * List of permissions and if they can be changed in this VFS backend. * * @var array */ protected $_permissions = array( 'owner' => array( 'read' => true, 'write' => true, 'execute' => true ), 'group' => array( 'read' => true, 'write' => true, 'execute' => true ), 'all' => array( 'read' => true, 'write' => true, 'execute' => true ) ); /** * Variable holding the connection to the ssh2 server. * * @var resource */ protected $_stream = false; /** * The SFTP resource stream. * * @var resource */ protected $_sftp; /** * The current working directory. * * @var string */ protected $_cwd; /** * Local cache array for user IDs. * * @var array */ protected $_uids = array(); /** * Local cache array for group IDs. * * @var array */ protected $_gids = array(); /** * Returns the size of a file. * * @param string $path The path of the file. * @param string $name The filename. * * @return integer The size of the file in bytes. * @throws Horde_Vfs_Exception */ public function size($path, $name) { $this->_connect(); $statinfo = @ssh2_sftp_stat($this->_sftp, $this->_getPath($path, $name)); if (($size = $statinfo['size']) === false) { throw new Horde_Vfs_Exception(sprintf('Unable to check file size of "%s".', $this->_getPath($path, $name))); } return $size; } /** * Retrieves a file from the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. * @throws Horde_Vfs_Exception */ public function read($path, $name) { $file = $this->readFile($path, $name); clearstatcache(); return (filesize($file) === 0) ? '' : file_get_contents($file); } /** * Retrieves a file from the VFS as an on-disk local file. * * This function provides a file on local disk with the data of a VFS file * in it. This file cannot be modified! The behavior if you do * modify it is undefined. It will be removed at the end of the request. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string A local filename. * @throws Horde_Vfs_Exception */ public function readFile($path, $name) { $this->_connect(); // Create a temporary file and register it for deletion at the // end of this request. if (!($localFile = Horde_Util::getTempFile('vfs'))) { throw new Horde_Vfs_Exception('Unable to create temporary file.'); } if (!$this->_recv($this->_getPath($path, $name), $localFile)) { throw new Horde_Vfs_Exception(sprintf('Unable to open VFS file "%s".', $this->_getPath($path, $name))); } return $localFile; } /** * Open a stream to a file in the VFS. * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return resource The stream. * @throws Horde_Vfs_Exception */ public function readStream($path, $name) { $stream = @fopen($this->_wrap($this->_getPath($path, $name)), 'r'); if (!is_resource($stream)) { throw new Horde_Vfs_Exception('Unable to open VFS file.'); } return $stream; } /** * Stores a file in the VFS. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the data to * be stored. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function write($path, $name, $tmpFile, $autocreate = false) { $this->_connect(); $this->_checkQuotaWrite('file', $tmpFile, $path, $name); if (!$this->_send($tmpFile, $this->_getPath($path, $name))) { if ($autocreate) { $this->autocreatePath($path); if ($this->_send($tmpFile, $this->_getPath($path, $name))) { return; } } throw new Horde_Vfs_Exception(sprintf('Unable to write VFS file "%s".', $this->_getPath($path, $name))); } } /** * Stores a file in the VFS from raw data. * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param boolean $autocreate Automatically create directories? * * @throws Horde_Vfs_Exception */ public function writeData($path, $name, $data, $autocreate = false) { $tmpFile = Horde_Util::getTempFile('vfs'); file_put_contents($tmpFile, $data); clearstatcache(); $this->write($path, $name, $tmpFile, $autocreate); } /** * Deletes a file from the VFS. * * @param string $path The path to delete the file from. * @param string $name The filename to delete. * * @throws Horde_Vfs_Exception */ public function deleteFile($path, $name) { $this->_checkQuotaDelete($path, $name); $this->_connect(); if (!@ssh2_sftp_unlink($this->_sftp, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to delete VFS file "%s".', $this->_getPath($path, $name))); } } /** * Checks if a given item is a folder. * * @param string $path The parent folder. * @param string $name The item name. * * @return boolean True if it is a folder, false otherwise. */ public function isFolder($path, $name) { try { $this->_connect(); } catch (Horde_Vfs_Exception $e) { return false; } /* See if we can stat the remote filename. ANDed with 040000 is true * if it is a directory. */ $statinfo = @ssh2_sftp_stat($this->_sftp, $this->_getPath($path, $name)); return $statinfo['mode'] & 040000; } /** * Deletes a folder from the VFS. * * @param string $path The parent folder. * @param string $name The name of the folder to delete. * @param boolean $recursive Force a recursive delete? * * @throws Horde_Vfs_Exception */ public function deleteFolder($path, $name, $recursive = false) { $this->_connect(); $isDir = false; foreach ($this->listFolder($path) as $file) { if ($file['name'] == $name && $file['type'] == '**dir') { $isDir = true; break; } } if ($isDir) { $file_list = $this->listFolder($path . '/' . $name); if (count($file_list) && !$recursive) { throw new Horde_Vfs_Exception(sprintf('Unable to delete "%s", the directory is not empty.', $this->_getPath($path, $name))); } foreach ($file_list as $file) { if ($file['type'] == '**dir') { $this->deleteFolder($path . '/' . $name, $file['name'], $recursive); } else { $this->deleteFile($path . '/' . $name, $file['name']); } } if (!@ssh2_sftp_rmdir($this->_sftp, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Cannot remove directory "%s".', $this->_getPath($path, $name))); } } else { if (!@ssh2_sftp_unlink($this->_sftp, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Cannot delete file "%s".', $this->_getPath($path, $name))); } } } /** * Renames a file in the VFS. * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @throws Horde_Vfs_Exception */ public function rename($oldpath, $oldname, $newpath, $newname) { $this->_connect(); $this->autocreatePath($newpath); if (!@ssh2_sftp_rename($this->_sftp, $this->_getPath($oldpath, $oldname), $this->_getPath($newpath, $newname))) { throw new Horde_Vfs_Exception(sprintf('Unable to rename VFS file "%s".', $this->_getPath($oldpath, $oldname))); } } /** * Creates a folder on the VFS. * * @param string $path The parent folder. * @param string $name The name of the new folder. * * @throws Horde_Vfs_Exception */ public function createFolder($path, $name) { $this->_connect(); if (!@ssh2_sftp_mkdir($this->_sftp, $this->_getPath($path, $name))) { throw new Horde_Vfs_Exception(sprintf('Unable to create VFS directory "%s".', $this->_getPath($path, $name))); } } /** * Changes permissions for an item on the VFS. * * @param string $path The parent folder of the item. * @param string $name The name of the item. * @param string $permission The permission to set in octal notation. * * @throws Horde_Vfs_Exception */ public function changePermissions($path, $name, $permission) { $this->_connect(); $full = $this->_getPath($path, $name); if (!@ssh2_sftp_chmod($this->_sftp, $full, octdec($permission))) { throw new Horde_Vfs_Exception(sprintf('Unable to change permission for VFS file "%s".', $full)); } } /** * Returns an unsorted file list of the specified directory. * * @param string $path The path of the directory. * @param string|array $filter Regular expression(s) to filter * file/directory name on. * @param boolean $dotfiles Show dotfiles? * @param boolean $dironly Show only directories? * * @return array File list. * @throws Horde_Vfs_Exception */ protected function _listFolder($path = '', $filter = null, $dotfiles = true, $dironly = false) { $this->_connect(); $files = array(); /* If 'maplocalids' is set, check for the POSIX extension. */ $mapids = (!empty($this->_params['maplocalids']) && extension_loaded('posix')); // THIS IS A PROBLEM.... there is no builtin systype() fn for SSH2. // Go with unix-style listings for now... $type = 'unix'; $olddir = $this->getCurrentDirectory(); $path = $this->_getPath('', $path); if (strlen($path)) { $this->_setPath($path); } if ($type == 'unix') { $ls_args = 'l'; // Get numeric ids if we're going to use posix_* functions to // map them. if ($mapids) { $ls_args .= 'n'; } // If we don't want dotfiles, We can save work here by not doing // an ls -a and then not doing the check later (by setting // $dotfiles to true, the if is short-circuited). if ($dotfiles) { $ls_args .= 'a'; $dotfiles = true; } $stream = @ssh2_exec( $this->_stream, 'ls -' . $ls_args . ' ' . escapeshellarg($path), null, array('LC_TIME' => 'C')); } else { $stream = @ssh2_exec($this->_stream, ''); } stream_set_blocking($stream, true); $errstream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR); if ($error = stream_get_contents($errstream)) { fclose($errstream); fclose($stream); throw new Horde_Vfs_Exception($error); } unset($list); while (!feof($stream)) { $line = fgets($stream); if ($line === false) { break; } $list[] = trim($line); } fclose($errstream); fclose($stream); if (!is_array($list)) { if (isset($olddir)) { $this->_setPath($olddir); } return array(); } $currtime = time(); foreach ($list as $line) { $file = array(); $item = preg_split('/\s+/', $line); if (($type == 'unix') || (($type == 'win') && !preg_match('|\d\d-\d\d-\d\d|', $item[0]))) { if ((count($item) < 8) || (substr($line, 0, 5) == 'total')) { continue; } $file['perms'] = $item[0]; if ($mapids) { if (!isset($this->_uids[$item[2]])) { $entry = posix_getpwuid($item[2]); $this->_uids[$item[2]] = (empty($entry)) ? $item[2] : $entry['name']; } $file['owner'] = $this->_uids[$item[2]]; if (!isset($this->_uids[$item[3]])) { $entry = posix_getgrgid($item[3]); $this->_uids[$item[3]] = (empty($entry)) ? $item[3] : $entry['name']; } $file['group'] = $this->_uids[$item[3]]; } else { $file['owner'] = $item[2]; $file['group'] = $item[3]; } // /dev file systems may have an additional column. $addcol = 0; if (substr($item[4], -1) == ',') { $addcol = 1; } $file['name'] = substr($line, strpos($line, sprintf("%s %2s %5s", $item[5 + $addcol], $item[6 + $addcol], $item[7 + $addcol])) + 13); // Filter out '.' and '..' entries. if (preg_match('/^\.\.?\/?$/', $file['name'])) { continue; } // Filter out dotfiles if they aren't wanted. if (!$dotfiles && (substr($file['name'], 0, 1) == '.')) { continue; } $p1 = substr($file['perms'], 0, 1); if ($p1 === 'l') { $file['link'] = substr($file['name'], strpos($file['name'], '->') + 3); $file['name'] = substr($file['name'], 0, strpos($file['name'], '->') - 1); $file['type'] = '**sym'; if ($this->isFolder('', $file['link'])) { $file['linktype'] = '**dir'; } else { $parts = explode('/', $file['link']); $name = explode('.', array_pop($parts)); if ((count($name) == 1) || (($name[0] === '') && (count($name) == 2))) { $file['linktype'] = '**none'; } else { $file['linktype'] = Horde_String::lower(array_pop($name)); } } } elseif ($p1 === 'd') { $file['type'] = '**dir'; } else { $name = explode('.', $file['name']); if ((count($name) == 1) || ((substr($file['name'], 0, 1) === '.') && (count($name) == 2))) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } } if ($file['type'] == '**dir') { $file['size'] = -1; } else { $file['size'] = $item[4 + $addcol]; } if (strpos($item[7 + $addcol], ':') !== false) { $file['date'] = strtotime($item[7 + $addcol] . ':00' . $item[5 + $addcol] . ' ' . $item[6 + $addcol] . ' ' . date('Y', $currtime)); // If the ssh2 server reports a file modification date more // less than one day in the future, don't try to subtract // a year from the date. There is no way to know, for // example, if the VFS server and the ssh2 server reside // in different timezones. We should simply report to the // user what the SSH2 server is returning. if ($file['date'] > ($currtime + 86400)) { $file['date'] = strtotime($item[7 + $addcol] . ':00' . $item[5 + $addcol] . ' ' . $item[6 + $addcol] . ' ' . (date('Y', $currtime) - 1)); } } else { $file['date'] = strtotime('00:00:00' . $item[5 + $addcol] . ' ' . $item[6 + $addcol] . ' ' . $item[7 + $addcol]); } } elseif ($type == 'netware') { $file = array(); $file['perms'] = $item[1]; $file['owner'] = $item[2]; if ($item[0] == 'd') { $file['type'] = '**dir'; } else { $file['type'] = '**none'; } $file['size'] = $item[3]; $file['name'] = $item[7]; for ($index = 8, $c = count($item); $index < $c; $index++) { $file['name'] .= ' ' . $item[$index]; } } else { /* Handle Windows SSH2 servers returning DOS-style file * listings. */ $file['perms'] = ''; $file['owner'] = ''; $file['group'] = ''; $file['name'] = $item[3]; for ($index = 4, $c = count($item); $index < $c; $index++) { $file['name'] .= ' ' . $item[$index]; } $file['date'] = strtotime($item[0] . ' ' . $item[1]); if ($item[2] == '') { $file['type'] = '**dir'; $file['size'] = -1; } else { $file['size'] = $item[2]; $name = explode('.', $file['name']); if ((count($name) == 1) || ((substr($file['name'], 0, 1) === '.') && (count($name) == 2))) { $file['type'] = '**none'; } else { $file['type'] = Horde_String::lower($name[count($name) - 1]); } } } // Filtering. if ($this->_filterMatch($filter, $file['name'])) { unset($file); continue; } if ($dironly && $file['type'] !== '**dir') { unset($file); continue; } $files[$file['name']] = $file; unset($file); } if (isset($olddir)) { $this->_setPath($olddir); } return $files; } /** * Returns if a given file or folder exists in a folder. * * @param string $path The path to the folder. * @param string $name The file or folder name. * * @return boolean True if it exists, false otherwise. */ public function exists($path, $name) { $this->_connect(); return @ssh2_sftp_stat($this->_sftp, $this->_getPath($path, $name)) !== false; } /** * Copies a file through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The name of the destination directory. * @param boolean $autocreate Auto-create the directory if it doesn't * exist? * * @throws Horde_Vfs_Exception */ public function copy($path, $name, $dest, $autocreate = false) { $this->_checkDestination($path, $dest); $this->_connect(); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, true) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('%s already exists.', $this->_getPath($dest, $name))); } } if ($this->isFolder($path, $name)) { $this->_copyRecursive($path, $name, $dest); } else { $tmpFile = Horde_Util::getTempFile('vfs'); if (!$this->_recv($this->_getPath($path, $name), $tmpFile)) { throw new Horde_Vfs_Exception(sprintf('Failed to copy from "%s".', $this->_getPath($path, $name))); } clearstatcache(); $this->_checkQuotaWrite('file', $tmpFile, $dest, $name); if (!$this->_send($tmpFile, $this->_getPath($dest, $name))) { throw new Horde_Vfs_Exception(sprintf('Failed to copy to "%s".', $this->_getPath($dest, $name))); } } } /** * Moves a file through the backend. * * @param string $path The path of the original file. * @param string $name The name of the original file. * @param string $dest The destination file name. * @param boolean $autocreate Auto-create the directory if it doesn't * exist? * * @throws Horde_Vfs_Exception */ public function move($path, $name, $dest, $autocreate = false) { $orig = $this->_getPath($path, $name); if (preg_match('|^' . preg_quote($orig) . '/?$|', $dest)) { throw new Horde_Vfs_Exception('Cannot move file(s) - destination is within source.'); } $this->_connect(); if ($autocreate) { $this->autocreatePath($dest); } foreach ($this->listFolder($dest, null, true) as $file) { if ($file['name'] == $name) { throw new Horde_Vfs_Exception(sprintf('%s already exists.', $this->_getPath($dest, $name))); } } if (!@ssh2_sftp_rename($this->_sftp, $orig, $this->_getPath($dest, $name))) { throw new Horde_Vfs_Exception(sprintf('Failed to move to "%s".', $this->_getPath($dest, $name))); } } /** * Returns the current working directory on the SSH2 server. * * @return string The current working directory. * @throws Horde_Vfs_Exception */ public function getCurrentDirectory() { $this->_connect(); if (!strlen($this->_cwd)) { $stream = @ssh2_exec($this->_stream, 'pwd'); stream_set_blocking($stream, true); $this->_cwd = trim(fgets($stream)); } return $this->_cwd; } /** * Changes the current directory on the server. * * @param string $path The path to change to. * * @throws Horde_Vfs_Exception */ protected function _setPath($path) { if (!($stream = @ssh2_exec($this->_stream, 'cd ' . escapeshellarg($path) . '; pwd'))) { throw new Horde_Vfs_Exception(sprintf('Unable to change to %s.', $path)); } stream_set_blocking($stream, true); $this->_cwd = trim(fgets($stream)); fclose($stream); } /** * Returns the full path of an item. * * @param string $path The directory of the item. * @param string $name The name of the item. * * @return mixed Full path to the file when $path is not empty and just * $name when not set. */ protected function _getPath($path, $name) { if (isset($this->_params['vfsroot']) && strlen($this->_params['vfsroot'])) { if (strlen($path)) { $path = $this->_params['vfsroot'] . '/' . $path; } else { $path = $this->_params['vfsroot']; } } return parent::_getPath($path, $name); } /** * Returns the parent directory of the specified path. * * @param string $path The path to get the parent of. * * @return string The parent directory. * @throws Horde_Vfs_Exception */ protected function _parentDir($path) { $this->_connect(); $this->_setPath('cd ' . $path . '/..'); return $this->getCurrentDirectory(); } /** * Attempts to open a connection to the SSH2 server. * * @throws Horde_Vfs_Exception */ protected function _connect() { if ($this->_stream !== false) { return; } if (!extension_loaded('ssh2')) { throw new Horde_Vfs_Exception('The SSH2 PECL extension is not available.'); } if (!is_array($this->_params)) { throw new Horde_Vfs_Exception('No configuration information specified for SSH2 VFS.'); } $required = array('hostspec', 'username', 'password'); foreach ($required as $val) { if (!isset($this->_params[$val])) { throw new Horde_Vfs_Exception(sprintf('Required "%s" not specified in VFS configuration.', $val)); } } /* Connect to the ssh2 server using the supplied parameters. */ if (empty($this->_params['port'])) { $this->_stream = @ssh2_connect($this->_params['hostspec']); } else { $this->_stream = @ssh2_connect($this->_params['hostspec'], $this->_params['port']); } if (!$this->_stream) { $this->_stream = false; throw new Horde_Vfs_Exception('Connection to SSH2 server failed.'); } if (!@ssh2_auth_password($this->_stream, $this->_params['username'], $this->_params['password'])) { $this->_stream = false; throw new Horde_Vfs_Exception('Authentication to SSH2 server failed.'); } /* Create sftp resource. */ $this->_sftp = @ssh2_sftp($this->_stream); if (!empty($this->_params['vfsroot']) && !@ssh2_sftp_stat($this->_sftp, $this->_params['vfsroot']) && !@ssh2_sftp_mkdir($this->_sftp, $this->_params['vfsroot'])) { throw new Horde_Vfs_Exception(sprintf('Unable to create VFS root directory "%s".', $this->_params['vfsroot'])); } } /** * Sends local file to remote host. * * This function exists because the ssh2_scp_send function doesn't seem to * work on some hosts. * * @param string $local Full path to the local file. * @param string $remote Full path to the remote location. * * @return boolean Success. */ protected function _send($local, $remote) { return @copy($local, $this->_wrap($remote)); } /** * Receives file from remote host. * * This function exists because the ssh2_scp_recv function doesn't seem to * work on some hosts. * * @param string $local Full path to the local file. * @param string $remote Full path to the remote location. * * @return boolean Success. */ protected function _recv($remote, $local) { return @copy($this->_wrap($remote), $local); } /** * Generate a stream wrapper file spec for a remote file path * * @param string $remote Full path to the remote location * * @return string A full stream wrapper path to the remote location */ protected function _wrap($remote) { $wrapper = 'ssh2.sftp://' . $this->_params['username'] . ':' . $this->_params['password'] . '@' . $this->_params['hostspec']; if (!empty($this->_params['port'])) { $wrapper .= ':' . $this->_params['port']; } if ($remote{0} != '/') { $remote = $this->getCurrentDirectory() . '/' . $remote; } return $wrapper . $remote; } } Horde_Vfs-2.3.1/lib/Horde/Vfs/Translation.php0000664000175000017500000000135112654104000017044 0ustar janjan * @package Vfs */ class Horde_Vfs_Translation extends Horde_Translation_Autodetect { /** * The translation domain * * @var string */ protected static $_domain = 'Horde_Vfs'; /** * The absolute PEAR path to the translations for the default gettext handler. * * @var string */ protected static $_pearDirectory = '@data_dir@'; } Horde_Vfs-2.3.1/lib/Horde/Vfs.php0000664000175000017500000000260612654104000014552 0ustar janjan * @package Vfs */ class Horde_Vfs { /* Quota constants. */ const QUOTA_METRIC_BYTE = 1; const QUOTA_METRIC_KB = 2; const QUOTA_METRIC_MB = 3; const QUOTA_METRIC_GB = 4; /** * Attempts to return a concrete instance based on $driver. * * @deprecated * * @param mixed $driver The type of concrete subclass to return. This * is based on the storage driver ($driver). The * code is dynamically included. * @param array $params A hash containing any additional configuration or * connection parameters a subclass might need. * * @return VFS The newly created concrete VFS instance. * @throws Horde_Vfs_Exception */ public static function factory($driver, $params = array()) { $class = 'Horde_Vfs_' . basename(Horde_String::ucfirst($driver)); if (class_exists($class)) { return new $class($params); } throw new Horde_Vfs_Exception('Class definition of ' . $class . ' not found.'); } } Horde_Vfs-2.3.1/locale/ar/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017336 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/ar/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000153112654104000017335 0ustar janjan# Arabic translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "" #: lib/VFS/sql_file.php:264 #, fuzzy msgid "Unable to rename VFS file." msgstr "لا توجد إمكانية لتغيير اسم ملف الـ VFS %s/%s." Horde_Vfs-2.3.1/locale/bg/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017324 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/bg/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000154212654104000017325 0ustar janjan# Bulgarian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Права" #: lib/VFS/sql_file.php:264 #, fuzzy msgid "Unable to rename VFS file." msgstr "Грешка при четенето на vfsroot папка." Horde_Vfs-2.3.1/locale/bs/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017340 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/bs/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000142712654104000017343 0ustar janjan# Bosnian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Dozvole" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/ca/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000110112654104000017304 0ustar janjan<\p q~@,No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No existeix aquest arxiuPermis denegatNo s'ha pogut canviar el nom de l'arxiu VFS.Horde_Vfs-2.3.1/locale/ca/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000153112654104000017316 0ustar janjan# Catalan translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "No existeix aquest arxiu" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Permis denegat" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "No s'ha pogut canviar el nom de l'arxiu VFS." Horde_Vfs-2.3.1/locale/cs/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000116612654104000017341 0ustar janjan<\p q~2DWNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2; Soubor neexistujePřístup odepřenNelze přejmenovat VFS soubor.Horde_Vfs-2.3.1/locale/cs/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000162012654104000017337 0ustar janjan# Czech translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "Soubor neexistuje" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Přístup odepřen" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Nelze přejmenovat VFS soubor." Horde_Vfs-2.3.1/locale/da/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000116212654104000017314 0ustar janjan<\p q~1CVNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_Vfs Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2013-01-29 11:43+0100 PO-Revision-Date: 2014-03-26 16:11+0100 Last-Translator: Erling Preben Hansen Language-Team: i18n@lists.horde.org Language: da MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Filen findes ikkeTilladelse nægtetKan ikke omdøbe VFS filen.Horde_Vfs-2.3.1/locale/da/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000166012654104000017322 0ustar janjan# Danish translations for Horde_Vfs package. # Copyright (C) 2014 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_Vfs package. # Erling Preben Hansen , 2014. # msgid "" msgstr "" "Project-Id-Version: Horde_Vfs\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2013-01-29 11:43+0100\n" "PO-Revision-Date: 2014-03-26 16:11+0100\n" "Last-Translator: Erling Preben Hansen \n" "Language-Team: i18n@lists.horde.org\n" "Language: da\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/Horde/Vfs/Smb.php:586 msgid "No such file" msgstr "Filen findes ikke" #: lib/Horde/Vfs/Smb.php:589 msgid "Permission Denied" msgstr "Tilladelse nægtet" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "Kan ikke omdøbe VFS filen." Horde_Vfs-2.3.1/locale/de/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000116712654104000017325 0ustar janjan<\p q~v"7,JNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2015-12-28 17:25+0100 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Datei nicht gefundenZugriff verweigertDie VFS-Datei konnte nicht umbenannt werden.Horde_Vfs-2.3.1/locale/de/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000164712654104000017333 0ustar janjan# German translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2015-12-28 17:25+0100\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/Horde/Vfs/Smb.php:595 msgid "No such file" msgstr "Datei nicht gefunden" #: lib/Horde/Vfs/Smb.php:598 msgid "Permission Denied" msgstr "Zugriff verweigert" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "Die VFS-Datei konnte nicht umbenannt werden." Horde_Vfs-2.3.1/locale/el/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000103412654104000017326 0ustar janjan,<PQklCUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Αδύνατη η μετονομασία του VFS αρχείου.Horde_Vfs-2.3.1/locale/el/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000163212654104000017335 0ustar janjan# Greek translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Εξουσιοδότηση" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Αδύνατη η μετονομασία του VFS αρχείου." Horde_Vfs-2.3.1/locale/es/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000123612654104000017341 0ustar janjan<\p q~Sh$yNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_Vfs Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2013-01-29 11:43+0100 PO-Revision-Date: 2013-06-11 20:26+0200 Last-Translator: Manuel P. Ayala , Juan C. Blanco Language-Team: i18n@lists.horde.org Language: es MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); El archivo no existePermiso denegadoIncapaz de renombrar el archivo VFS.Horde_Vfs-2.3.1/locale/es/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000172312654104000017345 0ustar janjan# Spanish translations for Horde_Vfs package. # Copyright (C) 2013 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_Vfs package. # Automatically generated, 2013. # msgid "" msgstr "" "Project-Id-Version: Horde_Vfs \n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2013-01-29 11:43+0100\n" "PO-Revision-Date: 2013-06-11 20:26+0200\n" "Last-Translator: Manuel P. Ayala , Juan C. Blanco " "\n" "Language-Team: i18n@lists.horde.org\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/Horde/Vfs/Smb.php:586 msgid "No such file" msgstr "El archivo no existe" #: lib/Horde/Vfs/Smb.php:589 msgid "Permission Denied" msgstr "Permiso denegado" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "Incapaz de renombrar el archivo VFS." Horde_Vfs-2.3.1/locale/et/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000114512654104000017341 0ustar janjan<\p q~k,"BNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Sellist faili ei oleJuurdepääs keelatudVFS faili ümbernimetamine nurjus.Horde_Vfs-2.3.1/locale/et/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000160212654104000017342 0ustar janjan# Estonian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "Sellist faili ei ole" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Juurdepääs keelatud" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "VFS faili ümbernimetamine nurjus." Horde_Vfs-2.3.1/locale/eu/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000126112654104000017341 0ustar janjan<\p q~cw(No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_Vfs Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2012-10-12 19:05+0200 PO-Revision-Date: 2013-01-17 14:53+0100 Last-Translator: Ibon Igartua Language-Team: Euskal Herriko Unibertsitatea Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); X-Poedit-Language: Basque Fitxategi ezezagunaBaimena ukatu daEzin zaio VFS fitxategiari izena aldatu.Horde_Vfs-2.3.1/locale/eu/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000174512654104000017353 0ustar janjan# Basque translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_Vfs\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2012-10-12 19:05+0200\n" "PO-Revision-Date: 2013-01-17 14:53+0100\n" "Last-Translator: Ibon Igartua \n" "Language-Team: Euskal Herriko Unibertsitatea \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Language: Basque\n" #: lib/Horde/Vfs/Smb.php:564 msgid "No such file" msgstr "Fitxategi ezezaguna" #: lib/Horde/Vfs/Smb.php:567 msgid "Permission Denied" msgstr "Baimena ukatu da" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Ezin zaio VFS fitxategiari izena aldatu." Horde_Vfs-2.3.1/locale/fa/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000075612654104000017326 0ustar janjan,<PQ@l@Unable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit نمی‌توان پرونده VFS را تغییر نام دادHorde_Vfs-2.3.1/locale/fa/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000153012654104000017320 0ustar janjan# Persian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "مجوز" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "نمی‌توان پرونده VFS را تغییر نام داد" Horde_Vfs-2.3.1/locale/fi/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000121312654104000017323 0ustar janjan<\p q~4N)aNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2012-10-12 19:05+0200 PO-Revision-Date: 2012-03-07 15:11:34+0200 Last-Translator: Leena Heino Language-Team: Finnish Language: fi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Tiedostoa ei ole olemassaKäyttö kiellettyEi voitu nimetä uudelleen VFS-tiedostoa.Horde_Vfs-2.3.1/locale/fi/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000170412654104000017333 0ustar janjan# Finnish translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Leena Heino , 2010-2012. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2012-10-12 19:05+0200\n" "PO-Revision-Date: 2012-03-07 15:11:34+0200\n" "Last-Translator: Leena Heino \n" "Language-Team: Finnish \n" "Language: fi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/Horde/Vfs/Smb.php:564 msgid "No such file" msgstr "Tiedostoa ei ole olemassa" #: lib/Horde/Vfs/Smb.php:567 msgid "Permission Denied" msgstr "Käyttö kielletty" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Ei voitu nimetä uudelleen VFS-tiedostoa." Horde_Vfs-2.3.1/locale/fr/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000127012654104000017337 0ustar janjan<\p q~j}&No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2013-01-14 09:19+0100 PO-Revision-Date: 2013-01-17 17:34+0100 Last-Translator: Paul De Vlieger Language-Team: French Language: fr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n > 1); X-Generator: Lokalize 1.4 Fichier inexistantPermission refuséeImpossible de renommer le fichier VFS.Horde_Vfs-2.3.1/locale/fr/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000206112654104000017341 0ustar janjan# French translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # Paul De Vlieger , 2013 msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2013-01-14 09:19+0100\n" "PO-Revision-Date: 2013-01-17 17:34+0100\n" "Last-Translator: Paul De Vlieger \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Lokalize 1.4\n" #: lib/Horde/Vfs/Smb.php:586 msgid "No such file" msgstr "Fichier inexistant" #: lib/Horde/Vfs/Smb.php:589 msgid "Permission Denied" msgstr "Permission refusée" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "Impossible de renommer le fichier VFS." Horde_Vfs-2.3.1/locale/gl/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017336 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/gl/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000141012654104000017331 0ustar janjan# Galician translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/he/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000064512654104000017331 0ustar janjan$,8k9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Horde_Vfs-2.3.1/locale/he/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000146512654104000017335 0ustar janjan# Hebrew translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/hr/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000131712654104000017343 0ustar janjan<\p q~(No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2011-11-04 15:10+0100 PO-Revision-Date: 2011-11-08 16:49+0200 Last-Translator: Valentin Vidic Language-Team: i18n@lists.horde.org Language: hr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Nepostojeća datotekaPristup odbijenNije uspjelo premienovanje VFS datoteke.Horde_Vfs-2.3.1/locale/hr/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000202612654104000017344 0ustar janjan# Croatian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Valentin Vidic , 2011. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2011-11-04 15:10+0100\n" "PO-Revision-Date: 2011-11-08 16:49+0200\n" "Last-Translator: Valentin Vidic \n" "Language-Team: i18n@lists.horde.org\n" "Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: lib/Horde/Vfs/Smb.php:600 msgid "No such file" msgstr "Nepostojeća datoteka" #: lib/Horde/Vfs/Smb.php:603 msgid "Permission Denied" msgstr "Pristup odbijen" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Nije uspjelo premienovanje VFS datoteke." Horde_Vfs-2.3.1/locale/hu/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000120012654104000017335 0ustar janjan<\p q~0G`No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_Vfs Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2013-01-29 11:43+0100 PO-Revision-Date: 2014-07-14 11:35+0200 Last-Translator: Andras Galos Language-Team: i18n@lists.horde.org Language: hu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Nincs ilyen állományHozzáférés megtagadvaA VFS fájl nem nevezhető át.Horde_Vfs-2.3.1/locale/hu/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000162212654104000017350 0ustar janjan# Hungarian translations for Horde_VFS module. # Copyright 2010-2013 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # msgid "" msgstr "" "Project-Id-Version: Horde_Vfs \n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2013-01-29 11:43+0100\n" "PO-Revision-Date: 2014-07-14 11:35+0200\n" "Last-Translator: Andras Galos \n" "Language-Team: i18n@lists.horde.org\n" "Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/Horde/Vfs/Smb.php:586 msgid "No such file" msgstr "Nincs ilyen állomány" #: lib/Horde/Vfs/Smb.php:589 msgid "Permission Denied" msgstr "Hozzáférés megtagadva" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "A VFS fájl nem nevezhető át." Horde_Vfs-2.3.1/locale/id/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017330 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=ASCII Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/id/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000145612654104000017335 0ustar janjan# Indonesian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 #, fuzzy msgid "No such file" msgstr "Tidak ada sisi" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Izin" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/is/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017347 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/is/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000143612654104000017352 0ustar janjan# Icelandic translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Persónulegt" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/it/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000113312654104000017342 0ustar janjan<\p q~k("8No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); File inesistentePermessi negatiImpossibile rinominare il file VFSHorde_Vfs-2.3.1/locale/it/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000156712654104000017360 0ustar janjan# Italian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "File inesistente" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Permessi negati" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Impossibile rinominare il file VFS" Horde_Vfs-2.3.1/locale/ja/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000132012654104000017316 0ustar janjan<\p q~-H$v4No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2013-01-29 11:43+0100 PO-Revision-Date: 2013-06-01 17:01+0900 Last-Translator: Hiromi Kimura Language-Team: i18n@lists.horde.org Language: ja MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; X-Generator: Poedit 1.5.4 そのようなファイルはありませんアクセスは拒否されましたVFS ファイルの名前を変更できません。Horde_Vfs-2.3.1/locale/ja/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000200112654104000017316 0ustar janjan# Japanese translation for Horde. # Copyright 2004-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde package. # Hiromi Kimura # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2013-01-29 11:43+0100\n" "PO-Revision-Date: 2013-06-01 17:01+0900\n" "Last-Translator: Hiromi Kimura \n" "Language-Team: i18n@lists.horde.org\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 1.5.4\n" #: lib/Horde/Vfs/Smb.php:586 msgid "No such file" msgstr "そのようなファイルはありません" #: lib/Horde/Vfs/Smb.php:589 msgid "Permission Denied" msgstr "アクセスは拒否されました" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "VFS ファイルの名前を変更できません。" Horde_Vfs-2.3.1/locale/km/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017343 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/km/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000152312654104000017343 0ustar janjan# Khmer translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "សិទ្ធិ​ត្រូវ​បាន​បដិសេធ" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/ko/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000063612654104000017346 0ustar janjan$,8d9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; Horde_Vfs-2.3.1/locale/ko/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000162012654104000017343 0ustar janjan# Korean translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: lib/VFS/smb.php:573 #, fuzzy msgid "No such file" msgstr "참조" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "개인 메일" #: lib/VFS/sql_file.php:264 #, fuzzy msgid "Unable to rename VFS file." msgstr "VFS 파일 %s/%s을(를) 변경할 수 없습니다." Horde_Vfs-2.3.1/locale/lt/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000125012654104000017345 0ustar janjan<\p q~dvNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2011-05-28 01:09+0300 PO-Revision-Date: 2011-06-28 01:13+0300 Last-Translator: Vilius Šumskas Language-Team: Lithuanian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2); Tokio failo nėraNeužtenka teisiųNepavyko pervadinti VFS failo.Horde_Vfs-2.3.1/locale/lt/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000174312654104000017357 0ustar janjan# Lithuanian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Vilius Šumskas , 2011. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2011-05-28 01:09+0300\n" "PO-Revision-Date: 2011-06-28 01:13+0300\n" "Last-Translator: Vilius Šumskas \n" "Language-Team: Lithuanian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n" "%100<10 || n%100>=20) ? 1 : 2);\n" #: lib/Horde/Vfs/Smb.php:574 msgid "No such file" msgstr "Tokio failo nėra" #: lib/Horde/Vfs/Smb.php:577 msgid "Permission Denied" msgstr "Neužtenka teisių" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Nepavyko pervadinti VFS failo." Horde_Vfs-2.3.1/locale/lv/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000133112654104000017347 0ustar janjan<\p q~ No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_Vfs Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2011-03-15 13:27+0100 PO-Revision-Date: 2011-10-16 15:22+0300 Last-Translator: Jānis Eisaks Language-Team: i18n@lists.horde.org Language: lv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2); X-Poedit-Language: Latvian X-Poedit-Country: LATVIA X-Poedit-SourceCharset: utf-8 Fails neeksistēPieeja liegtaNevar pārdēvēt VFS failu.Horde_Vfs-2.3.1/locale/lv/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000256112654104000017360 0ustar janjan# Latvian translations for Horde_Vfs package. # Copyright 2011-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_Vfs package. # Automatically generated, 2011. # msgid "" msgstr "" "Project-Id-Version: Horde_Vfs\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2011-03-15 13:27+0100\n" "PO-Revision-Date: 2011-10-16 15:22+0300\n" "Last-Translator: Jānis Eisaks \n" "Language-Team: i18n@lists.horde.org\n" "Language: lv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : " "2);\n" "X-Poedit-Language: Latvian\n" "X-Poedit-Country: LATVIA\n" "X-Poedit-SourceCharset: utf-8\n" #: lib/Horde/Vfs/Smb.php:574 msgid "No such file" msgstr "Fails neeksistē" # #-#-#-#-# horde.po (Horde 2.1) #-#-#-#-# # #-#-#-#-# lv_LV.po (Mnemo 2.1.2) #-#-#-#-# # # #-#-#-#-# lv_LV.po (Ingo H3 (1.1.5)) #-#-#-#-# # #-#-#-#-# lv_LV.po (Mnemo 2.1.2) #-#-#-#-# # # #-#-#-#-# mnemo.po (Mnemo 2.1.2) #-#-#-#-# # # #-#-#-#-# ingo.po (Ingo H3 (1.1.5)) #-#-#-#-# # #-#-#-#-# lv_LV.po (Mnemo 2.1.2) #-#-#-#-# # #: lib/Horde/Vfs/Smb.php:577 msgid "Permission Denied" msgstr "Pieeja liegta" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Nevar pārdēvēt VFS failu." Horde_Vfs-2.3.1/locale/mk/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000057212654104000017343 0ustar janjan$,8@9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horde_Vfs-2.3.1/locale/mk/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000141212654104000017340 0ustar janjan# Macedonian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/nb/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000064512654104000017334 0ustar janjan$,8k9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Horde_Vfs-2.3.1/locale/nb/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000161612654104000017336 0ustar janjan# Norwegian Bokmal translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 #, fuzzy msgid "No such file" msgstr "Ingen sider" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Rettighet" #: lib/VFS/sql_file.php:264 #, fuzzy msgid "Unable to rename VFS file." msgstr "Kan ikke åpne komprimert arkiv." Horde_Vfs-2.3.1/locale/nl/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000123712654104000017344 0ustar janjan<\p q~XmNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2012-10-12 19:05+0200 PO-Revision-Date: 2012-11-02 22:48+0100 Last-Translator: Arjen de Korte Language-Team: Dutch Language: nl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Lokalize 1.4 Bestand bestaat nietToegang geweigerdKan VFS bestand niet hernoemen.Horde_Vfs-2.3.1/locale/nl/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000174412654104000017352 0ustar janjan# Dutch translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # # Arjen de Korte , 2012. msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2012-10-12 19:05+0200\n" "PO-Revision-Date: 2012-11-02 22:48+0100\n" "Last-Translator: Arjen de Korte \n" "Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Lokalize 1.4\n" #: lib/Horde/Vfs/Smb.php:564 msgid "No such file" msgstr "Bestand bestaat niet" #: lib/Horde/Vfs/Smb.php:567 msgid "Permission Denied" msgstr "Toegang geweigerd" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Kan VFS bestand niet hernoemen." Horde_Vfs-2.3.1/locale/nn/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000064512654104000017350 0ustar janjan$,8k9Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Horde_Vfs-2.3.1/locale/nn/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000152012654104000017344 0ustar janjan# Norwegian Nynorsk translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Tilgang" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/pl/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000073712654104000017352 0ustar janjan$,89Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Horde_Vfs-2.3.1/locale/pl/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000165712654104000017357 0ustar janjan# Polish translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Uprawnienie" #: lib/VFS/sql_file.php:264 #, fuzzy msgid "Unable to rename VFS file." msgstr "Błąd przy zmianie nazwy pliku." Horde_Vfs-2.3.1/locale/pt/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000114612654104000017355 0ustar janjan<\p q~k+(=No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Arquivo inexistentePermissão NegadaNão foi possível renomear arquivo VFS.Horde_Vfs-2.3.1/locale/pt/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000160512654104000017360 0ustar janjan# Portuguese translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "Arquivo inexistente" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Permissão Negada" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Não foi possível renomear arquivo VFS." Horde_Vfs-2.3.1/locale/pt_BR/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000120112654104000017730 0ustar janjan<\p q~9M!_No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2013-01-29 11:43+0100 PO-Revision-Date: 2011-06-12 19:49-0300 Last-Translator: Luis Felipe Marzagao Language-Team: i18n@lists.horde.org Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n > 1); Arquivo inexistentePermissão NegadaImpossível renomear arquivo VFS.Horde_Vfs-2.3.1/locale/pt_BR/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000166512654104000017751 0ustar janjan# Portuguese translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2013-01-29 11:43+0100\n" "PO-Revision-Date: 2011-06-12 19:49-0300\n" "Last-Translator: Luis Felipe Marzagao \n" "Language-Team: i18n@lists.horde.org\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: lib/Horde/Vfs/Smb.php:586 msgid "No such file" msgstr "Arquivo inexistente" #: lib/Horde/Vfs/Smb.php:589 msgid "Permission Denied" msgstr "Permissão Negada" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "Impossível renomear arquivo VFS." Horde_Vfs-2.3.1/locale/ro/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000072312654104000017352 0ustar janjan$,89Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=ASCII Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2; Horde_Vfs-2.3.1/locale/ro/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000155012654104000017354 0ustar janjan# Romanian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " "20)) ? 1 : 2;\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/locale/ru/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000075712654104000017367 0ustar janjan$,89Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Horde_Vfs-2.3.1/locale/ru/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000212212654104000017356 0ustar janjan# Russian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" "10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: lib/VFS/smb.php:573 #, fuzzy msgid "No such file" msgstr "Заметки" # #-#-#-#-# ru_RU.po (Mnemo H3 2.2) #-#-#-#-# # fuzzy #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Изменить права доступа" #: lib/VFS/sql_file.php:264 #, fuzzy msgid "Unable to rename VFS file." msgstr "Невозможно соединиться с SQL сервером." Horde_Vfs-2.3.1/locale/sk/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000122712654104000017347 0ustar janjan<\p q~J\%qNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2011-03-15 13:27+0100 PO-Revision-Date: 2011-05-18 17:17+0100 Last-Translator: Martin Matuška Language-Team: i18n@lists.horde.org Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2; Súbor neexistujePrístup odmietnutýNepodarilo sa premenovať VFS súbor.Horde_Vfs-2.3.1/locale/sk/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000170712654104000017355 0ustar janjan# Slovak translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2011-03-15 13:27+0100\n" "PO-Revision-Date: 2011-05-18 17:17+0100\n" "Last-Translator: Martin Matuška \n" "Language-Team: i18n@lists.horde.org\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #: lib/Horde/Vfs/Smb.php:574 msgid "No such file" msgstr "Súbor neexistuje" #: lib/Horde/Vfs/Smb.php:577 msgid "Permission Denied" msgstr "Prístup odmietnutý" #: lib/Horde/Vfs/SqlFile.php:265 msgid "Unable to rename VFS file." msgstr "Nepodarilo sa premenovať VFS súbor." Horde_Vfs-2.3.1/locale/sl/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000123112654104000017343 0ustar janjan<\p q~K\#uNo such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3); Ni take datotekeDovoljenje je zavrnjeno.Ne morem preimenovati VFS datoteke.Horde_Vfs-2.3.1/locale/sl/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000167212654104000017357 0ustar janjan# Slovenian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" "%100==4 ? 2 : 3);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "Ni take datoteke" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Dovoljenje je zavrnjeno." #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Ne morem preimenovati VFS datoteke." Horde_Vfs-2.3.1/locale/sv/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000077012654104000017364 0ustar janjan,<PQklUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Kan inte byta namn på VFS-fil.Horde_Vfs-2.3.1/locale/sv/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000155112654104000017365 0ustar janjan# Swedish translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "" #: lib/VFS/smb.php:576 #, fuzzy msgid "Permission Denied" msgstr "Behörighet" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Kan inte byta namn på VFS-fil." Horde_Vfs-2.3.1/locale/tr/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000113112654104000017351 0ustar janjan<\p q~d %)/No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; Böyle bir dosya yokİzin YokVFS dosyası yeniden adlandırılamıyor.Horde_Vfs-2.3.1/locale/tr/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000156512654104000017367 0ustar janjan# Turkish translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "Böyle bir dosya yok" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "İzin Yok" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "VFS dosyası yeniden adlandırılamıyor." Horde_Vfs-2.3.1/locale/uk/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000133512654104000017351 0ustar janjan<\p q~ a#6No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Нема такого файлуДоступ забороненийНе можу перейменувати VFS файл.Horde_Vfs-2.3.1/locale/uk/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000177612654104001017366 0ustar janjan# Ukrainian translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "Нема такого файлу" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "Доступ заборонений" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "Не можу перейменувати VFS файл." Horde_Vfs-2.3.1/locale/zh_CN/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000104712654104001017734 0ustar janjan<\p q~@  No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 无此类文件权限不足无法重命名 VFS 文件。Horde_Vfs-2.3.1/locale/zh_CN/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000147712654104001017746 0ustar janjan# Chinese translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "无此类文件" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "权限不足" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "无法重命名 VFS 文件。" Horde_Vfs-2.3.1/locale/zh_TW/LC_MESSAGES/Horde_Vfs.mo0000664000175000017500000000105012654104001017760 0ustar janjan<\p q~@  !No such filePermission DeniedUnable to rename VFS file.Project-Id-Version: Horde_VFS Report-Msgid-Bugs-To: dev@lists.horde.org POT-Creation-Date: 2010-10-13 01:27+0200 PO-Revision-Date: 2010-10-13 01:27+0200 Last-Translator: Automatically generated Language-Team: i18n@lists.horde.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 無此檔案存取遭拒無法變更 VFS 檔案的名稱.Horde_Vfs-2.3.1/locale/zh_TW/LC_MESSAGES/Horde_Vfs.po0000664000175000017500000000150012654104001017763 0ustar janjan# Chinese translations for Horde_VFS module. # Copyright 2010-2016 Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_VFS module. # Automatically generated, 2010. # msgid "" msgstr "" "Project-Id-Version: Horde_VFS\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2010-10-13 01:27+0200\n" "PO-Revision-Date: 2010-10-13 01:27+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: i18n@lists.horde.org\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: lib/VFS/smb.php:573 msgid "No such file" msgstr "無此檔案" #: lib/VFS/smb.php:576 msgid "Permission Denied" msgstr "存取遭拒" #: lib/VFS/sql_file.php:264 msgid "Unable to rename VFS file." msgstr "無法變更 VFS 檔案的名稱." Horde_Vfs-2.3.1/locale/Horde_Vfs.pot0000664000175000017500000000144612654104001015340 0ustar janjan# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Horde LLC (http://www.horde.org/) # This file is distributed under the same license as the Horde_Vfs package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Horde_Vfs\n" "Report-Msgid-Bugs-To: dev@lists.horde.org\n" "POT-Creation-Date: 2015-12-28 17:25+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: lib/Horde/Vfs/Smb.php:595 msgid "No such file" msgstr "" #: lib/Horde/Vfs/Smb.php:598 msgid "Permission Denied" msgstr "" #: lib/Horde/Vfs/SqlFile.php:262 msgid "Unable to rename VFS file." msgstr "" Horde_Vfs-2.3.1/migration/Horde/Vfs/1_horde_vfs_base_tables.php0000664000175000017500000000416612654104001022524 0ustar janjantables())) { $t = $this->createTable('horde_vfs', array('autoincrementKey' => array('vfs_id'))); $t->column('vfs_id', 'int', array('null' => false, 'unsigned' => true)); $t->column('vfs_type', 'smallint', array('null' => false, 'unsigned' => true)); $t->column('vfs_path', 'string', array('limit' => 255, 'null' => false)); $t->column('vfs_name', 'string', array('limit' => 255, 'null' => false)); $t->column('vfs_modified', 'bigint', array('null' => false)); $t->column('vfs_owner', 'string', array('limit' => 255, 'null' => false)); $t->column('vfs_data', 'binary'); $t->end(); $this->addIndex('horde_vfs', array('vfs_path')); $this->addIndex('horde_vfs', array('vfs_name')); } if (!in_array('horde_muvfs', $this->tables())) { $t = $this->createTable('horde_muvfs', array('autoincrementKey' => array('vfs_id'))); $t->column('vfs_id', 'int', array('null' => false, 'unsigned' => true)); $t->column('vfs_type', 'smallint', array('null' => false, 'unsigned' => true)); $t->column('vfs_path', 'string', array('limit' => 255, 'null' => false)); $t->column('vfs_name', 'string', array('limit' => 255, 'null' => false)); $t->column('vfs_modified', 'bigint', array('null' => false)); $t->column('vfs_owner', 'string', array('limit' => 255, 'null' => false)); $t->column('vfs_perms', 'smallint', array('null' => false, 'unsigned' => true)); $t->column('vfs_data', 'binary'); $t->end(); $this->addIndex('horde_muvfs', array('vfs_path')); $this->addIndex('horde_muvfs', array('vfs_name')); } } public function down() { try { $this->dropTable('horde_muvfs'); } catch (Horde_Exception $e) {} try { $this->dropTable('horde_vfs'); } catch (Horde_Exception $e) {} } } Horde_Vfs-2.3.1/migration/Horde/Vfs/2_horde_vfs_upgrade_autoincrement.php0000664000175000017500000000154312654104001024641 0ustar janjanchangeColumn('horde_vfs', 'vfs_id', 'autoincrementKey'); try { $this->dropTable('horde_vfs_seq'); } catch (Horde_Db_Exception $e) { } $this->changeColumn('horde_muvfs', 'vfs_id', 'autoincrementKey'); try { $this->dropTable('horde_muvfs_seq'); } catch (Horde_Db_Exception $e) { } } public function down() { try { $this->changeColumn('horde_muvfs', 'vfs_id', 'integer', array('null' => false, 'unsigned' => true)); } catch (Horde_Db_Exception $e) {} try { $this->changeColumn('horde_vfs', 'vfs_id', 'integer', array('null' => false, 'unsigned' => true)); } catch (Horde_Db_Exception $e) {} } } Horde_Vfs-2.3.1/migration/Horde/Vfs/3_horde_vfs_fix_blob_length.php0000664000175000017500000000042512654104001023401 0ustar janjanchangeColumn('horde_vfs', 'vfs_data', 'binary'); $this->changeColumn('horde_muvfs', 'vfs_data', 'binary'); } public function down() { } } Horde_Vfs-2.3.1/migration/Horde/Vfs/4_horde_vfs_upgrade_null_columns.php0000664000175000017500000000323012654104001024473 0ustar janjanchangeColumn('horde_vfs', 'vfs_path', 'string', array('limit' => 255, 'null' => true)); $this->changeColumn('horde_vfs', 'vfs_owner', 'string', array('limit' => 255, 'null' => true)); $this->changeColumn('horde_muvfs', 'vfs_path', 'string', array('limit' => 255, 'null' => true)); $this->changeColumn('horde_muvfs', 'vfs_owner', 'string', array('limit' => 255, 'null' => true)); $this->update('UPDATE horde_vfs SET vfs_path = NULL WHERE vfs_path = \'\''); $this->update('UPDATE horde_vfs SET vfs_owner = NULL WHERE vfs_path = \'\''); $this->update('UPDATE horde_muvfs SET vfs_path = NULL WHERE vfs_path = \'\''); $this->update('UPDATE horde_muvfs SET vfs_owner = NULL WHERE vfs_path = \'\''); } public function down() { $this->changeColumn('horde_vfs', 'vfs_path', 'string', array('limit' => 255, 'null' => false)); $this->changeColumn('horde_vfs', 'vfs_owner', 'string', array('limit' => 255, 'null' => false)); $this->changeColumn('horde_muvfs', 'vfs_path', 'string', array('limit' => 255, 'null' => false)); $this->changeColumn('horde_muvfs', 'vfs_owner', 'string', array('limit' => 255, 'null' => false)); $this->update('UPDATE horde_vfs SET vfs_path = \'\' WHERE vfs_path IS NULL'); $this->update('UPDATE horde_vfs SET vfs_owner = \'\' WHERE vfs_path IS NULL'); $this->update('UPDATE horde_muvfs SET vfs_path = \'\' WHERE vfs_path IS NULL'); $this->update('UPDATE horde_muvfs SET vfs_owner = \'\' WHERE vfs_path IS NULL'); } } Horde_Vfs-2.3.1/test/Horde/Vfs/fixtures/samba1.txt0000775000175000017500000000150412654104001020030 0ustar janjan . D 0 Wed May 27 15:18:42 2009 .. D 0 Thu May 28 16:04:56 2009 SystemHiddenReadonlyArchive DAHSR 0 Wed May 27 14:17:21 2009 Ein ziemlich langer Ordner mit vielen Buchstaben, der nicht kurz ist D 0 Wed May 27 14:14:11 2009 Eine ziemlich lange Datei mit vielen Buchstaben, die nicht kurz ist.txt A 0 Wed May 27 14:14:42 2009 Ordner mit Sonderzeichen & ( ) _ - toll D 0 Wed May 27 14:15:05 2009 Datei mit SOnderzeichen ¿ € § µ ° juhuuu.txt A 0 Wed May 27 14:15:38 2009 SystemHiddenReadonlyArchive.txt AHSR 0 Wed May 27 14:16:32 2009 SystemHiddenReadonlyArchive.txte AHR 31 Wed May 27 15:18:42 2009 49152 blocks of size 65536. 2 blocks available Horde_Vfs-2.3.1/test/Horde/Vfs/fixtures/samba2.txt0000664000175000017500000000417612654104001020036 0ustar janjan . D 0 Fri Apr 24 13:29:13 2009 .. D 0 Fri Jun 6 22:23:04 2008 tmp D 0 Mon Jan 7 10:23:03 2008 Der Fischer und seine Frau Märchen.odt A 22935 Thu Jan 25 21:55:36 2007 Tänze D 0 Thu Jan 25 21:26:53 2007 Availabilities+rates EE-Dateien D 0 Tue Sep 13 14:46:53 2005 Briefkopf.odt A 9564 Fri Jan 20 11:42:11 2006 Deckblatt.pdf A 18027 Wed Nov 28 22:06:42 2007 Babymassage.sxw A 9228 Tue Dec 7 00:40:14 2004 Gutschein.pdf A 10621 Sat Jan 6 17:50:42 2007 Die zertanzten Schuh.pdf A 257955 Mon Jan 22 17:32:45 2007 Flyer Im Takt.pdf A 42905 Sat Jan 27 10:54:44 2007 Availabilities+rates EE.doc A 1407488 Sun Aug 14 20:27:26 2005 Availabilities+rates EE.htm A 262588 Tue Sep 13 14:42:16 2005 tt0208m_.ttf A 47004 Sat Mar 19 17:34:56 2005 Alte Dateien.zip A 5566512 Sun May 20 23:51:52 2007 Availabilities+rates SQ-Dateien D 0 Tue Sep 13 14:46:07 2005 Bobath-Befund.pdf A 123696 Wed Nov 28 21:43:20 2007 Availabilities+rates SQ.doc A 109056 Sun Aug 14 20:27:42 2005 Availabilities+rates SQ.htm A 266079 Tue Sep 13 14:41:30 2005 tt0586m_.ttf A 35928 Sat Mar 19 17:34:58 2005 Gartenkonzept SZOE.html 168801 Mon Jan 7 10:27:10 2008 .DS_Store AH 12292 Wed Mar 9 18:58:27 2005 Pfefferkuchenmann.odt 14399 Wed Dec 20 20:57:59 2006 Sockenstrickanleitung mit Bildern.sxw 9518 Mon Dec 27 19:32:09 2004 Gartenkonzept SZOE.doc 32959488 Mon May 28 17:22:32 2007 Gartenkonzept SZOE.odt A 32526103 Mon May 28 17:18:48 2007 Gartenkonzept SZOE.pdf A 32632182 Sun May 20 23:39:40 2007 48828 blocks of size 2097152. 14773 blocks available Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/Pdo/MysqlTest.php0000664000175000017500000000204512654104001020207 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Sql_Pdo_MysqlTest extends Horde_Vfs_Test_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('pdo') || !in_array('mysql', PDO::getAvailableDrivers())) { self::$reason = 'No mysql extension or no mysql PDO driver'; return; } $config = self::getConfig('VFS_SQL_PDO_MYSQL_TEST_CONFIG', __DIR__ . '/../..'); if ($config && !empty($config['vfs']['sql']['pdo_mysql'])) { self::$db = new Horde_Db_Adapter_Pdo_Mysql($config['vfs']['sql']['pdo_mysql']); parent::setUpBeforeClass(); } else { self::$reason = 'No pdo_mysql configuration'; } } } Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/Pdo/PgsqlTest.php0000664000175000017500000000204512654104001020170 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Sql_Pdo_PgsqlTest extends Horde_Vfs_Test_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('pdo') || !in_array('pgsql', PDO::getAvailableDrivers())) { self::$reason = 'No pgsql extension or no pgsql PDO driver'; return; } $config = self::getConfig('VFS_SQL_PDO_PGSQL_TEST_CONFIG', __DIR__ . '/../..'); if ($config && !empty($config['vfs']['sql']['pdo_pgsql'])) { self::$db = new Horde_Db_Adapter_Pdo_Pgsql($config['vfs']['sql']['pdo_pgsql']); parent::setUpBeforeClass(); } else { self::$reason = 'No pdo_pgsql configuration'; } } } Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/Pdo/SqliteTest.php0000664000175000017500000000130412654104001020340 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Sql_Pdo_SqliteTest extends Horde_Vfs_Test_Sql_Base { public static function setUpBeforeClass() { $factory_db = new Horde_Test_Factory_Db(); try { self::$db = $factory_db->create(); parent::setUpBeforeClass(); } catch (Horde_Test_Exception $e) { self::$reason = 'Sqlite not available'; } } } Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/Base.php0000664000175000017500000000752112654104001016376 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Test_Sql_Base extends Horde_Vfs_TestBase { protected static $db; protected static $migrator; public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadByteRange() { $this->_readByteRange(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public static function setUpBeforeClass() { $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli()); //self::$db->setLogger($logger); $dir = __DIR__ . '/../../../../migration/Horde/Vfs'; if (!is_dir($dir)) { error_reporting(E_ALL & ~E_DEPRECATED); $dir = PEAR_Config::singleton() ->get('data_dir', null, 'pear.horde.org') . '/Horde_Vfs/migration'; error_reporting(E_ALL | E_STRICT); } self::$migrator = new Horde_Db_Migration_Migrator( self::$db, null,//$logger, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_vfs_schema_info')); self::$migrator->up(); self::$vfs = new Horde_Vfs_Sql(array('db' => self::$db)); } public static function tearDownAfterClass() { if (self::$migrator) { if (self::$db) { self::$db->delete('DELETE FROM horde_vfs'); self::$db->delete('DELETE FROM horde_muvfs'); } self::$migrator->down(); } if (self::$db) { self::$db->disconnect(); } self::$db = self::$migrator = null; parent::tearDownAfterClass(); } } Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/MysqliTest.php0000664000175000017500000000167412654104001017645 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Sql_MysqliTest extends Horde_Vfs_Test_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('mysqli')) { self::$reason = 'No mysqli extension'; return; } $config = self::getConfig('VFS_SQL_MYSQLI_TEST_CONFIG', __DIR__ . '/..'); if ($config && !empty($config['vfs']['sql']['mysqli'])) { self::$db = new Horde_Db_Adapter_Mysqli($config['vfs']['sql']['mysqli']); parent::setUpBeforeClass(); } else { self::$reason = 'No mysqli configuration'; } } } Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/MysqlTest.php0000664000175000017500000000166412654104001017473 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Sql_MysqlTest extends Horde_Vfs_Test_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('mysql')) { self::$reason = 'No mysql extension'; return; } $config = self::getConfig('VFS_SQL_MYSQL_TEST_CONFIG', __DIR__ . '/..'); if ($config && !empty($config['vfs']['sql']['mysql'])) { self::$db = new Horde_Db_Adapter_Mysql($config['vfs']['sql']['mysql']); parent::setUpBeforeClass(); } else { self::$reason = 'No mysql configuration'; } } } Horde_Vfs-2.3.1/test/Horde/Vfs/Sql/Oci8Test.php0000664000175000017500000000244312654104001017164 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Sql_Oci8Test extends Horde_Vfs_Test_Sql_Base { public static function setUpBeforeClass() { if (!extension_loaded('oci8')) { self::$reason = 'No oci8 extension'; return; } $config = self::getConfig('VFS_SQL_OCI8_TEST_CONFIG', __DIR__ . '/..'); if ($config && !empty($config['vfs']['sql']['oci8'])) { self::$db = new Horde_Db_Adapter_Oci8($config['vfs']['sql']['oci8']); //self::$db->setLogger(new Horde_Log_Logger(new Horde_Log_Handler_Cli())); parent::setUpBeforeClass(); } else { self::$reason = 'No oci8 configuration'; } } public function testWriteLargeData() { // Write twice to test both INSERT and UPDATE. self::$vfs->writeData('', 'large', str_repeat('x', 4001)); self::$vfs->writeData('', 'large', str_repeat('x', 4001)); self::$vfs->deleteFile('', 'large'); } } Horde_Vfs-2.3.1/test/Horde/Vfs/SqlFile/Pdo/MysqlTest.php0000664000175000017500000000175612654104001021017 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_SqlFile_Pdo_MysqlTest extends Horde_Vfs_Test_SqlFile_Base { public static function setUpBeforeClass() { if (!extension_loaded('pdo') || !in_array('mysql', PDO::getAvailableDrivers())) { self::$reason = 'No mysql extension or no mysql PDO driver'; return; } $config = self::getConfig('VFS_SQLFILE_PDO_MYSQL_TEST_CONFIG', __DIR__ . '/../..'); if ($config && !empty($config['vfs']['sqlfile']['pdo_mysql'])) { self::$db = new Horde_Db_Adapter_Pdo_Mysql($config['vfs']['sqlfile']['pdo_mysql']); parent::setUpBeforeClass(); } } } Horde_Vfs-2.3.1/test/Horde/Vfs/SqlFile/Pdo/PgsqlTest.php0000664000175000017500000000175612654104001021000 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_SqlFile_Pdo_PgsqlTest extends Horde_Vfs_Test_SqlFile_Base { public static function setUpBeforeClass() { if (!extension_loaded('pdo') || !in_array('pgsql', PDO::getAvailableDrivers())) { self::$reason = 'No pgsql extension or no pgsql PDO driver'; return; } $config = self::getConfig('VFS_SQLFILE_PDO_PGSQL_TEST_CONFIG', __DIR__ . '/../..'); if ($config && !empty($config['vfs']['sqlfile']['pdo_pgsql'])) { self::$db = new Horde_Db_Adapter_Pdo_Pgsql($config['vfs']['sqlfile']['pdo_pgsql']); parent::setUpBeforeClass(); } } } Horde_Vfs-2.3.1/test/Horde/Vfs/SqlFile/Pdo/SqliteTest.php0000664000175000017500000000131412654104001021141 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_SqlFile_Pdo_SqliteTest extends Horde_Vfs_Test_SqlFile_Base { public static function setUpBeforeClass() { $factory_db = new Horde_Test_Factory_Db(); try { self::$db = $factory_db->create(); parent::setUpBeforeClass(); } catch (Horde_Test_Exception $e) { self::$reason = 'Sqlite not available'; } } } Horde_Vfs-2.3.1/test/Horde/Vfs/SqlFile/Base.php0000664000175000017500000000763712654104001017206 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Test_SqlFile_Base extends Horde_Vfs_TestBase { protected static $db; protected static $migrator; public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadByteRange() { $this->_readByteRange(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public static function setUpBeforeClass() { // The SqlFile VFS driver needs to be refactored to a real composite // driver. return; $logger = new Horde_Log_Logger(new Horde_Log_Handler_Cli()); //self::$db->setLogger($logger); $dir = __DIR__ . '/../../../../migration/Horde/Vfs'; if (!is_dir($dir)) { error_reporting(E_ALL & ~E_DEPRECATED); $dir = PEAR_Config::singleton() ->get('data_dir', null, 'pear.horde.org') . '/Horde_Vfs/migration'; error_reporting(E_ALL | E_STRICT); } self::$migrator = new Horde_Db_Migration_Migrator( self::$db, null,//$logger, array('migrationsPath' => $dir, 'schemaTableName' => 'horde_vfs_schema_info')); self::$migrator->up(); self::$vfs = new Horde_Vfs_SqlFile(array('db' => self::$db)); } public static function tearDownAfterClass() { if (self::$migrator) { self::$migrator->down(); } //self::$db->disconnect(); self::$db = null; parent::tearDownAfterClass(); } public function setUp() { $this->markTestIncomplete('The SqlFile VFS driver needs to be refactored to a real composite driver.'); parent::setUp(); } } Horde_Vfs-2.3.1/test/Horde/Vfs/SqlFile/MysqliTest.php0000664000175000017500000000161012654104001020433 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_SqlFile_MysqliTest extends Horde_Vfs_Test_SqlFile_Base { public static function setUpBeforeClass() { if (!extension_loaded('mysqli')) { self::$reason = 'No mysqli extension'; return; } $config = self::getConfig('VFS_SQLFILE_MYSQLI_TEST_CONFIG', __DIR__ . '/..'); if ($config && !empty($config['vfs']['sqlfile']['mysqli'])) { self::$db = new Horde_Db_Adapter_Mysqli($config['vfs']['sqlfile']['mysqli']); parent::setUpBeforeClass(); } } } Horde_Vfs-2.3.1/test/Horde/Vfs/SqlFile/MysqlTest.php0000664000175000017500000000160112654104001020262 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_SqlFile_MysqlTest extends Horde_Vfs_Test_SqlFile_Base { public static function setUpBeforeClass() { if (!extension_loaded('mysql')) { self::$reason = 'No mysql extension'; return; } $config = self::getConfig('VFS_SQLFILE_MYSQL_TEST_CONFIG', __DIR__ . '/..'); if ($config && !empty($config['vfs']['sqlfile']['mysql'])) { self::$db = new Horde_Db_Adapter_Mysql($config['vfs']['sqlfile']['mysql']); parent::setUpBeforeClass(); } } } Horde_Vfs-2.3.1/test/Horde/Vfs/AllTests.php0000664000175000017500000000013212654104001016507 0ustar janjanrun(); Horde_Vfs-2.3.1/test/Horde/Vfs/bootstrap.php0000664000175000017500000000014312654104001016773 0ustar janjan * @author Jan Schneider * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_FileTest extends Horde_Vfs_TestBase { public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadStream() { $this->_readStream(); } /** * @depends testWrite * @depends testWriteData */ public function testReadByteRange() { $this->_readByteRange(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public function testChmod() { $this->_chmod(); } public function testDeleteUnusalFileNames() { $file = '高&执&行&力&的&打&造.txt'; $dir = '.horde/foo'; $path = sys_get_temp_dir() . '/vfsfiletest/' . $dir . '/' . $file; self::$vfs->writeData($dir, $file, 'some content', true); $this->assertFileExists($path); $this->assertStringEqualsFile($path, 'some content'); self::$vfs->delete($dir, $file); $this->assertFileNotExists($path); } public static function setUpBeforeClass() { self::$vfs = Horde_Vfs::factory('File', array( 'vfsroot' => sys_get_temp_dir() . '/vfsfiletest' )); } public static function tearDownAfterClass() { system('rm -r ' . sys_get_temp_dir() . '/vfsfiletest'); parent::tearDownAfterClass(); } } Horde_Vfs-2.3.1/test/Horde/Vfs/FtpTest.php0000664000175000017500000000675212654104001016363 0ustar janjan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_FtpTest extends Horde_Vfs_TestBase { public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadStream() { $this->_readStream(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public function testChmod() { $this->_chmod(); } public static function setUpBeforeClass() { if (!extension_loaded('ftp')) { self::$reason = 'No ftp extension'; return; } $config = self::getConfig('VFS_FTP_TEST_CONFIG', __DIR__); if ($config && !empty($config['vfs']['ftp'])) { self::$vfs = Horde_Vfs::factory('Ftp', $config['vfs']['ftp']); } else { self::$reason = 'No ftp configuration'; } } public static function tearDownAfterClass() { if (self::$vfs) { try { self::$vfs->emptyFolder(''); } catch (Horde_Vfs_Exception $e) { echo $e; } } parent::tearDownAfterClass(); } } Horde_Vfs-2.3.1/test/Horde/Vfs/KolabTest.php0000664000175000017500000000466012654104001016656 0ustar janjan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @link http://pear.horde.org/index.php?package=Vfs */ /** * Test the Kolab based virtual file system. * * Copyright 2008-2016 Horde LLC (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @category Horde * @package VFS * @subpackage UnitTests * @author Gunnar Wrobel * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @link http://pear.horde.org/index.php?package=Vfs */ class Horde_Vfs_KolabTest extends PHPUnit_Framework_TestCase { /** * Test setup. * * @return NULL */ public function setUp() { $this->markTestIncomplete('Convert to Horde4'); $world = $this->prepareBasicSetup(); $this->assertTrue($world['auth']->authenticate('wrobel@example.org', array('password' => 'none'))); $this->_vfs = Horde_Vfs::factory('kolab'); } /** * Test folder handling. * * @return NULL */ public function testFolders() { $this->markTestIncomplete('listFolders() is gone.'); $this->assertEquals(array(), $this->_vfs->listFolders()); $this->assertNoError($this->_vfs->createFolder('/', 'test')); $this->assertEquals(1, count($this->_vfs->listFolders())); $this->assertNoError($this->_vfs->autocreatePath('/a/b/c/d')); $this->assertEquals(1, count($this->_vfs->listFolders('/'))); $this->assertEquals(3, count($this->_vfs->listFolders('/INBOX'))); $this->assertTrue($this->_vfs->exists('/INBOX/a', 'b')); $a = $this->_vfs->listFolder('/INBOX/a/b', null, true, true); $this->assertTrue(isset($a['c'])); $this->assertTrue($this->_vfs->isFolder('/INBOX/a/b', 'c')); $this->assertTrue($this->_vfs->deleteFolder('/INBOX/a/b/c', 'd')); $this->assertFalse($this->_vfs->exists('/INBOX/a/b/c', 'd')); $this->assertTrue($this->_vfs->deleteFolder('/INBOX', 'a', true)); } /** * Test file handling. * * @return NULL */ public function testFiles() { } } Horde_Vfs-2.3.1/test/Horde/Vfs/MongoTest.php0000664000175000017500000000770212654104001016705 0ustar janjan * @category Horde * @copyright 2013 Horde LLC * @ignore * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package VFS * @subpackage UnitTests */ class Horde_Vfs_MongoTest extends Horde_Vfs_TestBase { protected static $_mongo; public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadStream() { $this->_readStream(); } /** * @depends testWrite * @depends testWriteData */ public function testReadByteRange() { $this->_readByteRange(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public static function setUpBeforeClass() { if (($config = self::getConfig('VFS_MONGO_TEST_CONFIG', __DIR__)) && isset($config['vfs']['mongo']['hostspec'])) { $factory = new Horde_Test_Factory_Mongo(); self::$_mongo = $factory->create(array( 'config' => $config['vfs']['mongo']['hostspec'], 'dbname' => 'horde_vfs_mongodbtest' )); } if (empty(self::$_mongo)) { self::$reason = 'MongoDB not available.'; } else { self::$vfs = Horde_Vfs::factory('Mongo', array( 'mongo_db' => self::$_mongo )); } } public static function tearDownAfterClass() { if (!empty(self::$_mongo)) { self::$_mongo->selectDB(null)->drop(); } parent::tearDownAfterClass(); } } Horde_Vfs-2.3.1/test/Horde/Vfs/phpunit.xml0000664000175000017500000000005612654104001016461 0ustar janjan Horde_Vfs-2.3.1/test/Horde/Vfs/SmbTest.php0000664000175000017500000004227312654104001016351 0ustar janjan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_SmbTest extends Horde_Vfs_TestBase { public static function setUpBeforeClass() { $config = self::getConfig('VFS_FTP_TEST_CONFIG', __DIR__); if ($config && !empty($config['vfs']['smb'])) { if (!is_executable($config['vfs']['smb']['smbclient'])) { self::$reason = 'No executable smbclient'; return; } self::$vfs = Horde_Vfs::factory('Smb', $config['vfs']['smb']); } else { self::$reason = 'No smb configuration'; } } public static function tearDownAfterClass() { if (self::$vfs) { try { self::$vfs->emptyFolder(''); } catch (Horde_Vfs_Exception $e) { echo $e; } } parent::tearDownAfterClass(); } public function setUp() { parent::setUp(); $this->_oldTimezone = date_default_timezone_get(); date_default_timezone_set('Europe/Berlin'); } public function tearDown() { date_default_timezone_set($this->_oldTimezone); } public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadStream() { $this->_readStream(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->markTestIncomplete(); $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->markTestIncomplete(); $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->markTestIncomplete(); $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public function testHostspecWithPath() { self::$vfs->createFolder('', 'hostspectest'); self::$vfs->createFolder('hostspectest', 'directory'); self::$vfs->createFolder('hostspectest/directory', 'subdir'); $config = self::getConfig('VFS_FTP_TEST_CONFIG', __DIR__); $config['vfs']['smb']['share'] .= '/hostspectest'; $vfs = Horde_Vfs::factory('Smb', $config['vfs']['smb']); $this->assertEquals( array('subdir'), array_keys($vfs->listFolder('directory')) ); } public function testParseListing() { $vfs = new Horde_Vfs_Smb(); $listing = $vfs->parseListing(file(__DIR__ . '/fixtures/samba1.txt'), null, true, false); $this->assertInternalType('array', $listing); $this->assertEquals(7, count($listing)); $this->assertEquals( array ( 'SystemHiddenReadonlyArchive' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'SystemHiddenReadonlyArchive', 'type' => '**dir', 'date' => 1243426641, 'size' => -1, ), 'Ein ziemlich langer Ordner mit vielen Buchstaben, der nicht kurz ist' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Ein ziemlich langer Ordner mit vielen Buchstaben, der nicht kurz ist', 'type' => '**dir', 'date' => 1243426451, 'size' => -1, ), 'Eine ziemlich lange Datei mit vielen Buchstaben, die nicht kurz ist.txt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Eine ziemlich lange Datei mit vielen Buchstaben, die nicht kurz ist.txt', 'type' => 'txt', 'date' => 1243426482, 'size' => '0', ), 'Ordner mit Sonderzeichen & ( ) _ - toll' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Ordner mit Sonderzeichen & ( ) _ - toll', 'type' => '**dir', 'date' => 1243426505, 'size' => -1, ), 'Datei mit SOnderzeichen ¿ € § µ ° juhuuu.txt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Datei mit SOnderzeichen ¿ € § µ ° juhuuu.txt', 'type' => 'txt', 'date' => 1243426538, 'size' => '0', ), 'SystemHiddenReadonlyArchive.txt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'SystemHiddenReadonlyArchive.txt', 'type' => 'txt', 'date' => 1243426592, 'size' => '0', ), 'SystemHiddenReadonlyArchive.txte' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'SystemHiddenReadonlyArchive.txte', 'type' => 'txte', 'date' => 1243430322, 'size' => '31', ), ), $listing); $listing = $vfs->parseListing(file(__DIR__ . '/fixtures/samba2.txt'), null, true, false); $this->assertInternalType('array', $listing); $this->assertEquals(26, count($listing)); $this->assertEquals( array ( 'tmp' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'tmp', 'type' => '**dir', 'date' => 1199697783, 'size' => -1, ), 'Der Fischer und seine Frau Märchen.odt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Der Fischer und seine Frau Märchen.odt', 'type' => 'odt', 'date' => 1169758536, 'size' => '22935', ), 'Tänze' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Tänze', 'type' => '**dir', 'date' => 1169756813, 'size' => -1, ), 'Availabilities+rates EE-Dateien' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Availabilities+rates EE-Dateien', 'type' => '**dir', 'date' => 1126615613, 'size' => -1, ), 'Briefkopf.odt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Briefkopf.odt', 'type' => 'odt', 'date' => 1137753731, 'size' => '9564', ), 'Deckblatt.pdf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Deckblatt.pdf', 'type' => 'pdf', 'date' => 1196284002, 'size' => '18027', ), 'Babymassage.sxw' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Babymassage.sxw', 'type' => 'sxw', 'date' => 1102376414, 'size' => '9228', ), 'Gutschein.pdf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Gutschein.pdf', 'type' => 'pdf', 'date' => 1168102242, 'size' => '10621', ), 'Die zertanzten Schuh.pdf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Die zertanzten Schuh.pdf', 'type' => 'pdf', 'date' => 1169483565, 'size' => '257955', ), 'Flyer Im Takt.pdf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Flyer Im Takt.pdf', 'type' => 'pdf', 'date' => 1169891684, 'size' => '42905', ), 'Availabilities+rates EE.doc' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Availabilities+rates EE.doc', 'type' => 'doc', 'date' => 1124044046, 'size' => '1407488', ), 'Availabilities+rates EE.htm' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Availabilities+rates EE.htm', 'type' => 'htm', 'date' => 1126615336, 'size' => '262588', ), 'tt0208m_.ttf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'tt0208m_.ttf', 'type' => 'ttf', 'date' => 1111250096, 'size' => '47004', ), 'Alte Dateien.zip' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Alte Dateien.zip', 'type' => 'zip', 'date' => 1179697912, 'size' => '5566512', ), 'Availabilities+rates SQ-Dateien' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Availabilities+rates SQ-Dateien', 'type' => '**dir', 'date' => 1126615567, 'size' => -1, ), 'Bobath-Befund.pdf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Bobath-Befund.pdf', 'type' => 'pdf', 'date' => 1196282600, 'size' => '123696', ), 'Availabilities+rates SQ.doc' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Availabilities+rates SQ.doc', 'type' => 'doc', 'date' => 1124044062, 'size' => '109056', ), 'Availabilities+rates SQ.htm' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Availabilities+rates SQ.htm', 'type' => 'htm', 'date' => 1126615290, 'size' => '266079', ), 'tt0586m_.ttf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'tt0586m_.ttf', 'type' => 'ttf', 'date' => 1111250098, 'size' => '35928', ), 'Gartenkonzept SZOE.html' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Gartenkonzept SZOE.html', 'type' => 'html', 'date' => 1199698030, 'size' => '168801', ), '.DS_Store' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => '.DS_Store', 'type' => 'ds_store', 'date' => 1110391107, 'size' => '12292', ), 'Pfefferkuchenmann.odt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Pfefferkuchenmann.odt', 'type' => 'odt', 'date' => 1166644679, 'size' => '14399', ), 'Sockenstrickanleitung mit Bildern.sxw' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Sockenstrickanleitung mit Bildern.sxw', 'type' => 'sxw', 'date' => 1104172329, 'size' => '9518', ), 'Gartenkonzept SZOE.doc' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Gartenkonzept SZOE.doc', 'type' => 'doc', 'date' => 1180365752, 'size' => '32959488', ), 'Gartenkonzept SZOE.odt' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Gartenkonzept SZOE.odt', 'type' => 'odt', 'date' => 1180365528, 'size' => '32526103', ), 'Gartenkonzept SZOE.pdf' => array ( 'owner' => '', 'group' => '', 'perms' => '', 'name' => 'Gartenkonzept SZOE.pdf', 'type' => 'pdf', 'date' => 1179697180, 'size' => '32632182', ), ), $listing); } } Horde_Vfs-2.3.1/test/Horde/Vfs/Ssh2Test.php0000664000175000017500000000676212654104001016452 0ustar janjan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_Ssh2Test extends Horde_Vfs_TestBase { public function testListEmpty() { $this->_listEmpty(); } public function testCreateFolder() { $this->_createFolderStructure(); } /** * @depends testCreateFolder */ public function testWriteData() { $this->_writeData(); } /** * @depends testCreateFolder */ public function testWrite() { $this->_write(); } /** * @depends testWrite * @depends testWriteData */ public function testRead() { $this->_read(); } /** * @depends testWrite * @depends testWriteData */ public function testReadFile() { $this->_readFile(); } /** * @depends testWrite * @depends testWriteData */ public function testReadStream() { $this->_readStream(); } /** * @depends testWrite * @depends testWriteData */ public function testSize() { $this->_size(); } /** * @depends testWrite * @depends testWriteData */ public function testFolderSize() { $this->_folderSize(); } /** * @depends testWrite * @depends testWriteData */ public function testVfsSize() { $this->_vfsSize(); } /** * @depends testWrite * @depends testWriteData */ public function testCopy() { $this->_copy(); } /** * @depends testCopy */ public function testRename() { $this->_rename(); } /** * @depends testRename */ public function testMove() { $this->_move(); } /** * @depends testMove */ public function testDeleteFile() { $this->_deleteFile(); } /** * @depends testMove */ public function testDeleteFolder() { $this->_deleteFolder(); } /** * @depends testMove */ public function testEmptyFolder() { $this->_emptyFolder(); } /** * @depends testMove */ public function testQuota() { $this->_quota(); } /** * @depends testQuota */ public function testListFolder() { $this->_listFolder(); } public function testChmod() { $this->_chmod(); } public static function setUpBeforeClass() { if (!extension_loaded('ssh2')) { self::$reason = 'No ssh2 extension'; return; } $config = self::getConfig('VFS_SSH2_TEST_CONFIG', __DIR__); if ($config && !empty($config['vfs']['ssh2'])) { self::$vfs = Horde_Vfs::factory('Ssh2', $config['vfs']['ssh2']); } else { self::$reason = 'No ssh2 configuration'; } } public static function tearDownAfterClass() { if (self::$vfs) { try { self::$vfs->emptyFolder(''); } catch (Horde_Vfs_Exception $e) { echo $e; } } parent::tearDownAfterClass(); } } Horde_Vfs-2.3.1/test/Horde/Vfs/TestBase.php0000664000175000017500000003422412654104001016477 0ustar janjan * @category Horde * @package Vfs * @subpackage UnitTests * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 */ class Horde_Vfs_TestBase extends Horde_Test_Case { protected static $reason = ''; protected static $vfs; public function setUp() { if (!self::$vfs) { $this->markTestSkipped(self::$reason); } } public static function tearDownAfterClass() { self::$vfs = null; } protected function _listEmpty() { $this->assertEquals(array(), self::$vfs->listFolder('')); $this->assertEquals(array(), self::$vfs->listFolder('/')); } /** * Structure after test: * test/ * dir1/ * dir2/ */ protected function _createFolderStructure() { self::$vfs->createFolder('', 'test'); self::$vfs->createFolder('test', 'dir1'); self::$vfs->createFolder('test', 'dir2'); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * dir2/ * dir3/ * file1: content3_1 * file1: content1 */ protected function _writeData() { self::$vfs->writeData('test', 'file1', 'content1'); self::$vfs->writeData('test/dir1', 'file1', 'content1_1'); self::$vfs->writeData('test/dir3', 'file1', 'content3_1', true); try { self::$vfs->writeData('test/dir4', 'file1', 'content4_1'); $this->fail('Missing directory should throw an exception unless $autocreate is set'); } catch (Horde_Vfs_Exception $e) { } } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * dir3/ * file1: content3_1 * file2: __FILE__ * file1: content1 */ protected function _write() { self::$vfs->write('test/dir1', 'file2', __FILE__); self::$vfs->write('test/dir3', 'file2', __FILE__, true); try { self::$vfs->write('test/dir4', 'file2', __FILE__); $this->fail('Missing directory should throw an exception unless $autocreate is set'); } catch (Horde_Vfs_Exception $e) { } } protected function _read() { $this->assertEquals('content1', self::$vfs->read('test', 'file1')); $this->assertEquals('content1_1', self::$vfs->read('test/dir1', 'file1')); $this->assertEquals('content3_1', self::$vfs->read('test/dir3', 'file1')); $this->assertEquals(file_get_contents(__FILE__), self::$vfs->read('test/dir1', 'file2')); $this->assertEquals(file_get_contents(__FILE__), self::$vfs->read('test/dir3', 'file2', __FILE__)); } protected function _readFile() { $this->assertFileEquals(__FILE__, self::$vfs->readFile('test/dir1', 'file2')); $this->assertFileEquals(__FILE__, self::$vfs->readFile('test/dir3', 'file2', __FILE__)); } protected function _readStream() { $this->assertEquals( file_get_contents(__FILE__), stream_get_contents(self::$vfs->readStream('test/dir1', 'file2'))); $this->assertEquals( file_get_contents(__FILE__), stream_get_contents(self::$vfs->readStream('test/dir3', 'file2'))); } protected function _readByteRange() { $offset = 1; $this->assertEquals('on', self::$vfs->readByteRange('test', 'file1', $offset, 2, $remain)); $this->assertEquals(3, $offset); $this->assertEquals(5, $remain); $offset++; $this->assertEquals('en', self::$vfs->readByteRange('test', 'file1', $offset, 2, $remain)); $this->assertEquals(6, $offset); $this->assertEquals(2, $remain); $this->assertEquals('t1', self::$vfs->readByteRange('test', 'file1', $offset, -1, $remain)); } protected function _size() { $this->assertEquals(8, self::$vfs->size('test', 'file1')); $this->assertEquals(10, self::$vfs->size('test/dir1', 'file1')); $this->assertEquals(10, self::$vfs->size('test/dir3', 'file1')); $this->assertEquals(filesize(__FILE__), self::$vfs->size('test/dir1', 'file2')); $this->assertEquals(filesize(__FILE__), self::$vfs->size('test/dir3', 'file2', __FILE__)); } protected function _folderSize() { $this->assertEquals(28 + 2 * filesize(__FILE__), self::$vfs->getFolderSize('test')); $this->assertEquals(10 + filesize(__FILE__), self::$vfs->getFolderSize('test/dir1')); $this->assertEquals(10 + filesize(__FILE__), self::$vfs->getFolderSize('test/dir3')); } protected function _vfsSize() { $this->assertEquals(28 + 2 * filesize(__FILE__), self::$vfs->getVFSSize()); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * dir3/ * file1: content3_1 * file2: __FILE__ * dir4/ * file1: content1_1 * file1: content1 */ protected function _copy() { try { self::$vfs->copy('test/dir1', 'file1', 'test/dir1', true); $this->fail('Exception expected'); } catch (Horde_Vfs_Exception $e) { } self::$vfs->copy('test/dir1', 'file1', 'test/dir4', true); $this->assertTrue(self::$vfs->exists('test/dir1', 'file1')); $this->assertTrue(self::$vfs->exists('test/dir4', 'file1')); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * dir3/ * file1: content3_1 * file2: __FILE__ * file3: content1_1 * dir4/ * file1: content1 */ protected function _rename() { self::$vfs->rename('test/dir4', 'file1', 'test/dir4', 'file2'); $this->assertFalse(self::$vfs->exists('test/dir4', 'file1')); $this->assertTrue(self::$vfs->exists('test/dir4', 'file2')); self::$vfs->rename('test/dir4', 'file2', 'test/dir3', 'file3'); $this->assertFalse(self::$vfs->exists('test/dir4', 'file2')); $this->assertTrue(self::$vfs->exists('test/dir3', 'file3')); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * dir5/ * file3: content1_1 * dir3/ * file1: content3_1 * file2: __FILE__ * dir4/ * file1: content1 */ protected function _move() { self::$vfs->move('test/dir3', 'file3', 'test/dir2'); $this->assertFalse(self::$vfs->exists('test/dir3', 'file3')); $this->assertTrue(self::$vfs->exists('test/dir2', 'file3')); self::$vfs->createFolder('test', 'dir5'); self::$vfs->move('test', 'dir5', 'test/dir2'); $this->assertFalse(self::$vfs->exists('test', 'dir5')); $this->assertTrue(self::$vfs->exists('test/dir2', 'dir5')); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * dir5/ * dir3/ * file1: content3_1 * file2: __FILE__ * dir4/ * file1: content1 */ protected function _deleteFile() { $this->assertTrue(self::$vfs->exists('test/dir2', 'file3')); self::$vfs->deleteFile('test/dir2', 'file3'); $this->assertFalse(self::$vfs->exists('test/dir2', 'file3')); $this->assertFalse(self::$vfs->exists('test/dir4', 'file2')); try { self::$vfs->deleteFile('test/dir4', 'file2'); $this->fail('Missing file should throw an exception'); } catch (Horde_Vfs_Exception $e) { } } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * dir5/ * file1: content1 */ protected function _deleteFolder() { $this->assertTrue(self::$vfs->exists('test', 'dir4')); self::$vfs->deleteFolder('test', 'dir4'); $this->assertFalse(self::$vfs->exists('test', 'dir4')); $this->assertTrue(self::$vfs->exists('test', 'dir3')); try { self::$vfs->deleteFolder('test', 'dir3'); $this->fail('Non-empty folder should throw an exception unless $recursive is set'); } catch (Horde_Vfs_Exception $e) { } $this->assertTrue(self::$vfs->exists('test', 'dir3')); self::$vfs->deleteFolder('test', 'dir3', true); $this->assertFalse(self::$vfs->exists('test', 'dir3')); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * file1: content1 */ protected function _emptyFolder() { self::$vfs->copy('test/dir1', 'file1', 'test/dir2'); self::$vfs->copy('test/dir1', 'file2', 'test/dir2'); self::$vfs->createFolder('test/dir2', 'dir2_1'); $this->assertEquals( array('dir2_1', 'dir5', 'file1', 'file2'), array_keys($this->_sort(self::$vfs->listFolder('test/dir2')))); self::$vfs->emptyFolder('test/dir2'); $this->assertFalse(self::$vfs->exists('test/dir2', 'file1')); $this->assertFalse(self::$vfs->exists('test/dir2', 'file2')); $this->assertFalse(self::$vfs->exists('test/dir2', 'dir2_1')); $this->assertTrue(self::$vfs->exists('test', 'dir2')); $this->assertEquals(array(), self::$vfs->listFolder('test/dir2')); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * file1: content1 */ protected function _quota() { $used = 18 + filesize(__FILE__); self::$vfs->setQuota(18 + filesize(__FILE__) + 10); try { self::$vfs->writeData('', 'file1', '12345678901'); $this->fail('Writing over quota should throw an exception'); } catch (Horde_Vfs_Exception $e) { } self::$vfs->writeData('', 'file1', '1234567890'); $this->assertTrue(self::$vfs->exists('', 'file1')); $this->assertEquals( array('limit' => $used + 10, 'usage' => $used + 10), self::$vfs->getQuota() ); try { self::$vfs->writeData('', 'file2', '1'); $this->fail('Writing over quota should throw an exception'); } catch (Horde_Vfs_Exception $e) { } self::$vfs->deleteFile('', 'file1'); $this->assertFalse(self::$vfs->exists('', 'file1')); $this->assertEquals( array('limit' => $used + 10, 'usage' => $used), self::$vfs->getQuota() ); self::$vfs->writeData('', 'file2', '1'); $this->assertEquals( array('limit' => $used + 10, 'usage' => $used + 1), self::$vfs->getQuota() ); self::$vfs->writeData('', 'file2', '12345'); $this->assertEquals( array('limit' => $used + 10, 'usage' => $used + 5), self::$vfs->getQuota() ); self::$vfs->writeData('', 'file2', '123'); $this->assertEquals( array('limit' => $used + 10, 'usage' => $used + 3), self::$vfs->getQuota() ); self::$vfs->setQuota(-1); try { self::$vfs->getQuota(); $this->fail('Quota should be unset and throw an exception.'); } catch (Horde_Vfs_Exception $e) { } self::$vfs->deleteFile('', 'file2'); } /** * Structure after test: * test/ * dir1/ * file1: content1_1 * file2: __FILE__ * dir2/ * .file2: content2 * file1: content1 * file2: 1 */ protected function _listFolder() { try { self::$vfs->listFolder('nonexistant_foobar'); $this->fail('Listing non-existant folders should throw an exception'); } catch (Horde_Vfs_Exception $e) { } self::$vfs->writeData('', 'file2', '1'); $this->assertEquals( array('file2', 'test'), array_keys($this->_sort(self::$vfs->listFolder('/')))); $this->assertEquals( array('file2' => null, 'test' => array()), $this->_sort(self::$vfs->listFolder(''))); $this->assertEquals( array('test' => array()), $this->_sort(self::$vfs->listFolder('', null, true, true))); self::$vfs->writeData('test', '.file2', 'content2'); $this->assertEquals( array('file2' => null, 'test' => array('.file2' => null, 'dir1' => array('file1' => null, 'file2' => null), 'dir2' => array(), 'file1' => null)), $this->_sort(self::$vfs->listFolder('', null, true, false, true))); $this->assertEquals( array('dir1' => array('file1' => null, 'file2' => null), 'dir2' => array(), 'file1' => null), $this->_sort(self::$vfs->listFolder('test', null, false, false, true))); $this->assertEquals( array('.file2' => null, 'dir2' => array()), $this->_sort(self::$vfs->listFolder('test', '^.*1$'))); } protected function _chmod() { self::$vfs->createFolder('', 'chmodtest'); self::$vfs->writeData('chmodtest', 'chmod', 'foo'); self::$vfs->changePermissions('chmodtest', 'chmod', '640'); $folder = self::$vfs->listFolder('chmodtest'); $this->assertEquals('-rw-r-----', $folder['chmod']['perms']); } protected function _sort($folders) { ksort($folders); foreach ($folders as &$item) { if ($item['type'] == '**dir') { if (!empty($item['subdirs'])) { $item = $this->_sort($item['subdirs']); } else { $item = array(); } } else { $item = null; } } return $folders; } }