ich kann zwar als Benutzer meinen mir zugewiesenen Ordner im DBFS sehen, aber weder die dort abgelegten Datein kann ich sehen noch kann ich etwas hochladen.
Wenn ich auf "Datei hochladen" klicke sagt mir Contenido "Verzeichnis nicht beschreibbar".
Code: Alles auswählen
<?php
/*****************************************
* File : $RCSfile: include.upl_dirs_overview.php,v $
* Project : Contenido
* Descr : Directory overview
*
* Author : Timo A. Hummel
*
* Created : 28.12.2003
* Modified : $Date: 2006/10/06 00:08:17 $
*
* © four for business AG, www.4fb.de
*
* $Id: include.upl_dirs_overview.php,v 1.20 2006/10/06 00:08:17 bjoern.behrens Exp $
******************************************/
cInclude("classes", "class.ui.php");
cInclude("classes", "class.htmlelements.php");
cInclude("classes", "class.properties.php");
/*
* modification by oldperl 02.02.2007
* gives a user a specified upload directory with user-variable
* set a user-property like 'upload' 'userpath' '[directory in upload]'
*
* see contenido forum (http://contenido.org/forum/viewtopic.php?p=95617)
*/
$user_upload_path = getEffectiveSetting("upload","userpath"); // mod by emergence
if (is_string($user_upload_path) AND !empty($user_upload_path)) {
trim($user_upload_path);
if (substr($user_upload_path, -1) != "/") {
$user_upload_path .= "/";
}
if (!isset($path) OR empty($path)) $path = $user_upload_path;
}
// end modification by oldperl
cInclude("classes", "class.upload.php");
cInclude("classes", "widgets/class.widgets.treeview.php");
cInclude("includes", "functions.con.php");
cInclude("includes", "functions.str.php");
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="Kategorie öffnen" title="Kategorie öffnen"><img src="'.$item->collapsed_icon.'" border="0" align="middle"></a>');
} else
{
$collapselink = $sess->url($selflink."?area=$area&appendparameters=$appendparameters&frame=$frame&collapse=".$item->id);
return ('<a href="'.$collapselink.'" alt="Kategorie schließen" title="Kategorie schließen"><img src="'.$item->expanded_icon.'" border="0" align="middle"></a>');
}
} else
{
if ($item->custom["lastitem"])
{
return '<img src="images/grid_linedownrightend.gif" align="middle" width="18" height="18">';
} else
{
return '<img src="images/grid_linedownright.gif" align="middle" width="18" height="18">';
}
}
}
$appendparameters = $_REQUEST["appendparameters"];
if (!isset ($action))
$action = "";
if ($tmp_area == "") {
$tmp_area = $area; // $tmp_area used at two places for unknown reasons...
}
$uplexpandedList = unserialize($currentuser->getUserProperty("system", "upl_expandstate"));
$upldbfsexpandedList = unserialize($currentuser->getUserProperty("system", "upl_dbfs_expandstate"));
if (!is_array($uplexpandedList))
{
$uplexpandedList = array ();
}
if (!is_array($upldbfsexpandedList))
{
$upldbfsexpandedList = array ();
}
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."/";
}
}
}
$dbfs = new DBFSCollection;
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));
}
}
}
}
$tpl->reset();
$file = 'Upload';
$pathstring = '';
/*
* modification by oldperl 22.05.2006
* gives a user a specified upload directory with user-variable
* set a user-property like 'upload' 'userpath' '[directory in upload]'
*
* updatet 02.02.2007
* now the userpath in user-property is the root-path in filemanager
*
* please dont't forget to edit include.upl_files_overview for correct showing the first time
* and include.upl_left_top.php, so the right path is set for new directorys
*
* see contenido forum (http://contenido.org/forum/viewtopic.php?p=95617)
*/
$user_upload_path = getEffectiveSetting("upload","userpath"); // mod by emergence
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 .= "/";
}
$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);
}
}
$rootTreeItem = new TreeItem;
$rootTreeItem->custom["level"] = 0;
uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"].$user_upload_path, $rootTreeItem, 2);
// end modification by oldperl
/* Mark all items in the expandedList as expanded */
foreach ($uplexpandedList as $key => $value)
{
$rootTreeItem->markExpanded($value);
}
/* Collapse and expand the tree */
if (is_string($collapse))
{
$rootTreeItem->markCollapsed($collapse);
}
if (is_string($expand))
{
$rootTreeItem->markExpanded($expand);
}
$uplexpandedList = Array ();
$rootTreeItem->getExpandedList($uplexpandedList);
$currentuser->setUserProperty("system", "upl_expandstate", serialize($uplexpandedList));
$objects = Array ();
$rootTreeItem->traverse($objects);
unset ($objects[0]);
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
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/icons/category/".$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.'\'');
$search = new cHTMLTextbox("searchfor", $searchfor, 30);
$tpl->set('d', 'PATH', '');
$tpl->set('d', 'BGCOLOR', $bgcolor);
$tpl->set('d', 'INDENT', 3);
$tpl->set('d', 'DIRNAME', i18n("Search for"));
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', '');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
$form = new UI_Form("search");
$form->add("search", '<table border="0" cellspacing="0" cellpadding="0"><tr><td>'.$search->render().'</td><td><input type="image" src="images/submit.gif"></td></tr></table>');
$form->setVar("area", $area);
$form->setVar("frame", $frame);
$form->setVar("appendparameters", $appendparameters);
$tpl->set('d', 'PATH', '');
$tpl->set('d', 'BGCOLOR', $bgcolor);
$tpl->set('d', 'INDENT', 3);
$tpl->set('d', 'DIRNAME', $form->render());
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', '');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
}
$tpl->set('s', 'DIRNAME_0', '');
$tpl->set('s', 'EDITBUTTON_0', '');
$tpl->set('s', 'DELETEBUTTON_0', '');
chdir($cfg['path']['contenido']);
$tpl->set('d', 'PATH', '');
$tpl->set('d', 'BGCOLOR', $bgcolor);
$tpl->set('d', 'INDENT', 3);
$tpl->set('d', 'DIRNAME', ' ');
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', '');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
$tpl->set('s', 'SID', $sess->id);
$tpl->set('s', 'RENAME', i18n("Enter the new directory name:"));
/* Do searching */
if ($searchfor != "")
{
$items = uplSearch($searchfor);
if (is_array($items))
{
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
$mstr = sprintf($tmp_mstr, 'right_bottom', $sess->url("main.php?area=upl_search_results&frame=4&searchfor=$searchfor&appendparameters=$appendparameters"), 'right_top', $sess->url("main.php?area=$area&frame=3&appendparameters=$appendparameters"), '<img align="middle" src="images/but_lens.gif" style="padding-right: 3px;">'.i18n("Search results"));
$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();
$tpl->set('d', 'PATH', '');
$tpl->set('d', 'BGCOLOR', $bgcolor);
$tpl->set('d', 'INDENT', 3);
$tpl->set('d', 'DIRNAME', ' ');
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', '');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
}
}
# create javascript multilink
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\',\'%s\', \'%s\')">%s</a>';
$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);
$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', '<img src="images/delete_inact.gif">');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
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 ++)
{
# 16 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);
$editbutton = "";
$hasFiles = uplHasFiles($pathstring);
$hasSubdirs = uplHasSubdirs($pathstring);
if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir"))
{ #&& !in_array($path.$file."/", $upl_protected)) {
$deletebutton = '<a 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 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', 2);
$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"]);
$editbutton = '<a href="javascript:renameDir(\''.$file.'\',\''.$parent.'\');"><img src="images/but_rename.gif" border="0"></a>';
$tpl->set('d', 'DIRNAME', $mstr);
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', $deletebutton);
$tpl->set('d', 'COLLAPSE', $gline.$imgcollapse);
$tpl->next();
}
}
$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 */
foreach ($upldbfsexpandedList as $key => $value)
{
$rootTreeItem->markExpanded($value);
}
/* Collapse and expand the tree */
if (is_string($collapse))
{
$rootTreeItem->markCollapsed($collapse);
}
if (is_string($expand))
{
$rootTreeItem->markExpanded($expand);
}
$upldbfsexpandedList = Array ();
$rootTreeItem->getExpandedList($upldbfsexpandedList);
$currentuser->setUserProperty("system", "upl_dbfs_expandstate", serialize($upldbfsexpandedList));
$objects = Array ();
$rootTreeItem->traverse($objects);
unset ($objects[0]);
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
# create javascript multilink
$tmp_mstr = '<a href="javascript:conMultiLink(\'%s\', \'%s\',\'%s\', \'%s\')">%s</a>';
$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);
$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', '<img src="images/delete_inact.gif">');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
$dbfsc = new DBFSCollection;
$dlevels = array ();
if (is_array($objects))
{
foreach ($objects as $a_file)
{
$file = $a_file->name;
$depth = $a_file->custom["level"] - 1;
//$pathstring = str_replace("dbfs:/","",$a_file->id."/");
$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);
# 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);
$editbutton = "";
$hasFiles = $dbfsc->hasFiles($pathstring);
if (!$hasFiles && $perm->have_perm_area_action($tmp_area, "upl_rmdir"))
{ #&& !in_array($path.$file."/", $upl_protected)) {
$deletebutton = '<a 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 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', 2);
$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"]);
$editbutton = '<a href="javascript:renameDir(\''.$file.'\',\''.$parent.'\');"><img src="images/but_rename.gif" border="0"></a>';
$tpl->set('d', 'DIRNAME', $mstr);
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', $deletebutton);
$tpl->set('d', 'COLLAPSE', $gline.$collapse);
$tpl->next();
}
}
chdir($cfg["path"]["contenido"]);
$tpl->generate($cfg['path']['templates'].$cfg['templates']['upl_dirs_overview']);
?>