Example #1
0
<?php

/**
 * Handles password resetting
 */
require 'includes/global.inc.php';
//debug(1, 1, 1);
$page = Page::get_from_alias('forgot');
if ($_REQUEST['forgot-email']) {
    $email = strtolower($_POST['forgot-email']);
    if ($krustomer = Customer::get_from_email($email)) {
        // email found
        $status = 1;
        $mail = new Email();
        $mail->AddAddress($krustomer->Email, $krustomer->full_name);
        $mail->Subject = 'Madison & Rayne Password Reset';
        // Creates a reset token
        $reset_token = Customer::create_reset_token($krustomer->Email);
        $insert_array = array('CustomerID' => $krustomer->CustomerID, 'token_id' => $reset_token, 'expires' => date("Y-m-d H:i:s", time() + 60 * 60));
        dbi()->insert('password_reset_requests', $insert_array);
        $mail->MsgHTML("<p>We have received a request to reset the password for your Madison & Rayne account.\n                        If you did not request that your password be reset, you can ignore this email.</p>\n                        <p>To reset your password, please click on the link below.  Simply enter a new password\n                        of your choice.  You will have one hour to reset your password before the link will no longer work.</p>\n                        <p>If you have any questions, please contact us at\n                        <a href='mailto:info@madisonandrayne.com'>info@madisonandrayne.com</a> or 1-855-626-3701. Thank you!</p>\n                        <p><a href='" . SITE_URL . "/forgot?token_id=" . $reset_token . "'>" . SITE_URL . "/forgot?token_id=" . $reset_token . "</a></p>");
        $mail->Send();
        Gadget::add_message('An email has been sent to you with a link to reset your password.');
        Gadget::redirect('index');
        die;
    } else {
        // no email found
        Gadget::add_message('That email address was not found.');
    }
} elseif (isset($_REQUEST['token_id'])) {
    $_REQUEST = clean_input($_REQUEST);
                    }
                }

                //Gadget::add_message('success');
                Gadget::redirect('success2');
            } else {
                Gadget::add_message($transaction->get_error_message());
            }
        } catch (Exception $e) {
            s('Error: ' . $e->getMessage() . $transaction->get_error_message());
            Gadget::add_message($e->getMessage() . $transaction->get_error_message());
        }
    }
}

$page = Page::get_from_alias('giftcertificates');
$page->add_js('/js/giftcertificates.js');

require 'header.php';
?>
<div class="content-padding">
    <div><?php echo $page->content['main']; ?></div>
    <form class="user-form" name="giftcertificates-form" id="checkout-form" action="giftcertificates" method="post" onsubmit="return validateForm();">
        <table>
            <tbody>
                <tr style="vertical-align:top;">
                    <td>
                        <table style="margin-right:20px;">
                            <tbody>
                                <tr>
                                    <td colspan="2">
Example #3
0
    Co-Founders, Madison &amp; Rayne<br />
</p>
EOT;
                    $email->MsgHTML($body);
                    $email->Send();
                    unset($_SESSION['new_order']);
                }
            }
            Gadget::redirect('success');
        } catch (Exception $e) {
            s('Error: ' . $e->getMessage() . $transaction->get_error_message());
            Gadget::add_message($e->getMessage() . $transaction->get_error_message());
        }
    }
}
$page = Page::get_from_alias('checkout');
$page->add_js('/js/checkout.js');
require 'header.php';
?>
<div class="content-padding">
    <div><?php 
echo $page->content['main'];
?>
</div>
    <form class="user-form" name="checkout-form" id="checkout-form" action="checkout" method="post" onsubmit="return validateForm();">
        <table>
            <tbody>
                <tr style="vertical-align:top;">
                    <td>
                        <table>
                            <tbody>
Example #4
0
<?php

/**
 * @author Brad Jorgensen <*****@*****.**>
 */
