<?php

return header('Location: /process/');

#02.10.2009 22.44.56<br />
#15

ob_start();

ini_set( "display_errors", 'On' );

error_reporting(0);

/*
$headers = '';

foreach ($_SERVER as $key => $value) {
   if (strpos($key, 'HTTP_') === 0 && $key != 'HTTP_HOST') {
       $key = strtolower(strtr(substr($key, 5), '_', '-'));

       $headers .= $key . ': ' . $value . "\r\n";
   }
}

$opts = array(
 'http'=>array(
   'method'=>"GET",
   'header'=> $headers,
 )
);

$mobile	=	 "<!--".file_get_contents('http://phd.yandex.net/detect', false, stream_context_create($opts))."-->";
*/

//$mobile	=	(strpos($mobile,"yandex-mobile-info-error")!==false)?false:true;
//$mobile = true;
//var_dump($mobile);
require_once ( 'inc/mobile_detect.php' );
$mobile =   mobile_device_detect();
if(strpos($_SERVER['REQUEST_URI'],'mobile')===false && $mobile){header("Location: /ru/mobile/"); exit;}
require_once ( 'common.php' );



$tpl_path = $lang ? $CONFIG['tpl_path'] . $server . $lang . '/':$CONFIG['tpl_path'];

$class_path = $CONFIG['class_path'];



if ( !$request_link ) $request_link = $_GET['command'];



if ( !$CONFIG['multilanguage'] && $_GET['lang'] != $CONFIG['default_lang'] )

{

	$ret = $core->getPage( rewrite($_GET['lang'] . $request_link) );

}

else

{

	$ret = $core->getPage( rewrite($request_link) );

}



if ( !$ret ) $main->no_such_page();





if ( $ret['redirect_url'] )

{

	header( 'Location: ' . $ret['redirect_url'] );

	exit;

}



//echo $ret['title'];

session_start();

if ( !$ret['active'] )

{

	if ( !$_SESSION['session_is_admin'] ) $main->no_such_page();

}
if(function_exists("date_default_timezone_set"))date_default_timezone_set('Asia/Vladivostok');
setlocale(LC_ALL, 'ru_RU');



$PAGE = array();

$PAGE['title'] = $ret['title'];

#$PAGE['sub_title'] = $ret['title'];

$PAGE['alt_title'] = $ret['alt_title'];

$PAGE['title_from_main_module'] = '';

$PAGE['addition_to_path'] = '';

$PAGE['description'] = $ret['description'];

$PAGE['keywords'] = $ret['keywords'];

$PAGE['meta'] = $ret['meta'];

$PAGE['id'] = $ret['id'];

$PAGE['is_default'] = ( int )$ret['is_default'];

$PAGE['level'] = $ret['level'];

$PAGE['parent_id'] = $ret['parent_id'];

$PAGE['link'] = $ret['link'];

$link = $PAGE['link'];

$PAGE['address'] = $ret['address'];

$PAGE['branch'] = $ret['branch'];

$PAGE['branch_array'] = explode( ',', $PAGE['branch'] );

$PAGE['tpl_id'] = $ret['tpl_id'];

# $PAGE['number_of_fields'] 			= $ret['number_of_fields']; // устарело

$PAGE['main_module'] = $ret['main_module'];

$PAGE['lang'] = $lang;

$PAGE['modules'] = array();

$PAGE['field'] = '';

$PAGE['special_catalog_template'] = 0;



$baseurl = str_replace( "?", "", $core->formPageLink($PAGE['link'], $PAGE['address'],

	$lang, 1) );



$field_output = $core->get_field_content( $PAGE['id'], $PAGE['link'], 0, 0 );



$menu_html = $core->get_block_content( $PAGE['id'], 1, -1, 3, 'pages',

	'showmenu', $PAGE['link'] );

$sub_menu_html = $core->get_block_content( $PAGE['id'], 1, -3, 3, 'nowsell',

	'listcat', $PAGE['link'] );



	$bottom_menu = $core->get_block_content( $PAGE['id'], 1, -5, 3, 'pages',

	'showtopmenu', $PAGE['link'] );

$core->set_main_template( $PAGE['tpl_id'], 0, 0 );







$a = mt_rand( 1, 3 );



$core->page_assembling( $field_output, array('site_lang' => $lang, 'rnd' => $a,

	'siteusers_log' => $siteusers, 'siteusers_reg' => $registration, 'home_link' =>

	$home_link, 'search_link' => $search_link, 'original_link' => $original_link,

	'welcome_link' => $welcome_link, 'contact_email' => $CONFIG['contact_email'],

	'page_title' => $PAGE['alt_title'] ? $PAGE['alt_title']:$CONFIG['sitename'] .

	'  &raquo;&raquo; ' . strip_tags($PAGE['title']), 'title' => $PAGE['alt_title'] ?

	$PAGE['alt_title']:strip_tags($PAGE['title']), 'sub_title' =>strip_tags($PAGE['sub_title']), 'main_title' => $PAGE['title_from_main_module'] ?

	strip_tags($PAGE['title_from_main_module']):($PAGE['alt_title'] ? $PAGE['alt_title']:

	strip_tags($PAGE['title'])), 'page_description' => $PAGE['description'],

	'page_keywords' => $PAGE['keywords'], 'page_meta' => $PAGE['meta'], 'menu' => $menu_html,

	'sub_menu' => $sub_menu_html, 'path' => $page_path_html, 'catalog_menu' => $catalog_menu_html,

	'select_menu' => $select_menu_html, 'tpl_id' => $PAGE['tpl_id'],

	'siteusers_inter' => $inter, 'siteusers_regist' => $regist,'bottom_menu'=>$bottom_menu ,'site_title' => $CONFIG['sitename'],) )

;





if ( is_object($cache) && $cache->last_modified )

{

	$last_modified = gmdate( 'D, d M Y H:i:s', $cache->last_modified );

}

else

{

	$last_modified = gmdate( 'D, d M Y H:i:s' );

}

header( 'Last-Modified: ' . $last_modified . ' GMT' );





$tpl->printToScreen();

$content = ob_get_contents();

ob_end_clean();

if ( @$_SERVER["HTTP_ACCEPT_ENCODING"] && false !== strpos($_SERVER["HTTP_ACCEPT_ENCODING"],

	'gzip') && $CONFIG['front_office_zip'] > 0 && $CONFIG['front_office_zip'] <= 9 )

{

	$content = gzencode( $content, $zip );

	header( 'Content-Encoding: gzip' );

}

header( 'Content-Length: ' . strlen($content) );

echo $content;

exit;



?>