/** This is the standard way to initialize an application
  *
  * @param 	string	location of the configuration file
  *
  * @return this application object
  */
 public static function init($configFile)
 {
     self::$instance = new vB5_Frontend_ApplicationLight();
     $config = vB5_Config::instance();
     $config->loadConfigFile($configFile);
     $corePath = vB5_Config::instance()->core_path;
     //this will be set by vb::init
     //define('CWD', $corePath);
     define('CSRF_PROTECTION', true);
     define('VB_AREA', 'Presentation');
     require_once $corePath . "/vb/vb.php";
     vB::init();
     vB::setRequest(new vB_Request_WebApi());
     self::ajaxCharsetConvert();
     return self::$instance;
 }
Exemple #2
0
// Check for cached image calls to filedata/fetch?
if (isset($_REQUEST['routestring']) and $_REQUEST['routestring'] == 'filedata/fetch' and (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) and !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) or isset($_SERVER['HTTP_IF_NONE_MATCH']) and !empty($_SERVER['HTTP_IF_NONE_MATCH']))) {
    // Don't check modify date as URLs contain unique items to nullify caching
    $sapi_name = php_sapi_name();
    if ($sapi_name == 'cgi' or $sapi_name == 'cgi-fcgi') {
        header('Status: 304 Not Modified');
    } else {
        header('HTTP/1.1 304 Not Modified');
    }
    exit;
}
require_once 'includes/vb5/autoloader.php';
vB5_Autoloader::register(dirname(__FILE__));
//For a few set routes we can run a streamlined function.
if (vB5_Frontend_ApplicationLight::isQuickRoute()) {
    $app = vB5_Frontend_ApplicationLight::init('config.php');
    if ($app->execute()) {
        exit;
    }
}
$app = vB5_Frontend_Application::init('config.php');
//todo, move this back so we can catch notices in the startup code. For now, we can set the value in the php.ini
//file to catch these situations.
// We report all errors here because we have to make Application Notice free
error_reporting(E_ALL | E_STRICT);
$config = vB5_Config::instance();
if (!$config->report_all_php_errors) {
    // Note that E_STRICT became part of E_ALL in PHP 5.4
    error_reporting(E_ALL & ~(E_NOTICE | E_STRICT));
}
$routing = $app->getRouter();