Little Tweeks

This commit is contained in:
GamerClassN7
2020-10-22 17:59:45 +02:00
parent 946a93a23b
commit ab92a58289
5 changed files with 37 additions and 30 deletions

View File

@@ -33,13 +33,16 @@ class DeviceManager{
WHERE devices.approved != ? ORDER BY $sort $sortType", Array(2));
}
public static function create ($name, $token) {
public static function create ($name, $token, $type = "") {
$defaultRoom = RoomManager::getDefaultRoomId();
$device = array (
'name' => $name,
'token' => $token,
'room_id' => $defaultRoom,
);
if (!empty($type)) {
$device['type'] = $type;
}
try {
Db::add ('devices', $device);
return Db::loadOne("SELECT device_id FROM devices WHERE token = ?", array($token))['device_id'];