/** * Marks a device of the Request::GetGETUser() to be remotely wiped * * @param string $deviceId the device id * * @access public * @return boolean * @throws SoapFault */ public function WipeDevice($deviceId) { $deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId); ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::WipeDevice('%s'): mark device of user '%s' for remote wipe", $deviceId, Request::GetGETUser())); if (!ZPushAdmin::WipeDevice(Request::GetAuthUser(), Request::GetGETUser(), $deviceId)) { ZPush::GetTopCollector()->AnnounceInformation(ZLog::GetLastMessage(LOGLEVEL_ERROR), true); throw new SoapFault("ERROR", ZLog::GetLastMessage(LOGLEVEL_ERROR)); } ZPush::GetTopCollector()->AnnounceInformation(sprintf("Wipe requested - device id '%s'", $deviceId), true); return true; }
/** * Command "Wipe device" * Marks a device of that user to be remotely wiped * * @return * @access public */ public static function CommandWipeDevice() { $stat = ZPushAdmin::WipeDevice($_SERVER["LOGNAME"], self::$user, self::$device); if (self::$user !== false && self::$device !== false) { echo sprintf("Mark device '%s' of user '%s' to be wiped: %s", self::$device, self::$user, $stat ? 'OK' : ZLog::GetLastMessage(LOGLEVEL_ERROR)) . "\n"; if ($stat) { echo "Updated information about this device:\n"; self::printDeviceData(self::$device, self::$user); } } elseif (self::$user !== false) { echo sprintf("Mark devices of user '%s' to be wiped: %s", self::$user, $stat ? 'OK' : ZLog::GetLastMessage(LOGLEVEL_ERROR)) . "\n"; self::CommandShowDevices(); } }