require_once 'include/config.php'; if (DEBUG) { ini_set('display_errors', 1); error_reporting(E_ALL); } define('STATUS_CLOSED', 1); $template_fallbacks = array('admin_head.php' => 'head.php', 'admin_foot.php' => 'foot.php', 'archive_head.php' => 'head.php', 'archive_foot.php' => 'foot.php', 'comic_head.php' => 'head.php', 'comic_foot.php' => 'foot.php', 'chapter_head.php' => 'head.php', 'chapter_foot.php' => 'foot.php', 'rant_head.php' => 'head.php', 'rant_foot.php' => 'foot.php'); $request = isset($_REQUEST['q']) && $_REQUEST['q'] && $_REQUEST['q'] != '/' ? $_REQUEST['q'] : 'index'; $request = array_values(array_filter(explode('/', $request))); $page = new Page(); $page->title = config('title'); // $page->add_css("template/{config('template')}/style.css"); $page->add_css(template_path('style.css')); // $page->add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js'); $page->add_js(template_path('nav.js')); $page->set_start_time($start_time); switch ($request[0]) { case 'index': // frontpage $selection_style = config('frontpage_comic', 'latest'); $page->debug('selection_style', $selection_style); switch ($selection_style) { case 'first': $comic = $db->fetch_first("SELECT * FROM comics WHERE pub_date <= UNIX_TIMESTAMP() ORDER BY pub_date ASC LIMIT 1"); break; case 'first-of-latest-day': $latest = $db->quick("SELECT pub_date FROM comics WHERE pub_date <= UNIX_TIMESTAMP() ORDER BY pub_date DESC LIMIT 1"); $midnight = strtotime(date('Y-m-d', $latest)); $comic = $db->fetch_first("SELECT * FROM comics WHERE pub_date >= %d AND pub_date <= UNIX_TIMESTAMP() ORDER BY pub_date ASC LIMIT 1", $midnight); break; case 'latest':