Some modificatio and repair
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?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" : "");
|
||||
@@ -10,15 +10,16 @@ if (!empty ($_POST)){
|
||||
unlink("../updater/" . $fileName);
|
||||
}
|
||||
if ($fileName != "") {
|
||||
echo 'coping file'.$fileName .copy ($file['tmp_name'], "../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: ./device');
|
||||
die();
|
||||
|
Reference in New Issue
Block a user