Your IP : 216.73.217.64
<?php
/* *************************************************
*
* Document Manager (C) 2002-2010
* Version 4 - dmanager MySQL
* Benjamin Sonntag <benjamin@sonntag.fr>
* Chantal Bernard-Putz <chantal@bernard-putz.net>
* Franck Denis
* This software is protected by copyright laws,
* please read the file COPYRIGHT
* This software is provided as is with no warranty.
*
************************************************* */
/* $Id: browser.php 55 2011-06-29 10:58:11Z benjamin $ */
require_once ("common.php");
$fields = array (
"dir" => array ("request", "integer", 0),
"comment" => array ("get", "integer", 0),
"action" => array ("post", "string", ""),
"folder" => array ("post", "string", ""),
"sort" => array ("get", "integer", 0),
"newcomment" => array ("post", "string", ""),
"sendmail" => array ("post", "integer", 0),
);
getFields($fields);
if ($dir != 0 && $doc->hasRight($_SESSION["Sid_user"], "", $dir) === false)
{
header("Location: browser.php");
exit();
}
// IMPORTANT !!!
// $dir = $doc->securefolder($dir);
$doc->sort = $sort;
if ($comment == 1)
{
$_SESSION["Sshow_com"] = 1;
$doc->updateUserShowComment($_SESSION["Sid_user"], 1);
}
if ($comment == 2)
{
$_SESSION["Sshow_com"] = 0;
$doc->updateUserShowComment($_SESSION["Sid_user"], 0);
}
if ($action == "createfolder" && $folder)
{
if (!$doc->hasRight($_SESSION["Sid_user"], "f", $dir))
$error = _l("You cannot create folders !");
else
{
if (!$doc->createFolder($dir, $folder))
$error = $doc->errstr();
else
$error = _l("Directory successfully created !");
}
}
if ($action == "uploadfile" && !empty($_FILES))
{
if (!$doc->hasRight($_SESSION["Sid_user"], "u", $dir))
$error = _l("You cannot upload documents !");
else
{
if (!$doc->uploadFile($dir, $_FILES["upload"], $newcomment))
$error = $doc->errstr();
else
$error = _l("File successfully uploaded !");
}
if (($doc->config["conf_mailcondition"] == 1) || ($doc->config["conf_mailcondition"] > 1 && $sendmail))
{
if (!$doc->sendMail($_SESSION["Sid_user"], $dir, $_FILES["upload"]["name"], $newcomment))
$error = $doc->errstr();
}
}
$title = _l("Document Manager");
require_once ("head.php");
?>
<p> </p>
<h1><?php echo _l("Document Manager"); ?></h1>
<p style="display: inline"><br /></p>
<?php if (!empty($error)) { echo "<p class=\"error\">" . $error . "</p>"; } ?>
<table style="width: 85%" cellpadding="1" cellspacing="0" class="center">
<tr>
<?php if ($_SESSION["Suser_admin"] == 1) { ?>
<td style="width: 30px"> </td>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>admin.png" alt="<?php __l("Admin") ?>" /> <a href="users_admin.php"><?php __l("Admin") ?></a></td>
<td style="width: 30px"> </td>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>recalcul.png" alt="<?php __l("Refresh this folder") ?>" /> <a href="calculfolder.php?folder=<?php echo $dir; ?>"><?php __l("Refresh this folder") ?></a></td>
<?php } ?>
<?php if ($_SESSION["Suser_ccp"] == 1) { ?>
<td style="width: 30px"> </td>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>password.png" alt="<?php __l("Change password") ?>" /> <a href="passwd.php?dir=<?= urlencode($dir); ?>"><?php __l("Change password") ?></a></td>
<?php } ?>
<td style="width: 30px"> </td>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>comment<?php echo (!empty($_SESSION["Sshow_com"]) ? "hide" : ""); ?>.png" alt="<?php __l("Show comments"); ?>" /> <a href="browser.php?dir=<?php echo $dir; ?>&sort=<?php echo $sort; ?>&comment=<?php echo (!empty($_SESSION["Sshow_com"]) ? "2\">" . _l("Hide comments") : "1\">" . _l("Show comments")); ?></a></td>
<?php if ($doc->config["conf_showhelpbutton"]) { ?>
<td style="width: 30px"> </td>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>help.png" alt="<?php __l("Help") ?>" /> <a href="javascript:help();"><?php __l("Help") ?></a></td>
<?php } ?>
<td style="width: 30px"> </td>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>exit.png" alt="<?php __l("Disconnect") ?>" /> <a href="logout.php"><?php __l("Disconnect") ?></a></td>
</tr>
</table>
<p style="display: inline"><br /></p>
<table style="width: 85%" cellpadding="0" cellspacing="0" class="center">
<!-- En tete de la liste des fichiers -->
<tr>
<th> </th>
<th><a href="browser.php?dir=<?php echo $dir; ?>&sort=<?php echo (!$sort ? 1 : 0); ?>"><?php __l("File Name") ?></a><?php echo (!$sort || $sort == 1 ? "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "sort" . ($sort ? 1 : 2) . ".png\" alt=\""._l("Sorted by")."\" />" : ""); ?></th>
<th><a href="browser.php?dir=<?php echo $dir; ?>&sort=<?php echo ($sort == 2 ? "3" : "2"); ?>"><?php __l("Size") ?></a><?php echo ($sort == 2 || $sort == 3 ? "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "sort" . ($sort - 1) . ".png\" alt=\""._l("Sorted by")."\" />" : ""); ?></th>
<th><?php __l("Type"); ?></th>
<th><a href="browser.php?dir=<?php echo $dir; ?>&sort=<?php echo ($sort == 4 ? "5" : "4"); ?>"><?php __l("Last modification") ?></a><?php echo ($sort == 4 || $sort == 5 ? "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "sort" . ($sort - 3) . ".png\" alt=\""._l("Sorted by")."\" />" : ""); ?></th>
<th><a href="browser.php?dir=<?php echo $dir; ?>&sort=<?php echo ($sort == 6 ? "7" : "6"); ?>"><?php __l("By") ?></a><?php echo ($sort == 6 || $sort == 7 ? "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "sort" . ($sort - 5) . ".png\" alt=\""._l("Sorted by")."\" />" : ""); ?></th>
<th><?php __l("Actions") ?></th>
</tr>
<tr>
<td style="width: 20px; height: 26px"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>explorer.png" alt="" /></td>
<td colspan="6"><a href="browser.php?dir=0&sort=<?php echo $sort; ?>"><?php __l("Document Manager"); ?></a><?php $currentDir = $doc->folderArborescence($dir); echo ($currentDir == "" ? SEP : $currentDir); ?> </td>
</tr>
<!-- Liste des fichiers -->
<?php
$listFolders = $doc->listFolders($dir, $sort);
$listFiles = $doc->listFiles($dir, $sort);
$nbFolders = count($listFolders);
$nbFiles = count($listFiles);
if (empty($listFolders) && empty($listFiles))
{
$totalFolders = 0;
$totalFiles = 0;
?>
<tr>
<th colspan="7"><?php __l("No file in this folder"); ?></th>
</tr>
<?php
}
else
{
$totalFolders = 0;
for ($i = 0; $i < $nbFolders; $i++)
{
if ($doc->hasRight($_SESSION["Sid_user"], "", $listFolders[$i]["id_folder"]))
{
$doc->totalSize += $listFolders[$i]["folder_size"];
$totalFolders++;
?>
<tr class="rowhover">
<td style="width: 20px; height: 20px"><a href="browser.php?dir=<?php echo $listFolders[$i]["id_folder"]; ?>&sort=<?php echo $sort; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>folder.png" alt="" /></a></td>
<td class="colhover"><a href="browser.php?dir=<?php echo $listFolders[$i]["id_folder"]; ?>&sort=<?php echo $sort; ?>"><?php echo $listFolders[$i]["folder_name"]; ?></a></td>
<td class="colhover"><?php echo $doc->formatSize($listFolders[$i]["folder_size"]); ?></td>
<td class="colhover"><?php __l("Folder"); ?></td>
<td class="colhover"><?php echo dateTimeMy2fr($listFolders[$i]["folder_mtime"]); ?></td>
<td class="colhover"></td>
<td>
<img class="vmiddle noborder" src="<?php echo $pngPath; ?>rien.png" alt="" />
<?php
// What are the allowed actions for this user ?
if ($doc->hasRight($_SESSION["Sid_user"], "c", $dir)) /* Change comments */
{
?>
<a href="editfoldercomment.php?dir=<?php echo $dir; ?>&folder=<?php echo $listFolders[$i]["id_folder"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>edit.png" alt="<?php __l("Edit Comment"); ?>" title="<?php __l("Edit Comment"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if ($doc->hasRight($_SESSION["Sid_user"], "p", $dir)) /* Delete a folder */
{
?>
<a href="deletefolder.php?dir=<?php echo $dir; ?>&folder=<?php echo $listFolders[$i]["id_folder"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>delete.png" alt="<?php __l("Delete a folder"); ?>" title="<?php __l("Delete a folder"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if ($doc->hasRight($_SESSION["Sid_user"], "t", $dir)) /* Rename a folder */
{
?>
<a href="renamefolder.php?dir=<?php echo $dir; ?>&folder=<?php echo $listFolders[$i]["id_folder"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>rename.png" alt="<?php __l("Rename a Folder"); ?>" title="<?php __l("Rename a Folder"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if ($doc->hasRight($_SESSION["Sid_user"], "m", $dir)) /* Move files in folder */
{
?>
<a href="movefolder.php?dir=<?php echo $dir; ?>&folder=<?php echo $listFolders[$i]["id_folder"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>move.png" alt="<?php __l("Move a document"); ?>" title="<?php __l("Move a document"); ?>" /></a>
</td>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if (!empty($_SESSION["Sshow_com"]) && !empty($listFolders[$i]["folder_comment"]))
{
?>
</tr>
<tr>
<td> </td>
<td class="comments" colspan="5"><?php echo nl2br(trim($listFolders[$i]["folder_comment"])); ?></td>
<?php } ?>
</tr>
<?php
}
}
$totalFiles = 0;
for ($i = 0; $i < $nbFiles; $i++)
{
?>
<tr class="rowhover">
<?php
if ($doc->hasRight($_SESSION["Sid_user"], "r", $dir)) /* Read documents */
{
$doc->totalSize += $listFiles[$i]["file_size"];
$totalFiles++;
?>
<td style="width: 20px; height: 20px"><a href="download.php?dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath . $doc->icon($listFiles[$i]["file_name"]); ?>.png" alt="<?php __l("Download the file"); ?>" title="<?php __l("Download the file"); ?>" /></a></td>
<td class="colhover"><a href="download.php?dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><?php echo $listFiles[$i]["file_name"]; ?></a></td>
<td class="colhover"><?php echo $doc->formatSize($listFiles[$i]["file_size"]); ?></td>
<td class="colhover"><?php echo $doc->type($listFiles[$i]["file_name"]); ?></td>
<td class="colhover"><?php echo dateTimeMy2fr($listFiles[$i]["file_mtime"]); ?></td>
<td class="colhover"><?php echo $listFiles[$i]["user_name"]; ?></td>
<td>
<?php // What are the allowed actions for this user ? ?>
<a href="download.php?view=1&dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>view.png" alt="<?php __l("View File"); ?>" title="<?php __l("View File"); ?>" /></a>
<?php
if ($doc->hasRight($_SESSION["Sid_user"], "c", $dir)) /* change Comments on documents */
{
?>
<a href="editcomment.php?dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>edit.png" alt="<?php __l("Edit Comment"); ?>" title="<?php __l("Edit Comment"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if ($doc->hasRight($_SESSION["Sid_user"], "d", $dir)) /* Delete a documents */
{
?>
<a href="deletefile.php?dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>delete.png" alt="<?php __l("Delete a document"); ?>" title="<?php __l("Delete a document"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if ($doc->hasRight($_SESSION["Sid_user"], "n", $dir)) /* Rename a document */
{
?>
<a href="rename.php?dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>rename.png" alt="<?php __l("Rename a document"); ?>" title="<?php __l("Rename a document"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
if ($doc->hasRight($_SESSION["Sid_user"], "m", $dir)) /* Move a document accross folders */
{
?>
<a href="movefile.php?dir=<?php echo $dir; ?>&file=<?php echo $listFiles[$i]["id_file"]; ?>"><img class="vmiddle noborder" src="<?php echo $pngPath; ?>move.png" alt="<?php __l("Move a document"); ?>" title="<?php __l("Move a document"); ?>" /></a>
<?php
}
else
echo "<img class=\"vmiddle noborder\" src=\"" . $pngPath . "rien.png\" alt=\"\" /> ";
?>
</td>
<?php
if (!empty($_SESSION["Sshow_com"]) && !empty($listFiles[$i]["file_comment"]))
{
?>
</tr>
<tr>
<td> </td>
<td class="comments" colspan="6"><?php echo nl2br(trim($listFiles[$i]["file_comment"])); ?></td>
<?php
}
}
?>
</tr>
<?php
}
}
?>
<tr>
<td colspan="7"><hr /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><?php echo $doc->formatSize($doc->totalSize); ?></td>
<td colspan="2"><?php printf(_l("%s Files and %s Folders"), $totalFiles, $totalFolders); ?></td>
<td> </td>
<td> </td>
</tr>
</table>
<p style="display: inline"><br /></p>
<?php if ($doc->hasRight($_SESSION["Sid_user"], "u", $dir)) { /* Upload a Document */ ?>
<form method="post" action="browser.php" enctype="multipart/form-data">
<div>
<input type="hidden" name="dir" value="<?php echo $dir; ?>" />
<input type="hidden" name="action" value="uploadfile" />
<table style="width: 85%" cellpadding="4" cellspacing="0" class="center">
<tr>
<th style="width: 20px"> </th>
<th><?php __l("Upload a file in this folder:") ?></th>
<th> </th>
</tr>
<tr>
<td><img class="vmiddle" src="<?php echo $pngPath; ?>upload.png" alt="<?php __l("Upload documents"); ?>" title="<?php __l("Upload documents"); ?>" /></td>
<td><input class="int" type="file" name="upload" size="20" /></td>
<td rowspan="3">
<!-- Legende -->
<?php
if ($doc->hasRight($_SESSION["Sid_user"], "c", $dir) || $doc->hasRight($_SESSION["Sid_user"], "d", $dir) || $doc->hasRight($_SESSION["Sid_user"], "n", $dir) || $doc->hasRight($_SESSION["Sid_user"], "m", $dir) || $doc->hasRight($_SESSION["Sid_user"], "r", $dir))
{
?>
<p><?php __l("Legend"); ?></p>
<?php if ($doc->hasRight($_SESSION["Sid_user"], "r", $dir)) /* Read documents */ ?>
<img class="legende" src="<?php echo $pngPath; ?>view.png" alt="<?php __l("View File"); ?>" title="<?php __l("View File"); ?>" /> <?php __l("View File"); ?><br />
<?php if ($doc->hasRight($_SESSION["Sid_user"], "c", $dir)) /* change Comments on docuements */ ?>
<img class="legende" src="<?php echo $pngPath; ?>edit.png" alt="<?php __l("Edit Comment"); ?>" title="<?php __l("Edit Comment"); ?>" /> <?php __l("Edit Comment"); ?><br />
<?php if ($doc->hasRight($_SESSION["Sid_user"], "d", $dir)) /* Delete a docuements */ ?>
<img class="legende" src="<?php echo $pngPath; ?>delete.png" alt="<?php __l("Delete a document"); ?>" title="<?php __l("Delete a document"); ?>" /> <?php __l("Delete a document"); ?><br />
<?php if ($doc->hasRight($_SESSION["Sid_user"], "n", $dir)) /* Rename a docuement */ ?>
<img class="legende" src="<?php echo $pngPath; ?>rename.png" alt="<?php __l("Rename a document"); ?>" title="<?php __l("Rename a document"); ?>" /> <?php __l("Rename a document"); ?><br />
<?php if ($doc->hasRight($_SESSION["Sid_user"], "m", $dir)) /* Move a docuement accross folders */ ?>
<img class="legende" src="<?php echo $pngPath; ?>move.png" alt="<?php __l("Move a document"); ?>" title="<?php __l("Move a document"); ?>" /> <?php __l("Move a document"); ?><br />
<?php } ?>
</td>
</tr>
<tr>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>edit.png" alt="<?php __l("Comment") ?>" title="<?php __l("Comment") ?>" /></td>
<td><textarea class="int" name="newcomment" cols="40" rows="4"></textarea> <input class="inb" type="submit" value="<?php __l("Send") ?>" /></td>
</tr>
<?php if ($doc->config["conf_mailcondition"] > 1) { ?>
<tr>
<td><img class="vmiddle noborder" src="<?php echo $pngPath; ?>fileemail.png" alt="<?php __l("Send Mail") ?>" title="<?php __l("Send Mail") ?>" /></td>
<td><input class="inc" type="checkbox" name="sendmail" id="sendmail" value="1" <?php if ($doc->config["conf_mailcondition"] == 2) echo "checked=\"checked\""; ?> /><label for="sendmail"><?php __l("Send a mail with this upload"); ?></label></td>
</tr>
<?php } ?>
</table>
</div>
</form>
<?php
}
if ($doc->hasRight($_SESSION["Sid_user"], "f", $dir)) { /* Create a Folder */
?>
<p style="display: inline"><br /></p>
<form method="post" action="browser.php">
<div>
<input type="hidden" name="dir" value="<?php echo $dir; ?>" />
<input type="hidden" name="action" value="createfolder" />
<table style="width: 85%" cellpadding="4" cellspacing="0" class="center">
<tr>
<th style="width: 20px"> </th>
<th><?php __l("Create a new folder:") ?></th>
</tr>
<tr>
<td><img style="vmiddle" src="<?php echo $pngPath; ?>folder.png" alt="<?php __l("Create folders"); ?>" title="<?php __l("Create folders"); ?>" /></td>
<td><input class="int" type="text" name="folder" size="20" /> <input class="inb" type="submit" value="<?php __l("Create") ?>" /></td>
</tr>
</table>
</div>
</form>
<?php } ?>
<p style="display: inline"><br /></p>
<form method="get" action="search.php">
<div>
<input type="hidden" name="dir" value="<?php echo $dir; ?>" />
<input type="hidden" name="action" value="search" />
<table style="width: 85%" cellpadding="4" cellspacing="0" class="center">
<tr>
<th style="width: 20px"> </th>
<th colspan="2"><?php __l("Search :") ?></th>
</tr>
<tr>
<td><img style="vmiddle" src="<?php echo $pngPath; ?>search.png" alt="<?php __l("Search") ?>" /></td>
<td><input class="int" type="text" name="pattern" size="40" /> <input class="inb" type="submit" value="<?php __l("Search") ?>" /></td>
<td rowspan="2">
<div style="float: right; padding: 0 20px 0 20px">
<a href="http://www.dmanager.org/"><img src="../images/pelican.png" style="border: 0; vertical-align: middle; padding-bottom: 10px"> Dmanager <?php @readfile("version"); ?></a>
</div>
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="checkbox" name="searchInFolder" id="searchInFolder" value="1" checked="checked" /> <label for="searchInFolder"><?php __l("In folders") ?></label><br />
<input type="checkbox" name="searchInFile" id="searchInFile" value="1" checked="checked" /> <label for="searchInFile"><?php __l("In files") ?></label>
</td>
</tr>
</table>
</div>
</form>
<?php require_once ("foot.php");
// Send anonymous statistics
sendAnonymousStats();
?>