Initial revision

This commit is contained in:
zone 2001-05-21 01:09:20 +00:00
parent 8e8c43ccd7
commit 158cb2d5b3
100 changed files with 3736 additions and 0 deletions

136
filemanager/admin.php Executable file
View File

@ -0,0 +1,136 @@
<?
$phpgw_info["flags"] = array("currentapp" => "phpwebhosting");
include("../header.inc.php");
error_reporting (4);
if ($update == 1)
{
if ($commit)
{
$query = sql_query ("SELECT shortcut FROM settings");
while ($array = mysql_fetch_array ($query))
{
$shortcutvar = addslashes ($$array["shortcut"]);
$query2 = sql_query ("UPDATE settings SET info = '$shortcutvar' WHERE shortcut = '$array[shortcut]'");
header ("Location: $hostname/admin.php");
}
}
elseif ($set)
{
$query = sql_query ("SELECT shortcut FROM settings");
while ($array = mysql_fetch_array ($query))
{
$shortcut = $array["shortcut"];
$shortcutvar = addslashes ($$shortcut);
$query2 = sql_query ("UPDATE settings SET original = '$shortcutvar' WHERE shortcut = '$shortcut'");
$query3 = sql_query ("UPDATE settings SET info = original");
header ("Location: $hostname/admin.php");
}
}
elseif ($reset)
{
$query = sql_query ("UPDATE settings SET info = original");
header ("Location: $hostname/admin.php");
}
}
html_page_begin ("Administration");
html_page_body_begin ();
html_text_italic ("This is the administration section. Here you can change most everything. Be careful, because your changes affect the entire site, including this page.");
html_break (1);
html_text_italic (htmlspecialchars ('"Strings" are arbitrary text included inside of the HTML tags. For example, "Body String" would be in the <body> tag. An example would be "text=blue".'));
html_break (1);
html_text_italic ('"Shortcuts" are used mostly by developers');
html_break (2);
html_form_begin ("$hostname/users.php?op=logout");
html_form_input ("submit", NULL, "Log Out");
html_form_end ();
html_form_begin ("$hostname/admin.php?update=1");
html_table_begin ();
$query = sql_query ("SELECT DISTINCT category FROM settings");
while ($cat = mysql_fetch_array ($query))
{
$cat = $cat["category"];
html_table_row_begin ();
html_table_col_begin ();
html_text_header (2, ucwords ($cat));
html_table_col_end ();
html_table_row_end ();
$query2 = sql_query ("SELECT DISTINCT subcategory FROM settings WHERE category = '$cat'");
while ($sub = mysql_fetch_array ($query2))
{
$sub = $sub["subcategory"];
html_table_row_begin ();
html_table_col_begin ();
html_table_col_end ();
html_table_col_begin ();
html_text_header (3, ucwords ($sub));
html_table_col_end ();
html_table_row_end ();
$query3 = sql_query ("SELECT DISTINCT subsubcategory FROM settings WHERE category = '$cat' AND subcategory = '$sub'");
while ($subsub = mysql_fetch_array ($query3))
{
$subsub = $subsub["subsubcategory"];
html_table_row_begin ();
html_table_col_begin ();
html_table_col_end ();
html_table_col_begin ();
html_table_col_end ();
html_table_col_begin ();
html_text_header (4, ucwords ($subsub));
html_table_col_end ();
html_table_row_end ();
$query4 = sql_query ("SELECT * FROM settings WHERE category = '$cat' AND subcategory = '$sub' AND subsubcategory = '$subsub'");
while ($settings = mysql_fetch_array ($query4))
{
$desc = htmlspecialchars ($settings["description"]);
$original = htmlspecialchars ($settings["original"]);
if (($original == NULL || !$original) && !is_int ($original))
$original = "None";
$info = $settings["info"];
$shortcut = $settings["shortcut"];
html_table_row_begin ();
html_table_col_begin ();
html_table_col_end ();
html_table_col_begin ();
html_table_col_end ();
html_table_col_begin ();
html_table_col_end ();
html_table_col_begin ();
html_text_underline (ucwords ($desc));
html_font_set (2);
html_break (1, html_nbsp (3, 1));
html_text ("Shortcut: " . $shortcut);
html_break (1, html_nbsp (3, 1));
html_text ("Default: " . $original);
html_break (1, html_nbsp (3, 1));
html_font_end ();
html_form_textarea ($shortcut, 5, 50, $info);
html_table_col_end ();
html_table_row_end ();
}
}
}
}
html_table_end ();
html_break (2);
html_form_input ("submit", "commit", "Commit changes");
html_nbsp (10);
html_form_input ("submit", "set", "Save changes as Defaults");
html_nbsp (10);
html_form_input ("reset", NULL, "Reset to Session Defaults");
html_nbsp (10);
html_form_input ("submit", "reset", "Reset to Saved Defaults");
html_form_end ();
html_page_close ();
?>

729
filemanager/groups.php Executable file
View File

