//error_reporting(0);
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR);
ini_set('display_errors','On');
//if(empty($loaderName))
//{
//die ('
Sorry, this website is under construction
');
//}
//define('LB',"\n");
//ini_set('display_errors','1');
//ini_set('display_startup_errors','1');
//get config for rootPath
$configFile = 'config.php';
//if(eregi("rss.xml",$_SERVER["REQUEST_URI"]))
//preg_match("/\.xml/i", $_SERVER["REQUEST_URI"])
if(preg_match("/rss\.xml/i",$_SERVER["REQUEST_URI"]))
{
$loaderConfig['Settings']['Layout']='rss';
//$loaderName = 'rss';
}
//ini_set('session.cookie_lifetime',(3600*24*365));
if( (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "") && ($loaderName!='adm') ){
$redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $redirect");
}
$article="";
$newsarticle="";
$HTTP_HOST=$_SERVER['HTTP_HOST'];
$rq = $_SERVER["REQUEST_URI"];
$rq = str_replace("https://".$HTTP_HOST,"",$rq);
$rq = str_replace("/", "", $rq);
$flag='false';
if(empty($host)) {$host = $_SERVER['HTTP_HOST'];}
$domainHost = str_replace("https://","",$host);
$domainHost = str_replace("www.","",$host);
$domainHost = str_replace("www.","",$domainHost);
$article=substr($rq,0,8);
$newsarticle=substr($rq,0,12);
/*
if( ($domainHost=='kiev-apartments.com.ua' || $domainHost=='kiev-apartments.us') and ($article!='article-' && $newsarticle!='viewarticles'))
{
if(!empty($rq) && $rq!='home.html')
{
$url = 'http://apartments.com.ua'. $_SERVER["REQUEST_URI"];
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
}
*/
$res_rq=preg_match("/\?\_\=+[0-9]+$/", $rq, $matches_rq);
$domNew = '';
if( preg_match("/apartments\.com\.ua\/de/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('de', "", $rq);
}
$domNew = 'de';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/de/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/de' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/it/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch))
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('it', "", $rq);
}
$domNew = 'it';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/it/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/it' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/fr/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('fr', "", $rq);
}
$domNew = 'fr';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/fr/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/fr' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/es/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('es', "", $rq);
}
$domNew = 'es';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/es/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/es' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/ru/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('ru', "", $rq);
}
$domNew = 'ru';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/ru/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/ru' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/tu/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('tu', "", $rq);
}
$domNew = 'tu';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/tu/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/tu' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/eg/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('eg', "", $rq);
}
$domNew = 'eg';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/eg/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/eg' )
{
$rq = 'home.html';
}
}
if( preg_match("/apartments\.com\.ua\/el/", $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $arrmatch) )
{
if( preg_match("/home\.html/", $rq, $arrmatch) ){
$rq = str_replace('el', "", $rq);
}
$domNew = 'el';
if( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/el/' || $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'apartments.com.ua/el' )
{
$rq = 'home.html';
}
}
// || !empty($matches_rq[0])
//echo"===>".$loaderName;
//echo"===>".$mainConfig['langUrlDelet']."|".$rq." --- ".strlen($matches_rq[0]);
if(empty($rq) || $rq=='home.html' || !empty($matches_rq[0]) )
{
if($domainHost=='kiev-apartments.com.ua'){$flag='true';}
$pos=strpos($domainHost,'apartments');
$dom=substr($domainHost, $pos+11);
$dom=str_replace("com", "", $dom);
$dom=str_replace(".", "", $dom);
if(!empty($domNew)){$dom = $domNew;}
if ($flag=='false' and $loaderName!='adm'){
include('Html/home-'.$dom.'.html');
die();
}
if ($flag=='true'){
include('Html/kiev_home-'.$dom.'.html');
die();
}
}
if(preg_match("/uk\/accommodation-kiev\//i", $_SERVER["REQUEST_URI"])){
$url = "https://kiev-apartments.com.ua/";
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
if(preg_match("/rus\/apartments-kiev\//i",$_SERVER["REQUEST_URI"]) || preg_match("/ru\/apartments-kiev\//i",$_SERVER["REQUEST_URI"]))
{
$url = "https://kiev-apartments.ru/";
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
if(preg_match("/ger\/appartements-kiew\//i",$_SERVER["REQUEST_URI"]) || preg_match("/de\/wohnungen-kiew\//i",$_SERVER["REQUEST_URI"]))
{
$url = "https://kiev-apartments.de/";
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
if(preg_match("/fra\/appartements-kiev\//i",$_SERVER["REQUEST_URI"]) || preg_match("/fr\/appartements-kiev\//i",$_SERVER["REQUEST_URI"]))
{
$url = "https://www.kiev-apartments.eu/";
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
if(preg_match("/spa\/apartamentos-kiev\//i",$_SERVER["REQUEST_URI"]) || preg_match("/es\/apartamentos-kiev\//i",$_SERVER["REQUEST_URI"]))
{
$url = "https://kiev-apartments.es/";
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
if(preg_match("/ital\/index\//i",$_SERVER["REQUEST_URI"]) || preg_match("/it\/appartamenti-kiev\//i",$_SERVER["REQUEST_URI"]))
{
$url = "https://kiev-apartments.it/";
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: ".$url );
}
//$_SERVER['HTTP_HOST'];
//$_SERVER['DOCUMENT_ROOT'];
if(is_file($configFile))
{
include_once($configFile);
$rootPath = $mainConfig['Settings']['RootPath'];
$dtr=$mainConfig['Settings']['DTR'];
define('DTR',$dtr);
}
else
{
die('FATAL ERROR: config.php file was not found');
}
if(!empty($loaderConfig))
{
foreach ($loaderConfig['Settings'] as $loaderConfigCode=>$loaderConfigValue)
{
$mainConfig['Settings'][$loaderConfigCode] = $loaderConfigValue;
}
}
//$_SERVER['DOCUMENT_ROOT']
include_once($rootPath.'lib/Loader.lib.php');
include_once($rootPath."lib/JsHttpRequest.php");
//timeTracking('StartAll');
//get variables with /
timeTracking('LibFilesLoaded');
//echo 'loaderName: '.$loaderName;
if(!empty($loaderName))
{
//$HTTP_HOST='apartments.com.ua';
//$_SERVER["REQUEST_URI"] = '/two-room.html';
//echo"====1====>".$_SERVER["REQUEST_URI"]."|".$HTTP_HOST=apartments.com.ua;;
$request = $_SERVER["REQUEST_URI"];
$request = str_replace("https://".$HTTP_HOST,"",$request);
$requestTest = strstr($request,"/".$loaderName);
if(!empty($requestTest))
{
$request = $requestTest;
$request = str_replace("/$loaderName/","",$request);
}
parseGetRequest($request);
}
else
{
if(empty($_POST['SID']) && !empty($_GET) && empty($_GET['SID']))
{
// echo"====2====>".print_r($_GET);
$i=0;
foreach ($_GET as $variableName=>$variableValue){
if($i==0) {$request = $variableName; $i++;}
}
parseGetRequest($request);
}
}
//print_r($_POST);
timeTracking('RequestParsed');
if($mainConfig['Settings']['ClientType']=='admin')
{
$defaultHomeSID = 'homeadmin';
} else {
//if($mainConfig['Settings']['OwnerID']==$mainConfig['Settings']['DefaultOwner'])
if(empty($mainConfig['Settings']['region']))
{
$defaultHomeSID = 'home';
}
else
{
$defaultHomeSID = 'home';
}
}
if(!empty($_GET['SID'])) $SID = $_GET['SID'];
if (empty($SID)) {$SID = $defaultHomeSID; $_GET['SID']=$SID;}//section ID
if(empty($_POST['SID']) && !empty($_POST))
{
$_POST['SID']=$_GET['SID'];
}
include_once($rootPath.'lib/Cache.lib.php');
$caheController = new CacheController();
timeTracking('getPageStart');
$caheController->getPage($_GET);
timeTracking('getPageEnd');
include_once($rootPath.'lib/Core.lib.php');
include_once($rootPath.'lib/Interface.lib.php');
include_once($rootPath.'lib/Loader.lib.php');
include_once($rootPath.'lib/Templates.lib.php');
include_once($rootPath.'lib/DataSource.lib.php');
include_once($rootPath.'lib/ru_class.php');
//include_once($rootPath.'lib/WebServices/soaplocal.php');
//$SERVER_SOAP = new SoapLocal();
timeTracking('beforeStart');
$CORE = new SystemInterface();
//header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
//header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
//header("Cache-Control: post-check=0, pre-check=0",false);
//session_cache_limiter("must-revalidate");
//echo"=========>".print_r($mainConfig['Settings']);echo"
";
if(($_POST['windowMode']=='ajax') || ($_GET['windowMode']=='ajax')){
header("Cache-Control: no-cache, private, no-store, must-revalidate, proxy-revalidate, max-stale=0, post-check=0, pre-check=0, max-age=0, s-maxage=0",false);
header("Expires: ".gmdate("D, d M Y H:i:s",time()+60*60*24*2+1)." GMT");
header("Pragma: no-cache");
header("Last-Modified: Mon, 18 Jul 2005 09:00:00 GMT");
if($loaderConfig['Settings']['Layout'] == 'rss')
{
header("Content-Type: text/xml; charset=UTF-8");
}
else
{
header("Content-Type: text/html; charset=UTF-8");
}
//ob_start("coresystemMessagesHandler");
$CORE->getSession();
$CORE->loadDefinitions();
$retval = $CORE->printOutput();
timeTracking('End');
//ob_end_flush();*/
}else if(($_POST['windowMode']=='pdf') || ($_GET['windowMode']=='pdf')){
$CORE->getSession();
$CORE->loadDefinitions();
$CORE->printPDF();
} else {
if($loaderConfig['Settings']['Layout'] == 'rss')
{
header("Content-Type: text/xml; charset=UTF-8");
}
else
{
header("Content-Type: text/html; charset=UTF-8");
}
ob_start("coresystemMessagesHandler");
$CORE->getSession();
$CORE->loadDefinitions();
$lengz = ob_get_length();
if($mainConfig['Settings']['ClientType']=='admin') {
$url_mass = explode("/", $_SERVER['REQUEST_URI']);
if( $url_mass[3] != 'loginadmin' || ($url_mass[3] == 'loginadmin' && $url_mass[4]) ){
userExit();
}
}
$retval = $CORE->printOutput();
//timeTracking('End');
ob_end_flush();
}