From 80c717fb5c471feae6f3236751a2e4df7f56c65c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 14 Apr 2008 05:54:10 +0000 Subject: [PATCH] - only using the new stream wrapper interface - dropped all old code, images and translations - the former comments are savely stored in the sqlfs table, but are currently not available via the GUI --- filemanager/cli.php | 129 +- filemanager/doc/INSTALL | 45 - filemanager/doc/INSTALL_WebDAV | 124 - filemanager/inc/class.bofilemanager.inc.php | 351 --- .../inc/class.filemanager_hooks.inc.php | 149 - filemanager/inc/class.filemanager_ui.inc.php | 162 +- filemanager/inc/class.sofilemanager.inc.php | 59 - filemanager/inc/class.uifilemanager.inc.php | 2616 ----------------- filemanager/setup/default_records.inc.php | 16 - filemanager/setup/egw_de.lang | 125 +- filemanager/setup/egw_en.lang | 134 +- filemanager/setup/etemplates.inc.php | 26 +- filemanager/setup/setup.inc.php | 67 +- filemanager/templates/default/edit_file.tpl | 33 - filemanager/templates/default/errors.tpl | 6 - filemanager/templates/default/file.xet | 228 ++ filemanager/templates/default/filelisting.tpl | 32 - filemanager/templates/default/history.tpl | 29 - .../default/images/button_bookmark.png | Bin 996 -> 0 bytes .../default/images/button_bookmark_add.png | Bin 961 -> 0 bytes .../default/images/button_cancel.png | Bin 883 -> 0 bytes .../default/images/button_copy_to.png | Bin 590 -> 0 bytes .../default/images/button_createfile.png | Bin 1058 -> 0 bytes .../templates/default/images/button_cut.png | Bin 1196 -> 0 bytes .../default/images/button_delete.png | Bin 951 -> 0 bytes .../default/images/button_download.png | Bin 663 -> 0 bytes .../templates/default/images/button_edit.png | Bin 1076 -> 0 bytes .../default/images/button_edit_comments.png | Bin 1101 -> 0 bytes .../default/images/button_edit_preview.png | Bin 1230 -> 0 bytes .../templates/default/images/button_goto.png | Bin 1263 -> 0 bytes .../templates/default/images/button_home.png | Bin 1617 -> 0 bytes .../templates/default/images/button_info.png | Bin 1195 -> 0 bytes .../templates/default/images/button_mail.png | Bin 1066 -> 0 bytes .../default/images/button_move_to.png | Bin 998 -> 0 bytes .../templates/default/images/button_ok.png | Bin 769 -> 0 bytes .../templates/default/images/button_paste.png | Bin 881 -> 0 bytes .../default/images/button_reload.png | Bin 1157 -> 0 bytes .../default/images/button_rename.png | Bin 1253 -> 0 bytes .../templates/default/images/button_save.png | Bin 991 -> 0 bytes .../default/images/button_search.png | Bin 1382 -> 0 bytes .../default/images/button_search2.png | Bin 1393 -> 0 bytes .../templates/default/images/button_trash.png | Bin 1348 -> 0 bytes .../templates/default/images/button_tree.png | Bin 667 -> 0 bytes .../templates/default/images/button_up.png | Bin 1128 -> 0 bytes .../default/images/button_upload.png | Bin 1571 -> 0 bytes .../templates/default/images/button_zip.png | Bin 1336 -> 0 bytes .../templates/default/images/favicon.ico | Bin 3638 -> 0 bytes .../templates/default/images/folder-home.gif | Bin 1249 -> 0 bytes .../templates/default/images/folder-home.png | Bin 1617 -> 0 bytes .../templates/default/images/folder-open.gif | Bin 1225 -> 0 bytes .../templates/default/images/folder-open.png | Bin 1542 -> 0 bytes .../templates/default/images/folder-up.gif | Bin 772 -> 0 bytes .../templates/default/images/folder-up.png | Bin 1128 -> 0 bytes .../templates/default/images/folder.gif | Bin 1184 -> 0 bytes .../templates/default/images/folder.png | Bin 1373 -> 0 bytes .../templates/default/images/folder_home.gif | Bin 1249 -> 0 bytes .../templates/default/images/folder_home.png | Bin 1617 -> 0 bytes .../templates/default/images/folder_open.gif | Bin 1225 -> 0 bytes .../templates/default/images/folder_open.png | Bin 1542 -> 0 bytes .../templates/default/images/folder_up.gif | Bin 772 -> 0 bytes .../templates/default/images/folder_up.png | Bin 1128 -> 0 bytes .../templates/default/images/locked.gif | Bin 606 -> 0 bytes .../templates/default/images/locked.png | Bin 719 -> 0 bytes .../templates/default/images/navbar.gif | Bin 1625 -> 0 bytes .../images/source/buttonbackground.xcf | Bin 1846 -> 0 bytes .../templates/default/images/spacer.gif | Bin 43 -> 0 bytes filemanager/templates/default/index.tpl | 52 - filemanager/templates/default/pref.tpl | 7 - .../templates/default/pref_colspan.tpl | 4 - filemanager/templates/default/pref_list.tpl | 5 - .../templates/default/preference_acl_row.tpl | 9 - .../templates/default/preference_colspan.tpl | 8 - filemanager/templates/default/preferences.tpl | 24 - filemanager/templates/default/small_table.tpl | 15 - filemanager/templates/default/upload.tpl | 30 - filemanager/tests/benchmark_dav.php | 61 - filemanager/tests/test.php | 279 -- filemanager/tests/test_dav.php | 531 ---- filemanager/todo | 33 - filemanager/webdav.php | 16 +- 80 files changed, 503 insertions(+), 4902 deletions(-) delete mode 100644 filemanager/doc/INSTALL delete mode 100644 filemanager/doc/INSTALL_WebDAV delete mode 100755 filemanager/inc/class.bofilemanager.inc.php delete mode 100644 filemanager/inc/class.filemanager_hooks.inc.php delete mode 100755 filemanager/inc/class.sofilemanager.inc.php delete mode 100755 filemanager/inc/class.uifilemanager.inc.php delete mode 100644 filemanager/setup/default_records.inc.php delete mode 100644 filemanager/templates/default/edit_file.tpl delete mode 100755 filemanager/templates/default/errors.tpl create mode 100644 filemanager/templates/default/file.xet delete mode 100644 filemanager/templates/default/filelisting.tpl delete mode 100755 filemanager/templates/default/history.tpl delete mode 100644 filemanager/templates/default/images/button_bookmark.png delete mode 100644 filemanager/templates/default/images/button_bookmark_add.png delete mode 100644 filemanager/templates/default/images/button_cancel.png delete mode 100644 filemanager/templates/default/images/button_copy_to.png delete mode 100644 filemanager/templates/default/images/button_createfile.png delete mode 100644 filemanager/templates/default/images/button_cut.png delete mode 100644 filemanager/templates/default/images/button_delete.png delete mode 100644 filemanager/templates/default/images/button_download.png delete mode 100644 filemanager/templates/default/images/button_edit.png delete mode 100644 filemanager/templates/default/images/button_edit_comments.png delete mode 100644 filemanager/templates/default/images/button_edit_preview.png delete mode 100644 filemanager/templates/default/images/button_goto.png delete mode 100644 filemanager/templates/default/images/button_home.png delete mode 100644 filemanager/templates/default/images/button_info.png delete mode 100644 filemanager/templates/default/images/button_mail.png delete mode 100644 filemanager/templates/default/images/button_move_to.png delete mode 100644 filemanager/templates/default/images/button_ok.png delete mode 100644 filemanager/templates/default/images/button_paste.png delete mode 100644 filemanager/templates/default/images/button_reload.png delete mode 100644 filemanager/templates/default/images/button_rename.png delete mode 100644 filemanager/templates/default/images/button_save.png delete mode 100644 filemanager/templates/default/images/button_search.png delete mode 100644 filemanager/templates/default/images/button_search2.png delete mode 100644 filemanager/templates/default/images/button_trash.png delete mode 100644 filemanager/templates/default/images/button_tree.png delete mode 100644 filemanager/templates/default/images/button_up.png delete mode 100644 filemanager/templates/default/images/button_upload.png delete mode 100644 filemanager/templates/default/images/button_zip.png delete mode 100755 filemanager/templates/default/images/favicon.ico delete mode 100755 filemanager/templates/default/images/folder-home.gif delete mode 100644 filemanager/templates/default/images/folder-home.png delete mode 100755 filemanager/templates/default/images/folder-open.gif delete mode 100644 filemanager/templates/default/images/folder-open.png delete mode 100755 filemanager/templates/default/images/folder-up.gif delete mode 100644 filemanager/templates/default/images/folder-up.png delete mode 100755 filemanager/templates/default/images/folder.gif delete mode 100644 filemanager/templates/default/images/folder.png delete mode 100755 filemanager/templates/default/images/folder_home.gif delete mode 100644 filemanager/templates/default/images/folder_home.png delete mode 100755 filemanager/templates/default/images/folder_open.gif delete mode 100644 filemanager/templates/default/images/folder_open.png delete mode 100755 filemanager/templates/default/images/folder_up.gif delete mode 100644 filemanager/templates/default/images/folder_up.png delete mode 100755 filemanager/templates/default/images/locked.gif delete mode 100644 filemanager/templates/default/images/locked.png delete mode 100755 filemanager/templates/default/images/navbar.gif delete mode 100644 filemanager/templates/default/images/source/buttonbackground.xcf delete mode 100755 filemanager/templates/default/images/spacer.gif delete mode 100755 filemanager/templates/default/index.tpl delete mode 100755 filemanager/templates/default/pref.tpl delete mode 100755 filemanager/templates/default/pref_colspan.tpl delete mode 100755 filemanager/templates/default/pref_list.tpl delete mode 100755 filemanager/templates/default/preference_acl_row.tpl delete mode 100755 filemanager/templates/default/preference_colspan.tpl delete mode 100644 filemanager/templates/default/preferences.tpl delete mode 100755 filemanager/templates/default/small_table.tpl delete mode 100644 filemanager/templates/default/upload.tpl delete mode 100644 filemanager/tests/benchmark_dav.php delete mode 100644 filemanager/tests/test.php delete mode 100644 filemanager/tests/test_dav.php delete mode 100644 filemanager/todo diff --git a/filemanager/cli.php b/filemanager/cli.php index c0c6406187..4f4e774d20 100755 --- a/filemanager/cli.php +++ b/filemanager/cli.php @@ -1,12 +1,12 @@ #!/usr/bin/php -qC - * @copyright (c) 2006 by Ralf Becker + * @copyright (c) 2007/8 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -61,6 +61,7 @@ function usage($action=null,$ret=0) echo "\t$cmd find URL [URL2 ...] [-type (d|f)][-depth][-mindepth n][-maxdepth n][-mime type[/sub]][-name pattern][-path pattern][-uid id][-user name][-nouser][-gid id][-group name][-nogroup][-size N][-cmin N][-ctime N][-mmin N][-mtime N] (N: +n --> >n, -n --> =n) [-limit N[,n]][-order (name|size|...)][-sort (ASC|DESC)]\n"; echo "\t$cmd mount URL [path] (without path prints out the mounts)\n"; echo "\t$cmd umount [-a|--all (restores default mounts)] URL|path\n"; + echo "\t$cmd eacl URL [rwx-] [user or group]\n"; echo "\nCommon options: --user user --password password [--domain domain] can be used to pass eGW credentials without using the URL writing.\n"; echo "\nURL: {vfs|sqlfs|oldvfs}://user:password@domain/home/user/file, /dir/file, ...\n"; @@ -82,7 +83,7 @@ if (!$argv) $argv = array('-h'); $args = $find_options = array(); while(!is_null($option = array_shift($argv))) { - if ($option[0] != '-') // no option --> argument + if ($option == '-' || $option[0] != '-') // no option --> argument { $args[] = $option; continue; @@ -225,6 +226,9 @@ switch($cmd) } break; + case 'eacl': + do_eacl($argv); + break; case 'find': do_find($argv,$find_options); @@ -252,10 +256,14 @@ switch($cmd) switch($cmd) { case 'rm': - if ($recursive && class_exists('egw_vfs')) + if ($recursive) { + if (!class_exists('egw_vfs')) + { + die("rm -r only implemented for eGW streams!"); // dont want to repeat the code here + } array_unshift($argv,$url); - egw_vfs::remove($argv); + egw_vfs::remove($argv,true); $argv = array(); } else @@ -422,32 +430,33 @@ switch($cmd) */ function load_wrapper($url) { - switch($scheme = parse_url($url,PHP_URL_SCHEME)) + $scheme = parse_url($url,PHP_URL_SCHEME); + + if (!in_array($scheme,stream_get_wrappers())) { - case 'webdav': - require_once('HTTP/WebDAV/Client.php'); - break; - case 'smb': - require_once('../phpgwapi/inc/class.smb_stream_wrapper.inc.php'); - break; - case 'oldvfs': - case 'vfs': - case 'sqlfs': - if (!isset($GLOBALS['egw_info'])) - { - load_egw(parse_url($url,PHP_URL_USER),parse_url($url,PHP_URL_PASS),parse_url($url,PHP_URL_HOST)); - } - require_once(EGW_API_INC.'/class.'.$scheme.'_stream_wrapper.inc.php'); - break; - case '': // default scheme is file and alsways available - break; - default: - if (!in_array($scheme,stream_get_wrappers())) - { - die("Unknown scheme '$scheme' in $url !!!\n\n"); - } - break; + switch($scheme) + { + case 'webdav': + require_once('HTTP/WebDAV/Client.php'); + break; + case '': // default scheme is file and alsways available + break; + default: + if (!isset($GLOBALS['egw']) && !in_array($scheme,array('smb','imap'))) + { + load_egw(parse_url($url,PHP_URL_USER),parse_url($url,PHP_URL_PASS),parse_url($url,PHP_URL_HOST)); + } + // as eGW might not be loaded, we have to require the class exlicit + @include_once(EGW_API_INC.'/class.'.$scheme.'_stream_wrapper.inc.php'); + + if (!class_exists($scheme.'_stream_wrapper')) + { + die("Unknown scheme '$scheme' in $url !!!\n\n"); + } + break; + } } + //print_r(stream_get_wrappers()); } /** @@ -504,7 +513,7 @@ function load_egw($user,$passwd,$domain='default') set_exception_handler('cli_exception_handler'); // otherwise we get html! } $cmd = $GLOBALS['cmd']; - if (!in_array($cmd,array('ls','find','mount','umount')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir'])) + if (!in_array($cmd,array('ls','find','mount','umount','eacl')) && $GLOBALS['egw_info']['server']['files_dir'] && !is_writable($GLOBALS['egw_info']['server']['files_dir'])) { echo "\nError: eGroupWare's files directory {$GLOBALS['egw_info']['server']['files_dir']} is NOT writable by the user running ".basename(__FILE__)."!\n". "--> Please run it as the same user the webserver uses or root, otherwise the $cmd command will fail!\n\n"; @@ -528,6 +537,59 @@ function _check_pw($hash_or_cleartext,$pw) return $hash_or_cleartext == $pw; } +/** + * Set, delete or show the extended acl for a given path + * + * @param array $argv + */ +function do_eacl(array $argv) +{ + $argc = count($argv); + + if ($argc < 1 || $argc > 3) + { + usage(); + } + load_wrapper($url = $argv[0]); + if (!class_exists('egw_vfs')) + { + die('eacl only implemented for eGW streams!'); + } + if (!file_exists($url)) + { + die("$url: no such file our directory!\n"); + } + if ($argc == 1) + { + foreach(egw_vfs::get_eacl($url) as $acl) + { + $mode = ($acl['rights'] & egw_vfs::READABLE ? 'r' : '-'). + ($acl['rights'] & egw_vfs::WRITABLE ? 'w' : '-'). + ($acl['rights'] & egw_vfs::EXECUTABLE ? 'x' : '-'); + echo $acl['path']."\t$mode\t".$GLOBALS['egw']->accounts->id2name($acl['owner'])."\n"; + } + return; + } + if ($argc > 1 && !is_numeric($argv[1])) + { + $mode=$argv[1]; + $argv[1] = null; + for($i = 0; $mode[$i]; ++$i) + { + switch($mode[$i]) + { + case 'x': $argv[1] |= egw_vfs::EXECUTABLE; break; + case 'w': $argv[1] |= egw_vfs::WRITABLE; break; + case 'r': $argv[1] |= egw_vfs::READABLE; break; + } + } + } + if (!egw_vfs::eacl($url,$argv[1],$argc > 2 && !is_numeric($argv[2]) ? $GLOBALS['egw']->accounts->name2id($argv[2]) : $argv[2])) + { + echo "Error setting extended acl for $argv[0]!\n"; + } +} + /** * Give the stats for one file * @@ -544,7 +606,11 @@ function do_stat($url,$long=false,$numeric=false,$full_path=false) { $bname = basename($bname); } - if ($long && ($stat = stat($url))) + if (!file_exists($url) || !($stat = stat($url))) + { + echo "$bname: no such file or directory!\n"; + } + elseif ($long) { //echo $url; print_r($stat); @@ -657,6 +723,7 @@ function _cp($from,$to,$verbose=false,$perms=false) { die("Can't open $to for writing!\n"); } + //stream_filter_append($from_fp,'convert.base64-decode'); $count = stream_copy_to_stream($from_fp,$to_fp); if ($verbose) echo hsize($count)." bytes written to $to\n"; diff --git a/filemanager/doc/INSTALL b/filemanager/doc/INSTALL deleted file mode 100644 index fc87b41fdf..0000000000 --- a/filemanager/doc/INSTALL +++ /dev/null @@ -1,45 +0,0 @@ -INSTALL -------- -Command examples are suggestions only. Use your head. - -COMMAND SUMMARY ---------------- -cp -a /some/path/to/egroupware/files /path/to/files -cd /path/to/files -chown -R nobody . --OR- -chmod -R 777 . - -http://yourhost.com/setup/ > Setup/Config > Edit Current Configuration -"Enter the full path for users and group files" => /path/to/files - -FULL EXPLANATION ----------------- -[REQUIRED] Copy egroupware/files to where you want to store the files. - THIS SHOULD BE SOMEWHERE NOT INSIDE THE WEBROOT AND NOT ACCESSIBLE TO THE WEB. - Having the files within the webroot is a huge security risk as well as a privacy concern. - The exception to this would be if you WANT the users' and groups' files to be accessible - from the web, such as when setting up public or semi-public web page/document hosting. In - this case, the files directory can be left where it is. - (Make sure you copy the directory, don't just make a new one. The necessary directories - are files/ and files/home/) -[REQUIRED] In http://yourhost.com/setup, login to Setup/Config, then Edit Current Configuration. Enter the FULL path for the files directory you created earlier in the second box from the top. -[REQUIRED] Change permissions for files directory and all it's subdirectories to be writable by Apache - This is the files directory you created earlier and specified in setup (Edit Current Configuration). Note that 'nobody' below could also be 'apache' on your system. Check the 'User' setting in your httpd.conf. - cd /path/to/files - chown -R nobody . - -OR- - chmod -R 777 . - -SECURITY CONCERNS ------------------ -There are many security concerns related with allowing users to store files on the server. The most common problem is that users can upload any type of file, including CGI and PHP scripts. This in effect grants them local access to the machine, and can be used to read database passwords and other sensitive files. The ability to upload files of any type is not forbidden by phpwebhosting because it is sometimes desired, and also the types of vulnerable files differ from server to server. To combat this, you can add a simple entry to Apache's httpd.conf to prevent certain types of files from being executed. Included below is an example that results in .cgi, .pl, .php, .php3, and .phps files being treated as normal text files. It also explicitly turns all Options off, which includes turning Indexes (listing of files) off. - - -Options None -AllowOverride None -DirectoryIndex index.html -RemoveHandler cgi-script .cgi .pl -RemoveType application/x-httpd-php .php .php3 -RemoveType application/x-httpd-php-source .phps - diff --git a/filemanager/doc/INSTALL_WebDAV b/filemanager/doc/INSTALL_WebDAV deleted file mode 100644 index 798c73d80c..0000000000 --- a/filemanager/doc/INSTALL_WebDAV +++ /dev/null @@ -1,124 +0,0 @@ -INSTALL : WebDAV file share ---------------------------- -Note: if you don't know what WebDAV is you probably don't need it. The default -vfs_sql is generally faster and easier to setup. - -Filemanager's WebDAV support allows you to store your files online in -egroupware, in a way that cooperates well with other web applications (for -instance, in Windows you can then access your files as a "web folder", and -similarly KDE, Gnome, MacOSX, and amultitude of applications (eg MS Office and -OpenOffice.org) all include some way of browsing files on a WebDAV share) - - -Installation ------------- -To install: - -1/ Setup a WebDAV server - currently this code has only been well tested using - Apache's mod_dav (http://www.webdav.org/mod_dav/). mod_dav is included in - Apache 2, and most Linux distributions include it as a package. - - To setup mod_dav ensure that you have the module installed correctly ( RTFM :) - and create a virtual host (eg files.yourdomain.com) something like this: - - - AccessFileName .htaccess - ServerAdmin webmaster@yourdomain.com - DocumentRoot /var/files - - AllowOverride All - Options +Indexes - DAV on - DirectoryIndex / - RemoveHandler cgi-script .cgi .pl - RemoveType application/x-httpd-php .php .php3 - RemoveType application/x-httpd-php-source .phps - - - #This ensures egroupware can modify .htaccess files - order deny,allow - deny from all - #make sure your egroupware server is included here. - allow from localhost .localdomain - - ServerName files.yourdomain.com - ErrorLog logs/dav_err - CustomLog logs/dav_acc combined - - -2/ On the setup page (egroupware/setup/config.php) specify - the WebDAV server URL (eg http://files.yourdomain.com ) in the: "Full path - for users and groups files" text area, and select DAV in the: - "Select where you want to store/retrieve filesystem information" - combo. If your file repository supports SSL you might want to enter - 'https://files.yourdomain.com' instead - note that phpGroupWare itself wont - use SSL to access the repository, but when it redirects the users browser to - the repository it will use the secure https url. - -3/ Make sure your WebDAV repository contains a "home" directory (important!) - So if your WebDAV directory is /var/files, you would need: - /var/files/ - /var/files/home/ - -4/ You now want some kind of authentication on the WebDAV repository, so that - users accessing it directly still need their egroupware password. By default - there is no security through Apache's WebDAV module and anyone could access - your files. - - To enable authentication you must use a third-party Apache authentication - module. Which you use depends on how you have setup authentication in - phpGroupWare - for instance if you use an SQL DB (the default) then set up - mod_auth_pgsql (http://www.giuseppetanzilli.it/mod_auth_pgsql/) or - mod_auth_mysql (http://modauthmysql.sourceforge.net/) - - An example .htaccess file for your repository's root - (e.g. /var/files) when using mod_auth_mysql would be: - - Options None - DirectoryIndex index.html - RemoveHandler cgi-script .cgi .pl - RemoveType application/x-httpd-php .php .php3 - RemoveType application/x-httpd-php-source .phps - - AuthMySQL_Host localhost - AuthMySQL_User - AuthMySQL_Password - Auth_MySQL_DB - - AuthMySQL_Password_Table "phpgw_accounts AS users" - AuthMySQL_Username_Field users.account_lid - AuthMySQL_Password_Field account_pwd - - Auth_MySQL_Encryption_Types PHP_MD5 - - AuthName "V-Manager" - AuthType Basic - require valid-user - - eGroupWare's WebDAV vfs class has some support for adding - .htaccess files when creating new directories but does not do - so when creating a new directory for a new user so you will - need to do this by hand or modify the vfs_dav class. The .htaccess - file would look like "require user " - - Filemanager also supports group directories. Add the - following to the .htaccess file: - - AuthMySQL_Group_Table "phpgw_accounts AS groups, phpgw_accounts AS users, phpgw_acl AS acl" - Auth_MySQL_Group_Field groups.account_lid - Auth_MySQL_Group_Clause " AND groups.account_type='g' AND users.account_type='u' AND groups.account_id=acl.acl_location AND users.account_id=acl.acl_account AND groups.account_lid='Admins'" - - And finally make the group directories by hand: - - mkdir home/Admins; mkdir home/Default - - and each directory's .htaccess file by hand: - - require group Admins - -TODO: - -Create group directories automaticly -Create .htaccess file for group directories automaticly -Create .htaccess files for new user directories automaticly -Only list group directories to which the user has access diff --git a/filemanager/inc/class.bofilemanager.inc.php b/filemanager/inc/class.bofilemanager.inc.php deleted file mode 100755 index dfe0345baf..0000000000 --- a/filemanager/inc/class.bofilemanager.inc.php +++ /dev/null @@ -1,351 +0,0 @@ -sofilemanager(); - // discarded because of extension - //$this->so =& CreateObject('filemanager.sofilemanager'); - //$this->so->db_init(); - $this->db_init(); - - $this->vfs =& CreateObject('phpgwapi.vfs'); - - error_reporting(4); - - ### Start Configuration Options ### - ### These are automatically set in eGW - do not edit ### - - $this->sep = SEP; - $this->rootdir = $this->vfs->basedir; - $this->fakebase = $this->vfs->fakebase; - $this->appname = $GLOBALS['egw_info']['flags']['currentapp']; - - if(stristr($this->rootdir, EGW_SERVER_ROOT)) - { - $this->filesdir = substr($this->rootdir, strlen(EGW_SERVER_ROOT)); - } - else - { - unset($this->filesdir); - } - - $this->hostname = $GLOBALS['egw_info']['server']['webserver_url'] . $this->filesdir; - -// die($this->hostname); - ### - # Note that $userinfo["username"] is actually the id number, not the login name - ### - - $this->userinfo['username'] = $GLOBALS['egw_info']['user']['account_id']; - $this->userinfo['account_lid'] = $GLOBALS['egw']->accounts->id2name($this->userinfo['username']); - $this->userinfo['hdspace'] = 10000000000; // to settings - $this->homedir = $this->fakebase.'/'.$this->userinfo['account_lid']; - - ### End Configuration Options ### - - if(!defined('NULL')) - { - define('NULL', ''); - } - - ### - # Define the list of file attributes. Format is "internal_name" => "Displayed name" - # This is used both by internally and externally for things like preferences - ### - - $this->file_attributes = Array( - 'name' => lang('File Name'), - 'mime_type' => lang('MIME Type'), - 'size' => lang('Size'), - 'created' => lang('Created'), - 'modified' => lang('Modified'), - 'owner' => lang('Owner'), - 'createdby_id' => lang('Created by'), - 'modifiedby_id' => lang('Created by'), - 'modifiedby_id' => lang('Modified by'), - 'app' => lang('Application'), - 'comment' => lang('Comment'), - 'version' => lang('Version') - ); - if (!is_object($GLOBALS['egw']->datetime)) - { - $GLOBALS['egw']->datetime =& CreateObject('phpgwapi.datetime'); - } - $this->tz_offset_s = $GLOBALS['egw']->datetime->tz_offset; - $this->now = time() + $this->tz_offset_s; // time() is server-time and we need a user-time - - } - - /** - * changes the data from the db-format to your work-format - * - * reimplemented to adjust the timezone of the timestamps (adding $this->tz_offset_s to get user-time) - * Please note, we do NOT call the method of the parent so_sql !!! - * - * @param array $data if given works on that array and returns result, else works on internal data-array - * @return array with changed data - */ - function db2data($data=null) - { - if (!is_array($data)) - { - $data = &$this->data; - } - foreach($this->timestamps as $name) - { - if (isset($data[$name]) && $data[$name]) $data[$name] += $this->tz_offset_s; - } - return $data; - } - - /** - * changes the data from your work-format to the db-format - * - * reimplemented to adjust the timezone of the timestamps (subtraction $this->tz_offset_s to get server-time) - * Please note, we do NOT call the method of the parent so_sql !!! - * - * @param array $data if given works on that array and returns result, else works on internal data-array - * @return array with changed data - */ - function data2db($data=null) - { - if ($intern = !is_array($data)) - { - $data = &$this->data; - } - foreach($this->timestamps as $name) - { - if (isset($data[$name]) && $data[$name]) $data[$name] -= $this->tz_offset_s; - } - return $data; - } - - ### - # Calculate and display B or KB - # And yes, that first if is strange, - # but it does do something - ### - function borkb($size, $enclosed = NULL, $return = 1) - { - if(!$size) - { - $size = 0; - } - - if($enclosed) - { - $left = '('; - $right = ')'; - } - - if($size < 1024) - { - $rstring = $left . $size . 'B' . $right; - } - else - { - $rstring = $left . round($size/1024) . 'KB' . $right; - } - - return($this->eor($rstring, $return)); - } - - ### - # Check for and return the first unwanted character - ### - - function bad_chars($string, $all = True, $return = 0) - { - if($all) - { - if(preg_match("-([\\/<>\'\"\&])-", $string, $badchars)) - { - $rstring = $badchars[1]; - } - } - else - { - if(preg_match("-([\\/<>])-", $string, $badchars)) - { - $rstring = $badchars[1]; - } - } - - return trim(($this->eor($rstring, $return))); - } - - ### - # Match character in string using ord(). - ### - - function ord_match($string, $charnum) - { - for($i = 0; $i < strlen($string); $i++) - { - $character = ord(substr($string, $i, 1)); - - if($character == $charnum) - { - return True; - } - } - - return False; - } - - ### - # Decide whether to echo or return. Used by HTML functions - ### - - function eor($rstring, $return) - { - if($return) - { - return($rstring); - } - else - { - $this->html_text($rstring . "\n"); - return(0); - } - } - - function html_text($string, $times = 1, $return = 0, $lang = 0) - { - if($lang) - { - $string = lang($string); - } - - if($times == NULL) - { - $times = 1; - } - for($i = 0; $i != $times; $i++) - { - if($return) - { - $rstring .= $string; - } - else - { - echo $string; - } - } - if($return) - { - return($rstring); - } - } - - ### - # URL encode a string - # First check if its a query string, then if its just a URL, then just encodes it all - # Note: this is a hack. It was made to work with form actions, form values, and links only, - # but should be able to handle any normal query string or URL - ### - function string_encode($string, $return = False) - { - //var_dump($string); - if(preg_match("/=(.*)(&|$)/U", $string)) - { - $rstring = $string; - - preg_match_all("/=(.*)(&|$)/U", $string, $matches, PREG_SET_ORDER);//FIXME matches not defined - - reset($matches);//FIXME matches not defined - - while(list(,$match_array) = each($matches))//FIXME matches not defined - { - $var_encoded = rawurlencode(base64_encode($match_array[1])); - $rstring = str_replace($match_array[0], '=' . $var_encoded . $match_array[2], $rstring); - } - } - elseif($this->hostname != "" && ereg('^'.$this->hostname, $string)) -// elseif(ereg('^'.$this->hostname, $string)) - { - $rstring = ereg_replace('^'.$this->hostname.'/', '', $string); - $rstring = preg_replace("/(.*)(\/|$)/Ue", "rawurlencode(base64_encode('\\1')) . '\\2'", $rstring); - $rstring = $this->hostname.'/'.$rstring; - } - else - { - $rstring = rawurlencode($string); - - /* Terrible hack, decodes all /'s back to normal */ - $rstring = preg_replace("/%2F/", '/', $rstring); - } - - return($this->eor($rstring, $return)); - } - - function string_decode($string, $return = False) - { - $rstring = rawurldecode($string); - - return($this->eor($rstring, $return)); - } - - ### - # HTML encode a string - # This should be used with anything in an HTML tag that might contain < or > - ### - - function html_encode($string, $return) - { - $rstring = htmlspecialchars($string); - - return($this->eor($rstring, $return)); - } - } -?> diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php deleted file mode 100644 index a754ce0c1b..0000000000 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ /dev/null @@ -1,149 +0,0 @@ - - * @package filemanager - * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id$ - */ - -/** - * Class containing admin, preferences and sidebox-menus (used as hooks) - */ -class filemanager_hooks -{ - function all_hooks($args) - { - $appname = 'filemanager'; - $location = is_array($args) ? $args['location'] : $args; - //echo "

admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'

\n"; - - if ($location == 'sidebox_menu') - { - $title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); - $file = Array( - 'New interface' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index')), - 'Old interface' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.uifilemanager.index')), - 'Search' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.uifilemanager.index', 'action'=>'search')), - ); - display_sidebox($appname,$title,$file); - } - - if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') - { - $file = array( - 'Filemanager Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname), - 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), - ); - if ($location == 'preferences') - { - display_section($appname,$file); - } - else - { - display_sidebox($appname,lang('Preferences'),$file); - } - } - if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences') - { - $file = Array( - 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), - ); - if ($location == 'admin') - { - display_section($appname,$file); - } - else - { - display_sidebox($appname,lang('Admin'),$file); - } - } - - } - - function settings($args) - { - settype($GLOBALS['settings'],'array'); - - $GLOBALS['settings']['display_attrs'] = array( - 'type' => 'section', - 'title' => 'Display attributes', - 'name' => 'display_attrs', - 'xmlrpc' => True, - 'admin' => False - ); - - $file_attributes = Array( - 'name' => 'File Name', - 'mime_type' => 'MIME Type', - 'size' => 'Size', - 'created' => 'Created', - 'modified' => 'Modified', - 'owner' => 'Owner', - 'createdby_id' => 'Created by', - 'modifiedby_id' => 'Created by', - 'modifiedby_id' => 'Modified by', - 'app' => 'Application', - 'comment' => 'Comment', - 'version' => 'Version' - ); - - foreach($file_attributes as $key => $value) - { - $GLOBALS['settings'][$key] = array( - 'type' => 'check', - 'label' => "$value", - 'name' => $key, - 'xmlrpc' => True, - 'admin' => False - ); - } - - $GLOBALS['settings']['other_settings'] = array( - 'type' => 'section', - 'title' => 'Other settings', - 'name' => 'other_settings', - 'xmlrpc' => True, - 'admin' => False - ); - - $other_checkboxes = array ( - "viewinnewwin" => "View documents in new window", - "viewonserver" => "View documents on server (if available)", - "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", - "dotdot" => "Show ..", - "dotfiles" => "Show .files", - ); - - foreach($other_checkboxes as $key => $value) - { - $GLOBALS['settings'][$key] = array( - 'type' => 'check', - 'label' => "$value", - 'name' => $key, - 'xmlrpc' => True, - 'admin' => False - ); - } - - $upload_boxes = array( - '1' => '1', - '5' => '5', - '10' => '10', - '20' => '20', - '30' => '30' - ); - - $GLOBALS['settings']['show_upload_boxes'] = array( - 'label' => 'Default number of upload fields to show', - 'name' => 'show_upload_boxes', - 'values' => $upload_boxes, - 'xmlrpc' => True, - 'admin' => False - ); - - return true; - } -} diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 4dee908ce6..b40e534140 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -1,6 +1,6 @@ session->appsession('index','filemanager'); $old_path = $ses['path']; - $content['nm']['path'] = $old_path.'/'.$content['nm']['path']; + $content['nm']['path'] = egw_vfs::concat($old_path,$content['nm']['path']); } if (!@egw_vfs::mkdir($content['nm']['path'],null,STREAM_MKDIR_RECURSIVE)) { @@ -130,7 +130,7 @@ class filemanager_ui $content['nm']['msg'] = self::action($clipboard_type.'_paste',$clipboard_files,$content['nm']['path']); break; case 'upload': - $to = $content['nm']['path'].'/'.$content['upload']['name']; + $to = egw_vfs::concat($content['nm']['path'],$content['upload']['name']); if ($content['upload'] && is_uploaded_file($content['upload']['tmp_name']) && (egw_vfs::is_writable($content['nm']['path']) || egw_vfs::is_writable($to)) && copy($content['upload']['tmp_name'],egw_vfs::PREFIX.$to)) @@ -209,7 +209,8 @@ class filemanager_ui $post_max_size = ini_get('post_max_size'); $max_upload = min(self::km2int($upload_max_filesize),self::km2int($post_max_size)-2800); - return lang('Maximum size for uploads: %1 (php.ini: upload_max_filesize=%2, post_max_size=%3)',egw_vfs::hsize($max_upload),$upload_max_filesize,$post_max_size); + return lang('Maximum size for uploads').': '.egw_vfs::hsize($max_upload). + " (php.ini: upload_max_filesize=$upload_max_filesize, post_max_size=$post_max_size)"; } /** @@ -268,7 +269,7 @@ class filemanager_ui { if (!egw_vfs::is_dir($path)) { - $to = $dir.'/'.egw_vfs::basename($path); + $to = egw_vfs::concat($dir,egw_vfs::basename($path)); if ($path != $to && egw_vfs::copy($path,$to)) { ++$files; @@ -313,7 +314,7 @@ class filemanager_ui case 'cut_paste': foreach($selected as $path) { - $to = $dir.'/'.egw_vfs::basename($path); + $to = egw_vfs::concat($dir,egw_vfs::basename($path)); if ($path != $to && egw_vfs::rename($path,$to)) { ++$files; @@ -338,9 +339,10 @@ class filemanager_ui * * @param string $mime_type * @param int $size=16 + * @param boolean $et_image=true return $app/$icon string for etemplate (default) or html image tag if false * @return string */ - static private function mime_icon($mime_type, $size=16) + static function mime_icon($mime_type, $size=16) { if ($mime_type == egw_vfs::DIR_MIME_TYPE) { @@ -408,7 +410,7 @@ class filemanager_ui $row['icon'] = self::mime_icon($row['mime']); $row['perms'] = egw_vfs::int2mode($row['mode']); // only show link if we have access to the file or dir - if (egw_vfs::check_access($row,egw_vfs::READABLE)) + if (egw_vfs::check_access($path,egw_vfs::READABLE)) { if ($row['mime'] == egw_vfs::DIR_MIME_TYPE) { @@ -416,7 +418,7 @@ class filemanager_ui } else { - $row['link'] = self::download_url($path); + $row['link'] = egw_vfs::download_url($path); } } $row['user'] = $row['uid'] ? $GLOBALS['egw']->accounts->id2name($row['uid']) : 'root'; @@ -441,27 +443,16 @@ class filemanager_ui return egw_vfs::$find_total; } - /** - * URL to download the file - * - * We use our webdav handler as download url instead of an own download method. - * The webdav hander (filemanager/webdav.php) recognices eGW's session cookie and of cause understands regular GET requests. - * - * @param string $path - * @return string - */ - private static function download_url($path) - { - return '/filemanager/webdav.php'.$path; - } - /** * Preferences of a file/directory * * @param array $content=null + * @param string $msg='' */ - function file(array $content=null) + function file(array $content=null,$msg='') { + static $tabs = 'general|perms|eacl|preview'; + $tpl = new etemplate('filemanager.file'); if (!is_array($content)) @@ -485,7 +476,7 @@ class filemanager_ui { $content['perms']['executable'] = (int)!!($content['mode'] & 0111); $mask = 6; - $content['link'] = $GLOBALS['egw']->link(self::download_url($path)); + $content['link'] = $GLOBALS['egw']->link(egw_vfs::download_url($path)); if (preg_match('/^text/',$content['mime']) && $content['size'] < 100000) { $content['text_content'] = file_get_contents(egw_vfs::PREFIX.$path); @@ -493,62 +484,92 @@ class filemanager_ui } else { - $content['perms']['sticky'] = (int)!!($content['mode'] & 0x201); + //currently not implemented in backend $content['perms']['sticky'] = (int)!!($content['mode'] & 0x201); $mask = 7; } foreach(array('owner' => 6,'group' => 3,'other' => 0) as $name => $shift) { $content['perms'][$name] = ($content['mode'] >> $shift) & $mask; } + $content['is_owner'] = egw_vfs::has_owner_rights($path,$content); } else { + //_debug_array($content); $path = $content['path']; - foreach($content['old'] as $name => $old_value) + + list($button) = @each($content['button']); unset($content['button']); + if (in_array($button,array('save','apply'))) { - if (isset($content[$name]) && $old_value != $content[$name]) + foreach($content['old'] as $name => $old_value) { - switch($name) + if (isset($content[$name]) && $old_value != $content[$name]) { - case 'name': - if (egw_vfs::rename($path,$to = $content['dir'].'/'.$content['name'])) - { - $msg = lang('Renamed %1 to %2.',$path,$to).' '; - } - $path = $to; - break; - default: - static $name2cmd = array('uid' => 'chown','gid' => 'chgrp','perms' => 'chmod'); - $cmd = array('egw_vfs',$name2cmd[$name]); - $value = $name == 'perms' ? self::perms2mode($content['perms']) : $content[$name]; - if ($content['modify_subs'] && $name == 'perms') - { - egw_vfs::find($path,array('type'=>'d'),$cmd,array($value)); - egw_vfs::find($path,array('type'=>'f'),$cmd,array($value & 0666)); // no execute for files - } - elseif ($content['modify_subs']) - { - egw_vfs::find($path,null,$cmd,array($value)); - } - else - - { - call_user_func_array($cmd,array($path,$value)); - } - $msg .= lang('Permissions changed for %1.',$path.($content['modify_subs']?' '.lang('and all it\'s childeren'):'')); - break; + switch($name) + { + case 'name': + if (egw_vfs::rename($path,$to = egw_vfs::concat($content['dir'],$content['name']))) + { + $msg = lang('Renamed %1 to %2.',$path,$to).' '; + } + $path = $to; + break; + default: + static $name2cmd = array('uid' => 'chown','gid' => 'chgrp','perms' => 'chmod'); + $cmd = array('egw_vfs',$name2cmd[$name]); + $value = $name == 'perms' ? self::perms2mode($content['perms']) : $content[$name]; + if ($content['modify_subs'] && $name == 'perms') + { + egw_vfs::find($path,array('type'=>'d'),$cmd,array($value)); + egw_vfs::find($path,array('type'=>'f'),$cmd,array($value & 0666)); // no execute for files + } + elseif ($content['modify_subs']) + { + egw_vfs::find($path,null,$cmd,array($value)); + } + else + { + call_user_func_array($cmd,array($path,$value)); + } + $msg .= lang('Permissions changed for %1.',$path.($content['modify_subs']?' '.lang('and all it\'s childeren'):'')); + break; + } + } + } + } + elseif ($content['eacl'] && $content['is_owner']) + { + if ($content['eacl']['delete']) + { + list($ino_owner) = each($content['eacl']['delete']); + list($ino,$owner) = explode('-',$ino_owner); + $msg .= egw_vfs::eacl($path,null,$owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!'); + } + elseif ($button == 'eacl') + { + if (!$content['eacl']['owner']) + { + $msg .= lang('You need to select an owner!'); + } + else + { + $msg .= egw_vfs::eacl($path,$content['eacl']['rights'],$content['eacl']['owner']) ? + lang('ACL added.') : lang('Error adding the ACL!'); } } } // refresh opender and close our window $link = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index','msg'=>$msg)); - $js = "opener.location.href='$link'; window.close();"; + $js = "opener.location.href='$link';"; + if ($button == 'save') $js .= "window.close();"; echo "\n\n\n\n\n"; - $GLOBALS['egw']->common->egw_exit(); + if ($button == 'save')$GLOBALS['egw']->common->egw_exit(); } + $content['msg'] = $msg; + if (($readonlys['uid'] = !egw_vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root'; // only owner can change group & perms - if (($readonlys['gid'] = !egw_vfs::$is_root && $content['uid'] != egw_vfs::$user || + if (($readonlys['gid'] = !$content['is_owner'] || parse_url(egw_vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) // no uid, gid or perms in oldvfs { if (!$content['gid']) $content['ro_gid_root'] = 'root'; @@ -559,18 +580,27 @@ class filemanager_ui } $readonlys['name'] = !egw_vfs::is_writable($content['dir']); - if (parse_url(egw_vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs') - { - - } - + $readonlys[$tabs]['eacl'] = true; // eacl off by default if ($content['is_dir']) { - $sel_options['owner']=$sel_options['group']=$sel_options['other'] = array( + $readonlys[$tabs]['preview'] = true; // no preview tab for dirs + $sel_options['rights']=$sel_options['owner']=$sel_options['group']=$sel_options['other'] = array( 7 => lang('Display and modification of content'), 5 => lang('Display of content'), 0 => lang('No access'), ); + if(($content['eacl'] = egw_vfs::get_eacl($content['path'])) !== false) // backend supports eacl + { + unset($readonlys[$tabs]['eacl']); // --> switch the tab on again + foreach($content['eacl'] as &$eacl) + { + $eacl['path'] = parse_url($eacl['path'],PHP_URL_PATH); + $readonlys['delete['.$eacl['ino'].'-'.$eacl['owner'].']'] = $eacl['ino'] != $content['ino'] || + $eacl['path'] != $content['path'] || !$content['is_owner']; + } + array_unshift($content['eacl'],false); // make the keys start with 1, not 0 + $content['eacl']['rights'] = $content['eacl']['owner'] = 0; + } } else { @@ -578,7 +608,7 @@ class filemanager_ui 6 => lang('Read & write access'), 4 => lang('Read access only'), 0 => lang('No access'), - ); + ); } $preserve = $content; if (!isset($preserve['old'])) diff --git a/filemanager/inc/class.sofilemanager.inc.php b/filemanager/inc/class.sofilemanager.inc.php deleted file mode 100755 index 8039caabe1..0000000000 --- a/filemanager/inc/class.sofilemanager.inc.php +++ /dev/null @@ -1,59 +0,0 @@ -db = clone($GLOBALS['egw']->db); - $this->so_sql('phpgwapi',$this->maintable); - } - - /* Any initializations that need to be done */ - function db_init() - { - $this->db->Auto_Free = 0; - } - - /* General SQL query */ - function db_query($query) - { - - return $this->db->query($query); - } - - /* Fetch next array for $query_id */ - function db_fetch_array($query_id) - { - // $egw->db->Query_ID = $query_id; - $this->db->next_record(); - return $this->db->Record; - } - - /* - General wrapper for all other db calls - Calls in here are simply returned, so not all will work - */ - function db_call($function, $query_id) - { - // $egw->db->Query_ID = $query_id; - return $this->db->$function(); - } - } -?> diff --git a/filemanager/inc/class.uifilemanager.inc.php b/filemanager/inc/class.uifilemanager.inc.php deleted file mode 100755 index c4fec36e1c..0000000000 --- a/filemanager/inc/class.uifilemanager.inc.php +++ /dev/null @@ -1,2616 +0,0 @@ - True, - 'help' => True, - 'view' => True, - 'history' => True, - 'edit' => True, - 'download'=>True, - 'search_tpl'=>True, - ); - - //keep - var $bo; - var $t; - //template object - /** - * instantiation of the etemplate as classenvariable - * - * @var etemplate - */ - var $tmpl; - var $search_options; - var $disppath; - var $cwd; - var $lesspath; - var $readable_groups; - var $files_array; - var $dirs_options; - var $numoffiles; - var $dispsep; - - var $target; - - var $prefs;//array - - var $groups_applications; - - //originally post_vars - // var $goto; - var $goto_x; - var $download_x; - var $todir; - var $changedir; // for switching dir. - var $cdtodir; // for switching dir. -// var $createdir; - var $newfile_or_dir; - var $newdir_x; - var $newfile_x; - var $createfile_var; - var $delete_x; - var $renamefiles; - var $rename_x; - var $move_to_x; - // var $copy_to; - var $copy_to_x; - var $edit_x; - var $edit_comments_x; - var $edit_file; - var $edit_preview_x; - var $edit_save_x; - var $edit_save_done_x; - var $edit_cancel_x; - var $comment_files; - var $upload_x; - var $uploadprocess; - - // this ones must be checked thorougly; - var $fileman = Array(); - //var $fileman; - var $path; - var $file; // FIXME WHERE IS THIS FILLED? - var $sortby; - var $messages = array(); - var $show_upload_boxes; - - //var $debug = false; - var $debug = false; - var $now; - - function uifilemanager() - { - // discarded becouse of class extension - //$this->bo =& CreateObject('filemanager.bofilemanager'); - $this->bofilemanager(); - - //KL begin 200703 searchtemplate - // etemplate stuff - $this->tmpl =& CreateObject('etemplate.etemplate'); - //KL end 200703 searchtemplate - - // error_reporting(8); - - $this->dateformat=$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; - - //$this->now = date($this->dateformat); - $this->now = date('Y-m-d'); - - $this->t = $GLOBALS['egw']->template; - - // here local vars are created from the HTTP vars - @reset($_POST); - while(list($name,) = @each($_POST)) - { - $this->$name = $_POST[$name]; - } - - @reset($_GET); - while(list($name,) = @each($_GET)) - { - $$name = $_GET[$name]; - } - - $to_decode = array - ( - /* - Decode - 'var' when 'avar' == 'value' - or - 'var' when 'var' is set - */ - 'op' => array('op' => ''), - 'path' => array('path' => ''), - 'file' => array('file' => ''), - 'sortby' => array('sortby' => ''), - // 'fileman' => array('fileman' => ''), - 'messages' => array('messages' => ''), - // 'help_name' => array('help_name' => ''), - // 'renamefiles' => array('renamefiles' => ''), - 'comment_files' => array('comment_files' => ''), - 'show_upload_boxes' => array('show_upload_boxes' => '') - ); - - reset($to_decode); - while(list($var, $conditions) = each($to_decode)) - { - while(list($condvar, $condvalue) = each($conditions)) - { - if(isset($$condvar) && ($condvar == $var || $$condvar == $condvalue)) - { - if(is_array($$var)) - { - $temp = array(); - while(list($varkey, $varvalue) = each($$var)) - { - if(is_int($varkey)) - { - $temp[$varkey] = stripslashes(base64_decode(urldecode(($varvalue)))); - } - else - { - $temp[stripslashes(base64_decode(urldecode(($varkey))))] = $varvalue; - } - } - $this->$var = $temp; - } - elseif(isset($$var)) - { - $this->$var = stripslashes(base64_decode(urldecode($$var))); - } - } - } - } - - // get appl. and user prefs - $pref =& CreateObject('phpgwapi.preferences', $this->userinfo['username']); - $pref->read_repository(); - // $GLOBALS['egw']->hooks->single('add_def_pref', $GLOBALS['appname']); - $pref->save_repository(True); - $pref_array = $pref->read_repository(); - $this->prefs = $pref_array[$this->appname]; //FIXME check appname var in _debug_array - - //always show name - - $this->prefs['name'] = 1; - - if($this->prefs['viewinnewwin']) - { - $this->target = '_blank'; - } - - /* - Check for essential directories - admin must be able to disable these tests - */ - - // check if basedir exist - $test=$this->vfs->get_real_info(array('string' => $this->basedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - if($test['mime_type'] != 'Directory') - { - die('Base directory does not exist, Ask adminstrator to check the global configuration.'); - } - - $test=$this->vfs->get_real_info(array('string' => $this->basedir.$this->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - if($test['mime_type'] != 'Directory') - { - $this->vfs->override_acl = 1; - - $this->vfs->mkdir(array( - 'string' => $this->fakebase, - 'relatives' => array(RELATIVE_NONE) - )); - - $this->vfs->override_acl = 0; - - //test one more time - $test=$this->vfs->get_real_info(array('string' => $this->basedir.$this->fakebase, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - - if($test['mime_type']!='Directory') - { - die('Fake Base directory does not exist and could not be created, please ask the administrator to check the global configuration.'); - } - else - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array( - lang('Fake Base Dir did not exist, eGroupWare created a new one.') - )); - } - } - -// die($this->homedir); - $test=$this->vfs->get_real_info(array('string' => $this->basedir.$this->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - if($test['mime_type'] != 'Directory') - { - $this->vfs->override_acl = 1; - - $this->vfs->mkdir(array( - 'string' => $this->homedir, - 'relatives' => array(RELATIVE_NONE) - )); - - $this->vfs->override_acl = 0; - - //test one more time - $test=$this->vfs->get_real_info(array('string' => $this->basedir.$this->homedir, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - - if($test['mime_type'] != 'Directory') - { - die('Your Home Dir does not exist and could not be created, please ask the adminstrator to check the global configuration.'); - } - else - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array( - lang('Your Home Dir did not exist, eGroupWare created a new one.') - )); - // FIXME we just created a fresh home dir so we know there nothing in it so we have to remove all existing content - } - } - $GLOBALS['uifilemanager'] =& $this; // make ourself available for ExecMethod of get_rows function - - } - - function index() - { - //echo "