@ -0,0 +1,729 @@
<?
require ("main.inc");
error_reporting (4);
###
# Authenticate user
###
$userinfo = check_auth();
###
# Groups can allow/disallow access for anonymous users
# Update: actually not anymore, but we still need this
# for a few display options
###
if ($userinfo["username"] == "anonymous")
$anonymous = 1;
if (!$group)
choose_group ();
$query = sql_query ("SELECT * FROM groupinfo WHERE groupname = '$group'");
if (!$groupinfo = mysql_fetch_array($query))
choose_group ("Group $group does not exist");
$group_access = group_auth ();
###
# Something's gone wrong if we get GROUP_NONE
###
if ($group_access <= GROUP_NONE)
choose_group ("You do not have access to $groupinfo[groupname]");
if ($group_access >= GROUP_VIEW)
$view = 1;
if ($group_access >= GROUP_WRITE)
$write = 1;
if ($group_access >= GROUP_ADMIN)
$admin = 1;
if ($group_access >= GROUP_FOUNDER)
$founder = 1;
$phpwh->fs->set_account_type ("group");
$query = sql_query ("SELECT * FROM groupinfo WHERE groupname = '$group'");
if (!$sortby)
$sortby = "name";
if (!$path)
$path = "/";
if ($path != "/" && $nextdir)
$path = $path . "/" . $nextdir;
else
$path = $path . $nextdir;
if ($path == "/")
$disppath = "";
else
$disppath = $path;
$cwd = substr ($path, strrpos ($path, "/") +1);
if (!($lesspath = substr ($path, 0, strrpos ($path, "/"))))
$lesspath = "/";
if ($rename)
{
for ($j = 0; $j != $numoffiles; $j++)
$filesman = array_push ($fileman[$j]);
}
if ($path != "/")
{
$query = sql_query ("SELECT name FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND name = '$cwd' AND type = 'Directory' AND directory = '$lesspath'");
if (!mysql_fetch_row($query))
{
html_text_error ("Directory does not exist", 1);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
exit;
}
}
$query = sql_query ("SELECT * FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND directory = '$path' ORDER BY $sortby");
$files = mysql_fetch_array($query);
$numoffiles = mysql_affected_rows($db_main);
if ($op != 'showinfo' && $op != 'changeinfo' && $op != 'delete')
{
html_page_begin ("Groups :: $groupinfo[groupname]");
html_page_body_begin (HTML_PAGE_BODY_COLOR);
}
if (!$op && !$delete && !$createdir && !$renamefiles)
{
html_table_begin ("100%");
html_table_row_begin ();
html_table_col_begin (NULL, NULL, "top");
html_font_set (2);
html_text ("Welcome to " . html_text_bold ("$groupinfo[groupname]", 1));
html_break (2, html_text_bold ("$userinfo[username]", 1));
if ($anonymous)
{
html_break (2, html_link ("$hostname/login.php", "Login", 1));
html_break (2, html_link ("$hostname/signup.php", "Create an account", 1));
}
else
html_break (2, html_link ("$hostname/users.php", "Your user page", 1));
if ($admin)
html_break (2, html_link ("$hostname/groups.php?group=$groupinfo[groupname]&op=showinfo", "Edit this group", 1));
if ($founder)
html_break (2, html_link ("$hostname/groups.php?group=$groupinfo[groupname]&op=delete", "Delete this group", 1));
html_break (2, html_link ("$hostname/index.php", "Home", 1));
html_break (2);
html_break (1);
html_text_bold ($group_access_names[$group_access]);
html_text ("access");
html_font_end ();
html_table_col_end ();
html_table_col_begin ("center", NULL, "top");
html_align ("center");
html_form_begin ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path");
if ($numoffiles || $cwd)
{
html_table_begin ();
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_HEADER_BG_COLOR);
html_table_col_begin ("center", NULL, NULL, NULL, 8);
html_table_begin ("100%");
html_table_row_begin ();
html_table_col_begin ("left");
if ($cwd)
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$lesspath", html_image ("$hostname/images/folder-up.gif", "Up", "left", 0, NULL, 1));
html_table_col_end ();
html_table_col_begin ("center");
if ($cwd)
html_image ("$hostname/images/folder.gif", "Folder", "center");
else
html_image ("$hostname/images/folder-home.gif", "Home");
html_font_set (4, HTML_TABLE_FILES_HEADER_TEXT_COLOR);
html_text_bold (strtoupper($cwd));
html_table_col_end ();
html_table_col_begin ("right");
if ($cwd)
html_link ("$hostname/groups.php?group=$groupinfo[groupname]", html_image ("$hostname/images/folder-home.gif", "Home", "right", 0, NULL, 1));
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
###
html_table_col_begin ();
html_text ("Sort by:" . html_nbsp (5, 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=name", html_text_bold ("Filename", 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=type", html_text_bold ("Type", 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=size", html_text_bold ("Size", 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=createdby", html_text_bold ("Created By", 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=modifiedby", html_text_bold ("Modified By", 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=created", html_text_bold ("Created", 1));
html_table_col_end ();
html_table_col_begin ();
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&sortby=modified", html_text_bold ("Modified", 1));
html_table_col_end ();
html_table_col_begin ();
html_table_col_end ();
html_table_row_end ();
###
# List all of the files, with their attributes
###
$i = 0;
while ($i != $numoffiles)
{
if ($rename)
{
unset($renamethis);
for ($j = 0; $j != $numoffiles; $j++)
{
if ($fileman[$j] == $files["name"])
{
$renamethis = 1;
break;
}
}
}
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_BG_COLOR);
html_table_col_begin ("right");
if ($write)
{
if (!$rename)
html_form_input ("checkbox", "fileman[$i]", "$files[name]");
elseif ($renamethis)
html_form_input ("checkbox", "fileman[$files[name]]", "$files[name]", NULL, NULL, "checked");
else
html_nbsp;
}
html_table_col_end ();
html_table_col_begin ();
if ($renamethis)
{
if ($files["type"] == "Directory")
html_image ("$hostname/images/folder.gif", "Folder");
html_form_input ("text", "renamefiles[$files[name]]", "$files[name]", 255);
}
else
{
if ($files["type"] == "Directory")
{
html_image ("$hostname/images/folder.gif", "Folder");
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path&nextdir=$files[name]", $files["name"]);
}
else
{
html_link ("$hostname/groups/$groupinfo[groupname]$disppath/$files[name]", $files["name"]);
}
}
html_table_col_end ();
html_table_col_begin ();
html_text ($files["type"]);
html_table_col_end ();
html_table_col_begin ();
if ($files["type"] == "Directory")
{
$query2 = sql_query ("SELECT SUM(size) FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND directory RLIKE '^$disppath/$files[name]'");
$fileinfo = mysql_fetch_row($query2);
if ($fileinfo[0])
borkb($fileinfo[0]+1024);
else
echo "1KB";
}
else
borkb($files["size"]);
html_table_col_end ();
html_table_col_begin ();
html_text ($files["createdby"]);
html_table_col_end ();
html_table_col_begin ();
html_text ($files["modifiedby"]);
html_table_col_end ();
html_table_col_begin ();
html_text ($files["created"]);
html_table_col_end ();
html_table_col_begin ();
html_text ($files["modified"]);
html_table_col_end ();
html_table_col_begin ();
html_text ($files["owner"]);
html_table_col_end ();
if ($files["deleteable"] == "N")
{
html_table_col_begin ();
html_image ("$hostname/images/locked.gif", "Locked");
html_table_col_end ();
}
else
{
html_table_col_begin ();
html_table_col_end ();
}
html_table_row_end ();
if ($files["type"] == "Directory")
$usedspace += $fileinfo[0];
else
$usedspace += $files["size"];
$files = mysql_fetch_array($query);
$i++;
}
html_table_end ();
html_break (2);
if ($write)
{
html_form_input ("submit", "rename", "Rename");
html_nbsp (3);
if (!$rename)
{
html_form_input ("submit", "delete", "Delete");
html_nbsp (3);
}
}
}
if (!$rename)
{
if ($write)
{
html_form_input ("text", "createdir", NULL, 255);
html_nbsp ();
html_form_input ("submit", "newdir", "Create Folder");
html_form_end ();
}
html_break (1);
html_text_bold ("Files: ");
html_text ($numoffiles);
html_nbsp (3);
html_text_bold ("Used space: ");
html_text (borkb ($usedspace, NULL, 1));
html_nbsp (3);
if ($path == "/")
{
html_text_bold ("Unused space: ");
html_text (borkb ($groupinfo["hdspace"] - $usedspace, NULL, 1));
$query = sql_query ("SELECT name FROM groupfiles WHERE groupname = '$groupinfo[groupname]'");
$i = mysql_affected_rows($db_main);
html_break (2);
html_text_bold ("Total Files: ");
html_text ($i);
}
}
if ($write)
{
html_break (2);
html_form_begin ("$hostname/groups.php?group=$groupinfo[groupname]&op=upload&path=$path", "post", "multipart/form-data");
html (html_form_input ("file", "file[]", NULL, 255, NULL, NULL, NULL, 1) . "<br>", 5);
html_form_input ("submit", "upload_files", "Upload files");
html_form_end ();
}
html_table_col_end ();
html_table_row_end ();
html_table_end ();
html_page_body_end ();
html_page_end ();
}
###
# Handle File Uploads
###
elseif ($op == "upload")
{
for ($i = 0; $i != 5; $i++)
{
if ($file_size[$i] != 0)
{
if (strlen($file_name[$i]) > 255)
{
html_text_summary_error ("File names must be under 256 characters");
continue;
}
if ($badchar = bad_chars($file_name[$i], 1))
{
html_text_summary_error ("Cannot upload $file_name[$i]", "(filename contains '$badchar')");
continue;
}
$query = sql_query ("SELECT * FROM groupfiles WHERE name = '$file_name[$i]' AND groupname = '$groupinfo[groupname]' AND directory = '$path'");
if ($fileinfo = mysql_fetch_array($query))
{
if ($fileinfo["type"] == "Directory")
{
html_text_summary_error ("Cannot replace $fileinfo[name] because it is a directory");
continue;
}
$query = sql_query ("SELECT SUM(size) FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND name != '$file_name[$i]'");
$files = mysql_fetch_row($query);
$usedspace = $files[0];
if (($file_size[$i] + $usedspace) > $userinfo["hdspace"])
{
html_text_summary_error ("Not enough space to upload $file_name[$i]", NULL, $file_size[$i]);
continue;
}
if ($fileinfo["deleteable"] != "N")
{
$query = sql_query ("UPDATE groupfiles SET groupname = '$groupinfo[groupname]',modifiedby = '$userinfo[username]', size = $file_size[$i], type = '$file_type[$i]', modified = NOW(), deleteable = 'Y' WHERE number = '$fileinfo[number]' AND groupname = '$groupinfo[groupname]' AND directory = '$path'");
copy ($file[$i], "$rootdir/groups/$groupinfo[groupname]$path/$file_name[$i]");
html_text_summary ("Replaced $disppath/$file_name[$i]", $file_size[$i]);
}
}
else
{
$query = sql_query ("SELECT SUM(size) FROM groupfiles WHERE groupname = '$groupinfo[groupname]'");
$files = mysql_fetch_row($query);
$usedspace = $files[0];
if (($file_size[$i] + $usedspace) > $userinfo["hdspace"])
{
html_text_summary_error ("Not enough space to upload $file_name[$i]", NULL, $file_size[$i]);
continue;
}
$query = sql_query ("SELECT number FROM groupfiles WHERE groupname = 'number'");
$number = mysql_fetch_row($query);
$query = sql_query ("INSERT INTO groupfiles SET number = $number[0]+1, groupname='$groupinfo[groupname]', createdby='$userinfo[username]', modifiedby='', size=$file_size[$i], type='$file_type[$i]', created=NOW(), modified='', deleteable='Y', directory='$path', name='$file_name[$i]'");
copy ($file[$i], "$rootdir/groups/$groupinfo[groupname]$path/$file_name[$i]");
$query = sql_query ("UPDATE groupfiles SET number = $number[0]+1 WHERE groupname = 'number'");
html_text_summary ("Created $disppath/$file_name[$i]", $file_size[$i]);
}
}
}
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
}
elseif ($renamefiles)
{
while (list($file) = each($renamefiles))
{
if ($badchar = bad_chars ($renamefiles[$file], 1))
{
html_text_error_summary ("Cannot rename $file to $renamefiles[$file]", "(filename contains '$badchar')");
continue;
}
if (($fileman[$file] && $renamefiles[$file]) && ($fileman[$file] != $renamefiles[$file]))
{
$query = sql_query ("SELECT name FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND directory = '$path' AND name = '$renamefiles[$file]'");
if (mysql_fetch_row($query))
{
html_text_summary_error ("Cannot rename $fileman[$file]: $renamefiles[$file] exists");
continue;
}
$query = sql_query ("SELECT number,name,directory FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND (directory RLIKE '^$disppath/$fileman[$file]/' OR directory = '$disppath/$fileman[$file]')");
while ($fileinfo = mysql_fetch_row($query))
{
$newdir = $fileinfo[2];
$newdir = preg_replace("|^$disppath/$fileman[$file]|","$disppath/$renamefiles[$file]",$newdir);
$query2 = sql_query ("UPDATE groupfiles SET directory = '$newdir' WHERE groupname = '$groupinfo[groupname]' AND name = '$fileinfo[1]' AND number = '$fileinfo[0]' AND directory RLIKE '^$disppath/$fileman[$file]'");
}
$query = sql_query ("UPDATE groupfiles SET name = '$renamefiles[$file]' WHERE groupname = '$groupinfo[groupname]' AND directory = '$path' AND name = '$fileman[$file]'");
rename("$rootdir/$userinfo[username]$path/$fileman[$file]","$rootdir/$userinfo[username]$path/$renamefiles[$file]");
html_text_summary ("Renamed $disppath/$fileman[$file] to $disppath/$renamefiles[$file]");
}
}
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
}
elseif ($delete)
{
$query = sql_query ("SELECT name FROM groupfiles WHERE groupname = '$groupinfo[groupname]'");
$numoffiles = mysql_affected_rows($db_main);
for ($i = 0; $i != $numoffiles; $i++)
{
if ($fileman[$i])
{
if ($query = sql_query ("SELECT name,type,size FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND name = '$fileman[$i]' AND directory = '$path' AND deleteable = 'Y'"))
{
$fileinfo = mysql_fetch_row($query);
if ($fileinfo[1] == "Directory")
{
$query2 = sql_query ("SELECT name,size,directory FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND type != 'Directory' AND directory RLIKE '^$disppath/$fileman[$i]'");
while ($files = mysql_fetch_row($query2))
{
unlink("$rootdir/groups/$groupinfo[groupname]$files[2]/$files[0]");
html_text_summary ("Deleted $files[2]/$files[0]", $files[1]);
}
$query2 = sql_query ("DELETE FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND directory RLIKE '^$disppath/$fileman[$i]' AND type != 'Directory'");
$query2 = sql_query ("SELECT name,type,directory FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND type = 'Directory' AND (directory RLIKE '^$disppath/$fileman[$i]' OR (name = '$fileman[$i]' AND directory = '$path')) ORDER BY directory DESC");
while ($files = mysql_fetch_row($query2))
{
rmdir("$rootdir/groups/$groupinfo[groupname]$files[2]/$files[0]");
html_text_summary ("Deleted directory ");
if ($files[2] == "/")
html_text_bold ("/$files[0]");
else
html_text_bold ("$files[2]/$files[0]");
}
$query2 = sql_query ("DELETE FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND type = 'Directory' AND (directory RLIKE '^$disppath/$fileman[$i]' OR (name = '$fileman[$i]' AND directory = '$path'))");
}
else
{
$query = sql_query ("DELETE FROM groupfiles WHERE groupname = '$groupinfo[groupname]'
AND name = '$fileman[$i]' AND directory = '$path'");
unlink("$rootdir/groups/$groupinfo[groupname]$path/$fileman[$i]");
html_text_summary ("Deleted $disppath/$fileman[$i]", $fileinfo[2]);
}
}
}
}
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
}
elseif ($newdir && $createdir)
{
if ($badchar = bad_chars ($createdir, 1))
{
html_text_error_summary ("Cannot create directory $createdir", "(name contains '$badchar')");
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
html_page_close ();
}
if ($createdir[strlen($createdir)-1] == " " || $createdir[0] == " ")
{
html_text_error_summary ("Cannot create directory $createdir because it begins or ends in a space");
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
html_page_close ();
}
$query = sql_query ("SELECT name,type FROM groupfiles WHERE name = '$createdir' AND groupname = '$groupinfo[groupname]' AND directory = '$path'");
if ($fileinfo = mysql_fetch_row($query))
{
if ($fileinfo[1] != "Directory")
{
html_text_error_summary ("$fileinfo[0] already exists as a file");
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
html_page_close ();
}
else
{
html_text_error ("Directory $fileinfo[0] already exists");
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
html_page_close ();
}
}
else
{
$query = sql_query ("SELECT SUM(size) FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND name != '$file_name[$i]'");
$files = mysql_fetch_row($query);
$usedspace = $files[0];
if (($usedspace + 1024) > $userinfo["hdspace"])
{
html_text_summary_error ("Sorry, you do not have enough space to create a new directory","Groups : $groupinfo[groupname]");
html_page_close ();
}
$query = sql_query ("SELECT number FROM groupfiles WHERE groupname = 'number'");
$number = mysql_fetch_row($query);
$query = sql_query ("INSERT INTO groupfiles SET number=$number[0]+1, groupname='$groupinfo[groupname]', createdby='$userinfo[username]', modifiedby='', size=1024, type='Directory', created=NOW(), modified='', deleteable='Y', directory='$path', name='$createdir'");
mkdir("$rootdir/groups/$groupinfo[groupname]$path/$createdir",0755);
$query = sql_query ("UPDATE groupfiles SET number = $number[0]+1 WHERE groupname = 'number'");
html_text_summary ("Created directory $disppath/$createdir/");
}
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
}
###
# Show info about a group (to change), but only if they have admin access
# Having write access is not enough
###
elseif ($op == "showinfo")
{
if (group_auth () >= GROUP_ADMIN)
showgroupinfo ();
else
html_page_error (html_text_summary_error ("Admin access to $groupinfo[groupname] is denied", NULL, NULL, 1));
}
###
# Change group info. Proceeds showinfo above
###
elseif ($op == "changeinfo")
{
if ($group_access < GROUP_ADMIN)
html_page_error (html_text_summary_error ("Admin access to $groupinfo[groupname] is denied", NULL, NULL, 1));
if ($grouppass == $groupinfo["groupname"])
showgroupinfo ("Your password cannot be the same as the group name");
if (strlen ($grouppass) > 10)
showgroupinfo ("Your password must be 10 characters or less");
$users = split("\n", $usernames);
for ($i = 0; $users[$i]; $i++)
{
$query = sql_query ("SELECT username FROM userinfo WHERE username = '$users[$i]'");
if (!$user = mysql_fetch_row($query))
showgroupinfo ("User $users[$i] does not exist");
$usernamessep .= $user[0] . ",";
}
if ($usernamessep)
$usernamessep = ',' . $usernamessep;
if ($public)
$public = 'Y';
else
$public = 'N';
if ($passonly)
$passonly = 'Y';
else
$passonly = 'N';
$query = sql_query ("UPDATE groupinfo SET grouppass = PASSWORD('$grouppass'), public = '$public', passonly = '$passonly', users = '$usernamessep' WHERE groupname = '$groupinfo[groupname]'");
html_page_begin ("Groups :: $groupinfo[groupname]");
html_page_body_begin ();
html_break (2);
html_font_set (NULL, HTML_TEXT_UPDATE_COLOR);
html_text_bold (HTML_TEXT_NAVIGATION_UPDATE_SUCCESSFUL);
html_font_end ();
html_break (2);
html_link ("$hostname/groups.php?group=$groupinfo[groupname]&path=$path", HTML_TEXT_NAVIGATION_BACK_TO_GROUP);
html_page_close ();
}
elseif ($op == "delete")
{
if ($group_access < GROUP_FOUNDER)
html_page_error (html_text_summary_error ("Founder access to $groupinfo[groupname] is denied", NULL, NULL, 1));
if ($yesdelete)
{
$query = sql_query ("SELECT name,directory FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND type != 'Directory'");
while ($fileinfo = mysql_fetch_row($query))
{
unlink ("$rootdir/groups/$groupinfo[groupname]$fileinfo[1]/$fileinfo[0]");
}
$query = sql_query ("SELECT name,directory FROM groupfiles WHERE groupname = '$groupinfo[groupname]' AND type = 'Directory' ORDER BY directory DESC");
while ($fileinfo = mysql_fetch_row($query))
{
rmdir("$rootdir/groups/$groupinfo[groupname]$fileinfo[1]/$fileinfo[0]");
}
$query = sql_query ("DELETE FROM groupfiles WHERE groupname = '$groupinfo[groupname]'");
$query = sql_query ("DELETE FROM groupinfo WHERE groupname = '$groupinfo[groupname]'");
rmdir("$rootdir/groups/$groupinfo[groupname]");
html_page_begin ("Groups :: $groupinfo[groupname]");
html_page_body_begin ();
html_break (2);
html_font_set (NULL, HTML_TEXT_DELETE_ACCOUNT_COLOR);
html_text_bold (HTML_TEXT_NAVIGATION_DELETED_ACCOUNT);
html_font_end ();
html_break (2);
html_link ("$hostname", HTML_TEXT_NAVIGATION_HOME);
html_page_close ();
}
else
{
html_page_begin ("Groups :: $groupinfo[groupname]");
html_page_body_begin ();
html_font_set (NULL, HTML_TEXT_DELETE_ACCOUNT_COLOR);
html_text_bold (HTML_TEXT_NAVIGATION_DELETE_ACCOUNT);
html_form_begin ("$hostname/groups.php?group=$groupinfo[groupname]&op=delete");
html_form_input ("submit", "yesdelete", "Yes, please delete my group");
html_form_end ();
html_page_close ();
}
}
?>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
P7 332
#IMGINFO:14x12 Indexed (348 bytes)
#END_OF_COMMENTS
14 12 255
I$IIÛ¶¶¶ÿÿmÛ¶I$IIÛ¶ºÿÛÖ¶IÛ¶I$IIÛ¶ÿÿ$Û¶I$IµúI·H·þ·m¶Û¶¶±Þ‰­Žm¶ÿ$Û¶¶µú­²<C2AD>Úû»±)Û¶mµ©h¶·µ·²m¶)IiMImŽmI²H—ÖMIHJHermmII¶ÿm%HI)EnI$II¶ÿHnMimr<6D>I$II¶ÛInmmIm

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
filemanager/images/folder-up.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
filemanager/images/folder.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
filemanager/images/locked.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

