Plugin Directory

Changeset 1646940


Ignore:
Timestamp:
04/27/2017 10:11:53 PM (9 years ago)
Author:
abjelosevic
Message:

Added custom submenu in settings menu, for user selection and screenshot-1.png

Location:
ab-wp-security
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • ab-wp-security/trunk/ab-wp-security-plugin.php

    r1646091 r1646940  
    33   Plugin Name: AB WP Security
    44   Plugin URI: http://aleksandar.bjelosevic.info/abwps
    5    Description: Security plugin that stop User Enumeration in WordPress
    6    Version: 1.20
     5   Description: Security plugin that stop User Enumeration in WordPress, Disable XML-RPC and Remove WordPress Version Number
     6   Version: 1.30
    77   Author: Aleksandar Bjelosevic
    88   Author URI: http://aleksandar.bjelosevic.info
     
    1010   */
    1111
     12
     13
     14
     15function ab_wp_security_menu_item()
     16{
     17  add_submenu_page("options-general.php", "AB WP Security", "AB WP Security", "manage_options", "abwps", "abwpstools_page");
     18}
     19
     20//create page
     21function abwpstools_page()
     22{
     23
     24  ?>
     25      <div class="wrap">
     26         <!-- Add the icon to the page -->
     27        <div id="icon-themes" class="icon32"></div>
     28         <h2>AB WP Security</h2>
     29         <!-- Make a call to the WordPress function for rendering errors when settings are saved. -->
     30        <?php settings_errors(); ?>
     31 
     32        <!-- Create the form that will be used to render our options --> 
     33         <form method="post" action="options.php">
     34            <?php
     35               settings_fields("section");
     36 
     37               do_settings_sections("abwps");
     38                 
     39               submit_button();
     40            ?>
     41         </form>
     42         
     43      </div>
     44   <?php
     45}
     46
     47function abwps_settings()
     48{
     49    add_settings_section("section", "Settings", null, "abwps");
     50    add_settings_field("ab-wp-security-userenumeration", "Stop User Enumeration in WordPress", "abwps_userenumeration_display", "abwps", "section"); 
     51    add_settings_field("ab-wp-security-wp-version", "Remove WordPress Version Number", "abwps_wpversion_display", "abwps", "section");
     52    add_settings_field("ab-wp-security-xml-rpc", "Disable XML-RPC", "abwps_xmlrpc_display", "abwps", "section");
     53    register_setting("section", "ab-wp-security-user-enumeration");
     54    register_setting("section", "ab-wp-security-wp-version");
     55    register_setting("section", "ab-wp-security-xml-rpc");
     56}
     57
     58function abwps_userenumeration_display()
     59{
     60   ?>
     61        <input type="checkbox" name="ab-wp-security-user-enumeration" value="1" <?php checked(1, get_option('ab-wp-security-user-enumeration'), true); ?>>
     62       
     63       
     64   <?php
     65}
     66
     67function abwps_wpversion_display()
     68{
     69   ?>
     70        <input type="checkbox" name="ab-wp-security-wp-version" value="1" <?php checked(1, get_option('ab-wp-security-wp-version'), true); ?>>
     71   <?php
     72}
     73
     74function abwps_xmlrpc_display()
     75{
     76   ?>
     77         <input type="checkbox" name="ab-wp-security-xml-rpc" value="1" <?php checked(1, get_option('ab-wp-security-xml-rpc'), true); ?>>
     78   <?php
     79}
     80
     81
     82
     83
    1284// block WP enum scans
    1385
    14 if (!is_admin()) {
    15     // default URL format
    16     if (preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING'])) die();
    17     add_filter('redirect_canonical', 'abwp_check_enum', 10, 2);
    18 }
     86
    1987function abwp_check_enum($redirect, $request) {
    2088    // permalink URL format
     
    2391}
    2492
    25 // Remove WordPress Version Number
    26 function ab_wp_security_remove_version() {
    27 return '';
     93
     94function ab_wp_security_clean() {
     95
     96    // Remove WordPress Version Number
     97        if (get_option('ab-wp-security-wp-version'))
     98           {
     99           add_filter('the_generator', '');
     100           }
     101        // disable xmlrpc in WordPress   
     102       if (get_option('ab-wp-security-xml-rpc'))
     103           {
     104            add_filter('xmlrpc_enabled', '__return_false');
     105           }       
     106       if (get_option('ab-wp-security-user-enumeration'))
     107           {
     108            if (!is_admin()) {
     109    // default URL format
     110    if (preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING'])) die();
     111    add_filter('redirect_canonical', 'abwp_check_enum', 10, 2);
     112}         
     113           
     114           
     115           
     116           }     
     117
    28118}
    29 add_filter('the_generator', 'ab_wp_security_remove_version');
    30 add_filter('xmlrpc_enabled', '__return_false');
     119
     120add_action("admin_menu", "ab_wp_security_menu_item");
     121add_action("admin_init", "abwps_settings");
     122
     123add_action('init', 'ab_wp_security_clean');
     124
    31125?>
  • ab-wp-security/trunk/readme.txt

    r1646092 r1646940  
    55Requires at least: 3.8
    66Tested up to: 4.7.4
    7 Stable tag: 1.20
     7Stable tag: 1.30
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    2323== Changelog ==
    2424
     25= V1.30 =
     26Added custom submenu in settings menu, for user selection
     27
    2528= V1.20 =
    2629Disable XML-RPC
     
    3639
    3740== Screenshots ==
     411. Settings->AB WP Security page
    3842
    3943== Frequently Asked Questions ==
Note: See TracChangeset for help on using the changeset viewer.