Exemplo n.º 1
0
<?php

require_once 'Autoloader.php';
// create a new controller for product deletions
$controller = new DeleteController();
// let the controller handle the request
$controller->handleRequest();
// render the page and print it
echo $controller->displayPage();
        echo OutlineController::handleLanguageChange($_POST["lang"]);
    } else {
        if (isset($_POST["logout"])) {
            echo FooterController::logout();
        } else {
            if (isset($_POST["productId"]) && isset($_POST["command"])) {
                $id = intval($_POST["productId"]);
                $cmd = $_POST["command"];
                $data = isset($_POST["data"]) ? $_POST["data"] : null;
                switch ($cmd) {
                    case CartModel::CMD_ADD:
                        CartController::addById($id, $data);
                        break;
                    case CartModel::CMD_REMOVE:
                        CartController::removeById($id);
                        break;
                    default:
                        Logger::error("unknown command '" . $cmd . "' for cart received!");
                }
            } else {
                if (isset($_POST["emailExists"])) {
                    echo RegisterController::checkEmail($_POST["emailExists"]);
                } else {
                    if (isset($_POST["deleteProduct"])) {
                        DeleteController::delete(intval($_POST["deleteProduct"]));
                    }
                }
            }
        }
    }
}