Ejemplo n.º 1
0
function searchFlickr($keywords, $page)
{
    $retval = array();
    $data = array();
    $f = new phpFlickr('5bc169cff7b9121c0c93f9b8804b1116');
    $args = array("tags" => $keywords, "tag_mode" => "all", "sort" => "relevance", "per_page" => "10", "page" => $page);
    $photos = $f->photos_search($args);
    //decide not to show the photo beyond page 400;
    $totalPages = min($photos['pages'], 400);
    if ($totalPages > 0) {
        $i = 0;
        foreach ($photos['photo'] as $photo) {
            $user = $f->people_getInfo($photo['owner']);
            $data[$i] = array('id' => $photo['id'], 'title' => $photo['title'], 'author' => $user['username'], 'image' => $f->buildPhotoURL($photo, "Square"));
            $i++;
        }
        $retval['status'] = 'OK';
        $retval['statusmsg'] = 'OK';
        $retval['totalpages'] = $totalPages;
        $retval['currentpage'] = $page;
        $retval['data'] = $data;
    } else {
        $retval['status'] = 'NA';
        $retval['statusmsg'] = 'NA';
    }
    return $retval;
}
Ejemplo n.º 2
0
 /**
  * get images from flickr
  * @author - Henry Addo
  * @access - public 
  * @return - Array of images
  */
 public function get_images()
 {
     $username = "";
     $photo_urls = "http://www.flickr.com/photos/eyedol/";
     $tags = "tedglobal2007";
     // create instance of phpFlickr class
     $flickr = new phpFlickr('');
     //enable caching
     $flickr->enableCache("");
     //authenticate
     //$flickr->auth();
     //get token
     //$token = $token['user']['nsid'];
     // get NSID of the username
     $nsid = $token['user']['nsid'];
     $user = $flickr->people_findByUsername($username);
     //get the friendly URL of the the users' photos
     $photos_url = $flickr->urls_getUserPhotos($username);
     // get 20 images of public images of the user
     //$photos = $flickr->photos_search( array( 'tags'=>$tags,
     //'per_page'=> 200 ) );
     $photos = $flickr->people_getPublicPhotos($username, NULL, 36);
     // loop through the photos
     foreach ((array) $photos['photo'] as $photo) {
         $this->images[] = "<li><a href=\"#\">\n        <img  alt='{$photo['title']}' title='{$photo['title']}'\n        src=\"" . $flickr->buildPhotoURL($photo, 'Square') . "\" \n        onclick=\"get_image_id('" . $flickr->buildPhotoURL($photo) . "','{$photo['title']}')\"/></a></li>";
         $owner = $flickr->people_getInfo($photo[owner]);
         $this->owner = $owner['username'];
     }
     return $this->images;
 }
Ejemplo n.º 3
0
<?php

/* Last updated with phpFlickr 1.3.2
 *
 * This example file shows you how to call the 100 most recent public
 * photos.  It parses through them and prints out a link to each of them
 * along with the owner's name.
 *
 * Most of the processing time in this file comes from the 100 calls to
 * flickr.people.getInfo.  Enabling caching will help a whole lot with
 * this as there are many people who post multiple photos at once.
 *
 */
require_once "phpFlickr.php";
$f = new phpFlickr("bb204b11214e836e196f0481fa7f90b4");
$recent = $f->photos_getRecent(NULL, 1, 1);
foreach ($recent['photo'] as $photo) {
    $owner = $f->people_getInfo($photo['owner']);
    echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>";
    echo $photo['title'];
    echo "</a> Owner: ";
    echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>";
    echo $owner['username'];
    echo "</a><br>";
}
Ejemplo n.º 4
0
<?php

