$redirectTo !== '' ? $redirectTo : '/']))->send(); exit; } $passwordError = 'Incorrect access password.'; } if ($hasMaintenanceBypass) { goto maintenance_bypass_complete; } $title = Core\Services\Settings::get('site_maintenance_title', 'Coming Soon'); $message = Core\Services\Settings::get('site_maintenance_message', 'We are currently updating the site. Please check back soon.'); $buttonLabel = Core\Services\Settings::get('site_maintenance_button_label', ''); $buttonUrl = Core\Services\Settings::get('site_maintenance_button_url', ''); $customHtml = Core\Services\Settings::get('site_maintenance_html', ''); $siteTitle = Core\Services\Settings::get('site_title', 'AudioCore V1.5.1'); $contentHtml = ''; if ($customHtml !== '') { $contentHtml = $customHtml; } else { $contentHtml = '
' . '
Maintenance Mode
' . '

' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '

' . '

' . nl2br(htmlspecialchars($message, ENT_QUOTES, 'UTF-8')) . '

'; if ($buttonLabel !== '' && $buttonUrl !== '') { $contentHtml .= '' . htmlspecialchars($buttonLabel, ENT_QUOTES, 'UTF-8') . ''; } if ($maintenancePasswordHash !== '') { $contentHtml .= '
' . '' . '
' . '' . '' . '
'; if ($passwordError !== '') { $contentHtml .= '
' . htmlspecialchars($passwordError, ENT_QUOTES, 'UTF-8') . '
'; } $contentHtml .= '
'; } $contentHtml .= '
'; } $maintenanceHtml = '' . '' . '' . htmlspecialchars($siteTitle, ENT_QUOTES, 'UTF-8') . '' . '' . $contentHtml . ''; (new Core\Http\Response($maintenanceHtml, 503, ['Content-Type' => 'text/html; charset=utf-8']))->send(); exit; } maintenance_bypass_complete: $router = new Core\Http\Router(); $router->get('/', function (): Core\Http\Response { $db = Core\Services\Database::get(); if ($db instanceof PDO) { $stmt = $db->prepare("SELECT title, content_html FROM ac_pages WHERE is_home = 1 AND is_published = 1 LIMIT 1"); $stmt->execute(); $page = $stmt->fetch(PDO::FETCH_ASSOC); if ($page) { $view = new Core\Views\View(__DIR__ . '/../modules/pages/views'); return new Core\Http\Response($view->render('site/show.php', [ 'title' => (string)$page['title'], 'content_html' => Core\Services\Shortcodes::render((string)$page['content_html'], [ 'page_slug' => 'home', 'page_title' => (string)$page['title'], ]), ])); } } $view = new Core\Views\View(__DIR__ . '/../views'); return new Core\Http\Response($view->render('site/home.php', [ 'title' => 'AudioCore V1.5.1', ])); }); $router->registerModules(__DIR__ . '/../modules'); Core\Services\Plugins::register($router); $response = $router->dispatch($_SERVER['REQUEST_URI'] ?? '/', $_SERVER['REQUEST_METHOD'] ?? 'GET'); $response->send();