call index

"; - if ($_GET['action']=='search') - { - $this->search_tpl(); - } - else - { - $this->index_2(); - } - } - - function index_2() - { - //echo "

call index_2

"; - //_debug_array($this->tmpl); - $sessiondata = $this->read_sessiondata(); - if($noheader || $nofooter || ($this->download_x && (count($this->fileman) > 0))) - { - $noheader = True; - $nofooter = True; - $noappheader= True; - $nonavbar= True; - } - else - { - $GLOBALS['egw_info']['flags'] = array - ( - 'currentapp' => 'filemanager', - 'noheader' => $noheader, - 'nonavbar' => $nonavbar, - 'nofooter' => $nofooter, - 'noappheader' => $noappheader, - 'enable_browser_class' => True - ); - $GLOBALS['egw']->common->egw_header(); - } - - # Page to process users - # Code is fairly hackish at the beginning, but it gets better - # Highly suggest turning wrapping off due to long SQL queries - - ### - # Some hacks to set and display directory paths correctly - ### -/* - if($this->goto || $this->goto_x) - { - $this->path = $this->cdtodir; - } -*/ - // new method for switching to a new dir. - if($this->changedir=='true' && $this->cdtodir || $this->goto_x) - { - $this->path = $this->cdtodir; - } - - if(!$this->path) - { - $this->path = $this->vfs->pwd(); - - if(!$this->path || $this->vfs->pwd(array('full' => False)) == '') - { - $this->path = $this->homedir; - } - } - - $this->vfs->cd(array('string' => False, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - $this->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); - - $pwd = $this->vfs->pwd(); - - if(!$this->cwd = substr($this->path, strlen($this->homedir) + 1)) - { - $this->cwd = '/'; - } - else - { - $this->cwd = substr($pwd, strrpos($pwd, '/') + 1); - } - - $this->disppath = $this->path; - $sessiondata['workingdir']="$this->disppath"; - /* This just prevents // in some cases */ - if($this->path == '/') - { - $this->dispsep = ''; - } - else - { - $this->dispsep = '/'; - } - - if(!($this->lesspath = substr($this->path, 0, strrpos($this->path, '/')))) - { - $this->lesspath = '/'; - } - //echo "

#$this->path#

"; - # Get their readable groups to be used throughout the script - $groups = array(); - - $groups = $GLOBALS['egw']->accounts->get_list('groups'); - $this->readable_groups = Array(); - - while(list($num, $account) = each($groups)) - { - if($this->vfs->acl_check(array('owner_id' => $account['account_id'],'operation' => EGW_ACL_READ))) - { - $this->readable_groups[$account['account_lid']] = Array('account_id' => $account['account_id'], 'account_name' => $account['account_lid']); - } - } - $sessiondata['readable_groups']=$this->readable_groups; - $this->groups_applications = array(); - - while(list($num, $group_array) = each($this->readable_groups)) - { - $group_id = $GLOBALS['egw']->accounts->name2id($group_array['account_name']); - - $applications =& CreateObject('phpgwapi.applications', $group_id); - $this->groups_applications[$group_array['account_name']] = $applications->read_account_specific(); - } - $sessiondata['groups_applications']=$this->groups_applications; - - # We determine if they're in their home directory or a group's directory, - # and set the VFS working_id appropriately - if((preg_match('+^'.$this->fakebase.'\/(.*)(\/|$)+U', $this->path, $matches)) && $matches[1] != $this->userinfo['account_lid']) //FIXME matches not defined - { - $this->vfs->working_id = $GLOBALS['egw']->accounts->name2id($matches[1]);//FIXME matches not defined - } - else - { - $this->vfs->working_id = $this->userinfo['username']; - } - $this->save_sessiondata($sessiondata); - - # FIXME # comment what happens here - if($this->path != $this->homedir && $this->path != $this->fakebase && $this->path != '/' && !$this->vfs->acl_check(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE),'operation' => EGW_ACL_READ))) - { - echo "

died for some reasons

"; - $this->messages[]= $GLOBALS['egw']->common->error_list(array(lang('You do not have access to %1', $this->path))); - $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->homedir, lang('Go to your home directory')); - - $GLOBALS['egw']->common->egw_footer(); - $GLOBALS['egw']->common->egw_exit(); - } - - $this->userinfo['working_id'] = $this->vfs->working_id; - $this->userinfo['working_lid'] = $GLOBALS['egw']->accounts->id2name($this->userinfo['working_id']); - - # If their home directory doesn't exist, we try to create it - # Same for group directories - - - // Moved to constructor - /* - if(($this->path == $this->homedir) && !$this->vfs->file_exists($pim_tmp_arr)) - { - $this->vfs->override_acl = 1; - - if(!$this->vfs->mkdir(array( - 'string' => $this->homedir, - 'relatives' => array(RELATIVE_NONE) - ))) - { - $p = $this->vfs->path_parts($pim_tmp_arr); - - $this->messages[]= $GLOBALS['egw']->common->error_list(array( - lang('Could not create directory %1', - $this->homedir . ' (' . $p->real_full_path . ')' - ))); - } - - $this->vfs->override_acl = 0; - } - */ - - # Verify path is real - if($this->path != $this->homedir && $this->path != '/' && $this->path != $this->fakebase) - { - if(!$this->vfs->file_exists(array( - 'string' => $this->path, - 'relatives' => array(RELATIVE_NONE) - ))) - { - echo "

died for some other reasons

