All In One WP Security & Firewall - Version 4.3.1

Version Description

  • Improved white list directives to cater for Apache 2.4 and earlier versions.
  • Added 3 filters for the manual account registration approval email: aiowps_register_approval_email_subject, aiowps_register_approval_email_msg, aiowps_register_approval_email_from_name
  • Added configuration option to allow custom firewall rules to be applied at beginning of all rules applied by aiowps.
  • Changed record insertions to DB table aiowps_failed_logins to store the full IP address instead of IP range.
Download this release

Release Info

Developer mra13
Plugin Icon 128x128 All In One WP Security & Firewall
Version 4.3.1
Comparing to
See all releases

Code changes from version 4.2.9 to 4.3.1

admin/wp-security-brute-force-menu.php CHANGED
@@ -516,6 +516,8 @@ class AIOWPSecurity_Brute_Force_Menu extends AIOWPSecurity_Admin_Menu
516
  $random_20_digit_string = AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20); //Generate random 20 char string for use during captcha encode/decode
517
  $aio_wp_security->configs->set_value('aiowps_captcha_secret_key', $random_20_digit_string);
518
  $aio_wp_security->configs->set_value('aiowps_enable_login_captcha',isset($_POST["aiowps_enable_login_captcha"])?'1':'');
 
 
519
  $aio_wp_security->configs->set_value('aiowps_enable_custom_login_captcha',isset($_POST["aiowps_enable_custom_login_captcha"])?'1':'');
520
  $aio_wp_security->configs->set_value('aiowps_enable_lost_password_captcha',isset($_POST["aiowps_enable_lost_password_captcha"])?'1':'');
521
  $aio_wp_security->configs->save_config();
@@ -574,6 +576,37 @@ class AIOWPSecurity_Brute_Force_Menu extends AIOWPSecurity_Admin_Menu
574
  </table>
575
  </div></div>
576
  <div class="postbox">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  <h3 class="hndle"><label for="title"><?php _e('Lost Password Form Captcha Settings', 'all-in-one-wp-security-and-firewall'); ?></label></h3>
578
  <div class="inside">
579
  <?php
516
  $random_20_digit_string = AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20); //Generate random 20 char string for use during captcha encode/decode
517
  $aio_wp_security->configs->set_value('aiowps_captcha_secret_key', $random_20_digit_string);
518
  $aio_wp_security->configs->set_value('aiowps_enable_login_captcha',isset($_POST["aiowps_enable_login_captcha"])?'1':'');
519
+ $aio_wp_security->configs->set_value('aiowps_enable_woo_login_captcha',isset($_POST["aiowps_enable_woo_login_captcha"])?'1':'');
520
+ $aio_wp_security->configs->set_value('aiowps_enable_woo_register_captcha',isset($_POST["aiowps_enable_woo_register_captcha"])?'1':'');
521
  $aio_wp_security->configs->set_value('aiowps_enable_custom_login_captcha',isset($_POST["aiowps_enable_custom_login_captcha"])?'1':'');
522
  $aio_wp_security->configs->set_value('aiowps_enable_lost_password_captcha',isset($_POST["aiowps_enable_lost_password_captcha"])?'1':'');
523
  $aio_wp_security->configs->save_config();
576
  </table>
577
  </div></div>
578
  <div class="postbox">
579
+ <h3 class="hndle"><label for="title"><?php _e('Woocommerce Forms Captcha Settings', 'all-in-one-wp-security-and-firewall'); ?></label></h3>
580
+ <div class="inside">
581
+ <?php
582
+ //Display security info badge
583
+ global $aiowps_feature_mgr;
584
+ $aiowps_feature_mgr->output_feature_details_badge("woo-login-captcha");
585
+ ?>
586
+ <table class="form-table">
587
+ <tr valign="top">
588
+ <th scope="row"><?php _e('Enable Captcha On Woocommerce Login Form', 'all-in-one-wp-security-and-firewall')?>:</th>
589
+ <td>
590
+ <input name="aiowps_enable_woo_login_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_woo_login_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
591
+ <span class="description"><?php _e('Check this if you want to insert captcha on a Woocommerce login form', 'all-in-one-wp-security-and-firewall'); ?></span>
592
+ </td>
593
+ </tr>
594
+ </table>
595
+ <hr>
596
+ <?php
597
+ $aiowps_feature_mgr->output_feature_details_badge("woo-register-captcha");
598
+ ?>
599
+ <table class="form-table">
600
+ <tr valign="top">
601
+ <th scope="row"><?php _e('Enable Captcha On Woocommerce Registration Form', 'all-in-one-wp-security-and-firewall')?>:</th>
602
+ <td>
603
+ <input name="aiowps_enable_woo_register_captcha" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_woo_register_captcha')=='1') echo ' checked="checked"'; ?> value="1"/>
604
+ <span class="description"><?php _e('Check this if you want to insert captcha on a Woocommerce registration form', 'all-in-one-wp-security-and-firewall'); ?></span>
605
+ </td>
606
+ </tr>
607
+ </table>
608
+ </div></div>
609
+ <div class="postbox">
610
  <h3 class="hndle"><label for="title"><?php _e('Lost Password Form Captcha Settings', 'all-in-one-wp-security-and-firewall'); ?></label></h3>
611
  <div class="inside">
612
  <?php
admin/wp-security-dashboard-menu.php CHANGED
@@ -75,6 +75,17 @@ class AIOWPSecurity_Dashboard_Menu extends AIOWPSecurity_Admin_Menu
75
 
76
  function render_tab1()
