Example #1
0
 public static function forgotPassword(Db $db, $email, $pathtoTemplates = "templates/")
 {
     if (!self::emailExists($db, $email)) {
         return false;
     }
     $siteUrl = Constants::SITE_URL;
     $siteName = Constants::SITE_NAME;
     $newPass = UUID::generate();
     $newPassHash = md5($newPass);
     $pq = "update users set passhash = ? where email like ? limit 1";
     $db->preparedQuery($pq, array($newPassHash, $email), "ss");
     $plainMessage = "Your password has been reset to:\n\n{$newPass}\n\nPlease use this temporary password to log into the site and change it to a new, secure password of your choosing on the Edit Profile page.\n\nYou can follow this link:\n{$siteUrl}" . "admin/login.php?email={$email}&from=settings.php\n\nFrom: Automailer\n";
     $htmlMessage = EmailHelper::getEmailPara("Your password has been reset to:") . EmailHelper::getEmailPara("{$newPass}") . EmailHelper::getEmailPara("Please use this temporary password to log into the site and change it to a new, secure password of your choosing on the Edit Profile page.") . EmailHelper::getEmailPara("You can follow this link: <a style='color:#6666ff;' href='{$siteUrl}" . "admin/login.php?email={$email}&from=settings.php'>{$siteUrl}" . "login.php?email={$email}&from=settings.php</a>") . EmailHelper::getEmailPara("From: Automailer");
     $tHtml = new Template($pathtoTemplates . "mailers/holder.tpl.html");
     $tHtml->insertSlot("TITLE", "{$siteName} - Forgot Password");
     $tHtml->insertSlot("CONTENT", $htmlMessage);
     // do NOT error here, the password has been reset, dont return false so they think it has not
     @EmailHelper::sendHtmlEmail($tHtml->output(), $plainMessage, Constants::EMAIL_INFO, $email, "[{$siteName}] password reset");
     return true;
 }
