| 1 | <?php |
| 2 | |
| 3 | ini_set("ERROR_REPORTING", 0); |
| 4 | include_once('lib/parser2/dojo2.inc'); |
| 5 | $allfiles = @dojo_get_files(); |
| 6 | |
| 7 | if($argc || !empty($_GET['f'])){ |
| 8 | |
| 9 | $argfile = empty($_GET['f']) ? $argv[1] : $_GET['f']; |
| 10 | |
| 11 | $parts = explode("/", $argfile); |
| 12 | $ns = array_shift($parts); |
| 13 | $file = implode("/", $parts); |
| 14 | |
| 15 | try{ |
| 16 | $data = @dojo_get_contents($ns, $file); |
| 17 | }catch (Exception $e){ |
| 18 | $data = array( |
| 19 | "success" => False, |
| 20 | "error" => $e |
| 21 | ); |
| 22 | } |
| 23 | |
| 24 | if(!empty($_GET['f'])){ |
| 25 | header("Content-type: application/json"); |
| 26 | } |
| 27 | |
| 28 | print json_encode($data); |
| 29 | } |