<?php
class config
{
    var $errors = array();
    function __construct()
    {

		$patharray = explode("/",$_SERVER['PHP_SELF']);
		if (count($patharray) > 2)
		{
			$pathpop = array_pop($patharray);
			$siteprojectfolder = implode("/", $patharray);
		}
		else
			$siteprojectfolder = '';
  		
		if($_SERVER['HTTP_HOST'] == "localhost"){
			$this->frontEndURL  = 'http://'.$_SERVER['HTTP_HOST']."/".$patharray[1]; // need to uncomment using offline
		}else{
			//$this->frontEndURL  = 'http://demo.web-alliance-uk.co.uk/';
			$this->frontEndURL  = 'https://demo8.web-alliance.uk/griffith-elder/';
		}
		
		
		//$currentSiteName = "web-alliance-demo";		
		$currentSiteData = utility::getTableRowByField('sites','id',1);		
		
		$this->currentSiteData = $currentSiteData;		
		$this->siteURL  = 'http://'.$_SERVER['HTTP_HOST'].$siteprojectfolder;
		if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){
			$this->siteURL  = 'https://'.$_SERVER['HTTP_HOST'].$siteprojectfolder;
		}
		
		$this->siteId=$currentSiteData['id'];
		$this->siteName=$currentSiteData['site_name'];
		$this->site_url=$currentSiteData['site_url'];
		$this->siteAliasName=$currentSiteData['site_alias_name'];
		$this->free_shipping_on_cost_above = utility::getTableFieldById('keycode','description','name','free_shipping_on_cost_above');
		$this->mileage_rate = utility::getTableFieldById('keycode','code','name','mileage__rate');
		$this->siteEmail=$currentSiteData['sales_email'];
		$this->siteEmailTest='shoebahmad999@gmail.com';
		$this->info=$currentSiteData['info_email'];
		
  		$this->siteRoot = $_SERVER["DOCUMENT_ROOT"].$siteprojectfolder;   
	   	$this->subDirectories = $siteprojectfolder; 
	    $this->filePath = $this->subDirectories; 
	    $this->getfiletemplate = 'getfile'; 	    
        $this->creditCustomerArray = array();
		$this->dateFormat = "d-m-Y";
		$this->adminColor = (isset($_SESSION['admin_color'])) ? $_SESSION['admin_color'] : "#252525";
		$this->access_control = "";
		$this->companyPhone = $currentSiteData['company_phone'];
		$this->companyAddress =$currentSiteData['company_address'];
		$this->companyVatNumber =$currentSiteData['vat_reg_number'];
		$this->siteBankAccount =$currentSiteData['company_bank_account'];
		
		$this->archive_status_id =	$currentSiteData['company_fax']; //Using field as archive status
    }
 }
?>