Пример #1
0
<?php

require_once "RouterControllerInterface.php";
require_once "RouterController.php";
// Ugly load of controllers
require_once "controllers/IndexController.php";
require_once "controllers/ContactController.php";
$router = new RouterController();
$router->run();
Пример #2
0
<?php

session_start();
//zapnutie uvodnej session
mb_internal_encoding("UTF-8");
//interne php kodovanie UTF-8
function autoloadFunction($class)
{
    #konci nazov triedy na "controler" ?
    if (preg_match('/Controller$/', $class)) {
        require "controllers/" . $class . ".php";
    } else {
        require "models/" . $class . ".php";
    }
}
spl_autoload_register('autoloadFunction');
//funkcia autoload
Database::connect("127.0.0.1", "root", "", "cms_db");
//pripojenie sa k databaze
$router = new RouterController();
//vytvorenie smerovaca URL adries
$router->process(array($_SERVER['REQUEST_URI']));
//spracovanie aktualnej URL
$router->outputView();
//vyrenderovanie sablony
Пример #3
0
<?php

define('BASE_DIR', __DIR__ . '/');
define('INCLUDE', 1);
header('Strict-Transport-Security: max-age=31536000; includeSubDomains; preload');
ini_set('session.cookie_lifetime', '0');
if (!file_exists('common/config.php')) {
    throw new Exception("Zaváděcí soubor neexistuje.");
} else {
    require_once 'common/config.php';
}
function AutoLoadFunction($class)
{
    $class = ucfirst($class);
    $parse_url = array($_SERVER['REQUEST_URI']);
    $path = parse_url($parse_url[0]);
    $parts = explode("/", substr($path['path'], 1));
    if ($parts[0] == 'app') {
        preg_match('/Controller$/', $class) ? require "application/controllers/{$class}.php" : (require "common/models/{$class}.php");
    } else {
        // get form public folder in otherwise ...
        preg_match('/Controller$/', $class) ? require "public/controllers/{$class}.php" : (require "common/models/{$class}.php");
    }
}
spl_autoload_register("AutoloadFunction");
$controller = new RouterController();
$controller->Treat(array(REQ_URI));
Пример #4
0
<?php

// включим отображение всех ошибок
ini_set('display_errors', 1);
error_reporting(E_ALL);
// подключаем конфиг
include 'config.php';
//библиотеки
include_once 'lib/Smarty/Smarty.class.php';
// Соединяемся с БД
$dbObject = DbController::getConection();
if (!$dbObject) {
    exit('Unable to connect to database');
}
//начать сессию
$sessObject = new SessionController($dbObject);
$sessError = $sessObject->start();
// Загружаем router
$router = new RouterController($dbObject);
$routerError = $router->run();
$contentObj = new ContentController($dbObject);
$content = $contentObj->display($sessError, $routerError);
Пример #5
0
        Db::connect(DB_SERVER_PROD, DB_LOGIN_PROD, DB_PASSWORD_PROD, DB_DATABASE_PROD);
    } else {
        Db::connect(DB_SERVER_LOCAL, DB_LOGIN_LOCAL, DB_PASSWORD_LOCAL, DB_DATABASE_LOCAL);
    }
} catch (PDOException $e) {
    if (!$useProduction) {
        echo $e->getMessage();
    }
    require "views/DBerror.html";
    die;
}
//for corrent Nginx payment processing
if (!function_exists('apache_request_headers')) {
    function apache_request_headers()
    {
        $out = [];
        foreach ($_SERVER as $key => $value) {
            if (substr($key, 0, 5) == "HTTP_") {
                $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
                $out[$key] = $value;
            } else {
                $out[$key] = $value;
            }
        }
        return $out;
    }
}
$router = new RouterController('en');
//set default language
$router->process([$_SERVER['REQUEST_URI']]);
$router->render();
Пример #6
0
 */
mb_internal_encoding("utf-8");
spl_autoload_register("autoload");
session_start();
KeyConfigLoader::selectFile("main");
require_once "dependencies.php";
if (KeyConfigLoader::getValue("auto-index-libraries") == "true") {
    LibLoader::indexLibraries();
}
if (KeyConfigLoader::getValue("auto-load-libraries") == "true") {
    LibLoader::loadAll();
}
if (KeyConfigLoader::getValue("auto-index-layouts") == "true") {
    LayoutManager::indexLayouts();
}
$router = new RouterController();
$router->process($_SERVER['REQUEST_URI']);
$router->createView();
function autoload($class)
{
    if (strpos($class, "Controller") !== false) {
        require_once "controllers/{$class}.php";
    } else {
        require_once "models/{$class}.php";
    }
}
function kill($var)
{
    var_dump($var);
    die;
}
Пример #7
0
<?php

session_start();
require 'libs/dibi/dibi.php';
require 'config.php';
function autoload($class)
{
    // Končí název třídy řetězcem "Kontroler" ?
    if (preg_match('/Controller$/', $class)) {
        require "controllers/" . $class . ".php";
    } else {
        if (file_exists("models/" . $class . ".php")) {
            require "models/" . $class . ".php";
        } else {
            require "models/objects/" . $class . ".php";
        }
    }
}
spl_autoload_register("autoload");
$router = new RouterController();
$router->route(array($_SERVER['REQUEST_URI']));
$router->render_view();