require 'includes/global.inc.php';
debug(0, 0, 0);
$page = Page::get_from_alias('contact');
if ($_POST) {
    $errors = array();
    $email_addr = trim($_POST['contact-email']);
    $message = strip_tags(stripslashes($_POST['contact-message']));
    if (!$email_addr) {
        $errors[] = 'no email address provided';
    } elseif (!preg_match('/^[A-Z0-9._%+-]+\\@[A-Z0-9.-]+\\.[A-Z]{2,4}(\\.[A-Z]{2,4})?$/i', $email_addr)) {
        $errors[] = 'invalid email address';
    }
    if (!$message) {
        $errors[] = 'no message provided';
    }
    if ($errors) {
        Gadget::add_message(implode(', ', $errors));
    } else {
        $insert_data = array('Email' => $email_addr, 'Message' => $message);
        $dbi->insert('Contact', $insert_data);
        //$to_address     = '*****@*****.**';
        $to_address = '*****@*****.**';
        $email = new Email(true);
        $email->AddAddress($to_address);
        $email->Subject = 'Contact Us Submission';
        $body = '<p>The following message was submitted from the Contact Us form by ' . $email_addr . ':</p>' . htmlspecialchars($message);
Example #5
0
<?php
require 'includes/global.inc.php';
//debug(1, 1, 1);
debug(0, 0, 0);

$page = Page::get_from_alias('index');
$page->body_class = "background";

require 'header.php';
?>
<div class="foodphoto">
    <img src="images/home-image-rediscover.jpg" width="998" height="451" />
</div>
<div class="homebottom">
    <div>
        <div class="bottomleft">
            <h1>ideas on the table</h1>
            <div class="homerecipe">
                <?php
                    $ideas = $dbi->q_all("SELECT * FROM Ideas WHERE Active = '1' ORDER BY Sequence ASC");
                    foreach($ideas as $idea){
                        echo "<a href='$idea->Link'>$idea->Text</a><br />";
                    }
                ?>
                <div class="homerecipebutton">
                    <a href="menu">Check out this week's menu</a>
                </div>
            </div>
        </div>
        <div class="bottomright">
            <div class="chefprogrambutton">
Example #6
0
    } else { // empty order, just clear it here
        /*$order->PromoCodeID = $PromoCodeID;
        $order->DeliveryDate = Gadget::$date_do->format(DATE_FORMAT_MYSQL);
        $order->CustomerID = $krustomer->CustomerID;

        foreach ($meals as $key => $value) {
            $order->add_meal($key, (int) $value['n'], (int) $value['v'], '0');
        }

        $order->insert();*/
    }
    Access::protect_page();
}


$page = Page::get_from_alias('menu');
$page->add_css('/css/menu.css');
$page->add_js('/js/menu-sydcon.js');

require 'header.php';

$_date_ob = clone Gadget::$date_ob;
$_date_do = clone Gadget::$date_do;

