>
>
>
>
".$username[$x]." In Use!THIS IS MAJOR SECURITY RISK!
";
}
}
// Remove WordPress Version Number
function ab_wp_security_remove_version() {
return '';
}
function ab_wp_security_clean() {
// Remove WordPress Version Number
if (get_option('ab-wp-security-wp-version'))
{
add_filter('the_generator', 'ab_wp_security_remove_version');
add_filter( 'script_loader_src', 'ab_wp_security_remove_wp_version_strings' );
add_filter( 'style_loader_src', 'ab_wp_security_remove_wp_version_strings' );
}
// disable xmlrpc in WordPress
if (get_option('ab-wp-security-xml-rpc'))
{
add_filter('xmlrpc_enabled', '__return_false');
}
if (get_option('ab-wp-security-user-enumeration'))
{
if (!is_admin()) {
// default URL format
if (preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING'])) die();
add_filter('redirect_canonical', 'abwp_check_enum', 10, 2);
}
}
if (get_option('ab-wp-security-dir-browse'))
{
if (! is_admin())
{
//get wordpress directory
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
$filename = ABSPATH.'.htaccess'; //get original .htaccess
$filenameCopy = ABSPATH.'.htaccessBackupCopy'; //get changed .htaccess
if (file_exists($filename)) {
//make copy of original $filename
if (copy(".htaccess",".htaccessCopy")) //
{
$txt = "Options All -Indexes";
$contents = file_get_contents($filename);
$pattern = preg_quote($txt, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $contents, $matches)){
fclose ($filename);
}
else{
$myfile = fopen($filename, "a") or die("Unable to open file!");
fwrite($myfile, "\n". $txt);
fclose($myfile);
}
}
}
}
}
}
// Remove WordPress Version Number
function ab_wp_security_remove_wp_version_strings( $src ) {
global $wp_version;
parse_str(parse_url($src, PHP_URL_QUERY), $query);
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
$src = remove_query_arg('ver', $src);
}
return $src;
}
add_action("admin_menu", "ab_wp_security_menu_item");
add_action("admin_init", "abwps_settings");
add_action('init', 'ab_wp_security_clean');
?>