avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 1 | <?php |
avm99963 | 658fae5 | 2017-10-08 23:09:16 +0200 | [diff] [blame] | 2 | require_once("config.php"); |
| 3 | |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 4 | class write { |
| 5 | public static function do($json) { |
| 6 | print_r(json_encode($json)); |
| 7 | exit(); |
| 8 | } |
| 9 | |
| 10 | public static function error($n, $msg) { |
| 11 | self::do(["error" => $n, "msg" => $msg]); |
| 12 | } |
| 13 | } |
| 14 | |
avm99963 | cbcae35 | 2018-09-26 16:16:37 +0200 | [diff] [blame] | 15 | function get_graph() { |
| 16 | global $conf; |
| 17 | return json_decode(file_get_contents($conf["apiurl"]), true); |
| 18 | } |
| 19 | |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 20 | if (!isset($_GET["action"])) { |
| 21 | write::error(1, "No action provided"); |
| 22 | } |
| 23 | |
| 24 | switch ($_GET["action"]) { |
| 25 | case "getgraf": |
avm99963 | cbcae35 | 2018-09-26 16:16:37 +0200 | [diff] [blame] | 26 | $graf = file_get_contents($conf["apiurl"]); |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 27 | echo $graf; |
| 28 | break; |
| 29 | |
| 30 | default: |
| 31 | write::error(2, "Unknown action"); |
| 32 | } |
| 33 | ?> |