Example #1
0
/*-----------------------------------------------------*/
/*      _____           _               ___   ___      */
/*     |  __ \         | |             |__ \ / _ \     */
/*     | |__) |___  ___| |_ _   _ ___     ) | (_) |    */
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 15/10/2015 23:55               */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
use MealBooker\model\TimeFrame;
use MealBooker\models\dao\TimeFrameDao;
if (!SecurityManager::get()->getCurrentUser($_SESSION)->isAdmin()) {
    header('Location:' . WEB_PATH);
}
$timeFrameDao = new TimeFrameDao($em);
//save mode
if (isset($_POST['start']) && isset($_POST['id']) && isset($_POST['state'])) {
    $timeFrame = $timeFrameDao->getByPrimaryKey($_POST['id']);
    if ($timeFrame == null) {
        $timeFrame = new TimeFrame();
    }
    $timeFrame->setStart($_POST['start']);
    $timeFrame->setStatus($_POST['state']);
    $timeFrameDao->save($timeFrame);
    header('Location:' . WEB_PATH . '?page=admin&tab=timeframe');
}
//view Mode
Example #2
0
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 23/09/2015                     */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
?>
<header>
    <div class="hero">
        <div class="headings">
            <div class="container">
                <a href="<?php 
echo WEB_PATH;
?>
" class="brand"><img src="img/logo.png" alt="Aurore Traiteur" width="150"/></a>

                <p>
                    "Cuisiner suppose une tête légère, un esprit généreux et un coeur large" - Paul Gauguin
                </p>
            </div>
        </div>
        <?php 
if (isset($_SESSION) && SecurityManager::get()->isAuthentified($_SESSION)) {
    include 'nav.php';
}
?>
    </div>
</header>
Example #3
0
<?php

namespace MealBooker;

/*-----------------------------------------------------*/
/*      _____           _               ___   ___      */
/*     |  __ \         | |             |__ \ / _ \     */
/*     | |__) |___  ___| |_ _   _ ___     ) | (_) |    */
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 23/09/2015                     */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
require '../../config/global.php';
use MealBooker\manager\SecurityManager;
if (isset($_SESSION['auth'])) {
    SecurityManager::get()->logOutUser($_SESSION);
    unset($_SESSION['auth']);
}
session_regenerate_id();
header('Location: ' . WEB_PATH);
Example #4
0
        $user->setMail($_POST['mail']);
        $user->setPhoneNumber($_POST['phone']);
        $user->setOptIn(isset($_POST['optin']) ? true : false);
        $user->setStatus($_POST['state']);
        $role = $roleDao->getByPrimaryKey($_POST['role']);
        if ($role == null) {
            throw new Exception("une erreur est survenue -> 0x1");
        }
        $user->setRole($role);
        $user->setCompany($_POST['company']);
        //if already password save
        if (isset($_POST['password']) && strlen($_POST['password']) > 0) {
            if ($_POST['password'] != $_POST['passwordchk']) {
                throw new Exception("Le champs mot de passe et confirmation mot de passe doivent étre identiques");
            }
            $user->setPassword(SecurityManager::get()->hashPassword($_POST['password'], $user->getSalt()));
        } else {
            if ($user->getPassword() == null && strlen($_POST['password']) < 1) {
                throw new Exception("un mot de passe est requis");
            }
        }
        $userDao->save($user);
        header('Location:' . WEB_PATH . '?page=admin&tab=users');
    } catch (Exception $ex) {
        echo $error;
        $error = $ex->getMessage();
    }
}
//view Mode
if (isset($_GET['id'])) {
    $user = $userDao->getByPrimaryKey($_GET['id']);
Example #5
0
<?php

/*-----------------------------------------------------*/
/*      _____           _               ___   ___      */
/*     |  __ \         | |             |__ \ / _ \     */
/*     | |__) |___  ___| |_ _   _ ___     ) | (_) |    */
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 23/09/2015                     */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
use MealBooker\utils\Utils;
$user = SecurityManager::get()->getCurrentUser($_SESSION);
if (isset($user) && $user == null) {
    header('Location: ' . WEB_PATH);
}
?>
<div class="page-header">
    <h1>Mon compte</h1>
</div>
<div class="row">
    <div class="col-md-6">
        <strong>Nom :</strong> <?php 
echo $user->getFirstName();
?>
<br>
        <strong>Prénom :</strong> <?php 
echo $user->getLastName();
Example #6
0
<?php

/*-----------------------------------------------------*/
/*      _____           _               ___   ___      */
/*     |  __ \         | |             |__ \ / _ \     */
/*     | |__) |___  ___| |_ _   _ ___     ) | (_) |    */
/*     |  _  // _ \/ __| __| | | / __|   / / \__, |    */
/*     | | \ \  __/ (__| |_| |_| \__ \  / /_   / /     */
/*     |_|  \_\___|\___|\__|\__,_|___/ |____| /_/      */
/*                                                     */
/*                Date: 23/09/2015                     */
/*                 All right reserved                  */
/*-----------------------------------------------------*/
use MealBooker\manager\SecurityManager;
require_once '../../config/global.php';
$error = null;
$info = null;
if (isset($_POST) && isset($_POST['login']) && isset($_POST['password'])) {
    $login = $_POST['login'];
    $password = $_POST['password'];
    if (SecurityManager::get()->authentificate($login, $password) != null) {
        header('Location: ' . WEB_PATH);
    } else {
        header('Location: ' . WEB_PATH . '?error=authError');
    }
}
Example #7
0
">Menus</a>
            </li>
            <li>
                <a href="<?php 
echo WEB_PATH;
?>
?page=account">Mon compte</a>
            </li>
            <li>
                <a href="<?php 
echo WEB_PATH;
?>
?page=cart">Mon panier</a>
            </li>
            <?php 
if (SecurityManager::get()->isAdmin($_SESSION)) {
    ?>
                <li>
                    <a href="<?php 
    echo WEB_PATH;
    ?>
?page=admin">Administration</a>
                </li>
                <?php 
}
?>
            <li class="log-out">
                <a href="<?php 
echo WEB_PATH;
?>
security/signout.php">Déconnexion</a>
Example #8
0
}
/** SYSTEM CONSTANT */
define('WEB_PATH', APP_PATH . 'web/');
define('LIB_DIR', dirname(__FILE__) . '/../lib/');
define('CFG_DIR', dirname(__FILE__) . '/');
define('CSS_DIR', dirname(__FILE__) . '/../css/');
define('WEB_DIR', dirname(__FILE__) . '/../web/');
define('HTML_DIR', dirname(__FILE__) . '/../html/');
define('ROOT_DIR', dirname(__FILE__) . '/../');
define('FILE_DIR', ROOT_DIR . '/files/');
/** USEFULL CONSTANT */
define('STOPBOOKINGHOUR', 18);
define('STOPBOOKINGMINUTE', 00);
define('STARTBOOKINGHOUR', 07);
define('STARTBOOKINGMINUTE', 00);
if (!file_exists(FILE_DIR)) {
    mkdir(FILE_DIR);
}
require_once ROOT_DIR . "/vendor/autoload.php";
// database configuration parameters
$devConn = array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => '', 'dbname' => 'mealbooker', 'charset' => 'utf8');
$conn = array('driver' => 'pdo_mysql', 'host' => '', 'user' => '', 'password' => '', 'dbname' => '', 'charset' => 'utf8');
//mailerconfig
$mailConfig = ['serversmtp' => 'SSL0.OVH.NET', 'SMTPAuth' => true, 'Username' => '*****@*****.**', 'Password' => 'Mail4Contact', 'SMTPSecure' => 'ssl', 'Port' => 465, 'from' => '*****@*****.**'];
// obtaining the entity manager
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/../classes/"), true);
$em = EntityManager::create(DEV_MOD ? $devConn : $conn, $config);
$securityMananger = SecurityManager::init($em);
$mailManager = MailManager::init($em, $mailConfig);
$gDao = new GenericDao($em);
$configDao = new ConfigDao($em);
Example #9
0
                $meal->setDrink($drink);
            }
            if ($dessert != null) {
                $meal->setDessert($dessert);
            }
            $meal->setCourse($course);
            $meal->setOrder($order);
            array_push($mealArray, $meal);
        }
    }
    $order->setMeals($mealArray);
    $orderDao->save($order);
    if (isset($_SESSION['mealCart'])) {
        unset($_SESSION['mealCart']);
    }
    MailManager::get()->sendOrderConfirmation(SecurityManager::get()->getCurrentUser($_SESSION), $order);
} else {
    header('Location : ' . WEB_PATH);
}
?>
<div class="success">
    <i class="fa fa-check-circle"></i>

    <h1>Votre commande est validée!</h1>

    <p>
        Votre commande de repas est validée, vous allez recevoir un mail récapitulatif de votre commande.
        <br>
        A bientôt sur Aurore Traiteur
    </p>
    <a href="<?php 