include_once "../include.php";
require_once "./phpFlickr-3.1/phpFlickr.php";
$f = new phpFlickr("94c57f05ba55563f88348d29bdd54593");
$id = $_GET['id'];
$owner = $f->people_getInfo($id);
$retval = new obj();
$retval->status = 0;
$retval->statusMsg = sprintf("success");
$retval->raw = $owner;
$retval->data = $owner;
echo json_encode($retval);
Ejemplo n.º 5
0
 function execute($par)
 {
     global $wgUser, $wgOut, $wgScriptPath, $wgRequest, $wgLang, $wgIFI_FlickrAPIKey, $wgTmpDirectory;
     global $wgIFI_ResultsPerPage, $wgIFI_FlickrSort, $wgIFI_FlickrLicense, $wgIFI_ResultsPerRow, $wgIFI_CreditsTemplate;
     global $wgIFI_GetOriginal, $wgIFI_PromptForFilename, $wgIFI_AppendRandomNumber, $wgIFI_FlickrSearchBy, $wgIFI_ThumbType;
     global $wgIFI_CheckForExistingFile, $wgIFI_ValidDomains, $wgIFI_ValidLicenses;
     global $wgIFI_UseAjax, $wgIFI_AjaxKey, $wgIFI_AjaxDomain, $wgIFI_AjaxTemplate;
     require_once "phpFlickr-2.0.0/phpFlickr.php";
     wfLoadExtensionMessages('ImportFreeImages');
     $this->setHeaders();
     $fname = "wfSpecialImportFreeImages";
     $importPage = Title::makeTitle(NS_SPECIAL, "ImportFreeImages");
     if ($wgUser->isAnon()) {
         $wgOut->errorpage('uploadnologin', 'uploadnologintext');
         return;
     }
     if (empty($wgIFI_FlickrAPIKey)) {
         // error - need to set $wgIFI_FlickrAPIKey to use this extension
         $wgOut->errorpage('error', 'importfreeimages_noapikey');
         return;
     }
     $q = '';
     if (isset($_GET['q']) && !$wgRequest->wasPosted()) {
         $q = $_GET['q'];
     }
     $import = '';
     if ($wgRequest->wasPosted() && isset($_POST['url'])) {
         $import = $_POST['url'];
         $parts = parse_url($import);
         preg_match("/[^.]+\\.[^.]+\$/", $parts['host'], $domain_only);
         $domain = $domain_only[0];
         if (!isset($wgIFI_ValidDomains[$domain])) {
             $wgOut->addHTML(wfMsg('importfreeimages_invalidurl', $import));
             return;
         }
         if ($wgIFI_CheckForExistingFile && $wgRequest->getVal('override', null) == null) {
             $title = urldecode($wgRequest->getVal('ititle'));
             $id = $wgRequest->getVal('id');
             $x = Title::newFromText($title);
             if ($x) {
                 $dbr = wfGetDB(DB_SLAVE);
                 $res = $dbr->select("image", array("img_name", "img_description"), array("img_name like '" . $dbr->strencode($x->getDBKey()) . "%'"));
                 $found = false;
                 $wt = "";
                 while ($row = $dbr->fetchObject($res)) {
                     if (strpos($row->img_description, $id) !== false) {
                         $img = Image::newFromName($row->img_name);
                         $t = Title::makeTitle(NS_IMAGE, $row->img_name);
                         $wt .= "<tr><td>[[Image:{$img->getName()}|thumb|center|{$t->getText()}]]</td>\n\t\t\t\t\t\t\t<td valign='top'>" . wfMsg('image_instructions', $t->getFullText()) . "</td></tr>";
                         $found = true;
                     }
                 }
                 $dbr->freeResult($res);
             }
             if ($found) {
                 $wgOut->addHTML(wfMsg('importfreeimages_similarphotosfound') . "<table>");
                 $wgOut->addWikiText($wt);
                 $wgOut->addHTML("</table><br clear='all'/><form method='POST'>");
                 $vals = $wgRequest->getValues();
                 foreach ($vals as $key => $value) {
                     $wgOut->addHTML("<input type='hidden' name='{$key}' value='" . htmlspecialchars($value) . "'/>");
                 }
                 $wgOut->addHTML("<input type='hidden' name='override' value='true'/>");
                 $wgOut->addHTML("<input type='button' onclick='window.location=\"{$importPage->getFullURL()}\";' class='guided-button' value='" . wfMsg('importfreeimages_dontimportduplicate') . "'/>&nbsp;&nbsp;&nbsp; <input class='guided-button' type='submit' value='" . wfMsg('importfreeimages_importduplicate') . "'/></form>");
                 return;
             }
         }
         if ($wgIFI_GetOriginal && ($domain = "flickr.com")) {
             // get URL of original :1
             $sizes = $f->photos_getSizes($_POST['id']);
             $original = '';
             foreach ($sizes as $size) {
                 if ($size['label'] == 'Original') {
                     $original = $size['source'];
                     $import = $size['source'];
                 } else {
                     if ($size['label'] == 'Large') {
                         $large = $size['source'];
                     }
                 }
             }
             //somtimes Large is returned but no Original!
             if ($original == '' && $large != '') {
                 $import = $large;
             }
         }
         // store the contents of the file
         $pageContents = file_get_contents($import);
         $name = $wgTmpDirectory . "/flickr-" . rand(0, 999999);
         $r = fopen($name, "w");
         $size = fwrite($r, $pageContents);
         fclose($r);
         chmod($name, 0777);
         if ($domain == $wgIFI_AjaxDomain) {
             $caption = "{{{$wgIFI_AjaxTemplate}|{$import}}}";
             $id = $wgRequest->getVal('id');
             if ($domain == "wikimedia.org") {
                 //maybe we can grab the licnese
                 $yy = str_replace("http://upload.wikimedia.org/", "", $import);
                 $parts = split("/", $yy);
                 $img_title = "";
                 if (sizeof($parts) == 7) {
                     $img_title = $parts[5];
                 } else {
                     if (sizeof($parts) == 5) {
                         $img_title = $parts[4];
                     }
                 }
                 if ($img_title != "") {
                     $url = "http://commons.wikimedia.org/wiki/Image:{$img_title}";
                     $license = "unknown";
                     $contents = file_get_contents("http://commons.wikimedia.org/w/index.php?title=Image:{$img_title}&action=raw");
                     foreach ($wgIFI_ValidLicenses as $lic) {
                         if (strpos($contents, "{{$lic}") !== false || strpos($contents, "{{self|{$lic}") !== false || strpos($contents, "{{self2|{$lic}") !== false) {
                             $license = $lic;
                             break;
                         }
                     }
                     $caption = "{{{$wgIFI_AjaxTemplate}|{$import}|{$url}|{$license}}}";
                 }
             }
         } else {
             if (!empty($wgIFI_CreditsTemplate)) {
                 $f = new phpFlickr($wgIFI_FlickrAPIKey);
                 $info = $f->photos_getInfo($_POST['id']);
                 $caption = "{{" . $wgIFI_CreditsTemplate . $info['license'] . "|{$_POST['id']}|" . urldecode($_POST['owner']) . "|" . urldecode($_POST['name']) . "}}";
             } else {
                 $caption = wfMsg('importfreeimages_filefromflickr', $_POST['t'], "http://www.flickr.com/people/" . urlencode($_POST['owner']) . " " . $_POST['name']) . " <nowiki>{$import}</nowiki>. {{CC by 2.0}} ";
             }
         }
         $caption = trim($caption);
         $t = $_POST['ititle'];
         // handle duplicate filenames
         $i = strrpos($import, "/");
         if ($i !== false) {
             $import = substr($import, $i + 1);
         }
         // pretty dumb way to make sure we're not overwriting previously uploaded images
         $c = 0;
         $nt =& Title::makeTitle(NS_IMAGE, $import);
         $fname = $import;
         while ($nt->getArticleID() && $c < 20) {
             $fname = $c . "_" . $import;
             $nt =& Title::makeTitle(NS_IMAGE, $fname);
             $c++;
         }
         $import = $fname;
         /*
         			$arr = array ( "size" => $size, "tempname" => $name, 
         					"caption" => $caption,
         					"url" => $import, "title" => $_POST['t'] );
         */
         $filename = trim(urldecode($wgRequest->getVal('ititle', null)));
         if ($filename == "undefined") {
             $filename = wfTimestampNow();
         }
         $filename .= "_";
         if ($wgIFI_AppendRandomNumber) {
             $filename .= rand(0, 100000);
         }
         $parts = parse_url($wgRequest->getVal('url'));
         $ux = $wgRequest->getVal('url');
         $ext = strtolower(substr($ux, strrpos($ux, ".")));
         switch ($ext) {
             case ".png":
             case ".jpeg":
             case ".jpg":
             case ".gif":
                 $filename .= $ext;
                 break;
             default:
                 $filename .= ".jpg";
         }
         $filename = str_replace("?", "", $filename);
         $filename = str_replace(":", "", $filename);
         $filename = preg_replace('/ [ ]*/', ' ', $filename);
         if (!class_exists("UploadForm")) {
             require_once 'includes/SpecialUpload.php';
         }
         $u = new UploadForm($wgRequest);
         //MW 1.12+
         $u->mTempPath = $name;
         $u->mFileSize = $size;
         $u->mComment = $caption;
         $u->mSrcName = $filename;
         $u->mUploadTempName = $name;
         $u->mUploadSize = $size;
         $u->mUploadDescription = $caption;
         $u->mRemoveTempFile = true;
         $u->mIgnoreWarning = true;
         $u->mOname = $filename;
         $t = Title::newFromText($filename, NS_IMAGE);
         if (!$t) {
             $wgOut->addHTML("Error - could not create title from filename \"{$filename}\"");
             return;
         }
         if ($t->getArticleID() > 0) {
             $sk = $wgUser->getSkin();
             $dlink = $sk->makeKnownLinkObj($t);
             $warning .= '<li>' . wfMsgHtml('fileexists', $dlink) . '</li>';
             // use our own upload warning as we dont have a 'reupload' feature
             $this->uploadWarning($u);
             return;
         } else {
             $u->execute();
         }
     }
     $wgOut->addHTML(wfMsg('importfreeimages_description') . "<br/><br/>\n\t\t\t<form method=GET action='" . $importPage->getFullURL() . "'>" . wfMsg('search') . ": <input type=text name=q value='" . htmlspecialchars($q) . "'><input type=submit value=" . wfMsg('search') . ">\n\t\t\t</form>");
     if ($q != '') {
         $page = $_GET['p'];
         if ($page == '') {
             $page = 1;
         }
         $f = new phpFlickr($wgIFI_FlickrAPIKey);
         $q = $_GET['q'];
         // TODO: get the right licenses
         $photos = $f->photos_search(array("{$wgIFI_FlickrSearchBy}" => "{$q}", "tag_mode" => "any", "page" => $page, "per_page" => $wgIFI_ResultsPerPage, "license" => $wgIFI_FlickrLicense, "sort" => $wgIFI_FlickrSort));
         $i = 0;
         if ($photos == null || !is_array($photos) || sizeof($photos) == 0 || !isset($photos['photo'])) {
             $wgOut->addHTML(wfMsg("importfreeimages_nophotosfound", $q));
             return;
         }
         $sk = $wgUser->getSkin();
         $wgOut->addHTML("\n\t\t\t\t<style type='text/css' media='all'>/*<![CDATA[*/ @import '/extensions/ImportFreeImages/ifi.css'; /*]]>*/</style>\n\t\t\t\t<div id='photo_results'> " . wfMsg('importfreeimages_results', 'Flickr') . "\n\t\t\t\t<center>\n\t\t\t\t<table cellpadding='4' class='ifi_table'>\n\t\t\t\t<form method='POST' name='uploadphotoform' action='" . $importPage->getFullURL() . "'>\n\t\t\t\t\t<input type='hidden' name='url' value=''/>\n\t\t\t\t\t<input type='hidden' name='id' value=''/>\n\t\t\t\t\t<input type='hidden' name='action' value='submit'/>\n\t\t\t\t\t<input type='hidden' name='owner' value=''/>\n\t\t\t\t\t<input type='hidden' name='name' value=''/>\n\t\t\t\t\t<input type='hidden' name='ititle' value=''/>\n\t\t\t\t</form>\t\n\t\t<script type=\"text/javascript\">\n\t\n\t\t\tfunction s2 (url, id, owner, name, ititle) {\n\t\t\t\tresults = document.getElementById('photo_results');\n\t\t\t\tdocument.uploadphotoform.url.value = url;\n\t\t\t\tdocument.uploadphotoform.id.value = id;\n\t\t\t\tdocument.uploadphotoform.owner.value = owner;\n\t\t\t\tdocument.uploadphotoform.name.value = name;\n\t\t\t\tdocument.uploadphotoform.ititle.value = ititle;\n\t\t\t\tif (" . ($wgIFI_PromptForFilename ? "true" : "false") . ") {\n\t\t\t\t\tititle = ititle.replace(/\\+/g, ' ');\n\t\t\t\t\tdocument.uploadphotoform.ititle.value = prompt('" . wfMsg('importfreeimages_promptuserforfilename') . "', unescape(ititle));\n\t\t\t\t\tif (document.uploadphotoform.ititle.value == '') {\n\t\t\t\t\t\tdocument.uploadphotoform.ititle.value = ititle;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdocument.uploadphotoform.submit();\n\t\t\t\tresults.innerHTML = '" . wfMsg('importfreeimages_uploadingphoto') . "';\n\t\t\t}\n\t\n\t\t</script>\n\t\t\t\t");
         $count = 0;
         foreach ($photos['photo'] as $photo) {
             $count++;
             if ($i % $wgIFI_ResultsPerRow == 0) {
                 $wgOut->addHTML("<tr>");
             }
             $owner = $f->people_getInfo($photo['owner']);
             $wgOut->addHTML("<td><a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>");
             $wgOut->addHTML($photo['title']);
             $wgOut->addHTML("</a><br/>" . wfMsg('importfreeimages_owner') . ": ");
             $wgOut->addHTML("<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>");
             $wgOut->addHTML($owner['username']);
             $wgOut->addHTML("</a><br/>");
             //$wgOut->addHTML( "<img  src=http://static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . "." . "jpg>" );
             $url = "http://farm{$photo['farm']}.static.flickr.com/{$photo['server']}/{$photo['id']}_{$photo['secret']}.jpg";
             $wgOut->addHTML("<img src=\"http://farm{$photo['farm']}.static.flickr.com/{$photo['server']}/{$photo['id']}_{$photo['secret']}_{$wgIFI_ThumbType}.jpg\">");
             $wgOut->addHTML("<br/>(<a href='#' onclick=\"s2('{$url}', '{$photo['id']}','{$photo['owner']}', '" . urlencode($owner['username']) . "', '" . urlencode($photo['title']) . "');\">" . wfMsg('importfreeimages_importthis') . "</a>)\n");
             $wgOut->addHTML("</td>");
             if ($i % $wgIFI_ResultsPerRow == $wgIFI_ResultsPerRow - 1) {
                 $wgOut->addHTML("</tr>");
             }
             $i++;
         }
         if ($count == 0) {
             $wgOut->addHTML(wfMsg('importfreeimages_noresults'));
         }
         $wgOut->addHTML("</table></center>");
         if ($wgIFI_UseAjax) {
             $s = htmlspecialchars($wgRequest->getVal('q'));
             $gPage = ($page - 1) * 2;
             $importjs = HtmlSnips::makeUrlTags('js', array('importfreeimages.js'), '/extensions/ImportFreeImages/', false);
             $wgOut->addHTML("<br/><br/>" . wfMsg('importfreeimages_results', $wgIFI_AjaxDomain) . "\n\t\t\t\t\t<script type='text/javascript'>\t\t\t\n\t\t\t\t\t\tvar gAjaxDomain = '{$wgIFI_AjaxDomain}';\n\t\t\t\t\t\tvar gInitialSearch = '{$s}';\n\t\t\t\t\t\tvar gPage = {$gPage};\n\t\t\t\t\t\tvar gImportMsg = '" . wfMsg('importfreeimages_importthis') . "';\n\t\t\t\t\t\tvar gImportMsgManual = '" . wfMsg('importfreeimages_importmanual') . "';\n\t\t\t\t\t\tvar gManualURL= '" . Title::makeTitle(NS_PROJECT, 'Manual Import')->getFullURL() . "';\n\t\t\t\t\t\tvar gMoreInfo='" . wfMsg('importfreeimages_moreinfo') . "';\n\t\t\t\t\t</script>\n\t\t\t\t   <script src='http://www.google.com/jsapi?key={$wgIFI_AjaxKey}' type='text/javascript'></script>\n\t\t\t\t\t{$importjs}\n\t\t\t\t \t<div id='searchform' style='width:200px; display:none;'>Loading...</div>\n\t    \t\t\t<div id='ajax_results'></div>\n\t\t\t\t");
         }
         $page = $page + 1;
         $wgOut->addHTML("</form>");
         $wgOut->addHTML("<br/>" . $sk->makeLinkObj($importPage, wfMsg('importfreeimages_next', $wgIFI_ResultsPerPage), "p={$page}&q=" . urlencode($q)));
         $wgOut->addHTML("</div>");
     }
 }