47
filemanager/inc/db.inc.php Executable file
View File

@ -0,0 +1,47 @@
<?
error_reporting (8);
/* Any initializations that need to be done */
function db_init ()
{
global $phpgw;
global $phpgw_info;
$phpgw->db->Auto_Free = 0;
}
/* General SQL query */
function db_query ($query)
{
global $phpgw;
global $phpgw_info;
return $phpgw->db->query ($query);
}
/* Fetch next array for $query_id */
function db_fetch_array ($query_id)
{
global $phpgw;
global $phpgw_info;
$phpgw->db->Query_ID = $query_id;
$phpgw->db->next_record ();
return $phpgw->db->Record;
}
/*
General wrapper for all other db calls
Calls in here are simply returned, so not all will work
*/
function db_call ($function, $query_id)
{
global $phpgw;
global $phpgw_info;
$phpgw->db->Query_ID = $query_id;
return $phpgw->db->$function ();
}
?>

View File

@ -0,0 +1,3 @@
<?
?>

View File

@ -0,0 +1,5 @@
<?
require ("./inc/main.inc.php");
?>

View File

@ -0,0 +1,3 @@
<?
?>

View File

@ -0,0 +1,3 @@
<?
?>

View File

@ -0,0 +1,11 @@
<?php
global $pref;
$pref->change("phpwebhosting","filename","True");
$pref->change("phpwebhosting","mime_type","False");
$pref->change("phpwebhosting","size","True");
$pref->change("phpwebhosting","created","True");
$pref->change("phpwebhosting","modified","True");
$pref->change("phpwebhosting","createdby","True");
$pref->change("phpwebhosting","modifiedby","True");
$pref->change("phpwebhosting","comment","True");
?>

View File

@ -0,0 +1,40 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
{
echo "<p>\n";
$imgfile = $phpgw->common->get_image_dir ($appname) . '/' . $appname . '.gif';
if (file_exists ($imgfile))
{
$imgpath = $phpgw->common->get_image_path ($appname) . '/' . $appname . '.gif';
}
else
{
$imgfile = $phpgw->common->get_image_dir ($appname) . '/navbar.gif';
if (file_exists ($imgfile))
{
$imgpath = $phpgw->common->get_image_path ($appname) . '/navbar.gif';
}
else
{
$imgpath = '';
}
}
section_start (ucfirst ($appname), $imgpath);
echo '<a href="' . $phpgw->link ('/phpwebhosting/preferences.php') . '">' . lang ('PHPWebHosting preferences') . '</a>';
section_end ();
}
?>

411
filemanager/inc/html.inc.php Executable file
View File

@ -0,0 +1,411 @@
<?
function html_form_begin ($action, $method = "post", $enctype = NULL, $string = HTML_FORM_BEGIN_STRING, $return = 0)
{
global $phpgw;
global $sep;
$action = string_encode ($action, 1);
$action = $sep . $action;
$action = $phpgw->link ($action);
if ($method != NULL && $method)
$method = "method=$method";
if ($enctype != NULL && $enctype)
$enctype = "enctype=$enctype";
$rstring = "<form action=$action $method $enctype $string>";
return (eor ($rstring, $return));
}
function html_form_input ($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = HTML_FORM_INPUT_STRING, $return = 0)
{
if ($type != NULL && $type)
{
if ($type == "checkbox")
$value = string_encode ($value, 1);
$type = "type=$type";
}
if ($name != NULL && $name)
$name = "name=$name";
if ($value != NULL && $value)
{
$value = "value=\"$value\"";
}
if (is_int ($maxlength) && $maxlength >= 0)
$maxlength = "maxlength=$maxlength";
if (is_int ($size) && $size >= 0)
$size = "size=$size";
if ($checked != NULL && $checked)
$checked = "checked";
$rstring = "<input $type $name $value $maxlength $size $checked $string>";
return (eor ($rstring, $return));
}
function html_form_textarea ($name = NULL, $rows = NULL, $cols = NULL, $value = NULL, $string = HTML_FORM_TEXTAREA_STRING, $return = 0)
{
if ($name != NULL && $name)
$name = "name=$name";
if (is_int ($rows) && $rows >= 0)
$rows = "rows=$rows";
if (is_int ($cols) && $cols >= 0)
$cols = "cols=$cols";
$rstring = "<textarea $name $rows $cols $string>$value</textarea>";
return (eor ($rstring, $return));
}
function html_form_select_begin ($name = NULL, $return = 0)
{
if ($name != NULL && $name)
$name = "name=$name";
$rstring = "<select $name>";
return (eor ($rstring, $return));
}
function html_form_select_end ($return = 0)
{
$rstring = "</select>";
return (eor ($rstring, $return));
}
function html_form_option ($value = NULL, $selected = NULL, $return = 0)
{
if ($selected != NULL && $selected)
$selected = "selected";
$rstring = "<option $selected>$value</option>";
return (eor ($rstring, $return));
}
function html_form_end ($return = 0)
{
$rstring = '</form>';
return (eor ($rstring, $return));
}
function html_nbsp ($times = 1, $return = 0)
{
if ($times == NULL)
$times = 1;
for ($i = 0; $i != $times; $i++)
{
if ($return)
$rstring .= "&nbsp;";
else
echo "&nbsp;";
}
if ($return)
return ($rstring);
}
function html ($string, $times = 1, $return = 0)
{
for ($i = 0; $i != $times; $i++)
{
if ($return)
$rstring .= $string;
else
echo $string;
}
if ($return)
return ($rstring);
}
function html_break ($break, $string = "", $return = 0)
{
if ($break == 1)
$break = '<br>';
if ($break == 2)
$break = '<p>';
if ($break == 5)
$break = '<hr>';
return (eor ($break . $string, $return));
}
function html_page_begin ($title = NULL, $return = 0)
{
// $rstring = HTML_PAGE_BEGIN_BEFORE_TITLE . $title . HTML_PAGE_BEGIN_AFTER_TITLE;
return (eor ($rstring, $return));
}
function html_page_body_begin ($bgcolor = HTML_PAGE_BODY_COLOR, $background = NULL, $text = NULL, $link = NULL, $vlink = NULL, $alink = NULL, $string = HTML_PAGE_BODY_STRING, $return = 0)
{
if ($bgcolor != NULL && $bgcolor)
$bgcolor = "bgcolor=$bgcolor";
if ($background != NULL && $background)
$background = "background=$background";
if ($text != NULL && $text)
$text = "text=$text";
if ($link != NULL && $link)
$link = "link=$link";
if ($vlink != NULL && $vlink)
$vlink = "vlink=$vlink";
if ($alink != NULL && $alink)
$alink = "alink=$alink";
// $rstring = "<body $bgcolor $background $text $link $vlink $alink $string>";
return (eor ($rstring, $return));
}
function html_page_body_end ($return = 0)
{
// $rstring = "</body>";
return (eor ($rstring, $return));
}
function html_page_end ($return = 0)
{
// $rstring = "</html>";
return (eor ($rstring, $return));
}
function html_page_close ()
{
global $phpgw;
// html_page_body_end ();
// html_page_end ();
$phpgw->common->phpgw_footer ();
exit;
}
function html_text_bold ($text = NULL, $return = 0, $lang = 0)
{
if ($lang)
$text = translate ($text);
$rstring = "<b>$text</b>";
return (eor ($rstring, $return));
}
function html_text_underline ($text = NULL, $return = 0, $lang = 0)
{
if ($lang)
$text = translate ($text);
$rstring = "<u>$text</u>";
return (eor ($rstring, $return));
}
function html_text_italic ($text = NULL, $return = 0, $lang = 0)
{
if ($lang)
$text = translate ($text);
$rstring = "<i>$text</i>";
return (eor ($rstring, $return));
}
function html_text_summary ($text = NULL, $size = NULL, $return = 0, $lang = 0)
{
if ($lang)
$text = translate ($text);
$rstring .= html_break (1, NULL, $return);
$rstring .= html_text_bold ($text, $return);
$rstring .= html_nbsp (3, $return);
if ($size != NULL && $size >= 0)
$rstring .= borkb ($size, 1, $return);
if ($return)
return ($rstring);
}
function html_text_summary_error ($text = NULL, $text2 = NULL, $size = NULL, $return = 0, $lang = 0)
{
if ($lang)
$text = translate ($lang);
$rstring .= html_text_error ($text, 1, $return);
if (($text2 != NULL && $text2) || ($size != NULL && $size))
$rstring .= html_nbsp (3, $return);
if ($text2 != NULL && $text2)
$rstring .= html_text_error ($text2, NULL, $return);
if ($size != NULL && $size >= 0)
$rstring .= borkb ($size, 1, $return);
if ($return)
return ($rstring);
}
function html_font_set ($size = NULL, $color = NULL, $family = NULL, $return = 0)
{
if ($size != NULL && $size)
$size = "size=$size";
if ($color != NULL && $color)
$color = "color=$color";
if ($family != NULL && $family)
$family = "family=$family";
$rstring = "<font $size $color $family>";
return (eor ($rstring, $return));
}
function html_font_end ($return = 0)
{
$rstring = "</font>";
return (eor ($rstring, $return));
}
function html_text_error ($errorwas = NULL, $break = 1, $return = 0)
{
if ($break)
$rstring .= html_break (1, NULL, 1);
$rstring .= html_font_set (NULL, HTML_TEXT_ERROR_COLOR, NULL, 1);
$rstring .= html_text_bold (html_text_italic ($errorwas, 1), 1);
$rstring .= html_font_end (1);
return (eor ($rstring, $return));
}
function html_page_error ($errorwas = NULL, $title = "Error", $return = 0)
{
$rstring = html_page_begin ($title, $return);
$rstring .= html_page_body_begin (HTML_PAGE_BODY_COLOR, $return);
$rstring .= html_break (2, NULL, $return);
$rstring .= html_text_error ($errorwas, $return);
$rstring .= html_page_body_end ($return);
$rstring .= html_page_end ($return);
if (!$return)
html_page_close ();
else
return ($rstring);
}
function html_link ($href = NULL, $text = NULL, $return = 0, $encode = 1)
{
global $phpgw;
global $sep;
global $appname;
if ($encode)
$href = string_encode ($href, 1);
###
# This decodes / back to normal
###
$href = preg_replace ("/%2F/", "/", $href);
$text = trim ($text);
/*
$rstring = "<a href=$href>$text</a>";
*/
$href = $sep . $href;
$address = $phpgw->link ($href);
$rstring = "<a href=$address>$text</a>";
return (eor ($rstring, $return));
}
function html_link_back ($return)
{
global $hostname;
global $path;
global $groupinfo;
global $appname;
$rstring .= html_link ("$appname/index.php?path=$path", HTML_TEXT_NAVIGATION_BACK_TO_USER, 1);
return (eor ($rstring, $return));
}
function html_table_begin ($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = HTML_TABLE_BEGIN_STRING, $return = 0)
{
if ($width != NULL && $width)
$width = "width=$width";
if (is_int ($border) && $border >= 0)
$border = "border=$border";
if (is_int ($cellspacing) && $cellspacing >= 0)
$cellspacing = "cellspacing=$cellspacing";
if (is_int ($cellpadding) && $cellpadding >= 0)
$cellpadding = "cellpadding=$cellpadding";
if ($rules != NULL && $rules)
$rules = "rules=$rules";
$rstring = "<table $width $border $cellspacing $cellpadding $rules $string>";
return (eor ($rstring, $return));
}
function html_table_end ($return = 0)
{
$rstring = "</table>";
return (eor ($rstring, $return));
}
function html_table_row_begin ($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = HTML_TABLE_ROW_BEGIN_STRING, $return = 0)
{
if ($align != NULL && $align)
$align = "align=$align";
if ($halign != NULL && $halign)
$halign = "halign=$halign";
if ($valign != NULL && $valign)
$valign = "valign=$valign";
if ($bgcolor != NULL && $bgcolor)
$bgcolor = "bgcolor=$bgcolor";
$rstring = "<tr $align $halign $valign $bgcolor $string>";
return (eor ($rstring, $return));
}
function html_table_row_end ($return = 0)
{
$rstring = "</tr>";
return (eor ($rstring, $return));
}
function html_table_col_begin ($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = HTML_TABLE_COL_BEGIN_STRING, $return = 0)
{
if ($align != NULL && $align)
$align = "align=$align";
if ($halign != NULL && $halign)
$halign = "halign=$halign";
if ($valign != NULL && $valign)
$valign = "valign=$valign";
if (is_int ($rowspan) && $rowspan >= 0)
$rowspan = "rowspan=$rowspan";
if (is_int ($colspan) && $colspan >= 0)
$colspan = "colspan=$colspan";
$rstring = "<td $align $halign $valign $rowspan $colspan $string>";
return (eor ($rstring, $return));
}
function html_table_col_end ($return = 0)
{
$rstring = "</td>";
return (eor ($rstring, $return));
}
function html_text ($string, $times = 1, $return = 0, $lang = 0)
{
global $phpgw;
if ($lang)
$string = translate ($string);
if ($times == NULL)
$times = 1;
for ($i = 0; $i != $times; $i++)
{
if ($return)
$rstring .= $string;
else
echo $string;
}
if ($return)
return ($rstring);
}
function html_text_header ($size = 1, $string = NULL, $return = 0, $lang = 0)
{
$rstring = "<h$size>$string</h$size>";
return (eor ($rstring, $return));
}
function html_align ($align = NULL, $string = HTML_ALIGN_MAIN_STRING, $return = 0)
{
$rstring = "<p align=$align $string>";
return (eor ($rstring, $return));
}
function html_image ($src = NULL, $alt = NULL, $align = NULL, $border = NULL, $string = HTML_IMAGE_MAIN_STRING, $return = 0)
{
if ($src != NULL && $src)
$src = "src=$src";
if ($alt != NULL && $alt)
$alt = "alt=\"$alt\"";
if ($align != NULL && $align)
$align = "align=$align";
if (is_int ($border) && $border >= 0)
$border = "border=$border";
$rstring = "<img $src $alt $align $border $string>";
return (eor ($rstring, $return));
}
?>

