Rev 2111 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2068 | runge | 1 | <?php |
| 2 | |||
| 3 | require_once("config.php"); |
||
| 2111 | runge | 4 | require_once("atomjs_interface.php"); |
| 2068 | runge | 5 | |
| 2191 | linlun | 6 | |
| 7 | function GetSubfolders($directory, $pageConfiguration) |
||
| 2068 | runge | 8 | { |
| 9 | $folders = array(); |
||
| 10 | |||
| 11 | if (file_exists($directory)) |
||
| 12 | { |
||
| 13 | $directory_handle = opendir($directory); |
||
| 14 | |||
| 15 | while (false !== ($filename = readdir($directory_handle))) |
||
| 16 | { |
||
| 17 | if (is_dir($directory . "/" . $filename) && $filename[0] != ".") |
||
| 18 | { |
||
| 2191 | linlun | 19 | $found = 0; |
| 20 | foreach($pageConfiguration as $page) { |
||
| 21 | if (strcmp($page['page'],$filename)==0) { |
||
| 22 | $found = 1; |
||
| 23 | } |
||
| 24 | } |
||
| 25 | if ($found == 1) |
||
| 26 | $folders[] = $filename; |
||
| 2068 | runge | 27 | } |
| 28 | } |
||
| 29 | |||
| 30 | closedir($directory_handle); |
||
| 31 | |||
| 32 | if (count($folders) > 0) |
||
| 33 | { |
||
| 34 | natcasesort($folders); |
||
| 35 | $folders = array_values($folders); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | return $folders; |
||
| 40 | } |
||
| 41 | |||
| 42 | if (isset($_GET["ajax"])) |
||
| 43 | { |
||
| 44 | global $atomdHostname; |
||
| 45 | global $atomdPort; |
||
| 46 | |||
| 47 | $buffer = ""; |
||
| 48 | |||
| 49 | try |
||
| 50 | { |
||
| 2111 | runge | 51 | $socket = atomjs_connect($atomdHostname, $atomdPort); |
| 2068 | runge | 52 | |
| 2111 | runge | 53 | atomjs_write($socket, $_GET["command"]); |
| 2068 | runge | 54 | |
| 2111 | runge | 55 | echo trim(atomjs_read($socket)); |
| 2068 | runge | 56 | } |
| 57 | catch (Exception $e) |
||
| 58 | { |
||
| 59 | die($e); |
||
| 60 | } |
||
| 2111 | runge | 61 | |
| 62 | exit(0); |
||
| 2068 | runge | 63 | } |
| 64 | else |
||
| 65 | { |
||
| 2191 | linlun | 66 | $pages = GetSubfolders("pages/", $pageConfiguration); |
| 2068 | runge | 67 | } |
| 68 | |||
| 69 | ?> |