From 4cdc82e03ebaa759a92a3daec8f61bdfc729edf3 Mon Sep 17 00:00:00 2001 From: Kilderson Sena Date: Sat, 18 Sep 2021 23:31:06 -0300 Subject: [PATCH] final adjustments to first version --- config/dic.php | 4 ---- config/routes.php | 2 +- src/Controllers/AccessUrlController.php | 12 ++++++------ templates/index.html.twig | 2 +- templates/layouts/base.html.twig | 8 +++++++- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/config/dic.php b/config/dic.php index 21b8bc3..4427d54 100644 --- a/config/dic.php +++ b/config/dic.php @@ -5,10 +5,6 @@ $containerBuilder = new ContainerBuilder(); -if (APP_IS_PRODUCTION) { - $containerBuilder->enableCompilation(__DIR__ . '/../var/cache'); -} - $dependencies = require __DIR__ . '/dependencies.php'; $dependencies($containerBuilder); diff --git a/config/routes.php b/config/routes.php index 8aedd2c..f2cbd0a 100644 --- a/config/routes.php +++ b/config/routes.php @@ -16,7 +16,7 @@ $app->get('/{path}', AccessUrlController::class); - $app->group('/api/public_html', function (RouteCollectorProxy $group) { + $app->group('/api/public', function (RouteCollectorProxy $group) { $group->post('/shorten', ShortenUrlController::class); }); }; \ No newline at end of file diff --git a/src/Controllers/AccessUrlController.php b/src/Controllers/AccessUrlController.php index c65014e..fec7251 100644 --- a/src/Controllers/AccessUrlController.php +++ b/src/Controllers/AccessUrlController.php @@ -43,12 +43,12 @@ public function __invoke(Request $request, Response $response, array $args): Res 'url_id' => $row['id'], 'created_at' => (new DateTimeImmutable())->format('Y-m-d H:i:s'), 'meta' => json_encode([ - 'REMOTE_ADDR' => filter_input(INPUT_SERVER, 'REMOTE_ADDR'), - 'REMOTE_PORT' => filter_input(INPUT_SERVER, 'REMOTE_PORT'), - 'SERVER_NAME' => filter_input(INPUT_SERVER, 'SERVER_NAME'), - 'REQUEST_URI' => filter_input(INPUT_SERVER, 'REQUEST_URI'), - 'HTTP_HOST' => filter_input(INPUT_SERVER, 'HTTP_HOST'), - 'HTTP_USER_AGENT' => filter_input(INPUT_SERVER, 'HTTP_USER_AGENT'), + 'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'], + 'REMOTE_PORT' => $_SERVER['REMOTE_PORT'], + 'SERVER_NAME' => $_SERVER['SERVER_NAME'], + 'REQUEST_URI' => $_SERVER['REQUEST_URI'], + 'HTTP_HOST' => $_SERVER['HTTP_HOST'], + 'HTTP_USER_AGENT' => $_SERVER['HTTP_USER_AGENT'] ]), ]); diff --git a/templates/index.html.twig b/templates/index.html.twig index 4d16411..b660c9e 100644 --- a/templates/index.html.twig +++ b/templates/index.html.twig @@ -1,6 +1,6 @@ {% extends 'layouts/base.html.twig' %} -{% block title %}Encurte uma URL agora{% endblock %} +{% block title %}Url's um tanto pequenas e grátis{% endblock %} {% block content %}
diff --git a/templates/layouts/base.html.twig b/templates/layouts/base.html.twig index 3220d35..140f815 100644 --- a/templates/layouts/base.html.twig +++ b/templates/layouts/base.html.twig @@ -5,6 +5,12 @@ + + + + + + @@ -25,7 +31,7 @@ {% block headScripts %}{% endblock %} - {% block title %}{% endblock %} | Smallish + Smallish | {% block title %}{% endblock %} {% include 'layouts/_messages.html.twig' %}