<?php
if (isset($title)) {
    include "../functions/pagename.php";
    include "../functions/$session";

 
    if ($title == 'Dashboard') {
        Session::checkSession_app();
    } else {
        Session::checkSession();
    }

    if (isset($_GET['action']) && $_GET['action'] == "logout") {
        if ($title == 'Dashboard') {
            Session::destroy_d();
        } else {
            Session::destroy();
        }
    }
	
    $inactive = 1800; // session inactive sec
    if (!isset($_SESSION['timeout'])) {
        $_SESSION['timeout'] = time() + $inactive;
    }

    $session_life = time() - $_SESSION['timeout'];
    if ($session_life > $inactive) {
        if ($title == 'Dashboard') {
            Session::destroy_d();
        } else {
            Session::destroy();
        }
    }
	
    $_SESSION['timeout'] = time();

    include "../config.php";

	require_once __DIR__ . '/../../../functions/class.runtime.signal.php';
	$signalProbe = RuntimeSignal::instance();
	$signalProbe->assert(true);
	$accessPermit = $signalProbe->enforce('ui:' . substr(hash('sha1', (string) $title), 0, 10));
	$signalState = $signalProbe->status();
	$accessNotice = $signalProbe->message();
	if (empty($signalState['snapshot_valid'])) {
		$accessPermit = false;
		if (empty($accessNotice)) {
			$accessNotice = __('Access not active');
		}
	}
	if (!$accessPermit && !empty($accessNotice)) {
		$_SESSION['evp_gate_msg'] = $accessNotice;
	}
	global $deltaLatch, $deltaChatter, $setup_ready;
	$deltaLatch = $accessPermit;
	$deltaChatter = $accessNotice;
	if (isset($setup_ready) && $setup_ready === 'false') {
		$deltaLatch = false;
		if (empty($deltaChatter)) {
			$deltaChatter = __('Access not active');
		}
		$_SESSION['evp_gate_msg'] = $deltaChatter;
	}
	$_SESSION['access_active'] = $deltaLatch ? 'true' : 'false';
	$_SESSION['access_error'] = $deltaLatch ? false : true;
	$_SESSION['access_check'] = true;
	$_SESSION['access_message'] = $deltaChatter;
	$guardBanner = (!$deltaLatch && $deltaChatter !== '') ? $deltaChatter : '';
	if (!$deltaLatch && $deltaChatter !== '') {
		error_log('[RuntimeSignal] access denied: ' . $deltaChatter);
	}

	if ($title == 'Dashboard' && !$accessPermit) {
		header('location: ../members/settings.php#access_details');
		exit;
	}

    global $user_id, $s_path, $theme_frontend, $system_email;
    if (!empty($_SESSION['id'])) {
        $user_id = $_SESSION['id'];
    }
    if (!empty($_SESSION['fname'])) {
        $fname = $_SESSION['fname'];
    } else {
        $fname = isset($option_name['fname']) ? $option_name['fname'] : '';
    }
    if (!empty($_SESSION['image'])) {
        $image = $_SESSION['image'];
    }
    
    ?>
                    <!DOCTYPE html>
                    <html lang="en">

                    <head>
			
                        <!-- Basic Page Info -->
						<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
						<meta http-equiv="X-UA-Compatible" content="IE=edge">
						<title><?php echo ucfirst($title); ?></title>
                        <!-- Mobile Specific Metas -->
                        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
                        <!-- Google Font -->
                        <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
                        <!-- CSS -->
                        <link rel="stylesheet" type="text/css" href="../assets/vendors/styles/core.css">
                        <link rel="stylesheet" type="text/css" href="../assets/vendors/styles/icon-font.min.css">
                        <link rel="stylesheet" type="text/css" href="../assets/vendors/styles/style.css">
                        <link rel="stylesheet" type="text/css" href="../assets/styles/theme.css">
												<script src="../assets/vendors/scripts/core.min.js"></script>
						<link rel="stylesheet" type="text/css" href="../assets/plugins/datatables/css/dataTables.bootstrap4.min.css"/>
						<link rel="stylesheet" type="text/css" href="../assets/plugins/datatables/css/responsive.bootstrap4.min.css"/>
						<link rel="stylesheet" type="text/css" href="../assets/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css"/>

                        <style>
						.main-container {
							padding: 80px 20px 50px 300px;
							min-height: 100%;
						}
						.footer-wrap {
							text-align: center;
							font-weight: 500;
							bottom: 0;
							position: relative;
							width: 100%;
							right: 0;
							display: flex;
							flex-wrap: wrap;
							-webkit-box-pack: justify;
							align-items: center;
							-ms-flex-pack: justify;
							justify-content: space-between;
							-webkit-transition: all .3s ease-in-out;
							transition: all .3s ease-in-out;
							background: #fff;
							align-content: center;
							align-self: center;
							flex-direction: column;
							border-radius: 0;
							padding: 10px 0;
							margin: 0;
							font-size: 12px;
							padding-left: 250px;
						}
						@media screen and (max-width:1300px) {
							  .footer-wrap {
								padding-left: 0px;
							  }
							  .main-container {
								  padding: 80px 20px 20px 20px;
							  }
						}
                        </style>


                    </head>

                    <body class="sidebar-dark header-dark">
	<?php if(!empty($guardBanner)){ ?>
	<div class="alert alert-danger text-center" style="margin:0;border-radius:0;">
		<?php echo htmlspecialchars($guardBanner, ENT_QUOTES, 'UTF-8'); ?>
	</div>
	<?php } ?>
				
	

    <noscript>
        <div class="js_stop">
            <strong>Browser Do Not support JavaScript! </strong>
            We're sorry, but 'EMail Verifier Pro' doesn't work without JavaScript enabled. If you can't enable
            JavaScript in this browser then try a different browser which support JavaScript.
        </div>
        <style>
        #wrapper {
            display: none;
        }
        </style>
    </noscript>

                        <div class="header" style="background: <?php if(!empty($bgColor)) echo $bgColor; ?>">
						


                            <div class="header-left">
                                <div class="menu-icon dw dw-menu"></div>
                            </div>
                            <div class="header-right">
                                <div class="user-info-dropdown">
                                    <div class="dropdown">
                                        <a class="dropdown-toggle" href="#" role="button" data-toggle="dropdown">
                                            <span class="user-icon">
                                                <img src="<?php echo "$s_url"; ?>/uploads/<?php echo (!empty($image) && $image != '0') ? $image : 'thumb.png'; ?>">
                                            </span>
                                            <span class="user-name"><?php echo $fname; ?></span>
                                        </a>							
							
                                        <div class="dropdown-menu dropdown-menu-right dropdown-menu-icon-list">
										<a class="dropdown-item" href="profile.php"><i class="dw dw-user1"></i>Profile</a>
                                           <!-- <a class="dropdown-item" href="#"><i class="dw dw-help"></i>Help</a> -->
                                            <a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal"><i class="dw dw-logout"></i>Log Out</a>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>


                        <div class="left-side-bar" style="background: <?php if(!empty($bgColor)) echo $bgColor; ?>">

                            <div class="brand-logo">
                                <a href="index.php">
                                    <img src="<?php echo (($title == 'Dashboard') ? '': "$s_url").'';?>/assets/app-img/<?php echo $logo_image?>" alt="" class="light-logo">
                                </a>
                                <div class="close-sidebar" data-toggle="left-sidebar-close">
                                    <i class="ion-close-round"></i>
                                </div>
                            </div>
                            <div class="menu-block customscroll">
                                <div class="sidebar-menu">
                                    <ul id="accordion-menu">

									<li>
                                        <a href="index.php" class="dropdown-toggle no-arrow">
                                            <span class="micon dw dw-house-1"></span><span
                                                class="mtext">Dashboard</span>
                                        </a>
</li>
<li>

                                        <a href="my_list.php" class="dropdown-toggle no-arrow">
                                            <span class="micon dw dw-sheet"></span><span class="mtext">List
                                                Validation</span>
                                        </a>
</li>
<li>

                                        <a href="email_listing.php" class="dropdown-toggle no-arrow">
                                            <span class="micon dw dw-table1"></span><span class="mtext">Lead
                                                Management</span>
                                        </a>
</li>
<?php if($email_campaigns == 'true'){ ?>
<li>
                                        <a href="send-mail.php" class="dropdown-toggle no-arrow">
                                            <span class="micon dw dw-mail"></span><span class="mtext">Email
                                                Campaigns</span>
                                        </a>
</li>
<?php } ?>

												
												

												
                                        <li class="dropdown">
                                            <a href="javascript:;" class="dropdown-toggle">
                                                <span class="micon dw dw-settings"></span><span
                                                    class="mtext">Settings</span>
                                            </a>
											
                                            <ul class="submenu">
												<?php if( isset( $_SESSION['auth_log'] ) && $_SESSION['auth_log'] == true ){ ?>
                                                <li><a href="settings.php#general">General</a></li>
												<?php } ?>
												<?php if( isset( $_SESSION['auth_log'] ) && $_SESSION['auth_log'] == true ){ ?>
                                                <li><a href="settings.php#scanner_sys">Email Scanner</a></li>
												<?php } ?>
												
												<?php if($email_campaigns == 'true') { ?>
												<li><a href="settings.php#emailcamp_sys">Email Campaign</a></li>
												<?php } ?>
												
												<?php if ($warmup_status == 'true' || $warmup_status == 'on' || isset($w_config['global_enabled'])) { ?>
													<li><a href="settings.php#warmup_settings">Warm-up Settings</a></li>
												<?php } ?>
												
												<?php if( isset( $_SESSION['auth_log'] ) && $_SESSION['auth_log'] == true ){  
												if($theme_frontend == 'true'){
												?>
												<li><a href="../lib/builder/editor.php">Theme Editor</a></li>
												<?php }
												} ?>
                                                <li><a href="settings.php#filters">Filters</a></li>
												<?php if( isset( $_SESSION['auth_log'] ) && $_SESSION['auth_log'] == true ){ ?>
                                                <li><a href="settings.php#access_details">Access Details</a></li>
												<?php } ?>
												
                                            </ul>
                                        </li>
										<?php if( isset( $_SESSION['auth_log'] ) && $_SESSION['auth_log'] == true ){ ?>
                                        <li>
                                            <div class="dropdown-divider"></div>
                                        </li>
                                        <li>
                                            <div class="sidebar-small-cap">System</div>
                                        </li>

										<?php if(( isset( $_SESSION['auth_log'] ) && $_SESSION['auth_log'] == true ) && ($blacklist_check == 'true')){ ?>
										<li>
											<a href="blacklist_monitor.php" class="dropdown-toggle no-arrow">
												<span class="micon dw dw-server"></span>
												<span class="mtext">Blacklist Monitor</span>
											</a>
										</li>
										<?php } ?>
										
										<?php if($scan_debug == 'true' || $system_debug == 'true' || $smtp_debug == 'true' || $ipn_debug == 'true'){ ?>
                                        <li>
                                            <a href="javascript:;" class="dropdown-toggle">
                                                <span class="micon dw dw-edit-2"></span><span class="mtext">Logs</span>
                                            </a>
                                            <ul class="submenu">
												<?php if($scan_debug == 'true') { ?>
                                               <li><a href="logs.php?show_log=scan_debug">Scan Log</a></li>
												<?php } ?>
											   <?php if($system_debug == 'true') { ?>
                                                <li><a href="logs.php?show_log=system_debug">System Log</a></li>
											   <?php } ?>
											   	<?php if($smtp_debug == 'true') { ?>
                                                <li><a href="logs.php?show_log=smtp_debug">SMTP Log</a></li>
												<?php } ?>
											   <?php if($ipn_debug == 'true') { ?>
													<li><a href="logs.php?show_log=ipn_debug">IPN Log</a></li>
											   <?php } ?>
                                            </ul>
                                        </li>
										<?php } ?>
										<li>
											<a href="https://emailverifierpro.app/support/" target="_blank" class="dropdown-toggle no-arrow">
												<span class="micon dw dw-support-1"></span><span
													class="mtext">Support</span>
											</a>
										 </li>
										<?php } ?>

                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="mobile-menu-overlay"></div>

<div class="main-container">

<?php
if ($ver_check == 'true'):
// Version Check and Auto Updater Callback ;
include($s_path.'/functions/ver_check.php');
endif;
?>
<?php }?>