Example #2
0
				   <span id="meeting_time" style="position:absolute; z-index:8; left:330px; top:259px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $meet_time . '</span>

				   <span id="arrival_date_time" style="position:absolute; z-index:9; left:120px; top:312px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $arrive_date . '</span>
				   <span id="meeting_time" style="position:absolute; z-index:8; left:300px; top:312px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $arrive_time . '</span>
				   <span id="flight" style="position:absolute; z-index:11; left:438px; top:312px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;"><?php echo $row["flight"]; ?>' . $flight . '</span>

				   <span id="amount" style="position:absolute; z-index:11; left:115px; top:364px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;width:100px;">' . $amount . '</span>
				   <span id="comment" style="position:absolute; z-index:14; left:43px; top:763px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold; width:490px; height:50px;white-space:wrap; overflow:hidden;">' . $comment . '</span>
				   
				   <span id="cash" style="position:absolute; z-index:12; left:121px; top:435px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $cash . '</span>

				   <span id="eft" style="position:absolute; z-index:13; left:215px; top:438px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $eft . '</span>

				   <span id="cc" style="position:absolute; z-index:14; left:338px; top:438px;padding:0; margin:7px 0 0 5px; display:block; font-weight:bold;">' . $cc . '</span>
			   </div>
		   </div>
       </div>';
    }
    if ($error) {
        $t = new Template("templates/print/print_report_time.tpl.html");
        $t->insertSlot("VALID", urlencode($error));
        //$t->insertSlot("RESULTS", "$results");
    } else {
        $t->insertSlot("RESULTS", $results);
        $t->insertSlot("VALID", "valid");
    }
    $t->insertSlot("DESC", $desc);
    $t->insertSlot("TITLE", "Report-" . date("Y-m-d"));
    echo $t->output() . '';
    echo ' <br/><br/><br/><br/><br/><br/>';
}
Example #3
0
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
$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);
Example #4
0
            		<a href=\"print_single_booking.php?id=$bid&save=0\" target=\"_blank\">print</a><br />
            		<a href=\"edit_booking.php?id=$bid\">edit</a><br />
            		<a href=\"edit_booking.php?id=$bid&clone=1\">clone</a>";
            */
            $printRow = "<a href=\"print_single_booking.php?id={$bid}&save=1\" target=\"_blank\">save</a><br /><a href=\"print_single_booking.php?id={$bid}&save=0\" target=\"_blank\">print</a><br />";
            if (SessionHelper::isMaster()) {
                $printRow .= "<a href=\"edit_booking.php?id={$bid}\">edit</a><br />";
            }
            $printRow .= "<a href=\"edit_booking.php?id={$bid}&clone=1\">clone</a>";
            $results .= sprintf($rowTemplate, $n % 2 == 0 ? "even" : "odd", $n, $bid, $row["surname"] . ", " . $row["name"], $emailImg . $email . "<br />" . $phoneImg . $row["phone"], $row["vehicle"] . " \"" . $row["reg"] . "\"", $row["flight"], "", $depart, "", $meet, "", $arrive, $row["payment"], $combo, $cdate, $printRow);
        }
        $results .= "</table>\n";
    }
    $message = "";
}
$tt->insertSlot("RESULTS", $results);
$tt->insertSlot("SEARCH_TEXT", $search_text);
$tt->insertSlot("NAME_STATUS", $name_status);
$tt->insertSlot("EMAIL_STATUS", $email_status);
$tt->insertSlot("PHONE_STATUS", $phone_status);
$tt->insertSlot("AMOUNT_STATUS", $amount_status);
$tt->insertSlot("COMMENT_STATUS", $comment_status);
$tt->insertSlot("MAKE_STATUS", $make_status);
$tt->insertSlot("PARKING_POINTS_STATUS", $parking_points_status);
$tt->insertSlot("REG_STATUS", $reg_status);
$tt->insertSlot("COLOUR_STATUS", $colour_status);
$tt->insertSlot("FLIGHT_STATUS", $flight_status);
$tt->insertSlot("DROPOFF_STATUS", $dropoff_status);
$tt->insertSlot("PICKUP_STATUS", $pickup_status);
$tt->insertSlot("RANGE_START_VALUE", $_POST ? $range_start : "");
$tt->insertSlot("RANGE_END_VALUE", $_POST ? $range_end : "");
Example #5
0
            $meet = $row["D"] ? "&nbsp;" : $row["meet_time"];
            $cdate = date("d M Y <b>H:i:s</b><\\B\\R/><\\i>l</\\i>", $row["unix_created"]);
            $email = sprintf("<a href=\"mailto:%s\">%s</a>", $row["email"], $row["email"]);
            $departIsToday = $tday == date("Y-m-d", $row["unix_depart"]);
            $arriveIsToday = $tday == date("Y-m-d", $row["unix_arrive"]);
            $printRow = "<a href=\"print_single_booking.php?id={$bid}&save=1\" target=\"_blank\">save</a><br /><a href=\"print_single_booking.php?id={$bid}&save=0\" target=\"_blank\">print</a><br />";
            if (SessionHelper::isMaster()) {
                $printRow .= "<a href=\"edit_booking.php?id={$bid}\">edit</a><br />";
            }
            $printRow .= "<a href=\"edit_booking.php?id={$bid}&clone=1\">clone</a>";
            $results .= sprintf($rowTemplate, $n % 2 == 0 ? "even" : "odd", $n, $bid, $row["surname"] . ", " . $row["name"], $emailImg . $email . "<br />" . $phoneImg . $row["phone"], $row["vehicle"] . " \"" . $row["reg"] . "\"", $row["flight"], $departIsToday ? " today" : "", $depart, "", $meet, $arriveIsToday ? " today" : "", $arrive, $row["payment"], $combo, $row["parking_points"], $cdate, $printRow);
        }
        $results .= "</table>\n";
    }
    $message = "";
}
$tt->insertSlot("RESULTS", $results);
$tt->insertSlot("RANGE_START_VALUE", $_POST && $range == 50 ? $range_start : "");
$tt->insertSlot("RANGE_END_VALUE", $_POST && $range == 50 ? $range_end : "");
$tt->insertSlot("MESSAGE", $error ? "<span class=\"feedback_negative\">{$error}</span>" : "<span class=\"feedback_positive\">{$message}</span>");
$tt->insertSlot("RANGE_SELECTED_10", $range == 10 ? " selected" : "");
$tt->insertSlot("RANGE_SELECTED_20", $range == 20 ? " selected" : "");
$tt->insertSlot("RANGE_SELECTED_30", $range == 30 ? " selected" : "");
$tt->insertSlot("RANGE_SELECTED_40", $range == 40 ? " selected" : "");
$tt->insertSlot("RANGE_SELECTED_50", $range == 50 ? " selected" : "");
$tt->insertSlot("RANGE_INPUT_STYLE_DISPLAY", $range == 50 ? "block" : "none");
$tt->insertSlot("FOCUS_ID", $focusId);
// output
$jsExtra = JsWriter::scriptLink("js/jquery-1.4.2.min.js") . "\n" . JsWriter::scriptLink("js/report_time.js") . "\n" . JsWriter::scriptLink("js/datetimepicker_css.js");
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Report - time", $tt->output(), $jsExtra);
echo $t->output();
Example #6
0
                        <a href=\"print_single_booking.php?id=$bid&save=0\" target=\"_blank\">print</a><br />
                        <a href=\"edit_booking.php?id=$bid\">edit</a><br />
                        <a href=\"edit_booking.php?id=$bid&clone=1\">clone</a>";
                */
                $printRow = "<a href=\"print_single_booking.php?id={$bid}&save=1\" target=\"_blank\">save</a><br /><a href=\"print_single_booking.php?id={$bid}&save=0\" target=\"_blank\">print</a><br />";
                //if(SessionHelper::isMaster())
                $printRow .= "<a href=\"edit_booking.php?id={$bid}\">edit</a><br />";
                $printRow .= "<a href=\"edit_booking.php?id={$bid}&clone=1\">clone</a>";
                $results .= sprintf($rowTemplate, $n % 2 == 0 ? "even" : "odd", $n, $bid, $row["surname"] . ", " . $row["name"], $emailImg . $email . "<br />" . $phoneImg . $row["phone"], $row["vehicle"] . " \"" . $row["reg"] . "\"", $row["flight"], "", $depart, "", $meet, "", $arrive, $row["parking_points"], $row["payment"], $combo, $cdate, $printRow);
            }
            $total_points_used = 0;
            foreach ($rows3 as $row) {
                $total_points_used = floatval($row['points_used']) + $total_points_used;
            }
            $points_remaining = $total_points - $total_points_used;
            $results .= "</table><br/> total parking points earned = " . $total_points . "<br/> total parking points used = " . $total_points_used . "<br/> total parking points remaining = " . $points_remaining;
            $results .= '<form id="form" action="report_user.php?phone=' . $_GET['phone'] . '" method="post">Use parking points (0.2): <input type="text" name="use_points" id="user_points">pts<input id="submitButton" name="submitButton" type="submit" value="Submit" class="button_submit" /></form>';
        }
        $message = "";
    }
}
$tt->insertSlot("RESULTS", $results);
$tt->insertSlot("LAST_NAME", $last_name);
$tt->insertSlot("PHONE", $phone);
$tt->insertSlot("EMAIL", $email_a);
$tt->insertSlot("MESSAGE", $error ? "<span class=\"feedback_negative\">{$error}</span>" : "<span class=\"feedback_positive\">{$message}</span>");
$tt->insertSlot("FOCUS_ID", $focusId);
// output
$jsExtra = JsWriter::scriptLink("js/jquery-1.4.2.min.js") . "\n" . JsWriter::scriptLink("js/report_search.js") . "\n" . JsWriter::scriptLink("js/datetimepicker_css.js");
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Report - search", $tt->output(), $jsExtra);
echo $t->output();
Example #7
0
            $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();