159
filemanager/inc/main.inc.php Executable file
View File

@ -0,0 +1,159 @@
<?
### Start Configuration Options ###
### These are automatically set in phpGW - do not edit ###
$sep = $phpgw_info["server"]["dir_separator"];
$filesdir = $phpgw_info["server"]["files_dir"];
$rootdir = $phpgw->vfs->basedir;
$fakebase = $phpgw->vfs->fakebase;
$hostname = $phpgw_info["server"]["webserver_url"] . $filesdir;
$appname = $phpgw_info["flags"]["currentapp"];
$settings = $phpgw_info["user"]["preferences"][$appname];
### End Configuration Options ###
define ("NULL", "");
require ("./inc/db.inc.php");
/* Set up any initial db settings */
db_init ();
###
# Get user settings from database
###
/* We have to define these by hand in phpGW, or rely on it's templates */
define ('HTML_TABLE_FILES_HEADER_BG_COLOR', "");
define ('HTML_TABLE_FILES_HEADER_TEXT_COLOR', "maroon");
define ('HTML_TABLE_FILES_COLUMN_HEADER_BG_COLOR', "");
define ('HTML_TABLE_FILES_COLUMN_HEADER_TEXT_COLOR', "maroon");
define ('HTML_TABLE_FILES_BG_COLOR', "");
define ('HTML_TABLE_FILES_TEXT_COLOR', "maroon");
define ('HTML_TEXT_ERROR_COLOR', "red");
define ('HTML_TEXT_NAVIGATION_BACK_TO_USER', "Back to file manager");
###
# Need to include this here so they recognize the settings
###
require ("./inc/html.inc.php");
###
# Define the list of file attributes. Format is "internal_name" => "Displayed name"
# This is used both by internally and externally for things like preferences
###
$file_attributes = array ("name" => "Filename", "mime_type" => "MIME Type", "size" => "Size", "created" => "Created", "modified" => "Modified", "owner" => "Owner", "createdby_id" => "Created by", "modifiedby_id" => "Created by", "modifiedby_id" => "Modified by", "app" => "Application", "comment" => "Comment");
###
# Calculate and display B or KB
# And yes, that first if is strange,
# but it does do something
###
function borkb ($size, $enclosed = NULL, $return = 0)
{
if (!$size)
$size = 0;
if ($enclosed)
{
$left = "(";
$right = ")";
}
if ($size < 1024)
$rstring = $left . $size . "B" . $right;
else
$rstring = $left . round($size/1024) . "KB" . $right;
return (eor ($rstring, $return));
}
###
# Check for and return the first unwanted character
###
function bad_chars ($string, $return = 0)
{
if (preg_match("-([\\\|/|\||\?|\`|\@|\#|\$|%|\&|\*|\(|\)|\[|\{|\]|\}|\;|\:|\"|\'|\<|\>|\,|\ ])-", $string, $badchars))
$rstring = $badchars[1];
return trim ((eor ($rstring, $return)));
}
###
# Check for and return the first character that can't be used in a file or directory name
###
function bad_chars_file ($string, $return = 0)
{
if (preg_match ("-([\\\|\/|\&|\(|\)])-", $string, $badchars))
$rstring = $badchars[1];
return trim ((eor ($rstring, $return)));
}
###
# Decide whether to echo or return. Used by HTML functions
###
function eor ($rstring, $return)
{
if ($return)
return ($rstring);
else
{
html_text ($rstring . "\n");
return (0);
}
}
###
# URL encode a string
# First check if its a query string, then if its just a URL, then just encodes it all
# Note: this is a hack. It was made to work with form actions, form values, and links only,
# but should be able to handle any normal query string or URL
###
function string_encode ($string, $return)
{
global $hostname;
if (preg_match ("/=(.*)(&|$)/U", $string))
$rstring = preg_replace ("/=(.*)(&|$)/Ue", "'=' . rawurlencode ('\\1') . '\\2'", $string);
elseif (ereg ("^$hostname", $string))
{
$rstring = ereg_replace ("^$hostname/", "", $string);
$rstring = preg_replace ("/(.*)(\/|$)/Ue", "rawurlencode ('\\1') . '\\2'", $rstring);
$rstring = "$hostname/$rstring";
}
else
{
$rstring = rawurlencode ($string);
/* Terrible hack, decodes all /'s back to normal */
$rstring = preg_replace ("/%2F/", "/", $rstring);
}
return (eor ($rstring, $return));
}
function string_decode ($string, $return)
{
$rstring = urldecode ($string);
return (eor ($rstring, $return));
}
function translate ($text)
{
global $phpgw;
return ($phpgw->lang ($text));
}
?>

989
filemanager/index.php Executable file
View File

