<?
session_start();
$config = array();

// Begin Configuration
$config['basedir']     =  '/home/username/public_html';
$config['baseurl']     =  'http://www.domain.tld';

$DBTYPE = 'mysql';
$DBHOST = 'localhost';
$DBUSER = 'database_username';
$DBPASSWORD = 'database_password';
$DBNAME = 'database_name';
// End Configuration

$config['adminurl']      =  $config[baseurl].'/administrator';
$config['cssurl']      =  $config[baseurl].'/css';
$config['tmpimgpath']     =   $config['basedir'].'/uploads/temp';
$config['tmpimgpath2']     =   $config['basedir'].'/uploads/temp';
$config['imagedir']      =  $config[basedir].'/images';
$config['imageurl']      =  $config[baseurl].'/images';
$config['avatardir']      =  $config[imagedir].'/avatars';
$config['avatarurl']      =  $config[imageurl].'/avatars';
$config['cavatardir']      =  $config[imagedir].'/members';
$config['cavatarurl']      =  $config[imageurl].'/members';
$config['membersprofilepicdir']      =  $config[imagedir].'/membersprofilepic';
$config['membersprofilepicurl']      =  $config[imageurl].'/membersprofilepic';
$config['seriesdir']      =  $config[imagedir].'/videoseries';
$config['seriesurl']      =  $config[imageurl].'/videoseries';
$config['channeldir']      =  $config[imagedir].'/channels';
$config['channelurl']      =  $config[imageurl].'/channels';
$config['originalvdir']      =  $config[basedir].'/uploads/video';
$config['originalvurl']      =  $config[baseurl].'/uploads/video';
$config['profilebgdir']      =  '/profilebg/';
$config['channelbgdir']      =  '/channelbg/';
$config['channelbgurl']      =  $config[imageurl].'/channelbg';
$config['videodir']      =  $config[basedir].'/vdata';
$config['videourl']      =  $config[baseurl].'/vdata';
$config['thumbdir']      =  $config[imagedir].'/videothumbs';
$config['thumburl']      =  $config[imageurl].'/videothumbs';
$config['cthumburl']      =  $config[imageurl].'/channels';

require_once($config[basedir].'/smarty/libs/Smarty.class.php');
require_once($config[basedir].'/libraries/mysmarty.class.php');
require_once($config[basedir].'/libraries/SConfig.php');
require_once($config[basedir].'/libraries/SError.php');
require_once($config[basedir].'/libraries/adodb/adodb.inc.php');
require_once($config[basedir].'/libraries/phpmailer/class.phpmailer.php');
require_once($config[basedir].'/libraries/SEmail.php');

$conn = &ADONewConnection($DBTYPE);
$conn->PConnect($DBHOST, $DBUSER, $DBPASSWORD, $DBNAME);
@mysql_query("SET NAMES 'UTF8'");
$sql = "SELECT * from config";
$rsc = $conn->Execute($sql);

if($rsc){while(!$rsc->EOF)
{
$field = $rsc->fields['setting'];
$config[$field] = $rsc->fields['value'];
STemplate::assign($field, $config[$field]);
@$rsc->MoveNext();
}}

if ($_REQUEST['language'] != "")
{
	if ($_REQUEST['language'] == "english")
	{
		SESSION_REGISTER("language");
		$_SESSION[language] = "english";
	}
	elseif ($_REQUEST['language'] == "spanish")
	{
		SESSION_REGISTER("language");
		$_SESSION[language] = "spanish";
	}
}

if ($_SESSION['language'] == "")
{
	SESSION_REGISTER("language");
	$_SESSION[language] = "english";
}

if ($_SESSION['language'] == "english")
{
include("lang/english.php");
}
elseif ($_SESSION['language'] == "spanish")
{
include("lang/spanish.php");
}
else
{
include("lang/english.php");
}

for ($i=0; $i<count($lang); $i++)
{
	STemplate::assign('lang'.$i, $lang[$i]);
}

STemplate::assign('baseurl',       $config['baseurl']);
STemplate::assign('basedir',       $config['basedir']);
STemplate::assign('adminurl',       $config['adminurl']);
STemplate::assign('cssurl',       $config['cssurl']);
STemplate::assign('tmpimgpath',       $config['tmpimgpath']);
STemplate::assign('tmpimgpath2',       $config['tmpimgpath2']);
STemplate::assign('imagedir',        $config['imagedir']);
STemplate::assign('imageurl',        $config['imageurl']);
STemplate::assign('imgpath',        $config['imgpath']);
STemplate::assign('avatardir',        $config['avatardir']);
STemplate::assign('avatarurl',        $config['avatarurl']);
STemplate::assign('cavatardir',        $config['cavatardir']);
STemplate::assign('cavatarurl',        $config['cavatarurl']);
STemplate::assign('membersprofilepicdir',        $config['membersprofilepicdir']);
STemplate::assign('membersprofilepicurl',        $config['membersprofilepicurl']);
STemplate::assign('seriesdir',        $config['seriesdir']);
STemplate::assign('seriesurl',        $config['seriesurl']);
STemplate::assign('channeldir',        $config['channeldir']);
STemplate::assign('channelurl',        $config['channelurl']);
STemplate::assign('originalvdir',        $config['originalvdir']);
STemplate::assign('originalvurl',        $config['originalvurl']);
STemplate::assign('profilebgdir',        $config['profilebgdir']);
STemplate::assign('channelbgdir',        $config['channelbgdir']);
STemplate::assign('channelbgurl',        $config['channelbgurl']);
STemplate::assign('videodir',        $config['videodir']);
STemplate::assign('videourl',        $config['videourl']);
STemplate::assign('thumbdir',        $config['thumbdir']);
STemplate::assign('thumburl',        $config['thumburl']);
STemplate::assign('vthumburl',        $config['thumburl']);
STemplate::assign('cthumburl',        $config['cthumburl']);
STemplate::setCompileDir($config['basedir']."/temporary");
STemplate::setTplDir($config['basedir']."/themes");

?>