fix updater and other things
This commit is contained in:
@@ -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();
|
||||
|
@@ -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){
|
||||
|
@@ -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 != "") {
|
||||
|
Reference in New Issue
Block a user