Example #8
0
                                $error = "Could not update your details";
                            } else {
                                SessionHelper::updateName($values[0], $values[1]);
                            }
                            $message = "Your details have been updated";
                        }
                    }
                }
            }
        }
    }
}
// common
$firstnameValue = $submitted && $submitSuccess ? $_POST["firstname"] : $userData["first_name"];
$lastnameValue = $submitted && $submitSuccess ? $_POST["lastname"] : $userData["last_name"];
$message = $error ? "<span class=\"feedback_negative\">{$error}</span>" : "<span class=\"feedback_positive\">{$message}</span>";
$jsExtra = "<script src='js/settings.js' type='text/javascript'></script>";
$t = new Template("templates/admin_page.tpl.html");
$tSettings = new Template("templates/settings.tpl.html");
$tSettings->insertSlot("MESSAGE", $message);
$tSettings->insertSlot("FIRSTNAME_LABEL", FormFieldTexts::FIRST_NAME);
$tSettings->insertSlot("FIRSTNAME_VALUE", $firstnameValue);
$tSettings->insertSlot("LASTNAME_LABEL", FormFieldTexts::LAST_NAME);
$tSettings->insertSlot("LASTNAME_VALUE", $lastnameValue);
$tSettings->insertSlot("OLDPASS1_LABEL", FormFieldTexts::EXISTING_PASSWORD);
$tSettings->insertSlot("OLDPASS2_LABEL", FormFieldTexts::CONFIRM_EXISTING_PASSWORD);
$tSettings->insertSlot("NEWPASS1_LABEL", FormFieldTexts::NEW_PASSWORD);
$tSettings->insertSlot("NEWPASS2_LABEL", FormFieldTexts::CONFIRM_NEW_PASSWORD);
$tSettings->insertSlot("FOCUS_ID", $focusId);
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Edit Profile", $tSettings->output(), $jsExtra);
echo $t->output();
Example #9
0
 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" : "");
 }
