Merge branch 'remastering' of https://git.steelants.cz/SImple-Home/PHP_SMART_HOME_V3 into remastering
This commit is contained in:
commit
366f1c4db4
@ -76,7 +76,7 @@ class EndpointsApi extends ApiController{
|
||||
|
||||
//Log Data Save
|
||||
if (isset($obj['logs'])){
|
||||
foreach ($deviceLogs as $log) {
|
||||
foreach ($obj['logs'] as $log) {
|
||||
$logManager = new LogManager('../logs/devices/'. date("Y-m-d").'.log');
|
||||
$logManager->setLevel(LOGLEVEL);
|
||||
$logManager->write("[Device Log Msg] Device_ID " . $deviceId . "->" . $log, LogRecordTypes::ERROR);
|
||||
|
@ -1,23 +1,26 @@
|
||||
<?php
|
||||
if (!empty ($_POST)){
|
||||
$deviceManager = new DeviceManager ();
|
||||
if (!empty ($_FILES['deviceFirmware']) && !empty ($_FILES['deviceFirmware']['tmp_name']) && !empty ($_POST['deviceId'])) {
|
||||
$deviceManager = new DeviceManager ();
|
||||
$file = $_FILES['deviceFirmware'];
|
||||
$deviceMac = $deviceManager->getDeviceById ($_POST['deviceId'])['mac'];
|
||||
$fileName = (!empty ($deviceMac) ? str_replace (":", "", $deviceMac) . ".bin" : "");
|
||||
if ($fileName != "" && file_exists ("../app/updater/" . $fileName)) {
|
||||
unlink("../app/updater/" . $fileName);
|
||||
|
||||
if ($fileName != "" && file_exists ("../updater/" . $fileName)) {
|
||||
unlink("../updater/" . $fileName);
|
||||
}
|
||||
if ($fileName != "") {
|
||||
copy ($file['tmp_name'], "../app/updater/" . $fileName);
|
||||
} else {
|
||||
|
||||
copy ($file['tmp_name'], "../updater/" . $fileName);
|
||||
}
|
||||
}
|
||||
if (isset ($_POST['deviceCommand']) && !empty ($_POST['deviceId'])) {
|
||||
$deviceManager = new DeviceManager ();
|
||||
$deviceManager->edit ($_POST['deviceId'], array ('command' => $_POST['deviceCommand']));
|
||||
}else if (!empty ($_POST['deviceCommand'])) {
|
||||
$devices = $deviceManager->getAllDevices();
|
||||
foreach ($devices as $key => $device) {
|
||||
$deviceManager->edit ($device['device_id'], array ('command' => $_POST['deviceCommand']));
|
||||
}
|
||||
}
|
||||
header('Location: ./');
|
||||
header('Location: ./device');
|
||||
die();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class LogManager
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
if (isset($this->logFile)) {
|
||||
if (isset($this->logFile) && $this->logFile != "Unable to open file!") {
|
||||
fclose($this->logFile);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> 5cb6f0b... Some Fixes
|
||||
<head>
|
||||
<?php
|
||||
$partial = new Partial('head');
|
||||
@ -12,10 +8,6 @@
|
||||
?>
|
||||
<title><?php echo $TITLE ?></title>
|
||||
</head>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> 5cb6f0b... Some Fixes
|
||||
<body class="no-transitions">
|
||||
<div class="row no-gutters main">
|
||||
<div class="col-md-3 d-sm-none"></div>
|
||||
@ -37,7 +29,12 @@
|
||||
<th>Room</th>
|
||||
<th>Firmware</th>
|
||||
<th>IP Address<br>(Mac)</th>
|
||||
<th>Action</th>
|
||||
<th>Action
|
||||
<form method="post" action="">
|
||||
<button class="fa custom-file-input" type="submit" name="deviceCommand" value="reset" title="Reset All"><b></b></button>
|
||||
<div style="float: clear;"></div>
|
||||
</form>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -50,10 +47,11 @@
|
||||
<td>
|
||||
<?php if (!empty($device['mac'])) : ?>
|
||||
<i class="fa <?php echo (!empty($device['firmware_hash']) ? ($device['firmware_hash'] != "need" ? "fa-check-circle" : "fa-circle") : "fa-times-circle"); ?>" style="float: center; <?php echo (!empty($device['firmware_hash']) ? ($device['firmware_hash'] != "need" ? "color: green;" : "color: yellow;") : "color: red;"); ?>"></i>
|
||||
<button class="fa custom-file-input" type="button" onclick="document.getElementById('deviceFirmware').click();"></button>
|
||||
<?php echo $device['firmware_hash'] ?>
|
||||
<button class="fa custom-file-input" type="button" onclick="document.getElementById('deviceFirmware-<?php echo $device['device_id']?>').click();"></button>
|
||||
<form style="display: none;" method="post" action="" enctype="multipart/form-data">
|
||||
<input type="hidden" name="deviceId" value="<?php echo (!empty($device['device_id']) ? $device['device_id'] : ""); ?>">
|
||||
<input type="file" onchange="this.form.submit();" name="deviceFirmware" id="deviceFirmware" value="">
|
||||
<input type="file" onchange="this.form.submit();" name="deviceFirmware" id="deviceFirmware-<?php echo $device['device_id']?>" value="">
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<div type="float: clear;"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user