Esempio n. 1
0
 /**
  * @param array $params         
  * @throws Exception
  */
 public function authenticate(array $params)
 {
     if (!isset($params['code']) || empty($params['code'])) {
         throw new Exception('Authentication failed, invalid or empty code.');
     }
     $oAuthConf = Config::$a['oauth']['providers'][$this->authProvider];
     $client = new \OAuth2\Client($oAuthConf['clientId'], $oAuthConf['clientSecret'], \OAuth2\Client::AUTH_TYPE_AUTHORIZATION_BASIC);
     $client->setAccessTokenType(\OAuth2\Client::ACCESS_TOKEN_BEARER);
     $response = $client->getAccessToken('https://ssl.reddit.com/api/v1/access_token', 'authorization_code', array('redirect_uri' => sprintf(Config::$a['oauth']['callback'], $this->authProvider), 'code' => $params['code']));
     if (empty($response) || isset($response['error'])) {
         throw new Exception('Invalid access_token response');
     }
     if (!isset($response['result']) || empty($response['result']) || !isset($response['result']['access_token'])) {
         throw new Exception('Failed request for access token');
     }
     $client->setAccessToken($response['result']['access_token']);
     // Reddit requires a User-Agent
     $info = $client->fetch("https://oauth.reddit.com/api/v1/me.json", array(), 'GET', array('User-Agent' => 'destiny.gg/' . Config::version()));
     if (empty($info['result']) || !is_array($info['result']) || isset($info['error'])) {
         throw new Exception('Invalid user details response');
     }
     $authCreds = $this->getAuthCredentials($params['code'], $info['result']);
     $authCredHandler = new AuthenticationRedirectionFilter();
     return $authCredHandler->execute($authCreds);
 }
Esempio n. 2
0
<?php

use Destiny\Common\Config;
?>
<meta name="google-play-app" content="app-id=gg.destiny.app.chat">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="<?php 
echo Config::cdn();
?>
/favicon.png">
<link href="<?php 
echo Config::cdn();
?>
/vendor/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="<?php 
echo Config::cdn();
?>
/vendor/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet" media="screen">
<link href="<?php 
echo Config::cdnv();
?>
/web/css/style.min.css" rel="stylesheet" media="screen">
Esempio n. 3
0
<?php

use Destiny\Common\Utils\Http;
use Destiny\Common\Config;
$arr = array("og:site_name" => Config::$a['meta']['shortName'], "og:title" => Config::$a['meta']['title'], "og:description" => Config::$a['meta']['description'], "og:image" => Config::cdn() . '/web/img/destinygg.png', "og:url" => Http::getBaseUrl(), "og:type" => "video.other", "og:video" => Config::$a['meta']['video'], "og:video:secure_url" => Config::$a['meta']['videoSecureUrl'], "og:video:type" => "application/x-shockwave-flash", "og:video:height" => "260", "og:video:width" => "340");
foreach ($arr as $k => $v) {
    echo '<meta property="' . $k . '" content="' . $v . '" />' . PHP_EOL;
}
Esempio n. 4
0
?>
<!DOCTYPE html>
<html>
<head>
<title>Error : Forbidden</title>
<meta charset="utf-8">
<link href="<?php 
echo Config::cdn();
?>
/vendor/bootstrap-3.1.1/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="<?php 
echo Config::cdn();
?>
/errors/css/style.min.css" rel="stylesheet" media="screen">
<link rel="shortcut icon" href="<?php 
echo Config::cdn();
?>
/favicon.png">
<?php 
include Tpl::file('seg/google.tracker.php');
?>
</head>
<body class="error forbidden">

	<?php 
include 'top.php';
?>

	<section id="header-band">
		<div class="container">
			<header class="hero-unit" id="overview">