Ejemplo n.º 6
0
 // message after login
 case 'logged':
     $_SESSION['page_infos'][] = l10n('Successfully logged in to you Flickr account');
     redirect(FLICKR_ADMIN . '-import');
     break;
     // logout
 // logout
 case 'logout':
     unset($_SESSION['phpFlickr_auth_token']);
     $_SESSION['page_infos'][] = l10n('Logged out');
     redirect(FLICKR_ADMIN . '-import');
     break;
     // main menu
 // main menu
 case 'main':
     $u = $flickr->people_getInfo($u['id']);
     $template->assign(array('username' => $u['username'], 'profile_url' => $u['profileurl'], 'logout_url' => FLICKR_ADMIN . '-import&amp;action=logout', 'list_albums_url' => FLICKR_ADMIN . '-import&amp;action=list_albums', 'import_all_url' => FLICKR_ADMIN . '-import&amp;action=list_all'));
     break;
     // list user albums
 // list user albums
 case 'list_albums':
     // all albums
     $albums = $flickr->photosets_getList($u['id']);
     $total_albums = $albums['total'];
     $albums = $albums['photoset'];
     foreach ($albums as &$album) {
         $album['U_LIST'] = FLICKR_ADMIN . '-import&amp;action=list_photos&amp;album=' . $album['id'];
     }
     unset($album);
     // not classed
     $wo_albums = $flickr->photos_getNotInSet(NULL, NULL, NULL, NULL, 'photos', NULL, NULL, 1);
