get('/about', mkiRedirect('/')); $router->get('/about.html', mkiRedirect('/')); $router->get('/about.php', mkiRedirect('/')); $router->get('/index.php', mkiRedirect('/')); $router->get('/index.html', mkiRedirect('/')); $router->get('/365', mkiRedirect('/?fw365')); $router->get('/donate', mkiRedirect('https://paypal.me/flashwave')); $router->get('/header-bgs.json', function() { return json_encode(FM_BGS); }); $router->get('/now-listening', function() { $offset = (int)filter_input(INPUT_GET, 'offset', FILTER_SANITIZE_NUMBER_INT); $body = fm_component('header', [ 'title' => 'flash.moe / now listening', 'do_fullscreen_header' => true, 'is_now_playing' => true, 'offset' => $offset, ]); $body .= fm_component('footer', [ 'hide' => true, 'onload' => [ ['fm.initIndex', 10], ], ]); return $body; }); $router->get('/now-listening.json', function() { $lfmInfo = cache_output('lastfm', 10, function() { return json_decode(file_get_contents('https://now.flash.moe/get.php?u=flashwave_')); }); if(empty($lfmInfo[0]->name)) return []; $lfmInfo = $lfmInfo[0]; return [ 'name' => strval($lfmInfo->name), 'now_playing' => !empty($lfmInfo->nowplaying), 'url' => strval($lfmInfo->url), 'cover' => !empty($lfmInfo->images->large) ? strval($lfmInfo->images->large) : '', 'artist' => [ 'name' => !empty($lfmInfo->artist->name) ? strval($lfmInfo->artist->name) : '', 'url' => explode('/_/', strval($lfmInfo->url))[0], ], ]; }); $router->get('/home', function() { $body = fm_component('header', [ 'title' => 'flash.moe / homepage', 'do_fullscreen_header' => true, ]); $body .= <<
--
:
--
Week --  —  -----------
HTML; $body .= fm_component('footer', [ 'hide' => true, 'skip_analytics' => true, 'onload' => [ ['fm.initClock'], ['fm.initIndex', 10], ], ]); return $body; }); $router->get('/', function() use ($db) { $legacyPage = (string)filter_input(INPUT_GET, 'p'); if(!empty($legacyPage)) { $legacyPages = [ 'projects' => '/projects', 'contact' => '/contact', 'about' => '/', 'etc' => '/etc', 'hosted' => '/etc', 'friends' => '/related', ]; if(isset($legacyPages[$legacyPage])) { header('Location: ' . $legacyPages[$legacyPage]); return 302; } } $is365 = isset($_GET['fw365']); $blogInfo = json_decode(file_get_contents(MKI_DIR_PUB . '/old_blog_posts.json')); $projects = (new Projects($db))->getFeatured(); $languages = new Languages($db); $contact = [ [ 'id' => 'email', 'name' => 'E-mail', 'icon' => 'fmi fmi-email', 'display' => 'contact@flash.moe', 'link' => 'mailto:contact@flash.moe', ], [ 'id' => 'flashii', 'name' => 'Flashii', 'icon' => 'fmi fmi-flashii', 'display' => 'flash', 'link' => '//flashii.net/profile.php?u=1', ], [ 'id' => 'twitter', 'name' => 'Twitter', 'icon' => 'fmi fmi-twitter', 'display' => '@smugwave', 'link' => '//twitter.com/smugwave', ], [ 'id' => 'github', 'name' => 'Github', 'icon' => 'fmi fmi-github', 'display' => 'flashwave', 'link' => '//github.com/flashwave', ], ]; $body = fm_component('header', [ 'title' => 'flash.moe', 'is_index' => true, 'is_365' => $is365, ]); $body .= '
'; for($i = 1; $i < count(FM_NAV); ++$i) { $link = FM_NAV[$i]; $body .= "
'; $body .= fm_component('footer', [ 'is_index' => true, 'onload' => [ ['fm.initIndex'], ], ]); return $body; });