diff options
Diffstat (limited to 'modules-available/usblockoff/api.inc.php')
-rw-r--r-- | modules-available/usblockoff/api.inc.php | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/modules-available/usblockoff/api.inc.php b/modules-available/usblockoff/api.inc.php index 9467d67b..298dd948 100644 --- a/modules-available/usblockoff/api.inc.php +++ b/modules-available/usblockoff/api.inc.php @@ -12,12 +12,6 @@ function HandleParameters() $ip = Request::get('ip', 0, 'string'); $client = Database::queryFirst("SELECT m.machineuuid AS 'muid', m.currentuser AS 'user' FROM machine AS m WHERE m.clientip=:ip", array('ip' => $ip)); - // $ruleInformation['hash'] = Request::get('hash', '', 'string'); - // $ruleInformation['parent-hash'] = Request::get('parent-hash', '', 'string'); - // $ruleInformation['via-port'] = Request::get('via-port', '', 'string'); - // $ruleInformation['with-interface'] = Request::get('with-interface', '', 'string'); - // $ruleInformation['interface-policy'] = Request::get('interface-policy', '', 'string'); - // newDevice($id, $serial, $name, $ip, $ruleInformation); // TODO: product and vendor id necessary? It's already in the hwname part. list($vid, $pid) = explode(':', $id); $hwProps = array( @@ -44,7 +38,6 @@ function HandleParameters() } } - /** * Adds a new USB-Device to the db. * @@ -118,58 +111,12 @@ function addUSBHwProps($table, $hwid, $serial, $propArray) { } /** - * Adds a new USB-Device to the db. - * - * @param string $id USB-Device id. - * @param string $serial USB-Device serial number. - * @param string $name USB-Device name. - */ -/* VERSION WITH OLD DB --------------------------------------------------------------------------------------- -function newDevice($id, $serial, $name, $ip, $ruleInformation) -{ - $NOW = time(); - //$machineuuid = Database::queryFirst("SELECT machineuuid, currentuser FROM machine AS m WHERE m.clientip = :ip", array('ip' => $ip)); - $client = Database::queryFirst("SELECT m.machineuuid AS 'muid', m.currentuser AS 'user' FROM machine AS m WHERE m.clientip=:ip", array('ip' => $ip)); - - // TODO: Same device when ID/Serial/Name are the same? Maybe hash value but the hash value can be different on multiple unix. - $dbresult = Database::queryFirst("SELECT uid FROM `usb_devices` WHERE id=:id AND serial=:serialnr AND name=:name", array( - 'id' => $id, - 'serialnr' => $serial, - 'name' => $name)); - if (empty($dbresult)) { - $dbquery = Database::exec("INSERT INTO `usb_devices` (id, serial, name, machineuuid, time, user, ruleInformation) VALUES (:id, :serialnr, - :name, :machineuuid, :now, :user, :ruleInformation)", array('id' => $id, - 'serialnr' => $serial, - 'name' => $name, - 'machineuuid' => $client['muid'], - 'now' => $NOW, - 'user' => $client['user'], - 'ruleInformation' => json_encode($ruleInformation))); - echo "Successfully added"; - } else { - $dbquery = Database::exec("UPDATE `usb_devices` SET machineuuid=:machineuuid, time=:now, user=:user, ruleInformation=:ruleInformation WHERE id=:id AND serial=:serialnr AND name=:name", - array('id' => $id, - 'serialnr' => $serial, - 'name' => $name, - 'machineuuid' => $client['muid'], - 'now' => $NOW, - 'user' => $client['user'], - 'ruleInformation' => json_encode($ruleInformation))); - echo "Successfully updated"; - } - -} -*/ -/** * Deletes a device from the db given a serial number. * * @param string $serial USB-Device serial number. */ function deleteDevice($id, $serial) { - // For the Old db struct - //Database::exec("DELETE FROM `usb_devices` WHERE serial=:serial", array('serial' => $serial)); - $hw = Database::queryFirst("SELECT * FROM `statistic_hw` WHERE hwname=:id", array('id' => $id)); if($hw['hwtype'] === DeviceType::USB) { Database::exec("DELETE FROM `usblockoff_hw` WHERE hwid=:hwid AND serial=:serial", array( @@ -179,5 +126,4 @@ function deleteDevice($id, $serial) } else { echo "Type is not a USB device"; } - } |