Example #1
0
function makeDirectoryTree($directory, $path)
{
    $dirlist = scandir($directory['path']);
    $tree = array();
    foreach ($dirlist as $dir) {
        if ($dir != '.' && $dir != '..' && is_dir($directory['path'] . '/' . $dir)) {
            $element = array();
            $element['name'] = $dir;
            $element['path'] = $directory['path'] . '/' . $dir;
            if ($element['path'] == $path) {
                $element['current'] = true;
            }
            $element['children'] = makeDirectoryTree($element, $path);
            $element['url'] = makeURL('fileadmin', array('path' => $element['path']));
            $tree[] = $element;
        }
    }
    return $tree;
}
Example #2
0
                    $notify->add($lang->get('fileadmin'), 'Upload failed: ' . $result);
                }
            }
            // Delete File
            if (isset($_POST['delete_file_filename'])) {
                unlink($_GET['path'] . '/' . $_POST['delete_file_filename']);
            }
            // Delete Folder
            if (isset($_POST['delete_dir'])) {
                @rmdir($_GET['path']);
            }
        }
        // Make directory tree
        $root['name'] = 'fileadmin';
        $root['path'] = $dir;
        $root['url'] = makeURL($mod, array('path' => $dir));
        if ($_GET['path'] == $dir) {
            $root['current'] = true;
        }
        @($children = makeDirectoryTree($root, $_GET['path']));
        $root['children'] = $children;
        $smarty->assign('tree', $root);
        // Make file list
        @($path = is_dir($_GET['path']) ? $_GET['path'] : $dir);
        $filelist = makeFileList($path);
        $smarty->assign('files', $filelist);
        // Make URL list
    }
} else {
    $notify->add($lang->get('fileadmin'), $lang->get('no_access'));
}