62 lines
1.9 KiB
PHP
62 lines
1.9 KiB
PHP
<?php
|
|
|
|
$VENDOR_FOLDER_NAME = 'vendor';
|
|
$APPLICATION_PATH = realpath(dirname(__FILE__) . '/../application');
|
|
$DEFAULT_ENV = (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
|
|
|
|
$subdomain = explode('.', $_SERVER['HTTP_HOST'])[0];
|
|
|
|
$DEFAULT_ENV = (preg_match('/test/', $subdomain)) ? 'staging' : $DEFAULT_ENV;
|
|
$DEFAULT_ENV = (preg_match('/dev/', $subdomain)) ? 'development' : $DEFAULT_ENV;
|
|
|
|
//Controllo se devo abilitare la modalità di sviluppo
|
|
/*if (function_exists('getRequestHeaders')) {
|
|
$headers = getRequestHeaders();
|
|
if (isset($headers['X-As-Dev-Pw']) && $headers['X-As-Dev-Pw'] == 'JackDev2590') {
|
|
if (isset($headers['X-As-Dev-On']) && $headers['X-As-Dev-On']) {
|
|
// $APPLICATION_PATH = realpath(dirname(__FILE__) . '/../applicationdev');
|
|
$DEFAULT_ENV = 'development';
|
|
}
|
|
}
|
|
}*/
|
|
|
|
// in produzione mostro solo gli errori e non i warning e i notice
|
|
error_reporting(E_ERROR);
|
|
if ($DEFAULT_ENV === 'development') {
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
|
}
|
|
|
|
defined('APPLICATION_PATH') || define('APPLICATION_PATH', $APPLICATION_PATH);
|
|
defined('APPLICATION_ENV') || define('APPLICATION_ENV', $DEFAULT_ENV);
|
|
|
|
// Ensure library/ is on include_path
|
|
set_include_path(implode(PATH_SEPARATOR, array(
|
|
get_include_path()
|
|
)));
|
|
|
|
require_once(APPLICATION_PATH . "/../$VENDOR_FOLDER_NAME/autoload.php");
|
|
|
|
/** Zend_Application */
|
|
require_once 'Zend/Application.php';
|
|
|
|
// Create application, bootstrap, and run
|
|
$application = new Zend_Application(
|
|
APPLICATION_ENV,
|
|
APPLICATION_PATH . '/configs/application.ini'
|
|
);
|
|
$application->bootstrap()
|
|
->run();
|
|
|
|
/*function getRequestHeaders()
|
|
{
|
|
$headers = array();
|
|
foreach ($_SERVER as $key => $value) {
|
|
if (substr($key, 0, 5) <> 'HTTP_') {
|
|
continue;
|
|
}
|
|
$header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
|
|
$headers[$header] = $value;
|
|
}
|
|
return $headers;
|
|
}*/
|