public function delete($id) { if ($this->getClass() < self::CLASS_ADMIN) { throw new Exception('Du saknar rättigheter.', 401); } $user = $this->get($id); foreach (explode(", ", "iplog, bonuslog, bookmarks, snatch, reqvotes, blocks, bevaka, cheatlog, invites, readposts, peers") as $x) { $this->db->query("DELETE FROM " . $x . " WHERE userid = " . $id); } $this->db->query("DELETE FROM users WHERE id = " . $id); $this->db->query("DELETE FROM messages WHERE receiver = " . $id); $this->db->query("DELETE FROM friends WHERE friendid = " . $id . " OR userid = " . $id); $adminlogs = new AdminLogs($this->db, $this); $adminlogs->create("{{username}} raderade kontot [b]" . $user["username"] . "[/b] ifrån databasen"); }
public function delete($id) { if ($this->getClass() < self::CLASS_ADMIN) { throw new Exception(L::get("PERMISSION_DENIED"), 401); } $user = $this->get($id); foreach (explode(", ", "iplog, bonuslog, bookmarks, snatch, reqvotes, blocks, bevaka, cheatlog, invites, readposts, peers") as $x) { $this->db->query("DELETE FROM " . $x . " WHERE userid = " . $id); } $this->db->query("DELETE FROM users WHERE id = " . $id); $this->db->query("DELETE FROM messages WHERE receiver = " . $id); $this->db->query("DELETE FROM friends WHERE friendid = " . $id . " OR userid = " . $id); $adminlogs = new AdminLogs($this->db, $this); $adminlogs->create(L::get("ACCOUNT_REMOVED_LOG", [$user["username"]], Config::DEFAULT_LANGUAGE)); }