2020-06-26 09:00:22 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
use Pagerange\Markdown\MetaParsedown;
|
|
|
|
|
|
|
|
// Init router
|
|
|
|
$router = new AltoRouter();
|
|
|
|
|
|
|
|
// Router mapping
|
|
|
|
$router->map('GET', '/', function() {}, 'index');
|
|
|
|
$router->map('GET', '/verify', function() {}, 'verify');
|
|
|
|
$router->map('GET', '/encrypt', function() {}, 'encrypt');
|
|
|
|
$router->map('GET', '/proofs', function() {}, 'proofs');
|
|
|
|
$router->map('GET', '/faq', function() {}, 'faq');
|
2020-06-26 09:33:39 -06:00
|
|
|
$router->map('GET', '/[:uid]', function() {}, 'profile');
|
2020-06-26 09:00:22 -06:00
|
|
|
|
|
|
|
// Router matching
|
|
|
|
$match = $router->match();
|
|
|
|
|
|
|
|
// Render the appropriate route
|
|
|
|
if(is_array($match) && is_callable($match['target'])) {
|
|
|
|
switch ($match['name']) {
|
|
|
|
case 'index':
|
|
|
|
readfile('pages/index.html');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'verify':
|
|
|
|
readfile('pages/verify.html');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'encrypt':
|
|
|
|
readfile('pages/encrypt.html');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'proofs':
|
|
|
|
readfile('pages/proofs.html');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'faq':
|
|
|
|
readfile('pages/faq.html');
|
|
|
|
break;
|
2020-06-26 09:33:39 -06:00
|
|
|
|
|
|
|
case 'profile':
|
2020-06-26 10:01:39 -06:00
|
|
|
$content = file_get_contents('pages/profile.html');
|
2020-06-26 09:33:39 -06:00
|
|
|
$content = str_replace('%UID%', $match['params']['uid'], $content);
|
2020-06-26 10:01:39 -06:00
|
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
|
|
print($content);
|
2020-06-26 09:33:39 -06:00
|
|
|
break;
|
2020-06-26 09:00:22 -06:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No route was matched
|
|
|
|
}
|