Example #10
0
    if ($updateResult === false) {
        $error = "Could not delete booking. The server said: " . $db->error();
    } else {
        $error = "Booking deleted successfully!";
    }
}
$vals = array(1);
$types = 'i';
$q = "SELECT * from bookings WHERE statii_id = ? ORDER BY cdate DESC LIMIT 0,100";
$rows = $db->getRows($q, $vals, $types);
//var_dump($rows);
$results = '<table class="report"><tbody><tr class="headerRow"><td width="200">&nbsp;</td><td width="200">Client</td><td width="200">Email</td><td width="200">Make</td><td width="200">Regstration</td><td width="200">Depart</td><td width="200">Arrive</td><td width="200">Created</td><td width="100">Action</td></tr>';
$cnt = 1;
foreach ($rows as $row) {
    if ($cnt % 2) {
        $row_style = ' class="even"';
    } else {
        $row_style = ' class="odd"';
    }
    $results .= '<tr' . $row_style . '><td>' . $cnt . '</td><td>' . $row["first_name"] . ' ' . $row["last_name"] . '</td><td>' . $row["email"] . '</td><td>' . $row["make"] . '</td><td>' . $row["reg"] . '</td><td>' . $row["depart"] . '</td><td>' . $row["arrive"] . '</td><td>' . $row["cdate"] . '</td><td><a href="confirm_bookings.php?action=confirm&id=' . $row['bookings_id'] . '"><u>Confirm</u></a> | <a href="confirm_bookings.php?action=delete&id=' . $row['bookings_id'] . '"><u>Delete</u></a></td></tr>';
    $cnt++;
}
$results .= '</tbody></table>';
$submit = '<input id="submitButton" name="submitButton" type="submit" value="Submit" class="button_submit" /><span class="clear">&nbsp;</span>';
$tt->insertSlot("RESULTS", $results);
$tt->insertSlot("SUBMIT", $submit);
$tt->insertSlot("MESSAGE", $error ? "<span class=\"feedback_negative\">{$error}</span>" : "<span class=\"feedback_positive\">{$message}</span>");
// output
$jsExtra = JsWriter::scriptLink("js/jquery-1.4.2.min.js") . "\n" . JsWriter::scriptLink("js/report_search.js") . "\n" . JsWriter::scriptLink("js/datetimepicker_css.js");
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Report - search", $tt->output(), $jsExtra);
echo $t->output();
Example #11
0
$db = new Db();
$error = "";
$bookings_id = (int) $_GET["id"];
$save = (int) $_GET["save"] == 1;
$t = new Template($save ? "templates/print/save_single_booking.tpl.html" : "templates/print/print_single_booking2.tpl.html");
$q = "\nSELECT\nb.first_name AS first_name,\nb.last_name AS last_name,\nb.phone AS phone,\nb.make AS make,\nb.comment as comment,\nb.amount as amount,\nb.colour as colour,\nb.reg as reg,\nUNIX_TIMESTAMP(b.depart) as depart,\nUNIX_TIMESTAMP(b.arrive) as arrive,\nUNIX_TIMESTAMP(b.meet) as meet,\nb.flight as flight,\nb.payment_methods_id as payment_methods_id\nFROM bookings b\nWHERE b.bookings_id = {$bookings_id}\n";
$row = $db->getUniqueRowByQuery($q);
if (trim($_GET["id"]) == "") {
    $error = "Please supply bookings id as GET parameter \"id\"";
} else {
    if ($row === false) {
        $error = "Could not find booking with id {$bookings_id}";
    }
}
if ($error) {
    $t->insertSlot("VALID", urlencode($error));
    $t->insertSlot("CONTENT", "");
} else {
    $t->insertSlot("VALID", "valid");
    $t->insertSlot("INITIAL", strtoupper(substr($row["first_name"], 0, 1)));
    $t->insertSlot("SURNAME", $row["last_name"]);
    $t->insertSlot("MOBILE", $row["phone"]);
    $t->insertSlot("COMMENT", $row["comment"]);
    $t->insertSlot("AMOUNT", $row["amount"]);
    $t->insertSlot("MAKE", $row["make"]);
    $t->insertSlot("COLOUR", $row["colour"]);
    $t->insertSlot("REG", $row["reg"]);
    $t->insertSlot("DEPART_DATE", date("Y-m-d", $row["depart"]));
    $t->insertSlot("DEPART_TIME", date("H:i", $row["depart"]));
    $t->insertSlot("ARRIVAL_DATE", date("Y-m-d", $row["arrive"]));
    $t->insertSlot("ARRIVAL_TIME", date("H:i", $row["arrive"]));
Example #12
0
                    } else {
                        if ($halfdays <= 18) {
                            $quote = 150 + 12 * 90 + ($halfdays - 14) * 65;
                        } else {
                            if ($halfdays <= 52) {
                                $quote = $days * 90;
                            } else {
                                $quote = $days * 65;
                            }
                        }
                    }
                }
            }
        }
    }
}
if ($error) {
    $tt->insertSlot("MESSAGE", "<p>{$error}</p>");
} else {
    if ($quote) {
        $tt->insertSlot("MESSAGE", sprintf("<p>Quote total: <strong>R%s.00</strong> ({$departure_value} to {$arrival_value})</p>", $quote));
    } else {
        $tt->insertSlot("MESSAGE", '');
    }
}
$tt->insertSlot("BOOKINGS_DATA", $bookings_data);
$tt->insertSlot("ARRIVE_VALUE", $arrival_value);
$tt->insertSlot("DEPART_VALUE", $departure_value);
$tt->insertSlot("SUBMIT_LABEL", $submit_label);
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Rates", $tt->output(), $jsExtra);
echo $t->output();
Example #13
0
            $row_style = ' class="odd"';
        }
        $results .= '<tr' . $row_style . '><td>' . $row["client_name"] . '</td><td>' . $row["code"] . '</td><td>' . $row["discount"] . '%</td><td><a href="voucher_add.php?action=edit&id=' . $row['id'] . '"><u>EDIT</u></a></td><td><a href="voucher_add.php?action=delete&id=' . $row['id'] . '"><u>DELETE</u></a></td></tr>';
        $cnt++;
    }
    $results .= '</tbody></table>';
    $submit = '<input id="submitButton" name="submitButton" type="submit" value="Submit" class="button_submit" /><span class="clear">&nbsp;</span>';
}
$vals = array();
$types = '';
$q = "SELECT * from voucher_clients";
$rows = $db->getRows($q, $vals, $types);
$dropdown = '<select class="admin_text_input" id="voucher" name="voucher">';
foreach ($rows as $row) {
    if (isset($voucher_client) && $voucher_client == $row['id']) {
        $dropdown .= '<option value="' . $row['id'] . '" selected>' . $row['client_name'] . '</option>';
    } else {
        $dropdown .= '<option value="' . $row['id'] . '">' . $row['client_name'] . '</option>';
    }
}
$dropdown .= '</select>';
$tt->insertSlot("DROPDOWN", $dropdown);
$tt->insertSlot("RESULTS", $results);
$tt->insertSlot("VOUCHER_CODE", $voucher_code);
$tt->insertSlot("DISCOUNT", $discount);
$tt->insertSlot("SUBMIT", $submit);
$tt->insertSlot("MESSAGE", $error ? "<span class=\"feedback_negative\">{$error}</span>" : "<span class=\"feedback_positive\">{$message}</span>");
// output
$jsExtra = JsWriter::scriptLink("js/jquery-1.4.2.min.js") . "\n" . JsWriter::scriptLink("js/report_search.js") . "\n" . JsWriter::scriptLink("js/datetimepicker_css.js");
TemplateHelper::configurePage($t, Constants::SITE_NAME . " - Report - search", $tt->output(), $jsExtra);
echo $t->output();
Example #14
0
        // 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();
