Example #1
0
 public function expired($e)
 {
     $token = \JWTAuth::parseToken();
     Config::package('tymon/jwt-auth', 'jwt');
     $ttl = Config::get('jwt::refresh_ttl');
     $iat = Carbon::createFromTimestamp($token->getPayload()->get('iat'));
     $now = Carbon::now();
     // if renew ttl is expired too, return 401, otherwise let
     // the application generate a new token to frontend
     if ($iat->diffInMinutes($now) >= $ttl) {
         unset($iat, $now, $ttl);
         return response_failure(Lang::get('errors.api.auth.expired'), Config::get('status.error.unauthorized'));
     }
     unset($iat, $now, $ttl);
 }
Example #2
0
if (Config::process_xincludes()) {
    $readerOpts |= LIBXML_XINCLUDE;
}
// Indexing
if (Index::requireIndexing()) {
    v("Indexing...", VERBOSE_INDEXING);
    // Create indexer
    $format = $render->attach(new Index());
    $reader->open(Config::xml_file(), NULL, $readerOpts);
    $render->execute($reader);
    $render->detach($format);
    v("Indexing done", VERBOSE_INDEXING);
} else {
    v("Skipping indexing", VERBOSE_INDEXING);
}
foreach ((array) Config::package() as $package) {
    $factory = Format_Factory::createFactory($package);
    // Default to all output formats specified by the package
    if (count(Config::output_format()) == 0) {
        Config::set_output_format((array) $factory->getOutputFormats());
    }
    // Register the formats
    foreach (Config::output_format() as $format) {
        $render->attach($factory->createFormat($format));
    }
}
// Render formats
$reader = make_reader();
$reader->open(Config::xml_file(), NULL, $readerOpts);
foreach ($render as $format) {
    $format->notify(Render::VERBOSE, true);
Example #3
0
 /**
  * Register package autoloaders. Has to come BEFORE session calls.
  */
 public function setupPackageAutoloaders()
 {
     $pla = \Concrete\Core\Package\PackageList::get();
     $pl = $pla->getPackages();
     $cl = ClassLoader::getInstance();
     /** @var \Package[] $pl */
     foreach ($pl as $p) {
         \Config::package($p);
         if ($p->isPackageInstalled()) {
             $pkg = $this->make('Concrete\\Core\\Package\\PackageService')->getClass($p->getPackageHandle());
             if (is_object($pkg) && !$pkg instanceof \Concrete\Core\Package\BrokenPackage) {
                 $cl->registerPackage($pkg);
                 $this->packages[] = $pkg;
             }
         }
     }
 }
Example #4
0
 /**
  * Called to enable package specific configuration
  */
 public function registerConfigNamespace()
 {
     \Config::package($this->getPackageHandle(), $this->getPackagePath() . '/config');
 }