<?php
/**
* This file is created by Really Simple Security
*/

if (defined("SHORTINIT") && SHORTINIT) return;

$base_path = dirname(__FILE__);
if( file_exists( $base_path . "/rsssl-safe-mode.lock" ) ) {
    if ( ! defined( "RSSSL_SAFE_MODE" ) ) {
        define( "RSSSL_SAFE_MODE", true );
    }
    return;
}

if ( isset($_GET["rsssl_header_test"]) && (int) $_GET["rsssl_header_test"] ===  114077989 ) return;

if ( defined("RSSSL_HEADERS_ACTIVE" ) ) return;
define( "RSSSL_HEADERS_ACTIVE", true );
//RULES START

if ( !headers_sent() ) {
header("X-XSS-Protection: 0");
header("Referrer-Policy: strict-origin-when-cross-origin");
header("X-Frame-Options: SAMEORIGIN");
header("Content-Security-Policy: frame-ancestors 'self' ; upgrade-insecure-requests;");

}

// Access Restrictions

// Plugin dir validation.
$plugin_dir = __DIR__ . "/plugins/really-simple-ssl-pro";
if ( !file_exists($plugin_dir) ) {
  return;
}

// Variables needed for Access restrictions
 $ip_fetcher_file = "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/limitlogin/class-rsssl-ip-fetcher.php";
 if ( !file_exists($ip_fetcher_file) ) {
   return;
 }
$country_detection_file = "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/limitlogin/class-rsssl-country-detection.php";
 if ( !file_exists($country_detection_file) ) {
   return;
 }
$user_agent_detection_file = "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/class-rsssl-user-agent-handler.php";
 if ( !file_exists($user_agent_detection_file) ) {
   return;
 }
  $apology = "We&apos;re sorry.";
  $message = "This website is unavailable in your region.";
  $error_code = "Error code: 403";
// The Geo Database file.
  $db_file = "/nas/content/live/hprograms/wp-content/uploads/really-simple-ssl/geo_ip/GeoLite2-Country.mmdb";
  if (!file_exists($db_file)) {
    return;
  }
// Variables needed for 404
  $apology_404 = "We&apos;re sorry.";
  $message_404 = "Your access to this site has been temporarily denied";

// The block page.
  $block_page = "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/assets/templates/403-page.php";
  if (!file_exists($block_page)) {
    return;
  }

// The blocked countries, white list and other variables needed for block-regions.php.
  $countries_blocked = explode(",", "AN,AR,BO,BR,BQ,CL,CO,CW,EC,FK,GF,GY,PY,PE,SR,TT,UY,VE,AS,AU,CK,FJ,PF,GU,KI,MH,FM,NR,NC,NZ,NU,NF,MP,PW,PG,PN,WS,SB,TK,TO,TV,UM,VU,WF,AL,AD,AT,AX,BY,BE,BA,BG,HR,CS,CY,CZ,DK,EE,FO,FI,FR,DE,GG,GI,GR,HU,IS,IE,IM,IT,JE,XK,LV,LI,LT,LU,MT,MD,MC,ME,NL,MK,NO,PL,PT,RO,RU,SM,RS,SK,SI,SJ,ES,SE,CH,TC,TR,UA,GB,VA,AF,AM,AZ,BH,BD,BT,BN,KH,CN,CX,CC,IO,GE,HK,IN,ID,IR,IQ,IL,JP,JO,KZ,KP,KR,KW,KG,LA,LB,MO,MY,MV,MN,MM,NP,OM,PK,PS,PH,QA,SA,SG,LK,SY,TW,TJ,TH,TL,TM,AE,UZ,VN,YE,AQ,BV,TF,HM,GS,DZ,AO,BJ,BW,BF,BI,CV,CM,CF,TD,KM,CG,CD,CI,DJ,EG,GQ,ER,SZ,ET,GA,GM,GH,GN,GW,KE,LS,LR,LY,MG,MW,ML,MR,MU,MA,MZ,NA,NE,NG,RE,RW,ST,SN,SC,SL,SO,ZA,SS,SD,TZ,TG,TN,UG,EH,YT,ZM,ZW,CR,KY,BM,BZ,BB,BS,AW,AG,AI,HT,GT,GP,GD,GL,SV,DO,DM,CU,HN,JM,MQ,MX,MS,NI,PA,PR,BL,SH,KN,LC,MF,PM,VC,SX,VG,VI");
  $white_list = explode(",", "108.85.102.145");
  $uploads_dir = "/nas/content/live/hprograms/wp-content/uploads";
// The blocked ips for 404.
  $blocked_ips = explode(",", "");

// Loading the block-region.php
if ( file_exists( "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/block-region.php" ) ) {
  require_once "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/block-region.php";
}
// Loading the 404-detection.php
if ( file_exists( "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/404-detection.php" ) ) {
  require_once "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/404-detection.php";
}
// End Loading the block-region.php
// Variables needed for useragent
  $apology_404 = "We&apos;re sorry.";
  $message_user_agent = "Your access to this site has been denied";

// The blocked user agents.
  $blocked_user_agents = explode(",", "Lemon-Duck-*,Barkrowler,BDCbot,BLEXBot,Buck,Firefox/3.0,MegaIndex.ru,python-requests,site.ru");

// Loading the user-agents.php
if ( file_exists( "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/user-agent.php" ) ) {
  require_once "/nas/content/live/hprograms/wp-content/plugins/really-simple-ssl-pro/pro/security/wordpress/firewall/user-agent.php";
}
// End Loading the block-region.php
