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;
 }
 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";
 }

</head>
<body>
<?php 
ini_set("display_errors", E_ALL);
error_reporting(E_ALL);
$apiKey = "e9c2d11b4b0c9861766632f00320b128";
$secret = "25e5fcd971be9bb9";
$tokenKey = "72157631808364528-6b6d2e85e9679674";
$tokenSecret = "27c1b928d9306c59";
include_once "../lib/config.php";
include_once "../lib/FlickrHA.php";
include_once "../lib/FlickrPhotoHA.php";
include_once "../lib/FlickrDB.php";
$flickr = new FlickrHA($config->flickr->apiKey, $config->flickr->secret, $config->flickr->tokenKey, $config->flickr->tokenSecret);
$flickrDB = new FlickrDB($flickr, $config->db);
$setName = isset($_REQUEST["setName"]) ? $_REQUEST["setName"] : false;
if (!$setName || !$config->sets[$setName]) {
    die("no set");
}
echo "<p>Delete old...</p>";
$flickrDB->deleteSetPhotos($config->sets[$setName]->setId);
echo "<p>Getting images for set " . $setName . "...</p>";
#$setId = "72157663923690755";
$json = $flickr->getSetPhotos($config->sets[$setName]->setId);
$i = 0;
foreach ($json->photoset->photo as $photo) {
    set_time_limit(20);
    echo "<div>";
    echo "<img src=\"" . FlickrPhotoHA::getUrl($photo, FlickrPhotoHA::SIZE_SMALL_240_SHORT) . "\" />";