blob: 26b655a65a541f8ff0499df5c78afc99e1356f2e [file] [log] [blame]
avm99963f0d15212017-10-08 17:03:22 +02001<?php
avm99963658fae52017-10-08 23:09:16 +02002require_once("config.php");
3
avm99963f0d15212017-10-08 17:03:22 +02004class write {
Huguet57e9f47652018-07-23 03:28:12 +02005 public static function funct($json) {
avm99963f0d15212017-10-08 17:03:22 +02006 print_r(json_encode($json));
7 exit();
8 }
9
10 public static function error($n, $msg) {
Huguet57e9f47652018-07-23 03:28:12 +020011 self::funct(["error" => $n, "msg" => $msg]);
avm99963f0d15212017-10-08 17:03:22 +020012 }
13}
14
avm99963cbcae352018-09-26 16:16:37 +020015function get_graph() {
16 global $conf;
17 return json_decode(file_get_contents($conf["apiurl"]), true);
18}
19
avm99963f0d15212017-10-08 17:03:22 +020020if (!isset($_GET["action"])) {
21 write::error(1, "No action provided");
22}
23
24switch ($_GET["action"]) {
25 case "getgraf":
avm99963cbcae352018-09-26 16:16:37 +020026 $graf = file_get_contents($conf["apiurl"]);
avm99963f0d15212017-10-08 17:03:22 +020027 echo $graf;
28 break;
29
30 default:
31 write::error(2, "Unknown action");
32}
33?>