<?php
#  ________         ____________      _____ ________                       ________      
#  ___  __ )____  _____  /___  /_____ __  /____  __ \______________ ______ ___  __/      
#  __  __  |_  / / /__  / __  / _  _ \_  __/__  /_/ /__  ___/_  __ \_  __ \__  /_        
#  _  /_/ / / /_/ / _  /  _  /  /  __// /_  _  ____/ _  /    / /_/ // /_/ /_  __/        
#  /_____/  \__,_/  /_/   /_/   \___/ \__/  /_/      /_/     \____/ \____/ /_/           
#  ________                             _____ _____              ________                
#  __  ___/_____ ___________  _____________(_)__  /______  __    ___  __ \______________ 
#  _____ \ _  _ \_  ___/_  / / /__  ___/__  / _  __/__  / / /    __  /_/ /__  ___/_  __ \
#  ____/ / /  __// /__  / /_/ / _  /    _  /  / /_  _  /_/ /     _  ____/ _  /    / /_/ /
#  /____/  \___/ \___/  \__,_/  /_/     /_/   \__/  _\__, /      /_/      /_/     \____/ 
#                                                   /____/                               
# 42756C6C657450726F6F66 5365637572697479 50726F 
#
/*	The Copyright, AITpro Software Products License Information must remain
	intact or all BulletProof Security Pro warranties, guarantees, liabilities are void.
	
	Copyright (C) Edward Alexander, AIT-pro.com. All rights reserved.

	AITpro Software Products License Information:
	BY DOWNLOADING, INSTALLING, COPYING, ACCESSING, OR USING BulletProof Security Pro YOU AGREE TO THE TERMS OF THIS AGREEMENT. 
	IF YOU 	ARE ACCEPTING THESE TERMS ON BEHALF OF ANOTHER PERSON OR A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT AND WARRANT
	THAT YOU HAVE FULL AUTHORITY TO BIND THAT PERSON, COMPANY, OR LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT AGREE TO THESE TERMS,
	* DO NOT DOWNLOAD, INSTALL, COPY, ACCESS, OR USE BulletProof Security Pro; AND
	* PROMPTLY RETURN BulletProof Security Pro TO THE PARTY FROM WHOM YOU ACQUIRED IT. IF YOU DOWNLOADED BulletProof Security Pro
	FROM THE AITPRO WEBSITE, CONTACT AITPRO FOR A REFUND IF APPLICABLE.
	
	AITpro Software Products License Information continued:
	You agree to keep the AITpro Software Products License for BulletProof Security Pro, unmodified or altered in any way,
	with the original copy of BulletProof Security Pro that you have and any and all copies or partial copies of BulletProof
	Security Pro that You make. 
*/
// Direct calls to this file are Forbidden when core files are not present
if ( ! function_exists('add_action') ) {
		header('Status: 403 Forbidden');
		header('HTTP/1.1 403 Forbidden');
		exit();
}
 
if ( ! current_user_can('manage_options') ) { 
		header('Status: 403 Forbidden');
		header('HTTP/1.1 403 Forbidden');
		exit();
}
?>

<!-- force the vertical scrollbar -->
<style>
#wpwrap{min-height:100.1%};
</style>

<div id="bps-container" class="wrap" style="margin:10px 20px 5px 0px;">

<noscript><div id="message" class="updated" style="font-weight:600;font-size:13px;padding:5px;background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><span style="color:blue">BPS Warning: JavaScript is disabled in your Browser</span><br />BPS plugin pages will not display visually correct and all BPS JavaScript functionality will not work correctly.</div></noscript>

<?php 
$ScrollTop_options = get_option('bulletproof_security_options_scrolltop');

if ( isset( $ScrollTop_options['bps_scrolltop'] ) && $ScrollTop_options['bps_scrolltop'] != 'Off' ) {
	
	if ( esc_html($_SERVER['REQUEST_METHOD']) == 'POST' || isset( $_GET['settings-updated'] ) && @$_GET['settings-updated'] == true ) { 

		bpsPro_Browser_UA_scroll_animation();
	}
}
?>

<?php
// S-Monitor HUD - Heads Up Display - Warnings, Error messages, AutoFix Setup & Whitelist - displayed in BPS Only		
bps_HUD_autofix_setup_bps_only();
bps_HUD_autofix_whitelist_bps_only();
bps_HUD_bps_only();

// S-Monitor BPS Security Status for Root and wp-admin (wp-admin only if problem) - displayed in BPS Only
bps_security_status_bps_only();
bps_security_status_wpadmin_bps_only();

// S-Monitor & AutoRestore Status display - displayed in  BPS Only 
bps_ARCM_admin_notice_status_bps();

// S-Monitor - MScan Status display - BPS pages ONLY
bps_MScan_admin_notice_status_bps();

// S-Monitor - DB Monitor Status display - BPS pages ONLY
bps_DBM_admin_notice_status_bps();

// S-Monitor - DB Backup Status display - BPS pages ONLY
bps_DBB_admin_notice_status_bps();

// S-Monitor - Plugin Firewall Status display - BPS pages ONLY
bps_PFWAP_admin_notice_status_bps();

// S-Monitor - Uploads Anti-Exploit Guard Status display - BPS pages ONLY
bps_UAEG_admin_notice_status_bps();

// S-Monitor - Login Security Status display - BPS pages ONLY
bps_Login_Security_admin_notice_status_bps();

// S-Monitor - JTC Anti-Spam Status display - BPS pages ONLY
bps_jtc_antispam_admin_notice_status_bps();

// S-Monitor - Idle Session Status display - BPS pages ONLY
bpsPro_isl_notice_status_bps();

// S-Monitor - Auth Cookie Expiration Status display - BPS pages ONLY
bpsPro_ace_notice_status_bps();

// S-Monitor - Login Security Alerts - BPS pages ONLY
bps_smonitor_LoginSecurityResetModTimeDiff_bps();

// S-Monitor - ARQ Alerts - BPS pages ONLY
bps_smonitor_ARQ_alerts_bps();

// S-Monitor PHP Error Log - New PHP Errors - displayed in BPS Only
bps_smonitor_ELogModTimeDiff_bps();

// S-Monitor Security Log - New Log Entry Has Been Logged - displayed in BPS Only
bps_smonitor_SecurityLogModTimeDiff_bps();

// S-Monitor - PHP Error Log Set & valid path, ini_set Options Checks & auto-update wp-config.php - BPS pages ONLY
bps_smonitor_phpini_bps();

// S-Monitor F-Lock - Check if F-Lock options saved - F-Lock Lock / Unlock File Status & actual file permissions 404 or 400
bps_smonitor_flock_bps();
?>

<div id="message" class="updated" style="border:1px solid #999;background-color:#000;">

<?php
// Top div echo & bottom div echo
$bps_topDiv = '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
$bps_bottomDiv = '</p></div>';
$UIoptions = get_option('bulletproof_security_options_theme_skin');

// PHP Standard PHP Library (SPL) Check - if SPL is not installed / On then AutoRestore/Quarantine Iterators will not work
if ( ! is_array( spl_classes() ) ) {
	echo $bps_topDiv;
	$text = '<p><font color="#fb0101"><strong>'.__('The PHP Standard PHP Library (SPL) is Not Available - Please send an email to info@ait-pro.com for assistance.', 'bulletproof-security').'</strong></font></p>';
	echo $text;
	echo $bps_bottomDiv;
}

// General all purpose "Settings Saved." message for forms - /includes/class.php
if ( current_user_can('manage_options') && wp_script_is( 'bps-accordion', $list = 'queue' ) ) {
if ( isset( $_GET['settings-updated'] ) && @$_GET['settings-updated'] == true ) {
	$text = '<p style="font-size:1em;font-weight:bold;padding:2px 0px 2px 5px;margin:0px -11px 0px -11px;background-color:#dfecf2;-webkit-box-shadow: 3px 3px 5px 0px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px 0px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px 0px rgba(153,153,153,0.7);"><font color="green"><strong>'.__('Settings Saved', 'bulletproof-security').'</strong></font></p>';
	echo $text;
	} else {
	echo '<font color="#fb0101"><strong>'.bps_cuser_errors().'</strong></font>';
	}
}

/*********************************/
/*   ARQ File Counters & MTime   */
/*********************************/

// Master ARQ file counter - Not Used/Not necessary - will count the total # of files in all autorestore directories
function bpsFileCounterMaster($source, $count) {
	$source = WP_CONTENT_DIR . '/bps-backup/autorestore/';
	$count = 0;
	
	if ( is_dir($source) ) {
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);

	foreach ( $iterator as $files ) {
    	if ( $files->isFile() ) {
    	$count++;
		}
	}
	if ( $count <= 0 ) {
		echo $bps_topDiv;
		$text = '<font color="#fb0101"><strong>'.$count.__(' Files Backed up in the AutoRestore folder and all subdirectories.', 'bulletproof-security').'</strong></font>';
		echo $text;
		echo $bps_bottomDiv;
	} else {
		echo $bps_topDiv;
		$text = '<span class="arq-backup-files"><strong>'.$count.__(' Files Backed up in the AutoRestore folder and all subdirectories.', 'bulletproof-security').'</strong></span>';
		echo $text;
		echo $bps_bottomDiv;
	}
	}
}
// echo bpsFileCounterMaster($source, $count);

// Root ARQ file counter & MTime
function bpsFileCounterRoot($source, $count) {
	$source = WP_CONTENT_DIR . '/bps-backup/autorestore/root-files';
	$count = 0;
	
	if ( ! is_dir($source) ) {
	$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	}

	if ( isset($_POST['bpsARCMSubmit']) || isset($_POST['Submit-ARCM-RootNR']) || isset($_POST['Submit-ARCM-Wpadmin']) || isset($_POST['Submit-ARCM-Wpincludes']) || isset($_POST['Submit-ARCM-Wpcontent']) || isset($_POST['Submit-ARCM-Root-Delete']) || isset($_POST['Submit-ARCM-Wpadmin-Delete']) || isset($_POST['Submit-ARCM-Wpincludes-Delete']) || isset($_POST['Submit-ARCM-Wpcontent-Delete']) || isset($_POST['Submit-ARCM-Root-Restore']) || isset($_POST['Submit-ARCM-Wpadmin-Restore']) || isset($_POST['Submit-ARCM-Wpincludes-Restore']) || isset($_POST['Submit-ARCM-Wpcontent-Restore']) || isset($_POST['Submit-ARCM-Root-Show-Backup']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Backup']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Backup']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Backup']) || isset($_POST['Submit-ARCM-Root-Show-Website']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Website']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Website']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Website']) || isset($_POST['bps-exclude-filter-creator-copy']) || isset($_POST['bps-exclude-filter-creator-write']) || isset($_POST['Submit-ARQ-Add-Remove']) || isset($_POST['Submit-ARQ-Exclude']) || isset($_POST['submit-arq-top-level-search']) || isset($_POST['submit-arq-all-folders-search']) || isset($_POST['submit-arq-specific-folder-search']) || isset($_POST['submit-arq-db-add-remove-search']) || isset($_POST['submit-arq-db-exlude-remove-search']) || isset($_POST['Submit-ARQ-Remove-Added']) || isset($_POST['Submit-ARQ-Remove-Excluded']) ) {
		return;
	}

	$ARQoptions = get_option('bulletproof_security_options_ARCM');
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;
	
	if ( isset($ARQoptions['bps_autorestore_cron_filecheck']) && $ARQoptions['bps_autorestore_cron_filecheck'] == 'Off' ) {
		$text = __('Backup File Status Check', 'bulletproof-security').'<br>'.__('is Turned Off', 'bulletproof-security');
		echo $text;
		return;
	
	} else {

	if ( is_dir($source) ) {
		$iterator = new DirectoryIterator($source);

	foreach ( $iterator as $files ) {
    	if ( $files->isFile() ) {
    	$count++;
		$mtime = date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset );
		}
	}
	
	if ( $count <= 4 ) { // should only be 1 or 2 files, but leaving a buffer
		$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	} else {
		$text = __('Backup: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$mtime.'</strong></span><br>'.__('Total Backup Files: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$count.'</strong></span>';
		echo $text;
	}
	}
	}
}

// wp-admin ARQ file counter & MTime
function bpsFileCounterWpadmin($source, $count) {
$source = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-admin/';
$count = 0;
$GDMW_options = get_option('bulletproof_security_options_GDMW');

	if ( isset( $GDMW_options['bps_gdmw_hosting'] ) && $GDMW_options['bps_gdmw_hosting'] == 'yes' ) {
		$text = '<span class="arq-backup-files"><strong>'.__('GDMW Hosting', 'bulletproof-security').'<br>'.__('wp-admin check is Turned Off', 'bulletproof-security').'</strong></span>';
		echo $text;
		return;
	}

	if ( ! is_dir($source) ) {
	$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	}
	
	if ( isset($_POST['bpsARCMSubmit']) || isset($_POST['Submit-ARCM-RootNR']) || isset($_POST['Submit-ARCM-Wpadmin']) || isset($_POST['Submit-ARCM-Wpincludes']) || isset($_POST['Submit-ARCM-Wpcontent']) || isset($_POST['Submit-ARCM-Root-Delete']) || isset($_POST['Submit-ARCM-Wpadmin-Delete']) || isset($_POST['Submit-ARCM-Wpincludes-Delete']) || isset($_POST['Submit-ARCM-Wpcontent-Delete']) || isset($_POST['Submit-ARCM-Root-Restore']) || isset($_POST['Submit-ARCM-Wpadmin-Restore']) || isset($_POST['Submit-ARCM-Wpincludes-Restore']) || isset($_POST['Submit-ARCM-Wpcontent-Restore']) || isset($_POST['Submit-ARCM-Root-Show-Backup']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Backup']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Backup']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Backup']) || isset($_POST['Submit-ARCM-Root-Show-Website']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Website']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Website']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Website']) || isset($_POST['bps-exclude-filter-creator-copy']) || isset($_POST['bps-exclude-filter-creator-write']) || isset($_POST['Submit-ARQ-Add-Remove']) || isset($_POST['Submit-ARQ-Exclude']) || isset($_POST['submit-arq-top-level-search']) || isset($_POST['submit-arq-all-folders-search']) || isset($_POST['submit-arq-specific-folder-search']) || isset($_POST['submit-arq-db-add-remove-search']) || isset($_POST['submit-arq-db-exlude-remove-search']) || isset($_POST['Submit-ARQ-Remove-Added']) || isset($_POST['Submit-ARQ-Remove-Excluded']) ) {
		return;
	}
	
	$ARQoptions = get_option('bulletproof_security_options_ARCM');
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;
	
	if ( isset($ARQoptions['bps_autorestore_cron_filecheck']) && $ARQoptions['bps_autorestore_cron_filecheck'] == 'Off' ) {
		$text = __('Backup File Status Check', 'bulletproof-security').'<br>'.__('is Turned Off', 'bulletproof-security');
		echo $text;
		return;
	
	} else {

	if ( is_dir($source) ) {
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);

	foreach ( $iterator as $files ) {
    	if ( $files->isFile() ) {
    	$count++;
		$mtime = date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset );
		}
	}
	if ( $count <= 4 ) { // should only be 0 files, but leaving a buffer
		$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	} else {
		$text = __('Backup: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$mtime.'</strong></span><br>'.__('Total Backup Files: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$count.'</strong></span>';
		echo $text;
	}
	}
	}
}

