if (empty($downloads[$request])) { return Xysti::error(404, 'Download ' . $request . ' is not in config'); } $download = $downloads[$request]; // Run authentication etc on the download $before = Xysti::before($download); if (!is_null($before)) { return $before; } $path = Config::get('xysti.resources.downloads') . $download['uri']; if (!file_exists($path)) { return Xysti::error(404, 'Download ' . $request . ' could not be found at ' . $path); } return Response::make(File::get($path), 200, array('Content-Type' => File::mime(File::extension($path)))); }); } } // Catch all routes // ------------------------------------------------ /** * Handle remaining GET requests */ Route::get('(.*)', function () { return Xysti::make(); }); /** * Handle remaining POST requests */ Route::post('(.*)', function () { return Xysti::error(500, 'No post route.'); });
/** * Check whether the user is logged in * @return bool */ public static function user_check() { $auth_driver = Config::get('xysti.auth', 'default'); // Default auth if ($auth_driver == 'default') { return Auth::check(); // Sentry auth } elseif ($auth_driver == 'sentry') { return Sentry::check(); } else { return Xysti::error(500, 'Unknown authentication driver.'); } }