<?php
require_once(dirname(__FILE__) . '/db/db.cnf.php');
require_once(dirname(__FILE__) . '/db/database.Class.php');
$db = new database();
if(realpath($_SERVER["SCRIPT_FILENAME"]) == __FILE__) { // direct access denied
        header("Location: /");
        exit;
}

$bgColor = '';
$system_email = '';
$ic_send_mail = '';
$sys_smtp = '';
$ic_smtp = '';
$smtp_host = '';
$smtp_port = '';
$smtp_security = '';
$smtp_user = '';
$smtp_pass = '';
$smtp_ssl_verify = '';		
$tasker_hash = '';
$scan_timeout = '';
$batch_limit = '';
$scan_port = '';
$scan_mail = '';
$smtp_status = '';
$smtp_debug = '';
$smtp_auth = '';
$email_campaigns = '';
$inbox_checker = '';
$unsubscribe_link = '';
$email_limit = '';
$activity_debug = '';
$system_debug = '';
$scan_debug = '';
$ver_check = '';
$blacklist_check = '';
$cc_data = '';

$evp_options_sql = "SELECT * FROM evp_options";
$evp_options_read = $db->select($evp_options_sql);

if ($evp_options_read) {
$evp_options_check = mysqli_num_rows($evp_options_read);
if ($evp_options_check > 0) {
	while ($row = $evp_options_read->fetch_assoc()) {
		$option_name[$row['option_name']] = $row['option_value'];
	}
	$evp_options_read->free();
	$logo_image = $option_name['site_logo'];
	$app_title = $option_name['site_title'];
	$site_title =  $option_name['site_title'];
	$bgColor = $option_name['bgColor'];
	$system_email = $option_name['system_email'];
	$ic_send_mail = $option_name['ic_send_mail'];
	$scan_timeout = $option_name['scan_time_out'];
	$tasker_hash = $option_name['tasker_hash'];
	$batch_limit = $option_name['batch_limit'];
	$cc_data = unserialize($option_name['cc_data']);
	$scan_port = $option_name['scan_port'];
	$scan_mail = $option_name['scan_mail'];
	$smtp_status = $option_name['smtp_status'];
	$smtp_debug = $option_name['smtp_debug'];
	$activity_debug = $option_name['activity_debug'];
	$scan_debug = $option_name['scan_debug'];
	$system_debug = $option_name['system_debug'];
	$email_campaigns = $option_name['email_campaigns'];
	$inbox_checker = $option_name['inbox_checker'];
	$ic_smtp_errors = $option_name['smtp_errors'];
	$email_limit = $option_name['email_limit'];
	$smtp_cmd = $option_name['smtp_cmd'];
	$user_id = $option_name['user_id'];
	$username = $option_name['username'];
	$user_email = $option_name['email'];
	$user_pass = $option_name['password'];
	$user_fname = $option_name['fname'];
	$user_lname = $option_name['lname'];
	$user_name = $user_fname .' '. $user_lname;
	$reset_pass_token = $option_name['reset_pass_token'];
	$verify_email_token = $option_name['verify_email_token'];
	$s_url =  $option_name['site_url'];		
	$a_url =  $option_name['app_url'];		
	$s_path =  $option_name['script_path'];
	$s_ver = $option_name['script_ver'];
	$ver_check = $option_name['ver_check'];
	$blacklist_check = $option_name['blacklist_check'];
	$setup_ready = $option_name['validation'];
	$lic_key = $option_name['license_key'];
	$lic_id = $option_name['license_id'];
	$lic_type = $option_name['license_title'];
	$lic_exp = $option_name['license_exp'];
	$lic_support = $option_name['license_support'];
	$sys_smtp_data = $option_name['sys_smtp'];
	if(!empty($sys_smtp_data)){
			$sys_smtp_data = unserialize($sys_smtp_data);
			$sys_smtp = $sys_smtp_data['sys_smtp'];
			  foreach($sys_smtp_data as $smtp_data) {};
				$smtp_host = $smtp_data['smtp_host'];
				$smtp_port = $smtp_data['smtp_port'];
				$smtp_security = $smtp_data['smtp_security'];
				$smtp_auth = $smtp_data['smtp_auth'];
				$smtp_user = $smtp_data['smtp_user'];
				$smtp_pass = $smtp_data['smtp_pass'];
				$smtp_ssl_verify = $smtp_data['smtp_ssl_verify'];
	}
	
	$ic_smtp_data = $option_name['ic_smtp'];
	if(!empty($ic_smtp_data)){
			$ic_smtp_data = unserialize($ic_smtp_data);
			$ic_smtp = $ic_smtp_data['ic_smtp'];
			  foreach($ic_smtp_data as $smtp_data) {};
				$ic_imap_host = $smtp_data['imap_host'];
				$ic_imap_port = $smtp_data['imap_port'];
				$ic_smtp_host = $smtp_data['smtp_host'];
				$ic_smtp_port = $smtp_data['smtp_port'];
				$ic_smtp_security = $smtp_data['smtp_security'];
				$ic_smtp_auth = $smtp_data['smtp_auth'];
				$ic_smtp_user = $smtp_data['smtp_user'];
				$ic_smtp_pass = $smtp_data['smtp_pass'];
				$ic_smtp_ssl_verify = $smtp_data['smtp_ssl_verify'];
	}
	
	if (empty($logo_image)) {
		$logo_image = 'default_logo.png';
	}
	if (empty($app_title)) {
		$app_title = 'Email Verifier Pro';
	}
} else {
	$logo_image = 'default_logo.png';
	$app_title = 'Email Verifier Pro';
}
}
if(($smtp_debug || $activity_debug || $scan_debug || $system_debug) == 'true') {
	require_once(dirname(__FILE__) . '/functions/class.logger.php');
	$log = new Logger();
}

require_once(dirname(__FILE__) . '/functions/languages/class.translate.php');
$translator = new translator();

require_once(dirname(__FILE__) . '/functions/class.mailsend.php');