* @copyright (c) 2009-13 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ $GLOBALS['egw_info']['flags'] = array( 'currentapp' => 'filemanager' ); include('../header.inc.php'); if (!($path = egw_cache::getSession('filemanger','test'))) { $path = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; } if (isset($_REQUEST['path'])) $path = $_REQUEST['path']; echo html::form("

Path: ".html::input('path',$path,'text','size="40"'). html::submit_button('',lang('Submit'))."

\n",array(),'','','','','GET'); if (isset($path) && !empty($path)) { if ($path[0] != '/') { throw new egw_exception_wrong_userinput('Not an absolute path!'); } egw_cache::setSession('filemanger','test',$path); echo "

"; foreach(explode('/',$path) as $n => $part) { $p .= ($p != '/' ? '/' : '').$part; echo ($n > 1 ? ' / ' : '').html::a_href($n ? $part : ' / ','/filemanager/test.php',array('path'=>$p)); } echo "

\n"; echo "

egw_vfs::propfind('$path')=".array2string(egw_vfs::propfind($path))."

\n"; echo "

egw_vfs::resolve_url('$path')=".array2string(egw_vfs::resolve_url($path))."

\n"; $is_dir = egw_vfs::is_dir($path); echo "

is_dir('$path')=".array2string($is_dir)."

\n"; $time = microtime(true); $stat = egw_vfs::stat($path); $stime = number_format(1000*(microtime(true)-$time),1); $time = microtime(true); if ($is_dir)// && ($d = egw_vfs::opendir($path))) { $files = array(); //while(($file = readdir($d))) foreach(egw_vfs::scandir($path) as $file) { if (egw_vfs::is_readable($fpath=egw_vfs::concat($path,$file))) { $file = html::a_href($file,'/filemanager/test.php',array('path'=>$fpath)); } $file .= ' ('.egw_vfs::mime_content_type($fpath).')'; $files[] = $file; } //closedir($d); $time = number_format(1000*(microtime(true)-$time),1); echo "

".($files ? 'Directory' : 'Empty directory')." took $time ms

\n"; if($files) echo '
  1. '.implode("
  2. \n
  3. ",$files).'
'."\n"; } echo "

stat('$path') took $stime ms (mode = ".(isset($stat['mode'])?sprintf('%o',$stat['mode']).' = '.egw_vfs::int2mode($stat['mode']):'NULL').')'; if (is_array($stat)) { _debug_array($stat); } else { echo "

".array2string($stat)."

\n"; } echo "

egw_vfs::is_readable('$path')=".array2string(egw_vfs::is_readable($path))."

\n"; echo "

egw_vfs::is_writable('$path')=".array2string(egw_vfs::is_writable($path))."

\n"; echo "

is_link('$path')=".array2string(egw_vfs::is_link($path))."

\n"; echo "

readlink('$path')=".array2string(egw_vfs::readlink($path))."

\n"; $time = microtime(true); $lstat = egw_vfs::lstat($path); $time = number_format(1000*(microtime(true)-$time),1); echo "

lstat('$path') took $time ms (mode = ".(isset($lstat['mode'])?sprintf('%o',$lstat['mode']).' = '.egw_vfs::int2mode($lstat['mode']):'NULL').')'; if (is_array($lstat)) { _debug_array($lstat); } else { echo "

".array2string($lstat)."

\n"; } if (!$is_dir && $stat) { echo "

egw_vfs::mime_content_type('$path')=".array2string(egw_vfs::mime_content_type($path))."

\n"; echo "

filesize(egw_vfs::PREFIX.'$path')=".array2string(filesize(egw_vfs::PREFIX.$path))."

\n"; echo "

bytes(file_get_contents(egw_vfs::PREFIX.'$path'))=".array2string(bytes(file_get_contents(egw_vfs::PREFIX.$path)))."

\n"; } } $GLOBALS['egw']->common->egw_footer();