@ -0,0 +1,989 @@
<?
$phpgw_info["flags"] = array("currentapp" => "phpwebhosting",
"noheader" => False,
"noappheader" => False,
"enable_vfs_class" => True);
include("../header.inc.php");
error_reporting (4);
###
# 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
###
###
# Note that $userinfo["username"] is actually the id number, not the login name
###
$userinfo["username"] = $phpgw_info["user"]["account_id"];
$userinfo["account_lid"] = $phpgw->accounts->id2name ($userinfo["username"]);
$userinfo["hdspace"] = 10000000000;
$homedir = "$fakebase/$userinfo[account_lid]";
###
# Enable this to display some debugging info
###
$phpwh_debug = 0;
if ($download && $fileman[0])
{
$phpgw->browser->content_header ($fn);
echo $phpgw->vfs->read ($path/$fileman[0]);
$phpgw->common->phpgw_exit ();
}
###
# Default is to sort by name
###
if (!$sortby)
$sortby = "name";
###
# Some hacks to set and display directory paths correctly
###
if (!$path)
{
$path = $phpgw->vfs->pwd ();
if (!$path || $phpgw->vfs->pwd (False) == "")
$path = $homedir;
}
$extra_dir = substr ($path, strlen ($homedir) + 1);
$phpgw->vfs->cd (False, False, array (RELATIVE_NONE));
$phpgw->vfs->cd ($path, False, array (RELATIVE_NONE));
$pwd = $phpgw->vfs->pwd ();
if (!$cwd = substr ($path, strlen ($homedir) + 1))
$cwd = "/";
else
$cwd = substr ($pwd, strrpos ($pwd, "/") + 1);
$disppath = $path;
/* This just prevents // in some cases */
if ($path == "/")
$dispsep = "";
else
$dispsep = "/";
if (!($lesspath = substr ($path, 0, strrpos ($path, "/"))))
$lesspath = "/";
$now = date ("Y-m-d");
//This will hopefully be replaced by a session management working_id
//if (!$phpgw->vfs->working_id = preg_replace ("/\$fakebase\/(.*)\/(.*)$/U", "\\1", $path))
$userinfo["working_id"] = $phpgw->vfs->working_id;
$userinfo["working_lid"] = $phpgw->accounts->id2name ($userinfo["working_id"]);
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>
real getabsolutepath: " . $phpgw->vfs->getabsolutepath (False, False, False) . "<br>
fake getabsolutepath: " . $phpgw->vfs->getabsolutepath (False) . "<br>
appsession: " . $phpgw->common->appsession () . "<br>
pwd: " . $phpgw->vfs->pwd () . "<br>";
}
###
# Verify path is real
###
if ($path != $homedir && $path != "/" && $path != $fakebase)
{
if ($phpwh_debug)
{
echo "SELECT name FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND name = '$cwd' AND mime_type = 'Directory' AND directory = '$lesspath'<br>";
}
$query = db_query ("SELECT name FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND name = '$cwd' AND mime_type = 'Directory' AND directory = '$lesspath'");
if (!$phpgw->db->next_record ($query))
{
html_text_error ("Directory $dir does not exist", 1);
html_break (2);
html_link ("$appname/index.php?path=$homedir", "Go to your home directory");
html_break (2);
html_link_back ();
html_page_close ();
}
}
###
# Read in file info from database to use in the rest of the script
# $files in the loop below uses $query
###
$files_query = db_query ("SELECT * FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND directory = '$path' AND name != '' ORDER BY $sortby");
$numoffiles = db_call ("affected_rows", $files_query);
###
# Start Main Page
###
if ($op != "changeinfo" && $op != "logout" && $op != "delete")
{
html_page_begin ("Users :: $userinfo[username]");
html_page_body_begin (HTML_PAGE_BODY_COLOR);
}
###
# Start Main Table
###
if (!$op && !$delete && !$createdir && !$renamefiles && !$move && !$copy && !$edit && !$comment_files)
{
html_table_begin ("100%");
html_table_row_begin ();
html_table_col_begin ("center", NULL, "top");
html_align ("center");
html_form_begin ("$appname/index.php?path=$path");
if ($numoffiles || $cwd)
{
while (list ($num, $name) = each ($settings))
{
if ($name)
$columns++;
}
$columns++;
html_table_begin ();
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_HEADER_BG_COLOR);
html_table_col_begin ("center", NULL, NULL, NULL, $columns);
html_table_begin ("100%");
html_table_row_begin ();
html_table_col_begin ("left");
if ($path != "/")
html_link ("$appname/index.php?path=$lesspath", html_image ("images/folder-up.gif", "Up", "left", 0, NULL, 1));
html_table_col_end ();
html_table_col_begin ("center");
if ($cwd)
{
if ($path == $homedir)
html_image ("images/folder-home.gif", "Folder", "center");
else
html_image ("images/folder.gif", "Folder", "center");
}
else
html_image ("images/folder-home.gif", "Home");
html_font_set (4, HTML_TABLE_FILES_HEADER_TEXT_COLOR);
html_text_bold (strtoupper ($disppath));
html_font_end ();
html_table_col_end ();
html_table_col_begin ("right");
if ($path != $homedir)
html_link ("$appname/index.php?path=$homedir", html_image ("images/folder-home.gif", "Home", "right", 0, NULL, 1));
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 ();
html_text ("Sort by:" . html_nbsp (1, 1), NULL, NULL, 1);
html_table_col_end ();
reset ($file_attributes);
while (list ($internal, $displayed) = each ($file_attributes))
{
if ($settings[$internal])
{
html_table_col_begin ();
html_link ("$appname/index.php?path=$path&sortby=$internal", html_text_bold ("$displayed", 1, 1));
html_table_col_end ();
}
}
html_table_col_begin ();
html_table_col_end ();
html_table_row_end ();
if ($settings["dotdot"] && $settings["name"] && $path != "/")
{
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 ();
html_image ("images/folder.gif", "Folder");
html_link ("$appname/index.php?path=$lesspath", "..");
html_table_col_end ();
if ($settings["mime_type"])
{
html_table_col_begin ();
html_text ("Directory");
html_table_col_end ();
}
html_table_row_end ();
}
###
# List all of the files, with their attributes
###
for ($i = 0; $i != $numoffiles; $i++)
{
$files = db_fetch_array ($files_query);
if ($rename || $edit_comments)
{
unset ($this_selected);
unset ($renamethis);
unset ($edit_this_comment);
for ($j = 0; $j != $numoffiles; $j++)
{
if ($fileman[$j] == string_encode ($files["name"], 1))
{
$this_selected = 1;
break;
}
}
if ($rename && $this_selected)
$renamethis = 1;
elseif ($edit_comments && $this_selected)
$edit_this_comment = 1;
}
if (!$settings["dotfiles"] && ereg ("^\.", $files["name"]))
{
continue;
}
html_table_row_begin (NULL, NULL, NULL, HTML_TABLE_FILES_BG_COLOR);
###
# Checkboxes
###
html_table_col_begin ("right");
if (!$rename && !$edit_comments)
html_form_input ("checkbox", "fileman[$i]", "$files[name]");
elseif ($renamethis)
html_form_input ("hidden", "fileman[" . string_encode ($files[name], 1) . "]", "$files[name]", NULL, NULL, "checked");
else
html_nbsp;
html_table_col_end ();
###
# File name and icon
###
if ($settings["name"])
{
html_table_col_begin ();
if ($renamethis)
{
if ($files["mime_type"] == "Directory")
html_image ("images/folder.gif", "Folder");
html_form_input ("text", "renamefiles[" . string_encode ($files[name], 1) . "]", "$files[name]", 255);
}
else
{
if ($files["mime_type"] == "Directory")
{
html_image ("images/folder.gif", "Folder");
html_link ("$appname/index.php?path=$path$dispsep$files[name]", $files["name"]);
}
else
{
html_link ("$filesdir$pwd/$files[name]", $files["name"]);
}
}
html_table_col_end ();
}
###
# MIME type
###
if ($settings["mime_type"])
{
html_table_col_begin ();
html_text ($files["mime_type"]);
html_table_col_end ();
}
###
# File size
###
if ($settings["size"])
{
html_table_col_begin ();
if ($files["mime_type"] == "Directory")
{
$size_query = db_query ("SELECT SUM(size) FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND directory RLIKE '^$disppath/$files[name]'");
$fileinfo = db_fetch_array ($size_query);
db_call ("free", $size_query);
if ($fileinfo[0])
borkb ($fileinfo[0]+1024);
else
echo "1KB";
}
else
borkb ($files["size"]);
html_table_col_end ();
}
###
# Date created
###
if ($settings["created"])
{
html_table_col_begin ();
html_text ($files["created"]);
html_table_col_end ();
}
###
# Date modified
###
if ($settings["modified"])
{
html_table_col_begin ();
if ($files["modified"] != "0000-00-00")
html_text ($files["modified"]);
html_table_col_end ();
}
###
# Owner name
###
if ($settings["owner"])
{
html_table_col_begin ();
html_text ($phpgw->accounts->id2name ($files["owner_id"]));
html_table_col_end ();
}
###
# Creator name
###
if ($settings["createdby_id"])
{
html_table_col_begin ();
html_text ($phpgw->accounts->id2name ($files["createdby_id"]));
html_table_col_end ();
}
###
# Modified by name
###
if ($settings["modifiedby_id"])
{
html_table_col_begin ();
html_text ($phpgw->accounts->id2name ($files["modifiedby_id"]));
html_table_col_end ();
}
###
# Application
###
if ($settings["app"])
{
html_table_col_begin ();
html_text ($files["app"]);
html_table_col_end ();
}
###
# Comment
###
if ($settings["comment"])
{
html_table_col_begin ();
if ($edit_this_comment)
{
html_form_input ("text", "comment_files[" . string_encode ($files[name], 1) . "]", "$files[comment]", 255);
}
else
{
html_text ($files["comment"]);
}
html_table_col_end ();
}
###
# Deleteable (currently not used)
###
if ($settings["deleteable"])
{
if ($files["deleteable"] == "N")
{
html_table_col_begin ();
html_image ("images/locked.gif", "Locked");
html_table_col_end ();
}
else
{
html_table_col_begin ();
html_table_col_end ();
}
}
html_table_row_end ();
if ($files["mime_type"] == "Directory")
{
$usedspace += $fileinfo[0];
}
else
{
$usedspace += $files["size"];
}
}
html_table_end ();
html_break (2);
if (!$rename && !$edit_comments)
{
html_form_input ("submit", "edit", "Edit");
html_nbsp (3);
}
if (!$edit_comments)
{
html_form_input ("submit", "rename", "Rename");
html_nbsp (3);
}
if (!$rename && !$edit_comments)
{
html_form_input ("submit", "delete", "Delete");
html_nbsp (3);
}
if (!$rename)
{
html_form_input ("submit", "edit_comments", "Edit comments");
}
}
###
# 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);
html_form_input ("submit", "copy", "Copy to:");
html_form_input ("submit", "move", "Move to:");
html_form_select_begin ("todir");
$query3 = db_query ("SELECT name, directory FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND mime_type = 'Directory' ORDER BY name");
while ($dirs = db_fetch_array ($query3))
{
###
# So we don't display //
###
if ($dirs["directory"] != '/')
{
$dirs["directory"] .= '/';
}
###
# No point in displaying the current directory
###
if (($dirs["directory"] . $dirs["name"]) != $path)
{
html_form_option ($dirs["directory"] . $dirs["name"]);
}
}
html_form_select_end ();
html_break (1);
html_form_input ("submit", "download", "Download");
html_nbsp (3);
html_form_input ("text", "createdir", NULL, 255, 15);
html_form_input ("submit", "newdir", "Create Folder");
html_form_end ();
html_break (1);
html_text_bold ("Files: ");
html_text ($numoffiles);
html_nbsp (3);
html_text_bold ("Used space: ");
html_text (borkb ($usedspace, NULL, 1));
html_nbsp (3);
if ($path == $homedir)
{
html_text_bold ("Unused space: ");
html_text (borkb ($userinfo["hdspace"] - $usedspace, NULL, 1));
$query4 = db_query ("SELECT name FROM phpgw_vfs WHERE owner_id = '$userinfo[username]'");
$i = db_call ("affected_rows", $query4);
html_break (2);
html_text_bold ("Total Files: ");
html_text ($i);
}
###
# Show file upload boxes. Note the last argument to html (). Repeats 5 times
###
html_break (2);
html_form_begin ("$appname/index.php?op=upload&path=$path", "post", "multipart/form-data");
html_table_begin ();
html_table_row_begin ("center");
html_table_col_begin ();
html_text_bold ("File");
html_table_col_end ();
html_table_col_begin ();
html_text_bold ("Comment");
html_table_col_end ();
html_table_row_end ();
html_table_row_begin ();
html_table_col_begin ();
html (html_form_input ("file", "file[]", NULL, 255, NULL, NULL, NULL, 1) . html_break (1, NULL, 1), 5);
html_table_col_end ();
html_table_col_begin ();
html (html_form_input ("text", "comment[]", NULL, NULL, NULL, NULL, NULL, 1) . html_break (1, NULL, 1), 5);
html_table_col_end ();
html_table_row_end ();
html_table_end ();
html_form_input ("submit", "upload_files", "Upload files");
html_form_end ();
}
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
###
if ($edit_preview)
{
$content = $$edit_file;
html_break (1);
html_text_bold ("Preview of $path/$edit_file");
html_break (2);
html_table_begin ("90%");
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)
{
$content = $$edit_file;
if ($phpgw->vfs->write ($edit_file, $content))
{
html_text_bold ("Saved $path/$edit_file");
html_break (2);
}
else
{
html_text_error ("Could not save $path/$edit_file");
html_break (2);
}
}
/* This doesn't work just yet
elseif ($edit_save_all)
{
for ($j = 0; $j != $numoffiles; $j++)
{
$content = $$fileman[$j];
echo "fileman[$j]: $fileman[$j]<br><b>$content</b><br>";
continue;
if ($phpgw->vfs->write ($fileman[$j], $content))
{
html_text_bold ("Saved $path/$fileman[$j]");
html_break (1);
}
else
{
html_text_error ("Could not save $path/$fileman[$j]");
html_break (1);
}
}
html_break (1);
}
*/
###
# Now we display the edit boxes and forms
###
for ($j = 0; $j != $numoffiles; $j++)
{
if ($content = $phpgw->vfs->read ($fileman[$j]))
{
html_table_begin ("100%");
html_form_begin ("$appname/index.php?path=$path");
html_form_input ("hidden", "edit", True);
html_form_input ("hidden", "edit_file", "$fileman[$j]");
###
# We need to include all of the fileman entries for each file's form,
# so we loop through again
###
for ($i = 0; $i != $numoffiles; $i++)
{
html_form_input ("hidden", "fileman[$i]", "$fileman[$i]");
}
html_table_row_begin ();
html_table_col_begin ();
html_form_textarea ($fileman[$j], 35, 75, $content);
html_table_col_end ();
html_table_col_begin ("center");
html_form_input ("submit", "edit_preview", "Preview $fileman[$j]");
html_break (1);
html_form_input ("submit", "edit_save", "Save $fileman[$j]");
// html_break (1);
// html_form_input ("submit", "edit_save_all", "Save all");
html_table_col_end ();
html_table_row_end ();
html_break (2);
html_form_end ();
html_table_end ();
}
}
}
###
# Handle File Uploads
###
elseif ($op == "upload")
{
for ($i = 0; $i != 5; $i++)
{
if ($file_size[$i] != 0)
{
###
# Check to see if the file exists in the database
###
$query = db_query ("SELECT * FROM phpgw_vfs WHERE name = '$file_name[$i]' AND owner_id = '$userinfo[username]' AND directory = '$path'");
if ($fileinfo = db_fetch_array ($query))
{
if ($fileinfo["mime_type"] == "Directory")
{
html_text_summary_error ("Cannot replace $fileinfo[name] because it is a directory");
continue;
}
$query = db_query ("SELECT SUM(size) FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND name != '$file_name[$i]'");
$files = db_fetch_array ($query);
$usedspace = $files[0];
if (($file_size[$i] + $usedspace) > $userinfo["hdspace"])
{
html_text_summary_error ("Sorry, you do not have enough space to upload those files");
continue;
}
if ($fileinfo["deleteable"] != "N")
{
$phpgw->vfs->set_attributes ($file_name[$i], array ("owner_id" => $userinfo["username"], "modifiedby_id" => $userinfo["username"], "modified" => $now, "size" => $file_size[$i], mime_type => $file_type[$i], "deleteable" => "Y", "comment" => $comment[$i]), array (RELATIVE_ALL));
$phpgw->vfs->cp ($file[$i], "$file_name[$i]", array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
html_text_summary ("Replaced $disppath/$file_name[$i]", $file_size[$i]);
}
}
else
{
$query = db_query ("SELECT SUM(size) FROM phpgw_vfs WHERE owner_id = '$userinfo[username]'");
$files = db_fetch_array ($query);
$usedspace = $files[0];
if (($file_size[$i] + $usedspace) > $userinfo["hdspace"])
{
html_text_summary_error ("Not enough space to upload $file_name[$i]", NULL, $file_size[$i]);
continue;
}
$phpgw->vfs->cp ($file[$i], $file_name[$i], array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL));
$phpgw->vfs->set_attributes ($file_name[$i], array ("mime_type" => $file_type[$i], "comment" => $comment[$i]), array (RELATIVE_ALL));
html_text_summary ("Created $disppath/$file_name[$i]", $file_size[$i]);
}
}
}
html_break (2);
html_link_back ();
}
###
# Handle Editing comments
###
elseif ($comment_files)
{
while (list ($file) = each ($comment_files))
{
$phpgw->vfs->set_attributes ($file, array ("comment" => $comment_files[$file]));
html_text_summary ("Updated comment for $path/$file");
}
html_break (2);
html_link_back ();
}
###
# Handle Renaming Files and Directories
###
elseif ($renamefiles)
{
while (list ($file) = each ($renamefiles))
{
$file_decoded = string_decode ($file, 1);
if (ereg ("/", $renamefiles[$file]))
{
echo $phpgw->common->error_list (array ("File names cannot contain /"));
}
elseif (!$phpgw->vfs->mv ($file_decoded, $renamefiles[$file]))
{
echo $phpgw->common->error_list (array ("Could not rename $disppath/$file_decoded to $disppath/$renamefiles[$file]"));
}
else
{
html_text_summary ("Renamed $disppath/$file_decoded to $disppath/$renamefiles[$file]");
}
}
html_break (2);
html_link_back ();
}
###
# Handle Moving Files and Directories
###
elseif ($move)
{
while (list ($num, $file) = each ($fileman))
{
$file_decoded = string_decode ($file, 1);
if ($phpgw->vfs->mv ($file_decoded, $todir . "/" . $file_decoded, array (RELATIVE_ALL, RELATIVE_NONE)))
{
$moved++;
html_text_summary ("Moved $disppath/$file_decoded to $todir/$file_decoded");
}
else
{
echo $phpgw->common->error_list (array ("Could not move $disppath/$file_decoded to $todir/$file_decoded"));
}
}
if ($moved)
{
html_break (2);
html_link ("$appname/index.php?path=$todir", "Go to $todir");
}
html_break (2);
html_link_back ();
}
###
# Handle Copying of Files and Directories
###
elseif ($copy)
{
while (list ($num, $file) = each ($fileman))
{
$file_decoded = string_decode ($file, 1);
if ($phpgw->vfs->cp ($file_decoded, $todir . "/" . $file_decoded, array (RELATIVE_ALL, RELATIVE_NONE)))
{
$copied++;
html_text_summary ("Copied $disppath/$file_decoded to $todir/$file_decoded");
}
else
{
echo $phpgw->common->error_list (array ("Could not copy $disppath/$file_decoded to $todir/$file_decoded"));
}
}
if ($copied)
{
html_break (2);
html_link ("$appname/index.php?path=$todir", "Go to $todir");
}
html_break (2);
html_link_back ();
}
###
# Handle Deleting Files and Directories
###
elseif ($delete)
{
$query = db_query ("SELECT name FROM phpgw_vfs WHERE owner_id = '$userinfo[username]'");
$numoffiles = db_call ("affected_rows", $query);
for ($i = 0; $i != $numoffiles; $i++)
{
if ($fileman[$i])
{
###
# There is no need to create a separate $fileman_decode variable, because it will never be passed again
###
$fileman[$i] = string_decode ($fileman[$i], 1);
if ($phpgw->vfs->delete ($fileman[$i]))
{
html_text_summary ("Deleted $disppath/$fileman[$i]", $fileinfo["size"]);
}
else
{
$phpgw->common->error_list (array ("Could not delete $disppath/$fileman[$i]"));
}
}
}
html_break (2);
html_link_back ();
}
elseif ($newdir && $createdir)
{
if ($badchar = bad_chars_file ($createdir, 1))
{
html_text_summary_error ("Cannot create directory $createdir&nbsp;&nbsp;&nbsp;(name contains \"$badchar\")");
html_break (2);
html_link_back ();
html_page_close ();
}
if ($createdir[strlen($createdir)-1] == " " || $createdir[0] == " ")
{
html_text_summary_error ("Cannot create directory $createdir because it begins or ends in a space", 1);
html_break (2);
html_link_back ();
html_page_close ();
}
$query = db_query ("SELECT name,mime_type FROM phpgw_vfs WHERE name = '$createdir' AND owner_id = '$userinfo[username]' AND directory = '$path'");
if ($fileinfo = db_fetch_array ($query))
{
if ($fileinfo[1] != "Directory")
{
html_text_summary_error ("$fileinfo[0] already exists as a file");
html_break (2);
html_link_back ();
html_page_close ();
}
else
{
html_text_summary_error ("Directory $fileinfo[0] already exists");
html_break (2);
html_link_back ();
html_page_close ();
}
}
else
{
$query = db_query ("SELECT SUM(size) FROM phpgw_vfs WHERE owner_id = '$userinfo[username]' AND name != '$file_name[$i]'");
$files = db_fetch_array ($query);
$usedspace = $files[0];
if (($usedspace + 1024) > $userinfo["hdspace"])
{
html_text_summary_error ("Sorry, you do not have enough space to create a new directory", 1);
html_page_close ();
}
if ($phpgw->vfs->mkdir ($createdir))
{
html_text_summary ("Created directory $disppath/$createdir");
html_break (2);
html_link ("$appname/index.php?path=$disppath/$createdir", "Go to $disppath/$createdir");
}
else
echo $phpgw->common->error_list (array ("Could not create $disppath/$createdir"));
}
html_break (2);
html_link_back ();
}
html_page_close ();
?>

48
filemanager/login.php Executable file
View File

@ -0,0 +1,48 @@
<?
require ("main.inc");
error_reporting (4);
if ($htaccess)
{
$username = $PHP_AUTH_USER;
$password = $PHP_AUTH_PW;
}
if ($username && $password)
{
$query = sql_query ("SELECT * FROM userinfo WHERE username = '$username'");
if (!mysql_num_rows($query))
{
echo "No such username";
login();
}
$query = sql_query ("SELECT * FROM userinfo WHERE username = '$username' AND password = PASSWORD('$password')");
if (!mysql_num_rows($query))
{
echo "Invalid password";
login ();
}
setcookie ("cookieusername", $username, 0, "$hostname_path", "$hostname_domain");
setcookie ("cookiepassword", $password, 0, "$hostname_path", "$hostname_domain");
$query = sql_query ("UPDATE userinfo SET lastlogin = NOW() WHERE username = '$username'");
$query = sql_query ("UPDATE userinfo SET lastip = '$REMOTE_ADDR' WHERE username = '$username'");
header ("Location: $hostname/users.php");
}
if ($cookieusername && $cookiepassword)
{
header ("Location: $hostname/users.php");
exit;
}
if (!$username || !$password)
login();
?>

108
filemanager/preferences.php Normal file
View File

@ -0,0 +1,108 @@
<?php
/**************************************************************************\
* phpGroupWare - PHPWebHosting *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "phpwebhosting", "enable_nextmatchs_class" => True, "noheader" => True, "nonavbar" => True);
include("../header.inc.php");
/*
To add a preference, just add it here. Key is internal name, value is displayed name
*/
$other_checkboxes = array ("dotdot" => "Show ..", "dotfiles" => "Show .files");
if ($submit)
{
$phpgw->preferences->read_repository ();
reset ($file_attributes);
while (list ($internal, $displayed) = each ($file_attributes))
{
$phpgw->preferences->add ($phpgw_info["flags"]["currentapp"], $internal, $$internal);
}
reset ($other_checkboxes);
while (list ($internal, $displayed) = each ($other_checkboxes))
{
$phpgw->preferences->add ($phpgw_info["flags"]["currentapp"], $internal, $$internal);
}
$phpgw->preferences->save_repository (True);
Header('Location: '.$phpgw->link('/preferences/index.php'));
$phpgw->common->phpgw_exit();
}
function display_item ($field,$data)
{
global $phpgw, $p, $tr_color;
$tr_color = $phpgw->nextmatchs->alternate_row_color ($tr_color);
$var = array (
'bg_color' => $tr_color,
'field' => $field,
'data' => $data
);
$p->set_var ($var);
$p->parse ('row', 'pref_list', True);
}
$phpgw->common->phpgw_header ();
echo parse_navbar ();
$p = CreateObject ('phpgwapi.Template', $phpgw->common->get_tpl_dir ('phpwebhosting'));
$templates = array (
'pref' => 'pref.tpl',
'pref_colspan' => 'pref_colspan.tpl',
'pref_list' => 'pref_list.tpl',
);
$p->set_file ($templates);
$var = array (
'title' => lang ('PHPWebHosting preferences'),
'action_url' => $phpgw->link ('/' . $phpgw_info['flags']['currentapp'] . '/preferences.php'),
'bg_color' => $phpgw_info['theme']['th_bg'],
'submit_lang' => lang ('submit')
);
$p->set_var ($var);
$p->set_var ('text', '&nbsp;');
$p->parse ('row', 'pref_colspan', True);
if ($totalerrors)
{
echo '<p><center>' . $phpgw->common->error_list($errors) . '</center>';
}
while (list ($internal, $displayed) = each ($file_attributes))
{
unset ($checked);
if ($phpgw_info["user"]["preferences"]["phpwebhosting"][$internal])
$checked = 1;
$str .= html_form_input ("checkbox", $internal, NULL, NULL, NULL, $checked, NULL, 1) . " $displayed" . html_break (1, NULL, 1);
}
display_item (lang ('Display attributes'), $str);
while (list ($internal, $displayed) = each ($other_checkboxes))
{
unset ($checked);
if ($phpgw_info["user"]["preferences"]["phpwebhosting"][$internal])
$checked = 1;
$str = html_form_input ("checkbox", $internal, NULL, NULL, NULL, $checked, NULL, 1);
display_item (lang ($displayed), $str);
}
$p->pparse ('out', 'pref');
$phpgw->common->phpgw_footer ();
?>

View File

@ -0,0 +1,2 @@
<!-- $Id$ -->
<th width="11%" bgcolor="{bgcolor}"><font color="{font_color}">{col_title}</font></th>

View File

@ -0,0 +1,32 @@
<!-- $Id$ -->
{printer_friendly}
<table border="0" width="100%">
<tr>
<td valign="top" width="70%">
<tr>
<td>
<table border="0" width=100%>
<tr>
<td align="middle">
<font size="+2" color="{bg_text}"><b>{date}</b></font><br>
<font size="+1" color="{bg_text}">{username}</font>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="{bg_text}">
{daily_events}
</td>
</tr>
</table>
</td>
<td valign="top" align="right">
{small_calendar}
</td>
</tr>
</td>
</tr>
</table>
{print}

View File

@ -0,0 +1,33 @@
<!-- $Id$ -->
<style type="text/css">
<!--
.event
{
width: 91%
color: #{font_color};
font-family: {font};
font-weight: 100;
font-size: 80%;
line-height: 220%;
vertical-align: middle;
}
.time
{
width: 9%;
background-image: url('{bg_time_image}');
color: #{font_color};
font-family: {font};
font-size: 65%;
line-height: 220%;
vertical-align: middle;
}
-->
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
{row}
</table>

View File

@ -0,0 +1,7 @@
<!-- $Id$ -->
<!-- BEGIN day_row -->
<tr>
<td bgcolor="{bgcolor}"{extras}>{event}</td>
<th width="14%" bgcolor="{bgcolor1}"><font color="{font_color}">{open_link}{time}{close_link}</font></th>
</tr>
<!-- END day_row -->

View File

@ -0,0 +1,3 @@
<!-- $Id$ -->
<td class="event" bgcolor="{bgcolor}"{extras}>{event}</td>

View File

@ -0,0 +1,3 @@
<!-- $Id$ -->
<td class="time"><table width="100%" border="1" cellspacing="0" cellpadding="0"><tr><td class="time">{open_link}{time}{close_link}</td></tr></table></td>

View File

@ -0,0 +1,28 @@
<!-- $Id$ -->
<!-- BEGIN edit_entry_begin -->
<body bgcolor="#C0C0C0">
<center>
<h2><font color="#000000">{calendar_action}</font></h2>
<form action="{action_url}" method="post" name="addform">
{common_hidden}
<table border="0" width="75%">
<tr>
<td colspan="2">
<center><h1>{errormsg}</h1></center>
<hr>
</td>
</tr>
<!-- END edit_entry_begin -->
{output}
<!-- BEGIN edit_entry_end -->
</table>
<input type="submit" value="{submit_button}">
</form>
{delete_button}
</center>
<!-- END edit_entry_end -->

View File

@ -0,0 +1,8 @@
<br clear="all">
<hr clear="all">
<font size="-1">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
{output}
</tr>
</table>

View File

@ -0,0 +1,13 @@
<td valign="top" width="33%">
<font size="-1">
<form action="{action_url}" method="post" name="{form_name}">
<B>{label}:</B>
<select name="{form_label}" onchange="{form_onchange}">
{row}
</select>
<noscript><input type="submit" value="{go}"></noscript>
</form>
</font>
</td>

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<!-- BEGIN form_button -->
<form action="{action_url_button}" method="post" name="{action_text_button}form">
<input type="submit" value="{action_text_button}" {action_confirm_button}>
</form>
<!-- END form_button -->

View File

@ -0,0 +1,7 @@
<!-- $Id$ -->
<tr>
<td colspan="2">
{hr_text}
</td>
</tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,29 @@
<!-- $Id$ -->
{printer_friendly}
<head>
<style type="text/css">
.tablecell {
width: 80px;
height: 80px;
}
</style>
</head>
<table border="0" width="100%">
<tr>
<td align="left" valign="top">
{small_calendar_prev}
</td>
<td align="middle">
<font size="+2" color="#000000"><b>{month_identifier}</b></font>
<font size="+1" color="#000000"><br>{username}</font>
</td>
<td align="right" valign="top">
{small_calendar_next}
</td>
</tr>
</table>
{large_month}
<p>
<p>
{print}

View File

@ -0,0 +1,4 @@
<!-- $Id$ link_pict -->
<a href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;">
<img src="{pic_image}" width="5" height="7" alt="{description}" border="0">

View File

@ -0,0 +1,7 @@
<!-- $Id$ -->
<!-- BEGIN list -->
<tr>
<td valign="top" width="35%"><b>{field}:</b></td>
<td valign="top" width="65%">{data}</td>
</tr>
<!-- END list -->

View File

@ -0,0 +1,19 @@
<!-- $Id$ -->
<!-- BEGIN matrix_query_begin -->
<center>
<h2><font color="#000000">{matrix_action}</font></h2>
<form target="viewmatrix" action="{action_url}" method="post" name="matrixform">
<table border="0" width="75%">
<!-- END matrix_query_begin -->
{output}
<!-- BEGIN matrix_query_end -->
</table>
<input type="submit" value="{submit_button}">
</form>
{cancel_button}
</center>
<!-- END matrix_query_end -->

View File

@ -0,0 +1,37 @@
<!-- $Id$ -->
<!-- BEGIN mini_cal -->
<style type="text/css">
<!--
.minicalendar
{
color: #000000;
}
.minicalendargrey
{
color: #999999;
}
-->
</style>
<table border="0" cellspacing="0" cellpadding="0" valign="top" bgcolor="{bgcolor}" width="46%">
<tr valign="center" bgcolor="{bgcolor}">
<td align="left" colspan="5"><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;<b>{month}</b></font></td>
<td align="right" colspan="2"><a href="{prevmonth}"><img src="{img_root}/left.gif" border="0"></a>&nbsp;&nbsp;<a href="{nextmonth}"><img src="{img_root}/right.gif" border="0"></a></td>
</tr>
<tr>
<td bgcolor="{bgcolor}" align="center" colspan="7"><img src="{cal_img_root}/mini-calendar-bar.gif" width="90%" height="5"></td>
</tr>
<tr valign="top">
<td bgcolor="{bgcolor}" colspan="7">
<table border="0" width="100%" cellspacing="7" cellpadding="0" valign="top" cols="7">
<tr>{daynames}
</tr>{display_monthweek}
</table>
</td>
</tr>
</table>
<!-- END mini_cal -->

View File

@ -0,0 +1,4 @@
<!-- $Id$ -->
<!-- BEGIN mini_day -->
<td bgcolor="{bgcolor}" align="center"{day_image}><font size="-2">{dayname}</font></td>
<!-- END mini_day -->

View File

@ -0,0 +1,5 @@
<!-- $Id$ -->
<!-- BEGIN mini_week -->
<tr>{monthweek_day}
</tr>
<!-- END mini_week -->

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<table width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2" cellpadding="2">
{row}
</table>

View File

@ -0,0 +1,5 @@
<!-- $Id$ month_column -->
<td valign="top" width="75" height="75"{extra}>
{column_data}
</td>

View File

@ -0,0 +1,4 @@
<!-- $Id$ month_day -->
{new_event_link}
[ {day_number} ]<br>

View File

@ -0,0 +1,2 @@
<!-- $Id$ -->
{month_filler_text}

View File

@ -0,0 +1,3 @@
<!-- $Id$ -->
<tr>
{column_header}</tr>

View File

@ -0,0 +1,14 @@
<!-- $Id$ -->
<!-- BEGIN overlap -->
<center>
<h2>
<font color="{color}">Scheduling Conflict</font>
</h2>
<table>
<tr><td>{overlap_text}</td></tr>
<tr><td><ul>{overlap_list}</ul></td></tr>
</table>
{resubmit_button}
{reedit_button}
</center>
<!-- END overlap -->

View File

@ -0,0 +1,7 @@
<p><b>{title}:</b><hr><p>
<form action="{action_url}" method="POST">
<table border="0" align="center" width="50%">
{row}
</table>
<center><input type="submit" name="submit" value="{submit_lang}"></center>
</form>

View File

@ -0,0 +1,4 @@
<tr bgcolor="{bg_color}">
<td colspan="2">{text}</td>
</tr>

View File

@ -0,0 +1,5 @@
<tr bgcolor="{bg_color}">
<td align="right">{field}</td>
<td align="center">{data}</td>
</tr>

View File

@ -0,0 +1,27 @@
{errors}
{title}
<table border="0" align="center" width="70%">
<tr>
{nml}
<td width="40%">
<div align="center">
<form method="POST" action="{action_url}">
{common_hidden_vars}
<input type="text" name="query" value="{search_value}">
<input type="submit" name="search" value="{search}">
</form>
</div>
</td>
{nmr}
</tr>
</table>
<form method="POST" action="{action_url}">
<table border="0" align="center" width="50%" cols="4">
{row}
</table>
{common_hidden_vars_form}
<input type="hidden" name="processed" value="{processed}">
<center><input type="submit" name="submit" value="{submit_lang}"></center>
</form>

View File

@ -0,0 +1,9 @@
<!-- $Id$ -->
<tr bgcolor="{row_color}">
<td>{user}</td>
<td align="center"><input type="checkbox" name="{read}" value="Y"{read_selected}></td>
<td align="center"><input type="checkbox" name="{add}" value="Y"{add_selected}></td>
<td align="center"><input type="checkbox" name="{edit}" value="Y"{edit_selected}></td>
<td align="center"><input type="checkbox" name="{delete}" value="Y"{delete_selected}></td>
<td align="center"><input type="checkbox" name="{private}" value="Y"{private_selected}></td>
</tr>

View File

@ -0,0 +1,8 @@
<tr bgcolor="{bg_color}">
<td>{string}</td>
<td align="center">{read_lang}</td>
<td align="center">{add_lang}</td>
<td align="center">{edit_lang}</td>
<td align="center">{delete_lang}</td>
<td align="center">{private_lang}</td>
</tr>

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<h2><font color="{color}">{search_text}</font></h2>
<b>{quantity}</b><p>
{output}
<p>

View File

@ -0,0 +1,4 @@
<!-- $Id$ -->
<!-- BEGIN search_list -->
<li><a href="{url_result}">{result_desc}</a>
<!-- END search_list -->

View File

