diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-05-27 06:11:25 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2024-05-27 06:11:25 +0000 |
| commit | 4f847abc09405f0cf848f7b4b5a5a283acc6131d (patch) | |
| tree | 94912425ef703757cf63fd19f8463a73e594cf9c /public | |
| parent | 05fefe4a2d9582e48131c82cee4d25cef2db40f5 (diff) | |
integrate trails, fixes #4102
Closes #4102
Merge request studip/studip!3034
Diffstat (limited to 'public')
| -rw-r--r-- | public/assets.php | 2 | ||||
| -rw-r--r-- | public/dispatch.php | 2 | ||||
| -rw-r--r-- | public/install.php | 15 | ||||
| -rw-r--r-- | public/sendfile.php | 6 | ||||
| -rw-r--r-- | public/web_migrate.php | 2 |
5 files changed, 19 insertions, 8 deletions
diff --git a/public/assets.php b/public/assets.php index a0baa6d..3610a13 100644 --- a/public/assets.php +++ b/public/assets.php @@ -19,7 +19,7 @@ $uri = ltrim(Request::pathInfo(), '/'); list($type, $id) = explode('/', $uri, 2); // Setup response -$response = new Trails_Response(); +$response = new Trails\Response(); // Create response if (!$type || !$id) { diff --git a/public/dispatch.php b/public/dispatch.php index 68d0399..77c5933 100644 --- a/public/dispatch.php +++ b/public/dispatch.php @@ -21,5 +21,5 @@ require '../lib/bootstrap.php'; // prepare environment URLHelper::setBaseUrl($GLOBALS['ABSOLUTE_URI_STUDIP']); -$dispatcher = app(\Trails_Dispatcher::class); +$dispatcher = app(\Trails\Dispatcher::class); $dispatcher->dispatch(Request::pathInfo()); diff --git a/public/install.php b/public/install.php index 4e54575..e32cf75 100644 --- a/public/install.php +++ b/public/install.php @@ -17,7 +17,6 @@ set_include_path($GLOBALS['STUDIP_BASE_PATH']); require_once 'composer/autoload.php'; require_once 'lib/visual.inc.php'; -require_once 'vendor/trails/trails.php'; require_once 'lib/classes/URLHelper.php'; require_once 'lib/classes/LayoutMessage.interface.php'; require_once 'lib/classes/MessageBox.class.php'; @@ -33,6 +32,18 @@ require_once 'lib/flexi/Factory.php'; require_once 'lib/flexi/PhpTemplate.php'; require_once 'lib/flexi/Template.php'; require_once 'lib/flexi/TemplateNotFoundException.php'; +require_once 'lib/trails/Controller.php'; +require_once 'lib/trails/Dispatcher.php'; +require_once 'lib/trails/Exception.php'; +require_once 'lib/trails/Flash.php'; +require_once 'lib/trails/Inflector.php'; +require_once 'lib/trails/Response.php'; +require_once 'lib/trails/Exceptions/DoubleRenderError.php'; +require_once 'lib/trails/Exceptions/MissingFile.php'; +require_once 'lib/trails/Exceptions/RoutingError.php'; +require_once 'lib/trails/Exceptions/SessionRequiredException.php'; +require_once 'lib/trails/Exceptions/UnknownAction.php'; +require_once 'lib/trails/Exceptions/UnknownController.php'; require_once 'vendor/phpass/PasswordHash.php'; // Mock gettext functions if extension is not available @@ -61,5 +72,5 @@ $GLOBALS['template_factory'] = new Flexi\Factory('../templates/'); # get plugin class from request $dispatch_to = ltrim(Request::pathInfo(), '/'); -$dispatcher = new Trails_Dispatcher( '../app', $_SERVER['SCRIPT_NAME'], 'admin/install'); +$dispatcher = new Trails\Dispatcher( '../app', $_SERVER['SCRIPT_NAME'], 'admin/install'); $dispatcher->dispatch("admin/install/{$dispatch_to}"); diff --git a/public/sendfile.php b/public/sendfile.php index 7d6517c..03157b8 100644 --- a/public/sendfile.php +++ b/public/sendfile.php @@ -156,7 +156,7 @@ if ( ) { $link_data = FileManager::fetchURLMetadata($file_ref->file->metadata['url']); if ($link_data['response_code'] != 200) { - throw new Trails_Exception(404, _("Diese Datei wird von einem externen Server geladen und ist dort momentan nicht erreichbar!")); + throw new Trails\Exception(404, _("Diese Datei wird von einem externen Server geladen und ist dort momentan nicht erreichbar!")); } $content_type = $link_data['Content-Type'] ? strstr($link_data['Content-Type'], ';', true) : get_mime_type($file_name); @@ -166,7 +166,7 @@ if ( if (isset($file)) { $filesize = $file->getSize(); if ($filesize === false) { - throw new Trails_Exception(404, _('Fehler beim Laden der Inhalte der Datei')); + throw new Trails\Exception(404, _('Fehler beim Laden der Inhalte der Datei')); } } @@ -186,7 +186,7 @@ if (isset($file_ref, $file_ref->file, $file_ref->file->metadata['access_type']) // Check if file actually exists if (!parse_url($path_file, PHP_URL_SCHEME) && !file_exists($path_file)) { - throw new Trails_Exception(404, _('Fehler beim Laden der Inhalte der Datei')); + throw new Trails\Exception(404, _('Fehler beim Laden der Inhalte der Datei')); } $allowed_mime_types = get_mime_types(); diff --git a/public/web_migrate.php b/public/web_migrate.php index c01c600..0ee4de5 100644 --- a/public/web_migrate.php +++ b/public/web_migrate.php @@ -36,6 +36,6 @@ $GLOBALS['template_factory'] = new Flexi\Factory('../templates/'); # get plugin class from request $dispatch_to = Request::pathInfo() ?: ''; -$dispatcher = app(\Trails_Dispatcher::class); +$dispatcher = app(\Trails\Dispatcher::class); $dispatcher->trails_uri = $_SERVER['SCRIPT_NAME']; $dispatcher->dispatch("web_migrate/{$dispatch_to}"); |
