Пример #1
0
    $uploaded_start = mktime(0, 0, 0, $uploaded_start_month, $uploaded_start_day, $uploaded_start_year);
    $uploaded_end = mktime(23, 59, 59, $uploaded_end_month, $uploaded_end_day, $uploaded_end_year);
    $options["min_taken_date"] = $taken_start;
    $options["max_taken_date"] = $taken_end;
    $options["min_upload_date"] = $uploaded_start;
    $options["max_upload_date"] = $uploaded_end;
}
/* Set the default search to tag search */
if (!isset($flickr_method) || empty($flickr_method)) {
    $flickr_method = "tags";
}
/* Call service only if the query is set, ignore otherwise */
if (isset($flickr_query) && !empty($flickr_query) && isset($flickr_key)) {
    /* Include the required class */
    require_once "wso2/flickr/FlickrClient.php";
    $flickr_client = new FlickrClient($flickr_key);
    if ($flickr_method === "text") {
        $res = $flickr_client->photosTextSearch($flickr_query, $options);
    } else {
        $res = $flickr_client->photosTagSearch($flickr_query, $options);
    }
    /* Check for the soap - fault */
    if ($res["soap-fault"]) {
        $soap_reason = $res["soap-fault-reason"];
        printf("SOAP fault : {$soap_reason}\n");
    } elseif ($res["error"]) {
        $error_message = $res["error-msg"];
        printf("Error Message: {$error_message}\n");
    } elseif ($res["photos"] != NULL) {
        /* Calculating and Rendering the Number bar to access page by
           number */
Пример #2
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
ob_end_flush();
$text = $_GET["text"];
$small_image = array();
$medium_image = array();
$large_image = array();
$id = array();
$flicker_client = new FlickrClient($api_key);
$res_xml = $flicker_client->PhotoSearch($text);
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$str = str_replace($special, $replace, $res_xml);
$xml = <<<XML
<?xml version="1.0"?>
{$str}
XML;
file_put_contents("/tmp/xml.txt", $xml);
$XML = new SimpleXMLElement($xml);
foreach ($XML->photos->photo as $photo) {
    $image_id = (string) $photo['id'];
    array_push($id, $image_id);
    $server_id = (string) $photo['server'];
    $farm_id = (string) $photo['farm'];
    $secret = (string) $photo['secret'];
    $medium_url = "http://farm{$farm_id}.static.flickr.com/{$server_id}/{$image_id}_{$secret}_m.jpg";
    array_push($medium_image, $medium_url);
Пример #3
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
$shared = $_SESSION["shared"];
$frob = $_SESSION["frob"];
$photo_id = $_GET["id"];
$url = $_GET["url"];
$title = $_GET["title"];
ob_end_flush();
$flicker_client = new FlickrClient($api_key);
$res_token = $flicker_client->FlickrAuthGetToken($frob);
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$string = str_replace($special, $replace, $res_token);
$xml2 = <<<XML
<?xml version="1.0"?>
{$string}
XML;
$XML2 = new SimpleXMLElement($xml2);
$token = (string) $XML2->auth->token;
$_SESSION["token"] = $token;
file_put_contents("/tmp/toc1.txt", $token);
ob_end_flush();
?>

<html>
<head>
<title>Flickr recent photos</title>
Пример #4
0
<br>
<br>
 <input value="Submit" class="button" type="submit" />
</form>
<br>

<h4><b>Response<b></h4>
<?php 
$photo_id = $_POST['photo_id'];
$secret = $POST['secret'];
if ($secret == NULL) {
    $options = array("photo_id" => $photo_id);
} else {
    $options = array("photo_id" => $photo_id, "secret" => $secret);
}
$flicker_client = new FlickrClient($api_key);
switch ($method) {
    case 'flickr.photos.getInfo':
        $photo_info = $flicker_client->GetPhotoInfo($options);
        break;
    case 'flickr.photos.getFavorites':
        $photo_info = $flicker_client->GetPhotoFevorite($options);
        break;
    case 'flickr.photos.getPerms':
        $photo_info = $flicker_client->GetPhotoPerms($options);
        break;
    case 'flickr.photos.getRecent':
        $photo_info = $flicker_client->GetPhotoRecent;
        break;
    case 'flickr.photos.getSizes':
        $photo_info = $flicker_client->GetPhotoSizes($options);
Пример #5
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
ob_end_flush();
$small_image = array();
$medium_image = array();
$large_image = array();
$id = array();
$flicker_client = new FlickrClient($api_key);
$res_xml = $flicker_client->GetPhotoRecent();
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$str = str_replace($special, $replace, $res_xml);
$xml = <<<XML
<?xml version="1.0"?>
{$str}
XML;
file_put_contents("/tmp/xml.txt", $xml);
$XML = new SimpleXMLElement($xml);
if ($XML && $XML->photos && $XML->photos->photo) {
    foreach ($XML->photos->photo as $photo) {
        $image_id = (string) $photo['id'];
        array_push($id, $image_id);
        $server_id = (string) $photo['server'];
        $farm_id = (string) $photo['farm'];
        $secret = (string) $photo['secret'];
        $medium_url = "http://farm{$farm_id}.static.flickr.com/{$server_id}/{$image_id}_{$secret}_m.jpg";
        array_push($medium_image, $medium_url);
Пример #6
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
$shared = $_SESSION["shared"];
$frob = $_SESSION["frob"];
$token = $_SESSION["token"];
file_put_contents("/tmp/toc.txt", $token);
$photo_id = $_GET["id"];
file_put_contents("/tmp/photoid.txt", $photo_id);
$url = $_GET["url"];
$title = $_GET["title"];
ob_end_flush();
$flicker_client = new FlickrClient($api_key);
if (isset($_POST['Submit'])) {
    $comment = $_POST['comment'];
    $res_comment = $flicker_client->FlickrPhotoAddComments($photo_id, $comment, $token, $shared);
}
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$string = str_replace($special, $replace, $res_comment);
$xml2 = <<<XML
<?xml version="1.0"?>
{$string}
XML;
$XML = new SimpleXMLElement($xml2);
$comment = (string) $XML->comment['id'];
/*
*Add specific URL as location
Пример #7
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
$shared = $_SESSION["shared"];
$options = array("photo_id" => $photo_id);
$flicker_client = new FlickrClient($api_key);
$res_frob = $flicker_client->FlickrAuthGetFrob();
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$str = str_replace($special, $replace, $res_frob);
$xml = <<<XML
<?xml version="1.0"?>
{$str}
XML;
file_put_contents("/tmp/xml1.txt", $xml);
$XML = new SimpleXMLElement($xml);
$frob = (string) $XML->frob;
file_put_contents("/tmp/f2.txt", $frob);
$_SESSION["frob"] = $frob;
ob_end_flush();
/*
complete authontication
*/
$perms = "write";
$signature = md5($shared . 'api_key' . $api_key . 'frob' . $frob . 'perms' . $perms);
$url = "http://www.flickr.com/services/auth/?api_key={$api_key}&perms={$perms}&frob={$frob}&api_sig={$signature}";
header("Location:{$url}");
exit;
Пример #8
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
$method = $_SESSION["method"];
$photo_id = $_GET["id"];
$url = $_GET["url"];
$comment = $_GET["comment"];
ob_end_flush();
$options = array("photo_id" => $photo_id);
$flicker_client = new FlickrClient($api_key);
$res_xml = $flicker_client->GetPhotoInfo($options);
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$str = str_replace($special, $replace, $res_xml);
$xml = <<<XML
<?xml version="1.0"?>
{$str}
XML;
file_put_contents("/tmp/xml.txt", $xml);
$tags = array();
$XML = new SimpleXMLElement($xml);
$username = (string) $XML->photo->owner['username'];
$title = (string) $XML->photo->title;
$description = (string) $XML->photo->description;
$comments = (string) $XML->photo->comments;
foreach ($XML->photo->tags->tag as $tag) {
    array_push($tags, $tag);
}