wenn ich die funktion "uplRecursiveDirectoryList()" im moduliinput benutzen will kommt statt der normalen template-konfigurations-seite nur der pfad zum template was nicht gefunden wird.
verwende ich die funktion uplRecursiveDirectoryList dagegen im moduloutput funktioniert alles reibungslos ... kann mir jemand sagen wie ich im input auf das filesystem zugreifen kann, da es an der php funktion opendir() aneckt?
folgendes script funktioniert im output einwandfrei - im input geht nix mehr:
Code: Alles auswählen
<?php
cInclude("classes", "class.treeitem.php");
cInclude("includes", "functions.upl.php");
global $cfgClient, $client;
if (!function_exists("getUploadPathInfos") ) {
function getUploadPathInfos ( &$arr_dirs, $arr_tree ) {
global $client, $cfgClient;
if ( is_array($arr_tree) ) {
foreach ($arr_tree as $a_file) {
$i = count($arr_dirs) + 1;
$arr_dirs[$i]["name"] = $a_file->name;
$arr_dirs[$i]["depth"] = $a_file->custom["level"] - 1;
$arr_dirs[$i]["pathstring"] = str_replace($cfgClient[$client]['upl']['path'], "", $a_file->id);
$cnt = $arr_dirs[$i]["depth"];
$arr_dirs[$i]["indent"] = '';
for ($z = 0; $z < $cnt; $z ++) {
# 3 blanks for every level
$arr_dirs[$i]["indent"] .= " ";
}
if ( count($a_file->subitems) > 0 ) {
getUploadPathInfos($arr_dirs, $a_file->subitems );
}
}
}
}
}
$dllist_rootTreeItem = new TreeItem;
$dllist_rootTreeItem->custom["level"] = 0;
uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"], $dllist_rootTreeItem, 2);
$dllist_objects = Array ();
$dllist_rootTreeItem->traverse($dllist_objects);
unset ($dllist_objects[0]);
$arr_dirs = array();
getUploadPathInfos($arr_dirs, $dllist_objects );
// add basedir
array_unshift ($arr_dirs, array("name" => str_replace("/","", $cfgClient[$client]["upload"]), "depth" => 0, "pathstring" => "", "indent" => "" ));
$str_predefined = trim("CMS_VALUE[2]");
print mi18n("Verzeichnis für Downloads auswählen") . ":\n<br>";
print '<select name="CMS_VAR[2]">' . "\n";
// output of all found directories
foreach ( $arr_dirs as $arr_dir ) {
$str_selected = "";
if ($str_predefined == $arr_dir["pathstring"]) $str_selected = ' selected="selected"';
print '<option value="' . $arr_dir["pathstring"] . '">' . $arr_dir["indent"] . $arr_dir["name"] . '</option>' . "\n";
}
print '</select>' . "\n";
?>