fix updater and other things

This commit is contained in:
unknown
2020-03-12 21:34:12 +01:00
parent 3ff5e0d660
commit 0b92c0a84a
7 changed files with 42 additions and 43 deletions

View File

@@ -49,7 +49,7 @@ class DeviceManager{
public function editByToken ($token, $values = []) {
try {
Db::edit ('devices', $values, 'WHERE token = ?', array($deviceId));
Db::edit ('devices', $values, 'WHERE token = ?', array($token));
} catch(PDOException $error) {
echo $error->getMessage();
die();

View File

@@ -16,8 +16,8 @@ class NotificationManager
}
}
function getSubscription(){
return Db::loadAll('SELECT * FROM notifications;', array());
function getSubscription () {
return Db::loadAll ("SELECT * FROM notifications");
}
function sendSimpleNotification(string $serverKey, string $to, array $data, bool $timeStamp = false){

View File

@@ -7,8 +7,9 @@ if (isset($_POST) && !empty($_POST)){
$sleepTime = 0;
if (isset($_FILES['deviceFirmware']) && isset($_FILES['deviceFirmware']['tmp_name']) && $_FILES['deviceFirmware']['tmp_name'] != "") {
$file = $_FILES['deviceFirmware'];
$fileName = (isset ($_POST['deviceMac']) ? str_replace(":", "", $_POST['deviceMac']) . ".bin" : "");
if (file_exists("./app/updater/" . $fileName)) {
$deviceMac = DeviceManager::getDeviceById($deviceId)['mac'];
$fileName = (isset ($deviceMac) && $deviceMac != "" ? str_replace(":", "", $deviceMac) . ".bin" : "");
if ($fileName != "" && file_exists("./app/updater/" . $fileName)) {
unlink("./app/updater/" . $fileName);
}
if ($fileName != "") {