This commit is contained in:
parent
5758aee730
commit
78bfef9a1c
|
@ -2,6 +2,7 @@
|
||||||
"require": {
|
"require": {
|
||||||
"twig/twig": "^3.0",
|
"twig/twig": "^3.0",
|
||||||
"anlutro/curl": "^1.5",
|
"anlutro/curl": "^1.5",
|
||||||
"vlucas/phpdotenv": "^5.5"
|
"vlucas/phpdotenv": "^5.5",
|
||||||
|
"bramus/router": "1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
53
composer.lock
generated
53
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "3f1571128a1e9ef26dd6298b243bdd9d",
|
"content-hash": "37fb0f4a910e4ba4add92cd9abbdf84a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "anlutro/curl",
|
"name": "anlutro/curl",
|
||||||
|
@ -50,6 +50,57 @@
|
||||||
},
|
},
|
||||||
"time": "2023-06-27T07:39:41+00:00"
|
"time": "2023-06-27T07:39:41+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "bramus/router",
|
||||||
|
"version": "1.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/bramus/router.git",
|
||||||
|
"reference": "d2cf97d5c471e272ac5a2a88b652bc75089c8ae3"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/bramus/router/zipball/d2cf97d5c471e272ac5a2a88b652bc75089c8ae3",
|
||||||
|
"reference": "d2cf97d5c471e272ac5a2a88b652bc75089c8ae3",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "~2.14",
|
||||||
|
"phpunit/php-code-coverage": "~2.0",
|
||||||
|
"phpunit/phpunit": "~4.8"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Bramus": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Bram(us) Van Damme",
|
||||||
|
"email": "bramus@bram.us",
|
||||||
|
"homepage": "http://www.bram.us"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A lightweight and simple object oriented PHP Router",
|
||||||
|
"homepage": "https://github.com/bramus/router",
|
||||||
|
"keywords": [
|
||||||
|
"router",
|
||||||
|
"routing"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/bramus/router/issues",
|
||||||
|
"source": "https://github.com/bramus/router/tree/1.6"
|
||||||
|
},
|
||||||
|
"time": "2021-07-23T09:48:14+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "graham-campbell/result-type",
|
"name": "graham-campbell/result-type",
|
||||||
"version": "v1.1.1",
|
"version": "v1.1.1",
|
||||||
|
|
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 101 KiB |
29
index.php
29
index.php
|
@ -3,20 +3,31 @@
|
||||||
|
|
||||||
require_once '_config.php';
|
require_once '_config.php';
|
||||||
|
|
||||||
|
use Bramus\Router\Router;
|
||||||
|
|
||||||
|
$router = new Router();
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
if(isset($_SESSION['user']))
|
if(isset($_SESSION['user']))
|
||||||
$twig->addGlobal('user', $_SESSION['user']);
|
$twig->addGlobal('user', $_SESSION['user']);
|
||||||
|
|
||||||
switch ($_SERVER['REQUEST_URI']) {
|
$router->get('/u/([a-z0-9_\.]+)', function($name) {
|
||||||
case "/":
|
echo 'Hello ' . htmlentities($name);
|
||||||
|
});
|
||||||
|
|
||||||
|
$router->get('/', function() {
|
||||||
echo $twig->render('index.twig');
|
echo $twig->render('index.twig');
|
||||||
break;
|
});
|
||||||
case "/nations":
|
|
||||||
echo $twig->render('nations.twig');
|
$router->get('/nations', function() {
|
||||||
break;
|
echo $twig->render('index.twig');
|
||||||
default:
|
});
|
||||||
|
|
||||||
|
$router->set404(function() {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
|
|
||||||
echo $twig->render('404.twig');
|
echo $twig->render('404.twig');
|
||||||
break;
|
});
|
||||||
}
|
|
||||||
|
$router->run();
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<title>Clyde's Real Survival SMP • {{ pageTitle }}</title>
|
<title>Clyde's Real Survival SMP • {{ pageTitle }}</title>
|
||||||
|
|
||||||
<link rel="icon" href="favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<link rel="stylesheet" href="css/style.min.css">
|
<link rel="stylesheet" href="/css/style.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
|
@ -25,7 +25,7 @@
|
||||||
<ul class="navRight">
|
<ul class="navRight">
|
||||||
{% if user %}
|
{% if user %}
|
||||||
<li>
|
<li>
|
||||||
<a class="userButton">
|
<a class="userButton" href="/u/{{ user.username }}">
|
||||||
{{ user.global_name }}
|
{{ user.global_name }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue