mirror of
https://github.com/seigler/cryptohistory.org
synced 2025-07-27 01:36:11 +00:00
OMG it works!!
This commit is contained in:
parent
e1784bdd4c
commit
3d1e2a774b
5 changed files with 34 additions and 77 deletions
16
index.php
16
index.php
|
@ -20,14 +20,14 @@ $router->map('GET', '/', function() {
|
|||
});
|
||||
|
||||
// map cryptocurrency stuff
|
||||
$router->map( 'GET', '/charts/[BTC_DASH:pair]/[7d|24h:duration]/[svg|png:format]', function($pair, $duration, $format) {
|
||||
$router->map( 'GET', '/charts/[dark|light:theme]/[a:curA]-[a:curB]/[7d|24h:duration]/[svg|png:format]', function($theme, $curA, $curB, $duration, $format) {
|
||||
require __DIR__ . '/views/chart.php';
|
||||
renderChart(
|
||||
$pair,
|
||||
$theme,
|
||||
strtoupper($curB.'_'.$curA),
|
||||
60 * 60 * 24 * ($duration == '7d' ? 7 : 1),
|
||||
($duration == '7d' ? 1800 : 300),
|
||||
$format,
|
||||
'#000',
|
||||
800,
|
||||
200,
|
||||
12
|
||||
|
@ -39,12 +39,12 @@ $router->map( 'GET', '/charts/[BTC_DASH:pair]/[7d|24h:duration]/[svg|png:format]
|
|||
$match = $router->match();
|
||||
|
||||
// call closure or throw 404 status
|
||||
if( !$match || !is_callable( $match['target'] ) || false === call_user_func_array( $match['target'], $match['params'] )) {
|
||||
// no route was matched
|
||||
header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
|
||||
echo '<h1>404 Not Found</h1><p>Page not found</p>';
|
||||
}
|
||||
try {
|
||||
if( !$match || !is_callable( $match['target'] ) || false === call_user_func_array( $match['target'], $match['params'] )) {
|
||||
// no route was matched
|
||||
header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
|
||||
echo '<h1>404 Not Found</h1><p>Page not found</p>';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 500 Server Error", true, 500);
|
||||
echo 'There was some problem generating that for you.';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue