'.__("Make sure the Definition Updates are current and Run a Complete Scan.", 'gotmls').'
'.sprintf(__("If Known Threats are found and displayed in red then there will be a button to '%s'. If only Potentional Threats are found then there is no automatic fix because those are probably not malicious.", 'gotmls'), GOTMLS_Automatically_Fix_LANGUAGE).'
'.__("A backup of the original infected files are placed in the Quarantine in case you need to restore them or just want to look at them later. You can delete these files if you don't want to save more.", 'gotmls').'
'.__("Get instant access to definition updates.",'gotmls').'
'.__("If you have not already registered your Key then register now using the form below. * All registration fields are required ** I will NOT share your information.",'gotmls').'
'.(false && $isRegistered?'Registered to: '.$isRegistered:"").$Update_Link, "stuffbox").'
'.GOTMLS_box(__("Resources & Links",'gotmls'), '
";
}
function GOTMLS_Firewall_Options() {
global $current_user, $wpdb, $table_prefix;
GOTMLS_ajax_load_update();
GOTMLS_display_header();
$GOTMLS_nonce_found = GOTMLS_get_nonce();
$gt = ">"; // This local variable never changes
$lt = "<"; // This local variable never changes
$save_action = "";
$patch_attr = array(
array(
"icon" => "blocked",
"language" => __("Your WordPress Login page is susceptible to a brute-force attack (just like any other login page). These types of attacks are becoming more prevalent these days and can sometimes cause your server to become slow or unresponsive, even if the attacks do not succeed in gaining access to your site. Applying this patch will block access to the WordPress Login page whenever this type of attack is detected.",'gotmls'),
"status" => __('Not Installed','gotmls'),
"action" => __('Install Patch','gotmls')
),
array(
"language" => __("Your WordPress site has the current version of my brute-force Login protection installed.",'gotmls'),
"action" => __('Uninstall Patch','gotmls'),
"status" => __('Enabled','gotmls'),
"icon" => "checked"
),
array(
"language" => __("Your WordPress Login page has the old version of my brute-force protection installed. Upgrade this patch to improve the protection on the WordPress Login page and preserve the integrity of your WordPress core files.",'gotmls'),
"action" => __('Upgrade Patch','gotmls'),
"status" => __('Out of Date','gotmls'),
"icon" => "threat"
)
);
$find = '|]+xmlrpc.php>(.+?)\s*(# END GOTMLS Patch to Block XMLRPC Access\s*)*|is';
$deny = "\n\norder deny,allow\ndeny from all\nallow from ".GOTMLS_REMOTEADDR;
$allow = GOTMLS_REMOTEADDR;
if (isset($_SERVER["SERVER_ADDR"])) {
$deny .= "\nallow from ".GOTMLS_safe_ip($_SERVER["SERVER_ADDR"]);
$allow .= " ".GOTMLS_safe_ip($_SERVER["SERVER_ADDR"]);
}
$deny .= "\n\n\nRequire";
if (strlen(trim($allow)) > 0)
$deny .= " ip $allow";
else
$deny .= " all denied";
$deny .= "\n";
if (count($GLOBALS["GOTMLS"]["tmp"]["apache"]) > 1)
$errdiv = "";
else {
if (isset($GLOBALS["GOTMLS"]["tmp"]["apache"][0]) && (strtolower(substr($GLOBALS["GOTMLS"]["tmp"]["apache"][0]."123456", 0, 6)) == "apache"))
$errdiv = "";
else
$errdiv = "
".__('Unable to find Apache on this server, this patch work on Apache servers!','gotmls')."
";
}
$Firewall_nonce = $lt.'input type="hidden" name="'.str_replace('=', '" value="', GOTMLS_set_nonce(__FUNCTION__."420")).'"'.$gt;
$XMLRPC_patch_action = $lt.'hr /'.$gt.$lt.'form method="POST" name="GOTMLS_Form_XMLRPC_patch"'.$gt.$Firewall_nonce.$lt.'script'.$gt."\nfunction setFirewall(opt, val) {\n\tif (autoUpdateDownloadGIF = document.getElementById('fw_opt'))\n\t\tautoUpdateDownloadGIF.value = opt;\n\tif (autoUpdateDownloadGIF = document.getElementById('fw_val'))\n\t\tautoUpdateDownloadGIF.value = val;\n}\nfunction testComplete() {\nif (autoUpdateDownloadGIF = document.getElementById('autoUpdateDownload'))\n\tdonationAmount = autoUpdateDownloadGIF.src.replace(/^.+\?/,'');\nif ((autoUpdateDownloadGIF.src == donationAmount) || donationAmount=='0') {\n\tif (patch_searching_div = document.getElementById('GOTMLS_XMLRPC_patch_searching')) {\n\t\tif (autoUpdateDownloadGIF.src == donationAmount)\n\t\t\tpatch_searching_div.innerHTML = '".GOTMLS_strip4java(__("You must register and donate to use this feature!",'gotmls'))."';\n\t\telse\n\t\t\tpatch_searching_div.innerHTML = '".GOTMLS_strip4java(__("This feature is available to those who have donated!",'gotmls'))."';\n\t}\n} else {\n\tshowhide('GOTMLS_XMLRPC_patch_searching');\n\tshowhide('GOTMLS_XMLRPC_patch_button', true);\n}\n}\nwindow.onload=testComplete;\n$lt/script$gt$lt".'div style="padding: 0 30px;"'.$gt.$lt.'input type="hidden" name="GOTMLS_XMLRPC_patching" value="';
$patch_found = false;
$head = str_replace(array('|]+', '(.+?)', '\\s*(', '\\s*)*|is'), array(" 0) && GOTMLS_save_contents(ABSPATH.'.htaccess', "$head$htaccess")) {
$XMLRPC_patch_action .= '-1"'.$gt.$lt.'input style="float: right;" type="submit" value="Unblock XMLRPC Access" /'.$gt.$lt.'p'.$gt.$lt.'img src="'.GOTMLS_images_path.'checked.gif"'.$gt.$lt.'b'.$gt.'Block XMLRPC Access (Now Blocked';
$errdiv = "";
} elseif ($GOTMLS_nonce_found && isset($_POST["GOTMLS_XMLRPC_patching"]) && ($_POST["GOTMLS_XMLRPC_patching"] > 0))
$XMLRPC_patch_action .= '1"'.$gt.$lt.'input style="float: right;" type="submit" value="Block XMLRPC Access" /'.$gt.$lt.'p'.$gt.$lt.'img src="'.GOTMLS_images_path.'threat.gif"'.$gt.$lt.'b'.$gt.'Block XMLRPC Access (Still Allowing Access: '.sprintf(__("Failed to install XMLRPC Protection [.htaccess %s]",'gotmls'),(is_readable(ABSPATH.'.htaccess')?'read-'.(is_writable(ABSPATH.'.htaccess')?'write?':'only!'):"unreadable!").": ".strlen($htaccess).GOTMLS_fileperms(ABSPATH.'.htaccess'));
else
$XMLRPC_patch_action .= '1"'.$gt.$lt.'input style="float: right;" type="submit" value="Block XMLRPC Access" /'.$gt.$lt.'p'.$gt.$lt.'img src="'.GOTMLS_images_path.'question.gif"'.$gt.$lt.'b'.$gt.'Block XMLRPC Access (Currently Allowing Access';
}
$XMLRPC_patch_action .= ")$errdiv$lt/b$gt$lt/p$gt{$lt}b$gt".__("(This patch only works on Apache servers and requires mod_rewrite to be functional)",'gotmls')."$lt/b$gt{$lt}br$gt\n".__("Most WordPress sites do not use the XMLRPC features and hack attempts on the xmlrpc.php file are more common then ever before. Even if there are no vulnerabilities for hackers to exploit, these attempts can cause slowness or downtime similar to a DDoS attack. This patch automatically blocks all external access to the xmlrpc.php file.",'gotmls')."$lt/div$gt$lt/form$gt";
$patch_status = 0;
$patch_found = -1;
$find = "#if\s*\(([^\&]+\&\&)?\s*file_exists\((.+?)(safe-load|wp-login)\.php'\)\)\s*require(_once)?\((.+?)(safe-load|wp-login)\.php'\);#";
$head = str_replace(array('#', '\\(', '\\)', '(_once)?', ')\\.', '\\s*', '(.+?)(', '|', '([^\\&]+\\&\\&)?'), array(' ', '(', ')', '_once', '.', ' ', '\''.dirname(__FILE__).'/', '/', '!in_array($_SERVER["REMOTE_ADDR"], array("'.GOTMLS_REMOTEADDR.'")) &&'), $find);
if (is_file(ABSPATH.'../wp-config.php') && !is_file(ABSPATH.'wp-config.php'))
$wp_config = '../wp-config.php';
else
$wp_config = 'wp-config.php';
$BFLP_patch_action = "";
if (is_file(ABSPATH.$wp_config)) {
if (($config = @file_get_contents(ABSPATH.$wp_config)) && strlen($config)) {
if ($patch_found = preg_match($find, $config)) {
if (strpos($config, substr($head, strpos($head, "file_exists")))) {
if ($GOTMLS_nonce_found && isset($_POST["GOTMLS_patching"]) && ($_POST["GOTMLS_patching"] > 0) && GOTMLS_save_contents(ABSPATH.$wp_config, preg_replace('#'.$lt.'\?[ph\s]+(//.*\s*)*\?'.$gt.'#i', "", preg_replace($find, "", $config))))
$BFLP_patch_action .= GOTMLS_error_div(__("Removed Brute-Force Protection",'gotmls'));
else
$patch_status = 1;
} else {
if ($GOTMLS_nonce_found && isset($_POST["GOTMLS_patching"]) && ($_POST["GOTMLS_patching"] > 0) && GOTMLS_save_contents(ABSPATH.$wp_config, preg_replace($find, "$head", $config))) {
$BFLP_patch_action .= GOTMLS_error_div(__("Upgraded Brute-Force Protection",'gotmls'), "updated");
$patch_status = 1;
} else
$patch_status = 2;
}
} elseif ($GOTMLS_nonce_found && isset($_POST["GOTMLS_patching"]) && ($_POST["GOTMLS_patching"] > 0) && strlen($config) && ($patch_found == 0) && GOTMLS_save_contents(ABSPATH.$wp_config, "$lt?php$head// Load Brute-Force Protection by GOTMLS.NET before the WordPress bootstrap. ?$gt$config")) {
$BFLP_patch_action .= GOTMLS_error_div(__("Installed Brute-Force Protection",'gotmls'), "updated");
$patch_status = 1;
} elseif ($GOTMLS_nonce_found && isset($_POST["GOTMLS_patching"]) && ($_POST["GOTMLS_patching"] > 0))
$BFLP_patch_action .= GOTMLS_error_div(sprintf(__("Failed to install Brute-Force Protection (wp-config.php %s)",'gotmls'),(is_readable(ABSPATH.$wp_config)?'read-'.(is_writable(ABSPATH.$wp_config)?'write':'only'):"unreadable").": ".strlen($config).GOTMLS_fileperms(ABSPATH.$wp_config)), "updated");
} else
$BFLP_patch_action .= GOTMLS_error_div(__("wp-config.php Not Readable!",'gotmls'));
} else
$BFLP_patch_action .= GOTMLS_error_div(__("wp-config.php Not Found!",'gotmls'));
if ($GOTMLS_nonce_found && isset($_POST["GOTMLS_firewall_option"]) && strlen($_POST["GOTMLS_firewall_option"]) && isset($_POST["GOTMLS_firewall_value"]) && strlen($_POST["GOTMLS_firewall_value"])) {
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"][GOTMLS_sanitize($_POST["GOTMLS_firewall_option"])] = (INT) $_POST["GOTMLS_firewall_value"];
if (update_option("GOTMLS_settings_array", $GLOBALS["GOTMLS"]["tmp"]["settings_array"]))
$save_action = "\n{$lt}div onclick=\"this.style.display='none';\" style='position: relative; top: -40px; margin: 0 300px 0 130px;' class='updated'$gt\nSettings Saved!$lt/div$gt\n";
else
$save_action = "\n{$lt}div onclick=\"this.style.display='none';\" style='position: relative; top: -40px; margin: 0 300px 0 130px;' class='updated'$gt\nSave Failed!$lt/div$gt\n";
}
$sec_opts = $lt.'form method="POST" name="GOTMLS_Form_firewall"'.$gt.$lt.'input type="hidden" id="fw_opt" name="GOTMLS_firewall_option" value="traversal"'.$gt.$lt.'input type="hidden" name="GOTMLS_firewall_value" id="fw_val" value="0"'.$gt.$Firewall_nonce;
if (isset($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["firewall"]) && array($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["firewall"]))
foreach ($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["firewall"] as $TP => $VA)
if (is_array($VA) && count($VA) > 3 && strlen($VA[1]) && strlen($VA[2]))
$sec_opts .= $lt.'div style="padding: 0 30px;"'.$gt.$lt.'input type="submit" style="float: right;" value="'.(isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"]["$TP"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"]["$TP"]?"Enable Protection\" onclick=\"setFirewall('$TP', 0);\"$gt$lt".'p'.$gt.$lt.'img src="'.GOTMLS_images_path.'threat.gif"'.$gt.$lt."b$gt$VA[1] (Currently Disabled)":"Disable Protection\" onclick=\"setFirewall('$TP', 1);\"$gt$lt".'p'.$gt.$lt.'img src="'.GOTMLS_images_path.'checked.gif"'.$gt.$lt."b$gt$VA[1] (Automatically Enabled)")."$lt/b$gt$lt/p$gt$VA[2]$lt/div$gt$lt".'hr /'.$gt;
$style = ' display: none;" id="GOTMLS_patch_button"'.$gt.$lt.'div id="GOTMLS_patch_searching" style="float: right;"'.$gt.__("Checking for session compatibility ...",'gotmls').' '.$lt.'img src="'.GOTMLS_images_path.'wait.gif" height=16 width=16 alt="Wait..." /'.$gt.$lt.'/div'.$gt;
$script = "";
if ($patch_status) {
$sec_opts .= $lt.'input type="submit" style="float: right; margin: 6px;" value="'.(isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"]["BFLP"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"]["BFLP"]?"Show Protection Logo\" onclick=\"setFirewall('BFLP', 0);\"$gt$lt".'div style="float: right; margin: 8px;"'."$gt Logo will be hidden on the login page":"Hide Protection Logo\" onclick=\"setFirewall('BFLP', 1);\"$gt$lt".'div style="float: right; margin: 8px;"'.$gt.$lt.'img style="height: 24px; vertical-align: middle;"src="'.GOTMLS_images_path.'GOTMLS-Loading.gif" /'."$gt Brute-Force Protection is Active")."$lt/div$gt";
$style = '"'.$gt;
} else
$script = $lt."script type='text/javascript'$gt\nfunction search_patch_onload() {\n\tstopCheckingSession = checkupdateserver('".GOTMLS_admin_url('GOTMLS_log_session')."');\n}\nif (window.addEventListener)\n\twindow.addEventListener('load', search_patch_onload)\nelse\n\tdocument.attachEvent('onload', search_patch_onload);\n$lt/script$gt";
$sec_opts .= "$lt/form$gt\n$BFLP_patch_action\n$lt".'form method="POST" name="GOTMLS_Form_patch"'.$gt.$lt.'div style="padding: 0 30px;"'.$gt.$Firewall_nonce.$lt.'input type="submit" value="'.$patch_attr[$patch_status]["action"].'" style="float: right;'.$style.$lt.'input type="hidden" name="GOTMLS_patching" value="1"'.$gt.$lt.'p'.$gt.$lt.'img src="'.GOTMLS_images_path.$patch_attr[$patch_status]["icon"].'.gif"'.$gt.$lt.'b'.$gt.'Brute-force Protection '.$patch_attr[$patch_status]["status"].$lt.'/b'.$gt.$lt.'/p'.$gt.$patch_attr[$patch_status]["language"].__(" For more information on Brute-Force attack prevention and the WordPress wp-login-php file ",'gotmls').' '.$lt.'a target="_blank" href="'.GOTMLS_plugin_home.'tag/wp-login-php/"'.$gt.__("read my blog",'gotmls')."$lt/a$gt.$lt/div$gt$lt/form$gt\n$XMLRPC_patch_action\n$script";
$admin_notice = "";
if ($current_user->user_login == "admin") {
$admin_notice .= $lt.'hr /'.$gt;
if ($GOTMLS_nonce_found && isset($_POST["GOTMLS_admin_username"]) && ($current_user->user_login != trim($_POST["GOTMLS_admin_username"])) && strlen(trim($_POST["GOTMLS_admin_username"])) && preg_match('/^\s*[a-z_0-9\@\.\-]{3,}\s*$/i', $_POST["GOTMLS_admin_username"])) {
if ($wpdb->update($wpdb->users, array("user_login" => trim($_POST["GOTMLS_admin_username"])), array("user_login" => $current_user->user_login))) {
$wpdb->query($wpdb->prepare("UPDATE `{$wpdb->prefix}sitemeta` SET `meta_value` = REPLACE(`meta_value`, 's:5:\"admin\";', %s) WHERE `meta_key` = 'site_admins' AND `meta_value` like %s", 's:'.strlen(trim($_POST["GOTMLS_admin_username"])).':"'.trim($_POST["GOTMLS_admin_username"]).'";', '%s:5:"admin";%'));
$admin_notice .= GOTMLS_error_div(sprintf(__("You username has been change to %s. Don't forget to use your new username when you login again.",'gotmls'), $_POST["GOTMLS_admin_username"]), "updated");
} else
$admin_notice .= GOTMLS_error_div(sprintf(__("SQL Error changing username: %s. Please try again later.",'gotmls'), $wpdb->last_error));
} else {
if (isset($_POST["GOTMLS_admin_username"]))
$admin_notice .= GOTMLS_error_div(sprintf(__("Your new username must be at least 3 characters and can only contain "%s". Please try again.",'gotmls'), "a-z0-9_.-@"), "updated");
$admin_notice .= $lt.'form method="POST" name="GOTMLS_Form_admin"'.$gt.$lt.'div style="float: right;"'.$gt.$lt.'div style="float: left;"'.$gt.__("Change your username:",'gotmls').$lt.'/div'.$gt.$Firewall_nonce.$lt.'input style="float: left;" type="text" id="GOTMLS_admin_username" name="GOTMLS_admin_username" size="6" value="'.$current_user->user_login.'"'.$gt.$lt.'input style="float: left;" type="submit" value="Change"'.$gt.$lt.'/div'.$gt.$lt.'div style="padding: 0 30px;"'.$gt.$lt.'p'.$gt.$lt.'img src="'.GOTMLS_images_path.'threat.gif"'.$gt.$lt.'b'.$gt.'Admin Notice'.$lt.'/b'.$gt.$lt.'/p'.$gt.__("Your username is \"admin\", this is the most commonly guessed username by hackers and brute-force scripts. It is highly recommended that you change your username immediately.",'gotmls').$lt.'/div'.$gt.$lt.'/form'.$gt;
}
}
if ($GOTMLS_nonce_found && isset($_POST["GOTMLS_wpfirewall_action"])) {
if ($_POST["GOTMLS_wpfirewall_action"] == "exclude_terms")
update_option("WP_firewall_exclude_terms", "");
elseif ($_POST["GOTMLS_wpfirewall_action"] == "whitelisted_ip") {
$ips = GOTMLS_uckserialize(get_option("WP_firewall_whitelisted_ip", "not Array!"));
if (is_array($ips))
$ips = array_merge($ips, array(GOTMLS_safe_ip($_SERVER["REMOTE_ADDR"])));
else
$ips = array(GOTMLS_safe_ip($_SERVER["REMOTE_ADDR"]));
update_option("WP_firewall_whitelisted_ip", serialize($ips));
}
}
if (get_option("WP_firewall_exclude_terms", "Not Found!") == "allow") {
$end = "$lt/div$gt$lt/form$gt\n{$lt}hr /$gt";
$img = 'threat.gif"';
$button = $lt.'input type="submit" onclick="document.getElementById(\'GOTMLS_wpfirewall_action\').value=\'exclude_terms\';" value="'.__("Disable this Rule",'gotmls').'"'.$gt;
$wpfirewall_action = $lt.'form method="POST" name="GOTMLS_Form_wpfirewall2"'.$gt.$lt.'div style="float: right;"'.$gt.$lt.'input type="hidden" name="GOTMLS_wpfirewall_action" id="GOTMLS_wpfirewall_action" value=""'.$gt.$Firewall_nonce.$button.$lt.'/div'.$gt.$lt.'div style="padding: 0 30px;"'.$gt.$lt.'p'.$gt.$lt.'img src="'.GOTMLS_images_path.$img.$gt.$lt.'b'.$gt."WP Firewall 2 (Conflicting Firewall Rule)$lt/b$gt$lt/p$gt".__("The Conflicting Firewall Rule (WP_firewall_exclude_terms) activated by the WP Firewall 2 plugin has been shown to interfere with the Definition Updates and WP Core File Scans in my Anti-Malware plugin. I recommend that you disable this rule in the WP Firewall 2 plugin.",'gotmls').$end;
if (isset($_SERVER["REMOTE_ADDR"])) {
if (is_array($ips = GOTMLS_uckserialize(get_option("WP_firewall_whitelisted_ip", "not Array!"))) && in_array($_SERVER["REMOTE_ADDR"], $ips))
$wpfirewall_action = str_replace(array($img, $end), array('question.gif"', __(" However, your current IP has been Whitelisted so you could probably keep this rule enabled if you really want to.",'gotmls').$end), $wpfirewall_action);
else
$wpfirewall_action = str_replace(array($button, $end), array($button.$lt."br /$gt$lt".'input type="submit" onclick="document.getElementById(\'GOTMLS_wpfirewall_action\').value=\'whitelisted_ip\';" value="'.__("Whitelist your IP",'gotmls').'"'.$gt, __(" However, if you would like to keep this rule enabled you should at least Whitelist your IP.",'gotmls').$end), $wpfirewall_action);
}
$sec_opts = $wpfirewall_action.$sec_opts;
}
echo GOTMLS_box(__("Firewall Options",'gotmls'), $save_action.$sec_opts.$admin_notice)."\n
";
}
function GOTMLS_get_registrant($you) {
global $current_user, $wpdb;
wp_get_current_user();
if (isset($you["you"]))
$you = $you["you"];
if (isset($you["user_email"]) && strlen($you["user_email"]) == 32) {
if ($you["user_email"] == md5($current_user->user_email))
$registrant = $current_user->user_email;
elseif (!($registrant = $wpdb->get_var($wpdb->prepare("SELECT `user_nicename` FROM `$wpdb->users` WHERE MD5(`user_email`) = %s", $you["user_email"]))))
$registrant = GOTMLS_siteurl;
} else
$registrant = GOTMLS_siteurl;
return $registrant;
}
function GOTMLS_ajax_load_update() {
global $wpdb;
$GOTMLS_nonce_found = GOTMLS_get_nonce();
$YES_user_can = GOTMLS_user_can();
$GOTMLS_definitions_versions = array();
$user_info = array();
$saved = false;
$moreJS = "";
$finJS = "\n}";
$form = 'registerKeyForm';
$innerHTML = "
Your Installation Key could not be confirmed!
";
$autoUpJS = 'This new feature is currently only available to registered users who have donated $29 or more. ';
if (is_array($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]))
foreach ($GLOBALS["GOTMLS"]["tmp"]["definitions_array"] as $threat_level=>$definition_names)
foreach ($definition_names as $definition_name=>$definition_version)
if (is_array($definition_version) && isset($definition_version[0]) && strlen($definition_version[0]) == 5)
if (!isset($GOTMLS_definitions_versions[$threat_level]) || $definition_version[0] > $GOTMLS_definitions_versions[$threat_level])
$GOTMLS_definitions_versions[$threat_level] = $definition_version[0];
asort($GOTMLS_definitions_versions);
if (isset($_REQUEST["UPDATE_definitions_array"]) && strlen($_REQUEST["UPDATE_definitions_array"]) && $GOTMLS_nonce_found && $YES_user_can) {
$DEF_url = 'http:'.GOTMLS_update_home.'definitions.php?'.GOTMLS_get_version_URL.'&'.GOTMLS_set_nonce(GOTMLS_update_home).'&d='.ur1encode(GOTMLS_siteurl);
if (isset($_REQUEST["dt"]) && strlen($_REQUEST["dt"]))
$DEF_url .= '&dt='.preg_replace('/[^\w]/', "", $_REQUEST["dt"]);
if (strlen($_REQUEST["UPDATE_definitions_array"]) > 1) {
$GOTnew_definitions = GOTMLS_uckserialize(GOTMLS_decode($_REQUEST["UPDATE_definitions_array"]));
if (is_array($GOTnew_definitions)) {
$form = 'autoUpdateDownload';
$GLOBALS["GOTMLS"]["tmp"]["onLoad"] .= "updates_complete('Downloaded Definitions');";
}
} elseif ($_REQUEST["UPDATE_definitions_array"] == "D") {
$GLOBALS["GOTMLS"]["tmp"]["definitions_array"] = array();
$GOTnew_definitions = array();
delete_option('GOTMLS_get_URL_array');
} elseif (($DEF = GOTMLS_get_URL($DEF_url)) && is_array($GOTnew_definitions = GOTMLS_uckserialize(GOTMLS_decode($DEF))) && count($GOTnew_definitions)) {
if (isset($GOTnew_definitions["you"]["user_email"]) && strlen($GOTnew_definitions["you"]["user_email"]) == 32) {
$toInfo = GOTMLS_get_registrant($GOTnew_definitions["you"]);
$innerHTML = "
Your Installation Key is Registered to: $toInfo
";
$form = 'autoUpdateForm';
if (isset($GOTnew_definitions["you"]["user_donations"]) && isset($GOTnew_definitions["you"]["user_donation_total"]) && isset($GOTnew_definitions["you"]["user_donation_freshness"])) {
$user_donations_src = $GOTnew_definitions["you"]["user_donations"];
if ($GOTnew_definitions["you"]["user_donation_total"] > 27.99) {
$autoUpJS = 'Yes | No ';
$moreJS = 'if (foundUpdates = document.getElementById("check_wp_core_div_NA"))
foundUpdates.innerHTML = "Set Definition Updates to Automatically Download to activate this feature.";';
}
if ($user_donations_src > 0 && $GOTnew_definitions["you"]["user_donation_total"] > 0)
$li = "
You have made $user_donations_src donation".($user_donations_src?'s totalling':' for').' $'.$GOTnew_definitions["you"]["user_donation_total"].".
';\n/*{$lt}!--*"."/";
}
$li_js = "";
if ($MAX > 11)
$fix_button_js = "";
}
$ScanSettings = $lt.'div style="float: right;"'.$gt.GOTMLS_Run_Quick_Scan_LANGUAGE.": $QuickScan$lt/div$gt".GOTMLS_Scan_Settings_LANGUAGE;
echo "/*--{$gt}*".'/
document.getElementById("status_counts").innerHTML = divHTML+"'.$lt.'/ul'.$gt.'";
document.getElementById("fix_button").style.display = dis;
}
'.$vars.';
function showOnly(what) {
document.getElementById("only_what").innerHTML = document.getElementById("only"+what).innerHTML;
}
var startTime = 0;
'.$lt.'/script'.$gt.GOTMLS_box($ScanSettings, $scan_opts);
$Settings_Saved = "\n{$lt}div onclick=\"this.style.display='none';\" style='position: relative; top: -50px; margin: 0 300px 0 130px;' class='updated'$gt\nSettings Saved!$lt/div$gt\n";//script type='text/javascript'$gt\nalert('Settings Saved!');\n$lt/script$gt\n";
if (isset($_REQUEST["scan_type"]) && $_REQUEST["scan_type"] == "Save") {
if ($GOTMLS_nonce_found) {
update_option('GOTMLS_settings_array', $GLOBALS["GOTMLS"]["tmp"]["settings_array"]);
echo $Settings_Saved;
} else
echo GOTMLS_box(GOTMLS_Invalid_Nonce(""), __("Saving these settings requires a valid Nonce Token. No valid Nonce Token was found at this time, either because the token have expired or because the data was invalid. Please try re-submitting the form above.",'gotmls')."\n{$lt}script type='text/javascript'$gt\nalert('".GOTMLS_Invalid_Nonce("")."');\n$lt/script$gt\n");
echo GOTMLS_box(__("Scan History",'gotmls'), GOTMLS_get_scan_history());
} elseif (isset($_REQUEST["scan_what"]) && is_numeric($_REQUEST["scan_what"]) && ($_REQUEST["scan_what"] > -1)) {
if ($GOTMLS_nonce_found) {
update_option('GOTMLS_settings_array', $GLOBALS["GOTMLS"]["tmp"]["settings_array"]);
$GLOBALS["GOTMLS"]["scan"]["log"]["settings"]["check"] = array();
GOTMLS_update_scanlog(array("settings" => $GLOBALS["GOTMLS"]["tmp"]["settings_array"]));
$cleadCache = false;
if (function_exists('is_plugin_active')) {
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
$cleadCache = true;
}
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
$cleadCache = true;
}
if (class_exists('WpFastestCache')) {
$newCache = new WpFastestCache();
$newCache->deleteCache();
$cleadCache = true;
}
}
if ($cleadCache)
str_replace("Settings Saved!", "Cache Cleared and Settings Saved!", $Settings_Saved);
echo $Settings_Saved;
if (!isset($_REQUEST["scan_type"]))
$_REQUEST["scan_type"] = "Complete Scan";
elseif ($_REQUEST["scan_type"] == "Quick Scan") {
$li_js = "\nfunction testComplete() {\n\tif (percent != 100)\n\t\talert('".__("The Quick Scan was unable to finish because of a shortage of memory or a problem accessing a file. Please try using the Complete Scan, it is slower but it will handle these errors better and continue scanning the rest of the files.",'gotmls')."');\n}\nwindow.onload=testComplete;\n$lt/script$gt\n$lt".'script type="text/javascript"'.$gt;
$GLOBALS["GOTMLS"]["log"]["settings"]["check"] = array();
foreach ($GLOBALS["GOTMLS"]["tmp"]["threat_levels"] as $check)
if ($check != "potential")
$GLOBALS["GOTMLS"]["scan"]["log"]["settings"]["check"][] = $check;
}
$_SERVER_QUERY_STRING = "?";
foreach ($_GET as $name => $value) {
if (substr($name, 0, 10) != 'GOTMLS_fix' && $name != 'GOTMLS_mt') {
if (is_array($value)) {
foreach ($value as $val)
$_SERVER_QUERY_STRING .= rawurlencode($name).'[]='.rawurlencode($val).'&';
} else
$_SERVER_QUERY_STRING .= rawurlencode($name).'='.rawurlencode($value).'&';
}
}
echo "\n$lt".'form method="POST" action="'.admin_url("admin-ajax.php$_SERVER_QUERY_STRING").'" target="GOTMLS_iFrame" name="GOTMLS_Form_clean" id="GOTMLS_Form_clean"'.$gt.$lt.'input type="hidden" name="'.str_replace('=', '" value="', $GOTMLS_nonce_URL).'"'.$gt.$lt.'input type="hidden" name="action" value="GOTMLS_fix"'.$gt.$lt.'input type="hidden" id="GOTMLS_fixing" name="GOTMLS_fixing" value="1"'.$gt;
foreach ($_POST as $name => $value) {
if (substr($name, 0, 10) != 'GOTMLS_fix' && $name != 'GOTMLS_mt') {
if (is_array($value)) {
foreach ($value as $val)
echo $lt.'input type="hidden" name="'.GOTMLS_htmlspecialchars($name).'[]" value="'.GOTMLS_htmlspecialchars($val).'"'.$gt;
} else
echo $lt.'input type="hidden" name="'.GOTMLS_htmlspecialchars($name).'" value="'.GOTMLS_htmlspecialchars($value).'"'.$gt;
}
}
echo "\n$lt".'script type="text/javascript"'.$gt.'showhide("inside_'.md5($ScanSettings).'");'.$lt.'/script'.$gt.GOTMLS_box(GOTMLS_htmlspecialchars($_REQUEST["scan_type"]).' Status', $lt.'div id="status_text"'.$gt.$lt.'img src="'.GOTMLS_images_path.'wait.gif" height=16 width=16 alt="..."'.$gt.' '.GOTMLS_Loading_LANGUAGE.$lt.'/div'.$gt.$lt.'div id="status_bar"'.$gt.$lt.'/div'.$gt.$lt.'p id="pause_button" style="display: none; position: absolute; left: 0; text-align: center; margin-left: -30px; padding-left: 50%;"'.$gt.$lt.'input type="button" value="Pause" class="button-primary" onclick="pauseresume(this);" id="resume_button" /'.$gt.$lt.'/p'.$gt.$lt.'div id="status_counts"'.$gt.$lt.'/div'.$gt.$lt.'p id="fix_button" style="display: none; text-align: center;"'.$gt.$lt.'input id="repair_button" type="submit" value="'.GOTMLS_Automatically_Fix_LANGUAGE.'" class="button-primary" onclick="loadIframe(\'Examine Results\');" /'.$gt.$lt.'/p'.$gt);
$scan_groups_UL = "";
foreach ($scan_groups as $scan_name => $scan_group)
$scan_groups_UL .= "\n{$lt}ul name=\"found_$scan_group\" id=\"found_$scan_group\" class=\"GOTMLS_plugin $scan_group\" style=\"background-color: #ccc; display: none; padding: 0;\"$gt{$lt}a class=\"rounded-corners\" name=\"link_$scan_group\" style=\"float: right; padding: 0 4px; margin: 5px 5px 0 30px; line-height: 16px; text-decoration: none; color: #C00; background-color: #FCC; border: solid #F00 1px;\" href=\"#found_top\" onclick=\"showhide('found_$scan_group');\"{$gt}X$lt/a$gt{$lt}h3$gt$scan_name$lt/h3$gt\n".($scan_group=='potential'?$lt.'p'.$gt.' * '.__("NOTE: These are probably not malicious scripts (but it's a good place to start looking IF your site is infected and no Known Threats were found).",'gotmls').$lt.'/p'.$gt:($scan_group=='wp_core'?$lt.'p'.$gt.' * '.sprintf(__("NOTE: We have detected changes to the WordPress Core files on your site. This could be an intentional modification or the malicious work of a hacker. We can restore these files to their original state to preserve the integrity of your original WordPress %s installation.",'gotmls'), GOTMLS_wp_version).' (for more info '.$lt.'a target="_blank" href="'.GOTMLS_plugin_home.'tag/wp-core-files/"'.$gt.__("read my blog",'gotmls').$lt.'/a'.$gt.').'.$lt.'/p'.$gt:$lt.'br /'.$gt)).$lt.'/ul'.$gt;
if (!($dir = implode(GOTMLS_slash(), array_slice($dirs, 0, -1 * (2 + (INT) $_REQUEST["scan_what"])))))
$dir = "/";
$scanlog = array("dir" => $dir, "start" => time(), "type" => GOTMLS_sanitize($_REQUEST["scan_type"]));
if (isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check"]) && is_array($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check"]) && count($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check"]) == 1 && ($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check"][0] = "db_scan"))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"] = 0;
$scanlog["settings"] = $GLOBALS["GOTMLS"]["tmp"]["settings_array"];
if (isset($_REQUEST['scan_only']))
$scanlog['scan_only'] = $_REQUEST['scan_only'];
GOTMLS_update_scanlog(array("scan" => $scanlog));
echo GOTMLS_box($lt.'div id="GOTMLS_scan_dir" style="float: right;"'.$gt.' ('.(isset($GLOBALS["GOTMLS"]["scan"]["log"]["scan"]["dir"]) ? $GLOBALS["GOTMLS"]["scan"]["log"]["scan"]["dir"] : "Unknown path").") $lt/div$gt".__("Scan Details:",'gotmls'), $scan_groups_UL);
$no_flush_LANGUAGE = __("Not flushing OB Handlers: %s",'gotmls');
if (isset($_REQUEST["no_ob_end_flush"]))
echo GOTMLS_error_div(sprintf($no_flush_LANGUAGE, GOTMLS_htmlspecialchars(print_r(ob_list_handlers(), 1))));
elseif (is_array($OB_handlers) && count($OB_handlers)) {
// $GOTMLS_OB_handlers = get_option("GOTMLS_OB_handlers", array());
foreach (array_reverse($OB_handlers) as $OB_handler) {
if (isset($GOTMLS_OB_handlers[$OB_handler]) && $GOTMLS_OB_handlers[$OB_handler] == "no_end_flush")
echo GOTMLS_error_div(sprintf($no_flush_LANGUAGE, GOTMLS_htmlspecialchars($OB_handler)));
elseif (in_array($OB_handler, $OB_default_handlers)) {
// $GOTMLS_OB_handlers[$OB_handler] = "no_end_flush";
// update_option("GOTMLS_OB_handlers", $GOTMLS_OB_handlers);
@ob_end_flush();
// $GOTMLS_OB_handlers[$OB_handler] = "ob_end_flush";
// update_option("GOTMLS_OB_handlers", $GOTMLS_OB_handlers);
}
}
}
@ob_start();
echo "\n{$lt}script type=\"text/javascript\"$gt$li_js\n/*{$lt}!--*"."/";
if (!(isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"])) {
echo GOTMLS_return_threat("dirs", "wait", $dir).GOTMLS_update_status(sprintf(__("Preparing %s",'gotmls'), GOTMLS_replace_dirname($dir)), 0);//GOTMLS_return_threat("skipdirs", "blocked", $dir, GOTMLS_error_link("Directory Scan Depth set to 0, no files will be scanned!"));
$GLOBALS["GOTMLS"]["tmp"]["scanfiles"][GOTMLS_encode($dir)] = GOTMLS_strip4java(GOTMLS_replace_dirname($dir));
} elseif (is_dir($dir)) {
$GOTMLS_dirs_at_depth[0] = 1;
$GOTMLS_dir_at_depth[0] = 0;
if (isset($_REQUEST['scan_only']) && is_array($_REQUEST['scan_only'])) {
$GOTMLS_dirs_at_depth[0] += (count($_REQUEST['scan_only']) - 1);
foreach ($_REQUEST['scan_only'] as $only_dir)
if (is_dir(GOTMLS_trailingslashit($dir).$only_dir))
GOTMLS_readdir(GOTMLS_trailingslashit($dir).$only_dir);
} else
GOTMLS_readdir($dir);
} else
echo GOTMLS_return_threat("errors", "blocked", $dir, GOTMLS_error_link("Not a valid directory!"));
if ($_REQUEST["scan_type"] == "Quick Scan")
echo GOTMLS_update_status(__("Completed!",'gotmls'), 100);
else {
echo GOTMLS_update_status(__("Starting Scan ...",'gotmls'));
$DB_scan_JS = ", 'db_scan'";
if (isset($GLOBALS["GOTMLS"]["scan"]["log"]["settings"]["check"]) && is_array($GLOBALS["GOTMLS"]["scan"]["log"]["settings"]["check"]) && in_array("db_scan", $GLOBALS["GOTMLS"]["scan"]["log"]["settings"]["check"]))
echo GOTMLS_return_threat("dirs", "wait", "db_scan");//.GOTMLS_update_status(__("Starting Database Scan ...",'gotmls'));
//else $DB_scan_JS = "";
GOTMLS_flush('script');
echo "/*--{$gt}*"."/\nvar scriptSRC = '".GOTMLS_admin_url('GOTMLS_scan', $GOTMLS_nonce_URL.'&mt='.$GLOBALS["GOTMLS"]["tmp"]["mt"].'&GOTMLS_scan=')."';\nvar scanfilesArKeys = new Array('".implode("','", array_keys($GLOBALS["GOTMLS"]["tmp"]["scanfiles"]))."'$DB_scan_JS);\nvar scanfilesArNames = new Array('Scanning ".implode("','Scanning ", $GLOBALS["GOTMLS"]["tmp"]["scanfiles"])."'".str_replace("db_scan", "Starting Database Scan ...", $DB_scan_JS).");".'
var scanfilesI = 0;
var stopScanning;
var gotStuckOn = -1;
function scanNextDir(gotStuck) {
clearTimeout(stopScanning);
if (gotStuck > -1) {
gotStuck = gotStuckOn;
if (scanfilesArNames[gotStuck].substr(0, 3) != "Re-" && scanfilesArNames[gotStuck].substr(0, 10) != "Got Stuck ") {
if (scanfilesArNames[gotStuck].substr(0, 9) == "Checking ") {
scanfilesArNames.push(scanfilesArNames[gotStuck]);
scanfilesArKeys.push(scanfilesArKeys[gotStuck]+"&GOTMLS_skip_file[]="+encodeURIComponent(scanfilesArNames[gotStuck].substr(9)));
} else {
scanfilesArNames.push("Re-"+scanfilesArNames[gotStuck]);
scanfilesArKeys.push(scanfilesArKeys[gotStuck]+"&GOTMLS_only_file=");
}
} else {
var uri = scanfilesArKeys[gotStuck].split("&limit=", 2);
var skipdir = (scanfilesArKeys[gotStuck]+"&").split("&",2);
if (uri.length == 2) {
var lim = (uri[1]+"&").split("&", 2);
if (isNaN(lim[0]))
lim[0] = 1024;
else
lim[0] = Math.round(lim[0]/2);
scanfilesArKeys.push(uri[0]+"&limit="+lim[0]+"&"+lim[1]+"&GOTMLS_skip_dir="+skipdir[0]);
} else {
var lim = ["2048"];
scanfilesArKeys.push(scanfilesArKeys[gotStuck]+"&limit=2048&GOTMLS_skip_dir="+skipdir[0]);
}
scanfilesArNames.push("Got Stuck ("+lim[0]+") "+scanfilesArNames[gotStuck]);
}
}
if (document.getElementById("resume_button").value != "Pause") {
stopScanning=setTimeout(function() {scanNextDir(-1);}, 1000);
startTime++;
} else if (scanfilesI < scanfilesArKeys.length) {
document.getElementById("status_text").innerHTML = scanfilesArNames[scanfilesI];
var newscript = document.createElement("script");
newscript.setAttribute("src", scriptSRC+scanfilesArKeys[scanfilesI]);
divx = document.getElementById("found_scanned");
if (divx)
divx.appendChild(newscript);
gotStuckOn = scanfilesI++;
stopScanning=setTimeout(function() {scanNextDir(0);}, '.$GLOBALS["GOTMLS"]["tmp"]['execution_time'].'000);
}
}
startTime = ('.ceil(time()-$GLOBALS["GOTMLS"]["scan"]["log"]["scan"]["start"]).'+3);
stopScanning=setTimeout(function() {scanNextDir(-1);}, 3000);
function pauseresume(butt) {
if (butt.value == "Resume")
butt.value = "Pause";
else
butt.value = "Resume";
}
showhide("pause_button", true);'."\n/*{$lt}!--*"."/";
}
if (@ob_get_level()) {
GOTMLS_flush('script');
@ob_end_flush();
}
echo "/*--{$gt}*"."/\n$lt/script$gt$lt/form$gt";
} else
echo GOTMLS_box(GOTMLS_Invalid_Nonce(""), __("Starting a Complete Scan requires a valid Nonce Token. No valid Nonce Token was found at this time, either because the token have expired or because the data was invalid. Please try re-submitting the form above.",'gotmls')."\n{$lt}script type='text/javascript'$gt\nalert('".GOTMLS_Invalid_Nonce("")."');\n$lt/script$gt\n");
} else
echo GOTMLS_box(__("Scan History",'gotmls'), GOTMLS_get_scan_history());
echo "\n$lt/div$gt$lt/div$gt$lt/div$gt";
}
function GOTMLS_login_error($elementId, $ERROR, $alert_txt = "") {
$js = "\nif (GOTMLS_field = document.getElementById('$elementId'))\n\tGOTMLS_field.innerHTML = '
".GOTMLS_strip4java($ERROR)."
';";
return $js;
}
function GOTMLS_print_login_form($ops = array()) {
if (!is_array($ops))
$ops = array();
echo GOTMLS_login_form($ops);
}
if (defined("GOTMLS_SESSION_TIME") && is_numeric(GOTMLS_SESSION_TIME)) {
add_action("login_form", "GOTMLS_print_login_form");
}
function GOTMLS_login_form($ops = array(), $form_id = "", $shortcode = "") {
$gt = ">"; // This local variable never changes
$lt = "<"; // This local variable never changes
$up = "";
foreach (array("form_id" => "loginform", "top" => "-200px", "height" => "280px", "u" => "log", "p" => "pwd") as $field => $default) {
if (!(isset($ops["$field"]) && preg_match('/^[\w\-]++$/', $ops["$field"]) && strlen($ops["$field"]) < 50))
$ops["$field"] = $default;
if (strlen($field == 1))
$up .= "&GOTMLS_$field=".rawurlencode($ops["$field"]);
}
if (!(isset($GLOBALS["GOTMLS"]["tmp"]["loginform_id"]) && $GLOBALS["GOTMLS"]["tmp"]["loginform_id"]))
$GLOBALS["GOTMLS"]["tmp"]["loginform_id"] = 0;
$form_id = ++$GLOBALS["GOTMLS"]["tmp"]["loginform_id"];
$loading_bits = '" id="loading_BRUTEFORCE_'.$form_id.'"'.$gt.$lt.'div style="top: '.$ops["top"].'; position: relative; background-color: #FFF; z-index: 99999;"'.$gt.$lt.'img style="height: '.$ops["height"];
if (isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"]["BFLP"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["firewall"]["BFLP"]) {
$loading_bits = ' z-index: 9999; opacity: 0; top: 0; left: 0; width: 100%; height: 100%;'.$loading_bits;
$other = " display: none;";
} else
$other = "";
if (defined("GOTMLS_LOGIN_PROTECTION") && preg_match('/^[\da-f]{32}$/i', GOTMLS_LOGIN_PROTECTION)) {
$ajaxURL = GOTMLS_admin_url("GOTMLS_logintime", GOTMLS_set_nonce($sess = GOTMLS_LOGIN_PROTECTION, GOTMLS_REMOTEADDR)."$up&GOTMLS_sess=$sess&GOTMLS_form_id=$form_id&GOTMLS_time=");
return "$lt!-- Loading GOTMLS Brute-Force Protection --$gt$lt".'div style="position: absolute;'.$loading_bits.';" alt="Loading Brute-Force Protection ..." src="'.GOTMLS_images_path."GOTMLS-Loading.gif\" /$gt{$lt}div id='checking_BRUTEFORCE_$form_id'$gt Checking for JavaScript ... $lt/div$gt$lt/div$gt$lt/div$gt\n$lt".'div style="text-align: center;'."$other\"$gt$lt".'img style="height: 32px; vertical-align: middle;" alt="Brute-Force Protection from GOTMLS. NET" src="'.GOTMLS_images_path."GOTMLS-Loading.gif\" /$gt Brute-Force Protection is Active$lt/div$gt$lt".'input type="hidden" name="GOTMLS_sess" id="GOTMLS_sess_id_'.$form_id.'" value="'."$sess\" /$gt$lt".'input type="hidden" id="GOTMLS_offset_id_'.$form_id.'" value="0" name="GOTMLS_time" /'.$gt.$lt.'script type="text/javascript"'."$gt\nfunction GOTMLS_chk_session_$form_id() {\nvar GOTMLS_login_offset = new Date();\nvar GOTMLS_login_script = document.createElement('script');\nGOTMLS_login_script.src = '$ajaxURL'+GOTMLS_login_offset.getTime();\nif (GOTMLS_field = document.getElementById('GOTMLS_offset_id_$form_id')) {\n\tGOTMLS_field.value = GOTMLS_login_offset.getTime();\n}".GOTMLS_login_error("checking_BRUTEFORCE_$form_id", ' Checking for Session ... ')."\nif (GOTMLS_loading_gif = document.getElementById('loading_BRUTEFORCE_$form_id')) GOTMLS_loading_gif.style.display = 'block';\ndocument.head.appendChild(GOTMLS_login_script);\n}\nGOTMLS_chk_session_$form_id();\nsetInterval(function (){GOTMLS_chk_session_$form_id();}, 150000);\n$lt/script$gt\n";
} else
return "$lt!-- GOTMLS Brute-Force Protection is Disabled in the Firewall Options --$gt";
}
add_shortcode("gotmls-brute-force-protection", "GOTMLS_login_form");
function GOTMLS_ihc_login_form($ops = array()) {
$gt = ">"; // This local variable never changes
$lt = "<"; // This local variable never changes
$return = "$lt!-- ihc_login_form: Indeed Ultimate Membership Pro is not installed --$gt";
$form_end = "$lt/form$gt";
if (function_exists("ihc_login_form")) {
if (strpos($return = ihc_login_form($ops), $form_end))
$return = str_replace($form_end, GOTMLS_login_form(array("form_id" => "ihc_login_form", "top" => "-280px")).$form_end, $return);
else
$return .= "\n$lt!-- ihc_login_form: form_end not found --$gt";
}
return "\n$lt!-- ihc_login_form: GOTMLS Brute-Force Protection integration with indeed-membership-pro --$gt$return";
}
function GOTMLS_ajax_logintime() {
if (headers_sent($filename, $linenum))
$error_txt = sprintf("//Headers already sent in %s on line %s.\n", $filename, $linenum);
else
$error_txt = __("Please refresh the page before attempting to login.", 'gotmls');
@header("Content-type: text/javascript");
if (!defined("GOTMLS_FORMID"))
define("GOTMLS_FORMID", (isset($_GET["GOTMLS_form_id"])&&is_numeric($_GET["GOTMLS_form_id"]))?(INT) $_GET["GOTMLS_form_id"]:0);
$form_id = GOTMLS_FORMID;
if (defined("GOTMLS_SESS_ERROR"))
die(GOTMLS_login_error("checking_BRUTEFORCE_$form_id", GOTMLS_SESS_ERROR, $error_txt));
elseif (defined("GOTMLS_LOGIN_PROTECTION") && preg_match('/^[\da-f]{32}$/i', GOTMLS_LOGIN_PROTECTION) && defined("GOTMLS_SESSION_TIME") && is_numeric(GOTMLS_SESSION_TIME) && defined("GOTMLS_logintime_JS") && defined("GOTMLS_SESS")) {
if (GOTMLS_get_nonce(substr(GOTMLS_SESS, 0, 32), GOTMLS_REMOTEADDR))
die(GOTMLS_logintime_JS);
else
die(GOTMLS_login_error("checking_BRUTEFORCE_$form_id", GOTMLS_Invalid_Nonce("//DEBUG: $form_id "), $error_txt));
} else
die(GOTMLS_login_error("checking_BRUTEFORCE_$form_id", 'Login Session Not Started!', $error_txt));
}
function GOTMLS_ajax_lognewkey() {
@header("Content-type: text/javascript");
if (isset($GLOBALS["GOTMLS"]["tmp"]["HeadersError"]) && $GLOBALS["GOTMLS"]["tmp"]["HeadersError"])
echo "\n//Header Error: ".GOTMLS_strip4java(GOTMLS_htmlspecialchars($GLOBALS["GOTMLS"]["tmp"]["HeadersError"]));
if (GOTMLS_get_nonce()) {
if (isset($_POST["GOTMLS_installation_key"]) && ($_POST["GOTMLS_installation_key"] == GOTMLS_installation_key)) {
$keys = GOTMLS_uckserialize(get_option('GOTMLS_Installation_Keys', array()));
if (is_array($keys)) {
$count = count($keys);
if (!isset($keys[GOTMLS_installation_key]))
$keys = array_merge($keys, array(GOTMLS_installation_key => GOTMLS_siteurl));
} else
$keys = array(GOTMLS_installation_key => GOTMLS_siteurl);
update_option("GOTMLS_Installation_Keys", serialize($keys));
die("\n//$count~".count($keys));
} else
die("\n//0");
} else
die(GOTMLS_Invalid_Nonce("\n//Log New Key Error: ")."\n");
}
function GOTMLS_ajax_log_session() {
$fail_msg = "/* GOTMLS SESSION FAIL */\nif('undefined' != typeof stopCheckingSession && stopCheckingSession)\n\tclearTimeout(stopCheckingSession);\ndocument.getElementById('GOTMLS_patch_searching').innerHTML = '
".GOTMLS_strip4java(__("Your Server could not start a Session!",'gotmls'));
if (headers_sent($filename, $linenum)) {
if (!$filename)
$filename = __("an unknown file",'gotmls');
if (!is_numeric($linenum))
$linenum = __("unknown",'gotmls');
$fail_msg .= sprintf(__('Headers already sent in %1$s on line %2$s.','gotmls'), $filename, $linenum);
die($fail_msg."
';");
}
if (is_file(GOTMLS_plugin_path."safe-load/session.php"))
require_once(GOTMLS_plugin_path."safe-load/session.php");
GOTMLS_session_start();
if (!($sess_id = session_id()))
session_start();
header("Content-type: text/javascript");
if (isset($_SESSION["GOTMLS_SESSION_TEST"]))
die("/* GOTMLS SESSION PASS */\nif('undefined' != typeof stopCheckingSession && stopCheckingSession)\n\tclearTimeout(stopCheckingSession);\nshowhide('GOTMLS_patch_searching', true);\nif (autoUpdateDownloadGIF = document.getElementById('autoUpdateDownload'))\n\tdonationAmount = autoUpdateDownloadGIF.src.replace(/^.+\?/,'');\nif ((autoUpdateDownloadGIF.src == donationAmount) || donationAmount=='0') {\n\tif (patch_searching_div = document.getElementById('GOTMLS_patch_searching')) {\n\t\tif (autoUpdateDownloadGIF.src == donationAmount)\n\t\t\tpatch_searching_div.innerHTML = '".GOTMLS_strip4java(__("You must register and donate to use this feature!",'gotmls'))."';\n\t\telse\n\t\t\tpatch_searching_div.innerHTML = '".GOTMLS_strip4java(__("This feature is available to those who have donated!",'gotmls'))."';\n\t}\n} else {\n\tshowhide('GOTMLS_patch_searching');\n\tshowhide('GOTMLS_patch_button', true);\n}\n");
else {
$_SESSION["GOTMLS_SESSION_TEST"] = 1;
if (isset($_GET["SESSION"]) && is_numeric($_GET["SESSION"]) && $_GET["SESSION"] > 0)
die($fail_msg."';");
else
die("/* GOTMLS SESSION TEST */\nif('undefined' != typeof stopCheckingSession && stopCheckingSession)\n\tclearTimeout(stopCheckingSession);\nstopCheckingSession = checkupdateserver('".GOTMLS_script_URI."&SESSION=1');");
}
}
function GOTMLS_set_plugin_action_links($links_array, $plugin_file) {
if ($plugin_file == substr(str_replace("\\", "/", __FILE__), (-1 * strlen($plugin_file))) && strlen($plugin_file) > 10)
$links_array = array_merge(array(''.GOTMLS_Scan_Settings_LANGUAGE.''), $links_array);
return $links_array;
}
add_filter("plugin_action_links", "GOTMLS_set_plugin_action_links", 1, 2);
function GOTMLS_set_plugin_row_meta($links_array, $plugin_file) {
if ($plugin_file == substr(str_replace("\\", "/", __FILE__), (-1 * strlen($plugin_file))) && strlen($plugin_file) > 10)
$links_array = array_merge($links_array, array('FAQ','Support','Donate'));
return $links_array;
}
add_filter("plugin_row_meta", "GOTMLS_set_plugin_row_meta", 1, 2);
function GOTMLS_in_plugin_update_message($args) {
$transient_name = 'GOTMLS_upgrade_notice_'.preg_replace('/[^0-9\.\_]/', "", $args["Version"].'_'.$args["new_version"]);
if ((false === ($upgrade_notice = get_transient($transient_name))) && ($ret = GOTMLS_get_URL("https://plugins.svn.wordpress.org/gotmls/trunk/readme.txt"))) {
$upgrade_notice = '';
if ($match = preg_split('/==\s*Upgrade Notice\s*==\s+/i', $ret)) {
if (preg_match('/\n+=\s*'.str_replace(".", "\\.", GOTMLS_Version).'\s*=\s+/is', $match[1]))
$notice = (array) preg_split('/\n+=\s*'.str_replace(".", "\\.", GOTMLS_Version).'\s*=\s+/is', $match[1]);
else
$notice = (array) preg_split('/\n+=/is', $match[1]."\n=");
if (preg_match_all('/=\s*([\.0-9]+)\s*=\s*([^=]+)/i', $notice[0], $matches, PREG_SET_ORDER)) {
foreach ($matches as $m)
$upgrade_notice .= GOTMLS_html_tags(array('br /' => array('span' => GOTMLS_html_tags(array('b' => esc_html($m[1]).':')).esc_html($m[2]))));
set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS);
}
}
}
echo wp_kses($upgrade_notice, array('br' => array(), 'span' => array(), 'b' => array()));
}
add_action("in_plugin_update_message-gotmls/index.php", "GOTMLS_in_plugin_update_message");
function GOTMLS_debug_hook($function) {
return "\n\n";
}
function GOTMLS_begin_wp_body_open() {
return GOTMLS_debug_hook(__FUNCTION__);
}
function GOTMLS_finish_wp_body_open() {
return GOTMLS_debug_hook(__FUNCTION__);
}
function GOTMLS_begin_wp_head() {
echo GOTMLS_debug_hook(__FUNCTION__);
}
function GOTMLS_finish_wp_head() {
echo GOTMLS_debug_hook(__FUNCTION__);
}
function GOTMLS_begin_wp_footer() {
echo GOTMLS_debug_hook(__FUNCTION__);
}
function GOTMLS_finish_wp_footer() {
echo GOTMLS_debug_hook(__FUNCTION__);
}
if (isset($_REQUEST["eli"]) && ($_REQUEST["eli"] == "debug")) {
foreach (array('wp_head', 'wp_body_open', 'wp_footer') as $wp_hook) {
if (function_exists("GOTMLS_begin_$wp_hook"))
add_action($wp_hook, "GOTMLS_begin_$wp_hook", 0);
if (function_exists("GOTMLS_finish_$wp_hook"))
add_action($wp_hook, "GOTMLS_finish_$wp_hook", 999999);
}
}
function GOTMLS_admin_init() {
GOTMLS_define("GOTMLS_get_version_URL", GOTMLS_get_version("URL"));
if (!isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_what"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_what"] = 2;
if (!isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"] = -1;
if (isset($_REQUEST["scan_type"]) && ($_REQUEST["scan_type"] == "Quick Scan")) {
if (!isset($_REQUEST["scan_what"])) $_REQUEST["scan_what"] = 2;
if (!isset($_REQUEST["scan_only"])) {
$_REQUEST["scan_only"] = array("","wp-includes","wp-admin");
$dirs = GOTMLS_explode_dir(__FILE__);
$dir = ABSPATH;//implode(GOTMLS_slash(), array_slice($dirs, 0, -2));
$files = GOTMLS_getfiles($dir);
$dirs = array();
if (isset($files) && is_array($files) && count($files))
foreach ($files as $file)
if (is_dir(GOTMLS_trailingslashit($dir).$file))
$dirs[] = GOTMLS_trailingslashit($dir).$file;
$GLOBALS["GOTMLS"]["tmp"]["skip_dirs"] = array_merge($dirs, $GLOBALS["GOTMLS"]["tmp"]["skip_dirs"]);
$_REQUEST["scan_depth"] = -1;
} elseif (!isset($_REQUEST["scan_depth"]))
$_REQUEST["scan_depth"] = 2;
if ($_REQUEST["scan_only"] && !is_array($_REQUEST["scan_only"]))
$_REQUEST["scan_only"] = array($_REQUEST["scan_only"]);
}
if (!isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check_custom"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check_custom"] = "";
if (isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"]) && is_numeric($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"]))
$scan_level = intval($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"]);
else
$scan_level = count(explode('/', trailingslashit(GOTMLS_siteurl))) - 1;
$ajax_functions = array('load_update', 'log_session', 'empty_trash', 'fix', 'logintime', 'lognewkey', 'position', 'scan', 'View_Quarantine', 'whitelist');
if (GOTMLS_get_nonce()) {
if (isset($_REQUEST["dont_check"]) && is_array($_REQUEST["dont_check"]) && count($_REQUEST["dont_check"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["dont_check"] = GOTMLS_sanitize($_REQUEST["dont_check"]);
elseif (isset($_POST["scan_type"]) || !(isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["dont_check"]) && is_array($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["dont_check"])))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["dont_check"] = array();
if (isset($_POST["scan_level"]) && is_numeric($_POST["scan_level"]))
$scan_level = intval($_POST["scan_level"]);
if (isset($scan_level) && is_numeric($scan_level))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"] = intval($scan_level);
}
foreach ($ajax_functions as $ajax_function) {
add_action("wp_ajax_GOTMLS_$ajax_function", "GOTMLS_ajax_$ajax_function");
add_action("wp_ajax_nopriv_GOTMLS_$ajax_function", substr($ajax_function, 0, 3) == "log"?"GOTMLS_ajax_$ajax_function":"GOTMLS_ajax_nopriv");
}
if (!isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"] = count(explode('/', trailingslashit(GOTMLS_siteurl))) - 1;
}
add_action("admin_init", "GOTMLS_admin_init");
function GOTMLS_init() {
load_plugin_textdomain('gotmls', false, basename(GOTMLS_plugin_path).'/languages');
if (defined("GOTMLS_SESSION_TIME") && is_numeric(GOTMLS_SESSION_TIME)) {
if (function_exists("ihc_login_form"))
add_shortcode("ihc-login-form", "GOTMLS_ihc_login_form");
if (function_exists("GOTMLS_print_up_login_form")) {
if (function_exists("wc_get_template"))
add_action("woocommerce_login_form", "GOTMLS_print_up_login_form");
if (function_exists("wpum_login_form"))
add_action("wpum_before_submit_button_login_form", "GOTMLS_print_up_login_form");
}
}
register_post_type(
'gotmls_quarantine',
array(
'labels' => array(
'name' => _x( 'Quarantine', 'post type general name' ),
'singular_name' => _x( 'Quarantine', 'post type singular name' ),
'view_item' => __( 'View Quarantine Record' ),
'all_items' => __( 'All Quarantine Records' ),
),
'public' => false,
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => false,
'query_var' => false,
'can_export' => false,
'delete_with_user' => false,
'supports' => array( 'title', 'author', 'editor', 'excerpt', 'custom-fields' ),
'capability_type' => 'customize_gotmls_quarantine',
'capabilities' => array(
'create_posts' => 'customize',
'delete_others_posts' => 'customize',
'delete_post' => 'customize',
'delete_posts' => 'customize',
'delete_private_posts' => 'customize',
'delete_published_posts' => 'do_not_allow',
'edit_others_posts' => 'do_not_allow',
'edit_post' => 'do_not_allow',
'edit_posts' => 'do_not_allow',
'edit_private_posts' => 'do_not_allow',
'edit_published_posts' => 'do_not_allow',
'publish_posts' => 'customize',
'read' => 'do_not_allow',
'read_post' => 'do_not_allow',
'read_private_posts' => 'customize',
),
)
);
register_post_type(
'gotmls_results',
array(
'labels' => array(
'name' => _x( 'Results', 'post type general name' ),
'singular_name' => _x( 'Result', 'post type singular name' ),
'view_item' => __( 'View Scan Results' ),
'all_items' => __( 'All Scans' ),
),
'public' => false,
'map_meta_cap' => true,
'hierarchical' => true,
'rewrite' => false,
'query_var' => false,
'can_export' => false,
'delete_with_user' => false,
'supports' => array( 'title', 'author', 'editor', 'excerpt', 'custom-fields' ),
'capability_type' => 'customize_gotmls_reults',
'capabilities' => array(
'create_posts' => 'customize',
'delete_others_posts' => 'customize',
'delete_post' => 'customize',
'delete_posts' => 'customize',
'delete_private_posts' => 'customize',
'delete_published_posts' => 'do_not_allow',
'edit_others_posts' => 'do_not_allow',
'edit_post' => 'do_not_allow',
'edit_posts' => 'do_not_allow',
'edit_private_posts' => 'do_not_allow',
'edit_published_posts' => 'do_not_allow',
'publish_posts' => 'customize',
'read' => 'do_not_allow',
'read_post' => 'do_not_allow',
'read_private_posts' => 'customize',
),
)
);
}
add_action("init", "GOTMLS_init");
function GOTMLS_ajax_position() {
if (GOTMLS_get_nonce(GOTMLS_position_msg)) {
$properties = array("body" => 'style="margin: 0; padding: 0;"');
if (isset($_GET["GOTMLS_msg"]) && $_GET["GOTMLS_msg"] == GOTMLS_position_msg) {
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"] = $GLOBALS["GOTMLS"]["tmp"]["default"]["msg_position"];
$gl = '><';
$properties["html"] = $gl.'head'.$gl.'script type="text/javascript">
if (curDiv = window.parent.document.getElementById("div_file")) {
curDiv.style.left = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][0].'";
curDiv.style.top = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][1].'";
curDiv.style.height = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][2].'";
curDiv.style.width = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][3].'";
}
array("body" => GOTMLS_htmlentities($_GET["GOTMLS_msg"]).' '.__("saved.",'gotmls').(implode($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"]) == implode($GLOBALS["GOTMLS"]["tmp"]["default"]["msg_position"])?"":' ['.GOTMLS_position_msg.']'))), $properties));
} else
die(GOTMLS_Invalid_Nonce("\n//Position Error: ")."\n");
}
function GOTMLS_validate_position($vector, $position) {
if (preg_match('/^[0-9]+px$/', $position)) {
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][$vector] = $position;
return true;
} else
return false;
}
function GOTMLS_ajax_empty_trash() {
global $wpdb;
$gl = '><';
$action = array("RESTORE" => "UPDATE $wpdb->posts SET `post_status` = 'private'", "DELETE" => "DELETE FROM $wpdb->posts");
if (GOTMLS_get_nonce() && isset($_REQUEST["alter"]) && isset($action[$_REQUEST["alter"]])) {
if ($trashed = $wpdb->query($action[$_REQUEST["alter"]]." WHERE `post_type` = 'GOTMLS_quarantine' AND `post_status` = 'trash'")) {
$wpdb->query("REPAIR TABLE $wpdb->posts");
$trashmsg = sprintf(__("%s %d item from the quarantine trash.",'gotmls'), strtoupper(GOTMLS_sanitize($_REQUEST["alter"])."d"), (INT) $trashed);
} else
$trashmsg = __("Failed to empty the trash.",'gotmls');
} else
$trashmsg = GOTMLS_Invalid_Nonce("");
$properties = array("html" => $gl.'head'.$gl."script type='text/javascript'>\nalert('".GOTMLS_strip4java($trashmsg)."');\nif (curDiv = window.parent)\n\tcurDiv.location.reload(false);\nelse\n\twindow.opener.location.reload(false); 'style="margin: 0; padding: 0;"');
die(GOTMLS_html_tags(array("html" => array("body" => $trashmsg)), $properties));
}
function GOTMLS_ajax_whitelist() {
global $wpdb;
$body = "Whitelist Error: No file or checksum!";
$script = "window.parent.showhide('GOTMLS_iFrame', true);";
if (GOTMLS_get_nonce("GOTMLS_whitelist")) {
if (isset($_POST["GOTMLS_whitelist"]) && isset($_POST["GOTMLS_chksum"])) {
if (("list_group" == $_POST["GOTMLS_whitelist"]) && is_array($_POST["GOTMLS_chksum"])) {
$valid_chksums = array();
foreach ($_POST["GOTMLS_chksum"] as $chksum)
if (preg_match('/^[\da-f]{32}O\d++$/', $chksum))
$valid_chksums[] = "'$chksum'";
if (count($valid_chksums)) {
$trash = "UPDATE `$wpdb->posts` SET `post_status` = 'trash' WHERE `post_type` = 'GOTMLS_quarantine' AND `post_status` = 'pending' AND CONCAT(`post_mime_type`, 'O', `comment_count`) IN (".implode(", ", $valid_chksums).")";
if ($count = $wpdb->query($trash)) {
foreach ($valid_chksums as $chksum)
$script .= "\nif (chksum = window.parent.document.getElementById('whitelist_".substr($chksum, 1)."))\n\tchksum.checked = false;\nif (chksum = window.parent.document.getElementById('GOTMLS_whitelist_".substr($chksum, 1)."))\n\tchksum.style.display = 'none';";
if (count($_POST["GOTMLS_chksum"]) == count($valid_chksums) && count($valid_chksums) == $count)
$body = "Removed $count files from the Whitelist";
else
$body = "
Removed $count of ".count($valid_chksums)." (of ".count($_POST["GOTMLS_chksum"])." posted)