Example #15
0
require_once "classes/templatehelper.class.php";
require_once "classes/db.class.php";
require_once "classes/sessionhelper.class.php";
require_once "classes/jswriter.class.php";
require_once "classes/validationhelper.class.php";
require_once "classes/bookingshelper.class.php";
require_once "classes/utils.class.php";
$db = new Db();
$t = new Template("templates/admin_page.tpl.html");
$tt = new Template("templates/edit_booking.tpl.html");
$submitted = false;
$error = "";
$focusId = "first_name";
$bid = (int) $_GET["id"];
$clone = isset($_GET['clone']) ? (int) $_GET['clone'] : 0;
$tt->insertSlot("BOOKINGS_ID", $bid);
$tt->insertSlot("CLONE", $clone);
if ($_POST) {
    //echo '<pre>'; print_r($_POST); echo '</pre>';
    $submitted = true;
    $first_name = trim($_POST["first_name"]);
    $last_name = trim($_POST["last_name"]);
    $email = trim($_POST["email"]);
    $phone = trim($_POST["phone"]);
    $amount = trim($_POST["amount"]);
    $comment = trim($_POST["comment"]);
    $make = trim($_POST["make"]);
    $reg = trim($_POST["reg"]);
    $colour = trim($_POST["colour"]);
    $flight = trim($_POST["flight"]);
    $depart = trim($_POST["depart"]);