Exemple #1
0
<?php

/**
 * FILE: Init.php
 *
 * @AUTHOR: LTD shalvasoft
 * @AUTHOR: Shalva Kvaratskhelia
 * PROJECT: MVC
 * VERSION: 1.0.0
 */
require_once 'config/defines.php';
require_once 'config/processors.php';
$confFile = dirname(dirname(__FILE__)) . '/application/config/config.php';
if (file_exists($confFile)) {
    /** @noinspection PhpIncludeInspection */
    require_once $confFile;
}
require_once 'Api/AutoloadManager/autoloadManager_interface.php';
require_once 'Api/AutoloadManager/autoloadManager.php';
$autoloadManager = new autoloadManager();
/** @noinspection PhpInternalEntityUsedInspection */
$autoloadManager->setSaveFile(system_dir() . '/Cache/autoload.php');
$autoloadManager->register();
$autoloadManager->addFolder(system_dir());
$autoloadManager->excludeFolder(system_dir() . '/Api/AutoloadManager');
$autoloadManager->generate();
$app = new bootstrap();
$app->Init();
Exemple #2
0
<?php

header('Content-Type=text/html; charset=UTF-8');
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
//set_error_handler("exception_error_handler");
require_once dirname(__FILE__) . '/../conf/configuration_front.php';
require_once dirname(__FILE__) . '/../core/autoloadManager.php';
autoloadManager::setSaveFile(dirname(__FILE__) . '/../tmp/front.php');
autoloadManager::addFolder(CORE);
autoloadManager::addFolder(BUSINESS);
spl_autoload_register('autoloadManager::loadClass');
$_REQUEST['controller'] = Toolbox::getArrayParameter($_REQUEST, 'controller', 'Feed');
$_REQUEST['action'] = Toolbox::getArrayParameter($_REQUEST, 'action', 'index');
// jquery based ajax application
$from = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'XMLHttpRequest' === $_SERVER['HTTP_X_REQUESTED_WITH'] ? 'ajax' : 'http';
try {
    $front = frontDispatcher::getInstance();
    // Init Session
    // Save header for ajax call, so that we can either root or return false for ajax calls
    $actions = AccessHelper::getActions();
    // authenticate
    $AuthManager = new AuthManager($actions);
    $AuthManager->authenticate($front, '/?controller=Feed&action=index', $from);
    // Inject Dynamically changing objects
    $Container = ContainerFactory::get('front');
    $Container['Access'] = $actions;
    $Container['AuthManager'] = $AuthManager;
    $Container['Request'] = $_REQUEST;