@ -0,0 +1,21 @@
<!-- $Id$ -->
<!-- BEGIN view_begin -->
<center>
<h2>
<font color="{bg_text}">
{name}
</font>
</h2>
<table border="0" width="50%">
<!-- END view_begin -->
{output}
<!-- BEGIN view_end -->
</table>
<p>
{edit_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{delete_button}
</center>
<!-- END view_end -->

View File

@ -0,0 +1,33 @@
<!-- $Id$ -->
{printer_friendly}
<head>
<style type="text/css">
.tablecell {
width: 80px;
height: 80px;
}
</style>
</head>
<table border=0 width=100%>
<tr>
<td align="left" valign="top">
{small_calendar_prev}
</td>
<td align="left">
{prev_week_link}
</td>
<td align="center" valign="top">
{small_calendar_this}
<font size="+2" color="#000000"><b>{week_identifier}</b></font>
<font size="+2" color="#000000"><br>{username}</font>
</td>
<td align="right">
{next_week_link}
</td>
<td align="right" valign="top">
{small_calendar_next}
</td>
</tr>
</table>
{week_display}
{print}

View File

@ -0,0 +1,5 @@
<!-- $Id$ -->
{link_entry}
<nobr><font size="-2">{start_time}{end_time}</font></nobr>{close_view_link}&nbsp;
<font size="-1">{name}<br></font>

View File

@ -0,0 +1,4 @@
<!-- $Id$ -->
<font size="{week_day_font_size}">
{events}
</font>

View File

@ -0,0 +1,2 @@
<!-- $Id$ -->
<th width="11%" bgcolor="{bgcolor}"><font color="{font_color}">{col_title}</font></th>

View File

@ -0,0 +1,32 @@
<!-- $Id$ -->
{printer_friendly}
<table border="0" width="100%">
<tr>
<td valign="top" width="70%">
<tr>
<td>
<table border="0" width=100%>
<tr>
<td align="middle">
<font size="+2" color="{bg_text}"><b>{date}</b></font><br>
<font size="+1" color="{bg_text}">{username}</font>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="{bg_text}">
{daily_events}
</td>
</tr>
</table>
</td>
<td valign="top" align="right">
{small_calendar}
</td>
</tr>
</td>
</tr>
</table>
{print}

View File

@ -0,0 +1,33 @@
<!-- $Id$ -->
<style type="text/css">
<!--
.event
{
width: 91%
color: #{font_color};
font-family: {font};
font-weight: 100;
font-size: 80%;
line-height: 220%;
vertical-align: middle;
}
.time
{
width: 9%;
background-image: url('{bg_time_image}');
color: #{font_color};
font-family: {font};
font-size: 65%;
line-height: 220%;
vertical-align: middle;
}
-->
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
{row}
</table>

View File

@ -0,0 +1,7 @@
<!-- $Id$ -->
<!-- BEGIN day_row -->
<tr>
<td bgcolor="{bgcolor}"{extras}>{event}</td>
<th width="14%" bgcolor="{bgcolor1}"><font color="{font_color}">{open_link}{time}{close_link}</font></th>
</tr>
<!-- END day_row -->

View File

@ -0,0 +1,3 @@
<!-- $Id$ -->
<td class="event" bgcolor="{bgcolor}"{extras}>{event}</td>

View File

@ -0,0 +1,3 @@
<!-- $Id$ -->
<td class="time"><table width="100%" border="1" cellspacing="0" cellpadding="0"><tr><td class="time">{open_link}{time}{close_link}</td></tr></table></td>

View File

@ -0,0 +1,28 @@
<!-- $Id$ -->
<!-- BEGIN edit_entry_begin -->
<body bgcolor="#C0C0C0">
<center>
<h2><font color="#000000">{calendar_action}</font></h2>
<form action="{action_url}" method="post" name="addform">
{common_hidden}
<table border="0" width="75%">
<tr>
<td colspan="2">
<center><h1>{errormsg}</h1></center>
<hr>
</td>
</tr>
<!-- END edit_entry_begin -->
{output}
<!-- BEGIN edit_entry_end -->
</table>
<input type="submit" value="{submit_button}">
</form>
{delete_button}
</center>
<!-- END edit_entry_end -->

View File

@ -0,0 +1,8 @@
<br clear="all">
<hr clear="all">
<font size="-1">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
{output}
</tr>
</table>

View File

@ -0,0 +1,13 @@
<td valign="top" width="33%">
<font size="-1">
<form action="{action_url}" method="post" name="{form_name}">
<B>{label}:</B>
<select name="{form_label}" onchange="{form_onchange}">
{row}
</select>
<noscript><input type="submit" value="{go}"></noscript>
</form>
</font>
</td>

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<!-- BEGIN form_button -->
<form action="{action_url_button}" method="post" name="{action_text_button}form">
<input type="submit" value="{action_text_button}" {action_confirm_button}>
</form>
<!-- END form_button -->

View File

@ -0,0 +1,7 @@
<!-- $Id$ -->
<tr>
<td colspan="2">
{hr_text}
</td>
</tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,29 @@
<!-- $Id$ -->
{printer_friendly}
<head>
<style type="text/css">
.tablecell {
width: 80px;
height: 80px;
}
</style>
</head>
<table border="0" width="100%">
<tr>
<td align="left" valign="top">
{small_calendar_prev}
</td>
<td align="middle">
<font size="+2" color="#000000"><b>{month_identifier}</b></font>
<font size="+1" color="#000000"><br>{username}</font>
</td>
<td align="right" valign="top">
{small_calendar_next}
</td>
</tr>
</table>
{large_month}
<p>
<p>
{print}

View File

@ -0,0 +1,4 @@
<!-- $Id$ link_pict -->
<a href="{link_link}" onMouseOver="window.status='{lang_view}'; return true;">
<img src="{pic_image}" width="5" height="7" alt="{description}" border="0">

View File

@ -0,0 +1,7 @@
<!-- $Id$ -->
<!-- BEGIN list -->
<tr>
<td valign="top" width="35%"><b>{field}:</b></td>
<td valign="top" width="65%">{data}</td>
</tr>
<!-- END list -->

View File

@ -0,0 +1,19 @@
<!-- $Id$ -->
<!-- BEGIN matrix_query_begin -->
<center>
<h2><font color="#000000">{matrix_action}</font></h2>
<form target="viewmatrix" action="{action_url}" method="post" name="matrixform">
<table border="0" width="75%">
<!-- END matrix_query_begin -->
{output}
<!-- BEGIN matrix_query_end -->
</table>
<input type="submit" value="{submit_button}">
</form>
{cancel_button}
</center>
<!-- END matrix_query_end -->

View File

@ -0,0 +1,37 @@
<!-- $Id$ -->
<!-- BEGIN mini_cal -->
<style type="text/css">
<!--
.minicalendar
{
color: #000000;
}
.minicalendargrey
{
color: #999999;
}
-->
</style>
<table border="0" cellspacing="0" cellpadding="0" valign="top" bgcolor="{bgcolor}" width="46%">
<tr valign="center" bgcolor="{bgcolor}">
<td align="left" colspan="5"><font size="-2">&nbsp;&nbsp;&nbsp;&nbsp;<b>{month}</b></font></td>
<td align="right" colspan="2"><a href="{prevmonth}"><img src="{img_root}/left.gif" border="0"></a>&nbsp;&nbsp;<a href="{nextmonth}"><img src="{img_root}/right.gif" border="0"></a></td>
</tr>
<tr>
<td bgcolor="{bgcolor}" align="center" colspan="7"><img src="{cal_img_root}/mini-calendar-bar.gif" width="90%" height="5"></td>
</tr>
<tr valign="top">
<td bgcolor="{bgcolor}" colspan="7">
<table border="0" width="100%" cellspacing="7" cellpadding="0" valign="top" cols="7">
<tr>{daynames}
</tr>{display_monthweek}
</table>
</td>
</tr>
</table>
<!-- END mini_cal -->

View File

@ -0,0 +1,4 @@
<!-- $Id$ -->
<!-- BEGIN mini_day -->
<td bgcolor="{bgcolor}" align="center"{day_image}><font size="-2">{dayname}</font></td>
<!-- END mini_day -->

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<!-- BEGIN mini_week -->
<tr>
{monthweek_day}
</tr>
<!-- END mini_week -->

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<table width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2" cellpadding="2">
{row}
</table>

View File

@ -0,0 +1,5 @@
<!-- $Id$ month_column -->
<td valign="top" width="75" height="75"{extra}>
{column_data}
</td>

View File

@ -0,0 +1,4 @@
<!-- $Id$ month_day -->
{new_event_link}
[ {day_number} ]<br>

View File

@ -0,0 +1,2 @@
<!-- $Id$ -->
{month_filler_text}

View File

@ -0,0 +1,3 @@
<!-- $Id$ -->
<tr>
{column_header}</tr>

View File

@ -0,0 +1,14 @@
<!-- $Id$ -->
<!-- BEGIN overlap -->
<center>
<h2>
<font color="{color}">Scheduling Conflict</font>
</h2>
<table>
<tr><td>{overlap_text}</td></tr>
<tr><td><ul>{overlap_list}</ul></td></tr>
</table>
{resubmit_button}
{reedit_button}
</center>
<!-- END overlap -->

View File

@ -0,0 +1,7 @@
<p><b>{title}:</b><hr><p>
<form action="{action_url}" method="POST">
<table border="0" align="center" width="50%">
{row}
</table>
<center><input type="submit" name="submit" value="{submit_lang}"></center>
</form>

View File

@ -0,0 +1,4 @@
<tr bgcolor="{bg_color}">
<td colspan="2">{text}</td>
</tr>

View File

@ -0,0 +1,5 @@
<tr bgcolor="{bg_color}">
<td align="right">{field}</td>
<td align="center">{data}</td>
</tr>

View File

@ -0,0 +1,27 @@
{errors}
{title}
<table border="0" align="center" width="70%">
<tr>
{nml}
<td width="40%">
<div align="center">
<form method="POST" action="{action_url}">
{common_hidden_vars}
<input type="text" name="query" value="{search_value}">
<input type="submit" name="search" value="{search}">
</form>
</div>
</td>
{nmr}
</tr>
</table>
<form method="POST" action="{action_url}">
<table border="0" align="center" width="50%" cols="4">
{row}
</table>
{common_hidden_vars_form}
<input type="hidden" name="processed" value="{processed}">
<center><input type="submit" name="submit" value="{submit_lang}"></center>
</form>

View File

@ -0,0 +1,9 @@
<!-- $Id$ -->
<tr bgcolor="{row_color}">
<td>{user}</td>
<td align="center"><input type="checkbox" name="{read}" value="Y"{read_selected}></td>
<td align="center"><input type="checkbox" name="{add}" value="Y"{add_selected}></td>
<td align="center"><input type="checkbox" name="{edit}" value="Y"{edit_selected}></td>
<td align="center"><input type="checkbox" name="{delete}" value="Y"{delete_selected}></td>
<td align="center"><input type="checkbox" name="{private}" value="Y"{private_selected}></td>
</tr>

View File

@ -0,0 +1,8 @@
<tr bgcolor="{bg_color}">
<td>{string}</td>
<td align="center">{read_lang}</td>
<td align="center">{add_lang}</td>
<td align="center">{edit_lang}</td>
<td align="center">{delete_lang}</td>
<td align="center">{private_lang}</td>
</tr>

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<h2><font color="{color}">{search_text}</font></h2>
<b>{quantity}</b><p>
{output}
<p>

View File

@ -0,0 +1,4 @@
<!-- $Id$ -->
<!-- BEGIN search_list -->
<li><a href="{url_result}">{result_desc}</a>
<!-- END search_list -->

View File

@ -0,0 +1,21 @@
<!-- $Id$ -->
<!-- BEGIN view_begin -->
<center>
<h2>
<font color="{bg_text}">
{name}
</font>
</h2>
<table border="0" width="50%">
<!-- END view_begin -->
{output}
<!-- BEGIN view_end -->
</table>
<p>
{edit_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{delete_button}
</center>
<!-- END view_end -->

View File

@ -0,0 +1,33 @@
<!-- $Id$ -->
{printer_friendly}
<head>
<style type="text/css">
.tablecell {
width: 80px;
height: 80px;
}
</style>
</head>
<table border=0 width=100%>
<tr>
<td align="left" valign="top">
{small_calendar_prev}
</td>
<td align="left">
{prev_week_link}
</td>
<td align="center" valign="top">
{small_calendar_this}
<font size="+2" color="#000000"><b>{week_identifier}</b></font>
<font size="+2" color="#000000"><br>{username}</font>
</td>
<td align="right">
{next_week_link}
</td>
<td align="right" valign="top">
{small_calendar_next}
</td>
</tr>
</table>
{week_display}
{print}

View File

@ -0,0 +1,5 @@
<!-- $Id$ -->
{link_entry}
<nobr><font size="-2">{start_time}{end_time}</font></nobr>{close_view_link}&nbsp;
<font size="-1">{name}<br></font>

View File

@ -0,0 +1,4 @@
<!-- $Id$ -->
<font size="{week_day_font_size}">
{events}
</font>

210
filemanager/test.php Normal file
View File

@ -0,0 +1,210 @@
<?
$phpgw_info["flags"] = array("currentapp" => "phpwebhosting",
"noheader" => False,
"noappheader" => False,
"enable_vfs_class" => True);
include("../header.inc.php");
/*
General format for output is:
function - current directory - input[...] - what output should be - what output was
*/
html_break (1);
html_text_italic (PHP_OS . " - " . $phpgw_info["server"]["db_type"] . " - " . PHP_VERSION);
html_break (1);
###
# start of getabsolutepath tests
$sep = $phpgw_info["server"]["dir_separator"];
$user = $phpgw->vfs->working_lid;
$homedir = $phpgw->vfs->fakebase . "/" . $user;
$filesdir = $phpgw->vfs->basedir;
$currentapp = $phpgw_info["flags"]["currentapp"];
$phpgw->vfs->cd ();
$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))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i)) != $o)
{
echo "<br>getabsolutepath - $cd - $i - $o - $ao";
}
}
$cd = "test";
$phpgw->vfs->cd ($cd, False, 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/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i)) != $o)
{
echo "<br>getabsolutepath - $cd - $i - $o - $ao";
}
}
$cd = "test/test2/test3";
$phpgw->vfs->cd ($cd, False, 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/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i)) != $o)
{
echo "<br>getabsolutepath - $cd - $i - $o - $ao";
}
}
/* Actually means cd to home directory */
$cd = "";
$phpgw->vfs->cd ($cd);
$relatives = array (RELATIVE_USER);
$io = array ("" => "$homedir", "dir" => "$homedir/dir", "dir/file" => "$homedir/dir/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$homedir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o)
{
echo "<br>getabsolutepath - $cd - $i - $relatives[0] - $o - $ao";
}
}
/* $cd shouldn't affect this test, but we'll set it anyways */
$cd = "test2/test4";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE));
$relatives = array (RELATIVE_NONE);
$io = array ("" => "", "dir" => "dir", "dir/file" => "dir/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o)
{
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
}
}
/* $cd shouldn't affect this test, but we'll set it anyways */
$cd = "test3/test5";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE));
$relatives = array (RELATIVE_USER_APP);
$io = array ("" => "$homedir/.$currentapp", "dir" => "$homedir/.$currentapp/dir", "dir/dir2" => "$homedir/.$currentapp/dir/dir2", "dir/file" => "$homedir/.$currentapp/dir/file", "dir/dir2/dir3/file" => "$homedir/.$currentapp/dir/dir2/dir3/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$homedir/.$currentapp/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o)
{
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
}
}
/* $cd shouldn't affect this test, but we'll set it anyways */
$cd = "test4/test6";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE));
$relatives = array (RELATIVE_ROOT);
$io = array ("" => "", "dir" => "/dir", "/dir/dir2/dir3" => "/dir/dir2/dir3", "dir/file" => "/dir/file", "dir/dir2/dir3" => "/dir/dir2/dir3", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives)) != $o)
{
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
}
}
/* Now a few to test the VFS_REAL capabilities */
$cd = "";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE));
$relatives = array (RELATIVE_ROOT|VFS_REAL);
$io = array ("" => "$filesdir", "dir" => "$filesdir/dir", "dir/dir2/dir3" => "$filesdir/dir/dir2/dir3", "dir/file" => "$filesdir/dir/file", "dir/dir2/dir3/file" => "$filesdir/dir/dir2/dir3/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$filesdir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) == $o)
{
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
}
}
$cd = "test5/test7";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_NONE));
$relatives = array (RELATIVE_USER|VFS_REAL);
$io = array ("" => "$filesdir$homedir", "dir" => "$filesdir$homedir/dir", "dir/dir2/dir3" => "$filesdir$homedir/dir/dir2/dir3", "dir/file" => "$filesdir$homedir/dir/file", "dir/dir2/dir3/file" => "$filesdir$homedir/dir/dir2/dir3/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$filesdir$homedir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o)
{
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
}
}
$cd = "test6/test8";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_USER));
/* RELATIVE_CURRENT should be implied */
$relatives = array (VFS_REAL);
$io = array ("" => "$filesdir$homedir/$cd", "dir" => "$filesdir$homedir/$cd/dir", "dir/dir2/dir3" => "$filesdir$homedir/$cd/dir/dir2/dir3", "dir/file" => "$filesdir$homedir/$cd/dir/file", "dir/dir2/dir3/file" => "$filesdir$homedir/$cd/dir/dir2/dir3/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$filesdir$homedir/$cd/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o)
{
echo "<br>getabsolutepath - $cd - $i - $relatives[0] - $o - $ao";
}
}
$cd = "test7/test9";
$phpgw->vfs->cd ($cd, False, array (RELATIVE_USER));
$relatives = array (RELATIVE_USER_APP|VFS_REAL);
$io = array ("" => "$filesdir$homedir/.$currentapp", "dir" => "$filesdir$homedir/.$currentapp/dir", "dir/dir2/dir3" => "$filesdir$homedir/.$currentapp/dir/dir2/dir3", "dir/file" => "$filesdir$homedir/.$currentapp/dir/file", "dir/dir2/dir3/file" => "$filesdir$homedir/.$currentapp/dir/dir2/dir3/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$filesdir$homedir/.$currentapp/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
{
if (($ao = $phpgw->vfs->getabsolutepath ($i, $relatives, False)) != $o)
{
echo "<br>getabsolutepath - $cd (shouldn't matter) - $i - $relatives[0] - $o - $ao";
}
}
# end of getabsolutepath tests
###
###
# start of path_parts tests
/* Just for convienience
$io = array ("" => array ("fake_full_path" => "", "fake_leading_dirs" => "", "fake_extra_path" => "", "fake_name" => "", "real_full_path" => "", "real_leading_dirs" => "", "real_extra_path" => "", "real_name" => ""));
`~!@#$%^&*()-_=+/|[{]};:'\",<.>?
*/
$cd = "test8/test10";
$relatives[0] = RELATIVE_USER;
$phpgw->vfs->cd ($cd, False, array ($relatives[0]));
$subhome = substr ($homedir, 1);
$io = array ("" => array ("fake_full_path" => "$homedir/$cd", "fake_leading_dirs" => "$homedir/test8", "fake_extra_path" => "$subhome/test8", "fake_name" => "test10", "real_full_path" => "$filesdir$homedir/$cd", "real_leading_dirs" => "$filesdir$homedir/test8", "real_extra_path" => "$subhome/test8", "real_name" => "test10"), "dir2/file" => array ("fake_full_path" => "$homedir/$cd/dir2/file", "fake_leading_dirs" => "$homedir/$cd/dir2", "fake_extra_path" => "$subhome/$cd/dir2", "fake_name" => "file", "real_full_path" => "$filesdir$homedir/$cd/dir2/file", "real_leading_dirs" => "$filesdir$homedir/$cd/dir2", "real_extra_path" => "$subhome/$cd/dir2", "real_name" => "file"), "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => array ("fake_full_path" => "$homedir/$cd/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?", "fake_leading_dirs" => "$homedir/$cd/`~!@#$%^&*()-_=+", "fake_extra_path" => "$subhome/$cd/`~!@#$%^&*()-_=+", "fake_name" => "|[{]};:'\",<.>?", "real_full_path" => "$filesdir$homedir/$cd/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?", "real_leading_dirs" => "$filesdir$homedir/$cd/`~!@#$%^&*()-_=+", "real_extra_path" => "$subhome/$cd/`~!@#$%^&*()-_=+", "real_name" => "|[{]};:'\",<.>?"));
while (list ($i, $o) = each ($io))
{
$ao = $phpgw->vfs->path_parts ($i);
while (list ($key, $value) = each ($o))
{
if ($ao->$key != $o[$key])
{
echo "<br>path_parts - $cd - $i - $relatives[0] - $key - $o[$key] - $ao[$key]";
}
}
}
# end of path_parts tests
###
html_break (2);
html_text_bold ("The less output, the better. Please send errors to the current VFS maintainer (NOT the PHPWebHosting maintainer (although they may be one in the same)). Thanks!");
html_page_close ();
?>