"; - $this->messages[] = $GLOBALS['egw']->common->error_list(array(lang('Directory %1 does not exist', $this->path))); - $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->homedir, lang('Go to your home directory')); - $GLOBALS['egw']->common->egw_footer(); - $GLOBALS['egw']->common->egw_exit(); - } - } - - /* Update if they request it, or one out of 20 page loads */ - srand((double) microtime() * 1000000); - if($_GET['update'] || rand(0, 19) == 4) - { - $this->vfs->update_real(array( - 'string' => $this->path, - 'relatives' => array(RELATIVE_NONE) - )); - } - - # Check available permissions for $this->path, so we can disable unusable operations in user interface - if($this->vfs->acl_check(array( - 'string' => $this->path, - 'relatives' => array(RELATIVE_NONE), - 'operation' => EGW_ACL_ADD - ))) - { - $this->can_add = True; - } - - # Default is to sort by name - if(!$this->sortby) - { - $this->sortby = 'name'; - } - - if($this->debug) - { - $this->debug_filemanager(); - } - - # main action switch - // FIXME this will become a switch - if($this->newfile_x && $this->newfile_or_dir) // create new textfile - { - $this->createfile(); - } - elseif($this->newfile_or_dir && $this->newdir_x) - { - $this->createdir(); - } - elseif($this->uploadprocess) - { - $this->fileUpload(); - } - elseif($this->upload_x || $this->show_upload_boxes) - { - $this->showUploadboxes(); - } - elseif($this->copy_to_x) - { - $this->copyTo(); - } - elseif($this->move_to_x) - { - $this->moveTo(); - } - elseif($this->download_x) - { - $this->download(); - } - elseif($this->renamefiles) - { - $this->rename(); - } - elseif($this->comment_files) - { - $this->editComment(); - } - elseif($this->edit_cancel_x) - { - $this->readFilesInfo(); - $this->fileListing(); - } - elseif($this->edit_x || $this->edit_preview_x || $this->edit_save_x || $this->edit_save_done_x) - { - $this->edit(); - } - elseif($this->delete_x) - { - $this->delete(); - } - else - { - $this->readFilesInfo(); - $this->fileListing(); - } - } - - function fileListing() - { - $this->t->set_file(array('filemanager_list_t' => 'filelisting.tpl')); - $this->t->set_block('filemanager_list_t','filemanager_header','filemanager_header'); - $this->t->set_block('filemanager_list_t','column','column'); - $this->t->set_block('filemanager_list_t','row','row'); - $this->t->set_block('filemanager_list_t','filemanager_footer','filemanager_footer'); - - $vars['form_action']=$this->encode_href('/index.php', 'menuaction=filemanager.uifilemanager.index','path='.$this->path); - if($this->numoffiles || $this->cwd) - { - while(list($num, $name) = each($this->prefs)) - { - if($name) - { - $columns++; - } - } - $columns++; - - $vars['toolbar0'] = $this->toolbar('location'); - $vars['toolbar1'] = $this->toolbar('list_nav'); - - if(count($this->messages)>0) - { - foreach($this->messages as $msg) - { - $messages.='

'.$msg.'

'; - } - } - - $vars['messages'] = $messages; - - $this->t->set_var($vars); - $this->t->pparse('out','filemanager_header'); - - ### - # Start File Table Column Headers - # Reads values from $file_attributes array and preferences - ### - $this->t->set_var('actions',lang('select')); - - reset($this->file_attributes); - - if($this->numoffiles>0) - { - while(list($internal, $displayed) = each($this->file_attributes)) - { - if($this->prefs[$internal]) - { - $col_data=''.$displayed.''; - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - } - - $this->t->set_var('row_tr_color','#dedede'); - - //kan dit weg? - $this->t->parse('rows','row'); - - $this->t->pparse('out','row'); - } - else - { - $lang_nofiles=lang('No files in this directory.'); - } - $vars['lang_no_files'] = $lang_nofiles; - - if($this->prefs['dotdot'] && $this->prefs['name'] && $this->path != '/') - { - $this->t->set_var('actions',''); - - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->lesspath); - - $col_data=''.lang('Folder Up').''; - $col_data.=' ..'; - - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column'); - - if($this->prefs['mime_type']) - { - $col_data=lang('Directory'); - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - $this->t->set_var('row_tr_color',$tr_color); - $this->t->parse('rows','row'); - $this->t->pparse('out','row'); - } - - # List all of the files, with their attributes - @reset($this->files_array); - for($i = 0; $i != $this->numoffiles; $i++) - { - $files = $this->files_array[$i]; - - if($this->rename_x || $this->edit_comments_x) - { - unset($this_selected); - unset($renamethis); - unset($edit_this_comment); - - for($j = 0; $j != $this->numoffiles; $j++) - { - if($this->fileman[$j] == $files['name']) - { - $this_selected = 1; - break; - } - } - - if($this->rename_x && $this_selected) - { - $renamethis = 1; - } - elseif($this->edit_comments_x && $this_selected) - { - $edit_this_comment = 1; - } - } - - if(!$this->prefs['dotfiles'] && ereg("^\.", $files['name'])) - { - continue; - } - - # Checkboxes - //if(!$this->rename_x && !$this->edit_comments_x && $this->path != $this->fakebase && $this->path != '/') - if(!$this->rename_x && !$this->edit_comments_x && $this->path != '/') - { - $cbox=''; - $this->t->set_var('actions',$cbox); - } - elseif($renamethis) - { - $cbox=$this->html_form_input('hidden', 'fileman[' . base64_encode($files['name']) . ']', $files['name'], NULL, NULL, 'checked'); - $this->t->set_var('actions',$cbox); - } - else - { - $this->t->set_var('actions',''); - } - - # File name and icon - if($renamethis) - { - $col_data=$this->mime_icon($files['mime_type']); - $col_data.=''; - } - else - { - if($files['mime_type'] == 'Directory') - { - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path.$this->dispsep.$files['name']); - - $icon=$this->mime_icon($files['mime_type']); - - $col_data=''.$icon.' '; - $col_data.=''.$files['name'].' '; - } - else - { - - if($this->prefs['viewonserver'] && isset($this->filesdir) && !$files['link_directory']) - { - #FIXME - $clickview = $this->filesdir.$pwd.'/'.$files['name']; - - if($phpwh_debug) - { - echo 'Setting clickview = '.$clickview.'
'."\n"; - $this->html_link($clickview,'', '',$files['name'], 0, 1, 0, ''); - } - } - else - { - $icon=$this->mime_icon($files['mime_type']); - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.view','file='.$files['name'].'&path='.$this->path); - - $col_data=''.$icon.' '.$files['name'].''; - } - } - } - - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column'); - - # MIME type - if($this->prefs['mime_type']) - { - $col_data=$files['mime_type']; - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # File size - if($this->prefs['size']) - { - // KL to fetch the size of the object here is just WRONG, since the array may be already sorted by size - //$tmp_arr=array( - // 'string' => $files['directory'] . '/' . $files['name'], - // 'relatives' => array(RELATIVE_NONE) - //; - //if($files['mime_type'] != 'Directory') $tmp_arr['checksubdirs'] = false; - //$size = $this->vfs->get_size($tmp_arr); - $size = $files['size']; - - $col_data=$this->borkb($size); - - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Date created - if($this->prefs['created']) - { - $col_data=date($this->dateformat,strtotime($files['created'])); - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Date modified - if($this->prefs['modified']) - { - if($files['modified'] != '0000-00-00') - { - $col_data=date($this->dateformat,strtotime($files['modified'])); - } - else - { - $col_data=''; - } - - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Owner name - if($this->prefs['owner']) - { - // KL to fetch the name of the object here is just WRONG, since the array may be already sorted by id - //$this->t->set_var('col_data',$GLOBALS['egw']->accounts->id2name($files['owner_id'])); - $this->t->set_var('col_data',$files['owner_name']); - $this->t->parse('columns','column',True); - } - - # Creator name - if($this->prefs['createdby_id']) - { - $this->html_table_col_begin(); - if($files['createdby_id']) - { - // KL to fetch the name of the object here is just WRONG, since the array may be already sorted by id - //$col_data=$GLOBALS['egw']->accounts->id2name($files['createdby_id']); - $col_data=$files['createdby_name']; - } - else $col_data=''; - - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Modified by name - if($this->prefs['modifiedby_id']) - { - if($files['modifiedby_id']) - { - // KL to fetch the name of the object here is just WRONG, since the array may be already sorted by id - //$col_data=$GLOBALS['egw']->accounts->id2name($files['modifiedby_id']); - $col_data=$files['modifiedby_name']; - } - else $col_data=''; - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Application - if($this->prefs['app']) - { - $col_data=$files['app']; - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Comment - if($this->prefs['comment']) - { - if($edit_this_comment) - { - $col_data=''; - } - else - { - $col_data=$files['comment']; - } - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - # Version - if($this->prefs['version']) - { - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.history','file='.$files['name'].'&path='.$this->path); - $col_data=''.$files['version'].''; - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column',True); - } - - if($files['mime_type'] == 'Directory') - { - $usedspace += $fileinfo[0]; - } - else - { - $usedspace += $files['size']; - } - - $this->t->set_var('row_tr_color',''); - $this->t->parse('rows','row'); - $this->t->pparse('out','row'); - } - - // when renaming or changing comments render extra sumbmit button - if($this->rename_x || $this->edit_comments_x) - { - $col_data='
'; - $this->t->set_var('col_data',$col_data); - $this->t->parse('columns','column'); - $this->t->set_var('row_tr_color',''); - $this->t->parse('rows','row'); - $this->t->pparse('out','row'); - } - } - - // The file and directory information - $vars['lang_files_in_this_dir'] = lang('Files in this directory'); - $vars['files_in_this_dir'] = $this->numoffiles; - - $vars['lang_used_space'] = lang('Used space'); - $vars['used_space'] = $this->borkb($usedspace, NULL, 1); - - if($this->path == $this->homedir || $this->path == $this->fakebase) - { - $vars['lang_unused_space'] = lang('Unused space'); - $vars['unused_space'] = $this->borkb($this->userinfo['hdspace'] - $usedspace, NULL, 1); - - $tmp_arr=array( - 'string' => $this->path, - 'relatives' => array(RELATIVE_NONE) - ); - - $ls_array = $this->vfs->ls($tmp_arr); - - $vars['lang_total_files'] = lang('Total Files'); - $vars['total_files'] = count($ls_array); - } - - $this->t->set_var($vars); - $this->t->pparse('out','filemanager_footer'); - - $GLOBALS['egw']->common->egw_footer(); - $GLOBALS['egw']->common->egw_exit(); - } - - function readFilesInfo() - { - // start files info - - # Read in file info from database to use in the rest of the script - # $fakebase is a special directory. In that directory, we list the user's - # home directory and the directories for the groups they're in - $this->numoffiles = 0; - if($this->path == $this->fakebase) - { - // FIXME this test can be removed - if(!$this->vfs->file_exists(array('string' => $this->homedir, 'relatives' => array(RELATIVE_NONE)))) - { - $this->vfs->mkdir(array('string' => $this->homedir, 'relatives' => array(RELATIVE_NONE))); - } - reset($this->readable_groups); - // create the directorys of the readableGroups if they do not exist - while(list($num, $group_array) = each($this->readable_groups)) - { - # If the group doesn't have access to this app, we don't show it, and do not appkly any action here - if(!$this->groups_applications[$group_array['account_name']][$this->appname]['enabled']) - { - continue; - } - - if(!$this->vfs->file_exists(array('string' => $this->fakebase.'/'.$group_array['account_name'],'relatives' => array(RELATIVE_NONE)))) - { - $this->vfs->override_acl = 1; - $this->vfs->mkdir(array( - 'string' => $this->fakebase.'/'.$group_array['account_name'], - 'relatives' => array(RELATIVE_NONE) - )); - // FIXME we just created a fresh group dir so we know there nothing in it so we have to remove all existing content - $this->vfs->override_acl = 0; - $this->vfs->set_attributes(array('string' => $this->fakebase.'/'.$group_array['account_name'],'relatives' => array(RELATIVE_NONE),'attributes' => array('owner_id' => $group_array['account_id'],'createdby_id' => $group_array['account_id']))); - } - } - } - - // read the list of the existing directorys/files - $ls_array = $this->vfs->ls(array( - 'string' => $this->path, - 'relatives' => array(RELATIVE_NONE), - 'checksubdirs' => false, - 'nofiles' => false, - 'orderby' => $this->sortby - )); - $heimatverz=explode('/',$this->homedir); - // process the list: check if we are allowed to read it, get the real size, and count the files/dirs - while(list($num, $file_array) = each($ls_array)) - { - if($this->path == $this->fakebase) - { - if ($file_array['name'] && (array_key_exists($file_array['name'],$this->readable_groups) || $this->fakebase.'/'.$file_array['name'] == $this->homedir || $file_array['name'] == $heimatverz[2])) - { - if(!$this->groups_applications[$file_array['name']][$this->appname]['enabled'] && $this->fakebase.'/'.$file_array['name'] != $this->homedir && $file_array['name'] != $heimatverz[2]) - { - continue; - } - } - if ($file_array['name'] && !array_key_exists($file_array['name'],$this->readable_groups) && !($this->fakebase.'/'.$file_array['name'] == $this->homedir || $file_array['name'] == $heimatverz[2])) - { - continue; - } - } - // get additional info, which was not retrieved meeting our needs -> size, ids - if($this->prefs['size']) - { - //KL get the real size of the object - $tmp_arr=array( - 'string' => $file_array['directory'] . '/' . $file_array['name'], - 'relatives' => array(RELATIVE_NONE) - ); - if($file_array['mime_type'] != 'Directory') $tmp_arr['checksubdirs'] = false; - $file_array['size']=$this->vfs->get_size($tmp_arr); - // KL got the real size - } - if($this->prefs['owner']) - { - $file_array['owner_name']=$GLOBALS['egw']->accounts->id2name($file_array['owner_id']); - } - - # Creator name - if($this->prefs['createdby_id']) - { - if($file_array['createdby_id']) - { - //$col_data=$GLOBALS['egw']->accounts->id2name($files['createdby_lid']); - $file_array['createdby_name']=$GLOBALS['egw']->accounts->id2name($file_array['createdby_id']); - } - else - { - $file_array['createdby_name']=''; - } - } - - # Modified by name - if($this->prefs['modifiedby_id']) - { - if($file_array['modifiedby_id']) - { - $file_array['modifiedby_name']=$GLOBALS['egw']->accounts->id2name($file_array['modifiedby_id']); - } - else - { - $file_array['modifiedby_name']=''; - } - } - // got additional info - $this->numoffiles++; - $this->files_array[] = $file_array; - if($phpwh_debug) - { - echo 'Filename: '.$file_array['name'].'
'."\n"; - } - } - - - if( !is_array($this->files_array) ) - { - $this->files_array = array(); - } - else - { - // KL sorting by multisort, if sort-param is set. - if ($this->sortby) - { - $mysorting=$this->sortby; - if ($mysorting=='owner') - { - $mysorting='owner_name'; - } - elseif ($mysorting=='createdby_id') - { - $mysorting='createdby_name'; - } - elseif($mysorting=='modifiedby_id') - { - $mysorting='modifiedby_name'; - } - foreach ($this->files_array as $key => $row) { - $file[$key] = $row[$mysorting]; - } - - // cast and sort file as container of the sort-key-column ascending to sort - // $files_array (as last Param), by the common key - array_multisort(array_map('strtolower',$file), SORT_ASC, $this->files_array); - } - // KL sorting done - } - } - - function toolbar($type) - { - //echo "

call toolbar