Example #10
0
        }
    } catch (Exception $ex) {
        $error = $ex->getMessage();
    }
} else {
    if (isset($_POST['restorepassword']) && sizeof($_POST['restorepassword']) > 0 && isset($_POST['token']) && sizeof($_POST['token']) > 0) {
        //token and new password validation
        try {
            $password = $_POST['restorepassword'];
            $token = $_POST['token'];
            $userDao = new UserDao($em);
            $user = $userDao->getByRestoreToken($token);
            if ($user != null) {
                //unset token and save new password
                $user->setRestoreToken(null);
                $user->setPassword(SecurityManager::hashPassword($password, $user->getSalt()));
                $userDao->save($user);
                $message = 'Votre mot de passe est validé, vous pouvez maintenant vous <a href="' . WEB_PATH . '">connecter</a>';
            } else {
                throw new Exception("Une erreur est survenue");
            }
        } catch (Exception $ex) {
            $error = $ex->getMessage();
        }
    } else {
        if (isset($_GET['token']) && sizeof($_GET['token']) > 0) {
            //query validation
            try {
                $token = $_GET['token'];
                $userDao = new UserDao($em);
                $user = $userDao->getByRestoreToken($token);
Example #11
0
}
?>
    <!DOCTYPE html>
    <html>
    <?php 
include 'head.php';
?>
    <body>
    <?php 
include 'header.php';
?>
    <div class="main container">
        <div class="row">
            <?php 
if (SecurityManager::get()->isAuthentified($_SESSION)) {
    if ($maintenance && !SecurityManager::get()->getCurrentUser($_SESSION)->isAdmin()) {
        include 'security/maintenance.php';
    } else {
        if (isset($_GET['page'])) {
            switch ($_GET['page']) {
                case 'meal':
                    include 'meal.php';
                    break;
                case 'courses':
                    include 'courses.php';
                    break;
                case 'cart':
                    include 'cart.php';
                    break;
                case 'account':
                    include 'account.php';