// wp-includes ARQ file counter & MTime
function bpsFileCounterWpincludes($source, $count) {
$source = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-includes/';
$count = 0;
$GDMW_options = get_option('bulletproof_security_options_GDMW');

	if ( isset( $GDMW_options['bps_gdmw_hosting'] ) && $GDMW_options['bps_gdmw_hosting'] == 'yes' ) {
		$text = '<span class="arq-backup-files"><strong>'.__('GDMW Hosting', 'bulletproof-security').'<br>'.__('wp-includes check is Turned Off', 'bulletproof-security').'</strong></span>';
		echo $text;
		return;
	}	
	
	if ( ! is_dir($source) ) {
	$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	}

	if ( isset($_POST['bpsARCMSubmit']) || isset($_POST['Submit-ARCM-RootNR']) || isset($_POST['Submit-ARCM-Wpadmin']) || isset($_POST['Submit-ARCM-Wpincludes']) || isset($_POST['Submit-ARCM-Wpcontent']) || isset($_POST['Submit-ARCM-Root-Delete']) || isset($_POST['Submit-ARCM-Wpadmin-Delete']) || isset($_POST['Submit-ARCM-Wpincludes-Delete']) || isset($_POST['Submit-ARCM-Wpcontent-Delete']) || isset($_POST['Submit-ARCM-Root-Restore']) || isset($_POST['Submit-ARCM-Wpadmin-Restore']) || isset($_POST['Submit-ARCM-Wpincludes-Restore']) || isset($_POST['Submit-ARCM-Wpcontent-Restore']) || isset($_POST['Submit-ARCM-Root-Show-Backup']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Backup']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Backup']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Backup']) || isset($_POST['Submit-ARCM-Root-Show-Website']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Website']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Website']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Website']) || isset($_POST['bps-exclude-filter-creator-copy']) || isset($_POST['bps-exclude-filter-creator-write']) || isset($_POST['Submit-ARQ-Add-Remove']) || isset($_POST['Submit-ARQ-Exclude']) || isset($_POST['submit-arq-top-level-search']) || isset($_POST['submit-arq-all-folders-search']) || isset($_POST['submit-arq-specific-folder-search']) || isset($_POST['submit-arq-db-add-remove-search']) || isset($_POST['submit-arq-db-exlude-remove-search']) || isset($_POST['Submit-ARQ-Remove-Added']) || isset($_POST['Submit-ARQ-Remove-Excluded']) ) {
		return;
	}

	$ARQoptions = get_option('bulletproof_security_options_ARCM');
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;
	
	if ( isset($ARQoptions['bps_autorestore_cron_filecheck']) && $ARQoptions['bps_autorestore_cron_filecheck'] == 'Off' ) {
		$text = __('Backup File Status Check', 'bulletproof-security').'<br>'.__('is Turned Off', 'bulletproof-security');
		echo $text;
		return;
	
	} else {

	if ( is_dir($source) ) {
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);

	foreach ( $iterator as $files ) {
    	if ( $files->isFile() ) {
    	$count++;
		$mtime = date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset );
		}
	}
	if ( $count <= 4 ) { // should only be 0 files, but leaving a buffer
		$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	} else {
		$text = __('Backup: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$mtime.'</strong></span><br>'.__('Total Backup Files: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$count.'</strong></span>';
		echo $text;
	}
	}
	}
}

// wp-content ARQ file counter & MTime
function bpsFileCounterWpcontent($source, $count) {
	$source = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-content/';
	$count = 0;
	
	if ( ! is_dir($source) ) {
	$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	}

	if ( isset($_POST['bpsARCMSubmit']) || isset($_POST['Submit-ARCM-RootNR']) || isset($_POST['Submit-ARCM-Wpadmin']) || isset($_POST['Submit-ARCM-Wpincludes']) || isset($_POST['Submit-ARCM-Wpcontent']) || isset($_POST['Submit-ARCM-Root-Delete']) || isset($_POST['Submit-ARCM-Wpadmin-Delete']) || isset($_POST['Submit-ARCM-Wpincludes-Delete']) || isset($_POST['Submit-ARCM-Wpcontent-Delete']) || isset($_POST['Submit-ARCM-Root-Restore']) || isset($_POST['Submit-ARCM-Wpadmin-Restore']) || isset($_POST['Submit-ARCM-Wpincludes-Restore']) || isset($_POST['Submit-ARCM-Wpcontent-Restore']) || isset($_POST['Submit-ARCM-Root-Show-Backup']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Backup']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Backup']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Backup']) || isset($_POST['Submit-ARCM-Root-Show-Website']) || isset($_POST['Submit-ARCM-Wpadmin-Show-Website']) || isset($_POST['Submit-ARCM-Wpincludes-Show-Website']) || isset($_POST['Submit-ARCM-Wpcontent-Show-Website']) || isset($_POST['bps-exclude-filter-creator-copy']) || isset($_POST['bps-exclude-filter-creator-write']) || isset($_POST['Submit-ARQ-Add-Remove']) || isset($_POST['Submit-ARQ-Exclude']) || isset($_POST['submit-arq-top-level-search']) || isset($_POST['submit-arq-all-folders-search']) || isset($_POST['submit-arq-specific-folder-search']) || isset($_POST['submit-arq-db-add-remove-search']) || isset($_POST['submit-arq-db-exlude-remove-search']) || isset($_POST['Submit-ARQ-Remove-Added']) || isset($_POST['Submit-ARQ-Remove-Excluded']) ) {
		return;
	}

	$ARQoptions = get_option('bulletproof_security_options_ARCM');
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;
	
	if ( isset($ARQoptions['bps_autorestore_cron_filecheck']) && $ARQoptions['bps_autorestore_cron_filecheck'] == 'Off' ) {
		$text = __('Backup File Status Check', 'bulletproof-security').'<br>'.__('is Turned Off', 'bulletproof-security');
		echo $text;
		return;
	
	} else {

	if ( is_dir($source) ) {
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
	
	foreach ( $iterator as $files ) {
    	if ( $files->isFile() ) {
    	$count++;
		$mtime = date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset );
		}
	}
	if ( $count <= 0 ) { // should only be 0 files
		$text = '<font color="#fb0101"><strong>'.__('File Backup Required', 'bulletproof-security').'<br>'.__('Total Backup Files: ', 'bulletproof-security').$count.'</strong></font>';
		echo $text;
	
/* commented out in 12.
	} elseif ( $count > 1500 ) {
	
		$text = __('Backup: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$mtime.'</strong></span><br>'.__('Total Backup Files: ', 'bulletproof-security').'<font color="#fb0101"><strong>'.$count.'<br>'.__('The total number of backup files is excessive ', 'bulletproof-security').'<a href="https://forum.ait-pro.com/forums/topic/autorestore-the-total-number-of-backup-files-is-excessive/" target="_blank" title="Link opens in a new Browser window" style="font-size:12px;color:#2ea2cc;">'.__('Click Here', 'bulletproof-security').'</a></strong></font>';
		echo $text;	
*/	
	} else {
		
		$text = __('Backup: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$mtime.'</strong></span><br>'.__('Total Backup Files: ', 'bulletproof-security').'<span class="arq-backup-files"><strong>'.$count.'</strong></span>';
		echo $text;
	}
	}
	}
}

// FailSafe ARQ Cron Checks - onConfirm popup on Submit checks / messages
if ( current_user_can('manage_options') ) {
$bpsARQFailSafeRoot = WP_CONTENT_DIR . '/bps-backup/autorestore/root-files/index.php';
$bpsARQFailSafeWpadmin = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-admin/admin.php';
$bpsARQFailSafeWpincludes = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-includes/functions.php';
$bpsARQFailSafeWpcontent = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-content/index.php';
$bpsSpacePop = '-------------------------------------------------------------';

	if ( ! file_exists($bpsARQFailSafeRoot) ) {
	$BPSrootFSC = __('Root Files Need To Be Backed Up', 'bulletproof-security');
	} else {
	$BPSrootFSC = '';
	}
	
	if ( ! file_exists($bpsARQFailSafeWpadmin) ) {
	$BPSwpadminFSC = __('wp-admin Files Need To Be Backed Up', 'bulletproof-security');
	} else {
	$BPSwpadminFSC = '';
	}

	if ( ! file_exists($bpsARQFailSafeWpincludes) ) {
	$BPSwpincludesFSC = __('wp-includes Files Need To Be Backed Up', 'bulletproof-security');
	} else {
	$BPSwpincludesFSC = '';
	}
	
	if ( ! file_exists($bpsARQFailSafeWpcontent) ) {
	$BPSwpcontentFSC = __('wp-content Files Need To Be Backed Up', 'bulletproof-security');
	} else {
	$BPSwpcontentFSC = '';
	}
}

// Replace ABSPATH = wp-content/plugins
$bps_plugin_dir = str_replace( ABSPATH, '', WP_PLUGIN_DIR );
// Replace ABSPATH = wp-content
$bps_wpcontent_dir = str_replace( ABSPATH, '', WP_CONTENT_DIR );

require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/autorestore-help-text.php' );
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/arq-backup-files.php' );
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/arq-delete-files.php' );
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/arq-restore-files.php' );

// Anti-Piracy check - Fallback 10R
$D8 = '42756C6C657450726F6F66';
bpsPro_AP_Check($D8);

?>
</div>

<h2 class="bps-tab-title"><?php _e('BulletProof Security Pro ~ AutoRestore|Quarantine', 'bulletproof-security'); ?></h2>

<!-- jQuery UI Tab Menu -->
<div id="bps-tabs" class="bps-menu">
    <div id="bpsHead"><img src="<?php echo plugins_url('/bulletproof-security/admin/images/bps-pro-logo.gif'); ?>" />
    
<style>
<!--
.bps-spinner {
    visibility:visible;
	position:fixed;
    top:7%;
    left:45%;
 	width:240px;
	background:#fff;
	border:4px solid black;
	padding:2px 0px 4px 8px;   
	z-index:99999;
}
-->
</style> 

    <div id="bps-spinner" class="bps-spinner" style="visibility:hidden;">
    	<img id="bps-img-spinner" src="<?php echo plugins_url('/bulletproof-security/admin/images/bps-spinner.gif'); ?>" style="float:left;margin:0px 20px 0px 0px;" />
        <div id="bps-spinner-text-btn" style="padding:20px 0px 26px 0px;font-size:14px;">Processing...<br><button style="margin:10px 0px 0px 10px;" onclick="javascript:history.go(-1)">Cancel</button>
		</div>
    </div> 
    
