Esempio n. 1
0
 public static function render($path, $data)
 {
     self::$data = $data;
     if (!is_file($path)) {
         App::Abort();
     }
     include $path;
 }
Esempio n. 2
0
 public static function Run()
 {
     $found = false;
     $appRoutes = Route::$routes;
     # Sort the routes, so we make sure routes containing word boundaries matches before wildcards
     arsort($appRoutes);
     foreach ($appRoutes as $route) {
         if (preg_match($route['route'], $_SERVER['REQUEST_URI'], $matches)) {
             if ($_SERVER['REQUEST_METHOD'] != $route['request']) {
                 continue;
             }
             $found = true;
             self::$currentSlug = $route['slug'];
             Route::Dispatch($route['controller'], $route['method']);
             break;
         }
     }
     # If no route found in collection - Abort app and send user to 404 page
     if ($found === false) {
         App::Abort();
     }
 }
Esempio n. 3
0
<?php

Lang::addNamespace('stream', public_path('plugins/streaming/plugin/lang'));
//register plugin routes
require public_path() . '/plugins/streaming/plugin/routes.php';
//register a filter for links
Route::filter('links', function ($route, $request, $value) {
    if (!is_string($value)) {
        App::Abort(403);
    }
    if (!Helpers::hasAccess("links.{$value}")) {
        return Redirect::to('/');
    }
});
//make sure laravel can find and load plugin views
View::addLocation(public_path('plugins/streaming/plugin/views'));
//override mtdb controllers
App::bind('DashboardController', function () {
    return new StreamingDashboardController();
});
App::bind('SeriesSeasonsController', function () {
    return new StreamingSeriesSeasonsController();
});
App::bind('SeasonsEpisodesController', function () {
    return new StreamingSeasonsEpisodesController();
});
//override other classes
App::bind('Lib\\Repository', function () {
    return new Plugins\Streaming\Plugin\Lib\Repository();
});
App::bind('Lib\\Titles\\TitleRepository', function () {
 /**
  * Shows the result of an export as JSON.
  * @param  id $export_id Identifier of the export to be run.
  * @return json
  */
 public function show($export_id)
 {
     $export = $this->get($export_id);
     // Get and check report.
     $report = $this->report->find($export->report);
     if (!$report) {
         \App::abort(404, trans('exporting.errors.reportExistence'));
     }
     // Select statements.
     $statements = $this->query->selectStatementDocs($this->lrs->_id, $this->decodeURL($report->query));
     // Get and check fields.
     if (is_null($export['fields'])) {
         \App::Abort(400, trans('exporting.errors.noFields'));
     }
     // Filter and map results.
     $filtered_results = $this->exporter->filter($statements, $export['fields']);
     $mapped_results = $this->exporter->mapFields($filtered_results, $export['fields']);
     // Return mapped results and json.
     return $mapped_results;
 }