public function getInstanceDetails($id) { $location = empty($this->userid) ? apiDB::getLocation($id) : apiDB::getUserLocation($id, $this->userid); if (empty($location->id)) { return self::NO_SUCH_ID; } $user = apiDB::getUser($location->userid); if ($_SERVER['PHP_AUTH_USER'] != $user->email && $this->access <= 1) { return self::ACCESS_DENIED; } $this->latitude = $location->latitude; $this->longitude = $location->longitude; $this->name = $location->name; $this->userid = $location->userid; $this->id = $location->id; $this->rain = $location->rain; $this->mintemp = $location->mintemp; // Preserving $this->access however, to retain admin rights. return self::SETUP_OK; }