switch ($_date_ob->format(DATE_FORMAT_MYSQL)) {
    case '2013-12-21':
        $_date_ob->setDate('2013', '12', '20');
        $_date_do->setDate('2013', '12', '23');
        break;
    case '2013-12-28':
        $_date_ob->setDate('2013', '12', '27');
Example #7
0
<?php

/**
 * @author Brad Jorgensen <*****@*****.**>
 */
require 'includes/global.inc.php';
debug(0, 0, 0);
Access::protect_page();
$page = Page::get_from_alias('preferences');
$page->add_js('/js/myorder.js');
$page->add_js('slider');
$krustomer = Customer::get_current();
if ($_POST) {
    $errors = array();
    $data = clean_input($_POST);
    if ($errors) {
        Gadget::add_message(implode(', ', $errors));
    } else {
        //@todo this needs protection
        //@todo put this stuff in a class
        foreach ($data as $key => $value) {
            if (strpos($key, 'like_') === 0) {
                $insert_data = array('LikeID' => (int) substr($key, 5), 'CustomerID' => $_SESSION['CustomerID'], 'Value' => (int) $value);
                $odu = array('Value' => (int) $value);
                $dbi->insert('CustomerLikes', $insert_data, $odu);
            }
        }
        $krustomer->Allergies = $data['Allergies'];
        $krustomer->Want = implode(',', clean_input($_POST['Want']));
        $krustomer->DontWant = implode(',', clean_input($_POST['DontWant']));
        $krustomer->Comments = $data['Comments'];
Example #8
0
<?php
/**
 * @author Brad Jorgensen <*****@*****.**>
 */
require 'includes/global.inc.php';
debug(0, 0, 0);

$krustomer = Customer::get_current();

$page = Page::get_from_alias('success');

$date = Gadget::$date_do->format(DATE_FORMAT_MYSQL);

require 'header.php';
?>
<div class="content-padding">
    <div><?php echo $page->content['main']; ?></div>
    <h3>Order details</h3>
    <p>
        <?php
        if (isset($_SESSION['successWeekly'])) {
            echo '<h5>Weekly Meals</h5>';
            $allOrders = array();
            foreach ($_SESSION['successWeekly'] as $orderID) {
                $order       = Order::get_from_id($orderID);
                $allOrders[] = $order;
                echo $order->get_meal_rows();
            }

        } else if ($OrderID = $dbi->q_1("SELECT OrderID FROM Orders WHERE DeliveryDate = '$date' AND CustomerID = '$krustomer->CustomerID' ORDER BY OrderID DESC")->OrderID) {
            $order = Order::get_from_id($OrderID);
Example #9
0
<?php
require 'includes/global.inc.php';
debug(0, 0, 0);

Access::protect_page();

$page = Page::get_from_alias('myorder');
$page->add_js('/js/myorder.js');
$page->add_js('slider');

$krustomer = Customer::get_current();

if ($_POST) {
    $errors = array();

    $data            = clean_input($_POST);
    $currentPassword = $_POST['current-password'];
    $newPassword     = $_POST['new-password'];
    $confirmPassword = $_POST['confirm-password'];

    $wants_to_change_pass = ($currentPassword || $newPassword || $confirmPassword);

    if ($wants_to_change_pass) {
        if ($currentPassword) {
            if ($newPassword) {
                if ($newPassword === $confirmPassword) {
                    if (Access::check_password($currentPassword, $krustomer->CustomerID)) {
                        // current password is correct and new passwords match
                    } else {
                        $errors[] = 'The current password you entered is not correct.';
                    }
Example #10
0
<?php

/**
 * For making changes to the login without effecting the live environment as there is no dev environment
 * All files labeled -sydcon are of the same variety
 */
require 'includes/global.inc.php';
debug(0, 0, 0);
$page = Page::get_from_alias('login');
if ($_POST) {
    $errors = array();
    $email = trim($_POST['login-email']);
    $password = $_POST['login-password'];
    if (!$email) {
        $errors[] = 'no email address provided';
    } elseif (!preg_match('/^[A-Z0-9._%+-]+\\@[A-Z0-9.-]+\\.[A-Z]{2,4}(\\.[A-Z]{2,4})?$/i', $email)) {
        $errors[] = 'invalid email address';
    }
    if (!$password) {
        $errors[] = 'no password provided';
    }
    if ($errors) {
        Gadget::add_message(implode(', ', $errors));
    } else {
        switch (Access::log_user_in($email, $password)) {
            case 0:
                // shouldn't get here, should be redirected
                $message = 'You have been logged in.';
                break;
            case 1:
                $message = 'incorrect password';
Example #11
0
<?php

/**
 * Handles most pages that are in the database
 * 
 * @author Brad Jorgensen <*****@*****.**>
 * @package SDBIC
 */
require 'includes/global.inc.php';
debug(0, 0, 0);
if ($_GET['id']) {
    $page = Page::get_from_id((int) $_GET['id']);
} elseif ($_GET['q']) {
    $page = Page::get_from_alias($dbi->escape($_GET['q']));
}
if (!$page) {
    $page = Page::get_from_alias('404');
    header("HTTP/1.0 404 Not Found");
}
include 'header.php';
echo $page->content['main'];
include 'footer.php';
Example #12
0
            }
        }

        $_SESSION['subscription_update'] = array(
            'WeeklyMeals' => (int) $_POST['WeeklyMeals'],
            'WeeklyReg'   => (int) $_POST['WeeklyReg'],
            'WeeklyVeg'   => (int) $_POST['WeeklyVeg'],
            'PromoCodeID' => $PromoCodeID,
        );

        Gadget::redirect('preferences');
    }
    Gadget::add_message('Please select the number of meals and servings per week.');
}

$page = Page::get_from_alias('tasting');
$page->add_css('/css/menu.css');
$page->add_js('/js/tasting.js');

require 'header.php';
?>
<div id="content-header">
    <div id="content-header-left">
        <p class="header-p">
            our chef selects meals for you<br />
            from weekly menu plus new exclusive dishes<br />
            15% off our regular pricing, 4-week minimum
        </p>
        <div class="title">
            chef's tasting
        </div>
Example #13
0
<?php

require 'includes/global.inc.php';
debug(0, 0, 0);

$page = Page::get_from_alias('register');
$page->add_js('js/register.js');

if($_POST){
    $email     = strtolower(trim($_POST['register-email']));
    $password  = $_POST['register-password'];
    $password2 = $_POST['confirm-password'];
    $zip       = $_POST['register-zip'];

    $validation = new Validation();
    $validation->validate_array(array(
        array(
            'name'     => 'Email',
            'value'    => $email,
            'match'    => '/^[A-Z0-9._%+-]+\@[A-Z0-9.-]+\.[A-Z]{2,4}(\.[A-Z]{2,4})?$/i',
            'required' => true,
        ),
        array(
            'name'     => 'Password',
            'value'    => $password,
            'required' => true,
        ),
        array(
            'name'     => 'Password Confirmation',
            'value'    => $password2,
            'required' => true,