/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/lusitanian
/oauth
/src
/OAuth
/Common
/Http
/Uri
/Uri.php
<?php
namespace OAuth\Common\Http\Uri;
use InvalidArgumentException;
/**
* Standards-compliant URI class.
*/
class Uri implements UriInterface
{
/**
* @var string
*/
private $scheme = 'http';
/**
* @var string
*/
private $userInfo = '';
/**
* @var string
*/
private $rawUserInfo = '';
/**
* @var string
*/
private $host;
/**
* @var int
*/
private $port = 80;
/**
* @var string
*/
private $path = '/';
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/composer
/ClassLoader.php
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/composer
/ClassLoader.php
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/lusitanian
/oauth
/src
/OAuth
/OAuth1
/Service
/Twitter.php
use OAuth\Common\Exception\Exception;
class Twitter extends AbstractService
{
const ENDPOINT_AUTHENTICATE = "https://api.twitter.com/oauth/authenticate";
const ENDPOINT_AUTHORIZE = "https://api.twitter.com/oauth/authorize";
protected $authorizationEndpoint = self::ENDPOINT_AUTHENTICATE;
public function __construct(
CredentialsInterface $credentials,
ClientInterface $httpClient,
TokenStorageInterface $storage,
SignatureInterface $signature,
UriInterface $baseApiUri = null
) {
parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://api.twitter.com/1.1/');
}
}
/**
* {@inheritdoc}
*/
public function getRequestTokenEndpoint()
{
return new Uri('https://api.twitter.com/oauth/request_token');
}
/**
* {@inheritdoc}
*/
public function getAuthorizationEndpoint()
{
if ($this->authorizationEndpoint != self::ENDPOINT_AUTHENTICATE
&& $this->authorizationEndpoint != self::ENDPOINT_AUTHORIZE) {
$this->authorizationEndpoint = self::ENDPOINT_AUTHENTICATE;
}
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/lusitanian
/oauth
/src
/OAuth
/ServiceFactory.php
* @param UriInterface $baseApiUri
*
* @return ServiceInterface
*
* @throws Exception
*/
private function buildV1Service(
$serviceName,
CredentialsInterface $credentials,
TokenStorageInterface $storage,
$scopes,
UriInterface $baseApiUri = null
) {
if (!empty($scopes)) {
throw new Exception(
'Scopes passed to ServiceFactory::createService but an OAuth1 service was requested.'
);
}
return new $serviceName($credentials, $this->httpClient, $storage, new Signature($credentials), $baseApiUri);
}
}
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/lusitanian
/oauth
/src
/OAuth
/ServiceFactory.php
*/
public function createService(
$serviceName,
CredentialsInterface $credentials,
TokenStorageInterface $storage,
$scopes = array(),
UriInterface $baseApiUri = null,
$apiVersion = ""
) {
if (!$this->httpClient) {
// for backwards compatibility.
$this->httpClient = new StreamClient();
}
foreach ($this->serviceBuilders as $version => $buildMethod) {
$fullyQualifiedServiceName = $this->getFullyQualifiedServiceName($serviceName, $version);
if (class_exists($fullyQualifiedServiceName)) {
return $this->$buildMethod(
$fullyQualifiedServiceName,
$credentials,
$storage,
$scopes,
$baseApiUri,
$apiVersion
);
}
}
return null;
}
/**
* Gets the fully qualified name of the service
*
* @param string $serviceName The name of the service of which to get the fully qualified name
* @param string $type The type of the service to get (either OAuth1 or OAuth2)
*
* @return string The fully qualified name of the service
*/
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/oauth.php
}
Session::delete('oauth_user');
$credentials = new OAuth\Common\Consumer\Credentials(
Config::get("services.{$provider}.id"),
Config::get("services.{$provider}.secret"),
App::url("oauth.php?provider={$provider}")
);
$scope = isset($scopes[$provider]) ? $scopes[$provider] : array();
$storage = new OAuth\Common\Storage\Session;
$factory = new OAuth\ServiceFactory;
// Use cURL
// $factory->setHttpClient(new OAuth\Common\Http\Client\CurlClient);
$service = $factory->createService($provider, $credentials, $storage, $scope);
if ($provider === 'twitter') {
if (empty($_GET['oauth_token'])) {
$oauth_token = $service->requestRequestToken()->getRequestToken();
$authUrl = $service->getAuthorizationUri(compact('oauth_token'));
} else {
try {
$token = $storage->retrieveAccessToken(ucfirst($provider));
$service->requestAccessToken(
@$_GET['oauth_token'],
@$_GET['oauth_verifier'],
$token->getRequestTokenSecret()
);
} catch(Exception $e) {
exit('Oauth Retrieve Access Token Error.');
}
}
} else {
if (empty($_GET['code'])) {
$authUrl = $service->getAuthorizationUri();