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('/related.php', mkiRedirect('/')); $router->get('/related.html', mkiRedirect('/')); $router->get('/friends', mkiRedirect('/')); $router->get('/friends.php', mkiRedirect('/')); $router->get('/friends.html', mkiRedirect('/')); $router->get('/related', mkiRedirect('/')); $router->get('/etc.php', mkiRedirect('/')); $router->get('/etc.html', mkiRedirect('/')); $router->get('/etcetera', mkiRedirect('/')); $router->get('/etcetera.html', mkiRedirect('/')); $router->get('/etcetera.php', mkiRedirect('/')); $router->get('/misc', mkiRedirect('/')); $router->get('/misc.html', mkiRedirect('/')); $router->get('/misc.php', mkiRedirect('/')); $router->get('/etc', mkiRedirect('/')); $router->get('/365', mkiRedirect('/')); $router->get('/donate', mkiRedirect('/')); $router->get('/blog.php', mkiRedirect('/')); $router->get('/blog-post.php', mkiRedirect('/')); $router->get('/blog/:id', mkiRedirect('/')); $router->get('/old-blog', mkiRedirect('/')); $router->get('/old-blog/:id', mkiRedirect('/')); $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('/np.php', function() { header('Content-Type: text/xml'); return cache_output('lastfm-xml', 10, function() { return file_get_contents('https://now.flash.moe/get.php?u=flashwave_&f=xml'); }); }); $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; } } $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', ], ]; $body = fm_component('header', [ 'title' => 'flash.moe', 'is_index' => true, ]); $body .= '
'; for($i = 1; $i < count(FM_NAV); ++$i) { $link = FM_NAV[$i]; $body .= " '; } $body .= <<
Contact
More
HTML; foreach($contact as $social) { $body .= "
"; if(isset($social['link'])) { $body .= ""; } else { $body .= "
"; } $body .= <<
HTML; } $body .= '
'; $body .= fm_component('footer', [ 'is_index' => true, 'onload' => [ ['fm.initIndex'], ], ]); return $body; });