Esempio n. 5
0
        <thead>
          <tr>
            <td>Provider</td>
            <td style="width:100%;">Detail</td>
            <td>Created</td>
            <td>Modified</td>
          </tr>
        </thead>
        <tbody>
        <?php foreach($model->authSessions as $auth): ?>
          <tr>
            <td><?= $auth['authProvider'] ?></td>
            <td><?= (!empty($auth['authDetail'])) ? Tpl::out($auth['authDetail']):Tpl::out($auth['authId']) ?></td>
            <td><?=Tpl::moment(Date::getDateTime($auth['createdDate']), Date::STRING_FORMAT_YEAR)?></td>
            <td><?=Tpl::moment(Date::getDateTime($auth['modifiedDate']), Date::STRING_FORMAT_YEAR)?></td>
          </tr>
        <?php endforeach; ?>
        </tbody>
      </table>
    </div>
  </section>
  <?php endif; ?>
  
  <br />
  
  <?php include Tpl::file('seg/commonbottom.php') ?>
  
  <script src="<?=Config::cdnv()?>/web/js/admin.js"></script>
  
</body>
</html>
Esempio n. 6
0
namespace Destiny;

use Destiny\Common\Utils\Tpl;
use Destiny\Common\Config;
?>
<!DOCTYPE html>
<html>
<head>
<title><?php 
echo Tpl::title($model->title);
?>
</title>
<meta charset="utf-8">
<script src="<?php 
echo Config::cdnvf('1.2.0');
?>
/vendor/libs.min.js"></script>
<?php 
include Tpl::file('seg/google.tracker.php');
?>
<script>

// Make sure the user is redirected (for those who block ga.js)
var to = window.setTimeout(function(){
    window.location.replace(url);
}, 3500);

// Normal analytics
var url = '<?php 
echo $model->url;
Esempio n. 7
0
use Doctrine\DBAL\DriverManager;
use Doctrine\Common\Cache\RedisCache;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Destiny\Common\Application;
use Destiny\Common\Routing\Router;
use Destiny\Common\ControllerAnnotationLoader;
use Destiny\Common\DirectoryClassIterator;
use Doctrine\Common\Annotations\AnnotationReader;
// This should be in the server config
ini_set('date.timezone', 'UTC');
// Used when the full path is needed to the base directory
define('_BASEDIR', realpath(__DIR__ . '/../'));
define('PP_CONFIG_PATH', _BASEDIR . '/config/');
$loader = (require _BASEDIR . '/vendor/autoload.php');
Config::load(array_replace_recursive(require _BASEDIR . '/config/config.php', require _BASEDIR . '/config/config.local.php', json_decode(file_get_contents(_BASEDIR . '/composer.json'), true)));
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
$app = Application::instance();
$app->setLoader($loader);
$log = new Logger('web');
$log->pushHandler(new StreamHandler(Config::$a['log']['path'] . 'web.log', Logger::CRITICAL));
$log->pushProcessor(new Monolog\Processor\WebProcessor());
$app->setLogger($log);
$app->setConnection(DriverManager::getConnection(Config::$a['db']));
$redis = new Redis();
$redis->connect(Config::$a['redis']['host'], Config::$a['redis']['port']);
$redis->select(Config::$a['redis']['database']);
$app->setRedis($redis);
$cache = new RedisCache();
$cache->setRedis($app->getRedis());
$cache->setNamespace(Config::$a['cache']['namespace']);
Esempio n. 8
0
namespace Destiny;

use Destiny\Common\Utils\Tpl;
use Destiny\Common\Config;
?>
<!DOCTYPE html>
<html>
<head>
<title><?php 
echo Tpl::title($model->title);
?>
</title>
<meta charset="utf-8">
<script src="<?php 
echo Config::cdnvf('1.1.0');
?>
/vendor/libs.min.js"></script>
<?php 
include Tpl::file('seg/google.tracker.php');
?>
<script>

// Make sure the user is redirected (for those who block ga.js)
var to = window.setTimeout(function(){
    window.location.replace(url);
}, 3500);

// Normal analytics
var url = '<?php 
echo $model->url;