Ejemplo n.º 7
0
$flickr_comments_array = $f->photos_comments_getList($flickr_path[3]);
$flickr_comments = $flickr_comments_array['comments'];
$node->comment_count += count($flickr_comments);
?>
| <?php 
print l('comment', $node->field_flickr[0]['embed']);
?>

</div> <!-- flickr-tags -->

<?php 
if ($page) {
    if (isset($flickr_comments['comment']) && count($flickr_comments['comment'])) {
        print '<div class="comment">';
        foreach ($flickr_comments['comment'] as $flickr_comment) {
            $p = $f->people_getInfo($flickr_comment['author']);
            $commenter_icon_url = 'http://static.flickr.com/' . $p['iconserver'] . '/buddyicons/' . $p['nsid'] . '.jpg';
            $commenter_icon_alt = t('Flickr icon for ') . $flickr_comment['authorname'];
            $commenter_icon_attributes = NULL;
            $commenter_icon = theme('image', $commenter_icon_url, $commenter_icon_alt, '', $commenter_icon_attributes, FALSE);
            $commenter_icon_link_attributes = array();
            $commenter_icon_link_attributes['html'] = TRUE;
            $commenter_icon_link_attributes['attributes'] = array();
            $commenter_icon_link_attributes['attributes']['class'] = 'flickr-commenter-icon-link';
            print l($commenter_icon, $p['photosurl'], $commenter_icon_link_attributes);
            print '<div class="author">Submitted by ';
            print l($flickr_comment['authorname'], $p['photosurl']);
            print ' on ';
            print date('D Y-m-d H:i', $flickr_comment['datecreate']);
            print ' ';
            print l('#', $flickr_comment['permalink']);
Ejemplo n.º 8
0
function showFlickrPhotos($target)
{
    global $blogURL, $pluginURL, $configVal;
    requireComponent('Textcube.Function.misc');
    require_once "lib/phpFlickr.php";
    $data = misc::fetchConfigVal($configVal);
    $flickruserid = isset($data['flickruserid']) ? $data['flickruserid'] : "";
    $flickr_api_key = "d1038f051000214af2bf694014ca8f98";
    //It's key for plugin. It does not change.
    $f = new phpFlickr($flickr_api_key);
    ob_start();
    ?>
	<script type="text/javascript">
	//<![CDDA[
		function actionFlickr(flag){
			var person = document.getElementById("person").value;
			var photoSets = (document.getElementById("photoSets")==undefined) ? "" : document.getElementById("photoSets").value;
			var length = 16;
			var searchKey = document.getElementById("searchKey").value;
			var srcTarget = document.getElementById("flickrview");

			switch(flag) {
				case "search":
					var flickrQueryString = "?person=" + person + "&photoSets=" + photoSets + "&length=" + length + "&search=" + encodeURIComponent(searchKey) + "&page=1";
					srcTarget.src = "<?php 
    echo $blogURL;
    ?>
/plugin/flickrPhotos" + flickrQueryString;
				break;
				case "allview":
					var flickrQueryString = "?person=" + person + "&length=" + length + "&page=1";
					srcTarget.src = "<?php 
    echo $blogURL;
    ?>
/plugin/flickrPhotos" + flickrQueryString;
				break;
				case "refresh":
				default:
					parent.frames['flickrview'].location.reload();
				break;
			}
		}
	//]]>
	</script>
	<div style="margin-top:10px;clear:both;"><strong>&bull; Flickr Photos</strong></div>
	<?php 
    if (!empty($flickruserid)) {
        ?>
		<div id="photosToyHeader" style="margin-top:15px;background-color:#eee;">
		<?php 
        $userInfo = $f->people_getInfo($flickruserid);
        echo '&nbsp;Hello!&nbsp;<strong style="color: #36f;">', $userInfo['username'], '</strong>';
        $photosUrl = $userInfo['photosurl'];
        ?>
		</div>
		<?php 
    }
    ?>
	
	<div style="margin-top:5px;background-color:#fff;"><iframe name="flickrview" id="flickrview" src="<?php 
    echo $blogURL;
    ?>
/plugin/flickrPhotos" scrolling="no" style="width:100%;height:200px;margin:0;padding:0;border:0;"></iframe></div>
	<div id="photosToolbar" style="background-color:#eee;white-space:nowrap;padding:4px;overflow:hidden;">
	<?php 
    if (!empty($flickruserid)) {
        $mySets = $f->photosets_getList($flickruserid);
        echo 'Flickr Photosets&nbsp;<select id="photoSets" name="photoSets" size="1">';
        foreach ((array) $mySets['photoset'] as $row) {
            echo '<option label="', $row['title'], '" value="', $row['id'], '">', $row['title'], '(', $row['photos'], ')</option>';
        }
        echo '</select>&nbsp;&nbsp;';
    }
    ?>
	Search&nbsp;<select name="person" id="person" value="1"><option label="My" value="my">My</option><option label="All" value="all">All</option></select>&nbsp;<input type="text" name="searchKey" id="searchKey" value="" maxlength="255" /><br /><br />
	<img src="<?php 
    echo $pluginURL;
    ?>
/images/refresh.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('refresh');return false;" />&nbsp;<img src="<?php 
    echo $pluginURL;
    ?>
/images/search.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('search');return false;" />&nbsp;<img src="<?php 
    echo $pluginURL;
    ?>
/images/allview.gif" width="82" height="16" border="0" alt="" style="cursor:pointer;" onclick="actionFlickr('allview');return false;" />
	</div>
	<?php 
    $script = ob_get_contents();
    ob_end_clean();
    return $target . $script;
}