From d1d7fa394af30c62a853c375ba4614ba9afe4a24 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 18 May 2019 21:23:12 +0200 Subject: [PATCH 1/2] Move mod/view to src/Module/View --- mod/view.php | 27 --------------------------- src/App/Router.php | 1 + src/Module/Theme.php | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 27 deletions(-) delete mode 100644 mod/view.php create mode 100644 src/Module/Theme.php diff --git a/mod/view.php b/mod/view.php deleted file mode 100644 index 6f23d84dc4..0000000000 --- a/mod/view.php +++ /dev/null @@ -1,27 +0,0 @@ -argc == 4) { - $theme = $a->argv[2]; - $theme = Strings::sanitizeFilePathItem($theme); - - // set the path for later use in the theme styles - $THEMEPATH = "view/theme/$theme"; - if (file_exists("view/theme/$theme/style.php")) { - require_once("view/theme/$theme/style.php"); - } - } - - exit(); -} diff --git a/src/App/Router.php b/src/App/Router.php index cd59c3dd90..7e4c35ff01 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -202,6 +202,7 @@ class Router $this->routeCollector->addRoute(['GET'], '/smilies[/json]', Module\Smilies::class); $this->routeCollector->addRoute(['GET'], '/statistics.json', Module\Statistics::class); $this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class); + $this->routeCollector->addRoute(['GET'], '/view/theme/{theme:.+}', Module\Theme::class); $this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\ItemBody::class); $this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class); $this->routeCollector->addRoute(['GET'], '/xrd', Module\Xrd::class); diff --git a/src/Module/Theme.php b/src/Module/Theme.php new file mode 100644 index 0000000000..0540267af7 --- /dev/null +++ b/src/Module/Theme.php @@ -0,0 +1,32 @@ +argc == 4) { + $theme = $a->argv[2]; + $theme = Strings::sanitizeFilePathItem($theme); + + // set the path for later use in the theme styles + $THEMEPATH = "view/theme/$theme"; + if (file_exists("view/theme/$theme/style.php")) { + require_once("view/theme/$theme/style.php"); + } + } + + exit(); + } +} From 725984eb08cb5b57dd0fc436b845a3e81c93d46e Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 19 May 2019 03:05:21 +0200 Subject: [PATCH 2/2] change route --- src/App/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App/Router.php b/src/App/Router.php index 7e4c35ff01..8d61645394 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -202,7 +202,7 @@ class Router $this->routeCollector->addRoute(['GET'], '/smilies[/json]', Module\Smilies::class); $this->routeCollector->addRoute(['GET'], '/statistics.json', Module\Statistics::class); $this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class); - $this->routeCollector->addRoute(['GET'], '/view/theme/{theme:.+}', Module\Theme::class); + $this->routeCollector->addRoute(['GET'], '/view/theme/{theme}/style.pcss', Module\Theme::class); $this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\ItemBody::class); $this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class); $this->routeCollector->addRoute(['GET'], '/xrd', Module\Xrd::class);