ACC SHELL

Path : /srv/www/vhosts/alfa-com/
File Upload :
Current File : /srv/www/vhosts/alfa-com/bootstrap.php

<?php
	ini_set('display_errors', true);
	error_reporting(E_ALL);
	if (!defined('DEV'))
		define('DEV', false);
		
	$GLOBALS['site']['testDataUrl']				= 'http://www.poski.cz/.test-data/';
	list($GLOBALS['site']['localeDefault'])		= array_slice($GLOBALS['site']['locales'], 0, 1);
	$GLOBALS['site']['server']					= strtolower((isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']));
	if (!preg_match('~^(.*)\.([a-zA-Z0-9_-]+\.\w+)(:\d+)?$~', $GLOBALS['site']['server'], $server_matches))
		$server_matches = array(null, 'www', $GLOBALS['site']['devDomain'], ':81');
	$GLOBALS['site']['domain']					= $server_matches[2];
	$GLOBALS['site']['virtualDomain']			= $GLOBALS['site']['domain'];
	if (@$GLOBALS['site']['path'] === null)
		$GLOBALS['site']['path']				= str_replace(strtr($_SERVER['DOCUMENT_ROOT'], '\\', '/'), '', strtr(dirname(__FILE__), '\\', '/')) . '/';
	$GLOBALS['site']['url']						= (($_SERVER['SERVER_PORT'] == '443') ? 'https://' : 'http://') . $GLOBALS['site']['server'] . $GLOBALS['site']['path'];
	$GLOBALS['site']['base']					= array(strtr(substr(__FILE__, 0, strlen(__FILE__) - strlen('bootstrap.php')), '\\', '/'));
	$GLOBALS['site']['data']					= $GLOBALS['site']['base'][0] . 'data/';

	$include_paths = array();
	$include_paths[]							= $GLOBALS['site']['base'][0];
	$include_paths[]							= $GLOBALS['site']['base'][0] . 'engine/';
	$include_paths[]							= $GLOBALS['site']['base'][0] . 'third-party/';
	$include_paths[]							= $GLOBALS['site']['base'][0] . 'third-party/PEAR/';

	if (DEV)
	{
		$temp0 = (($GLOBALS['site']['server'] == ('www.'.$GLOBALS['site']['devDomain'])) || ($GLOBALS['site']['server'] == $GLOBALS['site']['devDomain']));
		if (preg_match('/^.+\.'.$GLOBALS['site']['devDomain'].'$/', $GLOBALS['site']['server']) && !$temp0)
		{
			$GLOBALS['site']['virtualDomain']		= $server_matches[1];
			//$GLOBALS['page']['siteTitle']			= ' (' . $GLOBALS['site']['virtualDomain'] . ')';
			/*if ($temp = trim($GLOBALS['site']['path'], '/'))
				$GLOBALS['page']['siteTitle']		= ' (' . $temp . ')';*/
			if (strpos(ini_get('open_basedir'), $GLOBALS['site']['devDomain'].':') !== false)
			{
				$temp 									= '/var/www/vhosts/'.$GLOBALS['site']['devDomain'].'/httpdocs/';
				$GLOBALS['site']['base'][]				= $temp;
				$include_paths[]						= $temp;
				$include_paths[]						= $temp . 'engine/';
				$include_paths[]						= $temp . 'third-party/';
				$include_paths[]						= $temp . 'third-party/PEAR/';
			}
		}
		if ($temp0)
			$GLOBALS['site']['tablePrefix']			= '0__';
		if (strpos($GLOBALS['site']['dsn'], '/'.strtr($GLOBALS['site']['devDomain'], '.', '_').':') !== false) // devel database
			$GLOBALS['site']['tablePrefix']			= str_replace(array('test/', '', '/', '.', '-'), array('', '', '_', '', ''), $GLOBALS['site']['virtualDomain'] . rtrim($GLOBALS['site']['path'], '/')) . '__';
	}

	if (strpos($_SERVER['HTTP_HOST'], 'localhost') === false)
	{
		session_name('PHPSESSID-' . strtr($GLOBALS['site']['virtualDomain'], '.', '_'));
		session_set_cookie_params(4*60*60, $GLOBALS['site']['path'], '.'.$GLOBALS['site']['domain']);
	}
	set_include_path(implode(PATH_SEPARATOR, $include_paths)/* . PATH_SEPARATOR . ini_get('include_path')*/);
	define('BASE', $GLOBALS['site']['base'][0]);
	define('DATA', $GLOBALS['site']['data']);
	
/****************************************************************************************************************/

	$GLOBALS['page']['locale']					= null;
	$GLOBALS['page']['location']				= null;
	$GLOBALS['page']['directory']				= null;
	$GLOBALS['page']['file']					= null;
	$GLOBALS['page']['flags']					= array();
	$GLOBALS['page']['administration']			= false;
	$GLOBALS['page']['simple']					= (isset($_SERVER['REDIRECT_page_simple']) ? ((bool) $_SERVER['REDIRECT_page_simple']) : false);
	$GLOBALS['page']['panel']					= (isset($_REQUEST['page_panel']) ? $_REQUEST['page_panel'] : null);
	$GLOBALS['page']['viewstate']				= (isset($_REQUEST['page_viewstate']) ? $_REQUEST['page_viewstate'] : null);
	
	$GLOBALS['page']['siteTitle']				= '';
	$GLOBALS['page']['siteName']				= '';
	$GLOBALS['page']['title']					= '';
	$GLOBALS['page']['titleStyle']				= '';
	$GLOBALS['page']['titleTemplate']			= '';
	$GLOBALS['page']['breadcrumbs']				= array();
	$GLOBALS['page']['h2']						= '';
	$GLOBALS['page']['keywords']				= 'správa budov, kacenláří, objekty, domy, byty';
	$GLOBALS['page']['description']				= 'Komplexní činnost při Správě budov, objektů, bytů, provozoven, kanceláří, obytných domů a jejich technického vybavení.';
	$GLOBALS['page']['titleSeparator']			= ' | ';
	$GLOBALS['page']['breadcrumbSeparator']		= '&nbsp;&raquo;&nbsp;';
	
/****************************************************************************************************************/
	
	$GLOBALS['logs']							= array();
	$GLOBALS['modules']							= array();
	$GLOBALS['objects']							= array();
	$GLOBALS['invocation']						= null;
	$GLOBALS['result']							= null;
	$GLOBALS['D']								= array();
	$GLOBALS['R']								= array();
	$GLOBALS['M']								= array();
	$GLOBALS['settings']						= array();
	$GLOBALS['settings']['modules']				= array();
	$GLOBALS['settings']['objects']				= array();
	$GLOBALS['settings']['templates']			= array(0 => array());
	
	if (is_file($GLOBALS['site']['data'] . 'settings.php'))
		include_once($GLOBALS['site']['data'] . 'settings.php');

/****************************************************************************************************************/
	
	$temp = strpos($_SERVER['REQUEST_URI'], '?');
	$_SERVER['REQUEST_PATH'] = (($temp === false) ? $_SERVER['REQUEST_URI'] : substr($_SERVER['REQUEST_URI'], 0, $temp));
	$_SERVER['REQUEST_PATH_RELATIVE'] = substr($_SERVER['REQUEST_PATH'], strlen($GLOBALS['site']['path']));
	$GLOBALS['page']['url'] = $_SERVER['REQUEST_PATH_RELATIVE'];

	while (preg_match('~^(.*)\.\.([a-zA-Z_-]+)\.(.*)$~', $GLOBALS['page']['url'], $matches))
	{
		$GLOBALS['page']['url'] = $matches[1];
		$_REQUEST[$matches[2]] = $matches[3];
		$_GET[$matches[2]] = $matches[3];
	}

	$GLOBALS['page']['URL'] = $GLOBALS['page']['url'];
	
	if ($GLOBALS['page']['locale'] === null)
		$GLOBALS['page']['locale'] = $GLOBALS['site']['localeDefault'] ;
	if (substr($GLOBALS['page']['url'], 2, 1) == '/')
	{
		$temp = substr($GLOBALS['page']['url'], 0, 2);
		if (in_array($temp, $GLOBALS['site']['locales']))
		{
			$GLOBALS['page']['locale'] = $temp;
			$GLOBALS['page']['URL'] = (string) substr($GLOBALS['page']['url'], 3);
		}
	}
	if (in_array($temp = @$_REQUEST['page_locale'], $GLOBALS['site']['locales']))
		$GLOBALS['page']['locale'] = $temp;
		
	define('L', $GLOBALS['page']['locale']);
	define('LL', '_' . L);
	define('PATH', $GLOBALS['site']['path']);
	define('LPATH', PATH . (($GLOBALS['page']['locale'] != $GLOBALS['site']['localeDefault']) ? ($GLOBALS['page']['locale'] . '/') : ''));
	
/****************************************************************************************************************/
	
	if (@$_SERVER['REDIRECT_page_location'] == '300')
	{
		foreach ($GLOBALS['site']['base'] as $base)
			if (is_file($file = ($base . $_SERVER['REQUEST_PATH_RELATIVE'])))
			{ $dir = dirname($file); chdir($dir); include($file); die(); }
		die('300 redirect: file not found');
	}
	
/****************************************************************************************************************/
	
	//require_once('third-party/spyc.php'); // NOT USED
	require_once('third-party/fb.php');
	require_once('Error.php');
	require_once('Utilities.php');
	
?>

ACC SHELL 2018