"; - switch($type) - { - case 'location': - $toolbar=' -
- - - '; - $toolbar.=''; - $toolbar.=' - '; - - // go up icon when we're not at the top, dont allow to go outside /home = fakebase - if($this->path != '/' && $this->path != $this->fakebase) - { - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->lesspath); - $toolbar.=$this->buttonImage($link,'up',lang('go up')); - } - - // go home icon when we're not home already - if($this->path != $this->homedir) - { - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->homedir); - $toolbar.=$this->buttonImage($link,'home',lang('go home')); - } - - // reload button with this url - $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index&update=1','path='.$this->path); - $toolbar.=$this->buttonImage($link,'reload',lang('reload')); - - $toolbar.=' - '; - $toolbar.=$this->inputImage('goto','goto',lang('Quick jump to')); - // upload button - if($this->path != '/' && $this->path != $this->fakebase && $this->can_add) - { - - $toolbar.=''; - $toolbar.=''; - $toolbar.=''; - - // $toolbar.=$this->inputImage('download','download',lang('Download')); - // upload button - $toolbar.=$this->inputImage('upload','upload',lang('Upload')); - } - $toolbar.='
spacerspacer'.lang('Location').': '; - //$toolbar.=' '; - $current_option=''; - // selectbox for change/move/and copy to - - $this->dirs_options=$this->all_other_directories_options(); - $toolbar.=' - spacerspacerspacer
'; - $toolbar.='
'; - break; - case 'list_nav': - $toolbar=' - - '; - // selectbox for change/move/and copy to - // submit buttons for - if($this->path != '/' && $this->path != $this->fakebase) - { - $toolbar.=''; - $toolbar.=' - '; - - if(!$this->rename_x && !$this->edit_comments_x) - { - // edit text file button - $toolbar.=$this->inputImage('edit','edit',lang('edit')); - } - - if(!$this->edit_comments_x) - { - $toolbar.=$this->inputImage('rename','rename',lang('Rename')); - } - - if(!$this->rename_x && !$this->edit_comments_x) - { - $toolbar.=$this->inputImage('delete','delete',lang('Delete')); - } - - if(!$this->rename_x) - { - $toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments')); - } - $toolbar.=''; - } - else - { - if ($this->path = $this->fakebase) - { - $toolbar.=''; - $toolbar.=' - '; - if(!$this->rename_x) - { - $toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments')); - } - } - } - - // $toolbar.='
spacerspacerspacerspacerspacer
'; - if(!$this->rename_x && !$this->edit_comments_x) - { - // copy and move buttons - if($this->path != '/' && $this->path != $this->fakebase) - { - $toolbar3.='spacer'; - $toolbar3.='spacer'; - - if (!$this->dirs_options) $this->dirs_options=$this->all_other_directories_options(); - $toolbar3.=''; - - $toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to')); - $toolbar3.=$this->inputImage('move_to','move_to',lang('Move to')); - - $toolbar3.='spacer'; - - } - - // create dir and file button - if($this->path != '/' && $this->path != $this->fakebase && $this->can_add) - { - $toolbar3.='spacer'; - $toolbar3.='spacer'; - - $toolbar3.=''; - $toolbar3.=$this->inputImage('newdir','createdir',lang('Create Folder')); - $toolbar3.=$this->inputImage('newfile','createfile',lang('Create File')); - } - - if($toolbar3) - { - $toolbar.=$toolbar3; - /* $toolbar.=' - - '.$toolbar3;*/ - } - } - $toolbar.='
'; - - break; - default:$x=''; - } - if($toolbar) - { - return $toolbar; - } - } - - // move to bo - # Handle File Uploads - function fileUpload() - { - - if($this->path != '/' && $this->path != $this->fakebase) - { - for($i = 0; $i != $this->show_upload_boxes; $i++) - { - if($badchar = $this->bad_chars($_FILES['upload_file']['name'][$i], True, True)) - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array($this->html_encode(lang('File names cannot contain "%1"', $badchar), 1))); - - continue; - } - if ($_FILES['upload_file']['tmp_name'][$i]=='') - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array($this->html_encode(lang('File %1 may be too big. Contact your Systemadministrator for further info', $_FILES['upload_file']['name']), 1))); - continue; - } - # Check to see if the file exists in the database, and get its info at the same time - $ls_array = $this->vfs->ls(array( - 'string'=> $this->path . '/' . $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_NONE), - 'checksubdirs' => False, - 'nofiles' => True - )); - - $fileinfo = $ls_array[0]; - - if($fileinfo['name']) - { - if($fileinfo['mime_type'] == 'Directory') - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array(lang('Cannot replace %1 because it is a directory', $fileinfo['name']))); - continue; - } - } - - if($_FILES['upload_file']['size'][$i] > 0) - { - if($fileinfo['name'] && $fileinfo['deleteable'] != 'N') - { - $tmp_arr=array( - 'string'=> $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_ALL), - 'attributes' => array( - 'owner_id' => $this->userinfo['username'], - 'modifiedby_id' => $this->userinfo['username'], - 'modified' => $this->now, - 'size' => $_FILES['upload_file']['size'][$i], - 'mime_type' => $_FILES['upload_file']['type'][$i], - 'deleteable' => 'Y', - 'comment' => stripslashes($_POST['upload_comment'][$i]) - ) - ); - $this->vfs->set_attributes($tmp_arr); - - $tmp_arr=array( - 'from' => $_FILES['upload_file']['tmp_name'][$i], - 'to' => $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) - ); - $this->vfs->cp($tmp_arr); - - $this->messages[]=lang('Replaced %1', $this->disppath.'/'.$_FILES['upload_file']['name'][$i]); - } - else - { - $this->vfs->cp(array( - 'from'=> $_FILES['upload_file']['tmp_name'][$i], - 'to'=> $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) - )); - - $this->vfs->set_attributes(array( - 'string'=> $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_ALL), - 'attributes'=> array( - 'mime_type' => $_FILES['upload_file']['type'][$i], - 'comment' => stripslashes($_POST['upload_comment'][$i]) - ) - )); - - $this->messages[]=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $_FILES['upload_file']['size'][$i]); - } - } - elseif($_FILES['upload_file']['name'][$i]) - { - $this->vfs->touch(array( - 'string'=> $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_ALL) - )); - - $this->vfs->set_attributes(array( - 'string'=> $_FILES['upload_file']['name'][$i], - 'relatives' => array(RELATIVE_ALL), - 'attributes'=> array( - 'mime_type' => $_FILES['upload_file']['type'][$i], - 'comment' => stripslashes($_POST['upload_comment'][$i]) - ) - )); - - $this->messages[]=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $file_size[$i]); - } - } - - $this->readFilesInfo(); - $this->filelisting(); - } - } - - # Handle Editing comments - function editComment() - { - while(list($file) = each($this->comment_files)) - { - if($badchar = $this->bad_chars($this->comment_files[$file], False, True)) - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array($file . $this->html_encode(': ' . lang('Comments cannot contain "%1"', $badchar), 1))); - continue; - } - - $this->vfs->set_attributes(array( - 'string' => $file, - 'relatives' => array(RELATIVE_ALL), - 'attributes' => array( - 'comment' => stripslashes($this->comment_files[$file]) - ) - )); - - $this->messages[]=lang('Updated comment for %1', $this->path.'/'.$file); - } - - $this->readFilesInfo(); - $this->filelisting(); - } - - # Handle Renaming Files and Directories - function rename() - { - while(list($from, $to) = each($this->renamefiles)) - { - if($badchar = $this->bad_chars($to, True, True)) - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array($this->html_encode(lang('File names cannot contain "%1"', $badchar), 1))); - continue; - } - - if(ereg("/", $to) || ereg("\\\\", $to)) - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array(lang("File names cannot contain \\ or /"))); - } - elseif(!$this->vfs->mv(array( - 'from' => $from, - 'to' => $to - ))) - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array(lang('Could not rename %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to))); - } - else - { - $this->messages[]=lang('Renamed %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to); - } - } - $this->readFilesInfo(); - $this->filelisting(); - } - - # Handle Moving Files and Directories - function moveTo() - { - if(!$this->todir) - { - $this->messages[] = $GLOBALS['egw']->common->error_list(array(lang('Could not move file because no destination directory is given ', $this->disppath.'/'.$file))); - - } - else - { - - while(list($num, $file) = each($this->fileman)) - { - if($this->vfs->mv(array( - 'from' => $file, - 'to' => $this->todir . '/' . $file, - 'relatives' => array(RELATIVE_ALL, RELATIVE_NONE) - ))) - { - $moved++; - $this->messages[]=lang('Moved %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); - } - else - { - $this->messages[] = $GLOBALS['egw']->common->error_list(array(lang('Could not move %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file))); - } - } - } - - if($moved) - { - $x=0; - } - - $this->readFilesInfo(); - $this->filelisting(); - } - - // Handle Copying of Files and Directories - function copyTo() - { - if(!$this->todir) - { - $this->messages[] = $GLOBALS['egw']->common->error_list(array(lang('Could not copy file because no destination directory is given ', $this->disppath.'/'.$file))); - - } - else - { - while(list($num, $file) = each($this->fileman)) - { - - if($this->vfs->cp(array( - 'from' => $file, - 'to' => $this->todir . '/' . $file, - 'relatives' => array(RELATIVE_ALL, RELATIVE_NONE) - ))) - { - $copied++; - $this->message .= lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); - } - else - { - $this->message .= $GLOBALS['egw']->common->error_list(array(lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file))); - } - } - } - if($copied) - { - $x=0; - } - - $this->readFilesInfo(); - $this->filelisting(); - } - - function createdir() - { - if($this->newdir_x && $this->newfile_or_dir) - { - if($this->badchar = $this->bad_chars($this->newfile_or_dir, True, True)) - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array($this->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1))); - } - - /* TODO is this right or should it be a single $ ? */ - if($this->newfile_or_dir[strlen($this->newfile_or_dir)-1] == ' ' || $this->newfile_or_dir[0] == ' ') - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array(lang('Cannot create directory because it begins or ends in a space'))); - } - - $ls_array = $this->vfs->ls(array( - 'string' => $this->path . '/' . $this->newfile_or_dir, - 'relatives' => array(RELATIVE_NONE), - 'checksubdirs' => False, - 'nofiles' => True - )); - - $fileinfo = $ls_array[0]; - - if($fileinfo['name']) - { - if($fileinfo['mime_type'] != 'Directory') - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array( - lang('%1 already exists as a file', - $fileinfo['name']) - )); - } - else - { - $this->messages[]= $GLOBALS['egw']->common->error_list(array(lang('Directory %1 already exists', $fileinfo['name']))); - } - } - else - { - if($this->vfs->mkdir(array('string' => $this->newfile_or_dir))) - { - $this->messages[]=lang('Created directory %1', $this->disppath.'/'.$this->newfile_or_dir); - } - else - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array(lang('Could not create %1', $this->disppath.'/'.$this->newfile_or_dir))); - } - } - - $this->readFilesInfo(); - $this->filelisting(); - } - } - - function delete() - { - if( is_array($this->fileman) && count($this->fileman) >= 1) - { - foreach($this->fileman as $filename) - { - if($this->vfs->delete(array('string' => $filename))) - { - $this->messages[]= lang('Deleted %1', $this->disppath.'/'.$filename).'
'; - } - else - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array(lang('Could not delete %1', $this->disppath.'/'.$filename))); - } - } - } - else - { - // make this a javascript func for quicker respons - $this->messages[]=$GLOBALS['egw']->common->error_list(array(lang('Please select a file to delete.'))); - } - $this->readFilesInfo(); - $this->filelisting(); - } - - function debug_filemanager() - { - error_reporting(8); - - echo "Filemanager debug:
- path: {$this->path}
- disppath: {$this->disppath}
- cwd: {$this->cwd}
- lesspath: {$this->lesspath} -

- eGroupware debug:
- real getabsolutepath: " . $this->vfs->getabsolutepath(array('target' => False, 'mask' => False, 'fake' => False)) . "
- fake getabsolutepath: " . $this->vfs->getabsolutepath(array('target' => False)) . "
- appsession: " . $GLOBALS['egw']->session->appsession('vfs','') . "
- pwd: " . $this->vfs->pwd() . "
"; - - echo '

'; - var_dump($this); - } - - function showUploadboxes() - { - $this->t->set_file(array('upload' => 'upload.tpl')); - $this->t->set_block('upload','upload_header','upload_header'); - $this->t->set_block('upload','row','row'); - $this->t->set_block('upload','upload_footer','upload_footer'); - - # Decide how many upload boxes to show - if(!$this->show_upload_boxes || $this->show_upload_boxes <= 0) - { - if(!$this->show_upload_boxes = $this->prefs['show_upload_boxes']) - { - $this->show_upload_boxes = 1; - } - } - - # Show file upload boxes. Note the last argument to html(). Repeats $this->show_upload_boxes times - if($this->path != '/' && $this->path != $this->fakebase && $this->can_add) - { - $vars['form_action']=$GLOBALS['egw']->link('/index.php','menuaction=filemanager.uifilemanager.index'); - $vars['path']=$this->path; - $vars['lang_file']=lang('File'); - $vars['lang_comment']=lang('Comment'); - $vars['num_upload_boxes']=$this->show_upload_boxes; - $this->t->set_var($vars); - $this->t->pparse('out','upload_header'); - - for($i=0;$i<$this->show_upload_boxes;$i++) - { - $this->t->set_var('row_tr_color',$tr_color); - $this->t->parse('rows','row'); - $this->t->pparse('out','row'); - } - - $vars['lang_upload']=lang('Upload files'); - $vars['change_upload_boxes'].=lang('Show') . ' '; - $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=5', '5'); - $links.=' '; - $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=10', '10'); - $links.=' '; - $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=20', '20'); - $links.=' '; - $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=50', '50'); - $links.=' '; - $links.= lang('upload fields'); - $vars['change_upload_boxes'].=$links; - $this->t->set_var($vars); - $this->t->pparse('out','upload_footer'); - } - } - - /* create textfile */ - function createfile() - { - $this->createfile_var=$this->newfile_or_dir; - if($this->createfile_var) - { - if($badchar = $this->bad_chars($this->createfile_var, True, True)) - { - $this->messages[] = $GLOBALS['egw']->common->error_list(array( - lang('File names cannot contain "%1"',$badchar), - 1) - ); - - $this->fileListing(); - } - - if($this->vfs->file_exists(array( - 'string'=> $this->createfile_var, - 'relatives' => array(RELATIVE_ALL) - ))) - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array(lang('File %1 already exists. Please edit it or delete it first.', $this->createfile_var))); - $this->fileListing(); - } - - if($this->vfs->touch(array( - 'string' => $this->createfile_var, - 'relatives' => array(RELATIVE_ALL) - ))) - { - $this->fileman = array(); - $this->fileman[0] = $this->createfile_var; - $this->edit = 1; - $this->numoffiles++; - $this->edit(); - } - else - { - $this->messages[]=$GLOBALS['egw']->common->error_list(array(lang('File %1 could not be created.', $this->createfile_var))); - $this->fileListing(); - } - } - } - - # Handle Editing files - function edit() - { - $this->readFilesInfo(); - - $this->t->set_file(array('filemanager_edit' => 'edit_file.tpl')); - $this->t->set_block('filemanager_edit','row','row'); - - $vars['preview_content'] = ''; - if($this->edit_file) - { - $this->edit_file_content = stripslashes($this->edit_file_content); - } - - if($this->edit_preview_x) - { - $content = $this->edit_file_content; - - $vars['lang_preview_of'] = lang('Preview of %1', $this->path.'/'.$edit_file); - - $vars['preview_content'] = nl2br($content); - } - elseif($this->edit_save_x || $this->edit_save_done_x) - { - $content = $this->edit_file_content; - //die( $content); - if($this->vfs->write(array( - 'string' => $this->edit_file, - 'relatives' => array(RELATIVE_ALL), - 'content' => $content - ))) - { - $this->messages[]=lang('Saved %1', $this->path.'/'.$this->edit_file); - - if($this->edit_save_done_x) - { - $this->readFilesInfo(); - $this->fileListing(); - exit; - } - } - else - { - $this->messages[]=lang('Could not save %1', $this->path.'/'.$this->edit_file); - } - } - - # Now we display the edit boxes and forms - for($j = 0; $j != $this->numoffiles; $j++) - { - # If we're in preview or save mode, we only show the file - # being previewed or saved - if($this->edit_file &&($this->fileman[$j] != $this->edit_file)) - { - continue; - } - - if($this->fileman[$j] && $this->vfs->file_exists(array( - 'string' => $this->fileman[$j], - 'relatives' => array(RELATIVE_ALL) - ))) - { - if($this->edit_file) - { - $content = stripslashes($this->edit_file_content); - } - else - { - $content = $this->vfs->read(array('string' => $this->fileman[$j])); - } - - $vars['form_action'] = $GLOBALS['egw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path); - $vars['edit_file'] = $this->fileman[$j]; - - # We need to include all of the fileman entries for each file's form, - # so we loop through again - for($i = 0; $i != $this->numoffiles; $i++) - { - if($this->fileman[$i]) - { - $value='value="'.$this->fileman[$i].'"'; - } - $vars['filemans_hidden'] = ''; - } - - $vars['file_content'] = $content; - - $vars['buttonPreview'] = $this->inputImage('edit_preview','edit_preview',lang('Preview %1', $this->html_encode($this->fileman[$j], 1))); - $vars['buttonSave'] = $this->inputImage('edit_save','save',lang('Save %1', $this->html_encode($this->fileman[$j], 1))); - $vars['buttonDone'] = $this->inputImage('edit_save_done','ok',lang('Save %1, and go back to file listing ', $this->html_encode($this->fileman[$j], 1))); - $vars['buttonCancel'] = $this->inputImage('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->html_encode($this->fileman[$j], 1))); - $this->t->set_var($vars); - $this->t->parse('rows','row'); - $this->t->pparse('out','row'); - - } - } - } - - function history() - { - if($this->file) // FIXME this-file is never defined - { - $journal_array = $this->vfs->get_journal(array( - 'string' => $this->file,//FIXME - 'relatives' => array(RELATIVE_ALL) - )); - - if(is_array($journal_array)) - { - $this->html_table_begin(); - $this->html_table_row_begin(); - $this->html_table_col_begin(); - echo lang('Date'); - $this->html_table_col_end(); - $this->html_table_col_begin(); - echo lang('Version'); - $this->html_table_col_end(); - $this->html_table_col_begin(); - echo lang('Who'); - $this->html_table_col_end(); - $this->html_table_col_begin(); - echo lang('Operation'); - $this->html_table_col_end(); - $this->html_table_row_end(); - - while(list($num, $journal_entry) = each($journal_array)) - { - $this->html_table_row_begin(); - $this->html_table_col_begin(); - $this->html_text($journal_entry['created'] . '   '); - $this->html_table_col_end(); - $this->html_table_col_begin(); - $this->html_text($journal_entry['version'] . '   ' ); - $this->html_table_col_end(); - $this->html_table_col_begin(); - $this->html_text($GLOBALS['egw']->accounts->id2name($journal_entry['owner_id']) . '   '); - $this->html_table_col_end(); - $this->html_table_col_begin(); - $this->html_text($journal_entry['comment']); - $this->html_table_col_end(); - } - - $this->html_table_end(); - $GLOBALS['egw']->common->egw_footer(); - $GLOBALS['egw']->common->egw_exit(); - } - else - { - echo lang('No version history for this file/directory'); - } - } - } - - function view() - { - if($this->file) //FIXME - { - $mime_type='unknown'; - $ls_array = $this->vfs->ls(array( - 'string' => $this->path.'/'.$this->file,//FIXME - 'relatives' => array(RELATIVE_ROOT), - 'checksubdirs' => False, - 'nofiles' => True - )); - if($ls_array[0]['mime_type'] && $ls_array[0]['mime_type'] != 'application/octet-stream') - { - $mime_type = $ls_array[0]['mime_type']; - } - else - { - $parts = explode('.',$this->file); - $_ext = array_pop($parts); - $mime_type = ExecMethod('phpgwapi.mime_magic.ext2mime',$_ext); - } - // check if the prefs are set for viewing unknown extensions as text/plain and - // check if the mime_type is unknown, empty or not found (application/octet) - // or check if the mimetype contains text, - // THEN set the mime_type text/plain - if(($this->prefs['viewtextplain'] && ($mime_type=='' || $mime_type=='unknown' || $mime_type=='application/octet-stream')) || - strpos($mime_type, 'text/') !== false) - { - $mime_type = 'text/plain'; - } - - // we want to define pdfs and text files as viewable - $viewable = array('','text/plain','text/csv','text/html','text/text','application/pdf'); - // we want to view pdfs and text files within the browser - if(in_array($mime_type,$viewable) && !$_GET['download']) - { - // if you add attachment; to the Content-disposition between disposition and filename - // you get a download dialog even for viewable files - header('Content-type: ' . $mime_type); - header('Content-disposition: filename="' . $this->file . '"');//FIXME - Header("Pragma: public"); - } - else - { - - $GLOBALS['egw']->browser->content_header($this->file,$mime_type);//FIXME - } - echo $this->vfs->read(array( - 'string' => $this->path.'/'.$this->file,//FIXME - 'relatives' => array(RELATIVE_NONE) - )); - $GLOBALS['egw']->common->egw_exit(); - } - } - - function download() - { - for($i = 0; $i != $this->numoffiles; $i++) - { - if(!$this->fileman[$i]) - { - continue; - } - - $download_browser =& CreateObject('phpgwapi.browser'); - $download_browser->content_header($this->fileman[$i]); - echo $this->vfs->read(array('string' => $this->fileman[$i])); - $GLOBALS['egw']->common->egw_exit(); - } - } - - //give back an array with all directories except current and dirs that are not accessable - function all_other_directories_options() - { - # First we get the directories in their home directory - $dirs = array(); - $dirs[] = array('directory' => $this->fakebase, 'name' => $this->userinfo['account_lid']); - - $tmp_arr=array( - 'string' => $this->homedir, - 'relatives' => array(RELATIVE_NONE), - 'checksubdirs' => True, - 'mime_type' => 'Directory' - ); - - $ls_array = $this->vfs->ls($tmp_arr); - - while(list($num, $dir) = each($ls_array)) - { - $dirs[] = $dir; - } - - - # Then we get the directories in their readable groups' home directories - reset($this->readable_groups); - while(list($num, $group_array) = each($this->readable_groups)) - { - # Don't list directories for groups that don't have access - if(!$this->groups_applications[$group_array['account_name']][$this->appname]['enabled']) - { - continue; - } - - $dirs[] = array('directory' => $this->fakebase, 'name' => $group_array['account_name']); - - $tmp_arr=array( - 'string' => $this->fakebase.'/'.$group_array['account_name'], - 'relatives' => array(RELATIVE_NONE), - 'checksubdirs' => True, - 'mime_type' => 'Directory' - ); - - $ls_array = $this->vfs->ls($tmp_arr); - while(list($num, $dir) = each($ls_array)) - { - $dirs[] = $dir; - } - } - - reset($dirs); - // key for the sorted array - $i=0; - while(list($num, $dir) = each($dirs)) - { - if(!$dir['directory']) - { - continue; - } - - # So we don't display // - if($dir['directory'] != '/') - { - $dir['directory'] .= '/'; - } - - # No point in displaying the current directory, or a directory that doesn't exist - if((($dir['directory'] . $dir['name']) != $this->path) && $this->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE)))) - { - //set the content of the sorted array - $i++; - $dirs_sorted[$i]=$dir['directory'] . $dir['name']; - } - } - // sort the directory optionlist - natcasesort($dirs_sorted); - //_debug_array($dirs_sorted); - // set the optionlist - foreach ($dirs_sorted as $key => $row) { - //FIXME replace the html_form_option function - //$options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']); - $options .= $this->html_form_option($row, $row); - } - // save some information with the session for retrieving it later - if ($dirs_sorted) $this->save_sessiondata($dirs_sorted,'dirs_options_array'); - return $options; - } - - /* seek icon for mimetype else return an unknown icon */ - function mime_icon($mime_type, $size=16,$et_image=false) - { - if(!$mime_type) - { - $mime_type='unknown'; - } - $mime_type= strtolower(str_replace ('/','_',$mime_type)); - list($mime_part) = explode('_',$mime_type); - - if (!($img=$GLOBALS['egw']->common->image('filemanager',$icon='mime'.$size.'_'.$mime_type)) && - !($img=$GLOBALS['egw']->common->image('filemanager',$icon='mime'.$size.'_'.$mime_part))) - { - $img = $GLOBALS['egw']->common->image('filemanager',$icon='mime'.$size.'_unknown'); - } - return $et_image ? 'filemanager/'.$icon : ''.lang($mime_type).''; - } - - function buttonImage($link,$img='',$help='') - { - $image=$GLOBALS['egw']->common->image('filemanager','button_'.strtolower($img)); - - if($img) - { - return ' - '.$help.' - '; - } - } - - function inputImage($name,$img='',$help='') - { - $image=$GLOBALS['egw']->common->image('filemanager','button_'.strtolower($img)); - - if($img) - { - return ' - - '; - } - } - - function html_form_input($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1) - { - $text = ' '; - if($type != NULL && $type) - { - if($type == 'checkbox') - { - $value = $this->string_encode($value, 1); - } - $text .= 'type="'.$type.'" '; - } - if($name != NULL && $name) - { - $text .= 'name="'.$name.'" '; - } - if($value != NULL && $value) - { - $text .= 'value="'.$value.'" '; - } - if(is_int($maxlength) && $maxlength >= 0) - { - $text .= 'maxlength="'.$maxlength.'" '; - } - if(is_int($size) && $size >= 0) - { - $text .= 'size="'.$size.'" '; - } - if($checked != NULL && $checked) - { - $text .= 'checked '; - } - - return ''; - } - - function html_form_option($value = NULL, $displayed = NULL, $selected = NULL, $return = 0) - { - $text = ' '; - if($value != NULL && $value) - { - $text .= ' value="'.$value.'" '; - } - if($selected != NULL && $selected) - { - $text .= ' selected'; - } - return ''.$displayed.''; - } - - function encode_href($href = NULL, $args = NULL , $extra_args) - { - $href = $this->string_encode($href, 1); - $all_args = $args.'&'.$this->string_encode($extra_args, 1); - - $address = $GLOBALS['egw']->link($href, $all_args); - - return $address; - } - - function html_link($href = NULL, $args = NULL , $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL) - { - // unset($encode); - if($encode) - { - $href = $this->string_encode($href, 1); - $all_args = $args.'&'.$this->string_encode($extra_args, 1); - } - else - { - // $href = $this->string_encode($href, 1); - $all_args = $args.'&'.$extra_args; - } - ### - # This decodes / back to normal - ### - // $all_args = preg_replace("/%2F/", "/", $all_args); - // $href = preg_replace("/%2F/", "/", $href); - - /* Auto-detect and don't disturb absolute links */ - if(!preg_match("|^http(.{0,1})://|", $href)) - { - //Only add an extra / if there isn't already one there - - // die(SEP); - if(!($href[0] == SEP)) - { - $href = SEP . $href; - } - - /* $GLOBALS['egw']->link requires that the extra vars be passed separately */ - // $link_parts = explode("?", $href); - $address = $GLOBALS['egw']->link($href, $all_args); - // $address = $GLOBALS['egw']->link($href); - } - else - { - $address = $href; - } - - /* If $linkonly is set, don't add any HTML */ - if($linkonly) - { - $rstring = $address; - } - else - { - if($target) - { - $target = 'target='.$target; - } - - $text = trim($text); - $rstring = ''.$text.''; - } - - return($this->eor($rstring, $return)); - } - - function html_table_begin($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0) - { - if($width != NULL && $width) - { - $width = "width=$width"; - } - if(is_int($border) && $border >= 0) - { - $border = "border=$border"; - } - if(is_int($cellspacing) && $cellspacing >= 0) - { - $cellspacing = "cellspacing=$cellspacing"; - } - if(is_int($cellpadding) && $cellpadding >= 0) - { - $cellpadding = "cellpadding=$cellpadding"; - } - if($rules != NULL && $rules) - { - $rules = "rules=$rules"; - } - - $rstring = ""; - return($this->eor($rstring, $return)); - } - - function html_table_end($return = 0) - { - $rstring = "
"; - return($this->eor($rstring, $return)); - } - - function html_table_row_begin($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0) - { - if($align != NULL && $align) - { - $align = "align=$align"; - } - if($halign != NULL && $halign) - { - $halign = "halign=$halign"; - } - if($valign != NULL && $valign) - { - $valign = "valign=$valign"; - } - if($bgcolor != NULL && $bgcolor) - { - $bgcolor = "bgcolor=$bgcolor"; - } - $rstring = ""; - return($this->eor($rstring, $return)); - } - - function html_table_row_end($return = 0) - { - $rstring = ""; - return($this->eor($rstring, $return)); - } - - function html_table_col_begin($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0) - { - if($align != NULL && $align) - { - $align = "align=$align"; - } - if($halign != NULL && $halign) - { - $halign = "halign=$halign"; - } - if($valign != NULL && $valign) - { - $valign = "valign=$valign"; - } - if(is_int($rowspan) && $rowspan >= 0) - { - $rowspan = "rowspan=$rowspan"; - } - if(is_int($colspan) && $colspan >= 0) - { - $colspan = "colspan=$colspan"; - } - - $rstring = ""; - return($this->eor($rstring, $return)); - } - - function html_table_col_end($return = 0) - { - $rstring = ""; - return($this->eor($rstring, $return)); - } - - function search_tpl($content=null) - { - //echo "

search_tpl

"; - //_debug_array($content); - $debug=0; - $content['message']=''; - if ($_GET['action']=='search') - { - $content['searchcreated']=1; - $content['datecreatedfrom']=date("U")-24*60*60; - $content['start_search']=lang('start search'); - } - - if ($content['start_search'] && strlen($content['start_search'])>0) - { - $searchactivated=1; - $read_onlys['searchstring']=true; - } - $content['nm']=$this->read_sessiondata('nm'); - $this->search_options=$content['nm']['search_options']; - $content['nm']['search']=$content['searchstring']; - $debug=$content['debug']; - - // initialisieren des nextmatch widgets, durch auslesen der sessiondaten - // wenn leer, bzw. kein array dann von hand initialisieren - $content['nm']=$this->read_sessiondata('nm'); - $content['message'].= "

content may be set

"; - if (!is_array($content['nm'])) - { - $content['message'].= "

content is not set

"; - $content['debug']=$debug; - $content['nm'] = array( // I = value set by the app, 0 = value on return / output - 'get_rows' => 'filemanager.uifilemanager.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' - 'filter_label' => '', // I label for filter (optional) - 'filter_help' => '', // I help-msg for filter (optional) - 'no_filter' => True, // I disable the 1. filter - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) - 'no_cat' => True, // I disable the cat-selectbox - //'template' => , // I template to use for the rows, if not set via options - //'header_left' => ,// I template to show left of the range-value, left-aligned (optional) - //'header_right' => ,// I template to show right of the range-value, right-aligned (optional) - //'bottom_too' => True, // I show the nextmatch-line (arrows, filters, search, ...) again after the rows - 'never_hide' => True, // I never hide the nextmatch-line if less then maxmatch entrie - 'lettersearch' => True,// I show a lettersearch - 'searchletter' => false,// I0 active letter of the lettersearch or false for [all] - 'start' => 0,// IO position in list - //'num_rows' => // IO number of rows to show, defaults to maxmatches from the general prefs - //'cat_id' => // IO category, if not 'no_cat' => True - //'search' => // IO search pattern - 'order' => 'vfs_created',// IO name of the column to sort after (optional for the sortheaders) - 'sort' => 'DESC',// IO direction of the sort: 'ASC' or 'DESC' - 'col_filter' => array(),// IO array of column-name value pairs (optional for the filterheaders) - //'filter' => // IO filter, if not 'no_filter' => True - //'filter_no_lang' => True// I set no_lang for filter (=dont translate the options) - //'filter_onchange'=> 'this.form.submit();'// I onChange action for filter, default: this.form.submit(); - //'filter2' => // IO filter2, if not 'no_filter2' => True - //'filter2_no_lang'=> True// I set no_lang for filter2 (=dont translate the options) - //'filter2_onchange'=> 'this.form.submit();'// I onChange action for filter, default: this.form.submit(); - //'rows' => // O content set by callback - //'total' => // O the total number of entries - //'sel_options' => // O additional or changed sel_options set by the callback and merged into $tmpl->sel_options - 'no_columnselection'=>false, - 'default_cols' => '!vfs_file_id,fulldir,mime_type', - ); - - } else { - // lesen wenn gesetzt - $content['message'].= "

content is set

"; - //_debug_print($content); - } - //echo "
"; - // loeschen wenn gesetzt - if (($content['clear_search']&&strlen($content['clear_search'])>0) or $_GET['actioncd']=='clear') - { - $content['debug']=0; - $content['nm']['search_options']=array(); - unset($content['nm']['search']); - $searchactivated=0; - $content['checkall']=0; - $content['checkonlyfiles']=0; - $content['checkonlydirs']=0; - $content['searchstring']=''; - $content['searchcreated']=0; - $content['datecreatedto']=''; - $content['datecreatedfrom']=''; - $content['searchmodified']=0; - $content['datemodifiedto']=''; - $content['datemodifiedfrom']=''; - $read_onlys=array(); - $this->search_options=array(); - } - - $sel_options = array( - 'vfs_mime_type' => array('directory'=>'directory', ''=>'') - ); - - $this->tmpl->read('filemanager.search'); - // the call of this function switches from enabled to disabled for various fields of the search dialog - //enable_disable_SearchFields($searchactivated); - //echo "

enable_disable_SearchFields

"; - //echo "

".$content['datecreatedfrom']."

"; - $switchflag=$searchactivated; - $this->tmpl->set_cell_attribute('checkall','disabled',$switchflag); - if ($content['checkall']) $this->tmpl->set_cell_attribute('alllabel','label',lang($this->tmpl->get_cell_attribute('alllabel','label')).'(x)'); - $this->tmpl->set_cell_attribute('checkonlyfiles','disabled',$switchflag); - if ($content['checkonlyfiles']) $this->tmpl->set_cell_attribute('filelabel','label',lang($this->tmpl->get_cell_attribute('filelabel','label')).'(x)'); - $this->tmpl->set_cell_attribute('checkonlydirs','disabled',$switchflag); - if ($content['checkonlydirs']) $this->tmpl->set_cell_attribute('dirlabel','label',lang($this->tmpl->get_cell_attribute('dirlabel','label')).'(x)'); - $this->tmpl->set_cell_attribute('searchstring','disabled',$switchflag); - //search created date - if ($content['searchcreated'] or $content['datecreatedfrom']!='' or $content['datecreatedto']!='') - { - $content['searchcreated']=1; - $this->tmpl->set_cell_attribute('createdlabel','label',lang($this->tmpl->get_cell_attribute('createdlabel','label')).'(x)'); - $read_onlys['datecreatedto']=$switchflag; - $read_onlys['datecreatedfrom']=$switchflag; - // the to-date is to be switched to the end of the day, so between a date and another one includes the to-date of the search - // the used database time function is a timestamp function, and a date converted turns out to be the beginning of the day - if ($content['datecreatedto']!='') - { - $content['datecreatedto']=$content['datecreatedto']+23*60*60+59; - } - if (($content['datecreatedfrom']=='' && $content['datecreatedto']) or ($content['datecreatedfrom'] && $content['datecreatedto']=='') ) $content['searchcreatedtext']=lang('Choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date'); - if (($content['datecreatedfrom']!='' && $content['datecreatedto']!='' && $content['datecreatedto']<$content['datecreatedfrom']) ) $content['searchcreatedtext']=lang('Choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates'); - } - else - { - $content['searchcreatedtext']=''; - } - $this->tmpl->set_cell_attribute('searchcreated','disabled',$switchflag); - //search modified date - if ($content['searchmodified'] or $content['datemodifiedfrom']!='' or $content['datemodifiedto']!='') - { - $content['searchmodified']=1; - $this->tmpl->set_cell_attribute('modifiedlabel','label',lang($this->tmpl->get_cell_attribute('modifiedlabel','label')).'(x)'); - $read_onlys['datemodifiedto']=$switchflag; - $read_onlys['datemodifiedfrom']=$switchflag; - // the to-date is to be switched to the end of the day, so between a date and another one includes the to-date of the search - // the used database time function is a timestamp function, and a date converted turns out to be the beginning of the day - if ($content['datemodifiedto']!='') - { - $content['datemodifiedto']=$content['datemodifiedto']+23*60*60+59; - } - if (($content['datemodifiedfrom']=='' && $content['datemodifiedto']) or ($content['datemodifiedfrom'] && $content['datemodifiedto']=='') ) $content['searchmodifiedtext']=lang('Choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date'); - if (($content['datemodifiedfrom']!='' && $content['datemodifiedto']!='' && $content['datemodifiedto']<$content['datemodifiedfrom']) ) $content['searchmodifiedtext']=lang('Choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates'); - } - else - { - $content['searchmodifiedtext']=''; - } - $this->tmpl->set_cell_attribute('searchmodified','disabled',$switchflag); - $this->tmpl->set_cell_attribute('debuginfos','disabled',!$debug); - - //_debug_array($content); - //echo "

#$debug,$searchactivated#

"; - $this->search_options['checkall']=$content['checkall']; - $this->search_options['checkonlyfiles']=$content['checkonlyfiles']; - $this->search_options['checkonlydirs']=$content['checkonlydirs']; - $this->search_options['searchstring']=$content['searchstring']; - $this->search_options['searchcreated']=$content['searchcreated']; - $this->search_options['datecreatedto']=$content['datecreatedto']; - $this->search_options['datecreatedfrom']=$content['datecreatedfrom']; - $this->search_options['searchmodified']=$content['searchmodified']; - $this->search_options['datemodifiedto']=$content['datemodifiedto']; - $this->search_options['datemodifiedfrom']=$content['datemodifiedfrom']; - - - $content['nm']['search_options']=$this->search_options; - - $content['nm']['search']=$content['searchstring']; - $content['nm']['start_search']=$content['start_search']; - - $this->save_sessiondata($content['nm'],'nm'); - // call and execute thge template - $content['message'].= "

execute the template

"; - echo $this->tmpl->exec('filemanager.uifilemanager.search_tpl',$content,$sel_options,$read_onlys,array('vfs_file_id'=>$this->data['vfs_file_id'])); - // the debug info will be displayed at the very end of the page - //_debug_array($content); - - } - /** - * the call of this function switches from enabled to disabled for various fields of the search dialog - */ - function enable_disable_SearchFields($switchflag) - { - //does not work at all. The calling of $this->tmpl returns nothing - return; - echo "

enable_disable_SearchFields

"; - $this->tmpl->set_cell_attribute('checkall','disabled',$switchflag); - if ($content['checkall']) $this->tmpl->set_cell_attribute('alllabel','label',lang($this->tmpl->get_cell_attribute('alllabel','label')).'(x)'); - $this->tmpl->set_cell_attribute('checkonlyfiles','disabled',$switchflag); - if ($content['checkonlyfiles']) $this->tmpl->set_cell_attribute('filelabel','label',lang($this->tmpl->get_cell_attribute('filelabel','label')).'(x)'); - $this->tmpl->set_cell_attribute('checkonlydirs','disabled',$switchflag); - if ($content['checkonlydirs']) $this->tmpl->set_cell_attribute('dirlabel','label',lang($this->tmpl->get_cell_attribute('dirlabel','label')).'(x)'); - $this->tmpl->set_cell_attribute('searchstring','disabled',$switchflag); - //return $template; - return true; - } - /** - * Saves state of the filemanager list in the session - * - * @param array $values - */ - function save_sessiondata($values,$key='') - { - if (strlen($key)>0) - { - $internalbuffer=$this->read_sessiondata(); - $internalbuffer[$key]=$values; - $this->save_sessiondata($internalbuffer); - } - else - { - //echo "

$for: uifilemanager::save_sessiondata(".print_r($values,True).") called_by='$this->called_by', for='$for'
".function_backtrace()."

\n"; - $GLOBALS['egw']->session->appsession(@$this->called_by.'session_data','filemanager',$values); - } - } - - /** - * reads list-state from the session - * - * @return array - */ - function read_sessiondata($key='') - { - $values = $GLOBALS['egw']->session->appsession(@$this->called_by.'session_data','filemanager'); - if (strlen($key)>0) - { - return $values[$key]; - } - else - { - return $values; - } - } - /** - * query rows for the nextmatch widget - * - * @param array $query with keys 'start', 'search', 'order', 'sort', 'col_filter' - * For other keys like 'filter', 'cat_id' you have to reimplement this method in a derived class. - * @param array &$rows returned rows/competitions - * @param array &$readonlys eg. to disable buttons based on acl, not use here, maybe in a derived class - * @param string $join='' sql to do a join, added as is after the table-name, eg. ", table2 WHERE x=y" or - * "LEFT JOIN table2 ON (x=y)", Note: there's no quoting done on $join! - * @param boolean $need_full_no_count=false If true an unlimited query is run to determine the total number of rows, default false - * @return int total number of rows - * optional not used here: $join='',$need_full_no_count=false - */ - function get_rows(&$query,&$rows,&$readonlys) - { - //echo "

retrieve rows

"; - $startposition=$query['start']; - //$this->save_sessiondata($query); - $sessiondata = $this->read_sessiondata(); - //_debug_array($sessiondata['dirs_options_array']); - //_debug_array($sessiondata['readable_groups']); - //_debug_array($sessiondata['groups_applications']); - if (!($this->search_options)) - { - $sessiondata['start']=$startposition; - $this->search_options=$sessiondata['nm']['search_options']; - } - //_debug_array($this->search_options); - $additionalwhereclause=", (select vfs_file_id as fileid, ".$this->db->concat($this->db->concat("vfs_directory","'/'"),"vfs_name")." as fulldir from egw_vfs WHERE vfs_mime_type <> 'journal' and vfs_mime_type <> 'journal-deleted' and vfs_name is not null and vfs_name <>'' and vfs_name<>'home' and vfs_app='filemanager') vfs2 WHERE vfs2.fileid=egw_vfs.vfs_file_id"; - //search options - if ($this->search_options['checkonlyfiles'] && !$this->search_options['checkonlydirs']) - { - $additionalwhereclause.=" and vfs_mime_type<>'directory' "; - } - elseif ($this->search_options['checkonlydirs'] && !$this->search_options['checkonlyfiles']) - { - $additionalwhereclause.=" and vfs_mime_type='directory' "; - } - elseif ($this->search_options['checkonlyfiles'] && $this->search_options['checkonlydirs']) - { - - } - // timespecific search options - // search regarding the creation date - if ($this->search_options['searchcreated'] && $this->search_options['datecreatedfrom'] && ($this->search_options['datecreatedfrom']<=$this->search_options['datecreatedto'] or !($this->search_options['datecreatedto']) or ($this->search_options['datecreatedto']==''))) - { - $additionalwhereclause.=" and vfs_created >=".$this->db->FROM_UNIXTIME($this->search_options['datecreatedfrom']); - } - if ($this->search_options['searchcreated'] && $this->search_options['datecreatedto'] && ($this->search_options['datecreatedfrom']<=$this->search_options['datecreatedto'] or !($this->search_options['datecreatedfrom']) or ($this->search_options['datecreatedfrom']==''))) - { - $additionalwhereclause.=" and vfs_created <=".$this->db->FROM_UNIXTIME($this->search_options['datecreatedto']); - } - if ($this->search_options['searchcreated'] && $this->search_options['datecreatedto'] && $this->search_options['datecreatedfrom'] && ($this->search_options['datecreatedfrom']>$this->search_options['datecreatedto'])) - { - $additionalwhereclause.=" and (vfs_created >=".$this->db->FROM_UNIXTIME($this->search_options['datecreatedfrom']); - $additionalwhereclause.=" or vfs_created <=".$this->db->FROM_UNIXTIME($this->search_options['datecreatedto']).")"; - } - // search regarding the modification date - if ($this->search_options['searchmodified'] && $this->search_options['datemodifiedfrom'] && ($this->search_options['datemodifiedfrom']<=$this->search_options['datemodifiedto'] or !($this->search_options['datemodifiedto']) or ($this->search_options['datemodifiedto']==''))) - { - $additionalwhereclause.=" and vfs_modified >=".$this->db->FROM_UNIXTIME($this->search_options['datemodifiedfrom']); - } - if ($this->search_options['searchmodified'] && $this->search_options['datemodifiedto'] && ($this->search_options['datemodifiedfrom']<=$this->search_options['datemodifiedto'] or !($this->search_options['datemodifiedfrom']) or ($this->search_options['datemodifiedfrom']==''))) - { - $additionalwhereclause.=" and vfs_modified <=".$this->db->FROM_UNIXTIME($this->search_options['datemodifiedto']); - } - if ($this->search_options['searchmodified'] && $this->search_options['datemodifiedto'] && $this->search_options['datemodifiedfrom'] && ($this->search_options['datemodifiedfrom']>$this->search_options['datemodifiedto'])) - { - $additionalwhereclause.=" and (vfs_modified >=".$this->db->FROM_UNIXTIME($this->search_options['datemodifiedfrom']); - $additionalwhereclause.=" or vfs_modified <=".$this->db->FROM_UNIXTIME($this->search_options['datemodifiedto']).")"; - } - // only show contacts if the order-criteria starts with the given letter - if ($query['searchletter']!=false) - { - $additionalwhereclause .= " and ".($query['order']).' '.$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.$GLOBALS['egw']->db->quote($query['searchletter'].'%'); - } - else - { - //echo "

reset colfilter?!

"; - $query['searchletter']=false; - } - - // filter for allowed groups - $firstleveldirs[]=array(); - $count_fld=0; - $or=''; - $aclcondition=" ( "; - array_push($sessiondata['dirs_options_array'],$this->homedir); - foreach ($sessiondata['dirs_options_array'] as $dir) - { - $splitteddir=explode('/',$dir); - $nix=array_shift($splitteddir); - $vfsbase=array_shift($splitteddir); - $vfs1stleveldir=array_shift($splitteddir); - if (!in_array("/$vfsbase/$vfs1stleveldir", $firstleveldirs)) - { - $count_fld++; - if ($count_fld>1) $or='or'; - array_push($firstleveldirs,"/$vfsbase/$vfs1stleveldir"); - $aclcondition.=" $or ".$this->db->concat($this->db->concat("vfs_directory","'/'"),vfs_name)." like '/$vfsbase/$vfs1stleveldir%' and vfs_mime_type='directory' "; - $aclcondition.=" or vfs_directory like '/$vfsbase/$vfs1stleveldir%' "; - //$aclcondition.=" or (vfs_directory='".implode('/',$splitteddir)."' and vfs_name='".$vfsname."')"; - } - } - $aclcondition.=")"; - if ($count_fld>0) $additionalwhereclause .= " and ".$aclcondition; - //echo "

$aclcondition

"; - - // save the nextmatch entrys/settings with the sessiondata - if (!$_POST['exec']['clear_search']) - { - $query['search_options']=$this->search_options; - } - else - { - //echo "

retrieve rows, clear search

"; - unset($query['search']); - unset($query['start_search']); - $switchflag=0; - - } - $this->save_sessiondata($query,'nm'); - // defaultfilter we dont want journal, and a whole lot of other stuff excluded, so we use the Join part of get_rows to do that - // echo "

$additionalwhereclause

"; - $rc=parent::get_rows($query,$rows,$readonlys, $additionalwhereclause); - //set the applicationheader - $GLOBALS['egw_info']['flags']['app_header'] = lang('filemanager'); - foreach ($rows as $key => $row) - { - $rows[$key]['dir_link']='filemanager.uifilemanager.index&path='.urlencode(base64_encode($row['vfs_directory'])); - if (strtolower($row['vfs_mime_type']) == 'directory') - { - $rows[$key]['file_link']='filemanager.uifilemanager.index&path='.urlencode(base64_encode($row['vfs_directory'].'/'.$row['vfs_name'])); - } - else - { - $rows[$key]['file_link']='filemanager.uifilemanager.view&path='.urlencode(base64_encode($row['vfs_directory'])).'&file='.urlencode(base64_encode($row['vfs_name'])); - } - $rows[$key]['icon'] = $this->mime_icon($row['vfs_mime_type'],16,true); - $rows[$key]['file'] = $row['vfs_directory'].'/'.$row['vfs_name']; - } - // add some info to the appheader that the user may be informed about the search-base of its query-result - if ($query['searchletter']) - { - $order = $order; - $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("%1 starts with '%2'",$order,$query['searchletter']); - } - if ($query['search']) - { - $GLOBALS['egw_info']['flags']['app_header'] .= ' - '.lang("Search for '%1'",$query['search']); - } - return $rc; - } - - } diff --git a/filemanager/setup/default_records.inc.php b/filemanager/setup/default_records.inc.php deleted file mode 100644 index bff62deabf..0000000000 --- a/filemanager/setup/default_records.inc.php +++ /dev/null @@ -1,16 +0,0 @@ -query("INSERT INTO phpgw_vfs (owner_id, createdby_id, modifiedby_id, created, modified, size, mime_type, deleteable, comment, app, directory, name, link_directory, link_name) VALUES (1,0,0,'1970-01-01',NULL,NULL,'Directory','Y',NULL,NULL,'/','', NULL, NULL)"); - $oProc->query("INSERT INTO phpgw_vfs (owner_id, createdby_id, modifiedby_id, created, modified, size, mime_type, deleteable, comment, app, directory, name, link_directory, link_name) VALUES (2,0,0,'1970-01-01',NULL,NULL,'Directory','Y',NULL,NULL,'/','home', NULL, NULL)"); -?> diff --git a/filemanager/setup/egw_de.lang b/filemanager/setup/egw_de.lang index 006c7f40ba..1014b38905 100644 --- a/filemanager/setup/egw_de.lang +++ b/filemanager/setup/egw_de.lang @@ -1,4 +1,3 @@ -%1 already exists as a file filemanager de Es gibt bereits eine Datei %1 %1 directories and %2 files copied. filemanager de %1 Verzeichnisse und %2 Dateien kopiert. %1 directories and %2 files deleted. filemanager de %1 Verzeichnisse und %2 Dateien gelöscht. %1 errors copying (%2 diretories and %3 files copied)! filemanager de %1 Fehler beim Kopieren (%2 Verzeichnisse und %3 Dateien kopiert)! @@ -7,169 +6,69 @@ %1 files copied. filemanager de %1 Dateien kopiert. %1 files deleted. filemanager de %1 Dateien gelöscht. %1 files moved. filemanager de %1 Dateien verschoben. -%1 starts with '%2' filemanager de %1 beginnt mit '%2' %1 the following files into current directory filemanager de Die foldenden Dateien in das aktuelle Verzeichnis %1 %1 urls %2 to clipboard. filemanager de %1 Adressen in die Zwischenablage %2. accessrights filemanager de Zugangsberechtigungen +acl added. filemanager de Zugrifsrecht hinzugefügt. +acl deleted. filemanager de Zugrifsrecht gelöscht. actions filemanager de Befehle +all subdirectories filemanager de Alle Unterverzeichnisse and all it's childeren filemanager de und alle seine Kinder -application filemanager de Anwendung -back to file manager filemanager de Zurück zur Dateiverwaltung -cancel editing %1 without saving filemanager de Bearbeiten abbrechen %1 ohne zu speichern -cannot create directory because it begins or ends in a space filemanager de Kann Verzeichnis nicht anlegen, da der Name mit einem Leerzeichen endet -cannot replace %1 because it is a directory filemanager de Kann %1 nicht ersetzen, da es ein Verzeichnis ist check all filemanager de Alle auswählen -choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates filemanager de Wenn Sie das bis Datum kleiner als das von Datum wählen, finden Sie alle Einträge, ausser denen, deren Datum im Zeitraum der beiden Daten liegt. -choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date filemanager de Wenn Sie nur ein Datum (von/bis) wählen, finden Sie alle Einträge deren Bezugsdatum älter, bzw. jünger als das jeweilige angegebene Datum ist clear search filemanager de Suchfelder zurücksetzen -command sucessfully run filemanager de Kommando erfolgreich ausgeführt -comment filemanager de Kommentar -comments cannot contain "%1" filemanager de Kommentare dürfen kein "%1" enthalten copied filemanager de kopiert -copied %1 to %2 filemanager de %1 nach %2 kopiert -copy to filemanager de Kopieren nach copy to clipboard filemanager de Kopieren in die Zwischenablage -copy to: filemanager de Kopieren nach: -could not copy %1 to %2 filemanager de Konnte %1 nicht nach %2 kopieren -could not copy file because no destination directory is given filemanager de Konnte Datei nicht kopieren, da kein Zielverzeichnis angegeben wurde -could not create %1 filemanager de Konnte %1 nicht anlegen -could not create directory %1 filemanager de Konnte Verzeichnis %1 nicht anlegen -could not delete %1 filemanager de Konnte %1 nicht löschen -could not move %1 to %2 filemanager de Konnte %1 nicht nach %2 verschieben -could not move file because no destination directory is given filemanager de Konnte Datei nicht verschieben, da kein Zielverzeichnis angegeben wurde -could not rename %1 to %2 filemanager de Konnte %1 nicht nach %2 umbenennen -could not save %1 filemanager de Konnte %1 nicht speichern create directory filemanager de Verzeichnis anlegen -create file filemanager de Neue Datei -create folder filemanager de Neues Verzeichnis created filemanager de Erstellt -created %1 filemanager de %1 erstellt -created %1,%2 filemanager de %1,%2 erstellt created between filemanager de erstellt zwischen -created by filemanager de Erstellt von -created directory %1 filemanager de Verzeichnis %1 erstellt +current directory filemanager de Aktuelles Verzeichnis cut filemanager de Ausschneiden cut to clipboard filemanager de Ausschneiden in die Zwischenablage -date filemanager de Datum -default number of upload fields to show filemanager de Vorgabe für Anzahl Felder zum Hochladen -delete filemanager de Löschen delete this file or directory filemanager de Datei oder Verzeichnis löschen -deleted %1 filemanager de %1 gelöscht directory filemanager de Verzeichnis -directory %1 already exists filemanager de Verzeichnis %1 existiert bereits -directory %1 does not exist filemanager de Verzeichnis %1 existiert nicht -directory names cannot contain "%1" filemanager de Verzeichnisnamen dürfen kein "%1" enthalten directory not found or no permission to access it! filemanager de Verzeichnis nicht gefunden oder keine Rechte darauf zuzugreifen! display and modification of content filemanager de Anzeigen und Verändern des Inhaltes -display attributes filemanager de Anzeigeattribute display of content filemanager de Anzeigen des Inhaltes -download filemanager de Herunterladen -edit filemanager de Bearbeiten -edit comments filemanager de Kommentare bearbeiten edit settings filemanager de Einstellungen bearbeiten -error running command filemanager de Fehler beim Ausführen des Kommandos +error adding the acl! filemanager de Fehler beim Hinzufügen des Zugriffsrechts! +error deleting the acl entry! filemanager de Fehler beim Löschen des Zugriffsrechts! error uploading file! filemanager de Fehler beim Hochladen der Datei! executable filemanager de Ausführbar -execute filemanager de Ausführen -failed to create directory filemanager de Verzeichnis konnte nicht erstellt werden +extended access control list filemanager de Erweiterte Zugriffsrechte +extended acl filemanager de Erweiterte ACL failed to create directory! filemanager de Konnte Verzeichnis nicht anlegen! -fake base dir did not exist, egroupware created a new one. filemanager de Dateimanager Wurzelverzeichnis existierte nicht, eGroupWare hat es jetzt angelegt. -file filemanager de Datei -file %1 already exists. please edit it or delete it first. filemanager de Datei %1 existiert bereits. Bitte zuerst bearbeiten oder löschen. -file %1 could not be created. filemanager de Datei %1 konnte nicht erstellt werden. -file %1 may be too big. contact your systemadministrator for further info filemanager de Datei %1 ist möglicherweise zu gross. Kontaktieren Sie Ihren Systemadministrator um weitergehende Informationen zu erhalten file deleted. filemanager de Datei gelöscht. -file name filemanager de Dateiname -file names cannot contain or / filemanager de Dateinamen dürfen kein \ oder / enthalten -file names cannot contain "%1" filemanager de Dateinamen dürfen kein "%1" enthalten -file names cannot contain \ or / filemanager de Dateinamen dürfen kein \ oder / enthalten file or directory not found! filemanager de Datei oder Verzeichnis nicht gefunden! file successful uploaded. filemanager de Datei erfolgreich hochgeladen. -filemanager common de Dateiverwaltung -filemanager preferences filemanager de Dateiverwaltungs-Einstellungen -files filemanager de Dateien -files in this directory filemanager de Dateien in diesem Verzeichnis -folder filemanager de Verzeichnisse -folder up filemanager de Ein Verzeichnis nach oben general filemanager de Allgemein -go home filemanager de Zum Heimverzeichnis wechseln go to filemanager de Gehe zu -go to %1 filemanager de Gehe zu %1 go to your home directory filemanager de Zu Ihrem Heimverzeichnis wechseln -go to: filemanager de Gehe zu: -go up filemanager de einen Ordner nach oben -home filemanager de Home id filemanager de Id -location filemanager de Pfad -locked filemanager de Gesperrt +inherited filemanager de Geerbt +maximum size for uploads filemanager de Maximale Größe beim Hochladen mime type filemanager de MIME-Typ modified filemanager de Verändert modified between filemanager de verändert zwischen -modified by filemanager de Verändert von modify all subdirectories and their content filemanager de Änderungen auf alle Unterverzeichnisse und ihre Inhalte anwenden move filemanager de Verschieben -move to filemanager de Verschieben nach -move to: filemanager de Verschieben nach: -moved %1 to %2 filemanager de %1 nach %2 verschoben no access filemanager de Kein Zugriff -no files in this directory. filemanager de Keine Dateien in diesem Verzeichnis vorhanden no preview available filemanager de Keine Vorschau verfügbar -no version history for this file/directory filemanager de Keine Versionshistorie für dies Datei / Verzeichnis only owner can rename or delete the content filemanager de Nur der Besitzer kann den Inhalt umbenennen oder löschen -operation filemanager de Operation -other settings filemanager de Weitere Einstellungen -owner filemanager de Eigentümer permission denied! filemanager de Zugriff verweigert! permissions filemanager de Zugriffsrechte permissions changed for %1. filemanager de Zugriffsrechte für %1 geändert. -please select a file to delete. filemanager de Bitte wählen Sie die Datei aus welche Sie löschen möchten preview filemanager de Vorschau -preview %1 filemanager de Vorschau %1 -preview of %1 filemanager de Vorschau von %1 -quick jump to filemanager de Sprung zu read & write access filemanager de Lese- und Schreibzugriff read access only filemanager de Nur Lesezugriff -reload filemanager de aktualisieren -rename filemanager de Umbenennen rename, change permissions or ownership filemanager de Umbennen, Zugriffsrechte oder Besitzer ändern -renamed %1 to %2 filemanager de %1 nach %2 umbenannt renamed %1 to %2. filemanager de %1 nach %2 umbenannt. -replaced %1 filemanager de %1 ersetzt +rights filemanager de Rechte root filemanager de root -save %1 filemanager de %1 speichern -save %1, and go back to file listing filemanager de %1 speichern und zurück zur Übersicht wechseln -save all filemanager de Alles speichern -save changes filemanager de Änderungen speichern -saved %1 filemanager de %1 gespeichert -search for '%1' filemanager de Suche nach '%1' searchstring filemanager de Suchbegriff select action... filemanager de Befehl auswählen... select file to upload in current directory filemanager de Datei zum hochladen in das aktuelle Verzeichnis auswählen -show filemanager de Anzeigen -show .. filemanager de Anzeigen ... -show .files filemanager de .Dateien anzeigen -show command line (experimental. dangerous.) filemanager de Kommando anzeigen (EXPERIMENTELL / GEFÄHRLICH) -show help filemanager de Hilfe anzeigen size filemanager de Größe -sort by: filemanager de Sortieren nach: start search filemanager de Suche starten -the future filemanager, now for testing purposes only, please send bugreports filemanager de Der neue Dateimanager, jetzt NUR ZUM TESTEN, bitte Fehlermeldungen senden -total files filemanager de Anzahl Dateien -unknown mime-type defaults to text/plain when viewing filemanager de Zum Anzeigen von unbekannte MIME-Typen text/plain verwenden -unused space filemanager de Unbenutzer Speicherplatz up filemanager de Nach oben -update filemanager de Aktualisieren -updated comment for %1 filemanager de Kommentar für %1 aktualisiert -upload filemanager de Hochladen -upload fields filemanager de Felder zum Hochladen -upload files filemanager de Dateien hochladen -use new experimental filemanager? filemanager de Neuen experimentellen Dateimanager benutzen? -used space filemanager de Benutzter Speicherplatz -users filemanager de Benutzer -version filemanager de Version -view documents in new window filemanager de Dokumente in neuem Fenster anzeigen -view documents on server (if available) filemanager de Dokument auf Server anzeigen (falls verfügbar) -who filemanager de Wer -you do not have access to %1 filemanager de Sie haben keinen Zugang zu %1 +you need to select an owner! filemanager de Sie müssen einen Eigentümer auswählen! you need to select some files first! filemanager de Sie müssen zuerst die Dateien auswählen! -your home dir did not exist, egroupware created a new one. filemanager de Ihre Benutzerverzeichnis existierte nicht, eGroupWare hat es jetzt angelegt. diff --git a/filemanager/setup/egw_en.lang b/filemanager/setup/egw_en.lang index cab0720215..e2af3b00d0 100644 --- a/filemanager/setup/egw_en.lang +++ b/filemanager/setup/egw_en.lang @@ -1,4 +1,3 @@ -%1 already exists as a file filemanager en %1 already exists as a file %1 directories and %2 files copied. filemanager en %1 directories and %2 files copied. %1 directories and %2 files deleted. filemanager en %1 directories and %2 files deleted. %1 errors copying (%2 diretories and %3 files copied)! filemanager en %1 errors copying (%2 diretories and %3 files copied)! @@ -7,170 +6,69 @@ %1 files copied. filemanager en %1 files copied. %1 files deleted. filemanager en %1 files deleted. %1 files moved. filemanager en %1 files moved. -%1 starts with '%2' filemanager en %1 starts with '%2' %1 the following files into current directory filemanager en %1 the following files into current directory %1 urls %2 to clipboard. filemanager en %1 URLs %2 to clipboard. accessrights filemanager en Accessrights +acl added. filemanager en ACL added. +acl deleted. filemanager en ACL deleted. actions filemanager en Actions +all subdirectories filemanager en All subdirectories and all it's childeren filemanager en and all it's childeren -application filemanager en Application -back to file manager filemanager en Back to file manager -cancel editing %1 without saving filemanager en Cancel editing %1 without saving -cannot create directory because it begins or ends in a space filemanager en Cannot create directory because it begins or ends in a space -cannot replace %1 because it is a directory filemanager en Cannot replace %1 because it is a directory check all filemanager en Check all -choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates filemanager en Choosing dates where to-date is smaller than the from-date, will result in a search returning all entries but thoose between the two entered dates -choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date filemanager en Choosing only one date (from/to) will result in a search returning all entries older/younger than the entered date clear search filemanager en clear search -command sucessfully run filemanager en Command sucessfully run -comment filemanager en Comment -comments cannot contain "%1" filemanager en Comments cannot contain "%1" copied filemanager en copied -copied %1 to %2 filemanager en Copied %1 to %2 -copy to filemanager en Copy To copy to clipboard filemanager en Copy to clipboard -copy to: filemanager en Copy to: -could not copy %1 to %2 filemanager en Could not copy %1 to %2 -could not copy file because no destination directory is given filemanager en Could not copy file because no destination directory is given -could not create %1 filemanager en Could not create %1 -could not create directory %1 filemanager en Could not create directory %1 -could not delete %1 filemanager en Could not delete %1 -could not move %1 to %2 filemanager en Could not move %1 to %2 -could not move file because no destination directory is given filemanager en Could not move file because no destination directory is given -could not rename %1 to %2 filemanager en Could not rename %1 to %2 -could not save %1 filemanager en Could not save %1 create directory filemanager en Create directory -create file filemanager en Create File -create folder filemanager en Create Folder -created filemanager en Created -created %1 filemanager en Created %1 -created %1,%2 filemanager en Created %1,%2 +created filemanager en created created between filemanager en created between -created by filemanager en Created by -created directory %1 filemanager en Created directory %1 +current directory filemanager en Current directory cut filemanager en cut cut to clipboard filemanager en Cut to clipboard -date filemanager en Date -debug filemanager en Debug -debuginfos filemanager en Debuginfos -default number of upload fields to show filemanager en Default number of upload fields to show -delete filemanager en Delete delete this file or directory filemanager en Delete this file or directory -deleted %1 filemanager en Deleted %1 directory filemanager en Directory -directory %1 already exists filemanager en Directory %1 already exists -directory %1 does not exist filemanager en Directory %1 does not exist -directory names cannot contain "%1" filemanager en Directory names cannot contain "%1" directory not found or no permission to access it! filemanager en Directory not found or no permission to access it! display and modification of content filemanager en Display and modification of content -display attributes filemanager en Display attributes display of content filemanager en Display of content -download filemanager en Download -edit filemanager en Edit -edit comments filemanager en Edit comments edit settings filemanager en Edit settings -error running command filemanager en Error running command +error adding the acl! filemanager en Error adding the ACL! +error deleting the acl entry! filemanager en Error deleting the ACL entry! error uploading file! filemanager en Error uploading file! executable filemanager en Executable -execute filemanager en Execute -failed to create directory filemanager en failed to create directory +extended access control list filemanager en Extended access control list +extended acl filemanager en Extended ACL failed to create directory! filemanager en Failed to create directory! -fake base dir did not exist, egroupware created a new one. filemanager en Fake Base Dir did not exist, eGroupWare created a new one. -file filemanager en File -file %1 already exists. please edit it or delete it first. filemanager en File %1 already exists. Please edit it or delete it first. -file %1 could not be created. filemanager en File %1 could not be created. -file %1 may be too big. contact your systemadministrator for further info filemanager en File %1 may be too big. Contact your Systemadministrator for further info file deleted. filemanager en File deleted. -file name filemanager en File Name -file names cannot contain "%1" filemanager en File names cannot contain "%1" -file names cannot contain \ or / filemanager en File names cannot contain \ or / file or directory not found! filemanager en File or directory not found! file successful uploaded. filemanager en File successful uploaded. -filemanager common en Filemanager -filemanager preferences filemanager en FileManager preferences -files filemanager en Files -files in this directory filemanager en Files in this directory -folder filemanager en Folder -folder up filemanager en Folder Up general filemanager en General -go home filemanager en go home -go to filemanager en Go To -go to %1 filemanager en Go to %1 +go to filemanager en Go to go to your home directory filemanager en Go to your home directory -go to: filemanager en Go to: -go up filemanager en go up -home filemanager en Home id filemanager en Id -location filemanager en Location -locked filemanager en Locked -mime type filemanager en MIME Type -modified filemanager en Modified +inherited filemanager en Inherited +maximum size for uploads filemanager en Maximum size for uploads +mime type filemanager en mime type +modified filemanager en modified modified between filemanager en modified between -modified by filemanager en Modified by modify all subdirectories and their content filemanager en Modify all Subdirectories and their content move filemanager en Move -move to filemanager en Move To -move to: filemanager en Move to: -moved %1 to %2 filemanager en Moved %1 to %2 no access filemanager en No access -no files in this directory. filemanager en No files in this directory. no preview available filemanager en No preview available -no version history for this file/directory filemanager en No version history for this file/directory only owner can rename or delete the content filemanager en Only owner can rename or delete the content -operation filemanager en Operation -other settings filemanager en Other settings -owner filemanager en Owner permission denied! filemanager en Permission denied! permissions filemanager en Permissions permissions changed for %1. filemanager en Permissions changed for %1. -please select a file to delete. filemanager en Please select a file to delete. preview filemanager en Preview -preview %1 filemanager en Preview %1 -preview of %1 filemanager en Preview of %1 -quick jump to filemanager en Quick jump to read & write access filemanager en Read & write access read access only filemanager en Read access only -reload filemanager en reload -rename filemanager en Rename rename, change permissions or ownership filemanager en Rename, change permissions or ownership -renamed %1 to %2 filemanager en Renamed %1 to %2 renamed %1 to %2. filemanager en Renamed %1 to %2. -replaced %1 filemanager en Replaced %1 +rights filemanager en Rights root filemanager en root -save %1 filemanager en Save %1 -save %1, and go back to file listing filemanager en Save %1, and go back to file listing -save all filemanager en Save all -save changes filemanager en Save changes -saved %1 filemanager en Saved %1 -search for '%1' filemanager en Search for '%1' searchstring filemanager en searchstring select action... filemanager en Select action... select file to upload in current directory filemanager en Select file to upload in current directory -show filemanager en Show -show .. filemanager en Show .. -show .files filemanager en Show .files -show command line (experimental. dangerous.) filemanager en Show command line (EXPERIMENTAL. DANGEROUS.) -show help filemanager en Show help size filemanager en Size -sort by: filemanager en Sort by: start search filemanager en start search -the future filemanager, now for testing purposes only, please send bugreports filemanager en The future filemanager, now for TESTING PURPOSES ONLY, please send bugreports -total files filemanager en Total Files -unknown mime-type defaults to text/plain when viewing filemanager en Unknown MIME-type defaults to text/plain when viewing -unused space filemanager en Unused space up filemanager en Up -update filemanager en Update -updated comment for %1 filemanager en Updated comment for %1 -upload filemanager en Upload -upload fields filemanager en upload fields -upload files filemanager en Upload files -use new experimental filemanager? filemanager en Use new experimental Filemanager? -used space filemanager en Used Space -users filemanager en Users -version filemanager en Version -view documents in new window filemanager en View documents in new window -view documents on server (if available) filemanager en View documents on server (if available) -who filemanager en Who -you do not have access to %1 filemanager en You do not have access to %1 +you need to select an owner! filemanager en You need to select an owner! you need to select some files first! filemanager en You need to select some files first! -your home dir did not exist, egroupware created a new one. filemanager en Your Home Dir did not exist, eGroupWare created a new one. diff --git a/filemanager/setup/etemplates.inc.php b/filemanager/setup/etemplates.inc.php index b845f689d8..c3bc982a8c 100644 --- a/filemanager/setup/etemplates.inc.php +++ b/filemanager/setup/etemplates.inc.php @@ -1,22 +1,26 @@ 'filemanager.file','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:1:{s:2:"h1";s:6:",!@msg";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:10:",redItalic";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:3:"tab";s:5:"label";s:27:"General|Permissions|Preview";s:4:"name";s:21:"general|perms|preview";s:4:"span";s:3:"all";}}i:3;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";}i:2;a:4:{s:4:"type";s:10:"buttononly";s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:7:"onclick";s:15:"window.close();";}}}}s:4:"rows";i:3;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1204554434',); +$templ_data[] = array('name' => 'filemanager.file','template' => '','lang' => '','group' => '0','version' => '1.5.002','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:1:{s:2:"h1";s:6:",!@msg";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:3:"tab";s:5:"label";s:40:"General|Permissions|Extended ACL|Preview";s:4:"name";s:26:"general|perms|eacl|preview";s:4:"span";s:3:"all";}}i:3;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";}i:2;a:3:{s:4:"type";s:6:"button";s:4:"name";s:13:"button[apply]";s:5:"label";s:5:"Apply";}i:3;a:4:{s:4:"type";s:10:"buttononly";s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:7:"onclick";s:15:"window.close();";}}}}s:4:"rows";i:3;s:4:"cols";i:1;}}','size' => '','style' => '.eaclAccount select,.eaclRights select { width: 160px; }','modified' => '1207725030',); + +$templ_data[] = array('name' => 'filemanager.file.eacl','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:4:",top";s:2:"c2";s:7:",bottom";s:2:"h2";s:11:",!@is_owner";}i:1;a:3:{s:1:"A";a:5:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:4:"span";s:3:"all";s:5:"label";s:28:"Extended access control list";i:1;a:7:{s:4:"type";s:4:"grid";s:4:"size";s:17:"100%,200,,,,,auto";s:4:"data";a:3:{i:0;a:7:{s:1:"A";s:2:"80";s:1:"B";s:2:"80";s:1:"D";s:2:"16";s:2:"h2";s:4:",!@1";s:1:"C";s:3:"20%";s:2:"c1";s:2:"th";s:2:"c2";s:3:"row";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Owner";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Rights";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Inherited";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:2;a:4:{s:1:"A";a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:13:"${row}[owner]";s:8:"readonly";s:1:"1";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[rights]";s:8:"readonly";s:1:"1";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:4:"name";s:12:"${row}[path]";}s:1:"D";a:5:{s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:4:"name";s:39:"delete[$row_cont[ino]-$row_cont[owner]]";s:7:"onclick";s:43:"return confirm(\'Delete this extended ACL\');";}}}s:4:"name";s:4:"eacl";s:4:"rows";i:2;s:4:"cols";i:4;s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"200";i:6;s:4:"auto";}}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:2;a:3:{s:1:"A";a:5:{s:4:"type";s:14:"select-account";s:4:"size";s:15:"select one,both";s:4:"name";s:11:"eacl[owner]";s:4:"span";s:12:",eaclAccount";s:5:"label";s:5:"Owner";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:4:"name";s:12:"eacl[rights]";s:4:"span";s:11:",eaclRights";s:5:"label";s:6:"Rights";}s:1:"C";a:3:{s:4:"type";s:6:"button";s:5:"label";s:3:"Add";s:4:"name";s:12:"button[eacl]";}}}s:4:"rows";i:2;s:4:"cols";i:3;s:4:"size";s:12:"450,300,,,10";s:7:"options";a:3:{i:0;s:3:"450";i:1;s:3:"300";i:4;s:2:"10";}}}','size' => '450,300,,,10','style' => '','modified' => '1207724932',); + $templ_data[] = array('name' => 'filemanager.file.general','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:9:{i:0;a:2:{s:1:"A";s:2:"80";s:2:"h1";s:2:"60";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"image";s:4:"name";s:4:"icon";s:4:"span";s:9:",mimeHuge";s:5:"align";s:6:"center";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";s:6:"needed";s:1:"1";s:4:"span";s:9:",fileName";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"hrule";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:4:"mime";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Directory";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:3:"dir";}}i:5;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Size";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:4:"name";s:5:"hsize";s:5:"label";s:17:"%s ($cont[size]b)";}}i:6;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Created";}s:1:"B";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:5:"ctime";s:8:"readonly";s:1:"1";}}i:7;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Modified";}s:1:"B";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:5:"mtime";s:8:"readonly";s:1:"1";}}i:8;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:8;s:4:"cols";i:2;s:4:"size";s:12:"450,300,,,10";s:7:"options";a:3:{i:0;s:3:"450";i:1;s:3:"300";i:4;s:2:"10";}}}','size' => '450,300,,,10','style' => '','modified' => '1204554817',); -$templ_data[] = array('name' => 'filemanager.file.perms','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:1:{s:2:"h3";s:9:",!@is_dir";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:12:"Accessrights";i:1;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:3:{s:1:"A";s:2:"80";s:2:"h5";s:9:",!@is_dir";s:2:"h4";s:8:",@is_dir";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Owner";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"perms[owner]";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Group";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"perms[group]";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Other";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"perms[other]";}}i:4;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:10:"Executable";s:4:"name";s:17:"perms[executable]";}}i:5;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:43:"Only owner can rename or delete the content";s:4:"name";s:13:"perms[sticky]";}}}s:4:"rows";i:5;s:4:"cols";i:2;s:7:"options";a:0:{}}}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:5:"Owner";i:1;a:5:{s:4:"type";s:4:"grid";s:7:"options";a:0:{}s:4:"data";a:3:{i:0;a:1:{s:1:"A";s:2:"80";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"User";}s:1:"B";a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:13:"root,accounts";s:4:"name";s:3:"uid";s:5:"label";s:12:"@ro_uid_root";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Group";}s:1:"B";a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:11:"root,groups";s:4:"name";s:3:"gid";s:5:"label";s:12:"@ro_gid_root";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:43:"Modify all Subdirectories and their content";s:4:"name";s:11:"modify_subs";}}}s:4:"rows";i:3;s:4:"cols";i:1;s:4:"size";s:12:"450,300,,,10";s:7:"options";a:3:{i:0;s:3:"450";i:1;s:3:"300";i:4;s:2:"10";}}}','size' => '450,300,,,10','style' => '','modified' => '1204567746',); +$templ_data[] = array('name' => 'filemanager.file.perms','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:1:{s:2:"h3";s:9:",!@is_dir";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:12:"Accessrights";i:1;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:3:{s:1:"A";s:2:"80";s:2:"h5";s:2:",1";s:2:"h4";s:8:",@is_dir";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Owner";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"perms[owner]";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Group";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"perms[group]";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Other";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"perms[other]";}}i:4;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:10:"Executable";s:4:"name";s:17:"perms[executable]";}}i:5;a:2:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:43:"Only owner can rename or delete the content";s:4:"name";s:13:"perms[sticky]";}}}s:4:"rows";i:5;s:4:"cols";i:2;s:7:"options";a:0:{}}}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:5:"Owner";i:1;a:5:{s:4:"type";s:4:"grid";s:7:"options";a:0:{}s:4:"data";a:3:{i:0;a:1:{s:1:"A";s:2:"80";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"User";}s:1:"B";a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:13:"root,accounts";s:4:"name";s:3:"uid";s:5:"label";s:12:"@ro_uid_root";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Group";}s:1:"B";a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:11:"root,groups";s:4:"name";s:3:"gid";s:5:"label";s:12:"@ro_gid_root";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:43:"Modify all Subdirectories and their content";s:4:"name";s:11:"modify_subs";}}}s:4:"rows";i:3;s:4:"cols";i:1;s:4:"size";s:12:"450,300,,,10";s:7:"options";a:3:{i:0;s:3:"450";i:1;s:3:"300";i:4;s:2:"10";}}}','size' => '450,300,,,10','style' => '','modified' => '1204567746',); $templ_data[] = array('name' => 'filemanager.file.preview','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:5:{s:2:"c1";s:4:",top";s:2:"h1";s:16:",!@mime=/^image/";s:2:"h3";s:22:",@mime=/^(image|text)/";s:2:"h2";s:18:"280,!@text_content";s:2:"c2";s:4:",top";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"image";s:4:"name";s:4:"link";s:4:"span";s:13:",previewImage";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"textarea";s:4:"name";s:12:"text_content";s:4:"span";s:12:",previewText";s:8:"readonly";s:1:"1";}}i:3;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"No preview available";}}}s:4:"rows";i:3;s:4:"cols";i:1;s:4:"size";s:18:"450,300,,,10,,auto";s:7:"options";a:4:{i:0;s:3:"450";i:1;s:3:"300";i:6;s:4:"auto";i:4;s:2:"10";}}}','size' => '450,300,,,10,,auto','style' => '','modified' => '1204567479',); diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php index d8b3700b47..c1dd02083a 100755 --- a/filemanager/setup/setup.inc.php +++ b/filemanager/setup/setup.inc.php @@ -1,43 +1,36 @@ 'phpgwapi', - 'versions' => array('1.3','1.4','1.5') - ); +/* Dependencies for this app to work */ +$setup_info['filemanager']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => array('1.3','1.4','1.5') +); - // installation checks for filemanager - $setup_info['filemanager']['check_install'] = array( - '' => array( - 'func' => 'pear_check', - 'from' => 'Filemanager', - ), - 'HTTP_WebDAV_Server' => array( - 'func' => 'pear_check', - 'from' => 'Filemanager', - ), - ); +// installation checks for filemanager +$setup_info['filemanager']['check_install'] = array( + '' => array( + 'func' => 'pear_check', + 'from' => 'Filemanager', + ), + 'HTTP_WebDAV_Server' => array( + 'func' => 'pear_check', + 'from' => 'Filemanager', + ), +); diff --git a/filemanager/templates/default/edit_file.tpl b/filemanager/templates/default/edit_file.tpl deleted file mode 100644 index a9807cc021..0000000000 --- a/filemanager/templates/default/edit_file.tpl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - -{preview_content}
-
- - - {filemans_hidden} - - - - - - -{buttonSave} {buttonPreview} {buttonDone} {buttonCancel} - - -
- -
- - - - - diff --git a/filemanager/templates/default/errors.tpl b/filemanager/templates/default/errors.tpl deleted file mode 100755 index 976ab6435f..0000000000 --- a/filemanager/templates/default/errors.tpl +++ /dev/null @@ -1,6 +0,0 @@ - -{errors} - - -{error} - diff --git a/filemanager/templates/default/file.xet b/filemanager/templates/default/file.xet new file mode 100644 index 0000000000..94d938c0da --- /dev/null +++ b/filemanager/templates/default/file.xet @@ -0,0 +1,228 @@ + + + + + + + +