Path: blob/master/web-gui/buildyourownbotnet/assets/js/aci-tree/php/aciTree.php
1293 views
<?php12error_reporting(E_ERROR);34// get the tree JSON data for the file system listing56$path = dirname(__FILE__);78require_once("$path/Tree.php");9require_once("$path/FsTree.php");1011// we limit the access to "$path/tree"12$fsTree = new FsTree(new Fs("$path/tree"));1314// what branch was requested?15$branch = isset($_GET['branch']) ? $_GET['branch'] : null;1617// special case for 1k test from the demo (skip the 'sleep' thing and return faster)18if ((strpos($branch, 'a_new_File_ID') !== false) || (strpos($branch, 'a_new_Folder_ID') !== false)) {19// burn your CPU not the server with the 1k entries ... ;))20if (preg_match('@[0-9]+$@', $branch, $match) == 1) {21if ((int) $match[0] > 20) {22die('[]');23}24}25sleep(1);26die('[]');27}2829if (strpos($branch, '..') !== false) {30// path should not have a [..] inside ;-)31$branch = 'undefined';32}3334// a small delay so we can see the loading animation35// (comment it for faster return)36sleep(1);3738// no cache so we can see the loading animation :)39header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');40header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');41header('Cache-Control: no-store, no-cache, must-revalidate');42header('Cache-Control: post-check=0, pre-check=0', false);43header('Pragma: no-cache');4445// get the branch (1 level)46$fsTree->json($branch);4748// this will get the entire tree (comment above and uncomment this)49//$fsTree->json($branch, true);505152