当前位置: 首页>>代码示例>>PHP>>正文


PHP phpFlickr::auth_getToken方法代码示例

本文整理汇总了PHP中phpFlickr::auth_getToken方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFlickr::auth_getToken方法的具体用法?PHP phpFlickr::auth_getToken怎么用?PHP phpFlickr::auth_getToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpFlickr的用法示例。


在下文中一共展示了phpFlickr::auth_getToken方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nextend_api_auth_flow

function nextend_api_auth_flow()
{
    $api_key = NextendRequest::getVar('api_key');
    $api_secret = NextendRequest::getVar('api_secret');
    if (session_id() == "") {
        @session_start();
    }
    if (!$api_key || !$api_secret) {
        $api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
        $api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
    } else {
        $_SESSION['api_key'] = $api_key;
        $_SESSION['api_secret'] = $api_secret;
    }
    if ($api_key && $api_secret) {
        require_once dirname(__FILE__) . "/api/phpFlickr.php";
        $f = new phpFlickr($api_key, $api_secret);
        if (empty($_GET['frob'])) {
            $f->auth('read', false);
        } else {
            $result = $f->auth_getToken($_GET['frob']);
            unset($_SESSION['api_key']);
            unset($_SESSION['api_secret']);
            unset($_SESSION['phpFlickr_auth_token']);
            echo '<script type="text/javascript">';
            echo 'window.opener.setToken("' . $result['token'] . '");';
            echo '</script>';
        }
    }
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:30,代码来源:auth.php

示例2: unset

/* Last updated with phpFlickr 2.3.2
 *
 * Edit these variables to reflect the values you need. $default_redirect 
 * and $permissions are only important if you are linking here instead of
 * using phpFlickr::auth() from another page or if you set the remember_uri
 * argument to false.
 */
$api_key = "[your api key]";
$api_secret = "[your api secret]";
$default_redirect = "/";
$permissions = "read";
$path_to_phpFlickr_class = "./";
ob_start();
require_once $path_to_phpFlickr_class . "phpFlickr.php";
unset($_SESSION['phpFlickr_auth_token']);
if (isset($_SESSION['phpFlickr_auth_redirect']) && !empty($_SESSION['phpFlickr_auth_redirect'])) {
    $redirect = $_SESSION['phpFlickr_auth_redirect'];
    unset($_SESSION['phpFlickr_auth_redirect']);
}
$f = new phpFlickr($api_key, $api_secret);
if (empty($_GET['frob'])) {
    $f->auth($permissions, false);
} else {
    $f->auth_getToken($_GET['frob']);
}
if (empty($redirect)) {
    header("Location: " . $default_redirect);
} else {
    header("Location: " . $redirect);
}
开发者ID:AndrewGerrie,项目名称:andrewgerrie-com,代码行数:30,代码来源:auth.php

示例3: phpFlickr

    if (!test_remote_download()) {
        $page['errors'][] = l10n('No download method available');
        $_GET['action'] = 'error';
    } else {
        // init flickr API
        include_once FLICKR_PATH . 'include/phpFlickr/phpFlickr.php';
        $flickr = new phpFlickr($conf['flickr2piwigo']['api_key'], $conf['flickr2piwigo']['secret_key']);
        $flickr->enableCache('fs', FLICKR_FS_CACHE);
        // must authenticate
        $u = $flickr->test_login();
        if (($u === false or empty($_SESSION['phpFlickr_auth_token'])) and @$_GET['action'] != 'login') {
            $_GET['action'] = 'init_login';
        }
        // generate token after authentication
        if (!empty($_GET['frob'])) {
            $flickr->auth_getToken($_GET['frob']);
            $_GET['action'] = 'logged';
        }
    }
}
if (!isset($_GET['action'])) {
    $_GET['action'] = 'main';
}
switch ($_GET['action']) {
    // button to login page
    case 'init_login':
        $template->assign('flickr_login', FLICKR_ADMIN . '-import&amp;action=login');
        break;
        // call flickr login procedure
    // call flickr login procedure
    case 'login':
开发者ID:biffhero,项目名称:Flickr2Piwigo,代码行数:31,代码来源:import.php

示例4: phpFlickr

<?php

/* Last updated with phpFlickr 1.4
 *
 * If you need your app to always login with the same user (to see your private
 * photos or photosets, for example), you can use this file to login and get a
 * token assigned so that you can hard code the token to be used.  To use this
 * use the phpFlickr::setToken() function whenever you create an instance of 
 * the class.
 */
require_once "phpFlickr.php";
$apiKey = "5f1ba3cb88d4ed7b109be31f9fb928a4";
$secret = "13ce4def3dfd80d5";
$perms = "delete";
$f = new phpFlickr($apiKey, $secret);
//Redirect to flickr for authorization
if (!$_GET['frob']) {
    $f->auth($perms);
} else {
    //If authorized, print the token
    $tokenArgs = $f->auth_getToken($_GET['frob']);
    echo "<pre>";
    var_dump($tokenArgs);
    echo "</pre>";
}
开发者ID:josue270193,项目名称:Catalogo,代码行数:25,代码来源:getToken.php

示例5: phpFlickr

$f = new phpFlickr($key, $secret);
$read_directory = "/tmp/Snapshots/";
$write_directory = "/tmp/Snapshots_Bak/";
$title = "FlickrSync";
$desc = "FlickrSync";
$tags = "flickrsync";
if (empty($frob)) {
    $frob = $f->auth_getFrob();
    $api_sig = md5($secret . "api_key" . $key . "frob" . $frob . "permswrite");
    $auth_url = "http://flickr.com/services/auth/?api_key={$key}&perms=write&frob={$frob}&api_sig={$api_sig}";
    echo "TWO STEPS YOU MUST NOW TAKE:\n\n";
    echo "1. SET THE frob VARIABLE TO: {$frob}\n\n";
    echo "2. VISIT {$auth_url} AND APPROVE THE APPLICATION!\n\n";
    echo "RERUN WHEN YOU HAVE SET FROB\n\n";
} elseif (empty($token)) {
    $token = $f->auth_getToken($frob);
    echo "PLEASE SET THE TOKEN VALUE TO THE TOKEN MENTIONED BELOW, SAVE, AND RERUN THE APPLICATION:";
    echo print_r($token) . "\n\n\n";
} else {
    $f->setToken($token);
    echo "ENTERING MASTER LOOP\n";
    while (1) {
        echo "I'm awake!!!\n";
        $filenames_to_upload = array();
        if ($handle = opendir($read_directory)) {
            while (($file = readdir($handle)) !== false) {
                echo "NEW FILE: {$file} \n\n";
                array_push($filenames_to_upload, $file);
            }
            closedir($handle);
        }
开发者ID:skeevis,项目名称:phpflickrsync,代码行数:31,代码来源:flickrsync.php


注:本文中的phpFlickr::auth_getToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。