public static function loginModuleOverride($arguments)
 {
     $smarty = $arguments[1];
     $smarty->assign("loginoverride", "");
     if (Session::isCustomerLoggedIn()) {
         $customer = Customer::getById(Session::getLoggedInCustomer());
         $smarty->assign("loginoverride", "userpanel");
         $smarty->assign("userRealName", $customer->getFirstname() . " " . $customer->getSurname());
     }
 }
 protected function runPage()
 {
     $this->mBasePage = "book.tpl";
     global $cWebPath;
     $this->mStyles[] = $cWebPath . '/style/jsDatePick_ltr.min.css';
     $this->mScripts[] = $cWebPath . '/scripts/jsDatePick.full.1.3.js';
     // set up the default values for the
     if (WebRequest::wasPosted()) {
         $this->mSmarty->assign("valQbCheckin", WebRequest::postString("qbCheckin"));
         $this->mSmarty->assign("valQbCheckout", WebRequest::postString("qbCheckout"));
         $this->mSmarty->assign("valQbAdults", WebRequest::postInt("qbAdults"));
         $this->mSmarty->assign("valQbChildren", WebRequest::postInt("qbChildren"));
         $this->mSmarty->assign("valQbPromoCode", WebRequest::postString("qbPromoCode"));
     } else {
         $this->mSmarty->assign("valQbCheckin", "");
         $this->mSmarty->assign("valQbCheckout", "");
         $this->mSmarty->assign("valQbAdults", "");
         $this->mSmarty->assign("valQbChildren", "");
         $this->mSmarty->assign("valQbPromoCode", "");
     }
     if (Session::isCustomerLoggedIn()) {
         $customer = Customer::getById(Session::getLoggedInCustomer());
         $this->mSmarty->assign("qbTitle", $customer->getTitle());
         $this->mSmarty->assign("qbFirstname", $customer->getFirstname());
         $this->mSmarty->assign("qbLastname", $customer->getSurname());
         $this->mSmarty->assign("qbAddress", $customer->getAddress()->getLine1());
         $this->mSmarty->assign("qbCity", $customer->getAddress()->getCity());
         $this->mSmarty->assign("qbPostcode", $customer->getAddress()->getPostcode());
         $this->mSmarty->assign("qbCountry", $customer->getAddress()->getCountry());
         $this->mSmarty->assign("qbEmail", $customer->getEmail());
     } else {
         $this->mSmarty->assign("qbTitle", "");
         $this->mSmarty->assign("qbFirstname", "");
         $this->mSmarty->assign("qbLastname", "");
         $this->mSmarty->assign("qbAddress", "");
         $this->mSmarty->assign("qbCity", "");
         $this->mSmarty->assign("qbPostcode", "");
         $this->mSmarty->assign("qbEmail", "");
         $this->mSmarty->assign("qbCountry", " ");
     }
 }
 protected function runPage()
 {
     if (Session::isCustomerLoggedIn()) {
         global $cWebPath;
         // redirect to main page
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
         return;
     }
     if (WebRequest::wasPosted()) {
         if (WebRequest::get("id") && WebRequest::get("hash")) {
             // setting password
             $id = WebRequest::get("id");
             $hash = WebRequest::get("hash");
             $customer = Customer::getById($id);
             try {
                 if ($customer->getMailChecksum() != $hash) {
                     throw new InvalidChecksumException();
                 }
                 $suPassword = WebRequest::post("suPassword");
                 $suConfirm = WebRequest::post("suConfirm");
                 // validation
                 if ($suPassword == "") {
                     throw new CreateCustomerException("Password not specified");
                 }
                 if ($suConfirm == "") {
                     throw new CreateCustomerException("Confirmed password not specified");
                 }
                 if ($suPassword != $suConfirm) {
                     throw new CreateCustomerException("Password mismatch");
                 }
                 // validation
                 if ($suPassword != "" && $suPassword == $suConfirm) {
                     $customer->setPassword($suPassword);
                 }
                 $customer->save();
                 // log them in
                 Session::setLoggedInCustomer($id);
                 // redirect to main page
                 global $cWebPath;
                 $this->mHeaders[] = "HTTP/1.1 303 See Other";
                 $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
             } catch (CreateCustomerException $ex) {
                 $this->mBasePage = "changePassword.tpl";
                 $this->error($ex->getMessage());
             } catch (InvalidChecksumException $ex) {
                 $this->mBasePage = "changePassword.tpl";
                 $this->error($ex->getMessage());
             }
         } else {
             // requesting
             try {
                 $suEmail = WebRequest::post("suEmail");
                 // validation
                 if ($suEmail == "") {
                     throw new CreateCustomerException("Email not specified");
                 }
                 $customer = Customer::getByEmail($suEmail);
                 if ($customer == null) {
                     throw new NonexistantObjectException();
                 }
                 $customer->sendPasswordReset();
                 $this->mBasePage = "forgotpassword.tpl";
                 // TODO: show some confirmation, check email, etc
             } catch (CreateCustomerException $ex) {
                 $this->mBasePage = "forgottenpassword.tpl";
                 $this->error($ex->getMessage());
             } catch (NonexistantObjectException $ex) {
                 $this->mBasePage = "forgottenpassword.tpl";
                 $this->error("nonexistant object");
             }
         }
     } else {
         if (WebRequest::get("id") && WebRequest::get("hash")) {
             // show reset password form
             try {
                 $id = WebRequest::get("id");
                 $hash = WebRequest::get("hash");
                 $customer = Customer::getById($id);
                 if ($customer->getMailChecksum() != $hash) {
                     throw new InvalidChecksumException();
                 }
                 $this->mBasePage = "changePassword.tpl";
                 $this->mSmarty->assign("cpid", $id);
                 $this->mSmarty->assign("cphash", $hash);
             } catch (InvalidChecksumException $ex) {
                 $this->mBasePage = "forgottenpassword.tpl";
                 $this->error("invalid checksum");
             }
         } else {
             // show request form
             $this->mBasePage = "forgottenpassword.tpl";
             return;
         }
     }
 }
 protected function runPage()
 {
     $showError = "";
     $error = "";
     global $cWebPath;
     $this->mBasePage = "signup.tpl";
     if (Session::isCustomerLoggedIn()) {
         // why do you want another account?
         // redirect to main page
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
     }
     if (WebRequest::wasPosted()) {
         try {
             $suTitle = WebRequest::post("suTitle");
             $suFirstname = WebRequest::post("suFirstname");
             $suLastname = WebRequest::post("suLastname");
             $suAddress = WebRequest::post("suAddress");
             $suCity = WebRequest::post("suCity");
             $suPostcode = WebRequest::post("suPostcode");
             $suCountry = WebRequest::post("suCountry");
             $suEmail = WebRequest::post("suEmail");
             $suPassword = WebRequest::post("suPassword");
             $suConfirm = WebRequest::post("suConfirm");
             // data validation
             if ($suTitle == "") {
                 throw new CreateCustomerException("Title not specified");
             }
             if ($suFirstname == "") {
                 throw new CreateCustomerException("Firstname not specified");
             }
             if ($suLastname == "") {
                 throw new CreateCustomerException("Lastname not specified");
             }
             if ($suAddress == "") {
                 throw new CreateCustomerException("Address not specified");
             }
             if ($suCity == "") {
                 throw new CreateCustomerException("City not specified");
             }
             if ($suPostcode == "") {
                 throw new CreateCustomerException("Postcode not specified");
             }
             if ($suCountry == "") {
                 throw new CreateCustomerException("Country not specified");
             }
             if ($suEmail == "") {
                 throw new CreateCustomerException("Email not specified");
             }
             if ($suPassword == "") {
                 throw new CreateCustomerException("Password not specified");
             }
             if ($suConfirm == "") {
                 throw new CreateCustomerException("Confirmed password not specified");
             }
             if ($suPassword != $suConfirm) {
                 throw new CreateCustomerException("Password mismatch");
             }
             $customer = new Customer();
             if ($suPassword != "" && $suPassword == $suConfirm) {
                 $customer->setPassword($suPassword);
             }
             // set values
             $customer->setTitle($suTitle);
             $customer->setFirstname($suFirstname);
             $customer->setSurname($suLastname);
             $address = new Address();
             $address->setLine1($suAddress);
             $address->setCity($suCity);
             $address->setPostCode($suPostcode);
             $address->setCountry($suCountry);
             $address->save();
             $customer->setAddress($address);
             $customer->setEmail($suEmail);
             // save it
             $customer->save();
             $customer->sendMailConfirm();
             global $cScriptPath;
             $this->mHeaders[] = "Location: {$cScriptPath}";
         } catch (CreateCustomerException $ex) {
             $this->mBasePage = "signup.tpl";
             $this->error($ex->getMessage());
         }
     } else {
         $this->mBasePage = "signup.tpl";
     }
 }