Convert to arrayized VFS calls, more precise output in test.php

This commit is contained in:
Zone 2002-01-16 06:32:19 +00:00
parent ed26d20be6
commit e38af6abb2
2 changed files with 407 additions and 129 deletions

View File

@ -18,7 +18,6 @@ while (list ($name,) = each ($GLOBALS['HTTP_GET_VARS']))
$$name = $GLOBALS['HTTP_GET_VARS'][$name]; $$name = $GLOBALS['HTTP_GET_VARS'][$name];
} }
$to_decode = array $to_decode = array
( (
/* /*
@ -90,7 +89,7 @@ include ('../header.inc.php');
if ($execute && $command_line) if ($execute && $command_line)
{ {
if ($result = $GLOBALS['phpgw']->vfs->command_line (stripslashes ($command_line))) if ($result = $GLOBALS['phpgw']->vfs->command_line (array ('command_line' => stripslashes ($command_line))))
{ {
$messages = html_text_bold ('Command sucessfully run', 1); $messages = html_text_bold ('Command sucessfully run', 1);
if ($result != 1 && strlen ($result) > 0) if ($result != 1 && strlen ($result) > 0)
@ -123,14 +122,14 @@ if (!$path)
{ {
$path = $GLOBALS['phpgw']->vfs->pwd (); $path = $GLOBALS['phpgw']->vfs->pwd ();
if (!$path || $GLOBALS['phpgw']->vfs->pwd (False) == '') if (!$path || $GLOBALS['phpgw']->vfs->pwd (array ('full' => False)) == '')
{ {
$path = $GLOBALS['homedir']; $path = $GLOBALS['homedir'];
} }
} }
$GLOBALS['phpgw']->vfs->cd (False, False, array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->cd (array ('string' => False, 'relatives' => array (RELATIVE_NONE), 'relative' => False));
$GLOBALS['phpgw']->vfs->cd ($path, False, array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->cd (array ('string' => $path, 'relatives' => array (RELATIVE_NONE), 'relative' => False));
$pwd = $GLOBALS['phpgw']->vfs->pwd (); $pwd = $GLOBALS['phpgw']->vfs->pwd ();
@ -165,8 +164,8 @@ if ($phpwh_debug)
lesspath: $lesspath lesspath: $lesspath
<p> <p>
<b>phpGW debug:</b><br> <b>phpGW debug:</b><br>
real getabsolutepath: " . $GLOBALS['phpgw']->vfs->getabsolutepath (False, False, False) . "<br> real getabsolutepath: " . $GLOBALS['phpgw']->vfs->getabsolutepath (array ('target' => False, 'mask' => False, 'fake' => False)) . "<br>
fake getabsolutepath: " . $GLOBALS['phpgw']->vfs->getabsolutepath (False) . "<br> fake getabsolutepath: " . $GLOBALS['phpgw']->vfs->getabsolutepath (array ('target' => False)) . "<br>
appsession: " . $GLOBALS['phpgw']->session->appsession ('vfs','') . "<br> appsession: " . $GLOBALS['phpgw']->session->appsession ('vfs','') . "<br>
pwd: " . $GLOBALS['phpgw']->vfs->pwd () . "<br>"; pwd: " . $GLOBALS['phpgw']->vfs->pwd () . "<br>";
} }
@ -204,7 +203,15 @@ else
$GLOBALS['phpgw']->vfs->working_id = $GLOBALS['userinfo']['username']; $GLOBALS['phpgw']->vfs->working_id = $GLOBALS['userinfo']['username'];
} }
if ($path != $GLOBALS['homedir'] && $path != $GLOBALS['fakebase'] && $path != '/' && !$GLOBALS['phpgw']->vfs->acl_check ($path, array (RELATIVE_NONE), PHPGW_ACL_READ)) if ($path != $GLOBALS['homedir']
&& $path != $GLOBALS['fakebase']
&& $path != '/'
&& !$GLOBALS['phpgw']->vfs->acl_check (array (
'string' => $path,
'relatives' => array (RELATIVE_NONE),
'operation' => PHPGW_ACL_READ
))
)
{ {
echo $GLOBALS['phpgw']->common->error_list (array ('You do not have access to '.$path)); echo $GLOBALS['phpgw']->common->error_list (array ('You do not have access to '.$path));
html_break (2); html_break (2);
@ -220,22 +227,35 @@ $GLOBALS['userinfo']['working_lid'] = $GLOBALS['phpgw']->accounts->id2name ($GLO
# Same for group directories # Same for group directories
### ###
if (($path == $GLOBALS['homedir']) && !$GLOBALS['phpgw']->vfs->file_exists ($GLOBALS['homedir'], array (RELATIVE_NONE))) if (($path == $GLOBALS['homedir'])
&& !$GLOBALS['phpgw']->vfs->file_exists (array (
'string' => $GLOBALS['homedir'],
'relatives' => array (RELATIVE_NONE)
))
)
{ {
// $GLOBALS['phpgw']->vfs->override_acl = 1; $GLOBALS['phpgw']->vfs->override_acl = 1;
$GLOBALS['phpgw']->vfs->mkdir ($GLOBALS['homedir'], array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->mkdir (array ('string' => $GLOBALS['homedir'], 'relatives' => array (RELATIVE_NONE)));
// $GLOBALS['phpgw']->vfs->override_acl = 0; $GLOBALS['phpgw']->vfs->override_acl = 0;
} }
elseif (preg_match ('|^'.$GLOBALS['fakebase'].'\/(.*)$|U', $path, $matches)) elseif (preg_match ('|^'.$GLOBALS['fakebase'].'\/(.*)$|U', $path, $matches))
{ {
if (!$GLOBALS['phpgw']->vfs->file_exists ($path, array (RELATIVE_NONE))) if (!$GLOBALS['phpgw']->vfs->file_exists (array ('string' => $path, 'relatives' => array (RELATIVE_NONE))))
{ {
// $GLOBALS['phpgw']->vfs->override_acl = 1; $GLOBALS['phpgw']->vfs->override_acl = 1;
$GLOBALS['phpgw']->vfs->mkdir ($path, array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->mkdir (array ('string' => $path, 'relatives' => array (RELATIVE_NONE)));
// $GLOBALS['phpgw']->vfs->override_acl = 0; $GLOBALS['phpgw']->vfs->override_acl = 0;
$group_id = $GLOBALS['phpgw']->accounts->name2id ($matches[1]); $group_id = $GLOBALS['phpgw']->accounts->name2id ($matches[1]);
$GLOBALS['phpgw']->vfs->set_attributes ($path, array (RELATIVE_NONE), array ('owner_id' => $group_id, 'createdby_id' => $group_id)); $GLOBALS['phpgw']->vfs->set_attributes (array (
'string' => $path,
'relatives' => array (RELATIVE_NONE),
'attributes' => array (
'owner_id' => $group_id,
'createdby_id' => $group_id
)
)
);
} }
} }
@ -245,7 +265,7 @@ elseif (preg_match ('|^'.$GLOBALS['fakebase'].'\/(.*)$|U', $path, $matches))
if ($path != $GLOBALS['homedir'] && $path != '/' && $path != $GLOBALS['fakebase']) if ($path != $GLOBALS['homedir'] && $path != '/' && $path != $GLOBALS['fakebase'])
{ {
if (!$GLOBALS['phpgw']->vfs->file_exists ($path, array (RELATIVE_NONE))) if (!$GLOBALS['phpgw']->vfs->file_exists (array ('string' => $path, 'relatives' => array (RELATIVE_NONE))))
{ {
echo $GLOBALS['phpgw']->common->error_list (array ('Directory '.$path.' does not exist')); echo $GLOBALS['phpgw']->common->error_list (array ('Directory '.$path.' does not exist'));
html_break (2); html_break (2);
@ -260,7 +280,7 @@ if ($path != $GLOBALS['homedir'] && $path != '/' && $path != $GLOBALS['fakebase'
srand ((double) microtime() * 1000000); srand ((double) microtime() * 1000000);
if ($update || rand (0, 19) == 4) if ($update || rand (0, 19) == 4)
{ {
$GLOBALS['phpgw']->vfs->update_real ($path, array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->update_real (array ('string' => $path, 'relatives' => array (RELATIVE_NONE)));
} }
### ###
@ -294,12 +314,18 @@ if (!$show_upload_boxes || $show_upload_boxes <= 0)
$numoffiles = 0; $numoffiles = 0;
if ($path == $GLOBALS['fakebase']) if ($path == $GLOBALS['fakebase'])
{ {
if (!$GLOBALS['phpgw']->vfs->file_exists ($GLOBALS['homedir'], array (RELATIVE_NONE))) if (!$GLOBALS['phpgw']->vfs->file_exists (array ('string' => $GLOBALS['homedir'], 'relatives' => array (RELATIVE_NONE))))
{ {
$GLOBALS['phpgw']->vfs->mkdir ($GLOBALS['homedir'], array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->mkdir (array ('string' => $GLOBALS['homedir'], 'relatives' => array (RELATIVE_NONE)));
} }
$ls_array = $GLOBALS['phpgw']->vfs->ls ($GLOBALS['homedir'], array (RELATIVE_NONE), False, False, True); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $GLOBALS['homedir'],
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => False,
'nofiles' => True
)
);
$files_array[] = $ls_array[0]; $files_array[] = $ls_array[0];
$numoffiles++; $numoffiles++;
// $files_array = $ls_array; // $files_array = $ls_array;
@ -317,13 +343,36 @@ if ($path == $GLOBALS['fakebase'])
continue; continue;
} }
if (!$GLOBALS['phpgw']->vfs->file_exists ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE))) if (!$GLOBALS['phpgw']->vfs->file_exists (array (
'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
'relatives' => array (RELATIVE_NONE)
))
)
{ {
$GLOBALS['phpgw']->vfs->mkdir ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE)); $GLOBALS['phpgw']->vfs->mkdir (array (
$GLOBALS['phpgw']->vfs->set_attributes ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE), array ('owner_id' => $group_array['account_id'], 'createdby_id' => $group_array['account_id'])); 'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
'relatives' => array (RELATIVE_NONE)
)
);
$GLOBALS['phpgw']->vfs->set_attributes (array (
'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
'relatives' => array (RELATIVE_NONE),
'attributes' => array (
'owner_id' => $group_array['account_id'],
'createdby_id' => $group_array['account_id']
)
)
);
} }
$ls_array = $GLOBALS['phpgw']->vfs->ls ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE), False, False, True); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => False,
'nofiles' => True
)
);
$files_array[] = $ls_array[0]; $files_array[] = $ls_array[0];
@ -332,7 +381,14 @@ if ($path == $GLOBALS['fakebase'])
} }
else else
{ {
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path, array (RELATIVE_NONE), False, False, False, $sortby); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $path,
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => False,
'nofiles' => False,
'orderby' => $sortby
)
);
if ($phpwh_debug) if ($phpwh_debug)
{ {
@ -366,37 +422,49 @@ if ($download)
$download_browser = CreateObject ('phpgwapi.browser'); $download_browser = CreateObject ('phpgwapi.browser');
$download_browser->content_header ($fileman[$i]); $download_browser->content_header ($fileman[$i]);
echo $GLOBALS['phpgw']->vfs->read ($fileman[$i]); echo $GLOBALS['phpgw']->vfs->read (array ('string' => $fileman[$i]));
$GLOBALS['phpgw']->common->phpgw_exit (); $GLOBALS['phpgw']->common->phpgw_exit ();
} }
} }
if ($op == 'view' && $file) if ($op == 'view' && $file)
{ {
// $ls_array = $GLOBALS['phpgw']->vfs->ls ($path.'/'.$file, array (RELATIVE_ALL), False, False, True); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $path.'/'.$file,
'relatives' => array (RELATIVE_ALL),
'checksubdirs' => False,
'nofiles' => True
)
);
// if ($ls_array[0]['mime_type']) if ($ls_array[0]['mime_type'])
// { {
// $mime_type = $ls_array[0]['mime_type']; $mime_type = $ls_array[0]['mime_type'];
// } }
// elseif ($GLOBALS['settings']['viewtextplain']) elseif ($GLOBALS['settings']['viewtextplain'])
// { {
// $mime_type = 'text/plain'; $mime_type = 'text/plain';
// } }
Header('Content-length: '.$GLOBALS['phpgw']->vfs->get_size($path.'/'.$file,array(RELATIVE_ALL))); header('Content-type: ' . $mime_type);
Header('Content-type: '.$GLOBALS['phpgw']->vfs->file_type($path.'/'.$file,array(RELATIVE_ALL))); echo $GLOBALS['phpgw']->vfs->read (array (
Header('Content-disposition: attachment; filename="'.$file.'"'); 'string' => $path.'/'.$file,
echo $GLOBALS['phpgw']->vfs->read($path.'/'.$file,array(RELATIVE_ALL)); 'relatives' => array (RELATIVE_NONE)
flush(); )
);
// header('Content-type: ' . $mime_type);
// echo $GLOBALS['phpgw']->vfs->read ($path.'/'.$file);
$GLOBALS['phpgw']->common->phpgw_exit (); $GLOBALS['phpgw']->common->phpgw_exit ();
} }
if ($op == 'history' && $file) if ($op == 'history' && $file)
{ {
$journal_array = $GLOBALS['phpgw']->vfs->get_journal (array (
'string' => $file,
'relatives' => array (RELATIVE_ALL)
)
);
if (is_array ($journal_array))
{
html_table_begin (); html_table_begin ();
html_table_row_begin (); html_table_row_begin ();
html_table_col_begin (); html_table_col_begin ();
@ -413,7 +481,6 @@ if ($op == 'history' && $file)
html_table_col_end (); html_table_col_end ();
html_table_row_end (); html_table_row_end ();
$journal_array = $GLOBALS['phpgw']->vfs->get_journal ($file, array (RELATIVE_ALL));
while (list ($num, $journal_entry) = each ($journal_array)) while (list ($num, $journal_entry) = each ($journal_array))
{ {
html_table_row_begin (); html_table_row_begin ();
@ -433,6 +500,12 @@ if ($op == 'history' && $file)
html_table_end (); html_table_end ();
html_page_close (); html_page_close ();
}
else
{
html_text_bold ('No version history for this file/directory');
}
} }
if ($newfile && $createfile) if ($newfile && $createfile)
@ -445,7 +518,11 @@ if ($newfile && $createfile)
html_page_close (); html_page_close ();
} }
if ($GLOBALS['phpgw']->vfs->file_exists ($createfile, array (RELATIVE_ALL))) if ($GLOBALS['phpgw']->vfs->file_exists (array (
'string' => $createfile,
'relatives' => array (RELATIVE_ALL)
))
)
{ {
echo $GLOBALS['phpgw']->common->error_list (array ('File '.$createfile.' already exists. Please edit it or delete it first.')); echo $GLOBALS['phpgw']->common->error_list (array ('File '.$createfile.' already exists. Please edit it or delete it first.'));
html_break (2); html_break (2);
@ -453,7 +530,11 @@ if ($newfile && $createfile)
html_page_close (); html_page_close ();
} }
if ($GLOBALS['phpgw']->vfs->touch ($createfile, array (RELATIVE_ALL))) if ($GLOBALS['phpgw']->vfs->touch (array (
'string' => $createfile,
'relatives' => array (RELATIVE_ALL)
))
)
{ {
$fileman = array (); $fileman = array ();
$fileman[0] = $createfile; $fileman[0] = $createfile;
@ -728,8 +809,12 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
if ($GLOBALS['settings']['viewonserver'] && isset ($GLOBALS['filesdir']) && !$files['link_directory']) if ($GLOBALS['settings']['viewonserver'] && isset ($GLOBALS['filesdir']) && !$files['link_directory'])
{ {
$clickview = $GLOBALS['filesdir'].$pwd.'/'.$files['name']; $clickview = $GLOBALS['filesdir'].$pwd.'/'.$files['name'];
if ($phpwh_debug)
{
echo 'Setting clickview = '.$clickview.'<br>'."\n"; echo 'Setting clickview = '.$clickview.'<br>'."\n";
} }
}
else else
{ {
$clickview = $GLOBALS['appname'].'/index.php?op=view&file='.$files['name'].'&path='.$path; $clickview = $GLOBALS['appname'].'/index.php?op=view&file='.$files['name'].'&path='.$path;
@ -766,7 +851,12 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
{ {
html_table_col_begin (); html_table_col_begin ();
$size = $GLOBALS['phpgw']->vfs->get_size ($files['directory'] . '/' . $files['name'], array (RELATIVE_NONE)); $size = $GLOBALS['phpgw']->vfs->get_size (array (
'string' => $files['directory'] . '/' . $files['name'],
'relatives' => array (RELATIVE_NONE)
)
);
borkb ($size); borkb ($size);
html_table_col_end (); html_table_col_end ();
@ -971,14 +1061,23 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
# First we get the directories in their home directory # First we get the directories in their home directory
### ###
$dirs = array ();
$dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $GLOBALS['userinfo']['account_lid']); $dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $GLOBALS['userinfo']['account_lid']);
$ls_array = $GLOBALS['phpgw']->vfs->ls ($GLOBALS['homedir'], array (RELATIVE_NONE), True, 'Directory'); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $GLOBALS['homedir'],
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => True,
'mime_type' => 'Directory'
)
);
while (list ($num, $dir) = each ($ls_array)) while (list ($num, $dir) = each ($ls_array))
{ {
$dirs[] = $dir; $dirs[] = $dir;
} }
### ###
# Then we get the directories in their membership's home directories # Then we get the directories in their membership's home directories
### ###
@ -997,7 +1096,13 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
$dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $group_array['account_name']); $dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $group_array['account_name']);
$ls_array = $phpgw->vfs->ls ($GLOBALS['fakebase'].'/'.$group_array[account_name], array (RELATIVE_NONE), True, 'Directory'); $ls_array = $phpgw->vfs->ls (array (
'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => True,
'mime_type' => 'Directory'
)
);
while (list ($num, $dir) = each ($ls_array)) while (list ($num, $dir) = each ($ls_array))
{ {
$dirs[] = $dir; $dirs[] = $dir;
@ -1025,7 +1130,12 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
# No point in displaying the current directory, or a directory that doesn't exist # No point in displaying the current directory, or a directory that doesn't exist
### ###
if ((($dir['directory'] . $dir['name']) != $path) && $GLOBALS['phpgw']->vfs->file_exists ($dir['directory'] . $dir['name'], array (RELATIVE_NONE))) if ((($dir['directory'] . $dir['name']) != $path)
&& $GLOBALS['phpgw']->vfs->file_exists (array (
'string' => $dir['directory'] . $dir['name'],
'relatives' => array (RELATIVE_NONE)
))
)
{ {
html_form_option ($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']); html_form_option ($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
} }
@ -1087,7 +1197,12 @@ if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$ed
html_text_bold ('Unused space: '); html_text_bold ('Unused space: ');
html_text (borkb ($GLOBALS['userinfo']['hdspace'] - $usedspace, NULL, 1)); html_text (borkb ($GLOBALS['userinfo']['hdspace'] - $usedspace, NULL, 1));
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path, array (RELATIVE_NONE)); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $path,
'relatives' => array (RELATIVE_NONE)
)
);
$i = count ($ls_array); $i = count ($ls_array);
html_break (2); html_break (2);
@ -1185,7 +1300,12 @@ if ($edit)
{ {
$content = $edit_file_content; $content = $edit_file_content;
if ($GLOBALS['phpgw']->vfs->write ($edit_file, array (RELATIVE_ALL), $content)) if ($GLOBALS['phpgw']->vfs->write (array (
'string' => $edit_file,
'relatives' => array (RELATIVE_ALL),
'content' => $content
))
)
{ {
html_text_bold ('Saved '.$path.'/'.$edit_file); html_text_bold ('Saved '.$path.'/'.$edit_file);
html_break (2); html_break (2);
@ -1210,7 +1330,12 @@ if ($edit)
echo 'fileman['.$j.']: '.$fileman[$j].'<br><b>'.$content.'</b><br>'; echo 'fileman['.$j.']: '.$fileman[$j].'<br><b>'.$content.'</b><br>';
continue; continue;
if ($GLOBALS['phpgw']->vfs->write ($fileman[$j], array (RELATIVE_ALL), $content)) if ($GLOBALS['phpgw']->vfs->write (array (
'string' => $fileman[$j],
'relatives' => array (RELATIVE_ALL),
'content' => $content
))
)
{ {
html_text_bold ('Saved '.$path.'/'.$fileman[$j]); html_text_bold ('Saved '.$path.'/'.$fileman[$j]);
html_break (1); html_break (1);
@ -1242,7 +1367,11 @@ if ($edit)
continue; continue;
} }
if ($fileman[$j] && $GLOBALS['phpgw']->vfs->file_exists ($fileman[$j], array (RELATIVE_ALL))) if ($fileman[$j] && $GLOBALS['phpgw']->vfs->file_exists (array (
'string' => $fileman[$j],
'relatives' => array (RELATIVE_ALL)
))
)
{ {
if ($edit_file) if ($edit_file)
{ {
@ -1250,7 +1379,7 @@ if ($edit)
} }
else else
{ {
$content = $GLOBALS['phpgw']->vfs->read ($fileman[$j]); $content = $GLOBALS['phpgw']->vfs->read (array ('string' => $fileman[$j]));
} }
html_table_begin ('100%'); html_table_begin ('100%');
@ -1306,7 +1435,14 @@ elseif ($op == 'upload' && $path != '/' && $path != $GLOBALS['fakebase'])
# Check to see if the file exists in the database, and get its info at the same time # Check to see if the file exists in the database, and get its info at the same time
### ###
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path . '/' . $upload_file_name[$i], array (RELATIVE_NONE), False, False, True); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $path . '/' . $upload_file_name[$i],
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => False,
'nofiles' => True
)
);
$fileinfo = $ls_array[0]; $fileinfo = $ls_array[0];
if ($fileinfo['name']) if ($fileinfo['name'])
@ -1322,23 +1458,69 @@ elseif ($op == 'upload' && $path != '/' && $path != $GLOBALS['fakebase'])
{ {
if ($fileinfo['name'] && $fileinfo['deleteable'] != 'N') if ($fileinfo['name'] && $fileinfo['deleteable'] != 'N')
{ {
$GLOBALS['phpgw']->vfs->set_attributes ($upload_file_name[$i], array (RELATIVE_ALL), array ('owner_id' => $GLOBALS['userinfo']['username'], 'modifiedby_id' => $GLOBALS['userinfo']['username'], 'modified' => $now, 'size' => $upload_file_size[$i], 'mime_type' => $upload_file_type[$i], 'deleteable' => 'Y', 'comment' => stripslashes ($upload_comment[$i]))); $GLOBALS['phpgw']->vfs->set_attributes (array (
$GLOBALS['phpgw']->vfs->cp ($upload_file[$i], $upload_file_name[$i], array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)); 'string' => $upload_file_name[$i],
'relatives' => array (RELATIVE_ALL),
'attributes' => array (
'owner_id' => $GLOBALS['userinfo']['username'],
'modifiedby_id' => $GLOBALS['userinfo']['username'],
'modified' => $now,
'size' => $upload_file_size[$i],
'mime_type' => $upload_file_type[$i],
'deleteable' => 'Y',
'comment' => stripslashes ($upload_comment[$i])
)
)
);
$GLOBALS['phpgw']->vfs->cp (array (
'from' => $upload_file[$i],
'to' => $upload_file_name[$i],
'relatives' => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
)
);
html_text_summary ('Replaced '.$disppath.'/'.$upload_file_name[$i], $upload_file_size[$i]); html_text_summary ('Replaced '.$disppath.'/'.$upload_file_name[$i], $upload_file_size[$i]);
} }
else else
{ {
$GLOBALS['phpgw']->vfs->cp ($upload_file[$i], $upload_file_name[$i], array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)); $GLOBALS['phpgw']->vfs->cp (array (
$GLOBALS['phpgw']->vfs->set_attributes ($upload_file_name[$i], array (RELATIVE_ALL), array ('mime_type' => $upload_file_type[$i], 'comment' => stripslashes ($upload_comment[$i]))); 'from' => $upload_file[$i],
'to' => $upload_file_name[$i],
'relatives' => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
)
);
$GLOBALS['phpgw']->vfs->set_attributes (array (
'string' => $upload_file_name[$i],
'relatives' => array (RELATIVE_ALL),
'attributes' => array (
'mime_type' => $upload_file_type[$i],
'comment' => stripslashes ($upload_comment[$i])
)
)
);
html_text_summary ('Created '.$disppath.'/'.$upload_file_name[$i], $upload_file_size[$i]); html_text_summary ('Created '.$disppath.'/'.$upload_file_name[$i], $upload_file_size[$i]);
} }
} }
elseif ($upload_file_name[$i]) elseif ($upload_file_name[$i])
{ {
$GLOBALS['phpgw']->vfs->touch ($upload_file_name[$i], array (RELATIVE_ALL)); $GLOBALS['phpgw']->vfs->touch (array (
$GLOBALS['phpgw']->vfs->set_attributes ($upload_file_name[$i], array (RELATIVE_ALL), array ('mime_type' => $upload_file_type[$i], 'comment' => $upload_comment[$i])); 'string' => $upload_file_name[$i],
'relatives' => array (RELATIVE_ALL)
)
);
$GLOBALS['phpgw']->vfs->set_attributes (array (
'string' => $upload_file_name[$i],
'relatives' => array (RELATIVE_ALL),
'attributes' => array (
'mime_type' => $upload_file_type[$i],
'comment' => $upload_comment[$i]
)
)
);
html_text_summary ('Created '.$disppath.'/'.$upload_file_name[$i], $file_size[$i]); html_text_summary ('Created '.$disppath.'/'.$upload_file_name[$i], $file_size[$i]);
} }
@ -1362,7 +1544,14 @@ elseif ($comment_files)
continue; continue;
} }
$GLOBALS['phpgw']->vfs->set_attributes ($file, array (RELATIVE_ALL), array ('comment' => stripslashes ($comment_files[$file]))); $GLOBALS['phpgw']->vfs->set_attributes (array (
'string' => $file,
'relatives' => array (RELATIVE_ALL),
'attributes' => array (
'comment' => stripslashes ($comment_files[$file])
)
)
);
html_text_summary ('Updated comment for '.$path.'/'.$file); html_text_summary ('Updated comment for '.$path.'/'.$file);
} }
@ -1389,7 +1578,11 @@ elseif ($renamefiles)
{ {
echo $GLOBALS['phpgw']->common->error_list (array ("File names cannot contain \\ or /")); echo $GLOBALS['phpgw']->common->error_list (array ("File names cannot contain \\ or /"));
} }
elseif (!$GLOBALS['phpgw']->vfs->mv ($from, $to)) elseif (!$GLOBALS['phpgw']->vfs->mv (array (
'from' => $from,
'to' => $to
))
)
{ {
echo $GLOBALS['phpgw']->common->error_list (array ('Could not rename '.$disppath.'/'.$from.' to '.$disppath.'/'.$to)); echo $GLOBALS['phpgw']->common->error_list (array ('Could not rename '.$disppath.'/'.$from.' to '.$disppath.'/'.$to));
} }
@ -1411,7 +1604,12 @@ elseif ($move)
{ {
while (list ($num, $file) = each ($fileman)) while (list ($num, $file) = each ($fileman))
{ {
if ($GLOBALS['phpgw']->vfs->mv ($file, $todir . '/' . $file, array (RELATIVE_ALL, RELATIVE_NONE))) if ($GLOBALS['phpgw']->vfs->mv (array (
'from' => $file,
'to' => $todir . '/' . $file,
'relatives' => array (RELATIVE_ALL, RELATIVE_NONE)
))
)
{ {
$moved++; $moved++;
html_text_summary ('Moved '.$disppath.'/'.$file.' to '.$todir.'/'.$file); html_text_summary ('Moved '.$disppath.'/'.$file.' to '.$todir.'/'.$file);
@ -1440,7 +1638,12 @@ elseif ($copy)
{ {
while (list ($num, $file) = each ($fileman)) while (list ($num, $file) = each ($fileman))
{ {
if ($GLOBALS['phpgw']->vfs->cp ($file, $todir . '/' . $file, array (RELATIVE_ALL, RELATIVE_NONE))) if ($GLOBALS['phpgw']->vfs->cp (array (
'from' => $file,
'to' => $todir . '/' . $file,
'relatives' => array (RELATIVE_ALL, RELATIVE_NONE)
))
)
{ {
$copied++; $copied++;
html_text_summary ('Copied '.$disppath.'/'.$file.' to '.$todir.'/'.$file); html_text_summary ('Copied '.$disppath.'/'.$file.' to '.$todir.'/'.$file);
@ -1471,7 +1674,7 @@ elseif ($delete)
{ {
if ($fileman[$i]) if ($fileman[$i])
{ {
if ($GLOBALS['phpgw']->vfs->delete ($fileman[$i])) if ($GLOBALS['phpgw']->vfs->delete (array ('string' => $fileman[$i])))
{ {
html_text_summary ('Deleted '.$disppath.'/'.$fileman[$i], $fileinfo['size']); html_text_summary ('Deleted '.$disppath.'/'.$fileman[$i], $fileinfo['size']);
} }
@ -1504,7 +1707,14 @@ elseif ($newdir && $createdir)
html_page_close (); html_page_close ();
} }
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path . '/' . $createdir, array (RELATIVE_NONE), False, False, True); $ls_array = $GLOBALS['phpgw']->vfs->ls (array (
'string' => $path . '/' . $createdir,
'relatives' => array (RELATIVE_NONE),
'checksubdirs' => False,
'nofiles' => True
)
);
$fileinfo = $ls_array[0]; $fileinfo = $ls_array[0];
if ($fileinfo['name']) if ($fileinfo['name'])
@ -1526,7 +1736,7 @@ elseif ($newdir && $createdir)
} }
else else
{ {
if ($GLOBALS['phpgw']->vfs->mkdir ($createdir)) if ($GLOBALS['phpgw']->vfs->mkdir (array ('string' => $createdir)))
{ {
html_text_summary ('Created directory '.$disppath.'/'.$createdir); html_text_summary ('Created directory '.$disppath.'/'.$createdir);
html_break (2); html_break (2);

View File

@ -26,148 +26,210 @@ $currentapp = $phpgw_info["flags"]["currentapp"];
### ###
# start of getabsolutepath tests # start of getabsolutepath tests
$sequence_num = 1;
$phpgw->vfs->cd (); $phpgw->vfs->cd ();
//$phpgw->common->phpgw_footer ();
//$phpgw->common->phpgw_exit ();
$io = array ("" => "$homedir", "dir" => "$homedir/dir", "dir/file" => "$homedir/dir/file", "dir/dir2" => "$homedir/dir/dir2", "dir/dir2/file" => "$homedir/dir/dir2/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$homedir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $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)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i))) != $o)
{ {
echo "<br>getabsolutepath - $cd - $i - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd - $i - $o - $ao";
} }
} }
$sequence_num = 2;
$cd = "test"; $cd = "test";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE)
)
);
$io = array ("" => "/test", "dir" => "/test/dir", "dir/file" => "/test/dir/file", "dir/dir2" => "/test/dir/dir2", "dir/dir2/file" => "/test/dir/dir2/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "/test/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $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)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i))) != $o)
{ {
echo "<br>getabsolutepath - $cd - $i - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd - $i - $o - $ao";
} }
} }
$sequence_num = 3;
$cd = "test/test2/test3"; $cd = "test/test2/test3";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE)
)
);
$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/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $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)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i))) != $o)
{ {
echo "<br>getabsolutepath - $cd - $i - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd - $i - $o - $ao";
} }
} }
/* Actually means cd to home directory */ /* Actually means cd to home directory */
$sequence_num = 4;
$cd = ""; $cd = "";
$phpgw->vfs->cd ($cd); $phpgw->vfs->cd (array(
'string' => $cd,
)
);
$relatives = array (RELATIVE_USER); $relatives = array (RELATIVE_USER);
$io = array ("" => "$homedir", "dir" => "$homedir/dir", "dir/file" => "$homedir/dir/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$homedir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $io = array ("" => "$homedir", "dir" => "$homedir/dir", "dir/file" => "$homedir/dir/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$homedir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives))) != $o)
{ {
echo "<br>getabsolutepath - $cd - $i - $relatives[0] - $o - $ao"; echo '<br><b>HERE</b>';
echo "<br>$sequence_num - getabsolutepath - $cd - $i - $relatives[0] - $o - $ao";
} }
} }
/* $cd shouldn't affect this test, but we'll set it anyways */ /* $cd shouldn't affect this test, but we'll set it anyways */
$sequence_num = 5;
$cd = "test2/test4"; $cd = "test2/test4";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE),
)
);
$relatives = array (RELATIVE_NONE); $relatives = array (RELATIVE_NONE);
$io = array ("" => "", "dir" => "dir", "dir/file" => "dir/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $io = array ("" => "", "dir" => "dir", "dir/file" => "dir/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives))) != $o)
{ {
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
} }
} }
/* $cd shouldn't affect this test, but we'll set it anyways */ /* $cd shouldn't affect this test, but we'll set it anyways */
$sequence_num = 6;
$cd = "test3/test5"; $cd = "test3/test5";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE),
)
);
$relatives = array (RELATIVE_USER_APP); $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/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $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)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives))) != $o)
{ {
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
} }
} }
/* $cd shouldn't affect this test, but we'll set it anyways */ /* $cd shouldn't affect this test, but we'll set it anyways */
$sequence_num = 7;
$cd = "test4/test6"; $cd = "test4/test6";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE)
)
);
$relatives = array (RELATIVE_ROOT); $relatives = array (RELATIVE_ROOT);
$io = array ("" => "", "dir" => "/dir", "/dir/dir2/dir3" => "/dir/dir2/dir3", "dir/file" => "/dir/file", "dir/dir2/dir3" => "/dir/dir2/dir3", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?"); $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)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives))) != $o)
{ {
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
} }
} }
/* Now a few to test the VFS_REAL capabilities */ /* Now a few to test the VFS_REAL capabilities */
$sequence_num = 8;
$cd = ""; $cd = "";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE)
)
);
$relatives = array (RELATIVE_ROOT|VFS_REAL); $relatives = array (RELATIVE_ROOT|VFS_REAL);
$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" . "|[{]};:'\",<.>?"); $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" . "|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives, 'fake' =>False))) != $o)
{ {
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
} }
} }
$sequence_num = 9;
$cd = "test5/test7"; $cd = "test5/test7";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE)
)
);
$relatives = array (RELATIVE_USER|VFS_REAL); $relatives = array (RELATIVE_USER|VFS_REAL);
$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" . "|[{]};:'\",<.>?"); $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" . "|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives, 'fake' => False))) != $o)
{ {
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
} }
} }
$sequence_num = 10;
$cd = "test6/test8"; $cd = "test6/test8";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_USER)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_USER)
)
);
/* RELATIVE_CURRENT should be implied */ /* RELATIVE_CURRENT should be implied */
$relatives = array (VFS_REAL); $relatives = array (VFS_REAL);
$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" . "|[{]};:'\",<.>?"); $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" . "|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives, 'fake' => False))) != $o)
{ {
echo "<br>getabsolutepath - $cd - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd - $i - $relatives[0] - $o - $ao";
} }
} }
$sequence_num = 11;
$cd = "test7/test9"; $cd = "test7/test9";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_USER)); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_USER)
)
);
$relatives = array (RELATIVE_USER_APP|VFS_REAL); $relatives = array (RELATIVE_USER_APP|VFS_REAL);
$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" . "|[{]};:'\",<.>?"); $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" . "|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io)) while (list ($i, $o) = each ($io))
{ {
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o) if (($ao = $phpgw->vfs->getabsolutepath (array ('string' => $i, 'mask' => $relatives, 'fake' => False))) != $o)
{ {
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao"; echo "<br>$sequence_num - getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
} }
} }
@ -182,20 +244,26 @@ $io = array ("" => array ("fake_full_path" => "", "fake_leading_dirs" => "", "fa
`~!@#$%^&*()-_=+/|[{]};:'\",<.>? `~!@#$%^&*()-_=+/|[{]};:'\",<.>?
*/ */
$sequence_num = 12;
$cd = "test8/test10"; $cd = "test8/test10";
$relatives[0] = RELATIVE_USER; $relatives[0] = RELATIVE_USER;
$phpgw->vfs->cd ($cd, False, array ($relatives[0])); $phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array ($relatives[0])
)
);
$subhome = substr ($homedir, 1); $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" => "|[{]};:'\",<.>?")); $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)) while (list ($i, $o) = each ($io))
{ {
$ao = $phpgw->vfs->path_parts ($i); $ao = $phpgw->vfs->path_parts (array ('string' => $i));
while (list ($key, $value) = each ($o)) while (list ($key, $value) = each ($o))
{ {
if ($ao->$key != $o[$key]) if ($ao->$key != $o[$key])
{ {
echo "<br>path_parts - $cd - $i - $relatives[0] - $key - $o[$key] - $ao[$key]"; echo "<br>$sequence_num - path_parts - $cd - $i - $relatives[0] - $key - $o[$key] - $ao[$key]";
} }
} }
} }