Пример #1
0
 /**
  * Returns the current AS Device in it's StateObject
  * If the data was not changed, it returns false (no need to update any data)
  *
  * @access public
  * @return array/boolean
  */
 public function GetData()
 {
     if (!$this->changed) {
         return false;
     }
     // device was updated
     $this->lastupdatetime = time();
     unset($this->ignoredMessageIds);
     if (!isset(self::$loadedData) || !isset(self::$loadedData->devices) || !is_array(self::$loadedData->devices)) {
         self::$loadedData = new StateObject();
         $devices = array();
     } else {
         $devices = self::$loadedData->devices;
     }
     $devices[$this->deviceuser] = $this;
     // check if RWStatus has to be updated so it can be updated for other users on same device
     if (isset($this->wipeStatus) && $this->wipeStatus > SYNC_PROVISION_RWSTATUS_OK) {
         foreach ($devices as $user => $asuserdata) {
             if ($user == $this->deviceuser) {
                 continue;
             }
             if (isset($this->wipeStatus)) {
                 $asuserdata->wipeStatus = $this->wipeStatus;
             }
             if (isset($this->wipeRequestBy)) {
                 $asuserdata->wipeRequestBy = $this->wipeRequestBy;
             }
             if (isset($this->wipeRequestOn)) {
                 $asuserdata->wipeRequestOn = $this->wipeRequestOn;
             }
             if (isset($this->wipeActionOn)) {
                 $asuserdata->wipeActionOn = $this->wipeActionOn;
             }
             $devices[$user] = $asuserdata;
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("Updated remote wipe status for user '%s' on the same device", $user));
         }
     }
     self::$loadedData->devices = $devices;
     return self::$loadedData;
 }