/** * Retrieves general user, friend, and snap updates. * * @param bool $force * Forces an update even if there's fresh data in the cache. Defaults * to FALSE. * * @return mixed * The data returned by the service or FALSE on failure. */ public function getUpdates($force = TRUE) { if (!$force) { $result = $this->cache->get('updates'); if ($result) { return $result; } } // Make sure we're logged in and have a valid access token. if (!$this->auth_token || !$this->username) { return FALSE; } if (strlen(parent::getGAuth()) <= 0) { $a = $this->getAuthToken(); parent::setGAuth($a); $this->totArray[1][$this->username] = array($a, time() + 55 * 60); file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . self::DATA_FOLDER . DIRECTORY_SEPARATOR . "auth-{$this->username}.dat", serialize($this->totArray)); } $timestamp = parent::timestamp(); $result = parent::post('/loq/all_updates', array('timestamp' => $timestamp, 'username' => $this->username, 'height' => 1280, 'width' => 720, 'max_video_height' => 640, 'max_video_width' => 480), array($this->auth_token, $timestamp), $multipart = false, $debug = $this->debug); if (!empty($result->updates_response)) { $this->auth_token = $result->updates_response->auth_token; $this->cache->set('updates', $result->updates_response); return $result->updates_response; } return $result; }
/** * Retrieves general user, friend, and snap updates. * * @param bool $force * Forces an update even if there's fresh data in the cache. Defaults * to FALSE. * * @return mixed * The data returned by the service or FALSE on failure. */ public function getUpdates($force = TRUE) { if (!$force) { $result = $this->cache->get('updates'); if ($result) { return $result; } } // Make sure we're logged in and have a valid access token. if (!$this->auth_token || !$this->username) { return FALSE; } if (strlen(parent::getGAuth()) <= 0) { parent::setGAuth($this->getAuthToken()); } $timestamp = parent::timestamp(); $result = parent::post('/loq/all_updates', array('timestamp' => $timestamp, 'username' => $this->username, 'height' => 1280, 'width' => 720, 'max_video_height' => 640, 'max_video_width' => 480), array($this->auth_token, $timestamp), $multipart = false, $debug = $this->debug); if (!empty($result->updates_response)) { $this->auth_token = $result->updates_response->auth_token; $this->cache->set('updates', $result->updates_response); return $result->updates_response; } return $result; }