API Clean UP

This commit is contained in:
JonatanRek 2019-10-11 17:49:31 +02:00
parent 23ae36dfc5
commit 875fbccd6e
1 changed files with 0 additions and 7 deletions

View File

@ -3,9 +3,7 @@
include_once('./config.php');
//Autoloader
$files = scandir('./app/class/');
$files = array_diff($files, array(
'.',
'..',
@ -25,7 +23,6 @@ foreach($files as $file) {
include './app/class/'. $file;
}
//Allow acces only wia Curl, Ajax ETC
$restAcess = 'XMLHttpRequest' == ( $_SERVER['HTTP_X_REQUESTED_WITH'] ?? '' );
if (!$restAcess){
@ -154,12 +151,9 @@ if ($values != null || $values != "") {
RecordManager::create($deviceId, $key, round($value['value'],2));
$logManager->write("[API] Device_ID " . $deviceId . " writed value " . $key . ' ' . $value['value'], LogRecordType::INFO);
//notification
if ($key == 'door' || $key == 'water') {
$notificationMng = new NotificationManager;
$notificationData = [];
switch ($key) {
@ -203,7 +197,6 @@ if ($values != null || $values != "") {
$jsonAnswer['sleepTime'] = $device['sleep_time'];
}
echo json_encode($jsonAnswer);
header("HTTP/1.1 200 OK");
} else {
//Vypis