From e442d580a6e0686eb677e8a796836d6cad4c97cd Mon Sep 17 00:00:00 2001 From: philipp <philipp@philipp-laptop.(none)> Date: Sat, 4 Dec 2010 23:17:22 +0100 Subject: [PATCH] =?UTF-8?q?Auf=20test-status=20gebracht,=20ajax.php=20l?= =?UTF-8?q?=C3=A4uft=20shcon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webroot/phpinfo.php | 5 ----- webroot/widgets/ZoneOffen/ZoneOffen.php | 14 +++++++++++++ webroot/widgets/ZoneOffen/ajax.php | 28 +++++++++++++++++++++++++ webroot/widgets/widgetInterface.php | 8 +++++++ 4 files changed, 50 insertions(+), 5 deletions(-) delete mode 100644 webroot/phpinfo.php create mode 100644 webroot/widgets/ZoneOffen/ZoneOffen.php create mode 100644 webroot/widgets/ZoneOffen/ajax.php create mode 100644 webroot/widgets/widgetInterface.php diff --git a/webroot/phpinfo.php b/webroot/phpinfo.php deleted file mode 100644 index 5cfc3e9..0000000 --- a/webroot/phpinfo.php +++ /dev/null @@ -1,5 +0,0 @@ -<? - -phpinfo(); - -?> diff --git a/webroot/widgets/ZoneOffen/ZoneOffen.php b/webroot/widgets/ZoneOffen/ZoneOffen.php new file mode 100644 index 0000000..7339a84 --- /dev/null +++ b/webroot/widgets/ZoneOffen/ZoneOffen.php @@ -0,0 +1,14 @@ +<?php + +require_once 'widgets/widgetInterface.php'; + +class ZoneOffen implements widgetInterface +{ + public function giveOutput() + { + $widgetOutput = "Test"; + return $widgetOutput; + } +} + +?> diff --git a/webroot/widgets/ZoneOffen/ajax.php b/webroot/widgets/ZoneOffen/ajax.php new file mode 100644 index 0000000..6be99b1 --- /dev/null +++ b/webroot/widgets/ZoneOffen/ajax.php @@ -0,0 +1,28 @@ +<?php + + $httpRequest = new HttpRequest('http://zone.warpzone.ms:8000/ecmd?io%20get%20pin%200', HttpRequest::METH_GET); + $httpRequest->send(); + + if ( trim($httpRequest->getResponseBody()) == "port 0: 0x00") { + $tuerOffen = true; + } else { + $tuerOffen = false; + } + + $httpRequest = new HttpRequest('http://zone.warpzone.ms:8000/ecmd?1w%20get%20103fcdf9010800c3', HttpRequest::METH_GET); + $httpRequest->send(); + + $tempLounge = trim($httpRequest->getResponseBody()); + + $httpRequest = new HttpRequest('http://zone.warpzone.ms:8000/ecmd?1w%20get%2010e3e2f9010800ed', HttpRequest::METH_GET); + $httpRequest->send(); + + $tempWerkstatt = trim($httpRequest->getResponseBody()); + + + $antwortArray["tuerOffen"] = $tuerOffen; + $antwortArray["tempLounge"] = floatval($tempLounge); + $antwortArray["tempWerkstatt"] = floatval($tempWerkstatt); + + print(json_encode($antwortArray)); +?> diff --git a/webroot/widgets/widgetInterface.php b/webroot/widgets/widgetInterface.php new file mode 100644 index 0000000..8d025c9 --- /dev/null +++ b/webroot/widgets/widgetInterface.php @@ -0,0 +1,8 @@ +<?php + +interface widget +{ + public function giveOutput(); +} + +?> -- GitLab