diff options
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | app.php | 10 | ||||
| -rw-r--r-- | functions.php | 12 | ||||
| -rw-r--r-- | public/index.php | 10 | ||||
| -rw-r--r-- | public/resolve.php | 5 | ||||
| -rw-r--r-- | views/tools.html | 2 | ||||
| m--------- | views/tools/untrack | 0 |
7 files changed, 30 insertions, 12 deletions
diff --git a/.gitmodules b/.gitmodules index 137c576..07a2e27 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "views/tools/pizza"] path = views/tools/pizza url = git@git.iamfabulous.de:pizza +[submodule "views/tools/untrack"] + path = views/tools/untrack + url = git@git.iamfabulous.de:untrack @@ -1,6 +1,7 @@ <?php require __DIR__ . '/vendor/autoload.php'; +require __DIR__ . '/functions.php'; $loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/views'); $twig = new \Twig\Environment($loader); # no cache @@ -26,12 +27,3 @@ $function = new \Twig\TwigFunction('dump', function($data) { var_dump($data); }); $twig->addFunction($function); - -function get_faces(){ - return json_decode( file_get_contents( __DIR__ . '/views/tools/faces/faces.json' ), true ); -} - -function str_starts_with( $haystack, $needle ) { - $length = strlen( $needle ); - return substr( $haystack, 0, $length ) === $needle; -} diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..a0ec825 --- /dev/null +++ b/functions.php @@ -0,0 +1,12 @@ +<?php + +require __DIR__ . '/views/tools/untrack/resolve.php'; + +function get_faces(){ + return json_decode( file_get_contents( __DIR__ . '/views/tools/faces/faces.json' ), true ); +} + +function str_starts_with( $haystack, $needle ) { + $length = strlen( $needle ); + return substr( $haystack, 0, $length ) === $needle; +} diff --git a/public/index.php b/public/index.php index c5c0c0b..fe70370 100644 --- a/public/index.php +++ b/public/index.php @@ -4,8 +4,6 @@ require_once __DIR__ . '/../app.php'; $url = strtok($_SERVER["REQUEST_URI"], '?'); -#var_dump([ "faces" => get_faces() ]); - switch( $url ) { case("/"): @@ -28,6 +26,14 @@ case("/tools/pizza"): case("/tools/pizza/"): echo $twig->render('tools/pizza/index.html'); break; +case("/tools/untrack"): +case("/tools/untrack/"): + $_url = ""; + if ( isset($_REQUEST['url']) ) { + $_url = htmlspecialchars($_REQUEST['url']); + } + echo $twig->render('tools/untrack/index.html', [ "url" => $_url ]); + break; default: http_response_code(404); echo $twig->render('404.html'); diff --git a/public/resolve.php b/public/resolve.php new file mode 100644 index 0000000..9d2cdb2 --- /dev/null +++ b/public/resolve.php @@ -0,0 +1,5 @@ +<?php + +require_once __DIR__ . '/../functions.php'; + +echo resolve(); diff --git a/views/tools.html b/views/tools.html index 9b3ba81..286c2b0 100644 --- a/views/tools.html +++ b/views/tools.html @@ -19,7 +19,7 @@ <a href="/tools/faces" title="Best faces on the net">Best faces on the net</a> </li> <li> - <a href="https://untrack.iamfabulous.de" title="Entfernt Tracking Parameter aus der URL" rel="nofollow">untrack - Entfernt Tracking Parameter aus der URL</a> + <a href="/tools/untrack" title="Entfernt Tracking Parameter aus der URL">untrack - Entfernt Tracking Parameter aus der URL</a> </li> <li> <a href="/tools/pizza" title="Pizzarechner">Pizzarechner</a> diff --git a/views/tools/untrack b/views/tools/untrack new file mode 160000 +Subproject fb6c093495e346b9985c75f32878e12e54d946b |
