diff --git a/config/config.default.php b/config/config.default.php index ea94cce8..980c9e1d 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -80,9 +80,6 @@ return [ '1' => 'Engelsystem dark', ], - // Rewrite URLs with mod_rewrite - 'rewrite_urls' => true, - // Redirect to this site after logging in or when pressing the top-left button // Must be one of news, meetings, user_shifts, angeltypes, user_questions 'home_site' => 'news', diff --git a/src/Http/LegacyUrlGenerator.php b/src/Http/LegacyUrlGenerator.php deleted file mode 100644 index b9f8b7f1..00000000 --- a/src/Http/LegacyUrlGenerator.php +++ /dev/null @@ -1,31 +0,0 @@ -/index.php?p=& - */ -class LegacyUrlGenerator extends UrlGenerator -{ - /** - * @param string $path - * @param array $parameters - * @return string urls in the form /index.php?p=& - */ - public function to($path, $parameters = []) - { - $page = ltrim($path, '/'); - if (!empty($page)) { - $page = str_replace('-', '_', $page); - $parameters = array_merge(['p' => $page], $parameters); - } - - $uri = parent::to('index.php', $parameters); - $uri = preg_replace('~(/index\.php)+~', '/index.php', $uri); - $uri = preg_replace('~(/index\.php)$~', '/', $uri); - - return $uri; - } -} diff --git a/src/helpers.php b/src/helpers.php index 7cb17ea9..0b354551 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -110,6 +110,7 @@ function redirect(string $path, $status = 302, $headers = []): Response */ function request($key = null, $default = null) { + /** @var Request $request */ $request = app('request'); if (is_null($key)) { @@ -215,6 +216,7 @@ function _e($key, $keyPlural, $number, $replace = []): string */ function url($path = null, $parameters = []) { + /** @var UrlGeneratorInterface $urlGenerator */ $urlGenerator = app('http.urlGenerator'); if (is_null($path)) { @@ -231,6 +233,7 @@ function url($path = null, $parameters = []) */ function view($template = null, $data = []) { + /** @var Renderer $renderer */ $renderer = app('renderer'); if (is_null($template)) { diff --git a/tests/Unit/Http/LegacyUrlGeneratorTest.php b/tests/Unit/Http/LegacyUrlGeneratorTest.php deleted file mode 100644 index 8caf3c77..00000000 --- a/tests/Unit/Http/LegacyUrlGeneratorTest.php +++ /dev/null @@ -1,54 +0,0 @@ - 'abc'], 'http://foo.bar/index.php?p=foo&test=abc'], - ]; - } - - /** - * @dataProvider provideLinksTo - * @covers \Engelsystem\Http\LegacyUrlGenerator::to - * - * @param string $urlToPath - * @param string $willReturn - * @param string[] $arguments - * @param string $expectedUrl - */ - public function testTo($urlToPath, $willReturn, $arguments, $expectedUrl) - { - $app = new Container(); - Application::setInstance($app); - - $request = $this->getMockBuilder(Request::class) - ->getMock(); - - $request->expects($this->once()) - ->method('getUriForPath') - ->with('/index.php') - ->willReturn($willReturn); - - $app->instance('request', $request); - - $urlGenerator = new LegacyUrlGenerator(); - $this->assertInstanceOf(UrlGeneratorInterface::class, $urlGenerator); - - $url = $urlGenerator->to($urlToPath, $arguments); - $this->assertEquals($expectedUrl, $url); - } -}