function endsWith($haystack, $needle)
{
return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
}
if ($_GET["reset"]!=""){
// unlink("cache.js");
$handle = fopen("cache.js", "w");
$c=" var imgdata = {";
$c.=" \"Set\": [";
require_once("phpFlickr.php");
$f = new phpFlickr("fc220d8b95d3bb930dbc94dda5662198","7920cffdfb330cb7");
$fs = $f->photosets_getList("68213833@N02");
$first=true;
$count=0;
foreach ($fs['photoset'] as $set) {
if (endsWith($set['title']['_content'],"."))
continue;
$count++;
if($count>10)
continue;
$id = $set['id'];
$title = $set['title']['_content'];
$farmid = $set['farm'];
$serverid = $set['server'];
$secret = $set['secret'];
$primary = $set['primary'];
$url="http://farm".$farmid.".staticflickr.com/".$serverid."/".$primary."_".$secret."_b.jpg";
if (!$first)$c.=",";else$first =false;
$c.=" {";
$c.=" \"Id\":\"$id\",";
$c.=" \"Title\":\"$title\",";
$c.=" \"Imageon\":\"tn.php?src=$url&w=70&h=70\",";
$c.=" \"Imageoff\":\"tn.php?src=$url&w=70&h=70&f=8|8|8|8|8|8|8|8|8|8|8|8|8|8|8|8|8|8\",";
$c.=" \"Images\": [";
$photos = $f->photosets_getPhotos($id);
$firstp=true;
$countp=0;
foreach ($photos['photoset']['photo'] as $p) {
if (endsWith($p['title'],"."))
continue;
$countp++;
$pid = $p['id'];
$ptitle = $p['title'];
$pfarmid = $p['farm'];
$pserverid = $p['server'];
$psecret = $p['secret'];
$url="http://farm".$pfarmid.".staticflickr.com/".$pserverid."/".$pid."_".$psecret."_b.jpg";
$info = $f->photos_getInfo($pid);
$pdesc = $info[photo]['description']['_content'];
$x = preg_replace("/\r\n|\r|\n/",'
',(addslashes($pdesc)));
if (!$firstp)$c.=",";else$firstp =false;
$c.=" {";
$c.=" \"Id\":\"$pid\",";
$c.=" \"Title\":\"$ptitle\",";
$c.=" \"Imageon\":\"tn.php?src=$url&zc=3&w=1024&h=1024\",";
$c.=" \"Imageoff\":\"tn.php?src=$url&zc=3&w=1024&h=1024&f=8|8|8|8|8|8|8|8|8|8|8|8|8|8|8|8|8|8\",";
$c.=" \"Description\":\"$x\"";
$c.=" }";
}
$c.=" ]";
$c.=" }";
}
$c.=" ]";
$c.=" };";
}?>