<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of config
 *
 * @author dghai
 */
//set_include_path(getcwd().'\phpseclib\\' . PATH_SEPARATOR . getcwd().'\ezcMail\\' . PATH_SEPARATOR.get_include_path());
set_include_path('../phpseclib/'.PATH_SEPARATOR.'../ezcMail/'.get_include_path());

class admin_config {
    /**
     * Stores configuration options specific to production environment.
     * @var array
     */
    private $_prodConfig;

    /**
     * Stores configuration options specific to development environment.
     * @var array
     */
    private $_devConfig;

    /**
     * Stores configuration options common to both, prod and dev, environments.
     * @var type
     */
    private $_commonConfig;

    /**
     * Holds whether current server is production or not depending on the
     * environment variables.
     * @var boolean
     */
    private $_isProd;

    function __construct()
    {
        $this->_isProd = ($_SERVER['production_server'] == 1);
        $this->_commonConfig = array(
            'new_admin_email_template'=>
            '<p>Hi!</p><p>Here are your credentials for Carview management application:
                <ul><li>Username: {username}</li><li>Password: {password}</li>
                </ul></p><p>Please tell us how we are doing by mailing
                your thoughts to {webmaster_email}.</p><p>Thank you!<br/>
                Team Carview</p>',
            
            'new_admin_email_plaintext' =>
            'Hi!\nHere are your credentials for Carview management application:\n
                \nUsername: {username}
                \nPassword: {password}
                \nPlease tell us how we are doing by mailing
                your thoughts to {webmaster_email}.
                \n\nThank you!
                \nTeam Carview',
            
            'new_admin_email_subject'  =>
            'Carview Admin Credentials'
        );

        $this->_devConfig = array(
            'db_schema' => 'vroom360',

            'db_server' => 'localhost',
            'db_server_port' => '3306',

            'db_user' => 'vroomadmin',
            'db_user_password' => '3e2b57d2622012ec92a10a11e548f1c4',

            'save_error_to_db' => true,

            'log_requests'     => true,
            
            'webmaster_email'  => 'vroom360@devghai.com',
            'webmaster_name'   => 'VRoom360 Websmaster',
            
            'smtp_server'      => 'mail.devghai.com',
            'smtp_port'        => 465,
            'smtp_username'    => 'vroom360+devghai.com',
            'smtp_password'    => 'vroom360',
            
            'filestore'        => '.\images\\',
            'path_separator'   => '\\',
        );

        $this->_prodConfig = array (
            'db_schema' => 'devghai_vroom360',

            'db_server' => 'localhost',
            'db_server_port' => '3306',

            'db_user' => 'devghai_vroomadm',
            'db_user_password' => '3e2b57d2622012ec92a10a11e548f1c4',

            'save_error_to_db' => true,

            'log_requests'     => true,
            
            'webmaster_email'  => 'vroom360@devghai.com',
            'webmaster_name'   => 'VRoom360 Websmaster',
            
            'smtp_server'      => 'mail.devghai.com',
            'smtp_port'        => 465,
            'smtp_username'    => 'vroom360+devghai.com',
            'smtp_password'    => 'vroom360',
            
            'filestore'        => './images/',
            'path_separator'   => '/',
        );
    }

    public function GetNewAdminEmailTemplate()
    {
        return $this->_commonConfig['new_admin_email_template'];
    }
    
    public function GetNewAdminEmailPlaintextTemplate()
    {
        return $this->_commonConfig['new_admin_email_plaintext'];
    }
    
    public function GetNewAdminEmailSubject()
    {
        return $this->_commonConfig['new_admin_email_subject'];
    }

    public function GetDbSchema()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['db_schema'];
        }

        return $this->_devConfig['db_schema'];
    }

    public function GetDbServer()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['db_server'];
        }

        return $this->_devConfig['db_server'];
    }

    public function GetDbPort()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['db_server_port'];
        }

        return $this->_devConfig['db_server_port'];
    }

    public function GetDbUser()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['db_user'];
        }

        return $this->_devConfig['db_user'];
    }

    public function GetDbUserPassword()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['db_user_password'];
        }

        return $this->_devConfig['db_user_password'];
    }


    public function IsSavingErrorToDbEnabled()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['save_error_to_db'];
        }

        return $this->_devConfig['save_error_to_db'];
    }

    public function IsLoggingRequestsEnabled()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['log_requests'];
        }

        return $this->_devConfig['log_requests'];
    }
    
    public function GetWebmasterEmail()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['webmaster_email'];
        }

        return $this->_devConfig['webmaster_email'];
    }
    
    public function GetWebmasterName()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['webmaster_name'];
        }

        return $this->_devConfig['webmaster_name'];
    }
    
    public function GetSMTPServer()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['smtp_server'];
        }

        return $this->_devConfig['smtp_server'];
    }
    
    public function GetSMTPPort()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['smtp_port'];
        }

        return $this->_devConfig['smtp_port'];
    }
    
    public function GetSMTPUsername()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['smtp_username'];
        }

        return $this->_devConfig['smtp_username'];
    }
    
    public function GetSMTPPassword()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['smtp_password'];
        }

        return $this->_devConfig['smtp_password'];
    }
    
    public function GetFilestore()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['filestore'];
        }

        return $this->_devConfig['filestore'];
    }
    
    public function GetPathSeparator()
    {
        if($this->_isProd)
        {
            return $this->_prodConfig['path_separator'];
        }

        return $this->_devConfig['path_separator'];
    }
}

?>
