<?php

$_DIR['root'] = realpath('.');

$_DIR['domain'] = 'http://' . $_SERVER['SERVER_NAME'] . ':'. $_SERVER['SERVER_PORT'];

$_temp = explode("/index",$_SERVER['PHP_SELF']);
$_root = $_temp[0];

$_DIR['uri_root'] = $_root;
$_DIR['uri_templates'] = $_root.'/templates';

$_DIR['pages_images_uri'] = $_root . '/templates/images/pages';
$_DIR['purifier_images_uri'] = $_root . '/templates/images/purifier';

$_DIR['vine_images_uri'] = $_root . '/images/vine';

$_DIR['temp'] = $_DIR['root'] . '/temp';
$_DIR['db_cache'] = $_DIR['temp'] . '/db_cache';
$_DIR['pear_path'] = $_DIR['root'] . '/includes/pear';
$_DIR['smarty_path'] = $_DIR['root'] . '/includes/smarty';

ini_set('include_path', $_DIR['pear_path'] . ':' . ini_get('include_path'));
ini_set('include_path', $_DIR['smarty_path'] . ':' . ini_get('include_path'));

require_once 'Smarty.class.php';
$smarty = new Smarty();
$smarty->cache_dir 	= $_DIR['temp'] . $_DIR['uri_root'] . '/cache';
$smarty->compile_dir 	= $_DIR['temp'] . $_DIR['uri_root'] . '/compile';
$smarty->template_dir	= $_DIR['root'] . '/templates';
$smarty->config_dir 	= $_DIR['root'] . '/templates/config';

/*
 * DB layer
 */

//require_once 'DB.php';
$_DBASE = array();
$_DBASE['user'] = '331508_user';
$_DBASE['password'] = 'nwb5114';
$_DBASE['base'] = '331508_main';
$_DBASE['host'] = '64.49.219.241';
$_DBASE['port'] = '3306';
$_DBASE['type'] = 'mysql';

require('includes/classes/cache.php');
$Cache = new Cache;
require('includes/classes/database.php');

$oscdb = osC_Database::connect($_DBASE['host'], $_DBASE['port'], $_DBASE['user'], $_DBASE['password'], 'mysql');
$oscdb->selectDatabase($_DBASE['base']);

require_once 'includes/token/Token.class.php';

?>