<script type="text/javascript">
/* <![CDATA[ */
function ARQRootBackup() {
	
	var r = confirm("Click OK to backup your Root files or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>     
    
<script type="text/javascript">
/* <![CDATA[ */
function ARQwpadminBackup() {
	
	var r = confirm("Click OK to backup your wp-admin files or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>     

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpincludesBackup() {
	
    var r = confirm("Click OK to backup your wp-includes files or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>  

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpcontentBackup() {
	
    var r = confirm("Click OK to backup your wp-content files or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>  

<script type="text/javascript">
/* <![CDATA[ */
function ARQRootDelete() {
	
    var r = confirm("Clicking OK will delete all of your backed up Root AutoRestore files.\n\n-------------------------------------------------------------\n\nTo create new backed up Root AutoRestore files click the Root Backup Files button.\n\n-------------------------------------------------------------\n\nIf you are upgrading WordPress then click OK to delete your Root AutoRestore files. After you have finished upgrading WordPress click the Root Backup Files button to create new backed up Root AutoRestore files before turning the AutoRestore Cron back On.\n\n-------------------------------------------------------------\n\nClick OK to delete Root AutoRestore files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>  

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpadminDelete() {
	
    var r = confirm("Clicking OK will delete all of your backed up wp-admin AutoRestore files.\n\n-------------------------------------------------------------\n\nTo create new backed up wp-admin AutoRestore files click the wp-admin Backup Files button.\n\n-------------------------------------------------------------\n\nIf you are upgrading WordPress then click OK to delete your wp-admin AutoRestore files. After you have finished upgrading WordPress click the wp-admin Backup Files button to create new backed up wp-admin AutoRestore files before turning the AutoRestore Cron back On.\n\n-------------------------------------------------------------\n\nClick OK to delete wp-admin AutoRestore files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpincludesDelete() {
	
    var r = confirm("Clicking OK will delete all of your backed up wp-includes AutoRestore files.\n\n-------------------------------------------------------------\n\nTo create new backed up wp-includes AutoRestore files click the wp-includes Backup Files button.\n\n-------------------------------------------------------------\n\nIf you are upgrading WordPress then click OK to delete your wp-includes AutoRestore files. After you have finished upgrading WordPress click the wp-includes Backup Files button to create new backed up wp-includes AutoRestore files before turning the AutoRestore Cron back On.\n\n-------------------------------------------------------------\n\nClick OK to delete wp-includes AutoRestore files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpcontentDelete() {
	
    var r = confirm("Clicking OK will delete all of your backed up wp-content AutoRestore files.\n\n-------------------------------------------------------------\n\nTo create new backed up wp-content AutoRestore files click the wp-content Backup Files button.\n\n-------------------------------------------------------------\n\nIf you are upgrading WordPress then you DO NOT need to delete your wp-content Backup Files.\n\n-------------------------------------------------------------\n\nClick OK to delete wp-content AutoRestore files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQRootRestore() {
	
    var r = confirm("Clicking OK will restore all of your backed up Root AutoRestore files to your root directory.\n\n-------------------------------------------------------------\n\nClick OK to restore your Root files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpadminRestore() {
	
    var r = confirm("Clicking OK will restore all of your backed up wp-admin AutoRestore files to /wp-admin.\n\n-------------------------------------------------------------\n\nClick OK to restore your wp-admin files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpincludesRestore() {
	
    var r = confirm("Clicking OK will restore all of your backed up wp-includes AutoRestore files to /wp-includes.\n\n-------------------------------------------------------------\n\nClick OK to restore your wp-includes files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpcontentRestore() {
	
    var r = confirm("Clicking OK will restore all of your backed up wp-content AutoRestore files to wp-content.\n\n-------------------------------------------------------------\n\nClick OK to restore your wp-content files now or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQRootShowBackup() {
	
    var r = confirm("Clicking OK will show all of your backed up Root AutoRestore files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script> 

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpadminShowBackup() {
	
    var r = confirm("Clicking OK will show all of your backed up wp-admin AutoRestore files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpincludesShowBackup() {
	
    var r = confirm("Clicking OK will show all of your backed up wp-includes AutoRestore files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpcontentShowBackup() {
	
    var r = confirm("Clicking OK will show all of your backed up wp-content AutoRestore files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

<script type="text/javascript">
/* <![CDATA[ */
function ARQRootShowWebsite() {
	
    var r = confirm("Clicking OK will show all of your Root folder website files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpadminShowWebsite() {
	
    var r = confirm("Clicking OK will show all of your wp-admin folder website files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpincludesShowWebsite() {
	
    var r = confirm("Clicking OK will show all of your wp-includes folder website files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

<script type="text/javascript">
/* <![CDATA[ */
function ARQwpcontentShowWebsite() {
	
    var r = confirm("Clicking OK will show all of your wp-content folder website files.\n\n-------------------------------------------------------------\n\nClick OK to proceed or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>

    </div>
		<ul>
			<li><a href="#bps-tabs-1"><?php _e('AutoRestore|Quarantine', 'bulletproof-security'); ?></a></li>
            <li><a href="#bps-tabs-2"><?php _e('Exclude wp-content Folders', 'bulletproof-security'); ?></a></li>
            <li><a href="#bps-tabs-3"><?php _e('Add|Exclude Other Folders & Files', 'bulletproof-security'); ?></a></li>
			<li><a href="#bps-tabs-4"><?php _e('Help &amp; FAQ', 'bulletproof-security'); ?></a></li>
		</ul>
            
<div id="bps-tabs-1" class="bps-tab-page">

<?php if ( ! current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security'); } else { ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('AutoRestore|Quarantine - ARQ IDPS', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<h3 style="margin:0px 0px 0px 0px;"><?php _e('AutoRestore|Quarantine - ARQ IDPS', 'bulletproof-security'); ?>  <button id="bps-open-modal1" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content1" class="bps-dialog-hide" title="<?php _e('AutoRestore|Quarantine - ARQ IDPS', 'bulletproof-security'); ?>">
	<p>
	<?php
		$text = '<strong>'.__('This Read Me Help window is draggable (top) and resizable (bottom right corner)', 'bulletproof-security').'</strong><br><br>';
		echo $text; 
		// Forum Help Links or of course both
		$text = '<strong><font color="blue">'.__('Forum Help Links: ', 'bulletproof-security').'</font></strong><br>'; 	
		echo $text;
	?>
	<strong><a href="https://forum.ait-pro.com/forums/topic/xternal-tools-xtf-guide/" title="Xternal Tools (XTF) Guide" target="_blank"><?php _e('Xternal Tools (XTF) Guide', 'bulletproof-security'); ?></a></strong><br />
	<strong><a href="https://forum.ait-pro.com/video-tutorials/" title="BPS Pro Video Tutorials Link" target="_blank"><?php _e('BPS Pro Video Tutorials Link', 'bulletproof-security'); ?></a></strong><br /> 
	<strong><a href="https://forum.ait-pro.com/forums/topic/autorestore-quarantine-guide-read-me-first/" title="AutoRestore|Quarantine Guide|Troubleshooting" target="_blank"><?php _e('AutoRestore|Quarantine Guide|Troubleshooting', 'bulletproof-security'); ?></a></strong><br /><br />	

	<?php echo $bps_modal_content1; ?>
    </p>
</div>

    </td>
    </tr>
  <tr>
    <td class="bps-table_cell_help">

<div id="ARQ-Cron-Table">
<table class="widefat" style="margin-bottom:15px;">
<thead>
	<tr>
	<th scope="col" style="" class="arq-cron-col1"><strong><?php _e('AutoRestore|Quarantine ARQ Cron Status: ', 'bulletproof-security'); ?></strong></th>
	<th scope="col" style="" class="arq-cron-col2"><strong><?php _e('AutoRestore|Quarantine ARQ Cron Settings:', 'bulletproof-security'); ?></strong></th>
    </tr>
</thead>

<tbody>
	<tr class="arq-settings">
	<th scope="row" style="vertical-align:middle;">
    
    <div class="autorestore-status-text"><h3>
	<?php echo bpsProAutoRestoreOff(); echo bpsProAutoRestoreOn(); ?><br /><?php $text = '<strong><span class="arq-status-frequency-text-read-me">'.__('Click the Read Me help button for help information', 'bulletproof-security').'<br><br>'.__('Recommended Settings: Run ARQ Cron check every 2 minutes, Standard WP Cron and Backup File Status Check Off. These settings have been extensively tested and do not cause any website performance or Server resource usage issues/problems.', 'bulletproof-security').'</span><br><br><span class="arq-status-frequency-text">'.__('ARQ Cron Check Frequency:', 'bulletproof-security').'<br>'.__('1 Minute: 60 file checks per hour maximum', 'bulletproof-security').'<br>'.__('2 Minutes: 30 file checks per hour maximum', 'bulletproof-security').'<br>'.__('3 Minutes: 20 file checks per hour maximum', 'bulletproof-security').'<br>'.__('4 Minutes: 15 file checks per hour maximum', 'bulletproof-security').'<br>'.__('5 Minutes: 12 file checks per hour maximum', 'bulletproof-security').'<br>'.__('10 Minutes: 6 file checks per hour maximum', 'bulletproof-security').'<br>'.__('15 Minutes: 4 file checks per hour maximum', 'bulletproof-security').'<br>'.__('30 Minutes: 2 file checks per hour maximum', 'bulletproof-security').'<br>'.__('60 Minutes: 1 file checks per hour maximum', 'bulletproof-security').'</span></strong>'; echo $text; ?>
    </h3></div>
    </th>
	<td style="border:none">

<?php
// AutoRestore Values Form
function bpsPro_autorestore_values_form() {
global $bps_topDiv, $bps_bottomDiv;

	if ( isset( $_POST['bpsARCMSubmit'] ) && current_user_can('manage_options') ) {
		check_admin_referer( 'bpsAutoRestoreValues' );
		
	if ( $_POST['arq_cron'] == 'Off' ) {
		wp_clear_scheduled_hook('bpsPro_AutoRestore_check');
		wp_clear_scheduled_hook('bpsPro_ARQ_OBFD');
	}
	
	$arq_cron_frequency = $_POST['arq_cron_frequency'];
	
	if ( $arq_cron_frequency == '1' ) {
		$arq_cron_end = time() + 60;	
	}
	if ( $arq_cron_frequency == '2' ) {
		$arq_cron_end = time() + 120;	
	}
	if ( $arq_cron_frequency == '3' ) {
		$arq_cron_end = time() + 180;	
	}
	if ( $arq_cron_frequency == '4' ) {
		$arq_cron_end = time() + 240;	
	}
	if ( $arq_cron_frequency == '5' ) {
		$arq_cron_end = time() + 300;	
	}	
	if ( $arq_cron_frequency == '10' ) {
		$arq_cron_end = time() + 600;	
	}	
	if ( $arq_cron_frequency == '15' ) {
		$arq_cron_end = time() + 900;	
	}	
	if ( $arq_cron_frequency == '30' ) {
		$arq_cron_end = time() + 1800;	
	}	
	if ( $arq_cron_frequency == '60' ) {
		$arq_cron_end = time() + 3600;	
	}	

	$BPS_Options = array(
	'bps_autorestore_cron' 				=> $_POST['arq_cron'], 
	'bps_autorestore_cron_frequency' 	=> $arq_cron_frequency, 
	'bps_autorestore_cron_forced' 		=> $_POST['arq_cron_forced'], 
	'bps_autorestore_cron_override' 	=> $_POST['arq_cron_override'], 
	'bps_autorestore_cron_filecheck' 	=> $_POST['arq_cron_filecheck'], 
	'bps_autorestore_cron_end' 			=> $arq_cron_end
	);	
	
		foreach( $BPS_Options as $key => $value ) {
			update_option('bulletproof_security_options_ARCM', $BPS_Options);
		}	

	echo $bps_topDiv;
	$text = '<font color="green"><strong>'.__('AutoRestore Option settings saved! Note: To display the current Backup File Status click the Reload BPS Pro Status Display button above.', 'bulletproof-security').'</strong></font>';
	echo $text;		
	echo $bps_bottomDiv;
	}
}
?>

<div id="bpsARQCron" style="margin:10px 0px 20px 0px;">
    <form name="bpsAutoRestore" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php 
	wp_nonce_field('bpsAutoRestoreValues'); 
	bpsPro_autorestore_values_form(); 
	$ARQoptions = get_option('bulletproof_security_options_ARCM');
	$bps_autorestore_cron_frequency = ! isset($ARQoptions['bps_autorestore_cron_frequency']) ? '' : $ARQoptions['bps_autorestore_cron_frequency'];
	$bps_autorestore_cron_forced = ! isset($ARQoptions['bps_autorestore_cron_forced']) ? '' : $ARQoptions['bps_autorestore_cron_forced'];
	$bps_autorestore_cron_override = ! isset($ARQoptions['bps_autorestore_cron_override']) ? '' : $ARQoptions['bps_autorestore_cron_override'];
	$bps_autorestore_cron_filecheck = ! isset($ARQoptions['bps_autorestore_cron_filecheck']) ? '' : $ARQoptions['bps_autorestore_cron_filecheck'];
	$bps_autorestore_cron = ! isset($ARQoptions['bps_autorestore_cron']) ? '' : $ARQoptions['bps_autorestore_cron'];
?>

<div style="margin-top:20px;"><strong>
<label for="bps-arcm"><?php _e('ARQ Cron Check Frequency:', 'bulletproof-security'); ?></label></strong>
</div>
<select name="arq_cron_frequency" class="form-340">
<option value="1"<?php selected('1', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 1 Minute', 'bulletproof-security'); ?></option>
<option value="2"<?php selected('2', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 2 Minutes', 'bulletproof-security'); ?></option>
<option value="3"<?php selected('3', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 3 Minutes', 'bulletproof-security'); ?></option>
<option value="4"<?php selected('4', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 4 Minutes', 'bulletproof-security'); ?></option>
<option value="5"<?php selected('5', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 5 Minutes', 'bulletproof-security'); ?></option>
<option value="10"<?php selected('10', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 10 Minutes', 'bulletproof-security'); ?></option>
<option value="15"<?php selected('15', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 15 Minutes', 'bulletproof-security'); ?></option>
<option value="30"<?php selected('30', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 30 Minutes', 'bulletproof-security'); ?></option>
<option value="60"<?php selected('60', $bps_autorestore_cron_frequency); ?>><?php _e('Run ARQ Cron Check Every 60 Minutes', 'bulletproof-security'); ?></option>
</select><br /><br />

<strong><label for="bps-arcm"><?php _e('Standard WP Cron or WP Cron with Time Restriction:', 'bulletproof-security'); ?></label></strong><br />
<select name="arq_cron_forced" class="form-340">
<option value="1"<?php selected('1', $bps_autorestore_cron_forced); ?>><?php _e('Standard WP Cron', 'bulletproof-security'); ?></option>
<option value="2"<?php selected('2', $bps_autorestore_cron_forced); ?>><?php _e('WP Cron with Time Restriction', 'bulletproof-security'); ?></option>
</select><br /><br />

<strong><label for="bps-arcm"><?php _e('ARQ Cron Override On|Off: Default Setting is Off', 'bulletproof-security'); ?></label></strong><br />
<select name="arq_cron_override" class="form-340">
<option value="Off"<?php selected('Off', $bps_autorestore_cron_override); ?>><?php _e('ARQ Cron Override Off', 'bulletproof-security'); ?></option>
<option value="On"<?php selected('On', $bps_autorestore_cron_override); ?>><?php _e('ARQ Cron Override On', 'bulletproof-security'); ?></option>
</select><br /><br />

<strong><label for="bps-arcm"><?php _e('ARQ Backup File Status Check On|Off:', 'bulletproof-security'); ?></label></strong><br />
<select name="arq_cron_filecheck" class="form-340">
<option value="On"<?php selected('On', $bps_autorestore_cron_filecheck); ?>><?php _e('Backup File Status Check On', 'bulletproof-security'); ?></option>
<option value="Off"<?php selected('Off', $bps_autorestore_cron_filecheck); ?>><?php _e('Backup File Status Check Off', 'bulletproof-security'); ?></option>
</select><br /><br />

<strong><label for="bps-arcm"><?php _e('AutoRestore On|Off (ARQ Cron Check On|Off):', 'bulletproof-security'); ?></label></strong><br />
<select name="arq_cron" class="form-340">
<option value="On"<?php selected('On', $bps_autorestore_cron); ?>><?php _e('AutoRestore On', 'bulletproof-security'); ?></option>
<option value="Off"<?php selected('Off', $bps_autorestore_cron); ?>><?php _e('AutoRestore Off', 'bulletproof-security'); ?></option>
</select><br /><br />

<input type="hidden" name="arq_cron_end" value="<?php echo esc_html( $bps_autorestore_cron_frequency ); ?>" />

<?php if ( ! file_exists($bpsARQFailSafeRoot) || ! file_exists($bpsARQFailSafeWpadmin) || ! file_exists($bpsARQFailSafeWpincludes) || ! file_exists($bpsARQFailSafeWpcontent) ) { ?>

<input type="submit" name="bpsARCMSubmit" value="<?php esc_attr_e('Save ARQ Cron Options', 'bulletproof-security'); ?>" class="button bps-button" onclick="return confirm('<?php $text = __('CRITICAL WARNING!!!', 'bulletproof-security').'\n\n'.__('You have NOT Backed Up All of your files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.$BPSrootFSC.'\n\n'.$BPSwpadminFSC.'\n\n'.$BPSwpincludesFSC.'\n\n'.$BPSwpcontentFSC.'\n\n'.$bpsSpacePop.'\n\n'.__('CLICK THE CANCEL BUTTON DO NOT TURN ON THE ARQ CRON CHECK UNTIL AFTER YOU HAVE BACKED UP ALL FILES.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('If you accidentally Turn On the ARQ Cron before backing up files the ARQ Cron will automatically be disabled and you will see the ARQ Cron FailSafe Shutdown message displayed in your WP Dashboard.', 'bulletproof-security'); echo $text; ?>')" />

<?php } else { ?>

<input type="submit" name="bpsARCMSubmit" value="<?php esc_attr_e('Save ARQ Cron Options', 'bulletproof-security'); ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Reminder: If you were manually editing or uploading files while ARQ was turned Off then click the appropriate Backup Files button: Root Files, wp-admin Files, wp-includes Files or wp-content Files before turning ARQ back On. Or run the Setup Wizard again, which will automatically backup all files and turn ARQ back On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to proceed or click Cancel', 'bulletproof-security'); echo $text; ?>')" />
<?php } ?>
</form>

</div>

</td>
</tr>
</tbody>
</table>
</div>

<?php
$source = '';
$dest = '';
?>

<div id="ARQ-Controls-Table">
<table class="widefat" style="margin-bottom:15px;">
<thead>
	<tr>
	<th scope="col"><strong><?php _e('AutoRestore|Quarantine', 'bulletproof-security'); ?><br /><?php _e('Controls & Backup Status', 'bulletproof-security'); ?></strong></th>
	<th scope="col"><strong><?php _e('Root Files', 'bulletproof-security'); ?></strong><br /><?php echo bpsFileCounterRoot($source, $count); ?></th>
	<th scope="col"><strong><?php _e('wp-admin Files', 'bulletproof-security'); ?></strong><br /><?php echo bpsFileCounterWpadmin($source, $count); ?></th>
	<th scope="col"><strong><?php _e('wp-includes Files', 'bulletproof-security'); ?></strong><br /><?php echo bpsFileCounterWpincludes($source, $count); ?></th>	
	<th scope="col"><strong><?php _e('wp-content Files', 'bulletproof-security'); ?></strong><br /><?php echo bpsFileCounterWpcontent($source, $count); ?></th>	    
    </tr>
</thead>

<tbody>
<tr>
	<th scope="row"><?php _e('Backup Files (Quick Setup)', 'bulletproof-security'); ?></th>
	<td> <?php $BPSProOptions = get_option('bulletproof_security_options_ARCM'); ?>  
    
    <form name="bpsAutoRestoreBackupRoot" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_RootNR'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-RootNR" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Backup your Root files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this Root Backup Files button again to be able to backup your Root files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php bps_arcm_nonrecursive_copy_root($source, $dest); ?>

<input type="submit" name="Submit-ARCM-RootNR" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQRootBackup()" />
<?php } ?>
</form>    

</td>
	<td>    
    
    <form name="bpsARCMBackupWpadmin" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpadmin'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpadmin" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Backup your wp-admin files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-admin Backup Files button again to be able to backup your wp-admin files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_recursive_copy_wpadmin($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Wpadmin" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpadminBackup()" />
<?php } ?>
</form>  

</td>
	<td>    
    
    <form name="bpsARCMBackupWpincludes" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpincludes'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpincludes" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Backup your wp-includes files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-includes Backup Files button again to be able to backup your wp-includes files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_recursive_copy_wpincludes($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Wpincludes" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpincludesBackup()" />
<?php } ?>
</form>  

</td>
	<td>    
    
    <form name="bpsARCMBackupWpcontent" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpcontent'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpcontent" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Backup your wp-content files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-content Backup Files button again to be able to backup your wp-content files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_recursive_copy_wpcontent($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Wpcontent" value="<?php esc_attr_e('Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpcontentBackup()" />
<?php } ?>
</form>

</td>
</tr>
<tr>
	<th scope="row"><?php _e('Delete Backup Files', 'bulletproof-security'); ?></strong></th>
	<td>    
    
    <form name="ARCM-Delete-All-Files-Root" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_root_delete'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Root-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Delete your Root AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this Root Delete Backup Files button again to be able to delete your Root AutoRestore Backup Files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_rmdirRoot($source); ?>

<input type="submit" name="Submit-ARCM-Root-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQRootDelete()" />
<?php } ?>
</form>

</td>
	<td> 
    
    <form name="ARCM-Delete-All-Files-Wpadmin" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpadmin_delete'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpadmin-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Delete your wp-admin AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-admin Delete Backup Files button again to be able to delete your wp-admin AutoRestore Backup Files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_rmdirWpadmin($source); ?>

<input type="submit" name="Submit-ARCM-Wpadmin-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpadminDelete()" />
<?php } ?>
</form>

</td>
	<td>    
    
    <form name="ARCM-Delete-All-Files-Wpincludes" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpincludes_delete'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpincludes-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Delete your wp-includes AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-includes Delete Backup Files button again to be able to delete your wp-includes AutoRestore Backup Files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_rmdirWpincludes($source); ?>

<input type="submit" name="Submit-ARCM-Wpincludes-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpincludesDelete()" />
<?php } ?>
</form>

</td>
	<td>    
    
    <form name="ARCM-Delete-All-Files-Wpcontent" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpcontent_delete'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpcontent-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Delete your wp-content AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-content Delete Backup Files button again to be able to delete your wp-content AutoRestore Backup Files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_rmdirWpcontent($source); ?>

<input type="submit" name="Submit-ARCM-Wpcontent-Delete" value="<?php esc_attr_e('Delete Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpcontentDelete()" />
<?php } ?>
</form>

</td>
</tr>
<tr>
	<th scope="row"><?php _e('Restore Backup Files', 'bulletproof-security'); ?></th>
	<td>  
    
    <form name="ARCM-Manual-AutoRestore-Root" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_root_restore'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Root-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" style="width:140px" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Restore your Root AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this Root Restore Backup Files button again to be able to restore your Root files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_nonrecursive_copy_root_restore($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Root-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQRootRestore()" />
<?php } ?>
</form>

</td>
    <td>    
    
    <form name="ARCM-Manual-AutoRestore-Wpadmin" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpadmin_restore'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpadmin-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Restore your wp-admin AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-admin Restore Backup Files button again to be able to restore your /wp-admin files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_recursive_copy_wpadmin_restore($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Wpadmin-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpadminRestore()" />
<?php } ?>
</form>

</td>
    <td>    
    
    <form name="ARCM-Manual-AutoRestore-Wpincludes" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpincludes_restore'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpincludes-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Restore your wp-includes AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-includes Restore Backup Files button again to be able to restore your /wp-includes files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_recursive_copy_wpincludes_restore($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Wpincludes-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpincludesRestore()" />
<?php } ?>
</form>

</td>
	<td>    
    
    <form name="ARCM-Manual-AutoRestore-Wpcontent" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpcontent_restore'); ?>

<?php if ( isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'On' ) { ?>

<input type="submit" name="Submit-ARCM-Wpcontent-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('The AutoRestore|Quarantine Cron is On.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('The AutoRestore|Quarantine Cron MUST be turned Off before you can Restore your wp-content AutoRestore Backup Files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click the Cancel button to close this pop up window, turn Off the AutoRestore Cron and then click this wp-content Restore Backup Files button again to be able to restore your wp-content files.', 'bulletproof-security'); echo $text; ?>')" />

<?php } if ( ! isset($BPSProOptions['bps_autorestore_cron']) || isset($BPSProOptions['bps_autorestore_cron']) && $BPSProOptions['bps_autorestore_cron'] == 'Off' ) { ?>
<?php @bps_arcm_recursive_copy_wpcontent_restore($source, $dest); ?>

<input type="submit" name="Submit-ARCM-Wpcontent-Restore" value="<?php esc_attr_e('Restore Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpcontentRestore()" />
<?php } ?>
</form>

</td>
</tr>
<tr>
	<th scope="row"><?php _e('Show Backup Files', 'bulletproof-security'); ?></th>
	<td>    
    
    <form name="ARCM-Show-root-Backup-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_root_show_backup'); ?>
	<input type="submit" name="Submit-ARCM-Root-Show-Backup" value="<?php esc_attr_e('Show Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQRootShowBackup()" />
</form>

</td>
	<td>
    
    <form name="ARCM-Show-wpadmin-Backup-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpadmin_show_backup'); ?>
	<input type="submit" name="Submit-ARCM-Wpadmin-Show-Backup" value="<?php esc_attr_e('Show Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpadminShowBackup()" />
</form>

</td>
	<td>   
    
    <form name="ARCM-Show-wpincludes-Backup-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpincludes_show_backup'); ?>
	<input type="submit" name="Submit-ARCM-Wpincludes-Show-Backup" value="<?php esc_attr_e('Show Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpincludesShowBackup()" />
</form>

</td>
	<td>    
    
    <form name="ARCM-Show-wpcontent-Backup-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpcontent_show_backup'); ?>
	<input type="submit" name="Submit-ARCM-Wpcontent-Show-Backup" value="<?php esc_attr_e('Show Backup Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpcontentShowBackup()" />
</form>

</td>
</tr>
<tr>
	<th scope="row"><?php _e('Show Website Files', 'bulletproof-security'); ?></th>
	<td style="border:none">    
    
    <form name="ARCM-Show-root-Website-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_root_show_website'); ?>
	<input type="submit" name="Submit-ARCM-Root-Show-Website" value="<?php esc_attr_e('Show Website Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQRootShowWebsite()" />
</form>

</td>
	<td style="border:none">    
    
    <form name="ARCM-Show-wpadmin-Website-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpadmin_show_website'); ?>
	<input type="submit" name="Submit-ARCM-Wpadmin-Show-Website" value="<?php esc_attr_e('Show Website Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpadminShowWebsite()" />
</form>

</td>
	<td style="border:none">    
    
    <form name="ARCM-Show-wpincludes-Website-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpincludes_show_website'); ?>
	<input type="submit" name="Submit-ARCM-Wpincludes-Show-Website" value="<?php esc_attr_e('Show Website Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpincludesShowWebsite()" />
</form>

</td>
	<td style="border:none">   
    
    <form name="ARCM-Show-wpcontent-Website-Files" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ARCM_wpcontent_show_website'); ?>
	<input type="submit" name="Submit-ARCM-Wpcontent-Show-Website" value="<?php esc_attr_e('Show Website Files', 'bulletproof-security') ?>" class="button bps-button" style="width:140px;height:auto;white-space:normal" onclick="ARQwpcontentShowWebsite()" />
</form>

</td>
</tr>
</tbody>
</table>
</div>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#ARQ-Controls-Table tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

<?php
if ( isset( $_POST['Submit-ARCM-Root-Show-Backup'] ) || isset( $_POST['Submit-ARCM-Wpadmin-Show-Backup'] ) || isset( $_POST['Submit-ARCM-Wpincludes-Show-Backup'] ) || isset( $_POST['Submit-ARCM-Wpcontent-Show-Backup'] ) ) {
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/arq-show-backup-files.php' );
}

if ( isset( $_POST['Submit-ARCM-Root-Show-Website'] ) || isset( $_POST['Submit-ARCM-Wpadmin-Show-Website'] ) || isset( $_POST['Submit-ARCM-Wpincludes-Show-Website'] ) || isset( $_POST['Submit-ARCM-Wpcontent-Show-Website'] ) ) {
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/arq-show-website-files.php' );
}

if ( isset( $_POST['Submit-ARQ-wpcontent-Exclude'] ) ) {
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/autorestore/arq-wp-content-exclude.php' );
}
?>

</td>
  </tr>
</table>

<?php } ?>
</div>

<div id="bps-tabs-2" class="bps-tab-page">

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('Exclude wp-content Folders Under The wp-content Folder ONLY', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<h3 style="margin:0px 0px 5px 0px;"><?php _e('Exclude wp-content Folders', 'bulletproof-security'); ?>  <button id="bps-open-modal2" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content2" class="bps-dialog-hide" title="<?php _e('Exclude wp-content Folders', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content2; ?></p>         
</div>

<form name="ARQ-wpcontent-Exclude" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-2' ); ?>" method="post">
	<?php wp_nonce_field('bulletproof_security_arq_wpcontent_exclude'); ?>
	<?php $ARQ2 = get_option('bulletproof_security_options_exclude_folder'); 
	$bpsexclude_input_1_label = ! isset($ARQ2['bpsexclude_input_1_label']) ? '' : $ARQ2['bpsexclude_input_1_label'];
	$bpsexclude_input_1 = ! isset($ARQ2['bpsexclude_input_1']) ? '' : $ARQ2['bpsexclude_input_1'];	
	$bpsexclude_input_2_label = ! isset($ARQ2['bpsexclude_input_2_label']) ? '' : $ARQ2['bpsexclude_input_2_label'];
	$bpsexclude_input_2 = ! isset($ARQ2['bpsexclude_input_2']) ? '' : $ARQ2['bpsexclude_input_2'];		
	$bpsexclude_input_3_label = ! isset($ARQ2['bpsexclude_input_3_label']) ? '' : $ARQ2['bpsexclude_input_3_label'];
	$bpsexclude_input_3 = ! isset($ARQ2['bpsexclude_input_3']) ? '' : $ARQ2['bpsexclude_input_3'];		
	$bpsexclude_input_4_label = ! isset($ARQ2['bpsexclude_input_4_label']) ? '' : $ARQ2['bpsexclude_input_4_label'];
	$bpsexclude_input_4 = ! isset($ARQ2['bpsexclude_input_4']) ? '' : $ARQ2['bpsexclude_input_4'];		
	$bpsexclude_input_5_label = ! isset($ARQ2['bpsexclude_input_5_label']) ? '' : $ARQ2['bpsexclude_input_5_label'];
	$bpsexclude_input_5 = ! isset($ARQ2['bpsexclude_input_5']) ? '' : $ARQ2['bpsexclude_input_5'];	
	$bpsexclude_input_6_label = ! isset($ARQ2['bpsexclude_input_6_label']) ? '' : $ARQ2['bpsexclude_input_6_label'];
	$bpsexclude_input_6 = ! isset($ARQ2['bpsexclude_input_6']) ? '' : $ARQ2['bpsexclude_input_6'];	
	$bpsexclude_input_7_label = ! isset($ARQ2['bpsexclude_input_7_label']) ? '' : $ARQ2['bpsexclude_input_7_label'];
	$bpsexclude_input_7 = ! isset($ARQ2['bpsexclude_input_7']) ? '' : $ARQ2['bpsexclude_input_7'];		
	$bpsexclude_input_8_label = ! isset($ARQ2['bpsexclude_input_8_label']) ? '' : $ARQ2['bpsexclude_input_8_label'];
	$bpsexclude_input_8 = ! isset($ARQ2['bpsexclude_input_8']) ? '' : $ARQ2['bpsexclude_input_8'];		
	$bpsexclude_input_9_label = ! isset($ARQ2['bpsexclude_input_9_label']) ? '' : $ARQ2['bpsexclude_input_9_label'];
	$bpsexclude_input_9 = ! isset($ARQ2['bpsexclude_input_9']) ? '' : $ARQ2['bpsexclude_input_9'];		
	$bpsexclude_input_10_label = ! isset($ARQ2['bpsexclude_input_10_label']) ? '' : $ARQ2['bpsexclude_input_10_label'];
	$bpsexclude_input_10 = ! isset($ARQ2['bpsexclude_input_10']) ? '' : $ARQ2['bpsexclude_input_10'];	
	$bpsexclude_input_11_label = ! isset($ARQ2['bpsexclude_input_11_label']) ? '' : $ARQ2['bpsexclude_input_11_label'];
	$bpsexclude_input_11 = ! isset($ARQ2['bpsexclude_input_11']) ? '' : $ARQ2['bpsexclude_input_11'];	
	$bpsexclude_input_12_label = ! isset($ARQ2['bpsexclude_input_12_label']) ? '' : $ARQ2['bpsexclude_input_12_label'];
	$bpsexclude_input_12 = ! isset($ARQ2['bpsexclude_input_12']) ? '' : $ARQ2['bpsexclude_input_12'];		
	$bpsexclude_input_13_label = ! isset($ARQ2['bpsexclude_input_13_label']) ? '' : $ARQ2['bpsexclude_input_13_label'];
	$bpsexclude_input_13 = ! isset($ARQ2['bpsexclude_input_13']) ? '' : $ARQ2['bpsexclude_input_13'];		
	$bpsexclude_input_14_label = ! isset($ARQ2['bpsexclude_input_14_label']) ? '' : $ARQ2['bpsexclude_input_14_label'];
	$bpsexclude_input_14 = ! isset($ARQ2['bpsexclude_input_14']) ? '' : $ARQ2['bpsexclude_input_14'];		
	$bpsexclude_input_15_label = ! isset($ARQ2['bpsexclude_input_15_label']) ? '' : $ARQ2['bpsexclude_input_15_label'];
	$bpsexclude_input_15 = ! isset($ARQ2['bpsexclude_input_15']) ? '' : $ARQ2['bpsexclude_input_15'];	
	$bpsexclude_input_16_label = ! isset($ARQ2['bpsexclude_input_16_label']) ? '' : $ARQ2['bpsexclude_input_16_label'];
	$bpsexclude_input_16 = ! isset($ARQ2['bpsexclude_input_16']) ? '' : $ARQ2['bpsexclude_input_16'];	
	$bpsexclude_input_17_label = ! isset($ARQ2['bpsexclude_input_17_label']) ? '' : $ARQ2['bpsexclude_input_17_label'];
	$bpsexclude_input_17 = ! isset($ARQ2['bpsexclude_input_17']) ? '' : $ARQ2['bpsexclude_input_17'];		
	$bpsexclude_input_18_label = ! isset($ARQ2['bpsexclude_input_18_label']) ? '' : $ARQ2['bpsexclude_input_18_label'];
	$bpsexclude_input_18 = ! isset($ARQ2['bpsexclude_input_18']) ? '' : $ARQ2['bpsexclude_input_18'];		
	$bpsexclude_input_19_label = ! isset($ARQ2['bpsexclude_input_19_label']) ? '' : $ARQ2['bpsexclude_input_19_label'];
	$bpsexclude_input_19 = ! isset($ARQ2['bpsexclude_input_19']) ? '' : $ARQ2['bpsexclude_input_19'];		
	$bpsexclude_input_20_label = ! isset($ARQ2['bpsexclude_input_20_label']) ? '' : $ARQ2['bpsexclude_input_20_label'];
	$bpsexclude_input_20 = ! isset($ARQ2['bpsexclude_input_20']) ? '' : $ARQ2['bpsexclude_input_20'];	
	?>

<div id="BPSExcludeTable">

<table class="widefat">
<thead>
	<tr>
	<th scope="col" style="" class="arq-wp-exclude-col1"><strong><?php _e('Label|Description', 'bulletproof-security'); ?></strong></th>
	<th scope="col" style="" class="arq-wp-exclude-col2"><strong><?php $text = __('This tool is ONLY designed to exclude folders under the wp-content folder from being checked by ARQ.', 'bulletproof-security').'<br>'.__('Click the Read Me help button above for correct usage and examples.', 'bulletproof-security'); echo $text; ?></strong></th>
    </tr>
</thead>

<tbody>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_1_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_1_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_1" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_1, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_2_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_2_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_2" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_2, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_3_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_3_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_3" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_3, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_4_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_4_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_4" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_4, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_5_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_5_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_5" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_5, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_6_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_6_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_6" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_6, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_7_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_7_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_7" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_7, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_8_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_8_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_8" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_8, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_9_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_9_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_9" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_9, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_10_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_10_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_10" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_10, " \t\n/"); ?>" /></td>
</tr> 
  <tr>
	<th scope="row"><input type="text" name="bpsexclude_input_11_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_11_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_11" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_11, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_12_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_12_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_12" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_12, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_13_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_13_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_13" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_13, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_14_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_14_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_14" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_14, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_15_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_15_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_15" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_15, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_16_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_16_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_16" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_16, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_17_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_17_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_17" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_17, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_18_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_18_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_18" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_18, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_19_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_19_label; ?>" /></th>
	<td><i>/wp-content/</i><input type="text" name="bpsexclude_input_19" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_19, " \t\n/"); ?>" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bpsexclude_input_20_label" class="arq-wp-exclude-label" value="<?php echo $bpsexclude_input_20_label; ?>" /></th>
	<td style="border:none"><i>/wp-content/</i><input type="text" name="bpsexclude_input_20" class="arq-wp-exclude" value="<?php echo trim($bpsexclude_input_20, " \t\n/"); ?>" /></td>
</tr>
</tbody>
</table>
</div>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#BPSExcludeTable tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

<p class="submit" style="float:left;margin:0px 10px 0px 0px;">
    <input type="submit" name="Submit-ARQ-wpcontent-Exclude" class="button bps-button" value="<?php esc_attr_e('Save Folder Exclude Rules', 'bulletproof-security') ?>" />
</p>
</form>

    </td>
  </tr>
</table>
</div>

<div id="bps-tabs-3" class="bps-tab-page">

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('Add|Exclude Other Folders & Files', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<h3 style="margin:0px 0px 5px 0px;"><?php _e('Add|Exclude Other Folders & Files', 'bulletproof-security'); ?>  <button id="bps-open-modal3" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content3" class="bps-dialog-hide" title="<?php _e('Add|Exclude Other Folders & Files', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content3; ?></p>
</div>

<div id="ARQ-Add-Exclude-Table">

<table class="widefat" style="margin-bottom:15px;">
<thead>
	<tr>
	<th scope="col" class="arq-add-exclude-col1"><strong><?php _e('Add & Exclude Uses:', 'bulletproof-security'); ?></strong></th>
	<th scope="col" class="arq-add-exclude-col2"><strong><?php _e('Add Folders & Files:', 'bulletproof-security'); ?></strong><br /><?php echo '<span class="arq-backup-files"><strong>'.__('For non-WordPress Folders & Files (ONLY)', 'bulletproof-security').'</strong></span>'; ?></th>
	<th scope="col" class="arq-add-exclude-col3"><strong><?php _e('Exclude Folders & Files:', 'bulletproof-security'); ?></strong><br /><?php echo '<span class="arq-backup-files"><strong>'.__('For WordPress Folders & Files (ONLY)', 'bulletproof-security').'</strong></span>'; ?></th>
    </tr>
</thead>

<tbody>
<tr>
	<th scope="row"><?php $text = '<strong>'.__('Add Folders & Files Use:', 'bulletproof-security').'</strong><br>'.__('You can add additional non-WordPress folders and files (ONLY) that you want to have checked and protected by the ARQ Cron. Click the Read Me help button for examples.', 'bulletproof-security').'<br><br><strong>'.__('Exclude Folders & Files Use:', 'bulletproof-security').'</strong><br>'.__('You can exclude WordPress folders and files (ONLY) that you DO NOT want to have checked and protected by the ARQ Cron. Click the Read Me help button for examples.', 'bulletproof-security'); echo $text; ?></th>
	<td style="border:none">

<?php
// Create ARQ Add DB Table - as of 3.1 the register_activation_hook is not called when a plugin is updated
function bps_arq_add_table_install() {
global $wpdb;
global $bulletproof_security_arq_db_version;
$table_name = $wpdb->prefix . "bpspro_arq_add";
$wpdb_collate = $wpdb->collate;     
	
	if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table_name ) ) != $table_name ) {

	$sql = "CREATE TABLE $table_name (
  	id bigint(20) NOT NULL auto_increment,
  	arq_add_type text NOT NULL,
  	arq_add_time datetime NOT NULL default '0000-00-00 00:00:00',
  	arq_add_dir text NOT NULL,
  	arq_add_source text NOT NULL,
  	arq_add_backup text NOT NULL,
  	UNIQUE KEY id (id)
	)
	COLLATE {$wpdb_collate};";

	require_once ABSPATH . 'wp-admin/includes/upgrade.php';
	dbDelta($sql);
	}
}

// Form ARQ Add Folders & Files - Create the /added-files folder, mkdir and copy folders and files - insert Added file paths into DB
// Important Note: If I ever decide to do anything with an Update DB Query I will need to create new Form code. see my DW example file/code.
if ( ! isset( $_POST['Submit-ARQ-Add-Remove'] ) )
    $chosenARQAdd = array(0);
	else
    if ( isset( $_POST['Submit-ARQ-Add-Remove'] ) && current_user_can('manage_options') ) {
		check_admin_referer( 'bulletproof_security_arq_add_remove' );   
	    $chosenARQAdd = $_POST['arqAddRemove'];
		$bps_arq_add_hidden = $_POST['bps_arq_add_hidden'];
		global $wpdb;
		set_time_limit(300); // 250 + 30 = 280 leaving a 20 second buffer
		
		$ARQoptions = get_option('bulletproof_security_options_ARCM');

 		$BPS_Options = array(
		'bps_autorestore_cron_frequency' 	=> $ARQoptions['bps_autorestore_cron_frequency'], 
		'bps_autorestore_cron' 				=> 'Off', 
		'bps_autorestore_cron_override' 	=> $ARQoptions['bps_autorestore_cron_override'], 
		'bps_autorestore_cron_filecheck' 	=> $ARQoptions['bps_autorestore_cron_filecheck'], 
		'bps_autorestore_cron_forced' 		=> $ARQoptions['bps_autorestore_cron_forced'], 
		'bps_autorestore_cron_end' 			=> $ARQoptions['bps_autorestore_cron_end']
		);	

		foreach ( $BPS_Options as $key => $value ) {
			update_option('bulletproof_security_options_ARCM', $BPS_Options);
		}   

		if ( ! is_dir( WP_CONTENT_DIR . '/bps-backup/autorestore/added-files' ) ) {
			@mkdir( WP_CONTENT_DIR . '/bps-backup/autorestore/added-files', 0755, true );
			@chmod( WP_CONTENT_DIR . '/bps-backup/autorestore/added-files', 0755 );
		}
	
		// Create the ARQ Add Database Table
		bps_arq_add_table_install();
		
		if ( $_POST['bps_arq_host_root_folder'] == '' ) {
			
			echo $bps_topDiv;
			$text = '<strong><font color="#fb0101">'.__('Error: You did not enter the full path to your hosting account root folder in the Add Folders & Files Form textbox.', 'bulletproof-security').'</font><br>'.__('Click the Add|Exclude Other Folders & Files Read Me help button for examples of hosting account root folder paths.', 'bulletproof-security').'</strong>';
			echo $text;
			echo '</p></div>';
			
		} elseif ( preg_match( '/(.*)((\/|\\\)wp-content(\/|\\\)|(\/|\\\)wp-content[^a-z0-9-_]|(\/|\\\)wp-admin(\/|\\\)|(\/|\\\)wp-includes(\/|\\\))(.*)/', trim( stripslashes( $_POST['arq-source-path-add'] ) ) ) ) {
		
			echo $bps_topDiv;
			$text = '<strong><font color="#fb0101">'.__('Error: These WordPress Core folders are already protected by AutoRestore: wp-admin, wp-content and wp-includes.', 'bulletproof-security').'</font><br>'.__('You cannot add folders or files in any of these WordPress Core folders. If you have backup folders with these WP reserved folder names then rename them. Example: wp-admin-backup, wp-content-backup, wp-includes-backup.', 'bulletproof-security').'</strong>';
			echo $text;
			echo '</p></div>';

		} else {

			$bps_arq_host_root_folder = array( 'bps_arq_host_root_folder' => trim( stripslashes( $_POST['bps_arq_host_root_folder'] ) ) );
			
			foreach ( $bps_arq_host_root_folder as $key => $value ) {
				update_option('bulletproof_security_options_arq_host_root', $bps_arq_host_root_folder);
			}
			
			$arq_root_hosting_account_path = get_option('bulletproof_security_options_arq_host_root');
			$arq_root_path_replace = str_replace( array( '\\\\', '\\'), '/', $arq_root_hosting_account_path['bps_arq_host_root_folder']);

			## 15.6: Removed stripslashes() here because it breaks things on XAMPP. stripslashes is used later in the code where needed.
			//$source = trim( stripslashes( $_POST['arq-source-path-add'] ) );
			$source = trim( $_POST['arq-source-path-add'] );
			$source_forward_slashes = str_replace( array( '\\\\', '\\'), '/', $source );
			// Gives me the root hosting account folder path from the root folder: /aitpro-blog/wordpress/test
			$dirname_replace = str_replace( dirname( $arq_root_path_replace ), '', $source_forward_slashes);
			// C:\xampp\htdocs2\aitpro-blog\wordpress/wp-content/bps-backup/autorestore/added-files/aitpro-blog/wordpress/test
			$destFolder = WP_CONTENT_DIR . '/bps-backup/autorestore/added-files' . $dirname_replace;
			
			$table_name = $wpdb->prefix . "bpspro_arq_add";
			
			if ( $_POST['arqAddRemove'] == array(0) ) {
				
				echo $bps_topDiv;
				$text = '<font color="#fb0101"><strong>'.__('Error: You did not select an Add Option.', 'bulletproof-security').'</strong></font>';
				echo $text;
				echo '</p></div>';
			}
	
			if ( $_POST['arqAddRemove'] == array(1) ) {
				
				$arq_add_hidden_options = array(
				'bps_arq_add_hidden' => $bps_arq_add_hidden
				);	
			
				foreach ( $arq_add_hidden_options as $key => $value ) {
					update_option('bulletproof_security_options_arq_add_hidden', $arq_add_hidden_options);
				}				
				
				if ( ! is_dir($destFolder) ) {
					@mkdir( $destFolder, 0755, true );
					@chmod( $destFolder, 0755 );
				}
				
				if ( is_dir($source) ) {
					$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
				
					$arq_add_source_array = array();
					
					foreach ( $iterator as $file ) {
						if ( $file->isDir() )	{
							
							// This adds any other subfolders in the $destFolder folder.
							if ( ! is_dir( $destFolder.DIRECTORY_SEPARATOR.$iterator->getSubPathName() ) ) {
								mkdir( $destFolder.DIRECTORY_SEPARATOR.$iterator->getSubPathName() );
							}
						
						} else {
				
							if ( ! file_exists( $destFolder.DIRECTORY_SEPARATOR.$iterator->getSubPathName() ) ) {					
								
								$rows_affected = $wpdb->insert( $table_name, array( 'arq_add_type' => 'top-level-folder', 'arq_add_time' => current_time('mysql'), 'arq_add_dir' => str_replace( array( '\\\\', '\\'), '/', $source ), 'arq_add_source' => str_replace( array( '\\\\', '\\'), '/', $file ), 'arq_add_backup' => str_replace( array( '\\\\', '\\'), '/', $destFolder.DIRECTORY_SEPARATOR.$iterator->getSubPathName() ) ) );
								
								@copy( $file, $destFolder.DIRECTORY_SEPARATOR.$iterator->getSubPathName() );
								
								$arq_add_source_array[] = str_replace( array( '\\\\', '\\'), '/', $file );
							
							} else {
								
								@copy( $file, $destFolder.DIRECTORY_SEPARATOR.$iterator->getSubPathName() );
								
								$arq_add_source_array[] = '';
							}
						}
					}
				
					echo $bps_topDiv;

					$text = '<strong><font color="green">'.__('AutoRestore was turned Off as a safety precaution. You can turn AutoRestore back On now.', 'bulletproof-security').'</font></strong><br>';
					echo $text;
				
					$arq_add_source_array_unique = array_unique($arq_add_source_array);
					
					foreach ( $arq_add_source_array_unique as $key => $value ) {
						
						if ( $value != '' ) {
						
							echo '<strong><font color="green">'.$value.__(' has been Added to /', 'bulletproof-security').$bps_wpcontent_dir.__('/bps-backup/autorestore/added-files successfully.', 'bulletproof-security').'</font></strong><br>';
						
						} else {
							
							echo '<strong><font color="green">'.__('All previously added files in folder ', 'bulletproof-security').stripslashes( $source ).'<br>'.__('have been resaved/recopied to ', 'bulletproof-security').$destFolder.'</font></strong><br>';
						}
					}
					
					echo '</p></div>';

				} else {
					copy($source, $destFolder);
				}		
			}

			if ( $_POST['arqAddRemove'] == array(2) ) {
			
				$arq_add_hidden_options = array(
				'bps_arq_add_hidden' => $bps_arq_add_hidden
				);	
			
				foreach ( $arq_add_hidden_options as $key => $value ) {
					update_option('bulletproof_security_options_arq_add_hidden', $arq_add_hidden_options);
				}

				if ( ! is_dir($destFolder) ) {
					@mkdir( $destFolder, 0755, true );
					@chmod( $destFolder, 0755 );
				}
	
				if ( is_dir($source) ) {
					$iterator = new DirectoryIterator($source);
		
					$arq_add_source_array = array();
					
					foreach ( $iterator as $file ) {
						if ( $file->isFile() ) {

							if ( ! file_exists($destFolder.DIRECTORY_SEPARATOR.$file->getFilename()) ) {
							
								$rows_affected = $wpdb->insert( $table_name, array( 'arq_add_type' => 'specific-folder', 'arq_add_time' => current_time('mysql'), 'arq_add_dir' => str_replace( array( '\\\\', '\\'), '/', $source ), 'arq_add_source' => str_replace( array( '\\\\', '\\'), '/', $file->getPathname() ), 'arq_add_backup' => str_replace( array( '\\\\', '\\'), '/', $destFolder.DIRECTORY_SEPARATOR.$file->getFilename() ) ) );
								
								copy($file->getPathname(), $destFolder.DIRECTORY_SEPARATOR.$file->getFilename());
								
								$arq_add_source_array[] = str_replace( array( '\\\\', '\\'), '/', $file->getPathname() );
							
							} else {
								
								copy($file->getPathname(), $destFolder.DIRECTORY_SEPARATOR.$file->getFilename());
								
								$arq_add_source_array[] = '';
							}					
						}
					}
					
					echo $bps_topDiv;
					
					$text = '<strong><font color="green">'.__('AutoRestore was turned Off as a safety precaution. You can turn AutoRestore back On now.', 'bulletproof-security').'</font></strong><br>';
					echo $text;
					
					$arq_add_source_array_unique = array_unique($arq_add_source_array);
					
					foreach ( $arq_add_source_array_unique as $key => $value ) {
						
						if ( $value != '' ) {
						
							echo '<strong><font color="green">'.$value.__(' has been Added to /', 'bulletproof-security').$bps_wpcontent_dir.__('/bps-backup/autorestore/added-files successfully.', 'bulletproof-security').'</font></strong><br>';
						
						} else {
							
							echo '<strong><font color="green">'.__('All previously added files in folder ', 'bulletproof-security').stripslashes( $source ).'<br>'.__('have been resaved/recopied to ', 'bulletproof-security').$destFolder.'</font></strong><br>';
						}
					}
					
					echo '</p></div>';
				}	
			}
			
			if ( $_POST['arqAddRemove'] == array(3) ) {
			
				$arq_add_hidden_options = array(
				'bps_arq_add_hidden' => $bps_arq_add_hidden
				);	
			
				foreach ( $arq_add_hidden_options as $key => $value ) {
					update_option('bulletproof_security_options_arq_add_hidden', $arq_add_hidden_options);
				}

				$path_parts = pathinfo($source);
				$filename = $path_parts['basename'];
				// C:/xampp/htdocs2/aitpro-blog/arq-indiv-file/test/test-sub
				$dirname = str_replace( array( '\\\\', '\\'), '/', $path_parts['dirname'] );
				$dirname_replace = str_replace( dirname($arq_root_path_replace), '', $dirname);
				// C:\xampp\htdocs2\aitpro-blog\wordpress/wp-content/bps-backup/autorestore/added-files/aitpro-blog/arq-indiv-file/test/test-sub\arq-indiv-test1.php
				$destFile = WP_CONTENT_DIR . '/bps-backup/autorestore/added-files' . $dirname_replace.DIRECTORY_SEPARATOR.$filename;
				// C:\xampp\htdocs2\aitpro-blog\wordpress/wp-content/bps-backup/autorestore/added-files/aitpro-blog/arq-indiv-file/test/test-sub
				$destFolder = WP_CONTENT_DIR . '/bps-backup/autorestore/added-files' . $dirname_replace;

				// Add An Individual File - A Single File Is Added.
				if ( file_exists($source) ) {
					
					if ( ! is_dir( $destFolder ) ) {
						@mkdir( $destFolder, 0755, true );
						@chmod( $destFolder, 0755 );
					}
					
					if ( ! file_exists($destFile) ) {
					
						$rows_affected = $wpdb->insert( $table_name, array( 'arq_add_type' => 'single-file', 'arq_add_time' => current_time('mysql'), 'arq_add_dir' => str_replace( array( '\\\\', '\\'), '/', $dirname ), 'arq_add_source' => str_replace( array( '\\\\', '\\'), '/', $source ), 'arq_add_backup' => str_replace( array( '\\\\', '\\'), '/', $destFile ) ) );
						
						copy($source, $destFile);
						
						echo $bps_topDiv;
						$text = '<strong><font color="green">'.__('AutoRestore was turned Off as a safety precaution. You can turn AutoRestore back On now.', 'bulletproof-security').'<br>'.stripslashes( $source ).__(' has been Added to /', 'bulletproof-security').$bps_wpcontent_dir.__('/bps-backup/autorestore/added-files successfully.', 'bulletproof-security').'</font></strong>';
						echo $text;
						echo '</p></div>';
				
					} else {
						
						copy($source, $destFile);

						echo $bps_topDiv;
						$text = '<strong><font color="green">'.__('AutoRestore was turned Off as a safety precaution. You can turn AutoRestore back On now.', 'bulletproof-security').'<br>'.stripslashes( $source ).__(' has been resaved/recopied to ', 'bulletproof-security').$destFile.'</font></strong>';
						echo $text;
						echo '</p></div>';						
					}
				}
			} // end array 3
		}
	} // end if isset

// Dropdown list array for ARQ Add Form		
function bps_showOptionsDropARQ1($array, $active, $echo=true) {
$string = '';
	
	foreach ( $array as $k => $v ) {
		if ( is_array($active) )
			$s = ( in_array($k, $active)) ? ' selected="selected"' : '';
		else
			$s = ( $active == $k ) ? ' selected="selected"' : '';
			$string .= '<option value="'.$k.'"'.$s.'>'.$v.'</option>'."\n";
	}
	
	if ($echo)
	echo $string;
	else
	return $string;
}

// Form ARQ Exclude Folders & Files - Add Excluded WordPress file paths to DB - DB row entry is source path, not backup path
if ( ! isset( $_POST['Submit-ARQ-Exclude'] ) )
    $chosenARQExclude = array(0);
	else
    if ( isset( $_POST['Submit-ARQ-Exclude'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_arq_exclude' );   
	    $chosenARQExclude = $_POST['arqExclude'];
		global $wpdb;

		## 15.6: Removed stripslashes(), which removes backslashes on XAMPP
		$source = trim( $_POST['arq-source-path-exclude'] );
		$table_name = $wpdb->prefix . "bpspro_arq_exclude";
		
	if ( $_POST['arqExclude'] == array(0) ) {
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
		$text = '<font color="#fb0101"><strong>'.__('Error: You did not select an Exclude Option.', 'bulletproof-security').'</strong></font>';
		echo $text;
		echo '</p></div>';
	}

	if ( $_POST['arqExclude'] == array(1) ) {
		
		if ( is_dir($source) ) {
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';

		foreach ( $iterator as $file ) {
			if ( $file->isDir() ) {
				// no need to add directory paths ONLY file paths are needed
			} else {
				$rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'arq_exclude_source' => $file ) );
			}
		}
		$text = '<font color="green">'.$source.__(' folder and all subfolders and files have been Excluded successfully.', 'bulletproof-security').'</font>';
		echo $text;
		echo '</p></div>';
		} else {
			echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
			$text = '<font color="#fb0101"><strong>'.$source.__(' is not a valid folder path.', 'bulletproof-security').'</strong></font>';
		echo $text;
		echo '</p></div>';
		}	
	}
		
		if ( $_POST['arqExclude'] == array(2) ) {
		
		if ( is_dir($source) ) {
		$iterator = new DirectoryIterator($source);

		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
		
		foreach ( $iterator as $file ) {
			if ( $file->isFile() ) {
				$rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'arq_exclude_source' => $source.DIRECTORY_SEPARATOR.$file ) );
			}
			
		}
		$text = '<font color="green">'.$source.__(' folder and all files in this folder have been Excluded successfully.', 'bulletproof-security').'</font>';
		echo $text;
		echo '</p></div>';
		} else {
			echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
			$text = '<font color="#fb0101"><strong>'.$source.__(' is not a valid folder path.', 'bulletproof-security').'</strong></font>';
		echo $text;
		echo '</p></div>';
		}	
	}
		
		if ( $_POST['arqExclude'] == array(3) ) {
		
		if ( file_exists($source) ) {
			$rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'arq_exclude_source' => $source ) );
			echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
			$text = '<font color="green">'.$source.__(' has been Excluded successfully and will NOT be checked by the ARQ Cron.', 'bulletproof-security').'</font>';
		echo $text;
		echo '</p></div>';
		} else {
			echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
			$text = '<font color="#fb0101"><strong>'.$source.__(' is not a valid file path.', 'bulletproof-security').'</strong></font>';
		echo $text;
		echo '</p></div>';
		}
		} // end array 3
} // end if isset

// Dropdown list array for ARQ Exclude Form		
function bps_showOptionsDropARQ2($array, $active, $echo=true) {
	$string = '';
	foreach ( $array as $k => $v ) {
	if ( is_array($active) )
	$s = ( in_array($k, $active) ) ? ' selected="selected"' : '';
	else
	$s = ( $active == $k ) ? ' selected="selected"' : '';
	$string .= '<option value="'.$k.'"'.$s.'>'.$v.'</option>'."\n";
	}
	if ($echo)   echo $string;
	else        return $string;
}

$arqAddRemove = array(' Select An Add Option:', 'Add Top Level Folder - All Subfolders & All Files Are Added', 'Add A Specific Folder - All Files In A Specific Folder Are Added', 'Add An Individual File - A Single File Is Added');

$arqExclude = array(' Select An Exclude Option:', 'Exclude Top Level Folder - All Subfolders & All Files Are Excluded', 'Exclude A Specific Folder - All Files In A Specific Folder Are Excluded', 'Exclude An Individual File - A Single File Is Excluded');

$arq_host_root = get_option('bulletproof_security_options_arq_host_root'); 
$bps_arq_host_root_folder = isset( $_POST['bps_arq_host_root_folder'] ) ? str_replace( array( '\\\\', '\\'), '/', $_POST['bps_arq_host_root_folder'] ) : $arq_host_root['bps_arq_host_root_folder'];

?>

<div id="bpsARQCronAdd" style="margin:10px 0px 10px 0px;">

<form name="ARQ-Add-Remove" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ); ?>" method="post">
	<?php wp_nonce_field('bulletproof_security_arq_add_remove'); ?>
    
    <strong><label for="arq-add"><?php _e('Enter the full path to your hosting account root folder:', 'bulletproof-security'); ?> </label></strong><br />
    <?php echo '<span class="arq-backup-files"><strong>'.__('Click the Read Me help button above for examples', 'bulletproof-security').'</strong></span>'; ?><br />
	<input type="text" name="bps_arq_host_root_folder" value="<?php echo rtrim( $bps_arq_host_root_folder, '/\\' ); ?>" class="form-340" /><br /><br />   
     
    <strong><label for="arq-add"><?php _e('Select Folder or File Add Option:', 'bulletproof-security'); ?> </label></strong><br />
	<select name="arqAddRemove[]" id="arqAddRemove" class="form-340" >
	<?php echo bps_showOptionsDropARQ1($arqAddRemove, $chosenARQAdd, true); ?>
	</select><br /><br />
    
    <strong><label for="arq-add"><?php _e('Enter an Add Folder or File Path:', 'bulletproof-security'); ?></label></strong><br />
    <?php echo '<span class="arq-backup-files"><strong>'.__('Click the Read Me help button above for examples', 'bulletproof-security').'</strong></span>'; ?><br />
    <input type="text" name="arq-source-path-add" class="regular-text-340" style="background-color:#FFFFFF;" value="" /><br /><br />
    
	<input type="hidden" name="bps_arq_add_hidden" value="14" />

    <input type="submit" name="Submit-ARQ-Add-Remove" value="<?php esc_attr_e('Add', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('For non-WordPress Folders & Files ONLY', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Clicking OK will copy the non-WordPress folders and files for whatever path you entered in the Enter an Add Folder or File Path text box to the /added-files backup folder and these folders and files will now be checked by the ARQ Cron.', 'bulletproof-security').'\n\n'.__('To remove these files from being checked by the ARQ Cron, use the Remove Added Folders|Files Search tool to search for and remove these files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to Add non-WordPress folders or files or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form>

</div>

</td>
	<td style="border:none;vertical-align:middle">

<div id="bpsARQCronExclude" style="margin:10px 0px 10px 0px;">

<form name="ARQ-Exclude" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_arq_exclude'); ?>
    
    <strong><label for="arq-exclude"><?php _e('Select Folder or File Exclude Option:', 'bulletproof-security'); ?> </label></strong><br />
	<select name="arqExclude[]" id="arqExclude" class="form-340" >
	<?php echo bps_showOptionsDropARQ2($arqExclude, $chosenARQExclude, true); ?>
	</select><br /><br />
    
    <strong><label for="arq-exclude"><?php _e('Enter an Exclude Folder or File Path:', 'bulletproof-security'); ?></label></strong><br />
    <?php echo '<span class="arq-backup-files"><strong>'.__('Click the Read Me help button above for examples', 'bulletproof-security').'</strong></span>'; ?><br />    
    <input type="text" name="arq-source-path-exclude" class="regular-text-340" style="background-color:#FFFFFF;" value="" /><br /><br />
    
    <input type="submit" name="Submit-ARQ-Exclude" value="<?php esc_attr_e('Exclude', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('For WordPress Folders & Files ONLY', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Clicking OK will exclude any WordPress folders and files for whatever path you entered in the Enter an Exclude Folder or File Path text box from being checked by the ARQ Cron.', 'bulletproof-security').'\n\n'.__('To remove files from being excluded from the ARQ Cron check, use the Remove Excluded Folders|Files Search tool to search for and remove these excluded files.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to Exclude WordPress folders or files or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form>

</div>

</td>
</tr>
</tbody>
</table> 
</div>

<?php
// Form Processing: Delete All Added Folders & Files Form
if ( isset( $_POST['submit-arq-db-add-delete'] ) && current_user_can('manage_options') ) {
	check_admin_referer('bulletproof_security_arq_delete_added');
	
	$ARQoptions = get_option('bulletproof_security_options_ARCM');

	$BPS_Options = array(
	'bps_autorestore_cron_frequency' 	=> $ARQoptions['bps_autorestore_cron_frequency'], 
	'bps_autorestore_cron' 				=> 'Off', 
	'bps_autorestore_cron_override' 	=> $ARQoptions['bps_autorestore_cron_override'], 
	'bps_autorestore_cron_filecheck' 	=> $ARQoptions['bps_autorestore_cron_filecheck'], 
	'bps_autorestore_cron_forced' 		=> $ARQoptions['bps_autorestore_cron_forced'], 
	'bps_autorestore_cron_end' 			=> $ARQoptions['bps_autorestore_cron_end']
	);	

	foreach ( $BPS_Options as $key => $value ) {
		update_option('bulletproof_security_options_ARCM', $BPS_Options);
	}		
	
	$arq_add_hidden_options = array(
	'bps_arq_add_hidden' => '14'
	);	

	foreach ( $arq_add_hidden_options as $key => $value ) {
		update_option('bulletproof_security_options_arq_add_hidden', $arq_add_hidden_options);
	}

	$Atable_name = $wpdb->prefix . "bpspro_arq_add";
	$wpdb->query("DROP TABLE IF EXISTS $Atable_name");	
	
	$added_files_folder = WP_CONTENT_DIR . '/bps-backup/autorestore/added-files/';		
	
	if ( is_dir($added_files_folder) ) {
		
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($added_files_folder), RecursiveIteratorIterator::CHILD_FIRST);		
		
		foreach ( $iterator as $file ) {
			
			if ( $file->isFile() ) {
				
				@unlink( $file->getRealPath() );

			} else {
			
				if ( $file->isDir() )	{
					@rmdir( $file->getRealPath() );
				}
			}
		}
	}	
	
	echo $bps_topDiv;
	$text = '<strong><font color="green">'.__('AutoRestore was turned Off as a safety precaution. You can turn AutoRestore back On now.', 'bulletproof-security').'<br>'.__('All Added folders & files have been deleted from the /', 'bulletproof-security').$bps_wpcontent_dir.__('/bps-backup/autorestore/added-files folder successfully.', 'bulletproof-security').'</font></strong>';
	echo $text;
	echo '</p></div>';	
}

	// DB Search Table Forms - DB Remove Added and DB Remove Excluded Search
	echo '<div id="ARQ-Remove-Added-Excluded">';
	echo '<table class="widefat" style="">';
	echo '<thead>';
	echo '<tr>';
	echo '<th scope="col" style="" class="arq-remove-add-exclude-col1"><strong>'.__('Remove Folders & Files', 'bulletproof-security').'</strong></th>';
	echo '<th scope="col" style="" class="arq-remove-add-exclude-col2"><strong>'.__('ARQ DB Search For Folder Names or Filenames to Remove From DB:', 'bulletproof-security').'</strong><br>'.__('Hint: A search using only a single forward slash '.'"'.'/'.'"'.' will show all database search results', 'bulletproof-security').'<br>'.__('Hint: A search for the folder or file name '.'"'.'orange'.'"'.' will show all folders and files that are named orange', 'bulletproof-security').'</th>';
	echo '</tr>';
	echo '</thead>';
	echo '<tbody>';
	echo '<tr>';
	echo '<th scope="row" style="border-bottom:none;">'.__('Remove Added Folders|Files Search', 'bulletproof-security').'</th>';
	echo '<td>';
	echo '<form name="bpsSearchDBAddRemove" action="'.admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ).'" method="post">';
	wp_nonce_field('bulletproof_security_arq_db_search_added');
	echo '<input type="text" name="arqAddSearch" class="regular-text-500" style="background-color:#FFFFFF;" value="" />';
	echo '<input type="submit" name="submit-arq-db-add-remove-search" value="'.esc_attr__('Search', 'bulletproof-security').'" class="button bps-button" />';
	echo '</form>';
	echo '</td>';
	echo '</tr>';	
	
	echo '<tr>';
	echo '<th scope="row" style="border-bottom:none;">'.__('Delete All Added Folders & Files', 'bulletproof-security').'</th>';
	echo '<td>';
	echo '<form name="bpsAddDelete" action="'.admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ).'" method="post">';
	wp_nonce_field('bulletproof_security_arq_delete_added');
	echo "<input type=\"submit\" name=\"submit-arq-db-add-delete\" value=\"".esc_attr__('Delete All Added Folders|Files', 'bulletproof-security')."\" class=\"button bps-button\" onclick=\"return confirm('".__('Click OK to delete all Added Folders & Files or click Cancel', 'bulletproof-security')."')\" />";
	echo '</form>';
	echo '</td>';
	echo '</tr>';	
	
	echo '<tr>';
	echo '<th scope="row" style="border-bottom:none;">'.__('Remove Excluded Folders|Files Search', 'bulletproof-security').'</th>';
	echo '<td style="border:none">';
	echo '<form name="bpsSearchDBExludeRemove" action="'.admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ).'" method="post">';
	wp_nonce_field('bulletproof_security_arq_db_search_excluded');
	echo '<input type="text" name="arqExcludeSearch" class="regular-text-500" style="background-color:#FFFFFF;" value="" />';
	echo '<input type="submit" name="submit-arq-db-exlude-remove-search" value="'.esc_attr__('Search', 'bulletproof-security').'" class="button bps-button" />';
	echo '</form>';		
	echo '</td>';
	echo '</tr>';	
	echo '</tbody>';
	echo '</table>';	
	echo '</div>';

	// File & Folder Search Table Forms - Show Top Level Tables, folders and files
	echo '<div id="ARQ-Folder-File-Search">';
	echo '<table class="widefat" style="margin-bottom:10px">';
	echo '<thead>';
	echo '<tr>';
	echo '<th scope="col" style="" class="arq-folder-file-search-col1"><strong>'.__('Folder & File Search Tool', 'bulletproof-security').'</strong></th>';
	echo '<th scope="col" style="" class="arq-folder-file-search-col2"><strong>'.__('Find Folder Name & File Name Paths:', 'bulletproof-security').'</strong></th>';
	echo '</tr>';
	echo '</thead>';
	echo '<tbody>';
	echo '<tr>';
	echo '<th scope="row" style="border-bottom:none;">'.__('Show ONLY Top Level Folders', 'bulletproof-security').'</th>';
	echo '<td>';
	echo '<form name="bpsSearchTopLevelFolders" action="'.admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ).'" method="post">';
	wp_nonce_field('bulletproof_security_arq_top_level_search');
	echo '<input type="submit" name="submit-arq-top-level-search" value="'.esc_attr__('Show Folders', 'bulletproof-security').'" class="button bps-button" />';
	echo '</form>';
	echo '</td>';
	echo '</tr>';	
	echo '<tr>';
	echo '<th scope="row" style="border-bottom:none;">'.__('Show ALL Folders<br>Top Level & Subfolders', 'bulletproof-security').'</th>';
	echo '<td>';
	echo '<form name="bpsSearchAllFolders" action="'.admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ).'" method="post">';
	wp_nonce_field('bulletproof_security_arq_all_folders_search');
	echo '<input type="submit" name="submit-arq-all-folders-search" value="'.esc_attr__('Show Folders', 'bulletproof-security').'" class="button bps-button" style="margin-top:10px;" />';
	echo '</form>';
	echo '</td>';
	echo '</tr>';	
	echo '<tr>';
	echo '<th scope="row" style="border-bottom:none;">'.__('Search a Specific Folder<br>For All Files in That Folder', 'bulletproof-security').'</th>';
	echo '<td style="border:none">';
	echo '<form name="bpsSearchSpecificFolder" action="'.admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ).'" method="post">';
	wp_nonce_field('bulletproof_security_arq_specific_folder_search');
    echo '<strong><label for="arq-search">'.__('Example Search: ', 'bulletproof-security').ABSPATH.'foldername</label></strong><br>';
	echo '<input type="text" name="arqSpecificFolderSearch" class="regular-text-500" style="background-color:#FFFFFF;" value="" />';
	echo '<input type="submit" name="submit-arq-specific-folder-search" value="'.esc_attr__('Search', 'bulletproof-security').'" class="button bps-button" />';
	echo '</form>';		
	echo '</td>';
	echo '</tr>';	
	echo '</tbody>';
	echo '</table>';	
	echo '</div>';
?>

<?php 
// bpsSearchTopLevelFolders Form - Show ONLY Top Level Folders 
if ( isset( $_POST['submit-arq-top-level-search'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_arq_top_level_search' );
	
	$source = get_home_path();
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;

	if ( is_dir($source) ) {
		$iterator = new DirectoryIterator($source);
			
		echo '<div id="ShowFolders">';
		echo '<table class="widefat" style="">';
		echo '<thead>';
		echo '<tr>';
		echo '<th scope="col" style="" class="arq-show-folders-col1"><strong>'.__('Top Level Folder Name', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-col2"><strong>'.__('Top Level Folder Path', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-col3"><strong>'.__('Last Modified', 'bulletproof-security').'</strong></th>';
		echo '</tr>';
		echo '</thead>';
		echo '<tbody>';
		echo '<tr>';

		foreach ( $iterator as $files ) {
			if ( $files->isDir() && ! $files->isDot() ) {
			echo '<th scope="row" style="border-bottom:none;">'.$files.'</th>';
			echo '<td>'.$files->getPathname().'</td>';
	    	echo '<td>'.date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset ).'</td>';
			echo '</tr>';	
			}
		}
		echo '</tbody>';
		echo '</table>';	
		echo '</div>';
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
	$text = '<font color="green">'.__('Your Search Results are displayed below the Folder & File Search tool.', 'bulletproof-security').'</font><br>';
	echo $text;
	echo '</p></div>';		
	}
}

// bpsSearchAllFolders Form - Show All Folders - Top Level and Subfolders 
if ( isset( $_POST['submit-arq-all-folders-search'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_arq_all_folders_search' );
	
	$source = get_home_path();
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;
	
	if ( is_dir($source) ) {
		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);		
		
		echo '<div id="ShowFolders">';
		echo '<table class="widefat" style="">';
		echo '<thead>';
		echo '<tr>';
		echo '<th scope="col" style="" class="arq-show-folders-col1"><strong>'.__('Folder|Subfolder Name', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-col2"><strong>'.__('Folder|Subfolder Path', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-col3"><strong>'.__('Last Modified', 'bulletproof-security').'</strong></th>';
		echo '</tr>';
		echo '</thead>';
		echo '<tbody>';
		echo '<tr>';
		
		foreach ( $iterator as $files ) {
			if ( $files->isDir() ) {
			echo '<th scope="row" style="border-bottom:none;">'.$iterator->getSubPathName().'</th>';
			echo '<td>'.$files->getPathname().'</td>';
	    	echo '<td>'.date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset ).'</td>';
			echo '</tr>';	
			}
		}
		echo '</tbody>';
		echo '</table>';	
		echo '</div>';
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
	$text = '<font color="green">'.__('Your Search Results are displayed below the Folder & File Search tool.', 'bulletproof-security').'</font><br>';
	echo $text;
	echo '</p></div>';		
	}
}

// bpsSearchSpecificFolder Form - Search a specific folder for all files in that folder 
if ( isset( $_POST['submit-arq-specific-folder-search'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_arq_specific_folder_search' );
	
	$source = $_POST['arqSpecificFolderSearch'];
	$gmt_offset = get_option( 'gmt_offset' ) * 3600;

	if ( is_dir($source) ) {
		$iterator = new DirectoryIterator($source);
			
		echo '<div id="ShowFolders">';
		echo '<table class="widefat" style="">';
		echo '<thead>';
		echo '<tr>';
		echo '<th scope="col" style="" class="arq-show-folders-files-col1"><strong>'.__('Filename', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-files-col2"><strong>'.__('Folder Path|', 'bulletproof-security').$source.'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-files-col3"><strong>'.__('Last Modified', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="" class="arq-show-folders-files-col4"><strong>'.__('File Size|bytes', 'bulletproof-security').'</strong></th>';
		echo '</tr>';
		echo '</thead>';
		echo '<tbody>';
		echo '<tr>';

		foreach ( $iterator as $files ) {
			if ( $files->isFile() ) {

			echo '<th scope="row" style="border-bottom:none;">'.$files->getFilename().'</th>';
			echo '<td>'.$files->getPathname().'</td>';
	    	echo '<td>'.date("n-d-Y H:i:s", $files->getMTime() + $gmt_offset ).'</td>';
			echo '<td>'.$files->getSize().' bytes'.'</td>'; 
			echo '</tr>';	
			}
		}
		echo '</tbody>';
		echo '</table>';	
		echo '</div>';
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
	$text = '<font color="green">'.__('Your Search Results are displayed below the Folder & File Search tool.', 'bulletproof-security').'</font><br>';
	echo $text;
	echo '</p></div>';		
		} else {
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
	$text = '<font color="#fb0101"><strong>'.__('You did not enter a valid folder path. Valid Folder Path Example: ', 'bulletproof-security').ABSPATH.'foldername</strong></font><br>';
	echo $text;
	echo '</p></div>';	
	}
}

if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#ShowFolders tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } 

// Get the Search Post variable for processing other ARQ remove Added folders and files forms 
if ( isset( $_POST['submit-arq-db-add-remove-search'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_arq_db_search_added' );
	
	$bpspro_arq_add_table = $wpdb->prefix . "bpspro_arq_add";
	$search = $_POST['arqAddSearch'];
}

// Remove Added files form proccessing code
if ( isset( $_POST['Submit-ARQ-Remove-Added'] ) && current_user_can('manage_options') ) {
	check_admin_referer('bulletproof_security_arq_remove_added');
	
	$removeornot = $_POST['removeornot'];
	$bpspro_arq_add_table = $wpdb->prefix . "bpspro_arq_add";
	
	switch( $_POST['Submit-ARQ-Remove-Added'] ) {
		case __('Remove', 'bulletproof-security'):
		
		$remove_rows = array();
		$donotremove = '';
		
		if ( ! empty($removeornot) ) {
			
			foreach ( $removeornot as $key => $value ) {
				if ( $value == 'remove' ) {
					$remove_rows[] = $key;
				} elseif ( $value == 'donotremove' ) {
					$donotremove .= ', '.$key;
				}
				}
			}
			$donotremove = substr($donotremove, 2); // add the comma and space from ', '.$key between each donotremove file
		
		if ( ! empty($remove_rows) ) {
			
			foreach ( $remove_rows as $remove_row ) {
				unlink($remove_row);
				$delete_row = $wpdb->query( $wpdb->prepare( "DELETE FROM $bpspro_arq_add_table WHERE arq_add_backup = %s", $remove_row));
				$textDBAddRemove = '<font color="green">'.sprintf(__('%s has been deleted from the backup folder and removed from your DB.', 'bulletproof-security'), $remove_row).'</font><br>';
			}
		}
		
		if ( ! empty($donotremove) ) {
		// do nothing here - do not echo a message because it would be repeated X times
		//$textDB = '<font color="green">'.sprintf(__('DB Rows %s Not Removed', 'bulletproof-security'), $donotremove).'</font>';
		}
		break;
	}
}
?>

<?php if ( ! empty($textDBAddRemove) ) { echo '<!-- Last Action --><div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>'.$textDBAddRemove.'</p></div>'; } ?>

<form name="bpsARQDBRadio" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_arq_remove_added'); ?>
<?php	
	$bpspro_arq_add_table = $wpdb->prefix . "bpspro_arq_add";

	if ( isset( $_POST['submit-arq-db-add-remove-search'] ) ) {
		$search = $_POST['arqAddSearch'];
	} else {
		$search = '';
	}
	
	if ( isset( $_POST['submit-arq-db-add-remove-search'] ) && $search != '' ) {

	$getARQAddTable = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $bpspro_arq_add_table WHERE arq_add_backup LIKE %s", "%$search%" ) );

		echo '<h3>'.__('Search Results For Added Files To Remove', 'bulletproof-security').'</h3>';	
		echo '<div id="RemoveAddedFiles">';
		echo '<table class="widefat" style="margin-bottom:20px;">';
		echo '<thead>';
		echo '<tr>';
		echo '<th scope="col" style="width:20%;"><strong>'.__('Filename in DB', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:7%;"><strong>'.__('Remove', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:7%;"><strong>'.__('Do Not<br>Remove', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:56%;"><strong>'.__('The Added File Path in DB|Backed Up File Path', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:10%;"><strong>'.__('Time Added<br>To DB', 'bulletproof-security').'</strong></th>';
		echo '</tr>';
		echo '</thead>';
		echo '<tbody>';
		echo '<tr>';
		
		foreach ( $getARQAddTable as $row ) {
    	$path_parts = pathinfo($row->arq_add_backup);
		$filename = $path_parts['basename'];
		
		echo '<th scope="row" style="border-bottom:none;">'.$filename.'</th>';
		echo "<td><input type=\"radio\" id=\"remove\" name=\"removeornot[$row->arq_add_backup]\" value=\"remove\" /></td>";
		echo "<td><input type=\"radio\" id=\"donotremove\" name=\"removeornot[$row->arq_add_backup]\" value=\"donotremove\" checked /></td>";
		echo '<td>'.$row->arq_add_backup.'</td>';		
		echo '<td>'.$row->arq_add_time.'</td>'; 
		echo '</tr>';			
		}
		echo '</tbody>';
		echo '</table>';	
		echo '</div>';
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
	$text = '<font color="green">'.__('Your DB Search Results For Added Files To Remove are displayed below the DB Search tool.', 'bulletproof-security').'</font><br>';
	echo $text;
	echo '</p></div>';

?>
<input type="submit" name="Submit-ARQ-Remove-Added" value="<?php esc_attr_e('Remove', 'bulletproof-security'); ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Clicking OK will Remove the DB entry for any Added file where you have selected the Remove Radio button and also delete the Added file that you no longer want checked by the ARQ Cron. ONLY backed up / Added ARQ files are deleted. To add a file or folder back to ARQ Cron checking, use the Add Folders & Files tool.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to remove your Remove choices or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form><br />

<?php } ?>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#RemoveAddedFiles tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

<?php
// Remove Exluded files from DB - removing files from being excluded will allow the ARQ Cron to check the file again
if ( isset( $_POST['submit-arq-db-exlude-remove-search'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_arq_db_search_excluded' );
	
	$bpspro_arq_exclude_table = $wpdb->prefix . "bpspro_arq_exclude";
	$search = $_POST['arqExcludeSearch'];
}

if ( isset( $_POST['Submit-ARQ-Remove-Excluded'] ) && current_user_can('manage_options') ) {
	check_admin_referer('bulletproof_security_arq_remove_excluded');
	
	$removeornot = $_POST['removeornot'];
	$bpspro_arq_exclude_table = $wpdb->prefix . "bpspro_arq_exclude";
	
	switch( $_POST['Submit-ARQ-Remove-Excluded'] ) {
		case __('Remove', 'bulletproof-security'):
		
		$remove_rows = array();
		$donotremove = '';
		
		if ( ! empty($removeornot) ) {
			
			foreach ( $removeornot as $key => $value ) {
				if ( $value == 'remove' ) {
					$remove_rows[] = $key;
				} elseif ( $value == 'donotremove' ) {
					$donotremove .= ', '.$key;
				}
				}
			}
			$donotremove = substr($donotremove, 2); // add the comma and space from ', '.$key between each donotremove file
		
		if ( ! empty($remove_rows) ) {
			
			foreach ( $remove_rows as $remove_row ) {
				$delete_row = $wpdb->query( $wpdb->prepare( "DELETE FROM $bpspro_arq_exclude_table WHERE arq_exclude_source = %s", $remove_row ) );
				$textDBExclude = '<font color="green">'.sprintf(__('%s has been removed from being excluded and will be checked again by the ARQ Cron.', 'bulletproof-security'), $remove_row).'</font><br>';
			}
		}
		if ( ! empty($donotremove) ) {
		// do nothing here - do not echo a message because it would be repeated X times
		//$textDB = '<font color="green">'.sprintf(__('DB Rows %s Not Removed', 'bulletproof-security'), $donotremove).'</font>';
		}
		break;
	}
}
?>

<?php if ( ! empty($textDBExclude) ) { echo '<!-- Last Action --><div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>'.$textDBExclude.'</p></div>'; } ?>

<form name="bpsARQDBRadioExlude" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/autorestore/autorestore.php#bps-tabs-3' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_arq_remove_excluded'); ?>
<?php	
	$bpspro_arq_exclude_table = $wpdb->prefix . "bpspro_arq_exclude";

	if ( isset( $_POST['submit-arq-db-exlude-remove-search'] ) ) {
		$search = $_POST['arqExcludeSearch'];
	} else {
		$search = '';
	}

	if ( isset( $_POST['submit-arq-db-exlude-remove-search'] ) && $search != '' ) {

		$getARQExcludeTable = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $bpspro_arq_exclude_table WHERE arq_exclude_source LIKE %s", "%$search%" ) );

		echo '<h3>'.__('Search Results For Excluded Files To Remove From DB', 'bulletproof-security').'</h3>';	
		echo '<div id="RemoveExcludedFiles">';		
		echo '<table class="widefat" style="margin-bottom:20px;">';
		echo '<thead>';
		echo '<tr>';
		echo '<th scope="col" style="width:20%;"><strong>'.__('Filename in DB', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:7%;"><strong>'.__('Remove', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:7%;"><strong>'.__('Do Not<br>Remove', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:56%;"><strong>'.__('The Excluded File Path in DB', 'bulletproof-security').'</strong></th>';
		echo '<th scope="col" style="width:10%;"><strong>'.__('Time Added<br>To DB', 'bulletproof-security').'</strong></th>';
		echo '</tr>';
		echo '</thead>';
		echo '<tbody>';
		echo '<tr>';
		
		foreach ( $getARQExcludeTable as $row ) {
    	$path_parts = pathinfo($row->arq_exclude_source);
		$filename = $path_parts['basename'];
		
		echo '<th scope="row" style="border-bottom:none;">'.$filename.'</th>';
		echo "<td><input type=\"radio\" id=\"remove\" name=\"removeornot[$row->arq_exclude_source]\" value=\"remove\" /></td>";
		echo "<td><input type=\"radio\" id=\"donotremove\" name=\"removeornot[$row->arq_exclude_source]\" value=\"donotremove\" checked /></td>";
		echo '<td>'.$row->arq_exclude_source.'</td>';		
		echo '<td>'.$row->time.'</td>'; 
		echo '</tr>';			
		}
		echo '</tbody>';
		echo '</table>';	
		echo '</div>';
		
		echo '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
	$text = '<font color="green">'.__('Your DB Search Results For Excluded Files To Remove from being excluded are displayed below the DB Search tool.', 'bulletproof-security').'</font><br>';
	echo $text;
	echo '</p></div>';

?>
<input type="submit" name="Submit-ARQ-Remove-Excluded" value="<?php esc_attr_e('Remove', 'bulletproof-security'); ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Clicking OK will Remove the DB entry for any Excluded files where you have selected the Remove Radio button. By removing the file path from being Excluded you are telling the ARQ Cron to check the file again. To exclude a file or folder again from being checked by the ARQ Cron, use the Exclude Folders & Files tool.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to remove your Remove choices or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form><br />

<?php } ?>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#RemoveExcludedFiles tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

</td>
  </tr>
</table>
</div>

<div id="bps-tabs-4" class="bps-tab-page">

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('Help & FAQ', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help_links">
    <a href="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/whatsnew/whatsnew.php' ); ?>" target="_blank"><?php _e('Whats New in ', 'bulletproof-security'); echo BULLETPROOF_VERSION; ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/bulletproof-security-pro-version-release-dates/" target="_blank"><?php _e('BPS Pro Features & Version Release Dates', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/video-tutorials/" target="_blank"><?php _e('Video Tutorials', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/plugin-conflicts-actively-blocked-plugins-plugin-compatibility/" target="_blank"><?php _e('Forum: Search, Troubleshooting Steps & Post Questions For Assistance', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/autorestore-quarantine-guide-read-me-first/" target="_blank"><?php _e('AutoRestore|Quarantine Guide & Troubleshooting', 'bulletproof-security'); ?></a>
    </td>
  </tr>
</table>
</div>

<div id="AITpro-link">BulletProof Security Pro <?php echo BULLETPROOF_VERSION; ?> Plugin by <a href="https://forum.ait-pro.com/" target="_blank" title="AITpro Website Security">AITpro Website Security</a>
</div>
</div>
<style>
<!--
.bps-spinner {visibility:hidden;}
-->
</style>
</div>