2001-06-25 09:28:51 +02:00
< ? php
2001-05-21 03:09:20 +02:00
$phpgw_info [ " flags " ] = array ( " currentapp " => " phpwebhosting " ,
" noheader " => False ,
" noappheader " => False ,
" enable_vfs_class " => True );
include ( " ../header.inc.php " );
/*
General format for output is :
function - current directory - input [ ... ] - what output should be - what output was
*/
html_break ( 1 );
2001-06-14 01:41:26 +02:00
html_text_italic ( PHP_OS . " - " . $phpgw_info [ " server " ][ " db_type " ] . " - " . PHP_VERSION . " - " . $phpgw -> vfs -> basedir );
2001-05-21 03:09:20 +02:00
html_break ( 1 );
2001-06-27 09:16:06 +02:00
$sep = SEP ;
2001-05-21 03:09:20 +02:00
$user = $phpgw -> vfs -> working_lid ;
$homedir = $phpgw -> vfs -> fakebase . " / " . $user ;
2001-05-25 04:16:09 +02:00
$realhomedir = preg_replace ( " |/| " , $sep , $homedir );
2001-05-21 03:09:20 +02:00
$filesdir = $phpgw -> vfs -> basedir ;
$currentapp = $phpgw_info [ " flags " ][ " currentapp " ];
2001-06-14 01:41:26 +02:00
###
# start of getabsolutepath tests
2002-01-16 07:32:19 +01:00
$sequence_num = 1 ;
2001-05-21 03:09:20 +02:00
$phpgw -> vfs -> cd ();
2002-01-16 07:32:19 +01:00
//$phpgw->common->phpgw_footer ();
//$phpgw->common->phpgw_exit ();
2001-05-21 03:09:20 +02:00
$io = array ( " " => " $homedir " , " dir " => " $homedir /dir " , " dir/file " => " $homedir /dir/file " , " dir/dir2 " => " $homedir /dir/dir2 " , " dir/dir2/file " => " $homedir /dir/dir2/file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $homedir /`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd - $i - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
2002-01-16 07:32:19 +01:00
$sequence_num = 2 ;
2001-05-21 03:09:20 +02:00
$cd = " test " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE )
)
);
2001-05-21 03:09:20 +02:00
$io = array ( " " => " /test " , " dir " => " /test/dir " , " dir/file " => " /test/dir/file " , " dir/dir2 " => " /test/dir/dir2 " , " dir/dir2/file " => " /test/dir/dir2/file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " /test/`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd - $i - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
2002-01-16 07:32:19 +01:00
$sequence_num = 3 ;
2001-05-21 03:09:20 +02:00
$cd = " test/test2/test3 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE )
)
);
2001-05-21 03:09:20 +02:00
$io = array ( " " => " /test/test2/test3 " , " dir " => " /test/test2/test3/dir " , " dir/file " => " /test/test2/test3/dir/file " , " dir/dir2 " => " /test/test2/test3/dir/dir2 " , " dir/dir2/file " => " /test/test2/test3/dir/dir2/file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " /test/test2/test3/`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd - $i - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
/* Actually means cd to home directory */
2002-01-16 07:32:19 +01:00
$sequence_num = 4 ;
2001-05-21 03:09:20 +02:00
$cd = " " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_USER );
$io = array ( " " => " $homedir " , " dir " => " $homedir /dir " , " dir/file " => " $homedir /dir/file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $homedir /`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo '<br><b>HERE</b>' ;
echo " <br> $sequence_num - getabsolutepath - $cd - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
/* $cd shouldn't affect this test, but we'll set it anyways */
2002-01-16 07:32:19 +01:00
$sequence_num = 5 ;
2001-05-21 03:09:20 +02:00
$cd = " test2/test4 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE ),
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_NONE );
$io = array ( " " => " " , " dir " => " dir " , " dir/file " => " dir/file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
/* $cd shouldn't affect this test, but we'll set it anyways */
2002-01-16 07:32:19 +01:00
$sequence_num = 6 ;
2001-05-21 03:09:20 +02:00
$cd = " test3/test5 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE ),
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_USER_APP );
$io = array ( " " => " $homedir /. $currentapp " , " dir " => " $homedir /. $currentapp /dir " , " dir/dir2 " => " $homedir /. $currentapp /dir/dir2 " , " dir/file " => " $homedir /. $currentapp /dir/file " , " dir/dir2/dir3/file " => " $homedir /. $currentapp /dir/dir2/dir3/file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $homedir /. $currentapp /`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
/* $cd shouldn't affect this test, but we'll set it anyways */
2002-01-16 07:32:19 +01:00
$sequence_num = 7 ;
2001-05-21 03:09:20 +02:00
$cd = " test4/test6 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE )
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_ROOT );
$io = array ( " " => " " , " dir " => " /dir " , " /dir/dir2/dir3 " => " /dir/dir2/dir3 " , " dir/file " => " /dir/file " , " dir/dir2/dir3 " => " /dir/dir2/dir3 " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " /`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " );
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
/* Now a few to test the VFS_REAL capabilities */
2002-01-16 07:32:19 +01:00
$sequence_num = 8 ;
2001-05-21 03:09:20 +02:00
$cd = " " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE )
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_ROOT | VFS_REAL );
2001-05-25 04:16:09 +02:00
$io = array ( " " => " $filesdir " , " dir " => " $filesdir $sep " . " dir " , " dir/dir2/dir3 " => " $filesdir $sep " . " dir $sep " . " dir2 $sep " . " dir3 " , " dir/file " => " $filesdir $sep " . " dir $sep " . " file " , " dir/dir2/dir3/file " => " $filesdir $sep " . " dir $sep " . " dir2 $sep " . " dir3 $sep " . " file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $filesdir $sep " . " `~!@# $ %^&*()-_=+ $sep " . " |[ { ]};:' \" ,<.>? " );
2001-05-21 03:09:20 +02:00
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives , 'fake' => False ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
2002-01-16 07:32:19 +01:00
$sequence_num = 9 ;
2001-05-21 03:09:20 +02:00
$cd = " test5/test7 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_NONE )
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_USER | VFS_REAL );
2001-05-25 04:16:09 +02:00
$io = array ( " " => " $filesdir $realhomedir " , " dir " => " $filesdir $realhomedir $sep " . " dir " , " dir/dir2/dir3 " => " $filesdir $realhomedir $sep " . " dir $sep " . " dir2 $sep " . " dir3 " , " dir/file " => " $filesdir $realhomedir $sep " . " dir $sep " . " file " , " dir/dir2/dir3/file " => " $filesdir $realhomedir $sep " . " dir $sep " . " dir2 $sep " . " dir3 $sep " . " file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $filesdir $realhomedir $sep " . " `~!@# $ %^&*()-_=+ $sep " . " |[ { ]};:' \" ,<.>? " );
2001-05-21 03:09:20 +02:00
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives , 'fake' => False ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
2002-01-16 07:32:19 +01:00
$sequence_num = 10 ;
2001-05-21 03:09:20 +02:00
$cd = " test6/test8 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_USER )
)
);
2001-05-21 03:09:20 +02:00
/* RELATIVE_CURRENT should be implied */
$relatives = array ( VFS_REAL );
2001-05-25 04:16:09 +02:00
$io = array ( " " => " $filesdir $realhomedir $sep $cd " , " dir " => " $filesdir $realhomedir $sep $cd $sep " . " dir " , " dir/dir2/dir3 " => " $filesdir $realhomedir $sep $cd $sep " . " dir $sep " . " dir2 $sep " . " dir3 " , " dir/file " => " $filesdir $realhomedir $sep $cd $sep " . " dir $sep " . " file " , " dir/dir2/dir3/file " => " $filesdir $realhomedir $sep $cd $sep " . " dir $sep " . " dir2 $sep " . " dir3 $sep " . " file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $filesdir $realhomedir $sep $cd $sep " . " `~!@# $ %^&*()-_=+ $sep " . " |[ { ]};:' \" ,<.>? " );
2001-05-21 03:09:20 +02:00
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives , 'fake' => False ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
2002-01-16 07:32:19 +01:00
$sequence_num = 11 ;
2001-05-21 03:09:20 +02:00
$cd = " test7/test9 " ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( RELATIVE_USER )
)
);
2001-05-21 03:09:20 +02:00
$relatives = array ( RELATIVE_USER_APP | VFS_REAL );
2001-05-25 04:16:09 +02:00
$io = array ( " " => " $filesdir $realhomedir $sep . $currentapp " , " dir " => " $filesdir $realhomedir $sep . $currentapp $sep " . " dir " , " dir/dir2/dir3 " => " $filesdir $realhomedir $sep . $currentapp $sep " . " dir $sep " . " dir2 $sep " . " dir3 " , " dir/file " => " $filesdir $realhomedir $sep . $currentapp $sep " . " dir $sep " . " file " , " dir/dir2/dir3/file " => " $filesdir $realhomedir $sep . $currentapp $sep " . " dir $sep " . " dir2 $sep " . " dir3 $sep " . " file " , " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => " $filesdir $realhomedir $sep . $currentapp $sep `~!@# $ %^&*()-_=+ $sep " . " |[ { ]};:' \" ,<.>? " );
2001-05-21 03:09:20 +02:00
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
if (( $ao = $phpgw -> vfs -> getabsolutepath ( array ( 'string' => $i , 'mask' => $relatives , 'fake' => False ))) != $o )
2001-05-21 03:09:20 +02:00
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao " ;
2001-05-21 03:09:20 +02:00
}
}
# end of getabsolutepath tests
###
###
# start of path_parts tests
/* Just for convienience
$io = array ( " " => array ( " fake_full_path " => " " , " fake_leading_dirs " => " " , " fake_extra_path " => " " , " fake_name " => " " , " real_full_path " => " " , " real_leading_dirs " => " " , " real_extra_path " => " " , " real_name " => " " ));
` ~!@ #$%^&*()-_=+/|[{]};:'\",<.>?
*/
2002-01-16 07:32:19 +01:00
$sequence_num = 12 ;
2001-05-21 03:09:20 +02:00
$cd = " test8/test10 " ;
$relatives [ 0 ] = RELATIVE_USER ;
2002-01-16 07:32:19 +01:00
$phpgw -> vfs -> cd ( array (
'string' => $cd ,
'relative' => False ,
'relatives' => array ( $relatives [ 0 ])
)
);
2001-05-21 03:09:20 +02:00
$subhome = substr ( $homedir , 1 );
$io = array ( " " => array ( " fake_full_path " => " $homedir / $cd " , " fake_leading_dirs " => " $homedir /test8 " , " fake_extra_path " => " $subhome /test8 " , " fake_name " => " test10 " , " real_full_path " => " $filesdir $homedir / $cd " , " real_leading_dirs " => " $filesdir $homedir /test8 " , " real_extra_path " => " $subhome /test8 " , " real_name " => " test10 " ), " dir2/file " => array ( " fake_full_path " => " $homedir / $cd /dir2/file " , " fake_leading_dirs " => " $homedir / $cd /dir2 " , " fake_extra_path " => " $subhome / $cd /dir2 " , " fake_name " => " file " , " real_full_path " => " $filesdir $homedir / $cd /dir2/file " , " real_leading_dirs " => " $filesdir $homedir / $cd /dir2 " , " real_extra_path " => " $subhome / $cd /dir2 " , " real_name " => " file " ), " `~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " => array ( " fake_full_path " => " $homedir / $cd /`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " , " fake_leading_dirs " => " $homedir / $cd /`~!@# $ %^&*()-_=+ " , " fake_extra_path " => " $subhome / $cd /`~!@# $ %^&*()-_=+ " , " fake_name " => " |[ { ]};:' \" ,<.>? " , " real_full_path " => " $filesdir $homedir / $cd /`~!@# $ %^&*()-_=+/|[ { ]};:' \" ,<.>? " , " real_leading_dirs " => " $filesdir $homedir / $cd /`~!@# $ %^&*()-_=+ " , " real_extra_path " => " $subhome / $cd /`~!@# $ %^&*()-_=+ " , " real_name " => " |[ { ]};:' \" ,<.>? " ));
while ( list ( $i , $o ) = each ( $io ))
{
2002-01-16 07:32:19 +01:00
$ao = $phpgw -> vfs -> path_parts ( array ( 'string' => $i ));
2001-05-21 03:09:20 +02:00
while ( list ( $key , $value ) = each ( $o ))
{
if ( $ao -> $key != $o [ $key ])
{
2002-01-16 07:32:19 +01:00
echo " <br> $sequence_num - path_parts - $cd - $i - $relatives[0] - $key - $o[$key] - $ao[$key] " ;
2001-05-21 03:09:20 +02:00
}
}
}
# end of path_parts tests
###
html_break ( 2 );
2001-08-24 10:05:29 +02:00
html_text_bold ( " The less output, the better. Please file errors as a " . html_link ( " https://sourceforge.net/tracker/?group_id=7305&atid=107305 " , " bug report " , True , False ) . " . Be sure to include the system information line at the top, and anything special about your setup. Thanks! " );
2001-05-21 03:09:20 +02:00
html_page_close ();
?>