<?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());
require_once 'ErrorObject.php';

class 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(
            'response_privateKey' => '-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCH0uzPQmyPgcMPWTYly2CkaNpHG7/riXLHZ5H4s1vFH9uYIjBtHCWJsW6WuOvI
cVpPc6NIagGuxP1oauJcdDSq/Z7JMPA6RLBFN8jiPuoHMuOyaxOlagu2JCAZU42mDrKwgfGiSPiS
L2iMr2rI76dirt/wJXY1wKPSwtAKtbFYPQIDAQABAoGACO9769CzYqeHRSG52betBnPtdEMjl6PF
vM+X/1QRZAEKCdKp++ufnpThMSI+RMQMTHDPm6p5rN1BzJZHiQyOEF4cCA+h4HA3XyRRAIkNQWrp
1EjjZnvaFDtLaNj1RiTFc6RsWNtoTCvzdA5nX8qqjG4B95VDQMcvoy3CRw/1MtECQQCKs8/KDrfP
a8fJvvKcwSNwzNkH6YfKGncS6kizBJVs+x/GZOd5IpdQuFcF1tpnNdvxRhFoZw+ra/2Y8g7+XaJF
AkEA+q/xu44NZIFMq8Bv8SRwM8ehNGUVchITjVPZzv1voXlQjfMT1MjaZ/VaRriGiIrBZp8HyI7k
3KNAhYvgctI5mQJAZhC/XS7Lb+UeFYVfvp4ZWE5Ffp8If15ONSsV6DX9Rz7cOP/Tnb4onwunbfKW
sNBfUwJ+mNcOHtTOvpeRFPkOCQJBALMoTRViZxXeBmJ0zEvFY97Nm9rrJxF387s8Itx4aXA4WCaq
gxC+XsCPK26Bb7xjleZ2X0SpQsyga3tFxSmqLnkCQBXPDx8K1QiYQzbTPhz++n+luJBsyYe6YLRT
eXO1AChZRkjOFfJK5XljlqsHCLoFanLBuYVVSOzVWY+A93wH9HM=
-----END RSA PRIVATE KEY-----',

            'response_publicKey' => '-----BEGIN PUBLIC KEY-----
MIGJAoGBAIfS7M9CbI+Bww9ZNiXLYKRo2kcbv+uJcsdnkfizW8Uf25giMG0cJYmxbpa468hxWk9z
o0hqAa7E/Whq4lx0NKr9nskw8DpEsEU3yOI+6gcy47JrE6VqC7YkIBlTjaYOsrCB8aJI+JIvaIyv
asjvp2Ku3/AldjXAo9LC0Aq1sVg9AgMBAAE=
-----END PUBLIC KEY-----',

            'request_publicKey' => '-----BEGIN PUBLIC KEY-----
MIGJAoGBAI5zstNY9OkGNfEM667y6NMb8WwQ+gw662tKp/2ica0dmqVRaXPEcT7O7uN/BOE+XBId
KlvXkywdLD4s9CMp9OfVvmzxjTLH6z04Y20lOanZYs1PBiJhsqVwXEewHlXPMZjCwoZ5ZYcVIprr
SmQMgecfDEGfbMnbZDmQmft7KHbNAgMBAAE=
-----END PUBLIC KEY-----',

            'request_privateKey' => '-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCOc7LTWPTpBjXxDOuu8ujTG/FsEPoMOutrSqf9onGtHZqlUWlzxHE+zu7jfwTh
PlwSHSpb15MsHSw+LPQjKfTn1b5s8Y0yx+s9OGNtJTmp2WLNTwYiYbKlcFxHsB5VzzGYwsKGeWWH
FSKa60pkDIHnHwxBn2zJ22Q5kJn7eyh2zQIDAQABAoGAKbgdu8L2OxasDpQbpCmU4VryKhWQvas1
zj7XkzMTesFMTLVanmJ+Tgg5s1u8WKE0QsPS54HrosRKdE0jFPdRN3Icc1cyCrk21z2W8EEMHxZc
VTvAN+E/W9uTTMyDoE6s0rcHmr1+8GHAEXJKFnvHpO9ZKmb1rmXN4p8k9doHkCsCQQCs8C361xll
/0ZdKrYa3ZTO557osy0tcM5gE7i33VgqDCjg1dvOHDr7SSb3RtNB8Uxn4qrseW18YCUHXXLrJLVj
AkEA0t8LrYBeY51ijAux9zHi2ByieKGCZHNIN1Pv9VjjT+pnuneEScA7hP43UjtmnmbLQ+3D2/vA
kmqOT2wmTYGyDwJAfRjUOeJE9ho9nQFbb32fujekJLIP2RIDx04czavoranUHCe285ZKOCHHdRIf
mVDiMzes6pg/0bt+raA0k9Ie/wJAF1FgyjPKvDs4HYJhkJMsoXcxJCO/9nmk/7FBdKD6qeiixcTX
lQwzyLYPygEVjOiTC5TsNpQ1LDuqNvAfoCx6UwJAPSem4EDDHkSd0zN7TaEIoBKT6A0wNBI9io7z
ZZlytwQR1g8gVahz+MjFWvpvseAi14Tsc0ZpU5HPB0Mu5qJ2kQ==
-----END RSA PRIVATE KEY-----',

            'enable_connection_encryption' => false,
            
            'reset_password_email_template'=>
            '<p>Hi!</p><p>Here\'s your new password for the Carview 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>',
            
            'reset_password_email_plaintext' =>
            'Hi!\nHere\'s your new password for the Carview 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',
            
            'reset_password_email_subject'  =>
            'Your Carview Password'
        );

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

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

            'db_user' => 'webuser',
            'db_user_password' => '2b00a6ee707290a755f1a880783fcc40',

            'save_error_to_db' => true,

            'log_requests'     => false,
            
            '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_webuser',
            'db_user_password' => '2b00a6ee707290a755f1a880783fcc40',

            'save_error_to_db' => true,

            'log_requests'     => false,
            
            '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 GetResponsePrivateKey()
    {
        return $this->_commonConfig['response_privateKey'];
    }

    public function GetResponsePublicKey()
    {
        return $this->_commonConfig['response_publicKey'];
    }

    public function GetRequestPrivateKey()
    {
        return $this->_commonConfig['request_privateKey'];
    }

    public function GetRequestPublicKey()
    {
        return $this->_commonConfig['request_publicKey'];
    }

    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 IsConnectionEncryptionEnabled()
    {
        return $this->_commonConfig['enable_connection_encryption'];
    }

    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 GetResetPasswordEmailTemplate()
    {
        return $this->_commonConfig['reset_password_email_template'];
    }
    
    public function GetResetPasswordEmailPlaintextTemplate()
    {
        return $this->_commonConfig['reset_password_email_plaintext'];
    }
    
    public function GetResetPasswordEmailSubject()
    {
        return $this->_commonConfig['reset_password_email_subject'];
    }
    
    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'];
    }
}

?>