77
  {
 
 
 
 
 
 
 
 
 
 
 
78
  echo '<div class="aio_grey_box">';
79
  echo '<p>' . __('For information, updates and documentation, please visit the', 'all-in-one-wp-security-and-firewall') . ' <a href="https://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin" target="_blank">' . __('AIO WP Security & Firewall Plugin', 'all-in-one-wp-security-and-firewall') . '</a> ' . __('Page', 'all-in-one-wp-security-and-firewall') . '</p>';
80
  echo '<p><a href="https://www.tipsandtricks-hq.com/development-center" target="_blank">' . __('Follow us', 'all-in-one-wp-security-and-firewall') . '</a> on ' . __('Twitter, Google+ or via Email to stay up to date about the new security features of this plugin.', 'all-in-one-wp-security-and-firewall') . '</p>';
75
 
76
  function render_tab1()
77
  {
78
+
79
+ //Lets check if reapply httaccess rules action was performed
80
+ if(strip_tags($_REQUEST['aiowps_reapply_htaccess']) == 1){
81
+ //Show success or failure message from the reapply operation.
82
+ if(isset($_SESSION['reapply_htaccess_rules_action_result']) && $_SESSION['reapply_htaccess_rules_action_result'] == '1'){
83
+ echo '<div class="updated"><p>The AIOWPS .htaccess rules were successfully re-inserted.</p></div>';
84
+ } else if (isset($_SESSION['reapply_htaccess_rules_action_result']) && $_SESSION['reapply_htaccess_rules_action_result'] == '2'){
85
+ echo '<div class="error"><p>AIOWPS encountered an error when trying to write to your .htaccess file. Please check the logs.</p></div>';
86
+ }
87
+ }
88
+
89
  echo '<div class="aio_grey_box">';
90
  echo '<p>' . __('For information, updates and documentation, please visit the', 'all-in-one-wp-security-and-firewall') . ' <a href="https://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin" target="_blank">' . __('AIO WP Security & Firewall Plugin', 'all-in-one-wp-security-and-firewall') . '</a> ' . __('Page', 'all-in-one-wp-security-and-firewall') . '</p>';
91
  echo '<p><a href="https://www.tipsandtricks-hq.com/development-center" target="_blank">' . __('Follow us', 'all-in-one-wp-security-and-firewall') . '</a> on ' . __('Twitter, Google+ or via Email to stay up to date about the new security features of this plugin.', 'all-in-one-wp-security-and-firewall') . '</p>';
admin/wp-security-firewall-menu.php CHANGED
@@ -1042,6 +1042,7 @@ class AIOWPSecurity_Firewall_Menu extends AIOWPSecurity_Admin_Menu
1042
 
1043
  $aio_wp_security->configs->set_value('aiowps_custom_rules',$custom_rules);
1044
  $aio_wp_security->configs->set_value('aiowps_enable_custom_rules',isset($_POST["aiowps_enable_custom_rules"])?'1':'');
 
1045
  $aio_wp_security->configs->save_config(); //Save the configuration
1046
 
1047
  $this->show_msg_settings_updated();
@@ -1091,6 +1092,13 @@ class AIOWPSecurity_Firewall_Menu extends AIOWPSecurity_Admin_Menu
1091
  <span class="description"><?php _e('Check this if you want to enable custom rules entered in the text box below', 'all-in-one-wp-security-and-firewall'); ?></span>
1092
  </td>
1093
  </tr>
 
 
 
 
 
 
 
1094
  <tr valign="top">
1095
  <th scope="row"><?php _e('Enter Custom .htaccess Rules:', 'all-in-one-wp-security-and-firewall')?></th>
1096
  <td>
1042
 
1043
  $aio_wp_security->configs->set_value('aiowps_custom_rules',$custom_rules);
1044
  $aio_wp_security->configs->set_value('aiowps_enable_custom_rules',isset($_POST["aiowps_enable_custom_rules"])?'1':'');
1045
+ $aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_top',isset($_POST["aiowps_place_custom_rules_at_top"])?'1':'');
1046
  $aio_wp_security->configs->save_config(); //Save the configuration
1047
 
1048
  $this->show_msg_settings_updated();
1092
  <span class="description"><?php _e('Check this if you want to enable custom rules entered in the text box below', 'all-in-one-wp-security-and-firewall'); ?></span>
1093
  </td>
1094
  </tr>
1095
+ <tr valign="top">
1096
+ <th scope="row"><?php _e('Place custom rules at the top', 'all-in-one-wp-security-and-firewall')?>:</th>
1097
+ <td>
1098
+ <input name="aiowps_place_custom_rules_at_top" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_place_custom_rules_at_top')=='1') echo ' checked="checked"'; ?> value="1"/>
1099
+ <span class="description"><?php _e('Check this if you want to place your custom rules at the beginning of all the rules applied by this plugin', 'all-in-one-wp-security-and-firewall'); ?></span>
1100
+ </td>
1101
+ </tr>
1102
  <tr valign="top">
1103
  <th scope="row"><?php _e('Enter Custom .htaccess Rules:', 'all-in-one-wp-security-and-firewall')?></th>
1104
  <td>
admin/wp-security-list-registered-users.php CHANGED
@@ -158,6 +158,10 @@ class AIOWPSecurity_List_Registered_Users extends AIOWPSecurity_List_Table {
158
  $email_msg .= __('Your account with user ID:','all-in-one-wp-security-and-firewall').$user->ID.__(' is now active','all-in-one-wp-security-and-firewall')."\n";
159
  $site_title = get_bloginfo( 'name' );
160
  $from_name = empty($site_title)?'WordPress':$site_title;
 
 
 
 
161
  $email_header = 'From: '.$from_name.' <'.get_bloginfo('admin_email').'>' . "\r\n\\";
162
  $sendMail = wp_mail($to_email_address, $subject, $email_msg, $email_header);
163
  if(FALSE === $sendMail){
@@ -188,6 +192,10 @@ class AIOWPSecurity_List_Registered_Users extends AIOWPSecurity_List_Table {
188
  $email_msg .= __('Your account with username: ','all-in-one-wp-security-and-firewall').$user->user_login.__(' is now active','all-in-one-wp-security-and-firewall')."\n";
189
  $site_title = get_bloginfo( 'name' );
190
  $from_name = empty($site_title)?'WordPress':$site_title;
 
 
 
 
191
  $email_header = 'From: '.$from_name.' <'.get_bloginfo('admin_email').'>' . "\r\n\\";
192
  $sendMail = wp_mail($to_email_address, $subject, $email_msg, $email_header);
193
  if(FALSE === $sendMail){
158
  $email_msg .= __('Your account with user ID:','all-in-one-wp-security-and-firewall').$user->ID.__(' is now active','all-in-one-wp-security-and-firewall')."\n";
159
  $site_title = get_bloginfo( 'name' );
160
  $from_name = empty($site_title)?'WordPress':$site_title;
161
+ $subject = apply_filters( 'aiowps_register_approval_email_subject', $subject );
162
+ $email_msg = apply_filters( 'aiowps_register_approval_email_msg', $email_msg, $user ); //also pass the WP_User object
163
+ $from_name = apply_filters( 'aiowps_register_approval_email_from_name', $from_name );
164
+
165
  $email_header = 'From: '.$from_name.' <'.get_bloginfo('admin_email').'>' . "\r\n\\";
166
  $sendMail = wp_mail($to_email_address, $subject, $email_msg, $email_header);
167
  if(FALSE === $sendMail){
192
  $email_msg .= __('Your account with username: ','all-in-one-wp-security-and-firewall').$user->user_login.__(' is now active','all-in-one-wp-security-and-firewall')."\n";
193
  $site_title = get_bloginfo( 'name' );
194
  $from_name = empty($site_title)?'WordPress':$site_title;
195
+ $subject = apply_filters( 'aiowps_register_approval_email_subject', $subject );
196
+ $email_msg = apply_filters( 'aiowps_register_approval_email_msg', $email_msg, $user ); //also pass the WP_User object
197
+ $from_name = apply_filters( 'aiowps_register_approval_email_from_name', $from_name );
198
+
199
  $email_header = 'From: '.$from_name.' <'.get_bloginfo('admin_email').'>' . "\r\n\\";
200
  $sendMail = wp_mail($to_email_address, $subject, $email_msg, $email_header);
201
  if(FALSE === $sendMail){
classes/grade-system/wp-security-feature-item-manager.php CHANGED
@@ -43,6 +43,8 @@ class AIOWPSecurity_Feature_Item_Manager
43
  //Login Captcha
44
  $this->feature_items[] = new AIOWPSecurity_Feature_Item("user-login-captcha", __("Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_4, $this->sec_level_basic);
45
  $this->feature_items[] = new AIOWPSecurity_Feature_Item("custom-login-captcha", __("Custom Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_4, $this->sec_level_basic);
 
 
46
  //Lost Password Captcha
47
  $this->feature_items[] = new AIOWPSecurity_Feature_Item("lost-password-captcha", __("Lost Password Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
48
  //Login whitelisting
@@ -195,6 +197,14 @@ class AIOWPSecurity_Feature_Item_Manager
195
  {
196
  $this->check_custom_login_captcha_feature($item);
197
  }
 
 
 
 
 
 
 
 
198
  if($item->feature_id == "lost-password-captcha")
199
  {
200
  $this->check_lost_password_captcha_feature($item);
@@ -430,6 +440,30 @@ class AIOWPSecurity_Feature_Item_Manager
430
  }
431
  }
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  function check_lost_password_captcha_feature($item)
434
  {
435
  global $aio_wp_security;
43
  //Login Captcha
44
  $this->feature_items[] = new AIOWPSecurity_Feature_Item("user-login-captcha", __("Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_4, $this->sec_level_basic);
45
  $this->feature_items[] = new AIOWPSecurity_Feature_Item("custom-login-captcha", __("Custom Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_4, $this->sec_level_basic);
46
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("woo-login-captcha", __("Woo Login Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
47
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("woo-register-captcha", __("Woo Register Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
48
  //Lost Password Captcha
49
  $this->feature_items[] = new AIOWPSecurity_Feature_Item("lost-password-captcha", __("Lost Password Captcha", "all-in-one-wp-security-and-firewall"), $this->feature_point_2, $this->sec_level_basic);
50
  //Login whitelisting
197
  {
198
  $this->check_custom_login_captcha_feature($item);
199
  }
200
+ if($item->feature_id == "woo-login-captcha")
201
+ {
202
+ $this->check_woo_login_captcha_feature($item);
203
+ }
204
+ if($item->feature_id == "woo-register-captcha")
205
+ {
206
+ $this->check_woo_register_captcha_feature($item);
207
+ }
208
  if($item->feature_id == "lost-password-captcha")
209
  {
210
  $this->check_lost_password_captcha_feature($item);
440
  }
441
  }
442
 
443
+ function check_woo_login_captcha_feature($item)
444
+ {
445
+ global $aio_wp_security;
446
+ if ($aio_wp_security->configs->get_value('aiowps_enable_woo_login_captcha') == '1') {
447
+ $item->set_feature_status($this->feature_active);
448
+ }
449
+ else
450
+ {
451
+ $item->set_feature_status($this->feature_inactive);
452
+ }
453
+ }
454
+
455
+ function check_woo_register_captcha_feature($item)
456
+ {
457
+ global $aio_wp_security;
458
+ if ($aio_wp_security->configs->get_value('aiowps_enable_woo_register_captcha') == '1') {
459
+ $item->set_feature_status($this->feature_active);
460
+ }
461
+ else
462
+ {
463
+ $item->set_feature_status($this->feature_inactive);
464
+ }
465
+ }
466
+
467
  function check_lost_password_captcha_feature($item)
468
  {
469
  global $aio_wp_security;
classes/wp-security-backup.php CHANGED
@@ -330,9 +330,6 @@ class AIOWPSecurity_Backup
330
 
331
  function aiowps_scheduled_db_cleanup_handler()
332
  {
333
- global $aio_wp_security;
334
-
335
- $aio_wp_security->debug_logger->log_debug_cron("DB Cleanup - checking if a cleanup needs to be done now...");
336
  //Check the events table because this can grow quite large especially when 404 events are being logged
337
  $events_table_name = AIOWPSEC_TBL_EVENTS;
338
  $max_rows_event_table = '5000'; //Keep a max of 5000 rows in the events table
330
 
331
  function aiowps_scheduled_db_cleanup_handler()
332
  {
 
 
 
333
  //Check the events table because this can grow quite large especially when 404 events are being logged
334
  $events_table_name = AIOWPSEC_TBL_EVENTS;
335
  $max_rows_event_table = '5000'; //Keep a max of 5000 rows in the events table
classes/wp-security-configure-settings.php CHANGED
@@ -43,6 +43,8 @@ class AIOWPSecurity_Configure_Settings
43
  //Captcha feature
44
  $aio_wp_security->configs->set_value('aiowps_enable_login_captcha','');//Checkbox
45
  $aio_wp_security->configs->set_value('aiowps_enable_custom_login_captcha','');//Checkbox
 
 
46
  $aio_wp_security->configs->set_value('aiowps_enable_lost_password_captcha','');//Checkbox
47
  $aio_wp_security->configs->set_value('aiowps_captcha_secret_key',AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20));//Hidden secret value which will be used to do some captcha processing. This will be assigned a random string generated when captcha settings saved
48
 
@@ -87,6 +89,7 @@ class AIOWPSecurity_Configure_Settings
87
  $aio_wp_security->configs->set_value('aiowps_enable_5g_firewall','');//Checkbox
88
  $aio_wp_security->configs->set_value('aiowps_enable_6g_firewall','');//Checkbox
89
  $aio_wp_security->configs->set_value('aiowps_enable_custom_rules','');//Checkbox
 
90
  $aio_wp_security->configs->set_value('aiowps_custom_rules','');
91
 
92
  //404 detection
@@ -183,6 +186,8 @@ class AIOWPSecurity_Configure_Settings
183
  //Captcha feature
184
  $aio_wp_security->configs->add_value('aiowps_enable_login_captcha','');//Checkbox
185
  $aio_wp_security->configs->add_value('aiowps_enable_custom_login_captcha','');//Checkbox
 
 
186
  $aio_wp_security->configs->add_value('aiowps_captcha_secret_key',AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20));//Hidden secret value which will be used to do some captcha processing. This will be assigned a random string generated when captcha settings saved
187
 
188
  //User registration
@@ -223,6 +228,7 @@ class AIOWPSecurity_Configure_Settings
223
  $aio_wp_security->configs->add_value('aiowps_enable_5g_firewall','');//Checkbox
224
  $aio_wp_security->configs->add_value('aiowps_enable_6g_firewall','');//Checkbox
225
  $aio_wp_security->configs->add_value('aiowps_enable_custom_rules','');//Checkbox
 
226
  $aio_wp_security->configs->add_value('aiowps_custom_rules','');
227
 
228
  //404 detection
@@ -311,6 +317,7 @@ class AIOWPSecurity_Configure_Settings
311
  $aio_wp_security->configs->set_value('aiowps_enable_6g_firewall','');//Checkbox
312
  $aio_wp_security->configs->set_value('aiowps_enable_brute_force_attack_prevention','');//Checkbox
313
  $aio_wp_security->configs->set_value('aiowps_enable_custom_rules','');//Checkbox
 
314
  $aio_wp_security->configs->set_value('aiowps_custom_rules','');
315
 
316
  $aio_wp_security->configs->set_value('aiowps_prevent_default_wp_file_access','');//Checkbox
43
  //Captcha feature
44
  $aio_wp_security->configs->set_value('aiowps_enable_login_captcha','');//Checkbox
45
  $aio_wp_security->configs->set_value('aiowps_enable_custom_login_captcha','');//Checkbox
46
+ $aio_wp_security->configs->set_value('aiowps_enable_woo_login_captcha','');//Checkbox
47
+ $aio_wp_security->configs->set_value('aiowps_enable_woo_register_captcha','');//Checkbox
48
  $aio_wp_security->configs->set_value('aiowps_enable_lost_password_captcha','');//Checkbox
49
  $aio_wp_security->configs->set_value('aiowps_captcha_secret_key',AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20));//Hidden secret value which will be used to do some captcha processing. This will be assigned a random string generated when captcha settings saved
50
 
89
  $aio_wp_security->configs->set_value('aiowps_enable_5g_firewall','');//Checkbox
90
  $aio_wp_security->configs->set_value('aiowps_enable_6g_firewall','');//Checkbox
91
  $aio_wp_security->configs->set_value('aiowps_enable_custom_rules','');//Checkbox
92
+ $aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_top','');//Checkbox
93
  $aio_wp_security->configs->set_value('aiowps_custom_rules','');
94
 
95
  //404 detection
186
  //Captcha feature
187
  $aio_wp_security->configs->add_value('aiowps_enable_login_captcha','');//Checkbox
188
  $aio_wp_security->configs->add_value('aiowps_enable_custom_login_captcha','');//Checkbox
189
+ $aio_wp_security->configs->add_value('aiowps_enable_woo_login_captcha','');//Checkbox
190
+ $aio_wp_security->configs->add_value('aiowps_enable_woo_register_captcha','');//Checkbox
191
  $aio_wp_security->configs->add_value('aiowps_captcha_secret_key',AIOWPSecurity_Utility::generate_alpha_numeric_random_string(20));//Hidden secret value which will be used to do some captcha processing. This will be assigned a random string generated when captcha settings saved
192
 
193
  //User registration
228
  $aio_wp_security->configs->add_value('aiowps_enable_5g_firewall','');//Checkbox
229
  $aio_wp_security->configs->add_value('aiowps_enable_6g_firewall','');//Checkbox
230
  $aio_wp_security->configs->add_value('aiowps_enable_custom_rules','');//Checkbox
231
+ $aio_wp_security->configs->add_value('aiowps_place_custom_rules_at_top','');//Checkbox
232
  $aio_wp_security->configs->add_value('aiowps_custom_rules','');
233
 
234
  //404 detection
317
  $aio_wp_security->configs->set_value('aiowps_enable_6g_firewall','');//Checkbox
318
  $aio_wp_security->configs->set_value('aiowps_enable_brute_force_attack_prevention','');//Checkbox
319
  $aio_wp_security->configs->set_value('aiowps_enable_custom_rules','');//Checkbox
320
+ $aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_top','');//Checkbox
321
  $aio_wp_security->configs->set_value('aiowps_custom_rules','');
322
 
323
  $aio_wp_security->configs->set_value('aiowps_prevent_default_wp_file_access','');//Checkbox
classes/wp-security-cronjob-handler.php CHANGED
@@ -10,22 +10,14 @@ class AIOWPSecurity_Cronjob_Handler {
10
  function aiowps_hourly_cron_event_handler()
11
  {
12
  //Do stuff that needs checking every hours
13
- global $aio_wp_security;
14
- //$aio_wp_security->debug_logger->log_debug_cron("Cronjob_Handler - Hourly cron handler got fired.");
15
-
16
- //do_action('aiowps_force_logout_check');
17
- //do_action('aiowps_check_password_stuff');
18
  do_action('aiowps_perform_scheduled_backup_tasks');
19
  do_action('aiowps_perform_fcd_scan_tasks');
 
20
  }
21
 
22
  function aiowps_daily_cron_event_handler()
23
  {
24
  //Do stuff that needs checking daily
25
- global $aio_wp_security;
26
- $aio_wp_security->debug_logger->log_debug_cron("Cronjob_Handler - Daily cron handler got fired.");
27
-
28
- do_action('aiowps_perform_db_cleanup_tasks');
29
  }
30
 
31
  }
10
  function aiowps_hourly_cron_event_handler()
11
  {
12
  //Do stuff that needs checking every hours
 
 
 
 
 
13
  do_action('aiowps_perform_scheduled_backup_tasks');
14
  do_action('aiowps_perform_fcd_scan_tasks');
15
+ do_action('aiowps_perform_db_cleanup_tasks');
16
  }
17
 
18
  function aiowps_daily_cron_event_handler()
19
  {
20
  //Do stuff that needs checking daily
 
 
 
 
21
  }
22
 
23
  }
classes/wp-security-general-init-tasks.php CHANGED
@@ -31,9 +31,13 @@ class AIOWPSecurity_General_Init_Tasks
31
  if(strip_tags($_REQUEST['aiowps_reapply_htaccess']) == 1){
32
  include_once ('wp-security-installer.php');
33
  if(AIOWPSecurity_Installer::reactivation_tasks()){
34
- echo '<div class="updated"><p>The AIOWPS .htaccess rules were successfully re-inserted.</p></div>';
 
 
35
  }else{
36
- echo '<div class="error"><p>AIOWPS encountered an error when trying to write to your .htaccess file. Please check the logs.</p></div>';
 
 
37
  }
38
 
39
  }elseif(strip_tags($_REQUEST['aiowps_reapply_htaccess']) == 2){
@@ -106,6 +110,19 @@ class AIOWPSecurity_General_Init_Tasks
106
  }
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  //For custom login form captcha feature, ie, when wp_login_form() function is used to generate login form
110
  if($aio_wp_security->configs->get_value('aiowps_enable_custom_login_captcha') == '1'){
111
  if (!is_user_logged_in()) {
31
  if(strip_tags($_REQUEST['aiowps_reapply_htaccess']) == 1){
32
  include_once ('wp-security-installer.php');
33
  if(AIOWPSecurity_Installer::reactivation_tasks()){
34
+ $aio_wp_security->debug_logger->log_debug("The AIOWPS .htaccess rules were successfully re-inserted!");
35
+ $_SESSION['reapply_htaccess_rules_action_result'] = '1';//Success indicator.
36
+ //Can't echo to the screen here. It will create an header already sent error.
37
  }else{
38
+ $aio_wp_security->debug_logger->log_debug("AIOWPS encountered an error when trying to write to your .htaccess file. Please check the logs.", 5);
39
+ $_SESSION['reapply_htaccess_rules_action_result'] = '2';//fail indicator.
40
+ //Can't echo to the screen here. It will create an header already sent error.
41
  }
42
 
43
  }elseif(strip_tags($_REQUEST['aiowps_reapply_htaccess']) == 2){
110
  }
111
  }
112
 
113
+ //For woo form captcha features
114
+ if($aio_wp_security->configs->get_value('aiowps_enable_woo_login_captcha') == '1'){
115
+ if (!is_user_logged_in()) {
116
+ add_action('woocommerce_login_form', array(&$this, 'insert_captcha_question_form'));
117
+ }
118
+ }
119
+
120
+ if($aio_wp_security->configs->get_value('aiowps_enable_woo_register_captcha') == '1'){
121
+ if (!is_user_logged_in()) {
122
+ add_action('woocommerce_register_form', array(&$this, 'insert_captcha_question_form'));
123
+ }
124
+ }
125
+
126
  //For custom login form captcha feature, ie, when wp_login_form() function is used to generate login form
127
  if($aio_wp_security->configs->get_value('aiowps_enable_custom_login_captcha') == '1'){
128
  if (!is_user_logged_in()) {
classes/wp-security-installer.php CHANGED
@@ -172,7 +172,7 @@ class AIOWPSecurity_Installer
172
  //Case where previously installed plugin was reactivated
173
  //Let's copy the original configs back to the options table
174
  $updated = update_option('aio_wp_security_configs', $temp_cfgs);
175
- if ($updated === FALSE) {
176
  $aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Installer::run_installer() - Update of option settings failed upon plugin activation!", 4);
177
  }
178
  $aio_wp_security->configs->configs = $temp_cfgs; //copy the original configs to memory
172
  //Case where previously installed plugin was reactivated
173
  //Let's copy the original configs back to the options table
174
  $updated = update_option('aio_wp_security_configs', $temp_cfgs);
175
+ if (!$updated) {
176
  $aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Installer::run_installer() - Update of option settings failed upon plugin activation!", 4);
177
  }
178
  $aio_wp_security->configs->configs = $temp_cfgs; //copy the original configs to memory
classes/wp-security-user-login.php CHANGED
@@ -273,12 +273,9 @@ class AIOWPSecurity_User_Login
273
  function increment_failed_logins($username)
274
  {
275
  global $wpdb, $aio_wp_security;
276
- //$login_attempts_permitted = $aio_wp_security->configs->get_value('aiowps_max_login_attempts');
277
- //$lockout_time_length = $aio_wp_security->configs->get_value('aiowps_lockout_time_length');
278
  $login_fails_table = AIOWPSEC_TBL_FAILED_LOGINS;
279
  $ip = AIOWPSecurity_Utility_IP::get_user_ip_address(); //Get the IP address of user
280
- $ip_range = AIOWPSecurity_Utility_IP::get_sanitized_ip_range($ip); //Get the IP range of the current user
281
- if(empty($ip_range)) return;
282
  $user = is_email($username) ? get_user_by('email', $username) : get_user_by('login', $username); //Returns WP_User object if it exists
283
  if ($user)
284
  {
@@ -288,9 +285,9 @@ class AIOWPSecurity_User_Login
288
  //If the login attempt was made using a non-existent user then let's set user_id to blank and record the attempted user login name for DB storage later on
289
  $user_id = 0;
290
  }
291
- $ip_range_str = esc_sql($ip_range).'.*';
292
  $now = current_time( 'mysql' );
293
- $data = array('user_id' => $user_id, 'user_login' => $username, 'failed_login_date' => $now, 'login_attempt_ip' => $ip_range_str);
294
  $format = array('%d', '%s', '%s', '%s');
295
  $result = $wpdb->insert($login_fails_table, $data, $format);
296
  if ($result === FALSE)
273
  function increment_failed_logins($username)
274
  {
275
  global $wpdb, $aio_wp_security;
 
 
276
  $login_fails_table = AIOWPSEC_TBL_FAILED_LOGINS;
277
  $ip = AIOWPSecurity_Utility_IP::get_user_ip_address(); //Get the IP address of user
278
+ if(empty($ip)) return;
 
279
  $user = is_email($username) ? get_user_by('email', $username) : get_user_by('login', $username); //Returns WP_User object if it exists
280
  if ($user)
281
  {
285
  //If the login attempt was made using a non-existent user then let's set user_id to blank and record the attempted user login name for DB storage later on
286
  $user_id = 0;
287
  }
288
+ $ip_str = esc_sql($ip);
289
  $now = current_time( 'mysql' );
290
+ $data = array('user_id' => $user_id, 'user_login' => $username, 'failed_login_date' => $now, 'login_attempt_ip' => $ip_str);
291
  $format = array('%d', '%s', '%s', '%s');
292
  $result = $wpdb->insert($login_fails_table, $data, $format);
293
  if ($result === FALSE)
classes/wp-security-utility-htaccess.php CHANGED
@@ -142,7 +142,27 @@ class AIOWPSecurity_Utility_Htaccess
142
  $ht = @fopen($htaccess, 'a+');
143
  @fclose($ht);
144
  }
145
- $ht_contents = explode(PHP_EOL, implode('', file($htaccess))); //parse each line of file into array
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  if ($ht_contents) { //as long as there are lines in the file
147
  $state = true;
148
  if (!$f = @fopen($htaccess, 'w+')) {
@@ -171,6 +191,7 @@ class AIOWPSecurity_Utility_Htaccess
171
 
172
  static function getrules()
173
  {
 
174
  $rules = "";
175
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_wp_file_access();
176
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_basic_htaccess();
@@ -186,9 +207,15 @@ class AIOWPSecurity_Utility_Htaccess
186
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_5g_blacklist();
187
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_brute_force_prevention();
188
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_spambots();
189
- $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_login_whitelist();
190
  $rules .= AIOWPSecurity_Utility_Htaccess::prevent_image_hotlinks();
191
- $rules .= AIOWPSecurity_Utility_Htaccess::getrules_custom_rules();
 
 
 
 
 
 
192
  //TODO: The following utility functions are ready to use when we write the menu pages for these features
193
 
194
  //Add more functions for features as needed
@@ -423,7 +450,7 @@ class AIOWPSecurity_Utility_Htaccess
423
  $special_case = true;
424
  $rules .= '<IfModule mod_rewrite.c>' . PHP_EOL;
425
  $rules .= 'RewriteEngine on' . PHP_EOL;
426
- $rules .= 'RewriteCond %{QUERY_STRING} ^' . $secret_slug . '$' . PHP_EOL;
427
  $rules .= 'RewriteCond %{REMOTE_ADDR} !^' . preg_quote($host_ip) . '[OR]' . PHP_EOL;
428
  } else {
429
  $slug = preg_quote($secret_slug); //escape any applicable chars
@@ -527,6 +554,111 @@ class AIOWPSecurity_Utility_Htaccess
527
  return $rules;
528
  }
529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  /*
531
  * This function will disable directory listings for all directories, add this line to the
532
  * site’s root .htaccess file.
@@ -1098,11 +1230,21 @@ END;
1098
  * @param array $ips
1099
  * @return array
1100
  */
1101
- protected static function add_netmask($ips) {
1102
 
1103
  $output = array();
1104
-
1105
  foreach ( $ips as $ip ) {
 
 
 
 
 
 
 
 
 
 
1106
 
1107
  $parts = explode('.', $ip);
1108
 
142
  $ht = @fopen($htaccess, 'a+');
143
  @fclose($ht);
144
  }
145
+ /*
146
+ *
147
+ Bug Fix: On some environments such as windows (xampp) this function was clobbering the non-aiowps-related .htaccess contents for certain cases.
148
+ In some cases when WordPress saves the .htaccess file (eg, when saving permalink settings),
149
+ the line endings differ from the expected PHP_EOL endings. (WordPress saves with "\n" (UNIX style) but PHP_EOL may be set as "\r\n" (WIN/DOS))
150
+ In this case exploding via PHP_EOL may not yield the result we expect.
151
+ Therefore we need to do the following extra checks.
152
+ */
153
+ $ht_contents_imploded = implode('', file($htaccess));
154
+ if(empty($ht_contents_imploded)){
155
+ return 1;
156
+ }else if(strstr($ht_contents_imploded, PHP_EOL)) {
157
+ $ht_contents = explode(PHP_EOL, $ht_contents_imploded); //parse each line of file into array
158
+ }else if(strstr($ht_contents_imploded, "\n")){
159
+ $ht_contents = explode("\n", $ht_contents_imploded); //parse each line of file into array
160
+ }else if(strstr($ht_contents_imploded, "\r")){
161
+ $ht_contents = explode("\r", $ht_contents_imploded); //parse each line of file into array
162
+ }else if(strstr($ht_contents_imploded, "\r\n")){
163
+ $ht_contents = explode("\r\n", $ht_contents_imploded); //parse each line of file into array
164
+ }
165
+
166
  if ($ht_contents) { //as long as there are lines in the file
167
  $state = true;
168
  if (!$f = @fopen($htaccess, 'w+')) {
191
 
192
  static function getrules()
193
  {
194
+ global $aio_wp_security;
195
  $rules = "";
196
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_wp_file_access();
197
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_basic_htaccess();
207
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_5g_blacklist();
208
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_brute_force_prevention();
209
  $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_spambots();
210
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_login_whitelist_v2();
211
  $rules .= AIOWPSecurity_Utility_Htaccess::prevent_image_hotlinks();
212
+ $custom_rules = AIOWPSecurity_Utility_Htaccess::getrules_custom_rules();
213
+ if($aio_wp_security->configs->get_value('aiowps_place_custom_rules_at_top')=='1'){
214
+ $rules = $custom_rules . $rules;
215
+ }else{
216
+ $rules .= $custom_rules;
217
+ }
218
+
219
  //TODO: The following utility functions are ready to use when we write the menu pages for these features
220
 
221
  //Add more functions for features as needed
450
  $special_case = true;
451
  $rules .= '<IfModule mod_rewrite.c>' . PHP_EOL;
452
  $rules .= 'RewriteEngine on' . PHP_EOL;
453
+ $rules .= 'RewriteCond %{QUERY_STRING} ^' . $secret_slug . '=1.*$' . PHP_EOL;
454
  $rules .= 'RewriteCond %{REMOTE_ADDR} !^' . preg_quote($host_ip) . '[OR]' . PHP_EOL;
455
  } else {
456
  $slug = preg_quote($secret_slug); //escape any applicable chars
554
  return $rules;
555
  }
556
 
557
+ /*
558
+ * (This is an updated and improved version of getrules_enable_login_whitelist())
559
+ * This function will write some directives to allow IPs in the whitelist to access wp-login.php or wp-admin
560
+ * The function also handles the following special cases:
561
+ * 1) If the rename login feature is being used: for this scenario instead of protecting wp-login.php we must protect the special page slug
562
+ * 2) If the rename login feature is being used AND non permalink URL structure: for this case need to use mod_rewrite because we must check QUERY_STRING
563
+ */
564
+ static function getrules_enable_login_whitelist_v2()
565
+ {
566
+ global $aio_wp_security;
567
+ $rules = '';
568
+
569
+ if ($aio_wp_security->configs->get_value('aiowps_enable_whitelisting') == '1') {
570
+ $site_url = AIOWPSEC_WP_URL;
571
+ $parse_url = parse_url($site_url);
572
+ $hostname = $parse_url['host'];
573
+ $host_ip = gethostbyname($hostname);
574
+ $hidden_login_pretty_perms = false;
575
+ $rules .= AIOWPSecurity_Utility_Htaccess::$enable_login_whitelist_marker_start . PHP_EOL; //Add feature marker start
576
+ //If the rename login page feature is active, we will need to adjust the directives
577
+ if ($aio_wp_security->configs->get_value('aiowps_enable_rename_login_page') == '1') {
578
+ $secret_slug = $aio_wp_security->configs->get_value('aiowps_login_page_slug');
579
+ if (get_option('permalink_structure')) {
580
+ $slug = preg_quote($secret_slug); //escape any applicable chars
581
+ $rules .= '<FilesMatch "^(' . $slug . ')">' . PHP_EOL;
582
+ } else {
583
+ //standard url structure is being used - ie, non permalinks
584
+ $hidden_login_pretty_perms = true;
585
+ $rules .= '<IfModule mod_rewrite.c>' . PHP_EOL;
586
+ $rules .= 'RewriteEngine on' . PHP_EOL;
587
+ $rules .= 'RewriteCond %{QUERY_STRING} ^' . $secret_slug . '=1.*$' . PHP_EOL;
588
+ $rules .= 'RewriteCond %{REMOTE_ADDR} !^' . preg_quote($host_ip) . PHP_EOL;
589
+ }
590
+ } else {
591
+ $rules .= '<FilesMatch "^(wp-login\.php)">' . PHP_EOL;
592
+ }
593
+ $rules_apache_pre_24 = '';
594
+ $rules_apache_24 = '';
595
+ if (!$hidden_login_pretty_perms) {
596
+ //start writing rules for versions of apache < 2.4
597
+ $rules_apache_pre_24 .= '<IfModule !mod_authz_core.c>' . PHP_EOL;
598
+ $rules_apache_pre_24 .= 'Order Allow,Deny' . PHP_EOL;
599
+ $rules_apache_pre_24 .= 'Allow from ' . $hostname . PHP_EOL;
600
+ $rules_apache_pre_24 .= 'Allow from ' . $host_ip . PHP_EOL;
601
+
602
+ //start writing rules for versions of apache >=2.4
603
+ $rules_apache_24 .= '<IfModule mod_authz_core.c>' . PHP_EOL;
604
+ $rules_apache_24 .= 'Require all denied' . PHP_EOL;
605
+ $rules_apache_24 .= 'Require local' . PHP_EOL;
606
+ $rules_apache_24 .= 'Require ip 127.0.0.1' . PHP_EOL;
607
+ $rules_apache_24 .= 'Require host ' . $hostname . PHP_EOL;
608
+ }
609
+
610
+ //Let's get list of whitelisted IPs
611
+ $hosts = AIOWPSecurity_Utility::explode_trim_filter_empty($aio_wp_security->configs->get_value('aiowps_allowed_ip_addresses'));
612
+ // Filter out duplicate lines, add netmask to IP addresses
613
+ $ips_with_netmask = self::add_netmask(array_unique($hosts));
614
+ if(!empty($ips_with_netmask)){
615
+ foreach($ips_with_netmask as $xhost){
616
+ $ipv6 = false;
617
+ if (strpos($xhost, ':') !== false) {
618
+ //possible ipv6 addr
619
+ //ipv6 - for now we will support only whole ipv6 addresses, NOT ranges
620
+ $ipv6 = WP_Http::is_ip_address($xhost);
621
+ if (FALSE === $ipv6) {
622
+ continue;
623
+ }
624
+ }
625
+ $ip_range = substr($xhost, 0, strpos($xhost, "/")); //check if address range
626
+ if($hidden_login_pretty_perms){
627
+ if(!empty($ip_range)){
628
+ $xhost = $ip_range; //get the IP minus the slash with netmask bits
629
+ }
630
+ if(!$ipv6){
631
+ $xhost = preg_replace("/[\.0]+$/", ".", $xhost);
632
+ $xhost = preg_quote($xhost);
633
+ }
634
+ $rules .= 'RewriteCond %{REMOTE_ADDR} !^' . $xhost . PHP_EOL;
635
+ }else{
636
+ //write rules for both apache 2.2 and 2.4+
637
+ $rules_apache_pre_24 .= 'Allow from ' . $xhost . PHP_EOL;
638
+ $rules_apache_24 .= 'Require ip '. $xhost . PHP_EOL;
639
+ }
640
+ }
641
+
642
+ }
643
+ if(!empty($rules_apache_pre_24)){
644
+ $rules_apache_pre_24 .= '</IfModule>' . PHP_EOL;
645
+ }
646
+ if(!empty($rules_apache_24)){
647
+ $rules_apache_24 .= '</IfModule>' . PHP_EOL;
648
+ }
649
+ $rules .= $rules_apache_pre_24 . $rules_apache_24;
650
+ if ($hidden_login_pretty_perms) {
651
+ $rules .= 'RewriteRule .* http://127.0.0.1 [L]' . PHP_EOL;
652
+ $rules .= '</IfModule>' . PHP_EOL;
653
+ } else {
654
+ $rules .= '</FilesMatch>' . PHP_EOL;
655
+ }
656
+ $rules .= AIOWPSecurity_Utility_Htaccess::$enable_login_whitelist_marker_end . PHP_EOL; //Add feature marker end
657
+ }
658
+
659
+ return $rules;
660
+ }
661
+
662
  /*
663
  * This function will disable directory listings for all directories, add this line to the
664
  * site’s root .htaccess file.
1230
  * @param array $ips
1231
  * @return array
1232
  */
1233
+ protected static function add_netmask($ips=array()) {
1234
 
1235
  $output = array();
1236
+ if(empty($ips)) return array();
1237
  foreach ( $ips as $ip ) {
1238
+ //Check if ipv6
1239
+ if (strpos($ip, ':') !== false) {
1240
+ //for now we'll only support whole ipv6 (not address ranges)
1241
+ $ipv6 = WP_Http::is_ip_address($ip);
1242
+ if (FALSE === $ipv6) {
1243
+ continue;
1244
+ }
1245
+ $output[] = $ip;
1246
+ }
1247
+
1248
 
1249
  $parts = explode('.', $ip);
1250
 
classes/wp-security-utility-ip-address.php CHANGED
@@ -74,7 +74,7 @@ class AIOWPSecurity_Utility_IP
74
  //possible ipv6 addr
75
  $res = WP_Http::is_ip_address($item);
76
  if(FALSE === $res){
77
- $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall').'</p>';
78
  }else if($res == '6'){
79
  $list[] = trim($item);
80
  }
@@ -89,7 +89,7 @@ class AIOWPSecurity_Utility_IP
89
 
90
  if (count($ipParts) < 2)
91
  {
92
- $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall').'</p>';
93
  continue;
94
  }
95
 
@@ -108,7 +108,7 @@ class AIOWPSecurity_Utility_IP
108
  if (trim($part) == '*')
109
  {
110
  $goodip = false;
111
- $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall').'</p>';
112
  }
113
  break;
114
  case 2:
@@ -123,7 +123,7 @@ class AIOWPSecurity_Utility_IP
123
  if ($foundwild == true)
124
  {
125
  $goodip = false;
126
- $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall').'</p>';
127
  }
128
  }
129
  else
@@ -138,7 +138,7 @@ class AIOWPSecurity_Utility_IP
138
  }
139
  if (ip2long(trim(str_replace('*', '0', $item))) == false)
140
  { //invalid ip
141
- $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall').'</p>';
142
  }
143
  elseif (strlen($item) > 4 && !in_array($item, $list))
144
  {
@@ -146,7 +146,7 @@ class AIOWPSecurity_Utility_IP
146
  if ($current_user_ip == $item && $list_type == 'blacklist')
147
  {
148
  //You can't ban your own IP
149
- $errors .= '<p>'.__('You cannot ban your own IP address: ', 'all-in-one-wp-security-and-firewall').$item.'</p>';
150
  }
151
  else
152
  {
74
  //possible ipv6 addr
75
  $res = WP_Http::is_ip_address($item);
76
  if(FALSE === $res){
77
+ $errors .= "\n".$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall');
78
  }else if($res == '6'){
79
  $list[] = trim($item);
80
  }
89
 
90
  if (count($ipParts) < 2)
91
  {
92
+ $errors .= "\n".$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall');
93
  continue;
94
  }
95
 
108
  if (trim($part) == '*')
109
  {
110
  $goodip = false;
111
+ $errors .= "\n".$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall');
112
  }
113
  break;
114
  case 2:
123
  if ($foundwild == true)
124
  {
125
  $goodip = false;
126
+ $errors .= "\n".$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall');
127
  }
128
  }
129
  else
138
  }
139
  if (ip2long(trim(str_replace('*', '0', $item))) == false)
140
  { //invalid ip
141
+ $errors .= "\n".$item.__(' is not a valid ip address format.', 'all-in-one-wp-security-and-firewall');
142
  }
143
  elseif (strlen($item) > 4 && !in_array($item, $list))
144
  {
146
  if ($current_user_ip == $item && $list_type == 'blacklist')
147
  {
148
  //You can't ban your own IP
149
+ $errors .= "\n".__('You cannot ban your own IP address: ', 'all-in-one-wp-security-and-firewall').$item;
150
  }
151
  else
152
  {
lib/whois/whois.cl.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
  /*
3
  Whois.php PHP classes to conduct whois queries
4
 
1
+ <?php
2
  /*
3
  Whois.php PHP classes to conduct whois queries
4
 
lib/whois/whois.client.php CHANGED
@@ -1,595 +1,595 @@
1
- <?php
2
- /*
3
- Whois.php PHP classes to conduct whois queries
4
-
5
- Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
-
7
- Maintained by David Saez
8
-
9
- For the most recent version of this package visit:
10
-
11
- http://www.phpwhois.org
12
-
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
- */
27
-
28
- require_once('whois.ip.lib.php');
29
-
30
- class WhoisClient {
31
-
32
- // Recursion allowed ?
33
- var $gtld_recurse = false;
34
-
35
- // Default WHOIS port
36
- var $PORT = 43;
37
-
38
- // Maximum number of retries on connection failure
39
- var $RETRY = 0;
40
-
41
- // Time to wait between retries
42
- var $SLEEP = 2;
43
-
44
- // Read buffer size (0 == char by char)
45
- var $BUFFER = 1024;
46
-
47
- // Communications timeout
48
- var $STIMEOUT = 10;
49
-
50
- // List of servers and handlers (loaded from servers.whois)
51
- var $DATA = array();
52
-
53
- // Array to contain all query variables
54
- var $Query = array(
55
- 'tld' => '',
56
- 'type' => 'domain',
57
- 'query' => '',
58
- 'status',
59
- 'server'
60
- );
61
-
62
- // This release of the package
63
- var $CODE_VERSION = '4.2.2';
64
-
65
- // Full code and data version string (e.g. 'Whois2.php v3.01:16')
66
- var $VERSION;
67
-
68
- /*
69
- * Constructor function
70
- */
71
- function __construct () {
72
- // Load DATA array
73
- @require('whois.servers.php');
74
-
75
- // Set version
76
- $this->VERSION = sprintf("phpWhois v%s-%s", $this->CODE_VERSION, $this->DATA_VERSION);
77
- }
78
-
79
- /*
80
- * Perform lookup
81
- */
82
-
83
- function GetRawData ($query) {
84
-
85
- $this->Query['query'] = $query;
86
-
87
- // clear error description
88
- if (isset($this->Query['errstr'])) unset($this->Query['errstr']);
89
-
90
- if (!isset($this->Query['server'])) {
91
- $this->Query['status'] = 'error';
92
- $this->Query['errstr'][] = 'No server specified';
93
- return(array());
94
- }
95
-
96
- // Check if protocol is http
97
-
98
- if (substr($this->Query['server'],0,7)=='http://' ||
99
- substr($this->Query['server'],0,8)=='https://')
100
- {
101
- $output = $this->httpQuery($this->Query['server']);
102
-
103
- if (!$output)
104
- {
105
- $this->Query['status'] = 'error';
106
- $this->Query['errstr'][] = 'Connect failed to: '.$this->Query['server'];
107
- return(array());
108
- }
109
-
110
- $this->Query['args'] = substr(strchr($this->Query['server'],'?'),1);
111
- $this->Query['server'] = strtok($this->Query['server'],'?');
112
-
113
- if (substr($this->Query['server'],0,7)=='http://')
114
- $this->Query['server_port'] = 80;
115
- else
116
- $this->Query['server_port'] = 483;
117
- }
118
- else
119
- {
120
- // Get args
121
-
122
- if (strpos($this->Query['server'],'?'))
123
- {
124
- $parts = explode('?',$this->Query['server']);
125
- $this->Query['server'] = trim($parts[0]);
126
- $query_args = trim($parts[1]);
127
-
128
- // replace substitution parameters
129
- $query_args = str_replace('{query}', $query, $query_args);
130
- $query_args = str_replace('{version}', 'phpWhois'.$this->CODE_VERSION, $query_args);
131
-
132
- if (strpos($query_args,'{ip}')!==false)
133
- {
134
- $query_args = str_replace('{ip}', phpwhois_getclientip(), $query_args);
135
- }
136
-
137
- if (strpos($query_args,'{hname}')!==false)
138
- {
139
- $query_args = str_replace('{hname}', gethostbyaddr(phpwhois_getclientip()), $query_args);
140
- }
141
- }
142
- else
143
- {
144
- if (empty($this->Query['args']))
145
- $query_args = $query;
146
- else
147
- $query_args = $this->Query['args'];
148
- }
149
-
150
- $this->Query['args'] = $query_args;
151
-
152
- if (substr($this->Query['server'],0,9) == 'rwhois://')
153
- {
154
- $this->Query['server'] = substr($this->Query['server'],9);
155
- }
156
-
157
- if (substr($this->Query['server'],0,8) == 'whois://')
158
- {
159
- $this->Query['server'] = substr($this->Query['server'],8);
160
- }
161
-
162
- // Get port
163
-
164
- if (strpos($this->Query['server'],':'))
165
- {
166
- $parts = explode(':',$this->Query['server']);
167
- $this->Query['server'] = trim($parts[0]);
168
- $this->Query['server_port'] = trim($parts[1]);
169
- }
170
- else
171
- $this->Query['server_port'] = $this->PORT;
172
-
173
- // Connect to whois server, or return if failed
174
-
175
- $ptr = $this->Connect();
176
-
177
- if($ptr < 0) {
178
- $this->Query['status'] = 'error';
179
- $this->Query['errstr'][] = 'Connect failed to: '.$this->Query['server'];
180
- return array();
181
- }
182
-
183
- stream_set_timeout($ptr,$this->STIMEOUT);
184
- stream_set_blocking($ptr,0);
185
-
186
- // Send query
187
- fputs($ptr, trim($query_args)."\r\n");
188
-
189
- // Prepare to receive result
190
- $raw = '';
191
- $start = time();
192
- $null = NULL;
193
- $r = array($ptr);
194
-
195
- while (!feof($ptr))
196
- {
197
- if (stream_select($r,$null,$null,$this->STIMEOUT))
198
- {
199
- $raw .= fgets($ptr, $this->BUFFER);
200
- }
201
-
202
- if (time()-$start > $this->STIMEOUT)
203
- {
204
- $this->Query['status'] = 'error';
205
- $this->Query['errstr'][] = 'Timeout reading from '.$this->Query['server'];
206
- return array();
207
- }
208
- }
209
-
210
- if (array_key_exists($this->Query['server'],$this->NON_UTF8))
211
- {
212
- $raw = utf8_encode($raw);
213
- }
214
-
215
- $output = explode("\n", $raw);
216
-
217
- // Drop empty last line (if it's empty! - saleck)
218
- if (empty($output[count($output)-1]))
219
- unset($output[count($output)-1]);
220
- }
221
-
222
- return $output;
223
- }
224
-
225
- /*
226
- * Perform lookup. Returns an array. The 'rawdata' element contains an
227
- * array of lines gathered from the whois query. If a top level domain
228
- * handler class was found for the domain, other elements will have been
229
- * populated too.
230
- */
231
-
232
- function GetData ($query='', $deep_whois=true) {
233
-
234
- // If domain to query passed in, use it, otherwise use domain from initialisation
235
- $query = !empty($query) ? $query : $this->Query['query'];
236
-
237
- $output = $this->GetRawData($query);
238
-
239
- // Create result and set 'rawdata'
240
- $result = array( 'rawdata' => $output );
241
- $result = $this->set_whois_info($result);
242
-
243
- // Return now on error
244
- if (empty($output)) return $result;
245
-
246
- // If we have a handler, post-process it with it
247
- if (isSet($this->Query['handler']))
248
- {
249
- // Keep server list
250
- $servers = $result['regyinfo']['servers'];
251
- unset($result['regyinfo']['servers']);
252
-
253
- // Process data
254
- $result = $this->Process($result,$deep_whois);
255
-
256
- // Add new servers to the server list
257
- if (isset($result['regyinfo']['servers']))
258
- $result['regyinfo']['servers'] = array_merge($servers,$result['regyinfo']['servers']);
259
- else
260
- $result['regyinfo']['servers'] = $servers;
261
-
262
- // Handler may forget to set rawdata
263
- if (empty($result['rawdata']))
264
- $result['rawdata'] = $output;
265
- }
266
-
267
- // Type defaults to domain
268
- if (!isset($result['regyinfo']['type']))
269
- $result['regyinfo']['type'] = 'domain';
270
-
271
- // Add error information if any
272
- if (isset($this->Query['errstr']))
273
- $result['errstr'] = $this->Query['errstr'];
274
-
275
- // Fix/add nameserver information
276
- if (method_exists($this,'FixResult') && $this->Query['tld'] != 'ip')
277
- $this->FixResult($result,$query);
278
-
279
- return($result);
280
- }
281
-
282
- /*
283
- * Adds whois server query information to result
284
- */
285
-
286
- function set_whois_info ($result)
287
- {
288
- $info = array(
289
- 'server'=> $this->Query['server'],
290
- );
291
-
292
- if (!empty($this->Query['args']))
293
- $info['args'] = $this->Query['args'];
294
- else
295
- $info['args'] = $this->Query['query'];
296
-
297
- if (!empty($this->Query['server_port']))
298
- $info['port'] = $this->Query['server_port'];
299
- else
300
- $info['port'] = 43;
301
-
302
- if (isset($result['regyinfo']['whois']))
303
- unset($result['regyinfo']['whois']);
304
-
305
- if (isset($result['regyinfo']['rwhois']))
306
- unset($result['regyinfo']['rwhois']);
307
-
308
- $result['regyinfo']['servers'][] = $info;
309
-
310
- return $result;
311
- }
312
-
313
- /*
314
- * Convert html output to plain text
315
- */
316
- function httpQuery ($query) {
317
-
318
- //echo ini_get('allow_url_fopen');
319
-
320
- //if (ini_get('allow_url_fopen'))
321
- $lines = @file($this->Query['server']);
322
-
323
- if (!$lines) return false;
324
-
325
- $output = '';
326
- $pre = '';
327
-
328
- while (list($key, $val)=each($lines)) {
329
- $val = trim($val);
330
-
331
- $pos=strpos(strtoupper($val),'<PRE>');
332
- if ($pos!==false) {
333
- $pre = "\n";
334
- $output.=substr($val,0,$pos)."\n";
335
- $val = substr($val,$pos+5);
336
- }
337
- $pos=strpos(strtoupper($val),'</PRE>');
338
- if ($pos!==false) {
339
- $pre = '';
340
- $output.=substr($val,0,$pos)."\n";
341
- $val = substr($val,$pos+6);
342
- }
343
- $output.=$val.$pre;
344
- }
345
-
346
- $search = array (
347
- '<BR>', '<P>', '</TITLE>',
348
- '</H1>', '</H2>', '</H3>',
349
- '<br>', '<p>', '</title>',
350
- '</h1>', '</h2>', '</h3>' );
351
-
352
- $output = str_replace($search,"\n",$output);
353
- $output = str_replace('<TD',' <td',$output);
354
- $output = str_replace('<td',' <td',$output);
355
- $output = str_replace('<tr',"\n<tr",$output);
356
- $output = str_replace('<TR',"\n<tr",$output);
357
- $output = str_replace('&nbsp;',' ',$output);
358
- $output = strip_tags($output);
359
- $output = explode("\n",$output);
360
-
361
- $rawdata = array();
362
- $null = 0;
363
-
364
- while (list($key, $val)=each($output)) {
365
- $val=trim($val);
366
- if ($val=='') {
367
- if (++$null>2) continue;
368
- }
369
- else $null=0;
370
- $rawdata[]=$val;
371
- }
372
- return $rawdata;
373
- }
374
-
375
- /*
376
- * Open a socket to the whois server.
377
- *
378
- * Returns a socket connection pointer on success, or -1 on failure.
379
- */
380
- function Connect ($server = '') {
381
-
382
- if ($server == '')
383
- $server = $this->Query['server'];
384
-
385
- // Fail if server not set
386
- if($server == '')
387
- return(-1);
388
-
389
- // Get rid of protocol and/or get port
390
- $port = $this->Query['server_port'];
391
-
392
- $pos = strpos($server,'://');
393
-
394
- if ($pos !== false)
395
- $server = substr($server, $pos+3);
396
-
397
- $pos = strpos($server,':');
398
-
399
- if ($pos !== false)
400
- {
401
- $port = substr($server,$pos+1);
402
- $server = substr($server,0,$pos);
403
- }
404
-
405
- // Enter connection attempt loop
406
- $retry = 0;
407
-
408
- while($retry <= $this->RETRY) {
409
- // Set query status
410
- $this->Query['status'] = 'ready';
411
-
412
- // Connect to whois port
413
- $ptr = @fsockopen($server, $port, $errno, $errstr, $this->STIMEOUT);
414
-
415
- if($ptr > 0) {
416
- $this->Query['status'] = 'ok';
417
- return($ptr);
418
- }
419
-
420
- // Failed this attempt
421
- $this->Query['status'] = 'error';
422
- $this->Query['error'][] = $errstr;
423
- $retry++;
424
-
425
- // Sleep before retrying
426
- sleep($this->SLEEP);
427
- }
428
-
429
- // If we get this far, it hasn't worked
430
- return(-1);
431
- }
432
-
433
- /*
434
- * Post-process result with handler class. On success, returns the result
435
- * from the handler. On failure, returns passed result unaltered.
436
- */
437
- function Process (&$result, $deep_whois=true) {
438
-
439
- $handler_name = str_replace('.','_',$this->Query['handler']);
440
-
441
- // If the handler has not already been included somehow, include it now
442
- $HANDLER_FLAG = sprintf("__%s_HANDLER__", strtoupper($handler_name));
443
-
444
- if (!defined($HANDLER_FLAG))
445
- include($this->Query['file']);
446
-
447
- // If the handler has still not been included, append to query errors list and return
448
- if (!defined($HANDLER_FLAG))
449
- {
450
- $this->Query['errstr'][] = "Can't find $handler_name handler: ".$this->Query['file'];
451
- return($result);
452
- }
453
-
454
- if (!$this->gtld_recurse && $this->Query['file'] == 'whois.gtld.php')
455
- return $result;
456
-
457
- // Pass result to handler
458
- $object = $handler_name.'_handler';
459
-
460
- $handler = new $object('');
461
-
462
- // If handler returned an error, append it to the query errors list
463
- if(isSet($handler->Query['errstr']))
464
- $this->Query['errstr'][] = $handler->Query['errstr'];
465
-
466
- $handler->deep_whois = $deep_whois;
467
-
468
- // Process
469
- $res = $handler->parse($result,$this->Query['query']);
470
-
471
- // Return the result
472
- return $res;
473
- }
474
-
475
- /*
476
- * Does more (deeper) whois ...
477
- */
478
-
479
- function DeepWhois ($query, $result) {
480
-
481
- if (!isset($result['regyinfo']['whois'])) return $result;
482
-
483
- $this->Query['server'] = $wserver = $result['regyinfo']['whois'];
484
- unset($result['regyinfo']['whois']);
485
- $subresult = $this->GetRawData($query);
486
-
487
- if (!empty($subresult))
488
- {
489
- $result = $this->set_whois_info($result);
490
- $result['rawdata'] = $subresult;
491
-
492
- if (isset($this->WHOIS_GTLD_HANDLER[$wserver]))
493
- $this->Query['handler'] = $this->WHOIS_GTLD_HANDLER[$wserver];
494
- else
495
- {
496
- $parts = explode('.',$wserver);
497
- $hname = strtolower($parts[1]);
498
-
499
- if (($fp = @fopen('whois.gtld.'.$hname.'.php', 'r', 1)) and fclose($fp))
500
- $this->Query['handler'] = $hname;
501
- }
502
-
503
- if (!empty($this->Query['handler']))
504
- {
505
- $this->Query['file'] = sprintf('whois.gtld.%s.php', $this->Query['handler']);
506
- $regrinfo = $this->Process($subresult); //$result['rawdata']);
507
- $result['regrinfo'] = $this->merge_results($result['regrinfo'], $regrinfo);
508
- //$result['rawdata'] = $subresult;
509
- }
510
- }
511
-
512
- return $result;
513
- }
514
-
515
- /*
516
- * Merge results
517
- */
518
-
519
- function merge_results($a1, $a2) {
520
-
521
- reset($a2);
522
-
523
- while (list($key, $val) = each($a2))
524
- {
525
- if (isset($a1[$key]))
526
- {
527
- if (is_array($val))
528
- {
529
- if ($key != 'nserver')
530
- $a1[$key] = $this->merge_results($a1[$key], $val);
531
- }
532
- else
533
- {
534
- $val = trim($val);
535
- if ($val != '')
536
- $a1[$key] = $val;
537
- }
538
- }
539
- else
540
- $a1[$key] = $val;
541
- }
542
-
543
- return $a1;
544
- }
545
-
546
- function FixNameServer($nserver)
547
- {
548
- $dns = array();
549
-
550
- foreach($nserver as $val)
551
- {
552
- $val = str_replace( array('[',']','(',')'), '', trim($val));
553
- $val = str_replace("\t", ' ', $val);
554
- $parts = explode(' ', $val);
555
- $host = '';
556
- $ip = '';
557
-
558
- foreach($parts as $p)
559
- {
560
- if (substr($p,-1) == '.') $p = substr($p,0,-1);
561
-
562
- if ((ip2long($p) == - 1) or (ip2long($p) === false))
563
- {
564
- // Hostname ?
565
- if ($host == '' && preg_match('/^[\w\-]+(\.[\w\-]+)+$/',$p))
566
- {
567
- $host = $p;
568
- }
569
- }
570
- else
571
- // IP Address
572
- $ip = $p;
573
- }
574
-
575
- // Valid host name ?
576
-
577
- if ($host == '') continue;
578
-
579
- // Get ip address
580
-
581
- if ($ip == '')
582
- {
583
- $ip = gethostbyname($host);
584
- if ($ip == $host) $ip = '(DOES NOT EXIST)';
585
- }
586
-
587
- if (substr($host,-1,1) == '.') $host = substr($host,0,-1);
588
-
589
- $dns[strtolower($host)] = $ip;
590
- }
591
-
592
- return $dns;
593
- }
594
- }
595
  ?>
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.ip.lib.php');
29
+
30
+ class WhoisClient {
31
+
32
+ // Recursion allowed ?
33
+ var $gtld_recurse = false;
34
+
35
+ // Default WHOIS port
36
+ var $PORT = 43;
37
+
38
+ // Maximum number of retries on connection failure
39
+ var $RETRY = 0;
40
+
41
+ // Time to wait between retries
42
+ var $SLEEP = 2;
43
+
44
+ // Read buffer size (0 == char by char)
45
+ var $BUFFER = 1024;
46
+
47
+ // Communications timeout
48
+ var $STIMEOUT = 10;
49
+
50
+ // List of servers and handlers (loaded from servers.whois)
51
+ var $DATA = array();
52
+
53
+ // Array to contain all query variables
54
+ var $Query = array(
55
+ 'tld' => '',
56
+ 'type' => 'domain',
57
+ 'query' => '',
58
+ 'status',
59
+ 'server'
60
+ );
61
+
62
+ // This release of the package
63
+ var $CODE_VERSION = '4.2.2';
64
+
65
+ // Full code and data version string (e.g. 'Whois2.php v3.01:16')
66
+ var $VERSION;
67
+
68
+ /*
69
+ * Constructor function
70
+ */
71
+ function __construct () {
72
+ // Load DATA array
73
+ @require('whois.servers.php');
74
+
75
+ // Set version
76
+ $this->VERSION = sprintf("phpWhois v%s-%s", $this->CODE_VERSION, $this->DATA_VERSION);
77
+ }
78
+
79
+ /*
80
+ * Perform lookup
81
+ */
82
+
83
+ function GetRawData ($query) {
84
+
85
+ $this->Query['query'] = $query;
86
+
87
+ // clear error description
88
+ if (isset($this->Query['errstr'])) unset($this->Query['errstr']);
89
+
90
+ if (!isset($this->Query['server'])) {
91
+ $this->Query['status'] = 'error';
92
+ $this->Query['errstr'][] = 'No server specified';
93
+ return(array());
94
+ }
95
+
96
+ // Check if protocol is http
97
+
98
+ if (substr($this->Query['server'],0,7)=='http://' ||
99
+ substr($this->Query['server'],0,8)=='https://')
100
+ {
101
+ $output = $this->httpQuery($this->Query['server']);
102
+
103
+ if (!$output)
104
+ {
105
+ $this->Query['status'] = 'error';
106
+ $this->Query['errstr'][] = 'Connect failed to: '.$this->Query['server'];
107
+ return(array());
108
+ }
109
+
110
+ $this->Query['args'] = substr(strchr($this->Query['server'],'?'),1);
111
+ $this->Query['server'] = strtok($this->Query['server'],'?');
112
+
113
+ if (substr($this->Query['server'],0,7)=='http://')
114
+ $this->Query['server_port'] = 80;
115
+ else
116
+ $this->Query['server_port'] = 483;
117
+ }
118
+ else
119
+ {
120
+ // Get args
121
+
122
+ if (strpos($this->Query['server'],'?'))
123
+ {
124
+ $parts = explode('?',$this->Query['server']);
125
+ $this->Query['server'] = trim($parts[0]);
126
+ $query_args = trim($parts[1]);
127
+
128
+ // replace substitution parameters
129
+ $query_args = str_replace('{query}', $query, $query_args);
130
+ $query_args = str_replace('{version}', 'phpWhois'.$this->CODE_VERSION, $query_args);
131
+
132
+ if (strpos($query_args,'{ip}')!==false)
133
+ {
134
+ $query_args = str_replace('{ip}', phpwhois_getclientip(), $query_args);
135
+ }
136
+
137
+ if (strpos($query_args,'{hname}')!==false)
138
+ {
139
+ $query_args = str_replace('{hname}', gethostbyaddr(phpwhois_getclientip()), $query_args);
140
+ }
141
+ }
142
+ else
143
+ {
144
+ if (empty($this->Query['args']))
145
+ $query_args = $query;
146
+ else
147
+ $query_args = $this->Query['args'];
148
+ }
149
+
150
+ $this->Query['args'] = $query_args;
151
+
152
+ if (substr($this->Query['server'],0,9) == 'rwhois://')
153
+ {
154
+ $this->Query['server'] = substr($this->Query['server'],9);
155
+ }
156
+
157
+ if (substr($this->Query['server'],0,8) == 'whois://')
158
+ {
159
+ $this->Query['server'] = substr($this->Query['server'],8);
160
+ }
161
+
162
+ // Get port
163
+
164
+ if (strpos($this->Query['server'],':'))
165
+ {
166
+ $parts = explode(':',$this->Query['server']);
167
+ $this->Query['server'] = trim($parts[0]);
168
+ $this->Query['server_port'] = trim($parts[1]);
169
+ }
170
+ else
171
+ $this->Query['server_port'] = $this->PORT;
172
+
173
+ // Connect to whois server, or return if failed
174
+
175
+ $ptr = $this->Connect();
176
+
177
+ if($ptr < 0) {
178
+ $this->Query['status'] = 'error';
179
+ $this->Query['errstr'][] = 'Connect failed to: '.$this->Query['server'];
180
+ return array();
181
+ }
182
+
183
+ stream_set_timeout($ptr,$this->STIMEOUT);
184
+ stream_set_blocking($ptr,0);
185
+
186
+ // Send query
187
+ fputs($ptr, trim($query_args)."\r\n");
188
+
189
+ // Prepare to receive result
190
+ $raw = '';
191
+ $start = time();
192
+ $null = NULL;
193
+ $r = array($ptr);
194
+
195
+ while (!feof($ptr))
196
+ {
197
+ if (stream_select($r,$null,$null,$this->STIMEOUT))
198
+ {
199
+ $raw .= fgets($ptr, $this->BUFFER);
200
+ }
201
+
202
+ if (time()-$start > $this->STIMEOUT)
203
+ {
204
+ $this->Query['status'] = 'error';
205
+ $this->Query['errstr'][] = 'Timeout reading from '.$this->Query['server'];
206
+ return array();
207
+ }
208
+ }
209
+
210
+ if (array_key_exists($this->Query['server'],$this->NON_UTF8))
211
+ {
212
+ $raw = utf8_encode($raw);
213
+ }
214
+
215
+ $output = explode("\n", $raw);
216
+
217
+ // Drop empty last line (if it's empty! - saleck)
218
+ if (empty($output[count($output)-1]))
219
+ unset($output[count($output)-1]);
220
+ }
221
+
222
+ return $output;
223
+ }
224
+
225
+ /*
226
+ * Perform lookup. Returns an array. The 'rawdata' element contains an
227
+ * array of lines gathered from the whois query. If a top level domain
228
+ * handler class was found for the domain, other elements will have been
229
+ * populated too.
230
+ */
231
+
232
+ function GetData ($query='', $deep_whois=true) {
233
+
234
+ // If domain to query passed in, use it, otherwise use domain from initialisation
235
+ $query = !empty($query) ? $query : $this->Query['query'];
236
+
237
+ $output = $this->GetRawData($query);
238
+
239
+ // Create result and set 'rawdata'
240
+ $result = array( 'rawdata' => $output );
241
+ $result = $this->set_whois_info($result);
242
+
243
+ // Return now on error
244
+ if (empty($output)) return $result;
245
+
246
+ // If we have a handler, post-process it with it
247
+ if (isSet($this->Query['handler']))
248
+ {
249
+ // Keep server list
250
+ $servers = $result['regyinfo']['servers'];
251
+ unset($result['regyinfo']['servers']);
252
+
253
+ // Process data
254
+ $result = $this->Process($result,$deep_whois);
255
+
256
+ // Add new servers to the server list
257
+ if (isset($result['regyinfo']['servers']))
258
+ $result['regyinfo']['servers'] = array_merge($servers,$result['regyinfo']['servers']);
259
+ else
260
+ $result['regyinfo']['servers'] = $servers;
261
+
262
+ // Handler may forget to set rawdata
263
+ if (empty($result['rawdata']))
264
+ $result['rawdata'] = $output;
265
+ }
266
+
267
+ // Type defaults to domain
268
+ if (!isset($result['regyinfo']['type']))
269
+ $result['regyinfo']['type'] = 'domain';
270
+
271
+ // Add error information if any
272
+ if (isset($this->Query['errstr']))
273
+ $result['errstr'] = $this->Query['errstr'];
274
+
275
+ // Fix/add nameserver information
276
+ if (method_exists($this,'FixResult') && $this->Query['tld'] != 'ip')
277
+ $this->FixResult($result,$query);
278
+
279
+ return($result);
280
+ }
281
+
282
+ /*
283
+ * Adds whois server query information to result
284
+ */
285
+
286
+ function set_whois_info ($result)
287
+ {
288
+ $info = array(
289
+ 'server'=> $this->Query['server'],
290
+ );
291
+
292
+ if (!empty($this->Query['args']))
293
+ $info['args'] = $this->Query['args'];
294
+ else
295
+ $info['args'] = $this->Query['query'];
296
+
297
+ if (!empty($this->Query['server_port']))
298
+ $info['port'] = $this->Query['server_port'];
299
+ else
300
+ $info['port'] = 43;
301
+
302
+ if (isset($result['regyinfo']['whois']))
303
+ unset($result['regyinfo']['whois']);
304
+
305
+ if (isset($result['regyinfo']['rwhois']))
306
+ unset($result['regyinfo']['rwhois']);
307
+
308
+ $result['regyinfo']['servers'][] = $info;
309
+
310
+ return $result;
311
+ }
312
+
313
+ /*
314
+ * Convert html output to plain text
315
+ */
316
+ function httpQuery ($query) {
317
+
318
+ //echo ini_get('allow_url_fopen');
319
+
320
+ //if (ini_get('allow_url_fopen'))
321
+ $lines = @file($this->Query['server']);
322
+
323
+ if (!$lines) return false;
324
+
325
+ $output = '';
326
+ $pre = '';
327
+
328
+ while (list($key, $val)=each($lines)) {
329
+ $val = trim($val);
330
+
331
+ $pos=strpos(strtoupper($val),'<PRE>');
332
+ if ($pos!==false) {
333
+ $pre = "\n";
334
+ $output.=substr($val,0,$pos)."\n";
335
+ $val = substr($val,$pos+5);
336
+ }
337
+ $pos=strpos(strtoupper($val),'</PRE>');
338
+ if ($pos!==false) {
339
+ $pre = '';
340
+ $output.=substr($val,0,$pos)."\n";
341
+ $val = substr($val,$pos+6);
342
+ }
343
+ $output.=$val.$pre;
344
+ }
345
+
346
+ $search = array (
347
+ '<BR>', '<P>', '</TITLE>',
348
+ '</H1>', '</H2>', '</H3>',
349
+ '<br>', '<p>', '</title>',
350
+ '</h1>', '</h2>', '</h3>' );
351
+
352
+ $output = str_replace($search,"\n",$output);
353
+ $output = str_replace('<TD',' <td',$output);
354
+ $output = str_replace('<td',' <td',$output);
355
+ $output = str_replace('<tr',"\n<tr",$output);
356
+ $output = str_replace('<TR',"\n<tr",$output);
357
+ $output = str_replace('&nbsp;',' ',$output);
358
+ $output = strip_tags($output);
359
+ $output = explode("\n",$output);
360
+
361
+ $rawdata = array();
362
+ $null = 0;
363
+
364
+ while (list($key, $val)=each($output)) {
365
+ $val=trim($val);
366
+ if ($val=='') {
367
+ if (++$null>2) continue;
368
+ }
369
+ else $null=0;
370
+ $rawdata[]=$val;
371
+ }
372
+ return $rawdata;
373
+ }
374
+
375
+ /*
376
+ * Open a socket to the whois server.
377
+ *
378
+ * Returns a socket connection pointer on success, or -1 on failure.
379
+ */
380
+ function Connect ($server = '') {
381
+
382
+ if ($server == '')
383
+ $server = $this->Query['server'];
384
+
385
+ // Fail if server not set
386
+ if($server == '')
387
+ return(-1);
388
+
389
+ // Get rid of protocol and/or get port
390
+ $port = $this->Query['server_port'];
391
+
392
+ $pos = strpos($server,'://');
393
+
394
+ if ($pos !== false)
395
+ $server = substr($server, $pos+3);
396
+
397
+ $pos = strpos($server,':');
398
+
399
+ if ($pos !== false)
400
+ {
401
+ $port = substr($server,$pos+1);
402
+ $server = substr($server,0,$pos);
403
+ }
404
+
405
+ // Enter connection attempt loop
406
+ $retry = 0;
407
+
408
+ while($retry <= $this->RETRY) {
409
+ // Set query status
410
+ $this->Query['status'] = 'ready';
411
+
412
+ // Connect to whois port
413
+ $ptr = @fsockopen($server, $port, $errno, $errstr, $this->STIMEOUT);
414
+
415
+ if($ptr > 0) {
416
+ $this->Query['status'] = 'ok';
417
+ return($ptr);
418
+ }
419
+
420
+ // Failed this attempt
421
+ $this->Query['status'] = 'error';
422
+ $this->Query['error'][] = $errstr;
423
+ $retry++;
424
+
425
+ // Sleep before retrying
426
+ sleep($this->SLEEP);
427
+ }
428
+
429
+ // If we get this far, it hasn't worked
430
+ return(-1);
431
+ }
432
+
433
+ /*
434
+ * Post-process result with handler class. On success, returns the result
435
+ * from the handler. On failure, returns passed result unaltered.
436
+ */
437
+ function Process (&$result, $deep_whois=true) {
438
+
439
+ $handler_name = str_replace('.','_',$this->Query['handler']);
440
+
441
+ // If the handler has not already been included somehow, include it now
442
+ $HANDLER_FLAG = sprintf("__%s_HANDLER__", strtoupper($handler_name));
443
+
444
+ if (!defined($HANDLER_FLAG))
445
+ include($this->Query['file']);
446
+
447
+ // If the handler has still not been included, append to query errors list and return
448
+ if (!defined($HANDLER_FLAG))
449
+ {
450
+ $this->Query['errstr'][] = "Can't find $handler_name handler: ".$this->Query['file'];
451
+ return($result);
452
+ }
453
+
454
+ if (!$this->gtld_recurse && $this->Query['file'] == 'whois.gtld.php')
455
+ return $result;
456
+
457
+ // Pass result to handler
458
+ $object = $handler_name.'_handler';
459
+
460
+ $handler = new $object('');
461
+
462
+ // If handler returned an error, append it to the query errors list
463
+ if(isSet($handler->Query['errstr']))
464
+ $this->Query['errstr'][] = $handler->Query['errstr'];
465
+
466
+ $handler->deep_whois = $deep_whois;
467
+
468
+ // Process
469
+ $res = $handler->parse($result,$this->Query['query']);
470
+
471
+ // Return the result
472
+ return $res;
473
+ }
474
+
475
+ /*
476
+ * Does more (deeper) whois ...
477
+ */
478
+
479
+ function DeepWhois ($query, $result) {
480
+
481
+ if (!isset($result['regyinfo']['whois'])) return $result;
482
+
483
+ $this->Query['server'] = $wserver = $result['regyinfo']['whois'];
484
+ unset($result['regyinfo']['whois']);
485
+ $subresult = $this->GetRawData($query);
486
+
487
+ if (!empty($subresult))
488
+ {
489
+ $result = $this->set_whois_info($result);
490
+ $result['rawdata'] = $subresult;
491
+
492
+ if (isset($this->WHOIS_GTLD_HANDLER[$wserver]))
493
+ $this->Query['handler'] = $this->WHOIS_GTLD_HANDLER[$wserver];
494
+ else
495
+ {
496
+ $parts = explode('.',$wserver);
497
+ $hname = strtolower($parts[1]);
498
+
499
+ if (($fp = @fopen('whois.gtld.'.$hname.'.php', 'r', 1)) and fclose($fp))
500
+ $this->Query['handler'] = $hname;
501
+ }
502
+
503
+ if (!empty($this->Query['handler']))
504
+ {
505
+ $this->Query['file'] = sprintf('whois.gtld.%s.php', $this->Query['handler']);
506
+ $regrinfo = $this->Process($subresult); //$result['rawdata']);
507
+ $result['regrinfo'] = $this->merge_results($result['regrinfo'], $regrinfo);
508
+ //$result['rawdata'] = $subresult;
509
+ }
510
+ }
511
+
512
+ return $result;
513
+ }
514
+
515
+ /*
516
+ * Merge results
517
+ */
518
+
519
+ function merge_results($a1, $a2) {
520
+
521
+ reset($a2);
522
+
523
+ while (list($key, $val) = each($a2))
524
+ {
525
+ if (isset($a1[$key]))
526
+ {
527
+ if (is_array($val))
528
+ {
529
+ if ($key != 'nserver')
530
+ $a1[$key] = $this->merge_results($a1[$key], $val);
531
+ }
532
+ else
533
+ {
534
+ $val = trim($val);
535
+ if ($val != '')
536
+ $a1[$key] = $val;
537
+ }
538
+ }
539
+ else
540
+ $a1[$key] = $val;
541
+ }
542
+
543
+ return $a1;
544
+ }
545
+
546
+ function FixNameServer($nserver)
547
+ {
548
+ $dns = array();
549
+
550
+ foreach($nserver as $val)
551
+ {
552
+ $val = str_replace( array('[',']','(',')'), '', trim($val));
553
+ $val = str_replace("\t", ' ', $val);
554
+ $parts = explode(' ', $val);
555
+ $host = '';
556
+ $ip = '';
557
+
558
+ foreach($parts as $p)
559
+ {
560
+ if (substr($p,-1) == '.') $p = substr($p,0,-1);
561
+
562
+ if ((ip2long($p) == - 1) or (ip2long($p) === false))
563
+ {
564
+ // Hostname ?
565
+ if ($host == '' && preg_match('/^[\w\-]+(\.[\w\-]+)+$/',$p))
566
+ {
567
+ $host = $p;
568
+ }
569
+ }
570
+ else
571
+ // IP Address
572
+ $ip = $p;
573
+ }
574
+
575
+ // Valid host name ?
576
+
577
+ if ($host == '') continue;
578
+
579
+ // Get ip address
580
+
581
+ if ($ip == '')
582
+ {
583
+ $ip = gethostbyname($host);
584
+ if ($ip == $host) $ip = '(DOES NOT EXIST)';
585
+ }
586
+
587
+ if (substr($host,-1,1) == '.') $host = substr($host,0,-1);
588
+
589
+ $dns[strtolower($host)] = $ip;
590
+ }
591
+
592
+ return $dns;
593
+ }
594
+ }
595
  ?>
lib/whois/whois.de.php CHANGED
@@ -64,9 +64,9 @@ class de_handler
64
  );
65
 
66
  if (!isset($r['regrinfo']['domain']['status']) || $r['regrinfo']['domain']['status'] == "free")
67
- {
68
  $r['regrinfo']['registered'] = 'no';
69
- }
70
  else
71
  {
72
  $r['regrinfo']['domain']['changed'] = substr($r['regrinfo']['domain']['changed'], 0, 10);
64
  );
65
 
66
  if (!isset($r['regrinfo']['domain']['status']) || $r['regrinfo']['domain']['status'] == "free")
67
+ {
68
  $r['regrinfo']['registered'] = 'no';
69
+ }
70
  else
71
  {
72
  $r['regrinfo']['domain']['changed'] = substr($r['regrinfo']['domain']['changed'], 0, 10);
lib/whois/whois.gtld.namejuice.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php
2
- /*
3
- Whois.php PHP classes to conduct whois queries
4
-
5
- Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
-
7
- Maintained by David Saez
8
-
9
- For the most recent version of this package visit:
10
-
11
- http://www.phpwhois.org
12
-
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
- */
27
-
28
- if (!defined('__NAMEJUICE_HANDLER__'))
29
- define('__NAMEJUICE_HANDLER__', 1);
30
-
31
- require_once('whois.parser.php');
32
-
33
- class namejuice_handler
34
- {
35
- function parse($data_str, $query)
36
- {
37
- $items = array(
38
- 'owner' => 'Registrant Contact:',
39
- 'admin' => 'Administrative Contact:',
40
- 'tech' => 'Technical Contact:',
41
- 'domain.name' => 'Domain name:',
42
- 'domain.nserver.' => 'Name Servers:',
43
- 'domain.created' => 'Creation date:',
44
- 'domain.expires' => 'Expiration date:',
45
- 'domain.changed' => 'Update date:',
46
- 'domain.status' => 'Status:',
47
- 'domain.sponsor' => 'Registration Service Provided By:'
48
- );
49
-
50
- return easy_parser($data_str, $items, 'dmy', false, true, true);
51
- }
52
- }
53
  ?>
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NAMEJUICE_HANDLER__'))
29
+ define('__NAMEJUICE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class namejuice_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant Contact:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.nserver.' => 'Name Servers:',
43
+ 'domain.created' => 'Creation date:',
44
+ 'domain.expires' => 'Expiration date:',
45
+ 'domain.changed' => 'Update date:',
46
+ 'domain.status' => 'Status:',
47
+ 'domain.sponsor' => 'Registration Service Provided By:'
48
+ );
49
+
50
+ return easy_parser($data_str, $items, 'dmy', false, true, true);
51
+ }
52
+ }
53
  ?>
lib/whois/whois.ip.lib.php CHANGED
@@ -1,99 +1,99 @@
1
- <?php
2
- /*
3
- Whois.php PHP classes to conduct whois queries
4
-
5
- Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
-
7
- Maintained by David Saez
8
-
9
- For the most recent version of this package visit:
10
-
11
- http://www.phpwhois.org
12
-
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
- */
27
-
28
- //-----------------------------------------------------------------
29
- // Check if ip adddress is valid
30
-
31
- function phpwhois_validip($ip)
32
- {
33
-
34
- if (empty($ip))
35
- return false;
36
-
37
- if ((ip2long($ip) == -1) or (ip2long($ip) === false))
38
- return false;
39
-
40
- $reserved_ips = array (
41
- array('0.0.0.0','2.255.255.255'),
42
- array('10.0.0.0','10.255.255.255'),
43
- array('127.0.0.0','127.255.255.255'),
44
- array('169.254.0.0','169.254.255.255'),
45
- array('172.16.0.0','172.31.255.255'),
46
- array('192.0.2.0','192.0.2.255'),
47
- array('192.168.0.0','192.168.255.255'),
48
- array('255.255.255.0','255.255.255.255')
49
- );
50
-
51
- foreach ($reserved_ips as $r)
52
- {
53
- $min = ip2long($r[0]);
54
- $max = ip2long($r[1]);
55
- if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
56
- }
57
-
58
- return true;
59
- }
60
-
61
- //-----------------------------------------------------------------
62
- // Get real client ip address
63
-
64
- function phpwhois_getclientip()
65
- {
66
- if (!empty($_SERVER['HTTP_CLIENT_IP']) && phpwhois_validip($_SERVER['HTTP_CLIENT_IP']))
67
- return $_SERVER['HTTP_CLIENT_IP'];
68
-
69
- if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
70
- foreach (explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']) as $ip)
71
- if (phpwhois_validip(trim($ip)))
72
- return $ip;
73
-
74
- if (!empty($_SERVER['HTTP_X_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_X_FORWARDED']))
75
- return $_SERVER['HTTP_X_FORWARDED'];
76
-
77
- if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && phpwhois_validip($_SERVER['HTTP_FORWARDED_FOR']))
78
- return $_SERVER['HTTP_FORWARDED_FOR'];
79
-
80
- if (!empty($_SERVER['HTTP_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_FORWARDED']))
81
- return $_SERVER['HTTP_FORWARDED'];
82
-
83
- if (!empty($_SERVER['HTTP_X_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_X_FORWARDED']))
84
- return $_SERVER['HTTP_X_FORWARDED'];
85
-
86
- return $_SERVER['REMOTE_ADDR'];
87
- }
88
-
89
  //-----------------------------------------------------------------
90
- // Convert from CIDR to net range
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  function phpwhois_cidr_conv($net)
93
  {
94
  $start = strtok($net, '/');
95
  $n = 3-substr_count($net, '.');
96
-
97
  if ($n > 0)
98
  {
99
  for ($i = $n; $i > 0; $i--)
@@ -114,7 +114,7 @@ function phpwhois_cidr_conv($net)
114
  if ($bits1[$i] == 0 and $bits2[$i] == 1)
115
  $final.= $bits2[$i];
116
  }
117
-
118
  return $start." - ".long2ip(bindec($final));
119
- }
120
  ?>
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ //-----------------------------------------------------------------
29
+ // Check if ip adddress is valid
30
+
31
+ function phpwhois_validip($ip)
32
+ {
33
+
34
+ if (empty($ip))
35
+ return false;
36
+
37
+ if ((ip2long($ip) == -1) or (ip2long($ip) === false))
38
+ return false;
39
+
40
+ $reserved_ips = array (
41
+ array('0.0.0.0','2.255.255.255'),
42
+ array('10.0.0.0','10.255.255.255'),
43
+ array('127.0.0.0','127.255.255.255'),
44
+ array('169.254.0.0','169.254.255.255'),
45
+ array('172.16.0.0','172.31.255.255'),
46
+ array('192.0.2.0','192.0.2.255'),
47
+ array('192.168.0.0','192.168.255.255'),
48
+ array('255.255.255.0','255.255.255.255')
49
+ );
50
+
51
+ foreach ($reserved_ips as $r)
52
+ {
53
+ $min = ip2long($r[0]);
54
+ $max = ip2long($r[1]);
55
+ if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
56
+ }
57
+
58
+ return true;
59
+ }
60
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  //-----------------------------------------------------------------
62
+ // Get real client ip address
63
+
64
+ function phpwhois_getclientip()
65
+ {
66
+ if (!empty($_SERVER['HTTP_CLIENT_IP']) && phpwhois_validip($_SERVER['HTTP_CLIENT_IP']))
67
+ return $_SERVER['HTTP_CLIENT_IP'];
68
+
69
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
70
+ foreach (explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']) as $ip)
71
+ if (phpwhois_validip(trim($ip)))
72
+ return $ip;
73
+
74
+ if (!empty($_SERVER['HTTP_X_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_X_FORWARDED']))
75
+ return $_SERVER['HTTP_X_FORWARDED'];
76
+
77
+ if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && phpwhois_validip($_SERVER['HTTP_FORWARDED_FOR']))
78
+ return $_SERVER['HTTP_FORWARDED_FOR'];
79
+
80
+ if (!empty($_SERVER['HTTP_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_FORWARDED']))
81
+ return $_SERVER['HTTP_FORWARDED'];
82
+
83
+ if (!empty($_SERVER['HTTP_X_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_X_FORWARDED']))
84
+ return $_SERVER['HTTP_X_FORWARDED'];
85
+
86
+ return $_SERVER['REMOTE_ADDR'];
87
+ }
88
+
89
+ //-----------------------------------------------------------------
90
+ // Convert from CIDR to net range
91
 
92
  function phpwhois_cidr_conv($net)
93
  {
94
  $start = strtok($net, '/');
95
  $n = 3-substr_count($net, '.');
96
+
97
  if ($n > 0)
98
  {
99
  for ($i = $n; $i > 0; $i--)
114
  if ($bits1[$i] == 0 and $bits2[$i] == 1)
115
  $final.= $bits2[$i];
116
  }
117
+
118
  return $start." - ".long2ip(bindec($final));
119
+ }
120
  ?>
lib/whois/whois.ip.php CHANGED
@@ -132,7 +132,7 @@ class ip_handler extends WhoisClient
132
 
133
  unset($this->Query['args']);
134
 
135
- while (count($this->more_data) > 0)
136
  {
137
  $srv_data = array_shift($this->more_data);
138
  $this->Query['server'] = $srv_data['server'];
132
 
133
  unset($this->Query['args']);
134
 
135
+ while (count($this->more_data) > 0)
136
  {
137
  $srv_data = array_shift($this->more_data);
138
  $this->Query['server'] = $srv_data['server'];
lib/whois/whois.mobi.php CHANGED
@@ -36,8 +36,8 @@ class mobi_handler
36
  {
37
  $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
 
39
- if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
40
- $r['regrinfo']['registered'] = 'unknown';
41
 
42
  $r['regyinfo']['referrer'] = 'http://www.mtld.mobi/';
43
  $r['regyinfo']['registrar'] = 'Dot Mobi Registry';
36
  {
37
  $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
 
39
+ if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
40
+ $r['regrinfo']['registered'] = 'unknown';
41
 
42
  $r['regyinfo']['referrer'] = 'http://www.mtld.mobi/';
43
  $r['regyinfo']['registrar'] = 'Dot Mobi Registry';
lib/whois/whois.nl.php CHANGED
@@ -55,16 +55,16 @@ class nl_handler
55
  return $r;
56
  }
57
 
58
- if (isset($r['regrinfo']['tech']))
59
- $r['regrinfo']['tech'] = $this->get_contact($r['regrinfo']['tech']);
60
 
61
- if (isset($r['regrinfo']['zone']))
62
  $r['regrinfo']['zone'] = $this->get_contact($r['regrinfo']['zone']);
63
-
64
- if (isset($r['regrinfo']['admin']))
65
- $r['regrinfo']['admin'] = $this->get_contact($r['regrinfo']['admin']);
66
-
67
- if (isset($r['regrinfo']['owner']))
68
  $r['regrinfo']['owner'] = $this->get_contact($r['regrinfo']['owner']);
69
 
70
  $r['regrinfo']['registered'] = 'yes';
55
  return $r;
56
  }
57
 
58
+ if (isset($r['regrinfo']['tech']))
59
+ $r['regrinfo']['tech'] = $this->get_contact($r['regrinfo']['tech']);
60
 
61
+ if (isset($r['regrinfo']['zone']))
62
  $r['regrinfo']['zone'] = $this->get_contact($r['regrinfo']['zone']);
63
+
64
+ if (isset($r['regrinfo']['admin']))
65
+ $r['regrinfo']['admin'] = $this->get_contact($r['regrinfo']['admin']);
66
+
67
+ if (isset($r['regrinfo']['owner']))
68
  $r['regrinfo']['owner'] = $this->get_contact($r['regrinfo']['owner']);
69
 
70
  $r['regrinfo']['registered'] = 'yes';
lib/whois/whois.nz.php CHANGED
@@ -91,8 +91,8 @@ class nz_handler
91
  else
92
  $r['regrinfo']['registered']='unknown';
93
 
94
- if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
95
- $r['regrinfo']['registered'] = 'unknown';
96
 
97
  $r['regyinfo']['referrer'] = 'http://www.dnc.org.nz';
98
  $r['regyinfo']['registrar'] = 'New Zealand Domain Name Registry Limited';
91
  else
92
  $r['regrinfo']['registered']='unknown';
93
 
94
+ if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
95
+ $r['regrinfo']['registered'] = 'unknown';
96
 
97
  $r['regyinfo']['referrer'] = 'http://www.dnc.org.nz';
98
  $r['regyinfo']['registrar'] = 'New Zealand Domain Name Registry Limited';
lib/whois/whois.org.php CHANGED
@@ -36,8 +36,8 @@ class org_handler
36
  {
37
  $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
 
39
- if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
40
- $r['regrinfo']['registered'] = 'unknown';
41
 
42
  $r['regyinfo']['referrer'] = 'http://www.pir.org/';
43
  $r['regyinfo']['registrar'] = 'Public Interest Registry';
36
  {
37
  $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
 
39
+ if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
40
+ $r['regrinfo']['registered'] = 'unknown';
41
 
42
  $r['regyinfo']['referrer'] = 'http://www.pir.org/';
43
  $r['regyinfo']['registrar'] = 'Public Interest Registry';
lib/whois/whois.parser.php CHANGED
@@ -148,50 +148,50 @@ if (!$items)
148
  $items = array(
149
  'Domain Name:' => 'domain.name',
150
  'Domain ID:' => 'domain.handle',
151
- 'Sponsoring Registrar:' => 'domain.sponsor',
152
  'Registrar ID:' => 'domain.sponsor',
153
- 'Domain Status:' => 'domain.status.',
154
  'Status:' => 'domain.status.',
155
- 'Name Server:' => 'domain.nserver.',
156
- 'Nameservers:' => 'domain.nserver.',
157
- 'Maintainer:' => 'domain.referer',
158
-
159
- 'Domain Registration Date:' => 'domain.created',
160
  'Domain Create Date:' => 'domain.created',
161
  'Domain Expiration Date:' => 'domain.expires',
162
- 'Domain Last Updated Date:' => 'domain.changed',
163
  'Creation Date:' => 'domain.created',
164
  'Last Modification Date:' => 'domain.changed',
165
  'Expiration Date:' => 'domain.expires',
166
  'Created On:' => 'domain.created',
167
  'Last Updated On:' => 'domain.changed',
168
- 'Expiration Date:' => 'domain.expires',
169
-
170
  'Registrant ID:' => 'owner.handle',
171
  'Registrant Name:' => 'owner.name',
172
- 'Registrant Organization:' => 'owner.organization',
173
  'Registrant Address:' => 'owner.address.street.',
174
  'Registrant Address1:' => 'owner.address.street.',
175
- 'Registrant Address2:' => 'owner.address.street.',
176
- 'Registrant Street:' => 'owner.address.street.',
177
- 'Registrant Street1:' => 'owner.address.street.',
178
- 'Registrant Street2:' => 'owner.address.street.',
179
  'Registrant Street3:' => 'owner.address.street.',
180
  'Registrant Postal Code:' => 'owner.address.pcode',
181
  'Registrant City:' => 'owner.address.city',
182
  'Registrant State/Province:' => 'owner.address.state',
183
- 'Registrant Country:' => 'owner.address.country',
184
  'Registrant Country/Economy:' => 'owner.address.country',
185
- 'Registrant Phone Number:' => 'owner.phone',
186
  'Registrant Phone:' => 'owner.phone',
187
- 'Registrant Facsimile Number:' => 'owner.fax',
188
  'Registrant FAX:' => 'owner.fax',
189
- 'Registrant Email:' => 'owner.email',
190
- 'Registrant E-mail:' => 'owner.email',
191
 
192
  'Administrative Contact ID:' => 'admin.handle',
193
  'Administrative Contact Name:' => 'admin.name',
194
- 'Administrative Contact Organization:' => 'admin.organization',
195
  'Administrative Contact Address:' => 'admin.address.street.',
196
  'Administrative Contact Address1:' => 'admin.address.street.',
197
  'Administrative Contact Address2:' => 'admin.address.street.',
@@ -201,12 +201,12 @@ if (!$items)
201
  'Administrative Contact Country:' => 'admin.address.country',
202
  'Administrative Contact Phone Number:' => 'admin.phone',
203
  'Administrative Contact Email:' => 'admin.email',
204
- 'Administrative Contact Facsimile Number:' => 'admin.fax',
205
  'Administrative Contact Tel:' => 'admin.phone',
206
- 'Administrative Contact Fax:' => 'admin.fax',
207
  'Administrative ID:' => 'admin.handle',
208
  'Administrative Name:' => 'admin.name',
209
- 'Administrative Organization:' => 'admin.organization',
210
  'Administrative Address:' => 'admin.address.street.',
211
  'Administrative Address1:' => 'admin.address.street.',
212
  'Administrative Address2:' => 'admin.address.street.',
@@ -216,32 +216,32 @@ if (!$items)
216
  'Administrative Country/Economy:' => 'admin.address.country',
217
  'Administrative Phone:' => 'admin.phone',
218
  'Administrative E-mail:' => 'admin.email',
219
- 'Administrative Facsimile Number:' => 'admin.fax',
220
  'Administrative Tel:' => 'admin.phone',
221
- 'Administrative FAX:' => 'admin.fax',
222
  'Admin ID:' => 'admin.handle',
223
  'Admin Name:' => 'admin.name',
224
- 'Admin Organization:' => 'admin.organization',
225
  'Admin Street:' => 'admin.address.street.',
226
- 'Admin Street1:' => 'admin.address.street.',
227
- 'Admin Street2:' => 'admin.address.street.',
228
- 'Admin Street3:' => 'admin.address.street.',
229
  'Admin Address:' => 'admin.address.street.',
230
- 'Admin Address2:' => 'admin.address.street.',
231
  'Admin Address3:' => 'admin.address.street.',
232
  'Admin City:' => 'admin.address.city',
233
  'Admin State/Province:' => 'admin.address.state',
234
  'Admin Postal Code:' => 'admin.address.pcode',
235
- 'Admin Country:' => 'admin.address.country',
236
  'Admin Country/Economy:' => 'admin.address.country',
237
  'Admin Phone:' => 'admin.phone',
238
  'Admin FAX:' => 'admin.fax',
239
- 'Admin Email:' => 'admin.email',
240
- 'Admin E-mail:' => 'admin.email',
241
 
242
  'Technical Contact ID:' => 'tech.handle',
243
  'Technical Contact Name:' => 'tech.name',
244
- 'Technical Contact Organization:' => 'tech.organization',
245
  'Technical Contact Address:' => 'tech.address.street.',
246
  'Technical Contact Address1:' => 'tech.address.street.',
247
  'Technical Contact Address2:' => 'tech.address.street.',
@@ -250,13 +250,13 @@ if (!$items)
250
  'Technical Contact State/Province:' => 'tech.address.state',
251
  'Technical Contact Country:' => 'tech.address.country',
252
  'Technical Contact Phone Number:' => 'tech.phone',
253
- 'Technical Contact Facsimile Number:' => 'tech.fax',
254
  'Technical Contact Phone:' => 'tech.phone',
255
  'Technical Contact Fax:' => 'tech.fax',
256
- 'Technical Contact Email:' => 'tech.email',
257
  'Technical ID:' => 'tech.handle',
258
  'Technical Name:' => 'tech.name',
259
- 'Technical Organization:' => 'tech.organization',
260
  'Technical Address:' => 'tech.address.street.',
261
  'Technical Address1:' => 'tech.address.street.',
262
  'Technical Address2:' => 'tech.address.street.',
@@ -265,30 +265,30 @@ if (!$items)
265
  'Technical State/Province:' => 'tech.address.state',
266
  'Technical Country/Economy:' => 'tech.address.country',
267
  'Technical Phone Number:' => 'tech.phone',
268
- 'Technical Facsimile Number:' => 'tech.fax',
269
  'Technical Phone:' => 'tech.phone',
270
- 'Technical Fax:' => 'tech.fax',
271
  'Technical FAX:' => 'tech.fax',
272
- 'Technical E-mail:' => 'tech.email',
273
  'Tech ID:' => 'tech.handle',
274
  'Tech Name:' => 'tech.name',
275
- 'Tech Organization:' => 'tech.organization',
276
  'Tech Address:' => 'tech.address.street.',
277
- 'Tech Address2:' => 'tech.address.street.',
278
- 'Tech Address3:' => 'tech.address.street.',
279
  'Tech Street:' => 'tech.address.street.',
280
- 'Tech Street1:' => 'tech.address.street.',
281
- 'Tech Street2:' => 'tech.address.street.',
282
  'Tech Street3:' => 'tech.address.street.',
283
  'Tech City:' => 'tech.address.city',
284
  'Tech Postal Code:' => 'tech.address.pcode',
285
  'Tech State/Province:' => 'tech.address.state',
286
- 'Tech Country:' => 'tech.address.country',
287
  'Tech Country/Economy:' => 'tech.address.country',
288
  'Tech Phone:' => 'tech.phone',
289
  'Tech FAX:' => 'tech.fax',
290
- 'Tech Email:' => 'tech.email',
291
- 'Tech E-mail:' => 'tech.email',
292
 
293
  'Billing Contact ID:' => 'billing.handle',
294
  'Billing Contact Name:' => 'billing.name',
@@ -301,29 +301,29 @@ if (!$items)
301
  'Billing Contact Country:' => 'billing.address.country',
302
  'Billing Contact Phone Number:' => 'billing.phone',
303
  'Billing Contact Facsimile Number:' => 'billing.fax',
304
- 'Billing Contact Email:' => 'billing.email',
305
  'Billing ID:' => 'billing.handle',
306
  'Billing Name:' => 'billing.name',
307
- 'Billing Organization:' => 'billing.organization',
308
  'Billing Address:' => 'billing.address.street.',
309
- 'Billing Address1:' => 'billing.address.street.',
310
- 'Billing Address2:' => 'billing.address.street.',
311
- 'Billing Address3:' => 'billing.address.street.',
312
  'Billing Street:' => 'billing.address.street.',
313
- 'Billing Street1:' => 'billing.address.street.',
314
- 'Billing Street2:' => 'billing.address.street.',
315
  'Billing Street3:' => 'billing.address.street.',
316
  'Billing City:' => 'billing.address.city',
317
  'Billing Postal Code:' => 'billing.address.pcode',
318
  'Billing State/Province:' => 'billing.address.state',
319
- 'Billing Country:' => 'billing.address.country',
320
  'Billing Country/Economy:' => 'billing.address.country',
321
  'Billing Phone:' => 'billing.phone',
322
- 'Billing Fax:' => 'billing.fax',
323
  'Billing FAX:' => 'billing.fax',
324
- 'Billing Email:' => 'billing.email',
325
- 'Billing E-mail:' => 'billing.email',
326
-
327
  'Zone ID:' => 'zone.handle',
328
  'Zone Organization:' => 'zone.organization',
329
  'Zone Name:' => 'zone.name',
@@ -541,21 +541,21 @@ return $r;
541
  function get_contacts ( $array, $extra_items='', $has_org= false )
542
  {
543
  if (isset($array['billing']))
544
- $array['billing'] = get_contact($array['billing'], $extra_items, $has_org);
545
-
546
- if (isset($array['tech']))
547
- $array['tech'] = get_contact($array['tech'], $extra_items, $has_org);
548
 
549
- if (isset($array['zone']))
 
 
 
550
  $array['zone'] = get_contact($array['zone'], $extra_items, $has_org);
551
-
552
- if (isset($array['admin']))
553
- $array['admin'] = get_contact($array['admin'], $extra_items, $has_org);
554
-
555
- if (isset($array['owner']))
556
  $array['owner'] = get_contact($array['owner'], $extra_items, $has_org);
557
 
558
- if (isset($array['registrar']))
559
  $array['registrar'] = get_contact($array['registrar'], $extra_items, $has_org);
560
 
561
  return $array;
148
  $items = array(
149
  'Domain Name:' => 'domain.name',
150
  'Domain ID:' => 'domain.handle',
151
+ 'Sponsoring Registrar:' => 'domain.sponsor',
152
  'Registrar ID:' => 'domain.sponsor',
153
+ 'Domain Status:' => 'domain.status.',
154
  'Status:' => 'domain.status.',
155
+ 'Name Server:' => 'domain.nserver.',
156
+ 'Nameservers:' => 'domain.nserver.',
157
+ 'Maintainer:' => 'domain.referer',
158
+
159
+ 'Domain Registration Date:' => 'domain.created',
160
  'Domain Create Date:' => 'domain.created',
161
  'Domain Expiration Date:' => 'domain.expires',
162
+ 'Domain Last Updated Date:' => 'domain.changed',
163
  'Creation Date:' => 'domain.created',
164
  'Last Modification Date:' => 'domain.changed',
165
  'Expiration Date:' => 'domain.expires',
166
  'Created On:' => 'domain.created',
167
  'Last Updated On:' => 'domain.changed',
168
+ 'Expiration Date:' => 'domain.expires',
169
+
170
  'Registrant ID:' => 'owner.handle',
171
  'Registrant Name:' => 'owner.name',
172
+ 'Registrant Organization:' => 'owner.organization',
173
  'Registrant Address:' => 'owner.address.street.',
174
  'Registrant Address1:' => 'owner.address.street.',
175
+ 'Registrant Address2:' => 'owner.address.street.',
176
+ 'Registrant Street:' => 'owner.address.street.',
177
+ 'Registrant Street1:' => 'owner.address.street.',
178
+ 'Registrant Street2:' => 'owner.address.street.',
179
  'Registrant Street3:' => 'owner.address.street.',
180
  'Registrant Postal Code:' => 'owner.address.pcode',
181
  'Registrant City:' => 'owner.address.city',
182
  'Registrant State/Province:' => 'owner.address.state',
183
+ 'Registrant Country:' => 'owner.address.country',
184
  'Registrant Country/Economy:' => 'owner.address.country',
185
+ 'Registrant Phone Number:' => 'owner.phone',
186
  'Registrant Phone:' => 'owner.phone',
187
+ 'Registrant Facsimile Number:' => 'owner.fax',
188
  'Registrant FAX:' => 'owner.fax',
189
+ 'Registrant Email:' => 'owner.email',
190
+ 'Registrant E-mail:' => 'owner.email',
191
 
192
  'Administrative Contact ID:' => 'admin.handle',
193
  'Administrative Contact Name:' => 'admin.name',
194
+ 'Administrative Contact Organization:' => 'admin.organization',
195
  'Administrative Contact Address:' => 'admin.address.street.',
196
  'Administrative Contact Address1:' => 'admin.address.street.',
197
  'Administrative Contact Address2:' => 'admin.address.street.',
201
  'Administrative Contact Country:' => 'admin.address.country',
202
  'Administrative Contact Phone Number:' => 'admin.phone',
203
  'Administrative Contact Email:' => 'admin.email',
204
+ 'Administrative Contact Facsimile Number:' => 'admin.fax',
205
  'Administrative Contact Tel:' => 'admin.phone',
206
+ 'Administrative Contact Fax:' => 'admin.fax',
207
  'Administrative ID:' => 'admin.handle',
208
  'Administrative Name:' => 'admin.name',
209
+ 'Administrative Organization:' => 'admin.organization',
210
  'Administrative Address:' => 'admin.address.street.',
211
  'Administrative Address1:' => 'admin.address.street.',
212
  'Administrative Address2:' => 'admin.address.street.',
216
  'Administrative Country/Economy:' => 'admin.address.country',
217
  'Administrative Phone:' => 'admin.phone',
218
  'Administrative E-mail:' => 'admin.email',
219
+ 'Administrative Facsimile Number:' => 'admin.fax',
220
  'Administrative Tel:' => 'admin.phone',
221
+ 'Administrative FAX:' => 'admin.fax',
222
  'Admin ID:' => 'admin.handle',
223
  'Admin Name:' => 'admin.name',
224
+ 'Admin Organization:' => 'admin.organization',
225
  'Admin Street:' => 'admin.address.street.',
226
+ 'Admin Street1:' => 'admin.address.street.',
227
+ 'Admin Street2:' => 'admin.address.street.',
228
+ 'Admin Street3:' => 'admin.address.street.',
229
  'Admin Address:' => 'admin.address.street.',
230
+ 'Admin Address2:' => 'admin.address.street.',
231
  'Admin Address3:' => 'admin.address.street.',
232
  'Admin City:' => 'admin.address.city',
233
  'Admin State/Province:' => 'admin.address.state',
234
  'Admin Postal Code:' => 'admin.address.pcode',
235
+ 'Admin Country:' => 'admin.address.country',
236
  'Admin Country/Economy:' => 'admin.address.country',
237
  'Admin Phone:' => 'admin.phone',
238
  'Admin FAX:' => 'admin.fax',
239
+ 'Admin Email:' => 'admin.email',
240
+ 'Admin E-mail:' => 'admin.email',
241
 
242
  'Technical Contact ID:' => 'tech.handle',
243
  'Technical Contact Name:' => 'tech.name',
244
+ 'Technical Contact Organization:' => 'tech.organization',
245
  'Technical Contact Address:' => 'tech.address.street.',
246
  'Technical Contact Address1:' => 'tech.address.street.',
247
  'Technical Contact Address2:' => 'tech.address.street.',
250
  'Technical Contact State/Province:' => 'tech.address.state',
251
  'Technical Contact Country:' => 'tech.address.country',
252
  'Technical Contact Phone Number:' => 'tech.phone',
253
+ 'Technical Contact Facsimile Number:' => 'tech.fax',
254
  'Technical Contact Phone:' => 'tech.phone',
255
  'Technical Contact Fax:' => 'tech.fax',
256
+ 'Technical Contact Email:' => 'tech.email',
257
  'Technical ID:' => 'tech.handle',
258
  'Technical Name:' => 'tech.name',
259
+ 'Technical Organization:' => 'tech.organization',
260
  'Technical Address:' => 'tech.address.street.',
261
  'Technical Address1:' => 'tech.address.street.',
262
  'Technical Address2:' => 'tech.address.street.',
265
  'Technical State/Province:' => 'tech.address.state',
266
  'Technical Country/Economy:' => 'tech.address.country',
267
  'Technical Phone Number:' => 'tech.phone',
268
+ 'Technical Facsimile Number:' => 'tech.fax',
269
  'Technical Phone:' => 'tech.phone',
270
+ 'Technical Fax:' => 'tech.fax',
271
  'Technical FAX:' => 'tech.fax',
272
+ 'Technical E-mail:' => 'tech.email',
273
  'Tech ID:' => 'tech.handle',
274
  'Tech Name:' => 'tech.name',
275
+ 'Tech Organization:' => 'tech.organization',
276
  'Tech Address:' => 'tech.address.street.',
277
+ 'Tech Address2:' => 'tech.address.street.',
278
+ 'Tech Address3:' => 'tech.address.street.',
279
  'Tech Street:' => 'tech.address.street.',
280
+ 'Tech Street1:' => 'tech.address.street.',
281
+ 'Tech Street2:' => 'tech.address.street.',
282
  'Tech Street3:' => 'tech.address.street.',
283
  'Tech City:' => 'tech.address.city',
284
  'Tech Postal Code:' => 'tech.address.pcode',
285
  'Tech State/Province:' => 'tech.address.state',
286
+ 'Tech Country:' => 'tech.address.country',
287
  'Tech Country/Economy:' => 'tech.address.country',
288
  'Tech Phone:' => 'tech.phone',
289
  'Tech FAX:' => 'tech.fax',
290
+ 'Tech Email:' => 'tech.email',
291
+ 'Tech E-mail:' => 'tech.email',
292
 
293
  'Billing Contact ID:' => 'billing.handle',
294
  'Billing Contact Name:' => 'billing.name',
301
  'Billing Contact Country:' => 'billing.address.country',
302
  'Billing Contact Phone Number:' => 'billing.phone',
303
  'Billing Contact Facsimile Number:' => 'billing.fax',
304
+ 'Billing Contact Email:' => 'billing.email',
305
  'Billing ID:' => 'billing.handle',
306
  'Billing Name:' => 'billing.name',
307
+ 'Billing Organization:' => 'billing.organization',
308
  'Billing Address:' => 'billing.address.street.',
309
+ 'Billing Address1:' => 'billing.address.street.',
310
+ 'Billing Address2:' => 'billing.address.street.',
311
+ 'Billing Address3:' => 'billing.address.street.',
312
  'Billing Street:' => 'billing.address.street.',
313
+ 'Billing Street1:' => 'billing.address.street.',
314
+ 'Billing Street2:' => 'billing.address.street.',
315
  'Billing Street3:' => 'billing.address.street.',
316
  'Billing City:' => 'billing.address.city',
317
  'Billing Postal Code:' => 'billing.address.pcode',
318
  'Billing State/Province:' => 'billing.address.state',
319
+ 'Billing Country:' => 'billing.address.country',
320
  'Billing Country/Economy:' => 'billing.address.country',
321
  'Billing Phone:' => 'billing.phone',
322
+ 'Billing Fax:' => 'billing.fax',
323
  'Billing FAX:' => 'billing.fax',
324
+ 'Billing Email:' => 'billing.email',
325
+ 'Billing E-mail:' => 'billing.email',
326
+
327
  'Zone ID:' => 'zone.handle',
328
  'Zone Organization:' => 'zone.organization',
329
  'Zone Name:' => 'zone.name',
541
  function get_contacts ( $array, $extra_items='', $has_org= false )
542
  {
543
  if (isset($array['billing']))
544
+ $array['billing'] = get_contact($array['billing'], $extra_items, $has_org);
 
 
 
545
 
546
+ if (isset($array['tech']))
547
+ $array['tech'] = get_contact($array['tech'], $extra_items, $has_org);
548
+
549
+ if (isset($array['zone']))
550
  $array['zone'] = get_contact($array['zone'], $extra_items, $has_org);
551
+
552
+ if (isset($array['admin']))
553
+ $array['admin'] = get_contact($array['admin'], $extra_items, $has_org);
554
+
555
+ if (isset($array['owner']))
556
  $array['owner'] = get_contact($array['owner'], $extra_items, $has_org);
557
 
558
+ if (isset($array['registrar']))
559
  $array['registrar'] = get_contact($array['registrar'], $extra_items, $has_org);
560
 
561
  return $array;
lib/whois/whois.sc.php CHANGED
@@ -1,45 +1,45 @@
1
- <?php
2
- /*
3
- Whois.php PHP classes to conduct whois queries
4
-
5
- Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
-
7
- Maintained by David Saez
8
-
9
- For the most recent version of this package visit:
10
-
11
- http://www.phpwhois.org
12
-
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
- */
27
-
28
- if (!defined('__SC_HANDLER__'))
29
- define('__SC_HANDLER__', 1);
30
-
31
- require_once('whois.parser.php');
32
-
33
- class sc_handler
34
- {
35
- function parse($data_str, $query)
36
- {
37
- $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, 'dmy');
38
- $r['regyinfo'] = array(
39
- 'referrer' => 'http://www.nic.sc',
40
- 'registrar' => 'VCS (Pty) Limited'
41
- );
42
- return $r;
43
- }
44
- }
45
  ?>
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SC_HANDLER__'))
29
+ define('__SC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class sc_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, 'dmy');
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.nic.sc',
40
+ 'registrar' => 'VCS (Pty) Limited'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
  ?>
lib/whois/whois.servers.php CHANGED
@@ -146,7 +146,7 @@ $this->WHOIS_GTLD_HANDLER = array(
146
  'whois.tucows.com' => 'opensrs',
147
  'whois.35.com' => 'onlinenic',
148
  'whois.nominalia.com' => 'genericb',
149
- 'whois.encirca.com' => 'genericb',
150
  'whois.corenic.net' => 'genericb'
151
  );
152
 
146
  'whois.tucows.com' => 'opensrs',
147
  'whois.35.com' => 'onlinenic',
148
  'whois.nominalia.com' => 'genericb',
149
+ 'whois.encirca.com' => 'genericb',
150
  'whois.corenic.net' => 'genericb'
151
  );
152
 
lib/whois/whois.si.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
- /*
3
- Whois.php PHP classes to conduct whois queries
4
-
5
- Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
-
7
- Maintained by David Saez
8
-
9
- For the most recent version of this package visit:
10
-
11
- http://www.phpwhois.org
12
-
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
- */
27
-
28
- if (!defined('__SI_HANDLER__'))
29
- define('__SI_HANDLER__', 1);
30
-
31
- require_once('whois.parser.php');
32
-
33
- class si_handler
34
- {
35
- function parse($data_str, $query)
36
- {
37
  $translate = array(
38
- 'nic-hdl' => 'handle',
39
  'nameserver' => 'nserver'
40
  );
41
 
@@ -44,12 +44,12 @@ class si_handler
44
  'tech-c' => 'tech'
45
  );
46
 
47
- $r['regrinfo'] = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
48
- $r['regyinfo'] = array(
49
- 'referrer' => 'http://www.arnes.si',
50
- 'registrar' => 'ARNES'
51
  );
52
- return $r;
53
- }
54
- }
55
- ?>
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SI_HANDLER__'))
29
+ define('__SI_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class si_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
  $translate = array(
38
+ 'nic-hdl' => 'handle',
39
  'nameserver' => 'nserver'
40
  );
41
 
44
  'tech-c' => 'tech'
45
  );
46
 
47
+ $r['regrinfo'] = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
48
+ $r['regyinfo'] = array(
49
+ 'referrer' => 'http://www.arnes.si',
50
+ 'registrar' => 'ARNES'
51
  );
52
+ return $r;
53
+ }
54
+ }
55
+ ?>
lib/whois/whois.utils.php CHANGED
@@ -112,12 +112,12 @@ class utils extends Whois {
112
 
113
  if (is_array($nserver))
114
  {
115
- reset($nserver);
116
  while (list($host, $ip) = each($nserver))
117
  {
118
  $url = '<a href="'. str_replace('$0',$ip,$link)."\">$host</a>";
119
  $out = str_replace($host, $url, $out);
120
- $out = str_replace(strtoupper($host), $url, $out);
121
  }
122
  }
123
  }
112
 
113
  if (is_array($nserver))
114
  {
115
+ reset($nserver);
116
  while (list($host, $ip) = each($nserver))
117
  {
118
  $url = '<a href="'. str_replace('$0',$ip,$link)."\">$host</a>";
119
  $out = str_replace($host, $url, $out);
120
+ $out = str_replace(strtoupper($host), $url, $out);
121
  }
122
  }
123
  }
lib/whois/whois.ve.php CHANGED
@@ -1,75 +1,75 @@
1
- <?php
2
- /*
3
- Whois.php PHP classes to conduct whois queries
4
-
5
- Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
-
7
- Maintained by David Saez
8
-
9
- For the most recent version of this package visit:
10
-
11
- http://www.phpwhois.org
12
-
13
- This program is free software; you can redistribute it and/or
14
- modify it under the terms of the GNU General Public License
15
- as published by the Free Software Foundation; either version 2
16
- of the License, or (at your option) any later version.
17
-
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
-
23
- You should have received a copy of the GNU General Public License
24
- along with this program; if not, write to the Free Software
25
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26
- USA.
27
- */
28
-
29
- if (!defined('__VE_HANDLER__'))
30
- define('__VE_HANDLER__', 1);
31
-
32
- require_once('whois.parser.php');
33
-
34
- class ve_handler
35
- {
36
- function parse($data_str, $query)
37
- {
38
- $items = array(
39
- 'owner' => 'Titular:',
40
- 'domain.name' => 'Nombre de Dominio:',
41
- 'admin' => 'Contacto Administrativo',
42
- 'tech' => 'Contacto Tecnico',
43
- 'billing' => 'Contacto de Cobranza:',
44
- 'domain.created' => 'Fecha de Creacion:',
45
- 'domain.changed' => 'Ultima Actualizacion:',
46
- 'domain.expires' => 'Fecha de Vencimiento:',
47
- 'domain.status' => 'Estatus del dominio:',
48
- 'domain.nserver' => 'Servidor(es) de Nombres de Dominio'
49
- );
50
-
51
- $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
52
-
53
- if (!isset($r['regrinfo']['domain']['created']) || is_array($r['regrinfo']['domain']['created']))
54
- {
55
- $r['regrinfo'] = array ( 'registered' => 'no');
56
- return $r;
57
- }
58
-
59
- $dns = array();
60
-
61
- foreach($r['regrinfo']['domain']['nserver'] as $nserv)
62
- {
63
- if ($nserv[0] == '-') $dns[] = $nserv;
64
- }
65
-
66
- $r['regrinfo']['domain']['nserver'] = $dns;
67
- $r['regrinfo'] = get_contacts($r['regrinfo']);
68
- $r['regyinfo'] = array(
69
- 'referrer' => 'http://registro.nic.ve',
70
- 'registrar' => 'NIC-Venezuela - CNTI'
71
- );
72
- return $r;
73
- }
74
- }
75
  ?>
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26
+ USA.
27
+ */
28
+
29
+ if (!defined('__VE_HANDLER__'))
30
+ define('__VE_HANDLER__', 1);
31
+
32
+ require_once('whois.parser.php');
33
+
34
+ class ve_handler
35
+ {
36
+ function parse($data_str, $query)
37
+ {
38
+ $items = array(
39
+ 'owner' => 'Titular:',
40
+ 'domain.name' => 'Nombre de Dominio:',
41
+ 'admin' => 'Contacto Administrativo',
42
+ 'tech' => 'Contacto Tecnico',
43
+ 'billing' => 'Contacto de Cobranza:',
44
+ 'domain.created' => 'Fecha de Creacion:',
45
+ 'domain.changed' => 'Ultima Actualizacion:',
46
+ 'domain.expires' => 'Fecha de Vencimiento:',
47
+ 'domain.status' => 'Estatus del dominio:',
48
+ 'domain.nserver' => 'Servidor(es) de Nombres de Dominio'
49
+ );
50
+
51
+ $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
52
+
53
+ if (!isset($r['regrinfo']['domain']['created']) || is_array($r['regrinfo']['domain']['created']))
54
+ {
55
+ $r['regrinfo'] = array ( 'registered' => 'no');
56
+ return $r;
57
+ }
58
+
59
+ $dns = array();
60
+
61
+ foreach($r['regrinfo']['domain']['nserver'] as $nserv)
62
+ {
63
+ if ($nserv[0] == '-') $dns[] = $nserv;
64
+ }
65
+
66
+ $r['regrinfo']['domain']['nserver'] = $dns;
67
+ $r['regrinfo'] = get_contacts($r['regrinfo']);
68
+ $r['regyinfo'] = array(
69
+ 'referrer' => 'http://registro.nic.ve',
70
+ 'registrar' => 'NIC-Venezuela - CNTI'
71
+ );
72
+ return $r;
73
+ }
74
+ }
75
  ?>
other-includes/wp-security-rename-login-feature.php CHANGED
@@ -34,8 +34,7 @@ global $error, $interim_login, $action;
34
  // Don't index any of these forms
35
  add_action( 'login_head', 'wp_no_robots' );
36
 
37
- if ( wp_is_mobile() )
38
- add_action( 'login_head', 'wp_login_viewport_meta' );
39
 
40
  if ( empty($wp_error) )
41
  $wp_error = new WP_Error();
@@ -54,6 +53,8 @@ $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
54
  if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
55
  add_action( 'login_head', 'wp_shake_js', 12 );
56
 
 
 
57
  ?><!DOCTYPE html>
58
  <!--[if IE 8]>
59
  <html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php language_attributes(); ?>>
@@ -63,10 +64,10 @@ if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->g
63
  <!--<![endif]-->
64
  <head>
65
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
66
- <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
67
  <?php
68
 
69
- wp_admin_css( 'login', true );
70
 
71
  /*
72
  * Remove all stored post data on logging out.
@@ -94,7 +95,7 @@ if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->g
94
 
95
  if ( is_multisite() ) {
96
  $login_header_url = network_home_url();
97
- $login_header_title = get_current_site()->site_name;
98
  } else {
99
  $login_header_url = __( 'https://wordpress.org/' );
100
  $login_header_title = __( 'Powered by WordPress', 'all-in-one-wp-security-and-firewall' );
@@ -118,8 +119,6 @@ if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->g
118
  $login_header_title = apply_filters( 'login_headertitle', $login_header_title );
119
 
120
  $classes = array( 'login-action-' . $action, 'wp-core-ui' );
121
- if ( wp_is_mobile() )
122
- $classes[] = 'mobile';
123
  if ( is_rtl() )
124
  $classes[] = 'rtl';
125
  if ( $interim_login ) {
@@ -145,6 +144,14 @@ if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->g
145
  ?>
146
  </head>
147
  <body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
 
 
 
 
 
 
 
 
148
  <div id="login">
149
  <h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
150
  <?php
@@ -214,7 +221,10 @@ if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->g
214
 
215
  // Don't allow interim logins to navigate away from the page.
216
  if ( ! $interim_login ): ?>
217
- <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?', 'all-in-one-wp-security-and-firewall' ); ?>"><?php printf( __( '&larr; Back to %s', 'all-in-one-wp-security-and-firewall' ), get_bloginfo( 'title', 'display' ) ); ?></a></p>
 
 
 
218
  <?php endif; ?>
219
 
220
  </div>
@@ -243,8 +253,6 @@ do_action( 'login_footer' ); ?>
243
  * @since 3.0.0
244
  */
245
  function wp_shake_js() {
246
- if ( wp_is_mobile() )
247
- return;
248
  ?>
249
  <script type="text/javascript">
250
  addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
@@ -268,20 +276,15 @@ function wp_login_viewport_meta() {
268
  /**
269
  * Handles sending password retrieval email to user.
270
  *
271
- * @global wpdb $wpdb WordPress database abstraction object.
272
- * @global PasswordHash $wp_hasher Portable PHP password hashing framework.
273
- *
274
  * @return bool|WP_Error True: when finish. WP_Error on error
275
  */
276
  function retrieve_password() {
277
- global $wpdb, $wp_hasher;
278
-
279
  $errors = new WP_Error();
280
 
281
  if ( empty( $_POST['user_login'] ) ) {
282
  $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'all-in-one-wp-security-and-firewall' ));
283
  } elseif ( strpos( $_POST['user_login'], '@' ) ) {
284
- $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) );
285
  if ( empty( $user_data ) )
286
  $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'all-in-one-wp-security-and-firewall' ));
287
  } else {
@@ -290,122 +293,82 @@ function retrieve_password() {
290
  }
291
 
292
  /**
293
- * Fires before errors are returned from a password reset request.
294
- *
295
- * @since 2.1.0
296
- */
297
- do_action( 'lostpassword_post' );
 
 
 
 
298
 
299
  if ( $errors->get_error_code() )
300
  return $errors;
301
 
302
  if ( !$user_data ) {
303
- $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'all-in-one-wp-security-and-firewall' ));
304
  return $errors;
305
  }
306
 
307
  // Redefining user_login ensures we return the right case in the email.
308
  $user_login = $user_data->user_login;
309
  $user_email = $user_data->user_email;
 
310
 
311
- /**
312
- * Fires before a new password is retrieved.
313
- *
314
- * @since 1.5.0
315
- * @deprecated 1.5.1 Misspelled. Use 'retrieve_password' hook instead.
316
- *
317
- * @param string $user_login The user login name.
318
- */
319
- do_action( 'retreive_password', $user_login );
320
-
321
- /**
322
- * Fires before a new password is retrieved.
323
- *
324
- * @since 1.5.1
325
- *
326
- * @param string $user_login The user login name.
327
- */
328
- do_action( 'retrieve_password', $user_login );
329
-
330
- /**
331
- * Filter whether to allow a password to be reset.
332
- *
333
- * @since 2.7.0
334
- *
335
- * @param bool true Whether to allow the password to be reset. Default true.
336
- * @param int $user_data->ID The ID of the user attempting to reset a password.
337
- */
338
- $allow = apply_filters( 'allow_password_reset', true, $user_data->ID );
339
-
340
- if ( ! $allow ) {
341
- return new WP_Error( 'no_password_reset', __('Password reset is not allowed for this user', 'all-in-one-wp-security-and-firewall' ) );
342
- } elseif ( is_wp_error( $allow ) ) {
343
- return $allow;
344
  }
345
 
346
- // Generate something random for a password reset key.
347
- $key = wp_generate_password( 20, false );
348
-
349
- /**
350
- * Fires when a password reset key is generated.
351
- *
352
- * @since 2.5.0
353
- *
354
- * @param string $user_login The username for the user.
355
- * @param string $key The generated password reset key.
356
- */
357
- do_action( 'retrieve_password_key', $user_login, $key );
358
-
359
- // Now insert the key, hashed, into the DB.
360
- if ( empty( $wp_hasher ) ) {
361
- require_once ABSPATH . WPINC . '/class-phpass.php';
362
- $wp_hasher = new PasswordHash( 8, true );
363
- }
364
- $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
365
- $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user_login ) );
366
-
367
- $message = __('Someone requested that the password be reset for the following account:', 'all-in-one-wp-security-and-firewall' ) . "\r\n\r\n";
368
  $message .= network_home_url( '/' ) . "\r\n\r\n";
369
  $message .= sprintf(__('Username: %s', 'all-in-one-wp-security-and-firewall' ), $user_login) . "\r\n\r\n";
370
  $message .= __('If this was a mistake, just ignore this email and nothing will happen.', 'all-in-one-wp-security-and-firewall' ) . "\r\n\r\n";
371
  $message .= __('To reset your password, visit the following address:', 'all-in-one-wp-security-and-firewall' ) . "\r\n\r\n";
372
  $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
373
 
374
- if ( is_multisite() )
375
- $blogname = $GLOBALS['current_site']->site_name;
376
- else
377
- /*
378
- * The blogname option is escaped with esc_html on the way into the database
379
- * in sanitize_option we want to reverse this for the plain text arena of emails.
380
- */
381
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
382
-
383
- $title = sprintf( __('[%s] Password Reset', 'all-in-one-wp-security-and-firewall' ), $blogname );
384
 
385
- /**
386
- * Filter the subject of the password reset email.
387
- *
388
- * @since 2.8.0
389
- *
390
- * @param string $title Default email title.
391
- */
392
- $title = apply_filters( 'retrieve_password_title', $title );
393
 
394
  /**
395
- * Filter the message body of the password reset mail.
396
  *
397
  * @since 2.8.0
398
- * @since 4.1.0 Added `$user_login` and `$user_data` parameters.
399
  *
400
- * @param string $message Default mail message.
401
- * @param string $key The activation key.
402
  * @param string $user_login The username for the user.
403
  * @param WP_User $user_data WP_User object.
404
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
406
 
407
  if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
408
- wp_die( __('The e-mail could not be sent.', 'all-in-one-wp-security-and-firewall' ) . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.', 'all-in-one-wp-security-and-firewall' ) );
409
 
410
  return true;
411
  }
@@ -438,7 +401,7 @@ if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
438
  }
439
 
440
  //Set a cookie now to see if they are supported by the browser.
441
- $secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) && 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
442
  setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
443
  if ( SITECOOKIEPATH != COOKIEPATH )
444
  setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
@@ -458,7 +421,7 @@ do_action( 'login_init' );
458
  *
459
  * @since 2.8.0
460
  */
461
- do_action( 'login_form_' . $action );
462
 
463
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
464
  $interim_login = isset($_REQUEST['interim-login']);
@@ -466,6 +429,11 @@ $interim_login = isset($_REQUEST['interim-login']);
466
  switch ($action) {
467
 
468
  case 'postpass' :
 
 
 
 
 
469
  require_once ABSPATH . WPINC . '/class-phpass.php';
470
  $hasher = new PasswordHash( 8, true );
471
 
@@ -558,7 +526,7 @@ switch ($action) {
558
 
559
  <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
560
  <p>
561
- <label for="user_login" ><?php _e('Username or E-mail:', 'all-in-one-wp-security-and-firewall') ?><br />
562
  <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
563
  </p>
564
  <?php
@@ -650,15 +618,18 @@ switch ($action) {
650
  <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
651
  <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
652
 
653
- <p class="user-pass1-wrap">
654
- <label for="pass1"><?php _e('New password', 'all-in-one-wp-security-and-firewall') ?></label><br />
655
- <div class="wp-pwd">
656
- <span class="password-input-wrapper">
657
- <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" />
658
- </span>
659
- <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator', 'all-in-one-wp-security-and-firewall' ); ?></div>
 
 
 
 
660
  </div>
661
- </p>
662
  <p class="user-pass2-wrap">
663
  <label for="pass2"><?php _e('Confirm new password', 'all-in-one-wp-security-and-firewall') ?></label><br />
664
  <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />
@@ -718,8 +689,8 @@ switch ($action) {
718
  $user_login = '';
719
  $user_email = '';
720
  if ( $http_post ) {
721
- $user_login = $_POST['user_login'];
722
- $user_email = $_POST['user_email'];
723
  $errors = register_new_user($user_login, $user_email);
724
  if ( !is_wp_error($errors) ) {
725
  $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
@@ -740,24 +711,24 @@ switch ($action) {
740
  login_header(__('Registration Form', 'all-in-one-wp-security-and-firewall' ), '<p class="message register">' . __('Register For This Site', 'all-in-one-wp-security-and-firewall' ) . '</p>', $errors);
741
  ?>
742
 
743
- <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">
744
  <p>
745
  <label for="user_login"><?php _e('Username', 'all-in-one-wp-security-and-firewall') ?><br />
746
  <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
747
  </p>
748
  <p>
749
- <label for="user_email"><?php _e('E-mail', 'all-in-one-wp-security-and-firewall') ?><br />
750
  <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label>
751
  </p>
752
  <?php
753
  /**
754
- * Fires following the 'E-mail' field in the user registration form.
755
  *
756
  * @since 2.1.0
757
  */
758
  do_action( 'register_form' );
759
  ?>
760
- <p id="reg_passmail"><?php _e( 'Registration confirmation will be e-mailed to you.', 'all-in-one-wp-security-and-firewall' ); ?></p>
761
  <br class="clear" />
762
  <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
763
  <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register', 'all-in-one-wp-security-and-firewall'); ?>" /></p>
@@ -765,7 +736,7 @@ switch ($action) {
765
 
766
  <p id="nav">
767
  <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in', 'all-in-one-wp-security-and-firewall' ); ?></a> |
768
- <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found', 'all-in-one-wp-security-and-firewall' ) ?>"><?php _e( 'Lost your password?', 'all-in-one-wp-security-and-firewall' ); ?></a>
769
  </p>
770
 
771
  <?php
@@ -780,15 +751,21 @@ switch ($action) {
780
  wp_enqueue_script( 'customize-base' );
781
 
782
  // If the user wants ssl but the session is not ssl, force a secure cookie.
783
- if ( !empty($_POST['log']) && !force_ssl_admin() ) {
784
- $user_name = sanitize_user($_POST['log']);
785
- if ( $user = get_user_by('login', $user_name) ) {
786
- if ( get_user_option('use_ssl', $user->ID) ) {
787
- $secure_cookie = true;
788
- force_ssl_admin(true);
789
- }
790
- }
791
- }
 
 
 
 
 
 
792
 
793
  if ( isset( $_REQUEST['redirect_to'] ) ) {
794
  $redirect_to = $_REQUEST['redirect_to'];
@@ -801,16 +778,18 @@ switch ($action) {
801
 
802
  $reauth = empty($_REQUEST['reauth']) ? false : true;
803
 
804
- $user = wp_signon( '', $secure_cookie );
805
 
806
  if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
807
  if ( headers_sent() ) {
808
- $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.', 'all-in-one-wp-security-and-firewall' ),
809
- __( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
 
810
  } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
811
  // If cookies are disabled we can't log in even with a valid user+pass
812
- $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.', 'all-in-one-wp-security-and-firewall' ),
813
- __( 'https://codex.wordpress.org/Cookies' ) ) );
 
814
  }
815
  }
816
 
@@ -849,7 +828,10 @@ switch ($action) {
849
  elseif ( is_multisite() && !$user->has_cap('read') )
850
  $redirect_to = get_dashboard_url( $user->ID );
851
  elseif ( !$user->has_cap('edit_posts') )
852
- $redirect_to = admin_url('profile.php');
 
 
 
853
  }
854
  wp_safe_redirect($redirect_to);
855
  exit();
@@ -862,7 +844,7 @@ switch ($action) {
862
 
863
  if ( $interim_login ) {
864
  if ( ! $errors->get_error_code() )
865
- $errors->add('expired', __('Session expired. Please log in again. You will not move away from this page.', 'all-in-one-wp-security-and-firewall' ), 'message');
866
  } else {
867
  // Some parts of this script use the main login form to display a message
868
  if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] )
@@ -870,11 +852,11 @@ switch ($action) {
870
  elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
871
  $errors->add('registerdisabled', __('User registration is currently not allowed.', 'all-in-one-wp-security-and-firewall' ));
872
  elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
873
- $errors->add('confirm', __('Check your e-mail for the confirmation link.', 'all-in-one-wp-security-and-firewall' ), 'message');
874
  elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
875
- $errors->add('newpass', __('Check your e-mail for your new password.', 'all-in-one-wp-security-and-firewall' ), 'message');
876
  elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
877
- $errors->add('registered', __('Registration complete. Please check your e-mail.', 'all-in-one-wp-security-and-firewall' ), 'message');
878
  elseif ( strpos( $redirect_to, 'about.php?updated' ) )
879
  $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.', 'all-in-one-wp-security-and-firewall' ), 'message' );
880
  }
@@ -888,7 +870,7 @@ switch ($action) {
888
  * @param string $redirect_to Redirect destination URL.
889
  */
890
  $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
891
- $user_login = '';
892
  // Clear any stale cookies.
893
  if ( $reauth )
894
  wp_clear_auth_cookie();
@@ -904,6 +886,15 @@ switch ($action) {
904
  } else {
905
  $aria_describedby_error = '';
906
  }
 
 
 
 
 
 
 
 
 
907
  ?>
908
 
909
  <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
@@ -923,7 +914,7 @@ switch ($action) {
923
  */
924
  do_action( 'login_form' );
925
  ?>
926
- <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me', 'all-in-one-wp-security-and-firewall'); ?></label></p>
927
  <p class="submit">
928
  <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In', 'all-in-one-wp-security-and-firewall'); ?>" />
929
  <?php if ( $interim_login ) { ?>
@@ -948,7 +939,7 @@ switch ($action) {
948
  echo apply_filters( 'register', $registration_url ) . ' | ';
949
  endif;
950
  ?>
951
- <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found', 'all-in-one-wp-security-and-firewall' ); ?>"><?php _e( 'Lost your password?', 'all-in-one-wp-security-and-firewall' ); ?></a>
952
  <?php endif; ?>
953
  </p>
954
  <?php } ?>
@@ -973,9 +964,16 @@ d.select();
973
  }, 200);
974
  }
975
 
976
- <?php if ( !$errors ) { ?>
977
- wp_attempt_focus();
978
- <?php } ?>
 
 
 
 
 
 
 
979
  if(typeof wpOnload=='function')wpOnload();
980
  <?php if ( $interim_login ) { ?>
981
  (function(){
34
  // Don't index any of these forms
35
  add_action( 'login_head', 'wp_no_robots' );
36
 
37
+ add_action( 'login_head', 'wp_login_viewport_meta' );
 
38
 
39
  if ( empty($wp_error) )
40
  $wp_error = new WP_Error();
53
  if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
54
  add_action( 'login_head', 'wp_shake_js', 12 );
55
 
56
+ $separator = is_rtl() ? ' &rsaquo; ' : ' &lsaquo; ';
57
+
58
  ?><!DOCTYPE html>
59
  <!--[if IE 8]>
60
  <html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php language_attributes(); ?>>
64
  <!--<![endif]-->
65
  <head>
66
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
67
+ <title><?php echo get_bloginfo( 'name', 'display' ) . $separator . $title; ?></title>
68
  <?php
69
 
70
+ wp_enqueue_style( 'login' );
71
 
72
  /*
73
  * Remove all stored post data on logging out.
95
 
96
  if ( is_multisite() ) {
97
  $login_header_url = network_home_url();
98
+ $login_header_title = get_network()->site_name;
99
  } else {
100
  $login_header_url = __( 'https://wordpress.org/' );
101
  $login_header_title = __( 'Powered by WordPress', 'all-in-one-wp-security-and-firewall' );
119
  $login_header_title = apply_filters( 'login_headertitle', $login_header_title );
120
 
121
  $classes = array( 'login-action-' . $action, 'wp-core-ui' );
 
 
122
  if ( is_rtl() )
123
  $classes[] = 'rtl';
124
  if ( $interim_login ) {
144
  ?>
145
  </head>
146
  <body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
147
+ <?php
148
+ /**
149
+ * Fires in the login page header after the body tag is opened.
150
+ *
151
+ * @since 4.6.0
152
+ */
153
+ do_action( 'login_header' );
154
+ ?>
155
  <div id="login">
156
  <h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
157
  <?php
221
 
222
  // Don't allow interim logins to navigate away from the page.
223
  if ( ! $interim_login ): ?>
224
+ <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php
225
+ /* translators: %s: site title */
226
+ printf( _x( '&larr; Back to %s', 'all-in-one-wp-security-and-firewall' ), get_bloginfo( 'title', 'display' ) );
227
+ ?></a></p>
228
  <?php endif; ?>
229
 
230
  </div>
253
  * @since 3.0.0
254
  */
255
  function wp_shake_js() {
 
 
256
  ?>
257
  <script type="text/javascript">
258
  addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
276
  /**
277
  * Handles sending password retrieval email to user.
278
  *
 
 
 
279
  * @return bool|WP_Error True: when finish. WP_Error on error
280
  */
281
  function retrieve_password() {
 
 
282
  $errors = new WP_Error();
283
 
284
  if ( empty( $_POST['user_login'] ) ) {
285
  $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'all-in-one-wp-security-and-firewall' ));
286
  } elseif ( strpos( $_POST['user_login'], '@' ) ) {
287
+ $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
288
  if ( empty( $user_data ) )
289
  $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'all-in-one-wp-security-and-firewall' ));
290
  } else {
293
  }
294
 
295
  /**
296
+ * Fires before errors are returned from a password reset request.
297
+ *
298
+ * @since 2.1.0
299
+ * @since 4.4.0 Added the `$errors` parameter.
300
+ *
301
+ * @param WP_Error $errors A WP_Error object containing any errors generated
302
+ * by using invalid credentials.
303
+ */
304
+ do_action( 'lostpassword_post', $errors );
305
 
306
  if ( $errors->get_error_code() )
307
  return $errors;
308
 
309
  if ( !$user_data ) {
310
+ $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or email.', 'all-in-one-wp-security-and-firewall' ));
311
  return $errors;
312
  }
313
 
314
  // Redefining user_login ensures we return the right case in the email.
315
  $user_login = $user_data->user_login;
316
  $user_email = $user_data->user_email;
317
+ $key = get_password_reset_key( $user_data );
318
 
319
+ if ( is_wp_error( $key ) ) {
320
+ return $key;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  }
322
 
323
+ $message = __('Someone has requested a password reset for the following account:', 'all-in-one-wp-security-and-firewall' ) . "\r\n\r\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  $message .= network_home_url( '/' ) . "\r\n\r\n";
325
  $message .= sprintf(__('Username: %s', 'all-in-one-wp-security-and-firewall' ), $user_login) . "\r\n\r\n";
326
  $message .= __('If this was a mistake, just ignore this email and nothing will happen.', 'all-in-one-wp-security-and-firewall' ) . "\r\n\r\n";
327
  $message .= __('To reset your password, visit the following address:', 'all-in-one-wp-security-and-firewall' ) . "\r\n\r\n";
328
  $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
329
 
330
+ if ( is_multisite() ) {
331
+ $blogname = get_network()->site_name;
332
+ } else {
333
+ /*
334
+ * The blogname option is escaped with esc_html on the way into the database
335
+ * in sanitize_option we want to reverse this for the plain text arena of emails.
336
+ */
337
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
338
+ }
 
339
 
340
+ /* translators: Password reset email subject. 1: Site name */
341
+ $title = sprintf( __('[%s] Password Reset'), $blogname );
 
 
 
 
 
 
342
 
343
  /**
344
+ * Filters the subject of the password reset email.
345
  *
346
  * @since 2.8.0
347
+ * @since 4.4.0 Added the `$user_login` and `$user_data` parameters.
348
  *
349
+ * @param string $title Default email title.
 
350
  * @param string $user_login The username for the user.
351
  * @param WP_User $user_data WP_User object.
352
  */
353
+ $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data );
354
+
355
+ /**
356
+ * Filter the message body of the password reset mail.
357
+ *
358
+ * If the filtered message is empty, the password reset email will not be sent.
359
+ *
360
+ * @since 2.8.0
361
+ * @since 4.1.0 Added `$user_login` and `$user_data` parameters.
362
+ *
363
+ * @param string $message Default mail message.
364
+ * @param string $key The activation key.
365
+ * @param string $user_login The username for the user.
366
+ * @param WP_User $user_data WP_User object.
367
+ */
368
  $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
369
 
370
  if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
371
+ wp_die( __('The email could not be sent.', 'all-in-one-wp-security-and-firewall' ) . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.', 'all-in-one-wp-security-and-firewall' ) );
372
 
373
  return true;
374
  }
401
  }
402
 
403
  //Set a cookie now to see if they are supported by the browser.
404
+ $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
405
  setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
406
  if ( SITECOOKIEPATH != COOKIEPATH )
407
  setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
421
  *
422
  * @since 2.8.0
423
  */
424
+ do_action( "login_form_{$action}" );
425
 
426
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
427
  $interim_login = isset($_REQUEST['interim-login']);
429
  switch ($action) {
430
 
431
  case 'postpass' :
432
+ if ( ! array_key_exists( 'post_password', $_POST ) ) {
433
+ wp_safe_redirect( wp_get_referer() );
434
+ exit();
435
+ }
436
+
437
  require_once ABSPATH . WPINC . '/class-phpass.php';
438
  $hasher = new PasswordHash( 8, true );
439
 
526
 
527
  <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
528
  <p>
529
+ <label for="user_login" ><?php _e('Username or Email Address', 'all-in-one-wp-security-and-firewall') ?><br />
530
  <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
531
  </p>
532
  <?php
618
  <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
619
  <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
620
 
621
+ <div class="user-pass1-wrap">
622
+ <p>
623
+ <label for="pass1"><?php _e( 'New password' ) ?></label>
624
+ </p>
625
+
626
+ <div class="wp-pwd">
627
+ <span class="password-input-wrapper">
628
+ <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" />
629
+ </span>
630
+ <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator', 'all-in-one-wp-security-and-firewall' ); ?></div>
631
+ </div>
632
  </div>
 
633
  <p class="user-pass2-wrap">
634
  <label for="pass2"><?php _e('Confirm new password', 'all-in-one-wp-security-and-firewall') ?></label><br />
635
  <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />
689
  $user_login = '';
690
  $user_email = '';
691
  if ( $http_post ) {
692
+ $user_login = isset( $_POST['user_login'] ) ? $_POST['user_login'] : '';
693
+ $user_email = isset( $_POST['user_email'] ) ? wp_unslash( $_POST['user_email'] ) : '';
694
  $errors = register_new_user($user_login, $user_email);
695
  if ( !is_wp_error($errors) ) {
696
  $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
711
  login_header(__('Registration Form', 'all-in-one-wp-security-and-firewall' ), '<p class="message register">' . __('Register For This Site', 'all-in-one-wp-security-and-firewall' ) . '</p>', $errors);
712
  ?>
713
 
714
+ <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate">
715
  <p>
716
  <label for="user_login"><?php _e('Username', 'all-in-one-wp-security-and-firewall') ?><br />
717
  <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
718
  </p>
719
  <p>
720
+ <label for="user_email"><?php _e('Email', 'all-in-one-wp-security-and-firewall') ?><br />
721
  <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label>
722
  </p>
723
  <?php
724
  /**
725
+ * Fires following the 'Email' field in the user registration form.
726
  *
727
  * @since 2.1.0
728
  */
729
  do_action( 'register_form' );
730
  ?>
731
+ <p id="reg_passmail"><?php _e( 'Registration confirmation will be emailed to you.', 'all-in-one-wp-security-and-firewall' ); ?></p>
732
  <br class="clear" />
733
  <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
734
  <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register', 'all-in-one-wp-security-and-firewall'); ?>" /></p>
736
 
737
  <p id="nav">
738
  <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in', 'all-in-one-wp-security-and-firewall' ); ?></a> |
739
+ <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'all-in-one-wp-security-and-firewall' ); ?></a>
740
  </p>
741
 
742
  <?php
751
  wp_enqueue_script( 'customize-base' );
752
 
753
  // If the user wants ssl but the session is not ssl, force a secure cookie.
754
+ if ( !empty($_POST['log']) && !force_ssl_admin() ) {
755
+ $user_name = sanitize_user($_POST['log']);
756
+ $user = get_user_by( 'login', $user_name );
757
+
758
+ if ( ! $user && strpos( $user_name, '@' ) ) {
759
+ $user = get_user_by( 'email', $user_name );
760
+ }
761
+
762
+ if ( $user ) {
763
+ if ( get_user_option('use_ssl', $user->ID) ) {
764
+ $secure_cookie = true;
765
+ force_ssl_admin(true);
766
+ }
767
+ }
768
+ }
769
 
770
  if ( isset( $_REQUEST['redirect_to'] ) ) {
771
  $redirect_to = $_REQUEST['redirect_to'];
778
 
779
  $reauth = empty($_REQUEST['reauth']) ? false : true;
780
 
781
+ $user = wp_signon( array(), $secure_cookie );
782
 
783
  if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
784
  if ( headers_sent() ) {
785
+ /* translators: 1: Browser cookie documentation URL, 2: Support forums URL */
786
+ $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.', 'all-in-one-wp-security-and-firewall' ),
787
+ __( 'https://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
788
  } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
789
  // If cookies are disabled we can't log in even with a valid user+pass
790
+ /* translators: 1: Browser cookie documentation URL */
791
+ $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.', 'all-in-one-wp-security-and-firewall' ),
792
+ __( 'https://codex.wordpress.org/Cookies' ) ) );
793
  }
794
  }
795
 
828
  elseif ( is_multisite() && !$user->has_cap('read') )
829
  $redirect_to = get_dashboard_url( $user->ID );
830
  elseif ( !$user->has_cap('edit_posts') )
831
+ $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url();
832
+
833
+ wp_redirect( $redirect_to );
834
+ exit();
835
  }
836
  wp_safe_redirect($redirect_to);
837
  exit();
844
 
845
  if ( $interim_login ) {
846
  if ( ! $errors->get_error_code() )
847
+ $errors->add('expired', __('Your session has expired. Please log in to continue where you left off.', 'all-in-one-wp-security-and-firewall' ), 'message');
848
  } else {
849
  // Some parts of this script use the main login form to display a message
850
  if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] )
852
  elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
853
  $errors->add('registerdisabled', __('User registration is currently not allowed.', 'all-in-one-wp-security-and-firewall' ));
854
  elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
855
+ $errors->add('confirm', __('Check your email for the confirmation link.', 'all-in-one-wp-security-and-firewall' ), 'message');
856
  elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
857
+ $errors->add('newpass', __('Check your email for your new password.', 'all-in-one-wp-security-and-firewall' ), 'message');
858
  elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
859
+ $errors->add('registered', __('Registration complete. Please check your email.', 'all-in-one-wp-security-and-firewall' ), 'message');
860
  elseif ( strpos( $redirect_to, 'about.php?updated' ) )
861
  $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.', 'all-in-one-wp-security-and-firewall' ), 'message' );
862
  }
870
  * @param string $redirect_to Redirect destination URL.
871
  */
872
  $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
873
+
874
  // Clear any stale cookies.
875
  if ( $reauth )
876
  wp_clear_auth_cookie();
886
  } else {
887
  $aria_describedby_error = '';
888
  }
889
+
890
+ //aiowps - this check is necessary because otherwise if variables are undefined we get a warning!
891
+ if(empty($user_login)){
892
+ $user_login = '';
893
+ }
894
+ if(empty($error)){
895
+ $error = '';
896
+ }
897
+
898
  ?>
899
 
900
  <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
914
  */
915
  do_action( 'login_form' );
916
  ?>
917
+ <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_html_e('Remember Me', 'all-in-one-wp-security-and-firewall'); ?></label></p>
918
  <p class="submit">
919
  <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In', 'all-in-one-wp-security-and-firewall'); ?>" />
920
  <?php if ( $interim_login ) { ?>
939
  echo apply_filters( 'register', $registration_url ) . ' | ';
940
  endif;
941
  ?>
942
+ <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'all-in-one-wp-security-and-firewall' ); ?></a>
943
  <?php endif; ?>
944
  </p>
945
  <?php } ?>
964
  }, 200);
965
  }
966
 
967
+ /**
968
+ * Filters whether to print the call to `wp_attempt_focus()` on the login screen.
969
+ *
970
+ * @since 4.8.0
971
+ *
972
+ * @param bool $print Whether to print the function call. Default true.
973
+ */
974
+ <?php if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) { ?>
975
+ wp_attempt_focus();
976
+ <?php } ?>
977
  if(typeof wpOnload=='function')wpOnload();
978
  <?php if ( $interim_login ) { ?>
979
  (function(){
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Tips and Tricks HQ, wpsolutions, Peter Petreski, Ruhul Amin, mbrso
3
  Donate link: https://www.tipsandtricks-hq.com
4
  Tags: security, secure, Anti Virus, antivirus, ban, ban hacker, virus, firewall, firewall security, login, lockdown, htaccess, hack, malware, vulnerability, protect, protection, phishing, database, backup, plugin, sql injection, ssl, restrict, login captcha, bot, hotlink, 404 detection, admin, rename, all in one, scan, scanner, iframe,
5
  Requires at least: 3.5
6
- Tested up to: 4.8
7
- Stable tag: 4.2.9
8
  License: GPLv3
9
 
10
  A comprehensive, user-friendly, all in one WordPress security and firewall plugin for your site.
@@ -184,6 +184,19 @@ None
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  = 4.2.9 =
188
  - Changed the parameter in current_user_can function to use an administrator capability instead of the "administrator" role name.
189
  - Added some new hooks to the AIOWPSecurity_WP_Loaded_Tasks called aiowps_wp_loaded_tasks_start and aiowps_wp_loaded_tasks_end.
3
  Donate link: https://www.tipsandtricks-hq.com
4
  Tags: security, secure, Anti Virus, antivirus, ban, ban hacker, virus, firewall, firewall security, login, lockdown, htaccess, hack, malware, vulnerability, protect, protection, phishing, database, backup, plugin, sql injection, ssl, restrict, login captcha, bot, hotlink, 404 detection, admin, rename, all in one, scan, scanner, iframe,
5
  Requires at least: 3.5
6
+ Tested up to: 4.9
7
+ Stable tag: 4.3.1
8
  License: GPLv3
9
 
10
  A comprehensive, user-friendly, all in one WordPress security and firewall plugin for your site.
184
 
185
  == Changelog ==
186
 
187
+ = 4.3.1 =
188
+ - Improved white list directives to cater for Apache 2.4 and earlier versions.
189
+ - Added 3 filters for the manual account registration approval email: aiowps_register_approval_email_subject, aiowps_register_approval_email_msg, aiowps_register_approval_email_from_name
190
+ - Added configuration option to allow custom firewall rules to be applied at beginning of all rules applied by aiowps.
191
+ - Changed record insertions to DB table aiowps_failed_logins to store the full IP address instead of IP range.
192
+
193
+ = 4.3.0 =
194
+ - Updated wp-security-rename-login-feature.php to include latest WordPress core changes.
195
+ - Added captcha for woocommerce login and registration forms.
196
+ - Fixed "mixed line endings" warnings for whois library.
197
+ - Moved DB cleanup task cron job from daily to hourly.
198
+ - Updated the reapply htaccess function so it doesn't create the header already sent error.
199
+
200
  = 4.2.9 =
201
  - Changed the parameter in current_user_can function to use an administrator capability instead of the "administrator" role name.
202
  - Added some new hooks to the AIOWPSecurity_WP_Loaded_Tasks called aiowps_wp_loaded_tasks_start and aiowps_wp_loaded_tasks_end.
wp-security-core.php CHANGED
@@ -7,7 +7,7 @@ if ( !defined('ABSPATH') ) {
7
  if (!class_exists('AIO_WP_Security')){
8
 
9
  class AIO_WP_Security{
10
- var $version = '4.2.9';
11
  var $db_version = '1.9';
12
  var $plugin_url;
13
  var $plugin_path;
7
  if (!class_exists('AIO_WP_Security')){
8
 
9
  class AIO_WP_Security{
10
+ var $version = '4.3.1';
11
  var $db_version = '1.9';
12
  var $plugin_url;
13
  var $plugin_path;
wp-security.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: All In One WP Security
4
- Version: 4.2.9
5
  Plugin URI: https://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin
6
- Author: Tips and Tricks HQ, Peter, Ruhul, Ivy
7
  Author URI: https://www.tipsandtricks-hq.com/
8
  Description: All round best WordPress security plugin!
9
  Text Domain: all-in-one-wp-security-and-firewall
1
  <?php
2
  /*
3
  Plugin Name: All In One WP Security
4
+ Version: 4.3.1
5
  Plugin URI: https://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin
6
+ Author: Tips and Tricks HQ, Peter Petreski, Ruhul, Ivy
7
  Author URI: https://www.tipsandtricks-hq.com/
8
  Description: All round best WordPress security plugin!
9
  Text Domain: all-in-one-wp-security-and-firewall