2001-06-25 09:28:51 +02:00
|
|
|
<?php
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
###
|
|
|
|
# Enable this to display some debugging info
|
|
|
|
###
|
|
|
|
|
|
|
|
$phpwh_debug = 0;
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
@reset ($GLOBALS['HTTP_POST_VARS']);
|
2001-08-24 10:08:06 +02:00
|
|
|
while (list ($name,) = each ($GLOBALS['HTTP_POST_VARS']))
|
|
|
|
{
|
|
|
|
$$name = $GLOBALS['HTTP_POST_VARS'][$name];
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
@reset ($GLOBALS['HTTP_GET_VARS']);
|
|
|
|
while (list ($name,) = each ($GLOBALS['HTTP_GET_VARS']))
|
|
|
|
{
|
|
|
|
$$name = $GLOBALS['HTTP_GET_VARS'][$name];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
$to_decode = array
|
|
|
|
(
|
|
|
|
/*
|
|
|
|
Decode
|
|
|
|
'var' when 'avar' == 'value'
|
2001-08-28 09:54:21 +02:00
|
|
|
or
|
|
|
|
'var' when 'var' is set
|
2001-08-24 10:08:06 +02:00
|
|
|
*/
|
|
|
|
'op' => array ('op' => ''),
|
|
|
|
'path' => array ('path' => ''),
|
|
|
|
'file' => array ('file' => ''),
|
|
|
|
'sortby' => array ('sortby' => ''),
|
|
|
|
'fileman' => array ('fileman' => ''),
|
2001-08-28 09:54:21 +02:00
|
|
|
'messages' => array ('messages' => ''),
|
2001-08-24 10:08:06 +02:00
|
|
|
'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))
|
|
|
|
{
|
2001-08-28 09:54:21 +02:00
|
|
|
$temp = array ();
|
2001-08-24 10:08:06 +02:00
|
|
|
while (list ($varkey, $varvalue) = each ($$var))
|
|
|
|
{
|
|
|
|
if (is_int ($varkey))
|
|
|
|
{
|
|
|
|
$temp[$varkey] = stripslashes (base64_decode ($varvalue));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$temp[stripslashes (base64_decode ($varkey))] = $varvalue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$$var = $temp;
|
|
|
|
}
|
|
|
|
elseif (isset ($$var))
|
|
|
|
{
|
|
|
|
$$var = stripslashes (base64_decode ($$var));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($noheader || $nofooter || ($download && (count ($fileman) > 0)) || ($op == 'view' && $file) || ($op == 'history' && $file) || ($op == 'help' && $help_name))
|
2001-06-25 21:46:52 +02:00
|
|
|
{
|
|
|
|
$noheader = True;
|
2001-08-28 09:54:21 +02:00
|
|
|
$nofooter = True;
|
2001-06-25 21:46:52 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw_info']['flags'] = array
|
2001-08-24 10:08:06 +02:00
|
|
|
(
|
2001-12-10 05:04:56 +01:00
|
|
|
'currentapp' => 'phpwebhosting',
|
|
|
|
'noheader' => $noheader,
|
|
|
|
'nofooter' => $nofooter,
|
|
|
|
'noappheader' => False,
|
|
|
|
'enable_vfs_class' => True,
|
|
|
|
'enable_browser_class' => True
|
2001-08-24 10:08:06 +02:00
|
|
|
);
|
2001-06-25 21:46:52 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
include ('../header.inc.php');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-08-28 09:54:21 +02:00
|
|
|
if ($execute && $command_line)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($result = $GLOBALS['phpgw']->vfs->command_line (stripslashes ($command_line)))
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$messages = html_text_bold ('Command sucessfully run', 1);
|
2001-08-28 09:54:21 +02:00
|
|
|
if ($result != 1 && strlen ($result) > 0)
|
|
|
|
{
|
|
|
|
$messages .= html_break (2, NULL, 1) . $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$messages = $GLOBALS['phpgw']->common->error_list (array ('Error running command'));
|
2001-08-28 09:54:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# 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
|
|
|
|
###
|
|
|
|
|
2001-06-14 01:19:13 +02:00
|
|
|
if ($go)
|
|
|
|
{
|
|
|
|
$path = $todir;
|
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
if (!$path)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$path = $GLOBALS['phpgw']->vfs->pwd ();
|
2001-08-24 10:08:06 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$path || $GLOBALS['phpgw']->vfs->pwd (False) == '')
|
2001-08-24 10:08:06 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$path = $GLOBALS['homedir'];
|
2001-08-24 10:08:06 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->cd (False, False, array (RELATIVE_NONE));
|
|
|
|
$GLOBALS['phpgw']->vfs->cd ($path, False, array (RELATIVE_NONE));
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$pwd = $GLOBALS['phpgw']->vfs->pwd ();
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$cwd = substr ($path, strlen ($GLOBALS['homedir']) + 1))
|
2001-08-24 10:08:06 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$cwd = '/';
|
2001-08-24 10:08:06 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
else
|
2001-08-24 10:08:06 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$cwd = substr ($pwd, strrpos ($pwd, '/') + 1);
|
2001-08-24 10:08:06 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
$disppath = $path;
|
|
|
|
|
|
|
|
/* This just prevents // in some cases */
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path == '/')
|
|
|
|
$dispsep = '';
|
2001-05-21 03:09:20 +02:00
|
|
|
else
|
2001-12-10 05:04:56 +01:00
|
|
|
$dispsep = '/';
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!($lesspath = substr ($path, 0, strrpos ($path, '/'))))
|
|
|
|
$lesspath = '/';
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$now = date ('Y-m-d');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
if ($phpwh_debug)
|
|
|
|
{
|
|
|
|
echo "<b>PHPWebHosting debug:</b><br>
|
|
|
|
path: $path<br>
|
|
|
|
disppath: $disppath<br>
|
|
|
|
cwd: $cwd<br>
|
|
|
|
lesspath: $lesspath
|
|
|
|
<p>
|
|
|
|
<b>phpGW debug:</b><br>
|
2001-12-10 05:04:56 +01:00
|
|
|
real getabsolutepath: " . $GLOBALS['phpgw']->vfs->getabsolutepath (False, False, False) . "<br>
|
|
|
|
fake getabsolutepath: " . $GLOBALS['phpgw']->vfs->getabsolutepath (False) . "<br>
|
|
|
|
appsession: " . $GLOBALS['phpgw']->session->appsession ('vfs','') . "<br>
|
|
|
|
pwd: " . $GLOBALS['phpgw']->vfs->pwd () . "<br>";
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
2001-06-05 08:35:56 +02:00
|
|
|
###
|
|
|
|
# Get their memberships to be used throughout the script
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$memberships = $GLOBALS['phpgw']->accounts->membership ($GLOBALS['userinfo']['username']);
|
2001-06-05 08:35:56 +02:00
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
if (!is_array ($memberships))
|
|
|
|
{
|
|
|
|
$memberships = array ();
|
|
|
|
}
|
|
|
|
|
2001-06-25 10:37:55 +02:00
|
|
|
while (list ($num, $group_array) = each ($memberships))
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$membership_id = $GLOBALS['phpgw']->accounts->name2id ($group_array['account_name']);
|
2001-06-25 10:37:55 +02:00
|
|
|
|
|
|
|
$group_applications = CreateObject('phpgwapi.applications', $membership_id);
|
2001-12-10 05:04:56 +01:00
|
|
|
$membership_applications[$group_array['account_name']] = $group_applications->read_account_specific ();
|
2001-06-25 10:37:55 +02:00
|
|
|
}
|
|
|
|
|
2001-06-05 08:35:56 +02:00
|
|
|
###
|
2001-07-04 11:02:51 +02:00
|
|
|
# We determine if they're in their home directory or a group's directory,
|
|
|
|
# and set the VFS working_id appropriately
|
2001-06-05 08:35:56 +02:00
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ((preg_match ('+^'.$GLOBALS['fakebase'].'\/(.*)(\/|$)+U', $path, $matches)) && $matches[1] != $GLOBALS['userinfo']['account_lid'])
|
2001-06-05 08:35:56 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id ($matches[1]);
|
2001-06-05 08:35:56 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->working_id = $GLOBALS['userinfo']['username'];
|
2001-06-05 08:35:56 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != $GLOBALS['homedir'] && $path != $GLOBALS['fakebase'] && $path != '/' && !$GLOBALS['phpgw']->vfs->acl_check ($path, array (RELATIVE_NONE), PHPGW_ACL_READ))
|
2001-07-04 11:02:51 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('You do not have access to '.$path));
|
2001-07-04 11:02:51 +02:00
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$GLOBALS['homedir'], 'Go to your home directory');
|
2001-07-04 11:02:51 +02:00
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['userinfo']['working_id'] = $GLOBALS['phpgw']->vfs->working_id;
|
|
|
|
$GLOBALS['userinfo']['working_lid'] = $GLOBALS['phpgw']->accounts->id2name ($GLOBALS['userinfo']['working_id']);
|
2001-06-05 08:35:56 +02:00
|
|
|
|
2001-06-04 00:40:59 +02:00
|
|
|
###
|
|
|
|
# If their home directory doesn't exist, we create it
|
2001-06-05 08:35:56 +02:00
|
|
|
# Same for group directories
|
2001-06-04 00:40:59 +02:00
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (($path == $GLOBALS['homedir']) && !$GLOBALS['phpgw']->vfs->file_exists ($GLOBALS['homedir'], array (RELATIVE_NONE)))
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
// $GLOBALS['phpgw']->vfs->override_acl = 1;
|
|
|
|
$GLOBALS['phpgw']->vfs->mkdir ($GLOBALS['homedir'], array (RELATIVE_NONE));
|
|
|
|
// $GLOBALS['phpgw']->vfs->override_acl = 0;
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
2001-12-10 05:04:56 +01:00
|
|
|
elseif (preg_match ('|^'.$GLOBALS['fakebase'].'\/(.*)$|U', $path, $matches))
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$GLOBALS['phpgw']->vfs->file_exists ($path, array (RELATIVE_NONE)))
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
// $GLOBALS['phpgw']->vfs->override_acl = 1;
|
|
|
|
$GLOBALS['phpgw']->vfs->mkdir ($path, array (RELATIVE_NONE));
|
|
|
|
// $GLOBALS['phpgw']->vfs->override_acl = 0;
|
2001-06-04 00:40:59 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$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));
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# Verify path is real
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != $GLOBALS['homedir'] && $path != '/' && $path != $GLOBALS['fakebase'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$GLOBALS['phpgw']->vfs->file_exists ($path, array (RELATIVE_NONE)))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Directory '.$path.' does not exist'));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$GLOBALS['homedir'], 'Go to your home directory');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-13 07:17:08 +02:00
|
|
|
/* Update if they request it, or one out of 20 page loads */
|
|
|
|
srand ((double) microtime() * 1000000);
|
|
|
|
if ($update || rand (0, 19) == 4)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->update_real ($path, array (RELATIVE_NONE));
|
2001-07-13 07:17:08 +02:00
|
|
|
}
|
2001-07-10 23:38:21 +02:00
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
###
|
|
|
|
# Default is to sort by name
|
|
|
|
###
|
|
|
|
|
|
|
|
if (!$sortby)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$sortby = 'name';
|
2001-08-24 10:08:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Decide how many upload boxes to show
|
|
|
|
###
|
|
|
|
|
|
|
|
if (!$show_upload_boxes || $show_upload_boxes <= 0)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$show_upload_boxes = $GLOBALS['settings']['show_upload_boxes'])
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
|
|
|
$show_upload_boxes = 5;
|
|
|
|
}
|
2001-08-24 10:08:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# Read in file info from database to use in the rest of the script
|
2001-06-04 00:40:59 +02:00
|
|
|
# $fakebase is a special directory. In that directory, we list the user's
|
|
|
|
# home directory and the directories for the groups they're in
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$numoffiles = 0;
|
|
|
|
if ($path == $GLOBALS['fakebase'])
|
2001-05-25 04:14:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$GLOBALS['phpgw']->vfs->file_exists ($GLOBALS['homedir'], array (RELATIVE_NONE)))
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->mkdir ($GLOBALS['homedir'], array (RELATIVE_NONE));
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($GLOBALS['homedir'], array (RELATIVE_NONE), False, False, True);
|
2001-07-04 11:02:51 +02:00
|
|
|
$files_array[] = $ls_array[0];
|
2001-05-25 04:14:20 +02:00
|
|
|
$numoffiles++;
|
2001-12-10 05:04:56 +01:00
|
|
|
// $files_array = $ls_array;
|
|
|
|
// $numoffiles = count($ls_array);
|
2001-05-25 04:14:20 +02:00
|
|
|
|
2001-06-05 08:35:56 +02:00
|
|
|
reset ($memberships);
|
|
|
|
while (list ($num, $group_array) = each ($memberships))
|
2001-05-25 04:14:20 +02:00
|
|
|
{
|
2001-06-25 10:37:55 +02:00
|
|
|
###
|
|
|
|
# If the group doesn't have access to this app, we don't show it
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$membership_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
|
2001-06-25 10:37:55 +02:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$GLOBALS['phpgw']->vfs->file_exists ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE)))
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->mkdir ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE));
|
|
|
|
$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']));
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($GLOBALS['fakebase'].'/'.$group_array['account_name'], array (RELATIVE_NONE), False, False, True);
|
2001-07-22 10:12:08 +02:00
|
|
|
|
2001-07-04 11:02:51 +02:00
|
|
|
$files_array[] = $ls_array[0];
|
2001-06-04 00:40:59 +02:00
|
|
|
|
2001-05-25 04:14:20 +02:00
|
|
|
$numoffiles++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path, array (RELATIVE_NONE), False, False, False, $sortby);
|
|
|
|
|
|
|
|
if ($phpwh_debug)
|
|
|
|
{
|
|
|
|
echo '# of files found in "'.$path.'" : '.count($ls_array).'<br>'."\n";
|
|
|
|
}
|
2001-05-25 04:14:20 +02:00
|
|
|
|
2001-07-10 23:38:21 +02:00
|
|
|
while (list ($num, $file_array) = each ($ls_array))
|
|
|
|
{
|
|
|
|
$numoffiles++;
|
|
|
|
$files_array[] = $file_array;
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($phpwh_debug)
|
|
|
|
{
|
|
|
|
echo 'Filename: '.$file_array['name'].'<br>'."\n";
|
|
|
|
}
|
2001-07-10 23:38:21 +02:00
|
|
|
}
|
2001-05-25 04:14:20 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
if (!is_array ($files_array))
|
|
|
|
{
|
|
|
|
$files_array = array ();
|
|
|
|
}
|
|
|
|
|
2001-06-25 23:13:18 +02:00
|
|
|
if ($download)
|
|
|
|
{
|
|
|
|
for ($i = 0; $i != $numoffiles; $i++)
|
|
|
|
{
|
|
|
|
if (!$fileman[$i])
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$download_browser = CreateObject ('phpgwapi.browser');
|
2001-08-24 10:08:06 +02:00
|
|
|
$download_browser->content_header ($fileman[$i]);
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->vfs->read ($fileman[$i]);
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit ();
|
2001-06-25 23:13:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($op == 'view' && $file)
|
2001-06-25 23:13:18 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
// $ls_array = $GLOBALS['phpgw']->vfs->ls ($path.'/'.$file, array (RELATIVE_ALL), False, False, True);
|
|
|
|
|
|
|
|
// if ($ls_array[0]['mime_type'])
|
|
|
|
// {
|
|
|
|
// $mime_type = $ls_array[0]['mime_type'];
|
|
|
|
// }
|
|
|
|
// elseif ($GLOBALS['settings']['viewtextplain'])
|
|
|
|
// {
|
|
|
|
// $mime_type = 'text/plain';
|
|
|
|
// }
|
|
|
|
|
|
|
|
Header('Content-length: '.$GLOBALS['phpgw']->vfs->get_size($path.'/'.$file,array(RELATIVE_ALL)));
|
|
|
|
Header('Content-type: '.$GLOBALS['phpgw']->vfs->file_type($path.'/'.$file,array(RELATIVE_ALL)));
|
|
|
|
Header('Content-disposition: attachment; filename="'.$file.'"');
|
|
|
|
echo $GLOBALS['phpgw']->vfs->read($path.'/'.$file,array(RELATIVE_ALL));
|
|
|
|
flush();
|
|
|
|
|
|
|
|
// header('Content-type: ' . $mime_type);
|
|
|
|
// echo $GLOBALS['phpgw']->vfs->read ($path.'/'.$file);
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit ();
|
2001-06-25 23:13:18 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($op == 'history' && $file)
|
2001-07-13 07:17:08 +02:00
|
|
|
{
|
|
|
|
html_table_begin ();
|
|
|
|
html_table_row_begin ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Date');
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Version');
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Who');
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Operation');
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$journal_array = $GLOBALS['phpgw']->vfs->get_journal ($file, array (RELATIVE_ALL));
|
2001-07-13 07:17:08 +02:00
|
|
|
while (list ($num, $journal_entry) = each ($journal_array))
|
|
|
|
{
|
|
|
|
html_table_row_begin ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($journal_entry['created'] . html_nbsp (3, 1));
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($journal_entry['version'] . html_nbsp (3, 1));
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($GLOBALS['phpgw']->accounts->id2name ($journal_entry['owner_id']) . html_nbsp (3, 1));
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($journal_entry['comment']);
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
html_table_end ();
|
2001-08-28 09:54:21 +02:00
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($newfile && $createfile)
|
|
|
|
{
|
|
|
|
if ($badchar = bad_chars ($createfile, True, True))
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array (html_encode ('Filenames cannot contain "'.$badchar.'"', 1)));
|
2001-08-28 09:54:21 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->file_exists ($createfile, array (RELATIVE_ALL)))
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('File '.$createfile.' already exists. Please edit it or delete it first.'));
|
2001-08-28 09:54:21 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->touch ($createfile, array (RELATIVE_ALL)))
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
|
|
|
$fileman = array ();
|
|
|
|
$fileman[0] = $createfile;
|
|
|
|
$edit = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('File '.$createfile.' could not be created.'));
|
2001-08-28 09:54:21 +02:00
|
|
|
}
|
2001-07-13 07:17:08 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($op == 'help' && $help_name)
|
2001-07-22 10:12:08 +02:00
|
|
|
{
|
|
|
|
while (list ($num, $help_array) = each ($help_info))
|
|
|
|
{
|
|
|
|
if ($help_array[0] != $help_name)
|
|
|
|
continue;
|
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
$help_array[1] = preg_replace ("/\[(.*)\|(.*)\]/Ue", "html_help_link ('\\1', '\\2', False, True)", $help_array[1]);
|
|
|
|
$help_array[1] = preg_replace ("/\[(.*)\]/Ue", "html_help_link ('\\1', '\\1', False, True)", $help_array[1]);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_font_set ('4');
|
|
|
|
$title = ereg_replace ('_', ' ', $help_array[0]);
|
2001-07-22 10:12:08 +02:00
|
|
|
$title = ucwords ($title);
|
|
|
|
html_text ($title);
|
|
|
|
html_font_end ();
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_font_set ('2');
|
2001-07-22 10:12:08 +02:00
|
|
|
html_text ($help_array[1]);
|
|
|
|
html_font_end ();
|
|
|
|
}
|
2001-08-24 10:08:06 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit ();
|
2001-07-22 10:12:08 +02:00
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# Start Main Page
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_page_begin ('Users :: '.$GLOBALS['userinfo']['username']);
|
2001-08-28 09:54:21 +02:00
|
|
|
html_page_body_begin (HTML_PAGE_BODY_COLOR);
|
|
|
|
|
|
|
|
if ($messages)
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-08-28 09:54:21 +02:00
|
|
|
html_text ($messages);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!is_array ($GLOBALS['settings']))
|
2001-08-24 10:08:06 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$pref = CreateObject ('phpgwapi.preferences', $GLOBALS['userinfo']['username']);
|
|
|
|
$GLOBALS['phpgw']->common->hook_single ('add_def_pref', $GLOBALS['appname']);
|
2001-08-24 10:08:06 +02:00
|
|
|
$pref->save_repository (True);
|
|
|
|
$pref_array = $pref->read_repository ();
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['settings'] = $pref_array[$GLOBALS['appname']];
|
2001-08-24 10:08:06 +02:00
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# Start Main Table
|
|
|
|
###
|
|
|
|
|
|
|
|
if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$edit && !$comment_files)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_begin ('100%');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_row_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('center', NULL, 'top');
|
|
|
|
html_align ('center');
|
|
|
|
html_form_begin ($GLOBALS['appname'].'/index.php?path='.$path);
|
2001-05-21 03:09:20 +02:00
|
|
|
if ($numoffiles || $cwd)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
while (list ($num, $name) = each ($GLOBALS['settings']))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
if ($name)
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-05-21 03:09:20 +02:00
|
|
|
$columns++;
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
$columns++;
|
|
|
|
html_table_begin ();
|
|
|
|
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_HEADER_BG_COLOR);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('center', NULL, NULL, NULL, $columns);
|
|
|
|
html_table_begin ('100%');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_row_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('left');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != '/')
|
2001-07-22 10:12:08 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$lesspath, html_image ('images/folder-up.gif', 'Up', 'left', 0, NULL, 1));
|
|
|
|
html_help_link ('up');
|
2001-07-22 10:12:08 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_table_col_end ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('center');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
if ($cwd)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path == $GLOBALS['homedir'])
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/folder-home.gif', 'Folder', 'center');
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
else
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/folder.gif', 'Folder', 'center');
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/folder-home.gif', 'Home');
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_font_set (4, HTML_TABLE_FILES_HEADER_TEXT_COLOR);
|
|
|
|
html_text_bold (strtoupper ($disppath));
|
|
|
|
html_font_end ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_help_link ('directory_name');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('right');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != $GLOBALS['homedir'])
|
2001-07-22 10:12:08 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$GLOBALS['homedir'], html_image ('images/folder-home.gif', 'Home', 'right', 0, NULL, 1));
|
|
|
|
html_help_link ('home');
|
2001-07-22 10:12:08 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
html_table_end ();
|
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_COLUMN_HEADER_BG_COLOR);
|
|
|
|
|
|
|
|
###
|
|
|
|
# Start File Table Column Headers
|
|
|
|
# Reads values from $file_attributes array and preferences
|
|
|
|
###
|
|
|
|
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ('Sort by:' . html_nbsp (1, 1), NULL, NULL, 1);
|
|
|
|
html_help_link ('sort_by');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
|
|
|
|
reset ($file_attributes);
|
|
|
|
while (list ($internal, $displayed) = each ($file_attributes))
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings'][$internal])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$path.'&sortby='.$internal, html_text_bold ($displayed, 1, 1));
|
|
|
|
html_help_link (strtolower (ereg_replace (' ', '_', $displayed)));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_table_col_begin ();
|
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['dotdot'] && $GLOBALS['settings']['name'] && $path != '/')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_row_begin ();
|
|
|
|
html_table_col_begin ();
|
|
|
|
html_table_col_end ();
|
|
|
|
|
|
|
|
/* We can assume the next column is the name */
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/folder.gif', 'Folder');
|
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$lesspath, '..');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['mime_type'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ('Directory');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
html_table_row_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# List all of the files, with their attributes
|
|
|
|
###
|
|
|
|
|
2001-05-25 04:14:20 +02:00
|
|
|
reset ($files_array);
|
2001-05-21 03:09:20 +02:00
|
|
|
for ($i = 0; $i != $numoffiles; $i++)
|
|
|
|
{
|
2001-05-25 04:14:20 +02:00
|
|
|
$files = $files_array[$i];
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
if ($rename || $edit_comments)
|
|
|
|
{
|
|
|
|
unset ($this_selected);
|
|
|
|
unset ($renamethis);
|
|
|
|
unset ($edit_this_comment);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
for ($j = 0; $j != $numoffiles; $j++)
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileman[$j] == $files['name'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$this_selected = 1;
|
2001-05-21 03:09:20 +02:00
|
|
|
break;
|
|
|
|
}
|
2001-12-10 05:04:56 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
if ($rename && $this_selected)
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-05-21 03:09:20 +02:00
|
|
|
$renamethis = 1;
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
elseif ($edit_comments && $this_selected)
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-05-21 03:09:20 +02:00
|
|
|
$edit_this_comment = 1;
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$GLOBALS['settings']['dotfiles'] && ereg ("^\.", $files['name']))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_BG_COLOR);
|
|
|
|
|
|
|
|
###
|
|
|
|
# Checkboxes
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('right');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$rename && !$edit_comments && $path != $GLOBALS['fakebase'] && $path != '/')
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('checkbox', 'fileman['.$i.']', base64_encode ($files['name']));
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
elseif ($renamethis)
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('hidden', 'fileman[' . base64_encode ($files['name']) . ']', $files['name'], NULL, NULL, 'checked');
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
else
|
2001-06-04 00:40:59 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_nbsp();
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_table_col_end ();
|
|
|
|
|
|
|
|
###
|
|
|
|
# File name and icon
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['name'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($phpwh_debug)
|
|
|
|
{
|
|
|
|
echo 'Setting file name: '.$files['name'].'<br>'."\n";
|
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_begin ();
|
|
|
|
|
|
|
|
if ($renamethis)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['mime_type'] == 'Directory')
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/folder.gif', 'Folder');
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('text', 'renamefiles[' . base64_encode ($files['name']) . ']', $files['name'], 255);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['mime_type'] == 'Directory')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/folder.gif', 'Folder');
|
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$path.$dispsep.$files['name'], $files['name']);
|
|
|
|
}
|
2001-06-04 00:40:59 +02:00
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['viewonserver'] && isset ($GLOBALS['filesdir']) && !$files['link_directory'])
|
2001-06-25 23:13:18 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$clickview = $GLOBALS['filesdir'].$pwd.'/'.$files['name'];
|
|
|
|
echo 'Setting clickview = '.$clickview.'<br>'."\n";
|
2001-06-25 23:13:18 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$clickview = $GLOBALS['appname'].'/index.php?op=view&file='.$files['name'].'&path='.$path;
|
2001-06-25 23:13:18 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['viewinnewwin'])
|
2001-06-25 23:13:18 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$target = '_new';
|
2001-06-25 23:13:18 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($clickview, $files['name'], 0, 1, 0, $target);
|
2001-06-04 00:40:59 +02:00
|
|
|
}
|
2001-12-10 05:04:56 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# MIME type
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['mime_type'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($files['mime_type']);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# File size
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['size'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$size = $GLOBALS['phpgw']->vfs->get_size ($files['directory'] . '/' . $files['name'], array (RELATIVE_NONE));
|
2001-07-10 23:38:21 +02:00
|
|
|
borkb ($size);
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Date created
|
|
|
|
###
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['created'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($files['created']);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Date modified
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['modified'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['modified'] != '0000-00-00')
|
2001-11-12 06:04:16 +01:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($files['modified']);
|
2001-11-12 06:04:16 +01:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Owner name
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['owner'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($GLOBALS['phpgw']->accounts->id2name ($files['owner_id']));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Creator name
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['createdby_id'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['createdby_id'])
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($GLOBALS['phpgw']->accounts->id2name ($files['createdby_id']));
|
2001-08-28 09:54:21 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Modified by name
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['modifiedby_id'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['modifiedby_id'])
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($GLOBALS['phpgw']->accounts->id2name ($files['modifiedby_id']));
|
2001-08-28 09:54:21 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Application
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['app'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($files['app']);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Comment
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['comment'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
|
|
|
if ($edit_this_comment)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('text', 'comment_files[' . base64_encode ($files['name']) . ']', html_encode ($files['comment'], 1), 255);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ($files['comment']);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
2001-07-13 07:17:08 +02:00
|
|
|
###
|
|
|
|
# Version
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['version'])
|
2001-07-13 07:17:08 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?op=history&file='.$files['name'].'&path='.$path, $files['version'], NULL, True, NULL, '_new');
|
2001-07-13 07:17:08 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# Deleteable (currently not used)
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['deleteable'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['deleteable'] == 'N')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_image ('images/locked.gif', 'Locked');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
html_table_col_begin ();
|
|
|
|
html_table_col_end ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_table_row_end ();
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($files['mime_type'] == 'Directory')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
$usedspace += $fileinfo[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$usedspace += $files['size'];
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_table_end ();
|
|
|
|
html_break (2);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != '/' && $path != $GLOBALS['fakebase'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-06-14 23:23:05 +02:00
|
|
|
if (!$rename && !$edit_comments)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'edit', 'Edit');
|
|
|
|
html_help_link ('edit');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_nbsp (3);
|
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-06-14 23:23:05 +02:00
|
|
|
if (!$edit_comments)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'rename', 'Rename');
|
|
|
|
html_help_link ('rename');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_nbsp (3);
|
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-06-14 23:23:05 +02:00
|
|
|
if (!$rename && !$edit_comments)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'delete', 'Delete');
|
|
|
|
html_help_link ('delete');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_nbsp (3);
|
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-06-14 23:23:05 +02:00
|
|
|
if (!$rename)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'edit_comments', 'Edit comments');
|
|
|
|
html_help_link ('edit_comments');
|
2001-06-14 23:23:05 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Display some inputs and info, but not when renaming or editing comments
|
|
|
|
###
|
|
|
|
|
|
|
|
if (!$rename && !$edit_comments)
|
|
|
|
{
|
|
|
|
###
|
|
|
|
# Begin Copy to/Move to selection
|
|
|
|
###
|
|
|
|
|
|
|
|
html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'go', 'Go to:');
|
|
|
|
html_help_link ('go_to');
|
2001-06-14 10:53:03 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != '/' && $path != $GLOBALS['fakebase'])
|
2001-06-14 23:23:05 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'copy', 'Copy to:');
|
|
|
|
html_help_link ('copy_to');
|
2001-06-14 23:23:05 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'move', 'Move to:');
|
|
|
|
html_help_link ('move_to');
|
2001-06-14 23:23:05 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_select_begin ('todir');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-06-14 01:19:13 +02:00
|
|
|
html_break (1);
|
|
|
|
|
2001-06-05 08:35:56 +02:00
|
|
|
###
|
|
|
|
# First we get the directories in their home directory
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $GLOBALS['userinfo']['account_lid']);
|
2001-06-05 08:35:56 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($GLOBALS['homedir'], array (RELATIVE_NONE), True, 'Directory');
|
2001-06-05 08:35:56 +02:00
|
|
|
while (list ($num, $dir) = each ($ls_array))
|
|
|
|
{
|
|
|
|
$dirs[] = $dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Then we get the directories in their membership's home directories
|
|
|
|
###
|
|
|
|
|
|
|
|
reset ($memberships);
|
|
|
|
while (list ($num, $group_array) = each ($memberships))
|
|
|
|
{
|
2001-06-25 10:37:55 +02:00
|
|
|
###
|
|
|
|
# Don't list directories for groups that don't have access
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$membership_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
|
2001-06-25 10:37:55 +02:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $group_array['account_name']);
|
2001-06-05 08:35:56 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $phpgw->vfs->ls ($GLOBALS['fakebase'].'/'.$group_array[account_name], array (RELATIVE_NONE), True, 'Directory');
|
2001-06-05 08:35:56 +02:00
|
|
|
while (list ($num, $dir) = each ($ls_array))
|
|
|
|
{
|
|
|
|
$dirs[] = $dir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
reset ($dirs);
|
|
|
|
while (list ($num, $dir) = each ($dirs))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if (!$dir['directory'])
|
2001-07-04 11:02:51 +02:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
# So we don't display //
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($dir['directory'] != '/')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$dir['directory'] .= '/';
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
###
|
2001-06-14 02:50:48 +02:00
|
|
|
# No point in displaying the current directory, or a directory that doesn't exist
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ((($dir['directory'] . $dir['name']) != $path) && $GLOBALS['phpgw']->vfs->file_exists ($dir['directory'] . $dir['name'], array (RELATIVE_NONE)))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_option ($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_form_select_end ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_help_link ('directory_list');
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != '/' && $path != $GLOBALS['fakebase'])
|
2001-06-14 23:23:05 +02:00
|
|
|
{
|
|
|
|
html_break (1);
|
2001-06-25 03:27:03 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'download', 'Download');
|
|
|
|
html_help_link ('download');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_nbsp (3);
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('text', 'createdir', NULL, 255, 15);
|
|
|
|
html_form_input ('submit', 'newdir', 'Create Folder');
|
|
|
|
html_help_link ('create_folder');
|
2001-06-14 23:23:05 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-07-13 07:17:08 +02:00
|
|
|
html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'update', 'Update');
|
|
|
|
html_help_link ('update');
|
2001-07-13 07:17:08 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != '/' && $path != $GLOBALS['fakebase'])
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
|
|
|
html_nbsp (3);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('text', 'createfile', NULL, 255, 15);
|
|
|
|
html_form_input ('submit', 'newfile', 'Create File');
|
|
|
|
html_help_link ('create_file');
|
2001-08-28 09:54:21 +02:00
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['settings']['show_command_line'])
|
2001-08-28 09:54:21 +02:00
|
|
|
{
|
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('text', 'command_line', NULL, NULL, 50);
|
|
|
|
html_help_link ('command_line');
|
2001-08-28 09:54:21 +02:00
|
|
|
|
2001-08-28 09:58:06 +02:00
|
|
|
html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'execute', 'Execute');
|
|
|
|
html_help_link ('execute');
|
2001-08-28 09:58:06 +02:00
|
|
|
}
|
2001-08-28 09:54:21 +02:00
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
html_form_end ();
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_help_link ('file_stats');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Files: ');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_text ($numoffiles);
|
|
|
|
html_nbsp (3);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Used space: ');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_text (borkb ($usedspace, NULL, 1));
|
|
|
|
html_nbsp (3);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path == $GLOBALS['homedir'] || $path == $GLOBALS['fakebase'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Unused space: ');
|
|
|
|
html_text (borkb ($GLOBALS['userinfo']['hdspace'] - $usedspace, NULL, 1));
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path, array (RELATIVE_NONE));
|
2001-07-10 23:38:21 +02:00
|
|
|
$i = count ($ls_array);
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Total Files: ');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_text ($i);
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
2001-08-24 10:08:06 +02:00
|
|
|
# Show file upload boxes. Note the last argument to html (). Repeats $show_upload_boxes times
|
2001-05-21 03:09:20 +02:00
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($path != '/' && $path != $GLOBALS['fakebase'])
|
2001-06-14 23:23:05 +02:00
|
|
|
{
|
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_begin ($GLOBALS['appname'].'/index.php?op=upload&path='.$path, 'post', 'multipart/form-data');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_row_begin ('center');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('File');
|
|
|
|
html_help_link ('upload_file');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Comment');
|
|
|
|
html_help_link ('upload_comment');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_row_begin ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('hidden', 'show_upload_boxes', base64_encode ($show_upload_boxes));
|
|
|
|
html (html_form_input ('file', 'upload_file[]', NULL, 255, NULL, NULL, NULL, 1) . html_break (1, NULL, 1), $show_upload_boxes);
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html (html_form_input ('text', 'upload_comment[]', NULL, NULL, NULL, NULL, NULL, 1) . html_break (1, NULL, 1), $show_upload_boxes);
|
2001-06-14 23:23:05 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
html_table_end ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'upload_files', 'Upload files');
|
|
|
|
html_help_link ('upload_files');
|
2001-08-24 10:08:06 +02:00
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ('Show' . html_nbsp (1, True));
|
|
|
|
html_link ($GLOBALS['appname'].'/index.php?show_upload_boxes=5', '5');
|
2001-08-24 10:08:06 +02:00
|
|
|
html_nbsp ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?show_upload_boxes=10', '10');
|
2001-08-24 10:08:06 +02:00
|
|
|
html_nbsp ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?show_upload_boxes=20', '20');
|
2001-08-24 10:08:06 +02:00
|
|
|
html_nbsp ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?show_upload_boxes=50', '50');
|
2001-08-24 10:08:06 +02:00
|
|
|
html_nbsp ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text ('upload fields');
|
2001-08-24 10:08:06 +02:00
|
|
|
html_nbsp ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_help_link ('show_upload_fields');
|
2001-06-14 23:23:05 +02:00
|
|
|
html_form_end ();
|
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
html_table_end ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle Editing files
|
|
|
|
###
|
|
|
|
|
|
|
|
if ($edit)
|
|
|
|
{
|
|
|
|
###
|
|
|
|
# If $edit is "Edit", we do nothing, and let the for loop take over
|
|
|
|
###
|
|
|
|
|
2001-06-14 01:19:13 +02:00
|
|
|
if ($edit_file)
|
|
|
|
{
|
2001-06-18 23:32:01 +02:00
|
|
|
$edit_file_content = stripslashes ($edit_file_content);
|
2001-06-14 01:19:13 +02:00
|
|
|
}
|
|
|
|
|
2001-05-21 03:09:20 +02:00
|
|
|
if ($edit_preview)
|
|
|
|
{
|
2001-06-18 23:32:01 +02:00
|
|
|
$content = $edit_file_content;
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Preview of '.$path.'/'.$edit_file);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_begin ('90%');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_row_begin ();
|
|
|
|
html_table_col_begin ();
|
|
|
|
html_text (nl2br ($content));
|
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
html_table_end ();
|
|
|
|
}
|
|
|
|
elseif ($edit_save)
|
|
|
|
{
|
2001-06-18 23:32:01 +02:00
|
|
|
$content = $edit_file_content;
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->write ($edit_file, array (RELATIVE_ALL), $content))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Saved '.$path.'/'.$edit_file);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
2001-06-04 00:40:59 +02:00
|
|
|
html_link_back ();
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_error ('Could not save '.$path.'/'.$edit_file);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
2001-06-04 00:40:59 +02:00
|
|
|
html_link_back ();
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This doesn't work just yet
|
|
|
|
elseif ($edit_save_all)
|
|
|
|
{
|
|
|
|
for ($j = 0; $j != $numoffiles; $j++)
|
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
$fileman[$j];
|
2001-06-04 00:40:59 +02:00
|
|
|
|
2001-12-20 03:11:29 +01:00
|
|
|
$content = $fileman[$j];
|
2001-12-10 05:04:56 +01:00
|
|
|
echo 'fileman['.$j.']: '.$fileman[$j].'<br><b>'.$content.'</b><br>';
|
2001-05-21 03:09:20 +02:00
|
|
|
continue;
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->write ($fileman[$j], array (RELATIVE_ALL), $content))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_bold ('Saved '.$path.'/'.$fileman[$j]);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_error ('Could not save '.$path.'/'.$fileman[$j]);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_break (1);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
###
|
|
|
|
# Now we display the edit boxes and forms
|
|
|
|
###
|
|
|
|
|
|
|
|
for ($j = 0; $j != $numoffiles; $j++)
|
|
|
|
{
|
2001-06-14 01:19:13 +02:00
|
|
|
###
|
|
|
|
# If we're in preview or save mode, we only show the file
|
|
|
|
# being previewed or saved
|
|
|
|
###
|
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
if ($edit_file && ($fileman[$j] != $edit_file))
|
2001-06-14 01:19:13 +02:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileman[$j] && $GLOBALS['phpgw']->vfs->file_exists ($fileman[$j], array (RELATIVE_ALL)))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-06-04 00:40:59 +02:00
|
|
|
if ($edit_file)
|
2001-06-18 23:32:01 +02:00
|
|
|
{
|
|
|
|
$content = stripslashes ($edit_file_content);
|
|
|
|
}
|
2001-06-14 10:53:03 +02:00
|
|
|
else
|
2001-06-18 23:32:01 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$content = $GLOBALS['phpgw']->vfs->read ($fileman[$j]);
|
2001-06-18 23:32:01 +02:00
|
|
|
}
|
2001-06-04 00:40:59 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_begin ('100%');
|
|
|
|
html_form_begin ($GLOBALS['appname'].'/index.php?path='.$path);
|
|
|
|
html_form_input ('hidden', 'edit', True);
|
|
|
|
html_form_input ('hidden', 'edit_file', $fileman[$j]);
|
2001-05-21 03:09:20 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
# We need to include all of the fileman entries for each file's form,
|
|
|
|
# so we loop through again
|
|
|
|
###
|
|
|
|
|
|
|
|
for ($i = 0; $i != $numoffiles; $i++)
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('hidden', 'fileman['.$i.']', base64_encode ($fileman[$i]));
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_table_row_begin ();
|
|
|
|
html_table_col_begin ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_textarea ('edit_file_content', 35, 75, $content);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
2001-12-10 05:04:56 +01:00
|
|
|
html_table_col_begin ('center');
|
|
|
|
html_form_input ('submit', 'edit_preview', 'Preview ' . html_encode ($fileman[$j], 1));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_form_input ('submit', 'edit_save', 'Save ' . html_encode ($fileman[$j], 1));
|
2001-05-21 03:09:20 +02:00
|
|
|
// html_break (1);
|
2001-12-10 05:04:56 +01:00
|
|
|
// html_form_input ('submit', 'edit_save_all', 'Save all');
|
2001-05-21 03:09:20 +02:00
|
|
|
html_table_col_end ();
|
|
|
|
html_table_row_end ();
|
|
|
|
html_break (2);
|
|
|
|
html_form_end ();
|
|
|
|
html_table_end ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle File Uploads
|
|
|
|
###
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
elseif ($op == 'upload' && $path != '/' && $path != $GLOBALS['fakebase'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
for ($i = 0; $i != $show_upload_boxes; $i++)
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
if ($badchar = bad_chars ($upload_file_name[$i], True, True))
|
2001-06-25 03:27:03 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array (html_encode ('Filenames cannot contain "'.$badchar.'"', 1)));
|
2001-07-10 23:38:21 +02:00
|
|
|
|
|
|
|
continue;
|
2001-06-25 03:27:03 +02:00
|
|
|
}
|
|
|
|
|
2001-07-10 23:38:21 +02:00
|
|
|
###
|
|
|
|
# Check to see if the file exists in the database, and get its info at the same time
|
|
|
|
###
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path . '/' . $upload_file_name[$i], array (RELATIVE_NONE), False, False, True);
|
2001-07-10 23:38:21 +02:00
|
|
|
$fileinfo = $ls_array[0];
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileinfo['name'])
|
2001-07-10 23:38:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileinfo['mime_type'] == 'Directory')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Cannot replace '.$fileinfo['name'].' because it is a directory'));
|
2001-07-10 23:38:21 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
if ($upload_file_size[$i] > 0)
|
2001-07-10 23:38:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileinfo['name'] && $fileinfo['deleteable'] != 'N')
|
2001-07-10 23:38:21 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$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->cp ($upload_file[$i], $upload_file_name[$i], array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Replaced '.$disppath.'/'.$upload_file_name[$i], $upload_file_size[$i]);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->cp ($upload_file[$i], $upload_file_name[$i], array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
|
|
|
|
$GLOBALS['phpgw']->vfs->set_attributes ($upload_file_name[$i], array (RELATIVE_ALL), array ('mime_type' => $upload_file_type[$i], 'comment' => stripslashes ($upload_comment[$i])));
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Created '.$disppath.'/'.$upload_file_name[$i], $upload_file_size[$i]);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
2001-08-24 10:08:06 +02:00
|
|
|
elseif ($upload_file_name[$i])
|
2001-06-14 10:53:03 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->touch ($upload_file_name[$i], array (RELATIVE_ALL));
|
|
|
|
$GLOBALS['phpgw']->vfs->set_attributes ($upload_file_name[$i], array (RELATIVE_ALL), array ('mime_type' => $upload_file_type[$i], 'comment' => $upload_comment[$i]));
|
2001-06-14 10:53:03 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Created '.$disppath.'/'.$upload_file_name[$i], $file_size[$i]);
|
2001-06-14 10:53:03 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle Editing comments
|
|
|
|
###
|
|
|
|
|
|
|
|
elseif ($comment_files)
|
|
|
|
{
|
|
|
|
while (list ($file) = each ($comment_files))
|
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
if ($badchar = bad_chars ($comment_files[$file], False, True))
|
2001-06-25 03:27:03 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array (html_text_italic ($file, 1) . html_encode (': Comments cannot contain "'.$badchar.'"', 1)));
|
2001-06-25 03:27:03 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->set_attributes ($file, array (RELATIVE_ALL), array ('comment' => stripslashes ($comment_files[$file])));
|
2001-05-21 03:09:20 +02:00
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Updated comment for '.$path.'/'.$file);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle Renaming Files and Directories
|
|
|
|
###
|
|
|
|
|
|
|
|
elseif ($renamefiles)
|
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
while (list ($from, $to) = each ($renamefiles))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
if ($badchar = bad_chars ($to, True, True))
|
2001-06-25 03:27:03 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array (html_encode ('File names cannot contain "'.$badchar.'"', 1)));
|
2001-06-25 03:27:03 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2001-08-24 10:08:06 +02:00
|
|
|
if (ereg ("/", $to) || ereg ("\\\\", $to))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ("File names cannot contain \\ or /"));
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
2001-12-10 05:04:56 +01:00
|
|
|
elseif (!$GLOBALS['phpgw']->vfs->mv ($from, $to))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Could not rename '.$disppath.'/'.$from.' to '.$disppath.'/'.$to));
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
2001-06-25 03:27:03 +02:00
|
|
|
else
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Renamed '.$disppath.'/'.$from.' to '.$disppath.'/'.$to);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle Moving Files and Directories
|
|
|
|
###
|
|
|
|
|
|
|
|
elseif ($move)
|
|
|
|
{
|
|
|
|
while (list ($num, $file) = each ($fileman))
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->mv ($file, $todir . '/' . $file, array (RELATIVE_ALL, RELATIVE_NONE)))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
$moved++;
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Moved '.$disppath.'/'.$file.' to '.$todir.'/'.$file);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Could not move '.$disppath.'/'.$file.' to '.$todir.'/'.$file));
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($moved)
|
|
|
|
{
|
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$todir, 'Go to '.$todir);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle Copying of Files and Directories
|
|
|
|
###
|
|
|
|
|
|
|
|
elseif ($copy)
|
|
|
|
{
|
|
|
|
while (list ($num, $file) = each ($fileman))
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->cp ($file, $todir . '/' . $file, array (RELATIVE_ALL, RELATIVE_NONE)))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
|
|
|
$copied++;
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Copied '.$disppath.'/'.$file.' to '.$todir.'/'.$file);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Could not copy '.$disppath.'/'.$file.' to '.$todir.'/'.$file));
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($copied)
|
|
|
|
{
|
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$todir, 'Go to '.$todir);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
###
|
|
|
|
# Handle Deleting Files and Directories
|
|
|
|
###
|
|
|
|
|
|
|
|
elseif ($delete)
|
|
|
|
{
|
|
|
|
for ($i = 0; $i != $numoffiles; $i++)
|
|
|
|
{
|
|
|
|
if ($fileman[$i])
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->delete ($fileman[$i]))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Deleted '.$disppath.'/'.$fileman[$i], $fileinfo['size']);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
$GLOBALS['phpgw']->common->error_list (array ('Could not delete '.$disppath.'/'.$fileman[$i]));
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
elseif ($newdir && $createdir)
|
|
|
|
{
|
2001-08-24 10:08:06 +02:00
|
|
|
if ($badchar = bad_chars ($createdir, True, True))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array (html_encode ('Directory names cannot contain "'.$badchar.'"', 1)));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($createdir[strlen($createdir)-1] == ' ' || $createdir[0] == ' ')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Cannot create directory because it begins or ends in a space'));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
$ls_array = $GLOBALS['phpgw']->vfs->ls ($path . '/' . $createdir, array (RELATIVE_NONE), False, False, True);
|
2001-07-10 23:38:21 +02:00
|
|
|
$fileinfo = $ls_array[0];
|
|
|
|
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileinfo['name'])
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($fileinfo['mime_type'] != 'Directory')
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ($fileinfo['name'].' already exists as a file'));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Directory '.$fileinfo['name'].' already exists'));
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
html_page_close ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
if ($GLOBALS['phpgw']->vfs->mkdir ($createdir))
|
2001-05-21 03:09:20 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
html_text_summary ('Created directory '.$disppath.'/'.$createdir);
|
2001-05-21 03:09:20 +02:00
|
|
|
html_break (2);
|
2001-12-10 05:04:56 +01:00
|
|
|
html_link ($GLOBALS['appname'].'/index.php?path='.$disppath.'/'.$createdir, 'Go to '.$disppath.'/'.$createdir);
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
else
|
2001-07-04 11:02:51 +02:00
|
|
|
{
|
2001-12-10 05:04:56 +01:00
|
|
|
echo $GLOBALS['phpgw']->common->error_list (array ('Could not create '.$disppath.'/'.$createdir));
|
2001-07-04 11:02:51 +02:00
|
|
|
}
|
2001-05-21 03:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
html_break (2);
|
|
|
|
html_link_back ();
|
|
|
|
}
|
|
|
|
|
|
|
|
html_page_close ();
|
|
|
|
|
|
|
|
?>
|