2016-10-06 15:57:01 +00:00
|
|
|
<?php
|
2021-05-23 09:17:02 +00:00
|
|
|
|
2016-10-06 15:57:01 +00:00
|
|
|
/**
|
|
|
|
* Project:
|
|
|
|
* Contenido Content Management System
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Directory overview
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
* @con_php_req 5.0
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @package Contenido Backend includes
|
|
|
|
* @version 1.2.3
|
|
|
|
* @author Timo A. Hummel
|
|
|
|
* @copyright four for business AG <www.4fb.de>
|
|
|
|
* @license http://www.contenido.org/license/LIZENZ.txt
|
|
|
|
* @link http://www.4fb.de
|
|
|
|
* @link http://www.contenido.org
|
|
|
|
* @since file available since contenido release <= 4.6
|
|
|
|
*
|
|
|
|
* {@internal
|
|
|
|
* created 2003-12-28
|
|
|
|
* modified 2008-06-27, Frederic Schneider, add security fix
|
|
|
|
*
|
2019-07-03 11:58:28 +00:00
|
|
|
* $Id$:
|
2016-10-06 15:57:01 +00:00
|
|
|
* }}
|
|
|
|
*
|
|
|
|
*/
|
2021-05-23 09:17:02 +00:00
|
|
|
if (!defined('CON_FRAMEWORK')) {
|
|
|
|
die('Illegal call');
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cInclude("includes", "functions.con.php");
|
|
|
|
cInclude("includes", "functions.str.php");
|
|
|
|
|
|
|
|
if (!(int) $client > 0) {
|
2021-05-23 09:17:02 +00:00
|
|
|
#if there is no client selected, display empty page
|
|
|
|
$oPage = new cPage;
|
|
|
|
$oPage->render();
|
|
|
|
return;
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
function getExpandCollapseButton($item) {
|
|
|
|
global $sess, $PHP_SELF, $frame, $area, $appendparameters;
|
|
|
|
$selflink = "main.php";
|
|
|
|
|
|
|
|
if (count($item->subitems) > 0) {
|
|
|
|
if ($item->collapsed == true) {
|
|
|
|
$expandlink = $sess->url($selflink . "?area=$area&frame=$frame&appendparameters=$appendparameters&expand=" . $item->id);
|
|
|
|
return ('<a href="' . $expandlink . '" alt="' . i18n('Open category') . '" title="' . i18n('Open category') . '"><img src="' . $item->collapsed_icon . '" border="0" align="middle" width="18"></a>');
|
|
|
|
} else {
|
|
|
|
$collapselink = $sess->url($selflink . "?area=$area&appendparameters=$appendparameters&frame=$frame&collapse=" . $item->id);
|
|
|
|
return ('<a href="' . $collapselink . '" alt="' . i18n('Close category') . '" title="' . i18n('Close category') . '"><img src="' . $item->expanded_icon . '" border="0" align="middle" width="18"></a>');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($item->custom["lastitem"]) {
|
|
|
|
return '<img src="images/but_lastnode.gif" align="middle" width="18" height="18">';
|
|
|
|
} else {
|
|
|
|
return '<img src="images/grid_collapse.gif" align="middle" width="18" height="18">';
|
|
|
|
}
|
|
|
|
}
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#################
|
|
|
|
# Create Folder
|
|
|
|
#################
|
|
|
|
#Fixxed by Timo Trautmann double database entries also called by action upl_mkdir
|
|
|
|
// Use remembered path from upl_last_path (from session)
|
2021-05-23 09:17:02 +00:00
|
|
|
if (!isset($path) && $sess->is_registered("upl_last_path")) {
|
|
|
|
$path = $upl_last_path;
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2022-03-04 15:22:59 +00:00
|
|
|
if(is_null($path)) {
|
|
|
|
$path = '';
|
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$appendparameters = $_REQUEST["appendparameters"];
|
2016-10-06 15:57:01 +00:00
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if (!isset($action))
|
|
|
|
$action = "";
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
if ($tmp_area == "") {
|
2021-05-23 09:17:02 +00:00
|
|
|
$tmp_area = $area; // $tmp_area used at two places for unknown reasons...
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$uplexpandedList = unserialize($currentuser->getUserProperty("system", "upl_expandstate"));
|
|
|
|
$upldbfsexpandedList = unserialize($currentuser->getUserProperty("system", "upl_dbfs_expandstate"));
|
2016-10-06 15:57:01 +00:00
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if (!is_array($uplexpandedList)) {
|
|
|
|
$uplexpandedList = array();
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if (!is_array($upldbfsexpandedList)) {
|
|
|
|
$upldbfsexpandedList = array();
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if ($action == "upl_renamedir") {
|
|
|
|
if ($perm->have_perm_area_action("upl", "upl_renamedir")) {
|
|
|
|
uplRenameDirectory($oldname, $newname, $parent);
|
|
|
|
$path = $cfgClient[$client]['upl']['path'] . $parent . $newname . "/";
|
|
|
|
if (in_array($cfgClient[$client]['upl']['path'] . $parent . $oldname . "/", $uplexpandedList)) {
|
|
|
|
$uplexpandedList[] = $cfgClient[$client]['upl']['path'] . $parent . $newname . "/";
|
|
|
|
}
|
|
|
|
}
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
###################
|
|
|
|
# File System Tree
|
|
|
|
###################
|
|
|
|
$dbfs = new DBFSCollection;
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if ($action == "upl_delete") {
|
|
|
|
if (is_dbfs($path)) {
|
|
|
|
$dbfs->remove($path . "/.");
|
|
|
|
} else {
|
|
|
|
/* Check for files */
|
|
|
|
if (uplHasFiles($path)) {
|
|
|
|
$failedFiles = array();
|
|
|
|
|
|
|
|
$directory = opendir($cfgClient[$client]["upl"]["path"] . $path);
|
|
|
|
while (false !== ($dir_entry = readdir($directory))) {
|
|
|
|
if ($dir_entry != "." && $dir_entry != "..") {
|
|
|
|
$res = @ unlink($cfgClient[$client]["upl"]["path"] . $path . $dir_entry);
|
|
|
|
|
|
|
|
if ($res == false) {
|
|
|
|
$failedFiles[] = $dir_entry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count($failedFiles) > 0) {
|
|
|
|
$notification->displayNotification("warning", i18n("Failed to delete the following files:") . "<br><br>" . implode("<br>", $failedFiles));
|
|
|
|
} else {
|
|
|
|
$res = @ rmdir($cfgClient[$client]['upl']['path'] . $path);
|
|
|
|
if ($res == false) {
|
|
|
|
$notification->displayNotification("warning", sprintf(i18n("Failed to remove directory %s"), $path));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$tpl->reset();
|
|
|
|
|
|
|
|
$file = 'Upload';
|
|
|
|
$pathstring = '';
|
|
|
|
/*
|
2021-05-23 09:17:02 +00:00
|
|
|
$rootTreeItem = new TreeItem;
|
|
|
|
$rootTreeItem->custom["level"] = 0;
|
|
|
|
$rootTreeItem->name = i18n("Upload directory");
|
|
|
|
*/
|
|
|
|
$user_upload_path = getEffectiveSetting("upload", "userpath");
|
|
|
|
|
|
|
|
if (is_string($user_upload_path) AND!empty($user_upload_path)) {
|
|
|
|
trim($user_upload_path);
|
|
|
|
$file = $user_upload_path;
|
|
|
|
if (substr($user_upload_path, -1) != "/") {
|
|
|
|
$user_upload_path .= "/";
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
2021-05-23 09:17:02 +00:00
|
|
|
$pathstring = $user_upload_path;
|
|
|
|
if (substr($cfgClient[$client]["upl"]["path"], -1) != "/" AND substr($user_upload_path, 0, 1) == "/") {
|
|
|
|
$user_upload_path = substr($user_upload_path, 1);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$rootTreeItem = new TreeItem;
|
|
|
|
$rootTreeItem->custom["level"] = 0;
|
|
|
|
$rootTreeItem->name = i18n("Upload directory");
|
2021-05-23 09:17:02 +00:00
|
|
|
$aInvalidDirectories = uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"] . $user_upload_path, $rootTreeItem, 2);
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
if (count($aInvalidDirectories) > 0) {
|
|
|
|
$sWarningInfo = i18n('The following directories contains invalid characters and were ignored: ');
|
|
|
|
$sSeperator = '<br>';
|
|
|
|
$sFiles = implode(', ', $aInvalidDirectories);
|
|
|
|
$sRenameString = i18n('Please click here in order to rename automatically.');
|
|
|
|
$sRenameHref = $sess->url("main.php?area=$area&frame=$frame&force_rename=true");
|
2021-05-23 09:17:02 +00:00
|
|
|
$sRemameLink = '<a href="' . $sRenameHref . '">' . $sRenameString . '</a>';
|
|
|
|
$sNotificationString = $sWarningInfo . $sSeperator . $sFiles . $sSeperator . $sSeperator . $sRemameLink;
|
|
|
|
|
2016-10-06 15:57:01 +00:00
|
|
|
$sErrorString = $notification->returnNotification("warning", $sNotificationString, 1);
|
|
|
|
$tpl->set('s', 'WARNING', $sErrorString);
|
|
|
|
} else {
|
|
|
|
$tpl->set('s', 'WARNING', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mark all items in the expandedList as expanded */
|
2021-05-23 09:17:02 +00:00
|
|
|
foreach ($uplexpandedList as $key => $value) {
|
|
|
|
$rootTreeItem->markExpanded($value);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Collapse and expand the tree */
|
2021-05-23 09:17:02 +00:00
|
|
|
if (is_string($collapse)) {
|
|
|
|
$rootTreeItem->markCollapsed($collapse);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if (is_string($expand)) {
|
|
|
|
$rootTreeItem->markExpanded($expand);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$uplexpandedList = Array();
|
2016-10-06 15:57:01 +00:00
|
|
|
$rootTreeItem->getExpandedList($uplexpandedList);
|
|
|
|
|
|
|
|
$currentuser->setUserProperty("system", "upl_expandstate", serialize($uplexpandedList));
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$objects = Array();
|
2016-10-06 15:57:01 +00:00
|
|
|
$rootTreeItem->traverse($objects);
|
2021-05-23 09:17:02 +00:00
|
|
|
unset($objects[0]);
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if ($appendparameters == "filebrowser") {
|
|
|
|
$mtree = new cWidgetTreeView("b58f0ae3-8d4e-4bb3-a754-5f0628863364");
|
|
|
|
$cattree = conFetchCategoryTree();
|
|
|
|
$marray = array();
|
|
|
|
|
|
|
|
foreach ($cattree as $key => $catitem) {
|
|
|
|
$no_start = true;
|
|
|
|
$no_online = true;
|
|
|
|
$no_start = !strHasStartArticle($catitem["idcat"], $lang);
|
|
|
|
|
|
|
|
$no_online = !$catitem["visible"];
|
|
|
|
|
|
|
|
if ($catitem["visible"] == 1) {
|
|
|
|
if ($catitem["public"] == 0) {
|
|
|
|
if ($no_start || $no_online) {
|
|
|
|
# Error found
|
|
|
|
$tmp_img = "folder_on_error_locked.gif";
|
|
|
|
} else {
|
|
|
|
# No error found
|
|
|
|
$tmp_img = "folder_on_locked.gif";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Category is public
|
|
|
|
if ($no_start || $no_online) {
|
|
|
|
# Error found
|
|
|
|
$tmp_img = "folder_on_error.gif";
|
|
|
|
} else {
|
|
|
|
# No error found
|
|
|
|
$tmp_img = "folder_on.gif";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Category is offline
|
|
|
|
if ($catitem['public'] == 0) {
|
|
|
|
# Category is locked
|
|
|
|
if ($no_start || $no_online) {
|
|
|
|
# Error found
|
|
|
|
$tmp_img = "folder_off_error_locked.gif";
|
|
|
|
} else {
|
|
|
|
# No error found
|
|
|
|
$tmp_img = "folder_off_locked.gif";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Category is public
|
|
|
|
if ($no_start || $no_online) {
|
|
|
|
# Error found
|
|
|
|
$tmp_img = "folder_off_error.gif";
|
|
|
|
} else {
|
|
|
|
# No error found
|
|
|
|
$tmp_img = "folder_off.gif";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$icon = "./images/" . $tmp_img;
|
|
|
|
|
|
|
|
$idcat = $catitem["idcat"];
|
|
|
|
|
|
|
|
$name = ' <a href="' . $sess->url("main.php?area=$area&frame=5&idcat=$idcat&appendparameters=$appendparameters") . '" target="right_bottom">' . $catitem["name"] . '</a>';
|
|
|
|
$marray[] = array("id" => $catitem["idcat"], "name" => $name, "level" => $catitem["level"], "attributes" => array("icon" => $icon));
|
|
|
|
}
|
|
|
|
|
|
|
|
$mtree->setTreeName(i18n("Categories"));
|
|
|
|
$mtree->setIcon("images/grid_folder.gif");
|
|
|
|
$mtree->importTable($marray);
|
|
|
|
|
|
|
|
$baselink = new cHTMLLink;
|
|
|
|
$baselink->setCLink($area, $frame, "");
|
|
|
|
$baselink->setCustom("appendparameters", $appendparameters);
|
|
|
|
|
|
|
|
$mtree->setBaseLink($baselink);
|
|
|
|
$mtree->setBackgroundMode(TREEVIEW_BACKGROUND_SHADED);
|
|
|
|
$mtree->setMouseoverMode(TREEVIEW_MOUSEOVER_NONE);
|
|
|
|
$mtree->setCollapsed($collapsed);
|
|
|
|
$mtree->processParameters();
|
|
|
|
|
|
|
|
$collapsed = array();
|
|
|
|
$mtree->getCollapsedList($collapsed);
|
|
|
|
|
|
|
|
$tpl->set('s', 'CATBROWSER', $mtree->render());
|
|
|
|
$tpl->set('s', 'APPENDPARAMETERS', 'url += \'&appendparameters=' . $appendparameters . '\'');
|
|
|
|
} else {
|
|
|
|
$tpl->set('s', 'CATBROWSER', '');
|
|
|
|
$tpl->set('s', 'APPENDPARAMETERS', 'url += \'&appendparameters=' . $appendparameters . '\'');
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chdir($cfg['path']['contenido']);
|
|
|
|
|
|
|
|
$tpl->set('s', 'SID', $sess->id);
|
|
|
|
|
|
|
|
# create javascript multilink
|
|
|
|
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\',\'%s\', \'%s\')">%s</a>';
|
2021-05-23 09:17:02 +00:00
|
|
|
$mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'<img src="images/ordner_oben.gif" align="middle" alt="" border="0"><img align="middle" src="images/spacer.gif" width="5" border="0">' . $file);
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
$tpl->set('d', 'PATH', $pathstring);
|
|
|
|
$tpl->set('d', 'BGCOLOR', $bgcolor);
|
|
|
|
$tpl->set('d', 'INDENT', 3);
|
|
|
|
$tpl->set('d', 'DIRNAME', $mstr);
|
|
|
|
$tpl->set('d', 'EDITBUTTON', '');
|
|
|
|
$tpl->set('d', 'DELETEBUTTON', '');
|
|
|
|
$tpl->set('d', 'COLLAPSE', '');
|
|
|
|
$tpl->next();
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if (is_array($objects)) {
|
|
|
|
foreach ($objects as $a_file) {
|
|
|
|
$file = $a_file->name;
|
|
|
|
$depth = $a_file->custom["level"] - 1;
|
|
|
|
$pathstring = str_replace($cfgClient[$client]['upl']['path'], "", $a_file->id);
|
|
|
|
$a_file->collapsed_icon = "images/grid_expand.gif";
|
|
|
|
$a_file->expanded_icon = "images/grid_collapse.gif";
|
|
|
|
$dlevels[$depth] = $a_file->custom["lastitem"];
|
|
|
|
$imgcollapse = getExpandCollapseButton($a_file);
|
|
|
|
$fileurl = rawurlencode($path . $file . '/');
|
|
|
|
$pathurl = rawurlencode($path);
|
|
|
|
|
|
|
|
# Indent for every level
|
|
|
|
$cnt = $depth;
|
|
|
|
$indent = 18;
|
|
|
|
|
|
|
|
for ($i = 0; $i < $cnt; $i++) {
|
|
|
|
$indent += 18;
|
|
|
|
}
|
|
|
|
|
|
|
|
# create javascript multilink # -> better create meaningful comments
|
|
|
|
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
|
|
|
|
$mstr = sprintf(
|
|
|
|
$tmp_mstr,
|
|
|
|
'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'<img src="images/grid_folder.gif" align="middle" border="0" alt=""><img src="images/spacer.gif" align="middle" width="5" border="0">' . $file);
|
|
|
|
|
|
|
|
$hasFiles = uplHasFiles($pathstring);
|
|
|
|
$hasSubdirs = uplHasSubdirs($pathstring);
|
|
|
|
|
|
|
|
if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
|
|
|
|
$deletebutton = '<a style="margin-left:10px;" title="' . i18n("Delete directory") . '" href="javascript://" onclick="event.cancelBubble=true;box.confirm(\'' . i18n("Delete directory") . '\', \'' . i18n("Do you really want to delete the following directory:") . '<b>' . $file . '</b>\', \'deleteDirectory(\\\'' . $pathstring . '\\\')\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . i18n("Delete directory") . '" alt="' . i18n("Delete directory") . '"></a>';
|
|
|
|
} else {
|
|
|
|
if ($hasFiles) {
|
|
|
|
$message = i18n("Directory contains files");
|
|
|
|
} else {
|
|
|
|
$message = i18n("Permission denied");
|
|
|
|
}
|
|
|
|
|
|
|
|
$deletebutton = "<img style=\"margin-left:10px;\" src=\"" . $cfg["path"]["images"] . "delete_inact.gif\" border=\"0\" alt=\"" . $message . "\" title=\"" . $message . "\">";
|
|
|
|
}
|
|
|
|
|
|
|
|
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
|
|
|
|
|
|
|
|
$tpl->set('d', 'PATH', $pathstring);
|
|
|
|
$tpl->set('d', 'BGCOLOR', $bgcolor);
|
|
|
|
$tpl->set('d', 'INDENT', 0);
|
|
|
|
|
|
|
|
$gline = "";
|
|
|
|
|
|
|
|
for ($i = 1; $i < $depth; $i++) {
|
|
|
|
if ($dlevels[$i] == false && $i != 0) {
|
|
|
|
$gline .= '<img src="images/grid_linedown.gif" align="middle" width="18">';
|
|
|
|
} else {
|
|
|
|
$gline .= '<img src="images/spacer.gif" width="18" height="18" align="middle">';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$parent = str_replace($cfgClient[$client]['upl']['path'], "", $a_file->custom["parent"]);
|
|
|
|
|
|
|
|
$tpl->set('d', 'DIRNAME', $mstr);
|
|
|
|
$tpl->set('d', 'EDITBUTTON', '');
|
|
|
|
$tpl->set('d', 'DELETEBUTTON', $deletebutton);
|
|
|
|
|
|
|
|
$tpl->set('d', 'COLLAPSE', $gline . $imgcollapse);
|
|
|
|
$tpl->next();
|
|
|
|
}
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$tpl->set('d', 'DELETEBUTTON', ' ');
|
|
|
|
$tpl->set('d', 'DIRNAME', '');
|
|
|
|
$tpl->set('d', 'EDITBUTTON', '');
|
|
|
|
$tpl->set('d', 'COLLAPSE', "");
|
|
|
|
$tpl->next();
|
|
|
|
|
|
|
|
####################################
|
|
|
|
# Database-based filesystem (DBFS)
|
|
|
|
####################################
|
|
|
|
$file = i18n("Database Filesystem");
|
|
|
|
$pathstring = 'dbfs:';
|
|
|
|
$rootTreeItem = new TreeItem;
|
|
|
|
$rootTreeItem->custom["level"] = 0;
|
|
|
|
|
|
|
|
uplRecursiveDBDirectoryList("", $rootTreeItem, 2);
|
|
|
|
|
|
|
|
/* Mark all items in the expandedList as expanded */
|
2021-05-23 09:17:02 +00:00
|
|
|
foreach ($upldbfsexpandedList as $key => $value) {
|
|
|
|
$rootTreeItem->markExpanded($value);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Collapse and expand the tree */
|
2021-05-23 09:17:02 +00:00
|
|
|
if (is_string($collapse)) {
|
|
|
|
$rootTreeItem->markCollapsed($collapse);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
if (is_string($expand)) {
|
|
|
|
$rootTreeItem->markExpanded($expand);
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$upldbfsexpandedList = Array();
|
2016-10-06 15:57:01 +00:00
|
|
|
$rootTreeItem->getExpandedList($upldbfsexpandedList);
|
|
|
|
|
|
|
|
$currentuser->setUserProperty("system", "upl_dbfs_expandstate", serialize($upldbfsexpandedList));
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$objects = Array();
|
2016-10-06 15:57:01 +00:00
|
|
|
$rootTreeItem->traverse($objects);
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
unset($objects[0]);
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
|
|
|
|
|
|
|
|
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
|
2021-05-23 09:17:02 +00:00
|
|
|
$mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'<img src="images/ordner_oben.gif" alt="" border="0"><img align="middle" src="images/spacer.gif" width="5" border="0">' . $file);
|
2016-10-06 15:57:01 +00:00
|
|
|
|
|
|
|
$tpl->set('d', 'PATH', $pathstring);
|
|
|
|
$tpl->set('d', 'BGCOLOR', $bgcolor);
|
|
|
|
$tpl->set('d', 'INDENT', 3);
|
|
|
|
$tpl->set('d', 'DIRNAME', $mstr);
|
|
|
|
$tpl->set('d', 'EDITBUTTON', '');
|
|
|
|
$tpl->set('d', 'DELETEBUTTON', '');
|
|
|
|
$tpl->set('d', 'COLLAPSE', '');
|
|
|
|
$tpl->next();
|
|
|
|
|
|
|
|
$dbfsc = new DBFSCollection;
|
|
|
|
|
2021-05-23 09:17:02 +00:00
|
|
|
$dlevels = array();
|
|
|
|
|
|
|
|
if (is_array($objects)) {
|
|
|
|
foreach ($objects as $a_file) {
|
|
|
|
$file = $a_file->name;
|
|
|
|
$depth = $a_file->custom["level"] - 1;
|
|
|
|
$pathstring = $a_file->id;
|
|
|
|
$a_file->collapsed_icon = "images/grid_expand.gif";
|
|
|
|
$a_file->expanded_icon = "images/grid_collapse.gif";
|
|
|
|
$dlevels[$depth] = $a_file->custom["lastitem"];
|
|
|
|
$collapse = getExpandCollapseButton($a_file);
|
|
|
|
$fileurl = rawurlencode($path . $file . '/');
|
|
|
|
$pathurl = rawurlencode($path);
|
|
|
|
|
|
|
|
if ($file == 'tmp') {
|
|
|
|
echo 'tmp2<br>';
|
|
|
|
}
|
|
|
|
|
|
|
|
# Indent for every level
|
|
|
|
$cnt = $depth;
|
|
|
|
$indent = 18;
|
|
|
|
|
|
|
|
for ($i = 0; $i < $cnt; $i++) {
|
|
|
|
# 18 px for every level
|
|
|
|
$indent += 18;
|
|
|
|
}
|
|
|
|
|
|
|
|
# create javascript multilink
|
|
|
|
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
|
|
|
|
$mstr = sprintf($tmp_mstr, 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"),
|
|
|
|
'<img src="images/grid_folder.gif" align="middle" border="0" alt=""><img src="images/spacer.gif" align="middle" width="5" border="0">' . $file);
|
|
|
|
|
|
|
|
$hasFiles = $dbfsc->hasFiles($pathstring);
|
|
|
|
|
|
|
|
if (!$hasFiles && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
|
|
|
|
$deletebutton = '<a style="margin-left:10px;" title="' . i18n("Delete directory") . '" href="javascript://" onclick="event.cancelBubble=true;box.confirm(\'' . i18n("Delete directory") . '\', \'' . i18n("Do you really want to delete the following directory:") . '<b>' . $file . '</b>\', \'deleteDirectory(\\\'' . $pathstring . '\\\')\')"><img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . i18n("Delete directory") . '" alt="' . i18n("Delete directory") . '"></a>';
|
|
|
|
} else {
|
|
|
|
if ($hasFiles) {
|
|
|
|
$message = i18n("Directory contains files");
|
|
|
|
} else {
|
|
|
|
$message = i18n("Permission denied");
|
|
|
|
}
|
|
|
|
|
|
|
|
$deletebutton = "<img style=\"margin-left:10px;\" src=\"" . $cfg["path"]["images"] . "delete_inact.gif\" border=\"0\" alt=\"" . $message . "\" title=\"" . $message . "\">";
|
|
|
|
}
|
|
|
|
|
|
|
|
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
|
|
|
|
|
|
|
|
$tpl->set('d', 'PATH', $pathstring);
|
|
|
|
$tpl->set('d', 'BGCOLOR', $bgcolor);
|
|
|
|
$tpl->set('d', 'INDENT', 0);
|
|
|
|
|
|
|
|
$gline = "";
|
|
|
|
|
|
|
|
for ($i = 1; $i < $depth; $i++) {
|
|
|
|
if ($dlevels[$i] == false && $i != 0) {
|
|
|
|
$gline .= '<img src="images/grid_linedown.gif" align="middle">';
|
|
|
|
} else {
|
|
|
|
$gline .= '<img src="images/spacer.gif" width="18" height="18" align="middle">';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$parent = str_replace($cfgClient[$client]['upl']['path'], "", $a_file->custom["parent"]);
|
|
|
|
$tpl->set('d', 'DIRNAME', $mstr);
|
|
|
|
$tpl->set('d', 'EDITBUTTON', '');
|
|
|
|
$tpl->set('d', 'DELETEBUTTON', $deletebutton);
|
|
|
|
$tpl->set('d', 'COLLAPSE', $gline . $collapse);
|
|
|
|
$tpl->next();
|
2016-10-06 15:57:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$tpl->set('s', 'ID_PATH', $path);
|
|
|
|
chdir($cfg["path"]["contenido"]);
|
2021-05-23 09:17:02 +00:00
|
|
|
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['upl_dirs_overview']);
|
2016-10-06 15:57:01 +00:00
|
|
|
?>
|