function recurseDir($path, &$node)
{
    global $pd;
    if (!($dir = opendir($path))) {
        return false;
    }
    $anode = new HTML_TreeNode(array('text' => basename($path), 'link' => "javascript:setHelpVal('" . $path . "');", 'icon' => 'folder.gif'));
    $result = addslashes(realpath(stripslashes($path) . $pd . ".."));
    if (!$node) {
        $anode->addItem(new DirNode('..', "javascript:setHelp('" . $result . "');", 'folder.gif'), '..');
    }
    while (($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (is_dir("{$path}{$pd}{$file}")) {
                recurseDir("{$path}{$pd}{$file}", $anode);
            }
        }
    }
    rewinddir($dir);
    //
    while (false) {
        //($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (is_file("{$path}{$pd}{$file}")) {
                $anode->addItem(new DirNode($file, "javascript:setHelpVal('{$path}{$pd}{$file}');", 'branchtop.gif', "{$path}{$pd}{$file}"));
            }
        }
    }
    if (!$node) {
        $node = $anode;
    } else {
        $node->addItem($anode);
    }
    closedir($dir);
}
Exemple #2
0
function &recurseDir($path) {
    if (!$dir = opendir($path)) {
        return false;
    }
    $files = array();
    $node = &new HTML_TreeNode(basename($path), basename($path), 'folder.gif');
    while (($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (@is_dir("$path/$file")) {
                $addnode = &recurseDir("$path/$file");
            } else {
                $addnode = &new HTML_TreeNode($file, $file, 'document2.png');
            }
            $node->addItem($addnode);
        }
    }
    closedir($dir);
    return $node;
}