Allow verify, encrypt and proofs with prefilled UID

This commit is contained in:
Yarmo Mackenbach 2020-06-27 14:51:31 +02:00
parent c3af757bd0
commit ff0e72da83

View file

@ -11,6 +11,9 @@ $router->map('GET', '/', function() {}, 'index');
$router->map('GET', '/verify', function() {}, 'verify'); $router->map('GET', '/verify', function() {}, 'verify');
$router->map('GET', '/encrypt', function() {}, 'encrypt'); $router->map('GET', '/encrypt', function() {}, 'encrypt');
$router->map('GET', '/proofs', function() {}, 'proofs'); $router->map('GET', '/proofs', function() {}, 'proofs');
$router->map('GET', '/verify/[:uid]', function() {}, 'verifyUid');
$router->map('GET', '/encrypt/[:uid]', function() {}, 'encryptUid');
$router->map('GET', '/proofs/[:uid]', function() {}, 'proofsUid');
$router->map('GET', '/faq', function() {}, 'faq'); $router->map('GET', '/faq', function() {}, 'faq');
$router->map('GET', '/[:uid]', function() {}, 'profile'); $router->map('GET', '/[:uid]', function() {}, 'profile');
@ -25,19 +28,27 @@ if(is_array($match) && is_callable($match['target'])) {
break; break;
case 'verify': case 'verify':
readfile('pages/verify.html'); case 'verifyUid':
$content = file_get_contents('pages/verify.html');
$content = str_replace('%UID%', (array_key_exists('uid', $match['params']) ? $match['params']['uid'] : ""), $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
break; break;
case 'encrypt': case 'encrypt':
readfile('pages/encrypt.html'); case 'encryptUid':
$content = file_get_contents('pages/encrypt.html');
$content = str_replace('%UID%', (array_key_exists('uid', $match['params']) ? $match['params']['uid'] : ""), $content);
header('Content-Type: text/html; charset=utf-8');
echo($content);
break; break;
case 'proofs': case 'proofs':
readfile('pages/proofs.html'); case 'proofsUid':
break; $content = file_get_contents('pages/proofs.html');
$content = str_replace('%UID%', (array_key_exists('uid', $match['params']) ? $match['params']['uid'] : ""), $content);
case 'faq': header('Content-Type: text/html; charset=utf-8');
readfile('pages/faq.html'); echo($content);
break; break;
case 'profile': case 'profile':
@ -46,6 +57,10 @@ if(is_array($match) && is_callable($match['target'])) {
header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
echo($content); echo($content);
break; break;
case 'faq':
readfile('pages/faq.html');
break;
} }
} else { } else {
// No route was matched // No route was matched