public static function configurePage(Template $t, $title, $bodyContent = null, $jsExtra = null) { $t->insertSlot("TITLE", $title); $currentPage = DocumentHelper::getCurrentPageName(); if ($bodyContent !== null) { $t->insertSlot("BODY_CONTENT", $bodyContent); } if ($jsExtra !== null) { $t->insertBlock("JS_EXTRA", $jsExtra); } if (SessionHelper::isAdmin()) { // logged in as admin $t->insertSlot("LOGIN_TEXT", "LOG OUT " . SessionHelper::getName()); $t->insertSlot("LOGIN_LINK", "logout.php"); } else { $t->insertBlock("LOGIN", ""); } // menu - highlight current page $t->insertSlot("CLASS_ABOUT", $currentPage == "about.php" ? "current" : ""); $t->insertSlot("CLASS_BOOKINGS", $currentPage == "bookings.php" ? "current" : ""); $t->insertSlot("CLASS_VALET_PARKING", $currentPage == "valet_parking.php" ? "current" : ""); $t->insertSlot("CLASS_VEHICLE_STORAGE", $currentPage == "vehicle_storage.php" ? "current" : ""); $t->insertSlot("CLASS_POOL_CAR", $currentPage == "pool_car.php" ? "current" : ""); $t->insertSlot("CLASS_RATES", $currentPage == "rates.php" ? "current" : ""); $t->insertSlot("CLASS_VIDEO", $currentPage == "video.php" ? "current" : ""); }
} } } } } } } } } $message = $error ? "<p class=\"feedback_negative\">{$error}</p>" : ($message ? "<p class=\"feedback_positive\">{$message}</p>" : ""); $jsExtra = JsWriter::scriptLink("js/bookings.js") . "\n" . JsWriter::scriptLink("js/datetimepicker_css.js"); $t = new Template("templates/page.tpl.html"); $tt = new Template("templates/bookings.tpl.html"); $tt->insertSlot("MESSAGE", $message); if ($submitSuccess) { $tt->insertBlock("FORM_CONTENT", ""); } else { $tt->insertSlot("FIRSTNAME_LABEL", FormFieldTexts::FIRST_NAME); $tt->insertSlot("FIRSTNAME_VALUE", $first_name); $tt->insertSlot("LASTNAME_LABEL", FormFieldTexts::LAST_NAME); $tt->insertSlot("LASTNAME_VALUE", $last_name); $tt->insertSlot("EMAIL_LABEL", FormFieldTexts::EMAIL); $tt->insertSlot("EMAIL_VALUE", $email); $tt->insertSlot("PHONE_LABEL", FormFieldTexts::PHONE); $tt->insertSlot("PHONE_VALUE", $phone); $tt->insertSlot("MAKE_LABEL", FormFieldTexts::MAKE); $tt->insertSlot("MAKE_VALUE", $make); $tt->insertSlot("REG_LABEL", FormFieldTexts::REG); $tt->insertSlot("REG_VALUE", $reg); $tt->insertSlot("COLOUR_LABEL", FormFieldTexts::COLOUR); $tt->insertSlot("COLOUR_VALUE", $colour);
$focusId = "email"; } else { if (!UserHelper::emailExists($db, $emailFilteredValue)) { $error = "The email address you entered has not been registered: {$emailFilteredValue}"; $focusId = "email"; } else { // all good $showForm = false; $emailResult = UserHelper::forgotPassword($db, $emailFilteredValue); if (!$emailResult) { $error = "Could not send password reset email"; } else { $message = "Your password has been reset and emailed to you"; } } } } } else { $emailFilteredValue = "email"; } if (!$showForm) { $tInner->insertBlock("FORM_CONTENT", ""); $tInner->insertBlock("INSTRUCTION_CONTENT", ""); } else { // showing form $tInner->insertSlot("FOCUS_ID", $focusId); $tInner->insertSlot("EMAIL_VALUE", $emailFilteredValue); } $tInner->insertSlot("FEEDBACK", $error ? "<span class='feedback_negative'>{$error}</span>" : ($message ? "<span class='feedback_positive'>{$message}</span>" : "")); TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Forgot Password", $tInner->output()); echo $t->output();
// they logged in using the form, send redirect headers // echo "SUCCESS " . print_r($_POST); exit; if ($from) { header("Location: " . $from); } else { if (SessionHelper::isAdmin()) { header("Location: report_time.php"); } else { header("Location: ."); } } exit; } } header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past require_once "classes/template.class.php"; require_once "classes/templatehelper.class.php"; require_once "classes/formwriter.class.php"; $t = new Template("templates/admin_page.tpl.html"); $t->insertBlock("LINKS", ""); $tLogin = new Template("templates/login.tpl.html"); $tLogin->insertSlot("MESSAGE", "<span class=\"" . (isset($success) ? $success ? "feedback_positive" : "feedback_negative" : "feedback_neutral") . "\">" . $message . "</span>"); $tLogin->insertSlot("FIELD_TEXT_EMAIL", FormFieldTexts::EMAIL); $tLogin->insertSlot("PREFILL_EMAIL", $prefillEmail); $tLogin->insertSlot("FROM", $from); $tLogin->insertSlot("FOCUS_ID", $focusId); TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Login", $tLogin->output(), JSWriter::scriptLink("js/jquery-1.4.2.min.js")); echo $t->output();