X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..6a7e4474cba9d8be4b2ec445e10f1691f7277c50:/examples/tree/get-nodes.php diff --git a/examples/tree/get-nodes.php b/examples/tree/get-nodes.php index c08ec8d5..f7604f4a 100644 --- a/examples/tree/get-nodes.php +++ b/examples/tree/get-nodes.php @@ -1,66 +1,66 @@ -=$factor;$i++) - $val /= $factor; - $p = strpos($val, '.'); - if($p !== false && $p > $digits) $val = round($val); - elseif($p !== false) $val = round($val, $digits-$p); - return round($val, $digits) . ' ' . $symbols[$i] . $bB; -} - -// grab the custom params -$path = isset($_REQUEST['path'])&&$_REQUEST['path'] == 'extjs' ? '../../../' : '../../'; - -$node = isset($_REQUEST['node']) ? $_REQUEST['node'] : ''; - -if(strpos($node, '..') !== false){ - die('Nice try buddy.'); -} - -$nodes = array(); -$directory = $path.$node; -if (is_dir($directory)){ - $d = dir($directory); - while($f = $d->read()){ - if($f == '.' || $f == '..' || substr($f, 0, 1) == '.') continue; - - $filename = $directory . '/' . $f; - $lastmod = date('M j, Y, g:i a', filemtime($filename)); - - if(is_dir($directory.'/'.$f)){ - $qtip = 'Type: Folder
Last Modified: '.$lastmod; - $nodes[] = array( - 'text' => $f, - 'id' => $node.'/'.$f, - //'qtip' => $qtip, - 'cls' => 'folder' - ); - } else { - $size = formatBytes(filesize($filename), 2); - $qtip = 'Type: JavaScript File
Last Modified: '.$lastmod.'
Size: '.$size; - $nodes[] = array( - 'text' => $f, - 'id' => $node.'/'.$f, - 'leaf' => true, - //'qtip' => $qtip, - //'qtipTitle' => $f, - 'cls' => 'file' - ); - } - } - $d->close(); -} - +=$factor;$i++) + $val /= $factor; + $p = strpos($val, '.'); + if($p !== false && $p > $digits) $val = round($val); + elseif($p !== false) $val = round($val, $digits-$p); + return round($val, $digits) . ' ' . $symbols[$i] . $bB; +} + +// grab the custom params +$path = isset($_REQUEST['path'])&&$_REQUEST['path'] == 'extjs' ? '../../../' : '../../'; + +$node = isset($_REQUEST['node']) ? $_REQUEST['node'] : ''; + +if(strpos($node, '..') !== false){ + die('Nice try buddy.'); +} + +$nodes = array(); +$directory = $path.$node; +if (is_dir($directory)){ + $d = dir($directory); + while($f = $d->read()){ + if($f == '.' || $f == '..' || substr($f, 0, 1) == '.') continue; + + $filename = $directory . '/' . $f; + $lastmod = date('M j, Y, g:i a', filemtime($filename)); + + if(is_dir($directory.'/'.$f)){ + $qtip = 'Type: Folder
Last Modified: '.$lastmod; + $nodes[] = array( + 'text' => $f, + 'id' => $node.'/'.$f, + //'qtip' => $qtip, + 'cls' => 'folder' + ); + } else { + $size = formatBytes(filesize($filename), 2); + $qtip = 'Type: JavaScript File
Last Modified: '.$lastmod.'
Size: '.$size; + $nodes[] = array( + 'text' => $f, + 'id' => $node.'/'.$f, + 'leaf' => true, + //'qtip' => $qtip, + //'qtipTitle' => $f, + 'cls' => 'file' + ); + } + } + $d->close(); +} + echo json_encode($nodes); \ No newline at end of file