<?php

if (preg_match('/' .basename(__FILE__) . '$/', $_SERVER['REQUEST_URI'] )) {
	// TODO redirect to 404
	die();
}


define('PROJECT_NAME', 'asterisk' );
define('PROJECT_WWW_DIR', __DIR__ );
define('CMS_DIR', realpath(__DIR__ . '/../carabi_cms'));
define('PROJECT_DIR', realpath(__DIR__ . '/../asterisk'));
define('DATA_DIR', realpath(__DIR__ . '/../data'));
define('CACHE_DIR', realpath(__DIR__ . '/../data/cache')); // кэш данных ora_xxx
define('CACHE_IMAGES_DIR', realpath(__DIR__ . '/../data/images-cache')); // кэш данных ora_xxx
define('SHARED_DIR', realpath(__DIR__ . '/../shared'));
define('CARABI_DIR', realpath(__DIR__ . '/../carabi'));
//define('SHARED_DIR', realpath(__DIR__ . '/../shared.rent.ru'));
define('SMARTY_TEMPLATECACHE_DIR', realpath(DATA_DIR . '/smarty/templates_c'));
define('SMARTY_CACHE_DIR', realpath(DATA_DIR . '/smarty/cache'));

define('SUB_URL', '');//"подкаталог" между доменом и корнем сайта
define('IMAGES_URL', SUB_URL .'/images');
define('STYLES_URL', SUB_URL .'/css');
define('SCRIPTS_URL', SUB_URL .'/js');
define('LOGIN_TO', SUB_URL . '/desktop');//страница, на которую перенаправляется пользователь после авторизации

session_start(); // 26-02-2010 включаем сессии теперь здесь - обязательно


//$DB_NAME="CARABI"; // TNS-name
//$DB_USER="pdn2005"; // Oracle User Name
//$DB_PASSWORD="pdn"; // User Password
//$ENCODING       = "CL8MSWIN1251";

$debug = 1;

define('USE_SSL_LOGIN', 1);//при авторизации отправлять логин и пароль через https

// пути для работы ссылок системы
$LOCALPATH='';
$EXTPATH='http://asterisk.loc/';

define('BASE_TMPLT', 'asterisk/_standard.tpl');

//global $DB_NAME,$DB_USER,$DB_PASSWORD,$ENCODING,$SCHEMA_NAMES;

$DATABASE_SCHEMAS = array(
	"veneta" => array (
		"tns_name" => "VENETA_SERVER",
		"login" => "",
		"password" => "",
		"commonuser" => 3265809,
		"webnewsChapters" => array(10489997)
	),
	"goldenc" => array (
		"tns_name" => "CARABI",
		"login" => "",
		"password" => "",
		"commonuser" => 1089609,
		"webnewsChapters" => array(1089677)
	),
	"neval" => array (
		"tns_name" => "NEVAL_NEW",
		"login" => "",
		"password" => "",
		"commonuser" => 1621605
	),
	"carabi_win" => array (
		"tns_name" => "CARABI_WIN",
		"login" => "",
		"password" => "",
		"commonuser" => 43179
	)
);

include DATA_DIR . '/mcrypt.inc';
mymcrypt::process($DATABASE_SCHEMAS);
include_once CARABI_DIR . '/classes/class.Auth.php';
$schema = Auth::getCurrentSchema("veneta");
$DB_NAME = "//213.145.56.37:1521/ORCL"; // $DATABASE_SCHEMAS[$schema]["tns_name"];
$DB_USER = $DATABASE_SCHEMAS[$schema]["n"];
$DB_PASSWORD = $DATABASE_SCHEMAS[$schema]["s"];

define('COMMONUSER_NOAUTH', $DATABASE_SCHEMAS[$schema]["commonuser"]);

//$ENCODING = "CL8MSWIN1251";
$ENCODING = "UTF8";



//require_once "main_inc.php";
date_default_timezone_set('Europe/Moscow');
define( 'DEBUG', true );
//utls::timer('Старт (инит)');
// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);
// время задержки
ini_set('max_execution_time',60);

/*
$commonSnippets = array(
                        array('file' => 'xlogin.php', 'fn'=>'xlogin')
                       );

$pagetypeSnippets = array();
$pagetypeSnippets['rubricator'] = array();
$pagetypeSnippets['rubricator'][] = array('file'=>'ajaxSearchForm.php', 'fn'=> 'ajaxSearchForm');
$pagetypeSnippets['catalog'] = array();
$pagetypeSnippets['catalog'][] = array('file'=>'ajaxSearchForm.php', 'fn'=> 'ajaxSearchForm');

$pagetypeSnippets['cabinet_publications'] = array();
$pagetypeSnippets['cabinet_publications'][] = array('file'=>'ajaxSearchForm.php', 'fn'=> 'ajaxSearchForm');


$allPageSnippets = array();
$allPageSnippets []= array('file'=>'setHomeRegion.php', 'fn'=> 'setHomeRegion');
*/
$classLookupDir = array();
$classLookupDir []= realpath(PROJECT_DIR . '/classes');
$classLookupDir []= realpath(CMS_DIR . '/classes');
$classLookupDir []= realpath(SHARED_DIR . '/classes');
$classLookupDir []= realpath(CARABI_DIR . '/classes');

$smartyTemplateLookupDir = array();
$smartyTemplateLookupDir []= realpath(PROJECT_DIR . '/smarty/templates/');
$smartyTemplateLookupDir []= realpath(CMS_DIR . '/smarty/templates/');
$smartyTemplateLookupDir []= realpath(SHARED_DIR . '/smarty/templates/');
$smartyTemplateLookupDir []= realpath(CARABI_DIR . '/smarty/templates/');

$smartyPluginLookupDir = array();
$smartyPluginLookupDir []= realpath(PROJECT_DIR . '/smarty/plugins/');
$smartyPluginLookupDir []= realpath(CMS_DIR . '/smarty/plugins/');
$smartyPluginLookupDir []= realpath(SHARED_DIR . '/smarty/plugins/');
$smartyPluginLookupDir []= realpath(CARABI_DIR . '/smarty/plugins/');
$smartyPluginLookupDir []= realpath(CARABI_DIR . '/wave_editor/smarty_plugins/');

$authorizedAccessPageAliases = array();

?>
