/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
/OAuth2
/Service
/Vkontakte.php
const SCOPE_WALL = 'wall';
const SCOPE_GROUPS = 'groups';
const SCOPE_MESSAGES = 'messages';
const SCOPE_NOTIFICATIONS = 'notifications';
const SCOPE_STATS = 'stats';
const SCOPE_ADS = 'ads';
const SCOPE_OFFLINE = 'offline';
const SCOPE_NOHTTPS = 'nohttps';
public function __construct(
CredentialsInterface $credentials,
ClientInterface $httpClient,
TokenStorageInterface $storage,
$scopes = array(),
UriInterface $baseApiUri = null
) {
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
if (null === $baseApiUri) {
$this->baseApiUri = new Uri('https://api.vk.com/method/');
}
}
/**
* {@inheritdoc}
*/
public function getAuthorizationEndpoint()
{
return new Uri('https://oauth.vk.com/authorize');
}
/**
* {@inheritdoc}
*/
public function getAccessTokenEndpoint()
{
return new Uri('https://oauth.vk.com/access_token');
}
/**
/var
/www
/fastuser-phone
/data
/www
/phone-996.ru
/vendor
/lusitanian
/oauth
/src
/OAuth
/ServiceFactory.php
* @param string $serviceName The fully qualified service name
* @param CredentialsInterface $credentials
* @param TokenStorageInterface $storage
* @param array|null $scopes Array of scopes for the service
* @param UriInterface|null $baseApiUri
*
* @return ServiceInterface
*
* @throws Exception
*/
private function buildV2Service(
$serviceName,
CredentialsInterface $credentials,
TokenStorageInterface $storage,
array $scopes,
UriInterface $baseApiUri = null,
$apiVersion = ""
) {
return new $serviceName(
$credentials,
$this->httpClient,
$storage,
$this->resolveScopes($serviceName, $scopes),
$baseApiUri,
$apiVersion
);
}
/**
* Resolves scopes for v2 services
*
* @param string $serviceName The fully qualified service name
* @param array $scopes List of scopes for the service
*
* @return array List of resolved scopes
*/
private function resolveScopes($serviceName, array $scopes)
{
$reflClass = new \ReflectionClass($serviceName);
$constants = $reflClass->getConstants();
/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();