コード例 #1
0
 public function getPrivacy()
 {
     $params = array();
     $params["method"] = "flickr.prefs.getPrivacy";
     $params["api_key"] = FlickrHA::$apiKey;
     $params["oauth_token"] = FlickrHA::$tokenKey . "x";
     $params["format"] = FlickrParamsHA::PHPFORMAT;
     $url = FlickrHA::API_GATEWAY . "?" . FlickrHA::createApiUrlParameters($params) . "&api_sig=" . FlickrHA::createApiSig2($params);
     $result = $this->_getResults($url);
     if (FlickrHA::hasError($result)) {
         return FlickrHA::getErrorCode($result);
     }
     return $result;
     //["stat"] ==="ok";
 }
コード例 #2
0
 public function reloadSetPhotos($setId)
 {
     $flickrId = $this->getFlickrId($setId);
     $photos = $this->_flickr->getSetPhotos($flickrId);
     if (FlickrHA::hasError($photos)) {
         return FlickrViewer::createErrorObject("Error while getting set photos:" . $photos->message);
     }
     //???create common error object
     $this->updatePhotoStatus(false, FlickrPhotoHA::STATUS_REMOVED_IN_SET_UPDATE, $setId);
     //??? ERROR?
     //print_r($photos["photoset"]["photo"]);
     //return;
     foreach ($photos["photoset"]["photo"] as $photo) {
         //print_r($photo);
         //continue;
         set_time_limit(20);
         $dbPhoto = $this->getDBPhoto(0, $photo["id"]);
         if ($dbPhoto !== false) {
             $this->updatePhotoStatus($dbPhoto["id"], FlickrPhotoHA::STATUS_OK);
             continue;
             //if error???
         }
         $sizes = $this->_flickr->getPhotosSizes($photo);
         $originalSecret = $this->_flickr->getPhotoInfo($photo);
         if (FlickrHA::hasError($originalSecret)) {
             return FlickrViewer::createErrorObject("Error while getting original secret :" . $originalSecret->message);
         }
         $originalSecret = $originalSecret["originalsecret"];
         $photoId = $this->savePhotoData($setId, $photo, $originalSecret, $sizes);
         if (FlickrViewer::hasError($photoId)) {
             return FlickrViewer::createErrorObject("Error while saving set photo :" . $photoId->message);
         }
     }
     return true;
 }