Roman Hergenreder 3 лет назад
Родитель
Сommit
dc3cdfb9fc
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      code/htb_api.php

+ 6 - 2
code/htb_api.php

@@ -513,8 +513,9 @@ namespace Api\Htb {
       ));
 
       if (!empty($query->getRows())) {
-        $query->execute();
-        $this->lastError = $sql->getLastError();
+        if(!$query->execute()) {
+          $this->lastError = $sql->getLastError();
+        }
       }
     }
 
@@ -560,6 +561,9 @@ namespace Api\Htb {
         $rootAccess = $htbUser["machineOwns"][$machineId]["root"];
         $this->result["unlock"] = array("user" => $userAccess, "root" => $rootAccess);
         $this->logAccess($userId, $machineId, $userAccess, $rootAccess);
+        if (!$userAccess && !$rootAccess) {
+          $this->createError("You did not own the machine yet.");
+        }
       } else {
         $ownedMachines = $this->fetchOwnedMachines($userId);
         if (!$this->success) {