ExternalCss[] = 'style.css'; if (!$g_use_local_jquery) $website->ExternalJs[] = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"; else $website->ExternalJs[] = "jquery-3.3.1.min.js"; $website->Style->items["td"]["word-wrap"] = "break-word"; $website->Style->items["td"]["max-width"] = "280px"; bootstrap_init($website); // Create a bootstrap fluid containers, one for whole website and one for errors, which are dynamically inserted to error container as they are generated $fc = new BS_FluidContainer($website); if (isset($_GET['login'])) ProcessLogin(); if (isset($_GET['logout'])) session_unset(); // Recover unfinished request // we must do this before checking POST and GET parameters - because they take precedence over preserved data if (isset($_SESSION['preserved_domain'])) { $g_selected_domain = $_SESSION['preserved_domain']; unset($_SESSION['preserved_domain']); } if (isset($_SESSION['preserved_action'])) { $g_action = $_SESSION['preserved_action']; unset($_SESSION['preserved_action']); } if (isset($_GET['action'])) $g_action = $_GET['action']; if (isset($_GET['domain'])) $g_selected_domain = $_GET['domain']; else if (isset($_POST['zone'])) $g_selected_domain = $_POST['zone']; // Check if login is needed if (RequireLogin()) { // If we were trying to run action=manage on some domain, preserve the link as much as we can, // so that user can resume the operation after login if ($g_action === 'manage' || $g_action === 'new' || $g_action === 'batch') $_SESSION['preserved_action'] = $g_action; if ($g_selected_domain !== null) $_SESSION['preserved_domain'] = $g_selected_domain; $fc->AppendHeader('Login to ' . G_HEADER); if ($g_auth_login_banner !== NULL) $fc->AppendObject(new BS_Alert($g_auth_login_banner, 'info')); // Display warnings and errors if there are any $fc->AppendObject($g_warning_container); $fc->AppendObject($g_error_container); if ($g_login_failed) $fc->AppendObject(new BS_Alert($g_login_failure_reason, 'danger')); $fc->AppendObject(GetLogin()); } else { $header = new DivContainer($fc); $header->ClassName = 'header'; $header->AppendObject(new Image("favicon.png", "DNS")); $header->AppendHeader(G_HEADER); if ($g_logged_in) $fc->AppendHtml(GetLoginInfo()); // Display warnings if there are any $fc->AppendObject($g_warning_container); $fc->AppendObject($g_error_container); $fc->AppendObject(GetMenu($fc)); if ($g_action === null) { $fc->AppendHeader("Select a zone to manage", 2); $fc->AppendObject(TabOverview::GetSelectForm($fc)); } else if ($g_action == "manage") { TabManage::ProcessDelete($fc); TabManage::GetContents($fc); } else if ($g_action == 'csv') { // Export the current zone as CSV (if user can actually read it) $table = GetRecordListTablePlainFormat($fc, $g_selected_domain); header('Content-Type: application/csv'); header('Content-Disposition: attachment; filename=' . $g_selected_domain . '.csv'); header('Pragma: no-cache'); print ($table->ToCSV(';', true)); exit(0); } else if ($g_action == 'new') { // Process previous inserting call (via submit) in case there was some TabEdit::Process($fc); $fc->AppendObject(TabEdit::GetInsertForm($fc)); $fc->AppendObject(TabEdit::GetHelp()); } else if ($g_action == 'edit') { // Process previous edit call (via submit) in case there was some TabEdit::Process($fc); $fc->AppendObject(TabEdit::GetEditForm($fc)); $fc->AppendObject(TabEdit::GetHelp()); } else if ($g_action == 'batch') { // Process any previous pending batch operation TabBatch::Process($fc); $fc->AppendObject(TabBatch::GetForm($fc)); } } // Bug workaround - the footer seems to take up some space $website->AppendHtml("


"); $website->AppendHtmlLine(""); $website->PrintHtml(); Debug('Generated in ' . psf_get_execution_time() . 's'); if ($g_debug) { psf_print_debug_as_html(); } // Close open FD's etc ResourceCleanup();