<?php // enables sessions for the entire app session_start(); require_once "controller/CustomerController.php"; require_once "controller/AnonymousController.php"; define("BASE_URL", $_SERVER["SCRIPT_NAME"] . "/"); define("IMAGES_URL", rtrim($_SERVER["SCRIPT_NAME"], "index.php") . "../static/images/"); define("CSS_URL", rtrim($_SERVER["SCRIPT_NAME"], "index.php") . "../static/css/"); $path = isset($_SERVER["PATH_INFO"]) ? trim($_SERVER["PATH_INFO"], "/") : ""; $urls = ["" => function () { if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") { ViewHelper::redirect(BASE_URL . "customer"); } else { AnonymousController::products(); } }, "customer/registration" => function () { if (isset($_GET['email']) && isset($_GET['key'])) { $reg_success = AnonymousController::checkRegistration(); if ($reg_success) { CustomerController::setActiveUser(); echo ViewHelper::render("view/customer-message.php", ["message" => "Registracija uspešna! Lahko se sedaj prijavite."]); } else { echo ViewHelper::render("view/customer-message.php", ["message" => "Registracija neuspešna! Vpišite pravi registracijski naslov."]); // AnonymousController::registrationUnsuccessful(); } } else { AnonymousController::registration(); } }, "customer/rating" => function () { CustomerController::addRating();