| @@ -4,10 +4,10 @@ | ||
| 4 | 4 | echo 'You are not allowed to access this page directly.'; |
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -define('LOGINIZER_VERSION', '1.3.3'); | |
| 9 | -define('LOGINIZER_DIR', WP_PLUGIN_DIR.'/'.basename(dirname(LOGINIZER_FILE))); | |
| 8 | +define('LOGINIZER_VERSION', '1.4.7'); | |
| 9 | +define('LOGINIZER_DIR', dirname(LOGINIZER_FILE)); | |
| 10 | 10 | define('LOGINIZER_URL', plugins_url('', LOGINIZER_FILE)); |
| 11 | 11 | define('LOGINIZER_PRO_URL', 'https://loginizer.com/features#compare'); |
| 12 | 12 | define('LOGINIZER_DOCS', 'https://loginizer.com/docs/'); |
| 13 | 13 | |
| @@ -30,8 +30,9 @@ | ||
| 30 | 30 | `time` int(10) NOT NULL DEFAULT '0', |
| 31 | 31 | `count` int(10) NOT NULL DEFAULT '0', |
| 32 | 32 | `lockout` int(10) NOT NULL DEFAULT '0', |
| 33 | 33 | `ip` varchar(255) NOT NULL DEFAULT '', |
| 34 | + `url` varchar(255) NOT NULL DEFAULT '', | |
| 34 | 35 | UNIQUE KEY `ip` (`ip`) |
| 35 | 36 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; |
| 36 | 37 | |
| 37 | 38 | foreach($sql as $sk => $sv){ |
| @@ -158,11 +159,24 @@ | ||
| 158 | 159 | } |
| 159 | 160 | |
| 160 | 161 | } |
| 161 | 162 | |
| 163 | + // Is it less than 1.3.9 ? | |
| 164 | + if($version < 139){ | |
| 165 | + | |
| 166 | + $wpdb->query("ALTER TABLE ".$wpdb->prefix."loginizer_logs ADD `url` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ip`;"); | |
| 167 | + | |
| 168 | + } | |
| 169 | + | |
| 162 | 170 | // Save the new Version |
| 163 | 171 | update_option('loginizer_version', LOGINIZER_VERSION); |
| 164 | 172 | |
| 173 | + // In Sitepad Math Captcha is enabled by default | |
| 174 | + if(defined('SITEPAD') && get_option('loginizer_captcha') === false){ | |
| 175 | + $option['captcha_no_google'] = 1; | |
| 176 | + add_option('loginizer_captcha', $option); | |
| 177 | + } | |
| 178 | + | |
| 165 | 179 | } |
| 166 | 180 | |
| 167 | 181 | // Add the action to load the plugin |
| 168 | 182 | add_action('plugins_loaded', 'loginizer_load_plugin'); |
| @@ -177,10 +191,18 @@ | ||
| 177 | 191 | |
| 178 | 192 | // Set the array |
| 179 | 193 | $loginizer = array(); |
| 180 | 194 | |
| 195 | + $loginizer['prefix'] = !defined('SITEPAD') ? 'Loginizer ' : 'SitePad '; | |
| 196 | + $loginizer['app'] = !defined('SITEPAD') ? 'WordPress' : 'SitePad'; | |
| 197 | + $loginizer['login_basename'] = !defined('SITEPAD') ? 'wp-login.php' : 'login.php'; | |
| 198 | + $loginizer['wp-includes'] = !defined('SITEPAD') ? 'wp-includes' : 'site-inc'; | |
| 199 | + | |
| 181 | 200 | // The IP Method to use |
| 182 | 201 | $loginizer['ip_method'] = get_option('loginizer_ip_method'); |
| 202 | + if($loginizer['ip_method'] == 3){ | |
| 203 | + $loginizer['custom_ip_method'] = get_option('loginizer_custom_ip_method'); | |
| 204 | + } | |
| 183 | 205 | |
| 184 | 206 | // Load settings |
| 185 | 207 | $options = get_option('loginizer_options'); |
| 186 | 208 | $loginizer['max_retries'] = empty($options['max_retries']) ? 3 : $options['max_retries']; |
| @@ -188,8 +210,21 @@ | ||
| 188 | 210 | $loginizer['max_lockouts'] = empty($options['max_lockouts']) ? 5 : $options['max_lockouts']; |
| 189 | 211 | $loginizer['lockouts_extend'] = empty($options['lockouts_extend']) ? 86400 : $options['lockouts_extend']; // 24 hours |
| 190 | 212 | $loginizer['reset_retries'] = empty($options['reset_retries']) ? 86400 : $options['reset_retries']; // 24 hours |
| 191 | 213 | $loginizer['notify_email'] = empty($options['notify_email']) ? 0 : $options['notify_email']; |
| 214 | + | |
| 215 | + // Default messages | |
| 216 | + $loginizer['d_msg']['inv_userpass'] = 'Incorrect Username or Password'; | |
| 217 | + $loginizer['d_msg']['ip_blacklisted'] = 'Your IP has been blacklisted'; | |
| 218 | + | |
| 219 | + // Message Strings | |
| 220 | + $loginizer['msg'] = get_option('loginizer_msg'); | |
| 221 | + | |
| 222 | + foreach($loginizer['d_msg'] as $lk => $lv){ | |
| 223 | + if(empty($loginizer['msg'][$lk])){ | |
| 224 | + $loginizer['msg'][$lk] = $loginizer['d_msg'][$lk]; | |
| 225 | + } | |
| 226 | + } | |
| 192 | 227 | |
| 193 | 228 | // Load the blacklist and whitelist |
| 194 | 229 | $loginizer['blacklist'] = get_option('loginizer_blacklist'); |
| 195 | 230 | $loginizer['whitelist'] = get_option('loginizer_whitelist'); |
| @@ -212,24 +247,31 @@ | ||
| 212 | 247 | $loginizer['ins_time'] = $ins_time; |
| 213 | 248 | |
| 214 | 249 | // Set the current IP |
| 215 | 250 | $loginizer['current_ip'] = lz_getip(); |
| 251 | + | |
| 252 | + // Is Brute Force Disabled ? | |
| 253 | + $loginizer['disable_brute'] = get_option('loginizer_disable_brute'); | |
| 216 | 254 | |
| 217 | - /* Filters and actions */ | |
| 255 | + // Filters and actions | |
| 256 | + if(empty($loginizer['disable_brute'])){ | |
| 218 | 257 | |
| 219 | - // Use this to verify before WP tries to login | |
| 220 | - // Is always called and is the first function to be called | |
| 221 | - //add_action('wp_authenticate', 'loginizer_wp_authenticate', 10, 2);// Not called by XML-RPC | |
| 222 | - add_filter('authenticate', 'loginizer_wp_authenticate', 10001, 3);// This one is called by xmlrpc as well as GUI | |
| 258 | + // Use this to verify before WP tries to login | |
| 259 | + // Is always called and is the first function to be called | |
| 260 | + //add_action('wp_authenticate', 'loginizer_wp_authenticate', 10, 2);// Not called by XML-RPC | |
| 261 | + add_filter('authenticate', 'loginizer_wp_authenticate', 10001, 3);// This one is called by xmlrpc as well as GUI | |
| 262 | + | |
| 263 | + // Is called when a login attempt fails | |
| 264 | + // Hence Update our records that the login failed | |
| 265 | + add_action('wp_login_failed', 'loginizer_login_failed'); | |
| 266 | + | |
| 267 | + // Is called before displaying the error message so that we dont show that the username is wrong or the password | |
| 268 | + // Update Error message | |
| 269 | + add_action('wp_login_errors', 'loginizer_error_handler', 10001, 2); | |
| 270 | + add_action('woocommerce_login_failed', 'loginizer_woocommerce_error_handler', 10001); | |
| 223 | 271 | |
| 224 | - // Is called when a login attempt fails | |
| 225 | - // Hence Update our records that the login failed | |
| 226 | - add_action('wp_login_failed', 'loginizer_login_failed'); | |
| 272 | + } | |
| 227 | 273 | |
| 228 | - // Is called before displaying the error message so that we dont show that the username is wrong or the password | |
| 229 | - // Update Error message | |
| 230 | - add_action('wp_login_errors', 'loginizer_error_handler', 10001, 2); | |
| 231 | - | |
| 232 | 274 | // Is the premium features there ? |
| 233 | 275 | if(file_exists(LOGINIZER_DIR.'/premium.php')){ |
| 234 | 276 | |
| 235 | 277 | // Include the file |
| @@ -432,11 +474,11 @@ | ||
| 432 | 474 | // Is he in the lockout time ? |
| 433 | 475 | if($result['time'] >= (time() - $loginizer['lockout_time'])){ |
| 434 | 476 | $banlift = ceil((($result['time'] + $loginizer['lockout_time']) - time()) / 60); |
| 435 | 477 | |
| 436 | - //echo 'Current Time '.date('m/d/Y H:i:s', time()).'<br />'; | |
| 437 | - //echo 'Last attempt '.date('m/d/Y H:i:s', $result['time']).'<br />'; | |
| 438 | - //echo 'Unlock Time '.date('m/d/Y H:i:s', $result['time'] + $loginizer['lockout_time']).'<br />'; | |
| 478 | + //echo 'Current Time '.date('d/M/Y H:i:s P', time()).'<br />'; | |
| 479 | + //echo 'Last attempt '.date('d/M/Y H:i:s P', $result['time']).'<br />'; | |
| 480 | + //echo 'Unlock Time '.date('d/M/Y H:i:s P', $result['time'] + $loginizer['lockout_time']).'<br />'; | |
| 439 | 481 | |
| 440 | 482 | $_time = $banlift.' minute(s)'; |
| 441 | 483 | |
| 442 | 484 | if($banlift > 60){ |
| @@ -485,9 +527,9 @@ | ||
| 485 | 527 | } |
| 486 | 528 | |
| 487 | 529 | // You are blacklisted |
| 488 | 530 | if(!empty($result)){ |
| 489 | - $lz_error['ip_blacklisted'] = 'Your IP has been blacklisted'; | |
| 531 | + $lz_error['ip_blacklisted'] = $loginizer['msg']['ip_blacklisted']; | |
| 490 | 532 | return true; |
| 491 | 533 | } |
| 492 | 534 | |
| 493 | 535 | return false; |
| @@ -542,13 +584,16 @@ | ||
| 542 | 584 | global $wpdb, $loginizer, $lz_cannot_login; |
| 543 | 585 | |
| 544 | 586 | if(empty($lz_cannot_login) && empty($loginizer['ip_is_whitelisted']) && empty($loginizer['no_loginizer_logs'])){ |
| 545 | 587 | |
| 588 | + $url = @addslashes((!empty($_SERVER['HTTPS']) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); | |
| 589 | + $url = esc_url($url); | |
| 590 | + | |
| 546 | 591 | $result = lz_selectquery("SELECT * FROM `".$wpdb->prefix."loginizer_logs` WHERE `ip` = '".$loginizer['current_ip']."';"); |
| 547 | 592 | |
| 548 | 593 | if(!empty($result)){ |
| 549 | 594 | $lockout = floor((($result['count']+1) / $loginizer['max_retries'])); |
| 550 | - $sresult = $wpdb->query("UPDATE `".$wpdb->prefix."loginizer_logs` SET `username` = '".$username."', `time` = '".time()."', `count` = `count`+1, `lockout` = '".$lockout."' WHERE `ip` = '".$loginizer['current_ip']."';"); | |
| 595 | + $sresult = $wpdb->query("UPDATE `".$wpdb->prefix."loginizer_logs` SET `username` = '".$username."', `time` = '".time()."', `count` = `count`+1, `lockout` = '".$lockout."', `url` = '".$url."' WHERE `ip` = '".$loginizer['current_ip']."';"); | |
| 551 | 596 | |
| 552 | 597 | // Do we need to email admin ? |
| 553 | 598 | if(!empty($loginizer['notify_email']) && $lockout >= $loginizer['notify_email']){ |
| 554 | 599 | |
| @@ -559,11 +604,11 @@ | ||
| 559 | 604 | $mail['message'] = 'Hi, |
| 560 | 605 | |
| 561 | 606 | '.($result['count']+1).' failed login attempts and '.$lockout.' lockout(s) from IP '.$loginizer['current_ip'].' |
| 562 | 607 | |
| 563 | -Last Login Attempt : '.date('d/m/Y H:i:s', time()).' | |
| 608 | +Last Login Attempt : '.date('d/M/Y H:i:s P', time()).' | |
| 564 | 609 | Last User Attempt : '.$username.' |
| 565 | -IP has been blocked until : '.date('d/m/Y H:i:s', time() + $loginizer['lockout_time']).' | |
| 610 | +IP has been blocked until : '.date('d/M/Y H:i:s P', time() + $loginizer['lockout_time']).' | |
| 566 | 611 | |
| 567 | 612 | Regards, |
| 568 | 613 | Loginizer'; |
| 569 | 614 | |
| @@ -569,9 +614,9 @@ | ||
| 569 | 614 | |
| 570 | 615 | @wp_mail($mail['to'], $mail['subject'], $mail['message']); |
| 571 | 616 | } |
| 572 | 617 | }else{ |
| 573 | - $insert = $wpdb->query("INSERT INTO `".$wpdb->prefix."loginizer_logs` SET `username` = '".$username."', `time` = '".time()."', `count` = '1', `ip` = '".$loginizer['current_ip']."', `lockout` = '0';"); | |
| 618 | + $insert = $wpdb->query("INSERT INTO `".$wpdb->prefix."loginizer_logs` SET `username` = '".$username."', `time` = '".time()."', `count` = '1', `ip` = '".$loginizer['current_ip']."', `lockout` = '0', `url` = '".$url."';"); | |
| 574 | 619 | } |
| 575 | 620 | |
| 576 | 621 | // We need to add one as this is a failed attempt as well |
| 577 | 622 | $result['count'] = $result['count'] + 1; |
| @@ -605,9 +650,9 @@ | ||
| 605 | 650 | } |
| 606 | 651 | |
| 607 | 652 | // Add the error |
| 608 | 653 | if(!empty($lz_user_pass) && !empty($show_error) && empty($lz_cannot_login)){ |
| 609 | - $errors->add('invalid_userpass', '<b>ERROR:</b> Incorrect Username or Password'); | |
| 654 | + $errors->add('invalid_userpass', '<b>ERROR:</b> ' . $loginizer['msg']['inv_userpass']); | |
| 610 | 655 | } |
| 611 | 656 | |
| 612 | 657 | // Add the number of retires left as well |
| 613 | 658 | if(count($errors->get_error_codes()) > 0 && isset($loginizer['retries_left'])){ |
| @@ -617,8 +662,21 @@ | ||
| 617 | 662 | return $errors; |
| 618 | 663 | |
| 619 | 664 | } |
| 620 | 665 | |
| 666 | + | |
| 667 | + | |
| 668 | +// Handles the error of the password not being there | |
| 669 | +function loginizer_woocommerce_error_handler(){ | |
| 670 | + | |
| 671 | + global $wpdb, $loginizer, $lz_user_pass, $lz_cannot_login; | |
| 672 | + | |
| 673 | + if(function_exists('wc_add_notice')){ | |
| 674 | + wc_add_notice( loginizer_retries_left(), 'error' ); | |
| 675 | + } | |
| 676 | + | |
| 677 | +} | |
| 678 | + | |
| 621 | 679 | // Returns a string with the number of retries left |
| 622 | 680 | function loginizer_retries_left(){ |
| 623 | 681 | |
| 624 | 682 | global $wpdb, $loginizer, $lz_user_pass, $lz_cannot_login; |
| @@ -662,34 +720,56 @@ | ||
| 662 | 720 | function loginizer_admin_menu() { |
| 663 | 721 | |
| 664 | 722 | global $wp_version, $loginizer; |
| 665 | 723 | |
| 666 | - // Add the menu page | |
| 667 | - add_menu_page(__('Loginizer Dashboard'), __('Loginizer Security'), 'activate_plugins', 'loginizer', 'loginizer_page_dashboard'); | |
| 724 | + if(!defined('SITEPAD')){ | |
| 668 | 725 | |
| 669 | - // Dashboard | |
| 670 | - add_submenu_page('loginizer', __('Loginizer Dashboard'), __('Dashboard'), 'activate_plugins', 'loginizer', 'loginizer_page_dashboard'); | |
| 726 | + // Add the menu page | |
| 727 | + add_menu_page(__('Loginizer Dashboard'), __('Loginizer Security'), 'activate_plugins', 'loginizer', 'loginizer_page_dashboard'); | |
| 671 | 728 | |
| 729 | + // Dashboard | |
| 730 | + add_submenu_page('loginizer', __('Loginizer Dashboard'), __('Dashboard'), 'activate_plugins', 'loginizer', 'loginizer_page_dashboard'); | |
| 731 | + | |
| 732 | + }else{ | |
| 733 | + | |
| 734 | + // Add the menu page | |
| 735 | + add_menu_page(__('Security'), __('Security'), 'activate_plugins', 'loginizer', 'loginizer_page_security', 'dashicons-shield', 85); | |
| 736 | + | |
| 737 | + // Rename Login | |
| 738 | + add_submenu_page('loginizer', __('Security Settings'), __('Rename Login'), 'activate_plugins', 'loginizer', 'loginizer_page_security'); | |
| 739 | + | |
| 740 | + } | |
| 741 | + | |
| 672 | 742 | // Brute Force |
| 673 | - add_submenu_page('loginizer', __('Loginizer Brute Force Settings'), __('Brute Force'), 'activate_plugins', 'loginizer_brute_force', 'loginizer_page_brute_force'); | |
| 743 | + add_submenu_page('loginizer', __('Brute Force Settings'), __('Brute Force'), 'activate_plugins', 'loginizer_brute_force', 'loginizer_page_brute_force'); | |
| 674 | 744 | |
| 675 | 745 | if(defined('LOGINIZER_PREMIUM')){ |
| 676 | 746 | |
| 677 | 747 | // PasswordLess |
| 678 | - add_submenu_page('loginizer', __('Loginizer PasswordLess Settings'), __('PasswordLess'), 'activate_plugins', 'loginizer_passwordless', 'loginizer_page_passwordless'); | |
| 748 | + add_submenu_page('loginizer', __($loginizer['prefix'].'PasswordLess Settings'), __('PasswordLess'), 'activate_plugins', 'loginizer_passwordless', 'loginizer_page_passwordless'); | |
| 679 | 749 | |
| 680 | - // Two Factor Auth | |
| 681 | - add_submenu_page('loginizer', __('Loginizer Two Factor Authentication'), __('Two Factor Auth'), 'activate_plugins', 'loginizer_2fa', 'loginizer_page_2fa'); | |
| 750 | + // Security Settings | |
| 751 | + if(!defined('SITEPAD')){ | |
| 682 | 752 | |
| 753 | + // Two Factor Auth | |
| 754 | + add_submenu_page('loginizer', __($loginizer['prefix'].' Two Factor Authentication'), __('Two Factor Auth'), 'activate_plugins', 'loginizer_2fa', 'loginizer_page_2fa'); | |
| 755 | + | |
| 756 | + } | |
| 757 | + | |
| 683 | 758 | // reCaptcha |
| 684 | - add_submenu_page('loginizer', __('Loginizer reCAPTCHA Settings'), __('reCAPTCHA'), 'activate_plugins', 'loginizer_recaptcha', 'loginizer_page_recaptcha'); | |
| 759 | + add_submenu_page('loginizer', __($loginizer['prefix'].'reCAPTCHA Settings'), __('reCAPTCHA'), 'activate_plugins', 'loginizer_recaptcha', 'loginizer_page_recaptcha'); | |
| 685 | 760 | |
| 686 | 761 | // Security Settings |
| 687 | - add_submenu_page('loginizer', __('Loginizer Security Settings'), __('Security Settings'), 'activate_plugins', 'loginizer_security', 'loginizer_page_security'); | |
| 762 | + if(!defined('SITEPAD')){ | |
| 688 | 763 | |
| 689 | - // Security Settings | |
| 690 | - add_submenu_page('loginizer', __('Loginizer File Checksums'), __('File Checksums'), 'activate_plugins', 'loginizer_checksums', 'loginizer_page_checksums'); | |
| 691 | - | |
| 764 | + // Security Settings | |
| 765 | + add_submenu_page('loginizer', __($loginizer['prefix'].'Security Settings'), __('Security Settings'), 'activate_plugins', 'loginizer_security', 'loginizer_page_security'); | |
| 766 | + | |
| 767 | + // File Checksums | |
| 768 | + add_submenu_page('loginizer', __('Loginizer File Checksums'), __('File Checksums'), 'activate_plugins', 'loginizer_checksums', 'loginizer_page_checksums'); | |
| 769 | + | |
| 770 | + } | |
| 771 | + | |
| 692 | 772 | }elseif(!defined('LOGINIZER_PREMIUM') && !empty($loginizer['ins_time']) && $loginizer['ins_time'] < (time() - (30*24*3600))){ |
| 693 | 773 | |
| 694 | 774 | // Go Pro link |
| 695 | 775 | add_submenu_page('loginizer', __('Loginizer Go Pro'), __('Go Pro'), 'activate_plugins', LOGINIZER_PRO_URL); |
| @@ -699,19 +779,10 @@ | ||
| 699 | 779 | } |
| 700 | 780 | |
| 701 | 781 | // The Loginizer Admin Options Page |
| 702 | 782 | function loginizer_page_header($title = 'Loginizer'){ |
| 703 | - /*wp_enqueue_script('common'); | |
| 704 | - wp_enqueue_script('wp-lists'); | |
| 705 | - wp_enqueue_script('postbox'); | |
| 706 | - wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); | |
| 707 | 783 | |
| 708 | - echo ' | |
| 709 | -<script> | |
| 710 | -jQuery(document).ready( function() { | |
| 711 | - //add_postbox_toggles("loginizer"); | |
| 712 | -}); | |
| 713 | -</script>';*/ | |
| 784 | + global $loginizer; | |
| 714 | 785 | |
| 715 | 786 | ?> |
| 716 | 787 | <style> |
| 717 | 788 | .lz-right-ul{ |
| @@ -730,12 +801,19 @@ | ||
| 730 | 801 | <div id="top-sortables" class="meta-box-sortables ui-sortable"> |
| 731 | 802 | |
| 732 | 803 | <table cellpadding="2" cellspacing="1" width="100%" class="fixed" border="0"> |
| 733 | 804 | <tr> |
| 734 | - <td valign="top"><h3>'.$title.'</h3></td> | |
| 735 | - <td align="right"><a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/loginizer">Review Loginizer</a></td> | |
| 805 | + <td valign="top"><h3>'.$loginizer['prefix'].$title.'</h3></td>'; | |
| 806 | + | |
| 807 | + if(!defined('SITEPAD')){ | |
| 808 | + | |
| 809 | + echo '<td align="right"><a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/loginizer">Review Loginizer</a></td> | |
| 736 | 810 | <td align="right" width="40"><a target="_blank" href="https://twitter.com/loginizer"><img src="'.LOGINIZER_URL.'/twitter.png" /></a></td> |
| 737 | - <td align="right" width="40"><a target="_blank" href="https://www.facebook.com/Loginizer-815504798591884"><img src="'.LOGINIZER_URL.'/facebook.png" /></a></td> | |
| 811 | + <td align="right" width="40"><a target="_blank" href="https://www.facebook.com/Loginizer-815504798591884"><img src="'.LOGINIZER_URL.'/facebook.png" /></a></td>'; | |
| 812 | + | |
| 813 | + } | |
| 814 | + | |
| 815 | + echo ' | |
| 738 | 816 | </tr> |
| 739 | 817 | </table> |
| 740 | 818 | <hr /> |
| 741 | 819 | |
| @@ -750,12 +828,14 @@ | ||
| 750 | 828 | function loginizer_page_footer(){ |
| 751 | 829 | |
| 752 | 830 | echo '</td> |
| 753 | 831 | <td width="200" valign="top" id="loginizer-right-bar">'; |
| 832 | + | |
| 833 | + if(!defined('SITEPAD')){ | |
| 754 | 834 | |
| 755 | - if(!defined('LOGINIZER_PREMIUM')){ | |
| 835 | + if(!defined('LOGINIZER_PREMIUM')){ | |
| 756 | 836 | |
| 757 | - echo ' | |
| 837 | + echo ' | |
| 758 | 838 | <div class="postbox" style="min-width:0px !important;"> |
| 759 | 839 | <h2 class="hndle ui-sortable-handle"> |
| 760 | 840 | <span>Premium Version</span> |
| 761 | 841 | </h2> |
| @@ -770,15 +850,15 @@ | ||
| 770 | 850 | <li>Rename Login Page</li> |
| 771 | 851 | <li>Disable XML-RPC</li> |
| 772 | 852 | <li>And many more ...</li> |
| 773 | 853 | </ul> |
| 774 | - <center><a class="button button-primary" href="https://loginizer.com/members/cart.php">Upgrade</a></center> | |
| 854 | + <center><a class="button button-primary" href="https://loginizer.com/pricing">Upgrade</a></center> | |
| 775 | 855 | </div> |
| 776 | 856 | </div>'; |
| 777 | 857 | |
| 778 | - }else{ | |
| 858 | + }else{ | |
| 779 | 859 | |
| 780 | - echo ' | |
| 860 | + echo ' | |
| 781 | 861 | <div class="postbox" style="min-width:0px !important;"> |
| 782 | 862 | <h2 class="hndle ui-sortable-handle"> |
| 783 | 863 | <span>Recommendations</span> |
| 784 | 864 | </h2> |
| @@ -793,17 +873,65 @@ | ||
| 793 | 873 | <li>Change \'admin\' Username</li> |
| 794 | 874 | </ul> |
| 795 | 875 | </div> |
| 796 | 876 | </div>'; |
| 877 | + } | |
| 878 | + | |
| 879 | + echo ' | |
| 880 | + <div class="postbox" style="min-width:0px !important;"> | |
| 881 | + <h2 class="hndle ui-sortable-handle"> | |
| 882 | + <span><a target="_blank" href="https://pagelayer.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/images/pagelayer_product.png" width="100%" /></a></span> | |
| 883 | + </h2> | |
| 884 | + <div class="inside"> | |
| 885 | + <i>Easily manage and make professional pages and content with our Pagelayer builder </i>:<br> | |
| 886 | + <ul class="lz-right-ul"> | |
| 887 | + <li>30+ Free Widgets</li> | |
| 888 | + <li>60+ Premium Widgets</li> | |
| 889 | + <li>400+ Premium Sections</li> | |
| 890 | + <li>Theme Builder</li> | |
| 891 | + <li>WooCommerce Builder</li> | |
| 892 | + <li>Theme Creator and Exporter</li> | |
| 893 | + <li>Form Builder</li> | |
| 894 | + <li>Popup Builder</li> | |
| 895 | + <li>And many more ...</li> | |
| 896 | + </ul> | |
| 897 | + <center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/pagelayer/">Visit Pagelayer</a></center> | |
| 898 | + </div> | |
| 899 | + </div>'; | |
| 900 | + | |
| 901 | + echo ' | |
| 902 | + <div class="postbox" style="min-width:0px !important;"> | |
| 903 | + <h2 class="hndle ui-sortable-handle"> | |
| 904 | + <span><a target="_blank" href="https://wpcentral.co/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/images/wpcentral_product.png" width="100%" /></a></span> | |
| 905 | + </h2> | |
| 906 | + <div class="inside"> | |
| 907 | + <i>Manage all your WordPress sites from <b>1 dashboard</b> </i>:<br> | |
| 908 | + <ul class="lz-right-ul"> | |
| 909 | + <li>1-click Admin Access</li> | |
| 910 | + <li>Update WordPress</li> | |
| 911 | + <li>Update Themes</li> | |
| 912 | + <li>Update Plugins</li> | |
| 913 | + <li>Backup your WordPress Site</li> | |
| 914 | + <li>Plugins & Theme Management</li> | |
| 915 | + <li>Post Management</li> | |
| 916 | + <li>And many more ...</li> | |
| 917 | + </ul> | |
| 918 | + <center><a class="button button-primary" target="_blank" href="https://wpcentral.co/?from=loginizer-plugin">Visit wpCentral</a></center> | |
| 919 | + </div> | |
| 920 | + </div>'; | |
| 921 | + | |
| 797 | 922 | } |
| 798 | 923 | |
| 799 | 924 | echo '</td> |
| 800 | 925 | </tr> |
| 801 | - </table> | |
| 802 | - <br /> | |
| 926 | + </table>'; | |
| 927 | + | |
| 928 | + if(!defined('SITEPAD')){ | |
| 929 | + | |
| 930 | + echo '<br /> | |
| 803 | 931 | <div style="width:45%;background:#FFF;padding:15px; margin:auto"> |
| 804 | 932 | <b>Let your friends know that you have secured your website :</b> |
| 805 | - <form method="get" action="http://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);"> | |
| 933 | + <form method="get" action="https://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);"> | |
| 806 | 934 | <textarea name="text" cols="45" row="3" style="resize:none;">I just secured my @WordPress site against #bruteforce using @loginizer</textarea> |
| 807 | 935 | <input type="submit" value="Tweet!" class="button button-primary" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/> |
| 808 | 936 | </form> |
| 809 | 937 | |
| @@ -817,10 +945,13 @@ | ||
| 817 | 945 | } |
| 818 | 946 | </script> |
| 819 | 947 | |
| 820 | 948 | <hr /> |
| 821 | - <a href="http://loginizer.com" target="_blank">Loginizer</a> v'.LOGINIZER_VERSION.'. You can report any bugs <a href="http://wordpress.org/support/plugin/loginizer" target="_blank">here</a>. | |
| 822 | - | |
| 949 | + <a href="http://loginizer.com" target="_blank">Loginizer</a> v'.LOGINIZER_VERSION.'. You can report any bugs <a href="http://wordpress.org/support/plugin/loginizer" target="_blank">here</a>.'; | |
| 950 | + | |
| 951 | + } | |
| 952 | + | |
| 953 | + echo ' | |
| 823 | 954 | </div> |
| 824 | 955 | </div> |
| 825 | 956 | </div> |
| 826 | 957 | </div>'; |
| @@ -830,9 +961,23 @@ | ||
| 830 | 961 | // The Loginizer Admin Options Page |
| 831 | 962 | function loginizer_page_dashboard(){ |
| 832 | 963 | |
| 833 | 964 | global $loginizer, $lz_error, $lz_env; |
| 965 | + | |
| 966 | + if(!current_user_can('manage_options')){ | |
| 967 | + wp_die('Sorry, but you do not have permissions to change settings.'); | |
| 968 | + } | |
| 969 | + | |
| 970 | + // Dismiss the announcement | |
| 971 | + if(isset($_GET['dismiss_announcement'])){ | |
| 972 | + update_option('loginizer_no_announcement', 1); | |
| 973 | + } | |
| 834 | 974 | |
| 975 | + /* Make sure post was from this page */ | |
| 976 | + if(count($_POST) > 0){ | |
| 977 | + check_admin_referer('loginizer-options'); | |
| 978 | + } | |
| 979 | + | |
| 835 | 980 | // Is there a license key ? |
| 836 | 981 | if(isset($_POST['save_lz'])){ |
| 837 | 982 | |
| 838 | 983 | $license = lz_optpost('lz_license'); |
| @@ -842,13 +987,18 @@ | ||
| 842 | 987 | $lz_error['lic_invalid'] = __('The license key was not submitted', 'loginizer'); |
| 843 | 988 | return loginizer_page_dashboard_T(); |
| 844 | 989 | } |
| 845 | 990 | |
| 846 | - $resp = wp_remote_get(LOGINIZER_API.'license.php?license='.$license); | |
| 991 | + $resp = wp_remote_get(LOGINIZER_API.'license.php?license='.$license, array('timeout' => 30)); | |
| 847 | 992 | |
| 848 | 993 | if(is_array($resp)){ |
| 849 | 994 | $json = json_decode($resp['body'], true); |
| 850 | 995 | //print_r($json); |
| 996 | + }else{ | |
| 997 | + | |
| 998 | + $lz_error['resp_invalid'] = __('The response was malformed<br>'.var_export($resp, true), 'loginizer'); | |
| 999 | + return loginizer_page_dashboard_T(); | |
| 1000 | + | |
| 851 | 1001 | } |
| 852 | 1002 | |
| 853 | 1003 | // Save the License |
| 854 | 1004 | if(empty($json['license'])){ |
| @@ -870,13 +1020,19 @@ | ||
| 870 | 1020 | // Is there a IP Method ? |
| 871 | 1021 | if(isset($_POST['save_lz_ip_method'])){ |
| 872 | 1022 | |
| 873 | 1023 | $ip_method = (int) lz_optpost('lz_ip_method'); |
| 1024 | + $custom_ip_method = lz_optpost('lz_custom_ip_method'); | |
| 874 | 1025 | |
| 875 | - if($ip_method >= 0 && $ip_method <= 2){ | |
| 1026 | + if($ip_method >= 0 && $ip_method <= 3){ | |
| 876 | 1027 | update_option('loginizer_ip_method', $ip_method); |
| 877 | 1028 | } |
| 878 | 1029 | |
| 1030 | + // Custom Method name ? | |
| 1031 | + if($ip_method == 3){ | |
| 1032 | + update_option('loginizer_custom_ip_method', $custom_ip_method); | |
| 1033 | + } | |
| 1034 | + | |
| 879 | 1035 | } |
| 880 | 1036 | |
| 881 | 1037 | loginizer_page_dashboard_T(); |
| 882 | 1038 | |
| @@ -886,9 +1042,9 @@ | ||
| 886 | 1042 | function loginizer_page_dashboard_T(){ |
| 887 | 1043 | |
| 888 | 1044 | global $loginizer, $lz_error, $lz_env; |
| 889 | 1045 | |
| 890 | - loginizer_page_header('Loginizer Dashboard'); | |
| 1046 | + loginizer_page_header('Dashboard'); | |
| 891 | 1047 | ?> |
| 892 | 1048 | <style> |
| 893 | 1049 | .welcome-panel{ |
| 894 | 1050 | margin: 0px; |
| @@ -907,9 +1063,15 @@ | ||
| 907 | 1063 | font-size:12px; |
| 908 | 1064 | } |
| 909 | 1065 | </style> |
| 910 | 1066 | |
| 911 | - <?php | |
| 1067 | + <?php | |
| 1068 | + | |
| 1069 | + $hide_announcement = get_option('loginizer_no_announcement'); | |
| 1070 | + if(empty($hide_announcement)){ | |
| 1071 | + echo '<div id="message" class="welcome-panel">'. __('<a href="https://loginizer.com/blog/loginizer-has-been-acquired-by-softaculous/" target="_blank" style="text-decoration:none;">We are excited to announce that we have joined forces with Softaculous and have been acquired by them 😊. Read full announcement here.</a>', 'loginizer'). '<a class="welcome-panel-close" style="top:3px;right:2px;" href="'.menu_page_url('loginizer', false).'&dismiss_announcement=1" aria-label="Dismiss announcement"></a></div><br />'; | |
| 1072 | + } | |
| 1073 | + | |
| 912 | 1074 | echo '<script src="https://api.loginizer.com/'.(defined('LOGINIZER_PREMIUM') ? 'news_security.js' : 'news.js').'"></script><br>'; |
| 913 | 1075 | |
| 914 | 1076 | // Saved ? |
| 915 | 1077 | if(!empty($GLOBALS['lz_saved'])){ |
| @@ -1012,9 +1174,9 @@ | ||
| 1012 | 1174 | <td>'.ABSPATH.'</td> |
| 1013 | 1175 | </tr> |
| 1014 | 1176 | <tr> |
| 1015 | 1177 | <th align="left">'.__('Server\'s IP Address', 'loginizer').'</th> |
| 1016 | - <td>'.$_SERVER['SERVER_ADDR'].'</td> | |
| 1178 | + <td>'.@$_SERVER['SERVER_ADDR'].'</td> | |
| 1017 | 1179 | </tr> |
| 1018 | 1180 | <tr> |
| 1019 | 1181 | <th align="left">'.__('Your IP Address', 'loginizer').'</th> |
| 1020 | 1182 | <td>'.lz_getip().' |
| @@ -1019,13 +1181,15 @@ | ||
| 1019 | 1181 | <th align="left">'.__('Your IP Address', 'loginizer').'</th> |
| 1020 | 1182 | <td>'.lz_getip().' |
| 1021 | 1183 | <div style="float:right"> |
| 1022 | 1184 | Method : |
| 1023 | - <select name="lz_ip_method" style="font-size:11px; width:150px"> | |
| 1185 | + <select name="lz_ip_method" id="lz_ip_method" style="font-size:11px; width:150px" onchange="lz_ip_method_handle()"> | |
| 1024 | 1186 | <option value="0" '.lz_POSTselect('lz_ip_method', 0, (@$loginizer['ip_method'] == 0)).'>REMOTE_ADDR</option> |
| 1025 | 1187 | <option value="1" '.lz_POSTselect('lz_ip_method', 1, (@$loginizer['ip_method'] == 1)).'>HTTP_X_FORWARDED_FOR</option> |
| 1026 | 1188 | <option value="2" '.lz_POSTselect('lz_ip_method', 2, (@$loginizer['ip_method'] == 2)).'>HTTP_CLIENT_IP</option> |
| 1189 | + <option value="3" '.lz_POSTselect('lz_ip_method', 3, (@$loginizer['ip_method'] == 3)).'>CUSTOM</option> | |
| 1027 | 1190 | </select> |
| 1191 | + <input name="lz_custom_ip_method" id="lz_custom_ip_method" type="text" value="'.lz_optpost('lz_custom_ip_method', @$loginizer['custom_ip_method']).'" style="font-size:11px; width:100px; display:none" /> | |
| 1028 | 1192 | <input name="save_lz_ip_method" class="button button-primary" value="Save" type="submit" /> |
| 1029 | 1193 | </div> |
| 1030 | 1194 | </td> |
| 1031 | 1195 | </tr> |
| @@ -1048,8 +1212,23 @@ | ||
| 1048 | 1212 | </form> |
| 1049 | 1213 | |
| 1050 | 1214 | </div> |
| 1051 | 1215 | </div> |
| 1216 | + | |
| 1217 | +<script type="text/javascript"> | |
| 1218 | + | |
| 1219 | +function lz_ip_method_handle(){ | |
| 1220 | + var ele = jQuery('#lz_ip_method'); | |
| 1221 | + if(ele.val() == 3){ | |
| 1222 | + jQuery('#lz_custom_ip_method').show(); | |
| 1223 | + }else{ | |
| 1224 | + jQuery('#lz_custom_ip_method').hide(); | |
| 1225 | + } | |
| 1226 | +}; | |
| 1227 | + | |
| 1228 | +lz_ip_method_handle(); | |
| 1229 | + | |
| 1230 | +</script> | |
| 1052 | 1231 | |
| 1053 | 1232 | <div id="" class="postbox"> |
| 1054 | 1233 | |
| 1055 | 1234 | <button class="handlediv button-link" aria-expanded="true" type="button"> |
| @@ -1131,14 +1310,43 @@ | ||
| 1131 | 1310 | check_admin_referer('loginizer-options'); |
| 1132 | 1311 | } |
| 1133 | 1312 | |
| 1134 | 1313 | // BEGIN THEME |
| 1135 | - loginizer_page_header('Loginizer - Brute Force Settings'); | |
| 1314 | + loginizer_page_header('Brute Force Settings'); | |
| 1136 | 1315 | |
| 1137 | 1316 | // Load the blacklist and whitelist |
| 1138 | 1317 | $loginizer['blacklist'] = get_option('loginizer_blacklist'); |
| 1139 | 1318 | $loginizer['whitelist'] = get_option('loginizer_whitelist'); |
| 1140 | 1319 | |
| 1320 | + // Disable Brute Force | |
| 1321 | + if(isset($_POST['disable_brute_lz'])){ | |
| 1322 | + | |
| 1323 | + // Save the options | |
| 1324 | + update_option('loginizer_disable_brute', 1); | |
| 1325 | + | |
| 1326 | + $loginizer['disable_brute'] = 1; | |
| 1327 | + | |
| 1328 | + echo '<div id="message" class="updated"><p>' | |
| 1329 | + . __('The Brute Force Protection feature is now disabled', 'loginizer') | |
| 1330 | + . '</p></div><br />'; | |
| 1331 | + | |
| 1332 | + } | |
| 1333 | + | |
| 1334 | + // Enable brute force | |
| 1335 | + if(isset($_POST['enable_brute_lz'])){ | |
| 1336 | + | |
| 1337 | + // Save the options | |
| 1338 | + update_option('loginizer_disable_brute', 0); | |
| 1339 | + | |
| 1340 | + $loginizer['disable_brute'] = 0; | |
| 1341 | + | |
| 1342 | + echo '<div id="message" class="updated"><p>' | |
| 1343 | + . __('The Brute Force Protection feature is now enabled', 'loginizer') | |
| 1344 | + . '</p></div><br />'; | |
| 1345 | + | |
| 1346 | + } | |
| 1347 | + | |
| 1348 | + // The Brute Force Settings | |
| 1141 | 1349 | if(isset($_POST['save_lz'])){ |
| 1142 | 1350 | |
| 1143 | 1351 | $max_retries = (int) lz_optpost('max_retries'); |
| 1144 | 1352 | $lockout_time = (int) lz_optpost('lockout_time'); |
| @@ -1181,9 +1389,9 @@ | ||
| 1181 | 1389 | |
| 1182 | 1390 | } |
| 1183 | 1391 | |
| 1184 | 1392 | // Delete a Blackist IP range |
| 1185 | - if(isset($_GET['bdelid'])){ | |
| 1393 | + if(isset($_POST['bdelid'])){ | |
| 1186 | 1394 | |
| 1187 | 1395 | $delid = (int) lz_optreq('bdelid'); |
| 1188 | 1396 | |
| 1189 | 1397 | // Unset and save |
| @@ -1196,10 +1404,22 @@ | ||
| 1196 | 1404 | . '</p></div><br />'; |
| 1197 | 1405 | |
| 1198 | 1406 | } |
| 1199 | 1407 | |
| 1408 | + // Delete all Blackist IP ranges | |
| 1409 | + if(isset($_POST['del_all_blacklist'])){ | |
| 1410 | + | |
| 1411 | + // Unset and save | |
| 1412 | + update_option('loginizer_blacklist', array()); | |
| 1413 | + | |
| 1414 | + echo '<div id="message" class="updated fade"><p>' | |
| 1415 | + . __('The Blacklist IP range(s) have been cleared successfully', 'loginizer') | |
| 1416 | + . '</p></div><br />'; | |
| 1417 | + | |
| 1418 | + } | |
| 1419 | + | |
| 1200 | 1420 | // Delete a Whitelist IP range |
| 1201 | - if(isset($_GET['delid'])){ | |
| 1421 | + if(isset($_POST['delid'])){ | |
| 1202 | 1422 | |
| 1203 | 1423 | $delid = (int) lz_optreq('delid'); |
| 1204 | 1424 | |
| 1205 | 1425 | // Unset and save |
| @@ -1212,8 +1432,20 @@ | ||
| 1212 | 1432 | . '</p></div><br />'; |
| 1213 | 1433 | |
| 1214 | 1434 | } |
| 1215 | 1435 | |
| 1436 | + // Delete all Blackist IP ranges | |
| 1437 | + if(isset($_POST['del_all_whitelist'])){ | |
| 1438 | + | |
| 1439 | + // Unset and save | |
| 1440 | + update_option('loginizer_whitelist', array()); | |
| 1441 | + | |
| 1442 | + echo '<div id="message" class="updated fade"><p>' | |
| 1443 | + . __('The Whitelist IP range(s) have been cleared successfully', 'loginizer') | |
| 1444 | + . '</p></div><br />'; | |
| 1445 | + | |
| 1446 | + } | |
| 1447 | + | |
| 1216 | 1448 | // Reset All Logs |
| 1217 | 1449 | if(isset($_POST['lz_reset_all_ip'])){ |
| 1218 | 1450 | |
| 1219 | 1451 | $result = $wpdb->query("DELETE FROM `".$wpdb->prefix."loginizer_logs` |
| @@ -1431,9 +1663,24 @@ | ||
| 1431 | 1663 | if(!empty($error)){ |
| 1432 | 1664 | lz_report_error($error);echo '<br />'; |
| 1433 | 1665 | } |
| 1434 | 1666 | } |
| 1435 | - | |
| 1667 | + | |
| 1668 | + // Save the messages | |
| 1669 | + if(isset($_POST['save_err_msgs_lz'])){ | |
| 1670 | + | |
| 1671 | + $msgs['inv_userpass'] = lz_optpost('msg_inv_userpass'); | |
| 1672 | + $msgs['ip_blacklisted'] = lz_optpost('msg_ip_blacklisted'); | |
| 1673 | + | |
| 1674 | + // Update them | |
| 1675 | + update_option('loginizer_msg', $msgs); | |
| 1676 | + | |
| 1677 | + echo '<div id="message" class="updated fade"><p>' | |
| 1678 | + . __('Error messages were saved successfully', 'loginizer') | |
| 1679 | + . '</p></div><br />'; | |
| 1680 | + | |
| 1681 | + } | |
| 1682 | + | |
| 1436 | 1683 | // Count the Results |
| 1437 | 1684 | $tmp = lz_selectquery("SELECT COUNT(*) AS num FROM `".$wpdb->prefix."loginizer_logs`"); |
| 1438 | 1685 | //print_r($tmp); |
| 1439 | 1686 | |
| @@ -1457,8 +1704,10 @@ | ||
| 1457 | 1704 | // Reload the settings |
| 1458 | 1705 | $loginizer['blacklist'] = get_option('loginizer_blacklist'); |
| 1459 | 1706 | $loginizer['whitelist'] = get_option('loginizer_whitelist'); |
| 1460 | 1707 | |
| 1708 | + $saved_msgs = get_option('loginizer_msg'); | |
| 1709 | + | |
| 1461 | 1710 | ?> |
| 1462 | 1711 | |
| 1463 | 1712 | <div id="" class="postbox"> |
| 1464 | 1713 | |
| @@ -1505,9 +1754,10 @@ | ||
| 1505 | 1754 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('IP','loginizer'); ?></th> |
| 1506 | 1755 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Attempted Username','loginizer'); ?></th> |
| 1507 | 1756 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Last Failed Attempt (DD/MM/YYYY)','loginizer'); ?></th> |
| 1508 | 1757 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Failed Attempts Count','loginizer'); ?></th> |
| 1509 | - <th scope="row" valign="top" style="background:#EFEFEF;" width="150"><?php echo __('Lockouts Count','loginizer'); ?></th> | |
| 1758 | + <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Lockouts Count','loginizer'); ?></th> | |
| 1759 | + <th scope="row" valign="top" style="background:#EFEFEF;" width="150"><?php echo __('URL Attacked','loginizer'); ?></th> | |
| 1510 | 1760 | </tr> |
| 1511 | 1761 | <?php |
| 1512 | 1762 | |
| 1513 | 1763 | if(empty($result)){ |
| @@ -1531,9 +1781,9 @@ | ||
| 1531 | 1781 | <td> |
| 1532 | 1782 | '.$iv['username'].' |
| 1533 | 1783 | </td> |
| 1534 | 1784 | <td> |
| 1535 | - '.date('d/m/Y H:i:s', $iv['time']).' | |
| 1785 | + '.date('d/M/Y H:i:s P', $iv['time']).' | |
| 1536 | 1786 | </td> |
| 1537 | 1787 | <td> |
| 1538 | 1788 | '.$iv['count'].' |
| 1539 | 1789 | </td> |
| @@ -1539,8 +1789,11 @@ | ||
| 1539 | 1789 | </td> |
| 1540 | 1790 | <td> |
| 1541 | 1791 | '.$iv['lockout'].' |
| 1542 | 1792 | </td> |
| 1793 | + <td> | |
| 1794 | + '.$iv['url'].' | |
| 1795 | + </td> | |
| 1543 | 1796 | </tr>'; |
| 1544 | 1797 | } |
| 1545 | 1798 | } |
| 1546 | 1799 | |
| @@ -1610,8 +1863,21 @@ | ||
| 1610 | 1863 | </td> |
| 1611 | 1864 | </tr> |
| 1612 | 1865 | </table><br /> |
| 1613 | 1866 | <input name="save_lz" class="button button-primary action" value="<?php echo __('Save Settings','loginizer'); ?>" type="submit" /> |
| 1867 | + <?php | |
| 1868 | + | |
| 1869 | + if(empty($loginizer['disable_brute'])){ | |
| 1870 | + | |
| 1871 | + echo '<input name="disable_brute_lz" class="button action" value="'.__('Disable Brute Force Protection','loginizer').'" type="submit" style="float:right" />'; | |
| 1872 | + | |
| 1873 | + }else{ | |
| 1874 | + | |
| 1875 | + echo '<input name="enable_brute_lz" class="button button-primary action" value="'.__('Enable Brute Force Protection','loginizer').'" type="submit" style="float:right" />'; | |
| 1876 | + | |
| 1877 | + } | |
| 1878 | + | |
| 1879 | + ?> | |
| 1614 | 1880 | </form> |
| 1615 | 1881 | |
| 1616 | 1882 | </div> |
| 1617 | 1883 | </div> |
| @@ -1616,8 +1882,69 @@ | ||
| 1616 | 1882 | </div> |
| 1617 | 1883 | </div> |
| 1618 | 1884 | <br /> |
| 1619 | 1885 | |
| 1886 | +<?php | |
| 1887 | + | |
| 1888 | + wp_enqueue_script('jquery-paginate', LOGINIZER_URL.'/jquery-paginate.js', array('jquery'), '1.10.15'); | |
| 1889 | + | |
| 1890 | +?> | |
| 1891 | + | |
| 1892 | +<style> | |
| 1893 | +.page-navigation a { | |
| 1894 | +margin: 5px 2px; | |
| 1895 | +display: inline-block; | |
| 1896 | +padding: 5px 8px; | |
| 1897 | +color: #0073aa; | |
| 1898 | +background: #e5e5e5 none repeat scroll 0 0; | |
| 1899 | +border: 1px solid #ccc; | |
| 1900 | +text-decoration: none; | |
| 1901 | +transition-duration: 0.05s; | |
| 1902 | +transition-property: border, background, color; | |
| 1903 | +transition-timing-function: ease-in-out; | |
| 1904 | +} | |
| 1905 | + | |
| 1906 | +.page-navigation a[data-selected] { | |
| 1907 | +background-color: #00a0d2; | |
| 1908 | +color: #fff; | |
| 1909 | +} | |
| 1910 | +</style> | |
| 1911 | + | |
| 1912 | +<script> | |
| 1913 | + | |
| 1914 | +jQuery(document).ready(function(){ | |
| 1915 | + jQuery('#lz_bl_table').paginate({ limit: 11, navigationWrapper: jQuery('#lz_bl_nav')}); | |
| 1916 | + jQuery('#lz_wl_table').paginate({ limit: 11, navigationWrapper: jQuery('#lz_wl_nav')}); | |
| 1917 | +}); | |
| 1918 | + | |
| 1919 | +// Delete a Blacklist / Whitelist IP Range | |
| 1920 | +function del_confirm(field, todo_id, msg){ | |
| 1921 | + var ret = confirm(msg); | |
| 1922 | + | |
| 1923 | + if(ret){ | |
| 1924 | + jQuery('#lz_bl_wl_todo').attr('name', field); | |
| 1925 | + jQuery('#lz_bl_wl_todo').val(todo_id); | |
| 1926 | + jQuery('#lz_bl_wl_form').submit(); | |
| 1927 | + } | |
| 1928 | + | |
| 1929 | + return false; | |
| 1930 | + | |
| 1931 | +} | |
| 1932 | + | |
| 1933 | +// Delete all Blacklist / Whitelist IP Ranges | |
| 1934 | +function del_confirm_all(msg){ | |
| 1935 | + var ret = confirm(msg); | |
| 1936 | + | |
| 1937 | + if(ret){ | |
| 1938 | + return true; | |
| 1939 | + } | |
| 1940 | + | |
| 1941 | + return false; | |
| 1942 | + | |
| 1943 | +} | |
| 1944 | + | |
| 1945 | +</script> | |
| 1946 | + | |
| 1620 | 1947 | <div id="" class="postbox"> |
| 1621 | 1948 | |
| 1622 | 1949 | <button class="handlediv button-link" aria-expanded="true" type="button"> |
| 1623 | 1950 | <span class="screen-reader-text">Toggle panel: Blacklist IP</span> |
| @@ -1647,13 +1974,15 @@ | ||
| 1647 | 1974 | <input type="text" size="25" value="<?php echo(lz_optpost('end_ip')); ?>" name="end_ip" id="end_ip"/> <?php echo __('End IP of the range. <br />If you want to blacklist single IP leave this field blank.','loginizer'); ?> <br /> |
| 1648 | 1975 | </td> |
| 1649 | 1976 | </tr> |
| 1650 | 1977 | </table><br /> |
| 1651 | - <input name="blacklist_iprange" class="button button-primary action" value="<?php echo __('Add Blacklist IP Range','loginizer'); ?>" type="submit" /> | |
| 1978 | + <input name="blacklist_iprange" class="button button-primary action" value="<?php echo __('Add Blacklist IP Range','loginizer'); ?>" type="submit" /> | |
| 1979 | + <input style="float:right" name="del_all_blacklist" onclick="return del_confirm_all('<?php echo __('Are you sure you want to delete all Blacklist IP Range(s) ?','loginizer'); ?>')" class="button action" value="<?php echo __('Delete All Blacklist IP Range(s)','loginizer'); ?>" type="submit" /> | |
| 1652 | 1980 | </form> |
| 1653 | 1981 | </div> |
| 1654 | 1982 | |
| 1655 | - <table class="wp-list-table fixed striped users" border="0" width="95%" cellpadding="10" align="center"> | |
| 1983 | + <div id="lz_bl_nav" style="margin: 5px 10px; text-align:right"></div> | |
| 1984 | + <table id="lz_bl_table" class="wp-list-table fixed striped users" border="0" width="95%" cellpadding="10" align="center"> | |
| 1656 | 1985 | <tr> |
| 1657 | 1986 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Start IP','loginizer'); ?></th> |
| 1658 | 1987 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('End IP','loginizer'); ?></th> |
| 1659 | 1988 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Date (DD/MM/YYYY)','loginizer'); ?></th> |
| @@ -1680,9 +2009,9 @@ | ||
| 1680 | 2009 | <td> |
| 1681 | 2010 | '.date('d/m/Y', $iv['time']).' |
| 1682 | 2011 | </td> |
| 1683 | 2012 | <td> |
| 1684 | - <a class="submitdelete" href="admin.php?page=loginizer_brute_force&bdelid='.$ik.'" onclick="return confirm(\'Are you sure you want to delete this IP range ?\')">Delete</a> | |
| 2013 | + <a class="submitdelete" href="javascript:void(0)" onclick="return del_confirm(\'bdelid\', '.$ik.', \'Are you sure you want to delete this IP range ?\')">Delete</a> | |
| 1685 | 2014 | </td> |
| 1686 | 2015 | </tr>'; |
| 1687 | 2016 | } |
| 1688 | 2017 | } |
| @@ -1688,9 +2017,12 @@ | ||
| 1688 | 2017 | } |
| 1689 | 2018 | ?> |
| 1690 | 2019 | </table> |
| 1691 | 2020 | <br /> |
| 1692 | - | |
| 2021 | + <form action="" method="post" id="lz_bl_wl_form"> | |
| 2022 | + <?php wp_nonce_field('loginizer-options'); ?> | |
| 2023 | + <input type="hidden" value="" name="" id="lz_bl_wl_todo"/> | |
| 2024 | + </form> | |
| 1693 | 2025 | </div> |
| 1694 | 2026 | |
| 1695 | 2027 | <br /> |
| 1696 | 2028 | |
| @@ -1723,13 +2055,15 @@ | ||
| 1723 | 2055 | <input type="text" size="25" value="<?php echo(lz_optpost('end_ip_w')); ?>" name="end_ip_w" id="end_ip_w"/> <?php echo __('End IP of the range. <br />If you want to whitelist single IP leave this field blank.','loginizer'); ?> <br /> |
| 1724 | 2056 | </td> |
| 1725 | 2057 | </tr> |
| 1726 | 2058 | </table><br /> |
| 1727 | - <input name="whitelist_iprange" class="button button-primary action" value="<?php echo __('Add Whitelist IP Range','loginizer'); ?>" type="submit" /> | |
| 2059 | + <input name="whitelist_iprange" class="button button-primary action" value="<?php echo __('Add Whitelist IP Range','loginizer'); ?>" type="submit" /> | |
| 2060 | + <input style="float:right" name="del_all_whitelist" onclick="return del_confirm_all('<?php echo __('Are you sure you want to delete all Whitelist IP Range(s) ?','loginizer'); ?>')" class="button action" value="<?php echo __('Delete All Whitelist IP Range(s)','loginizer'); ?>" type="submit" /> | |
| 1728 | 2061 | </form> |
| 1729 | 2062 | </div> |
| 1730 | 2063 | |
| 1731 | - <table class="wp-list-table fixed striped users" border="0" width="95%" cellpadding="10" align="center"> | |
| 2064 | + <div id="lz_wl_nav" style="margin: 5px 10px; text-align:right"></div> | |
| 2065 | + <table id="lz_wl_table" class="wp-list-table fixed striped users" border="0" width="95%" cellpadding="10" align="center"> | |
| 1732 | 2066 | <tr> |
| 1733 | 2067 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Start IP','loginizer'); ?></th> |
| 1734 | 2068 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('End IP','loginizer'); ?></th> |
| 1735 | 2069 | <th scope="row" valign="top" style="background:#EFEFEF;"><?php echo __('Date (DD/MM/YYYY)','loginizer'); ?></th> |
| @@ -1756,9 +2090,9 @@ | ||
| 1756 | 2090 | <td> |
| 1757 | 2091 | '.date('d/m/Y', $iv['time']).' |
| 1758 | 2092 | </td> |
| 1759 | 2093 | <td> |
| 1760 | - <a class="submitdelete" href="admin.php?page=loginizer_brute_force&delid='.$ik.'" onclick="return confirm(\'Are you sure you want to delete this IP range ?\')">Delete</a> | |
| 2094 | + <a class="submitdelete" href="javascript:void(0)" onclick="return del_confirm(\'delid\', '.$ik.', \'Are you sure you want to delete this IP range ?\')">Delete</a> | |
| 1761 | 2095 | </td> |
| 1762 | 2096 | </tr>'; |
| 1763 | 2097 | } |
| 1764 | 2098 | } |
| @@ -1766,9 +2100,44 @@ | ||
| 1766 | 2100 | </table> |
| 1767 | 2101 | <br /> |
| 1768 | 2102 | |
| 1769 | 2103 | </div> |
| 1770 | - | |
| 2104 | + | |
| 2105 | + <div id="" class="postbox"> | |
| 2106 | + | |
| 2107 | + <button class="handlediv button-link" aria-expanded="true" type="button"> | |
| 2108 | + <span class="screen-reader-text">Toggle panel: Error Messages</span> | |
| 2109 | + <span class="toggle-indicator" aria-hidden="true"></span> | |
| 2110 | + </button> | |
| 2111 | + | |
| 2112 | + <h2 class="hndle ui-sortable-handle"> | |
| 2113 | + <span><?php echo __('Error Messages', 'loginizer'); ?></span> | |
| 2114 | + </h2> | |
| 2115 | + | |
| 2116 | + <div class="inside"> | |
| 2117 | + | |
| 2118 | + <form action="" method="post" enctype="multipart/form-data"> | |
| 2119 | + <?php wp_nonce_field('loginizer-options'); ?> | |
| 2120 | + <table class="form-table"> | |
| 2121 | + <tr> | |
| 2122 | + <th scope="row" valign="top"><label for="msg_inv_userpass"><?php echo __('Failed Login Attempt','loginizer'); ?></label></th> | |
| 2123 | + <td> | |
| 2124 | + <input type="text" size="25" value="<?php echo esc_attr($saved_msgs['inv_userpass']); ?>" name="msg_inv_userpass" id="msg_inv_userpass" /> | |
| 2125 | + <?php echo __('Default: <em>"' . $loginizer['d_msg']['inv_userpass']. '"</em>', 'loginizer'); ?><br /> | |
| 2126 | + </td> | |
| 2127 | + </tr> | |
| 2128 | + <tr> | |
| 2129 | + <th scope="row" valign="top"><label for="msg_ip_blacklisted"><?php echo __('Blacklisted IP','loginizer'); ?></label></th> | |
| 2130 | + <td> | |
| 2131 | + <input type="text" size="25" value="<?php echo esc_attr($saved_msgs['ip_blacklisted']); ?>" name="msg_ip_blacklisted" id="msg_ip_blacklisted" /> | |
| 2132 | + <?php echo __('Default: <em>"' . $loginizer['d_msg']['ip_blacklisted']. '"</em>', 'loginizer'); ?><br /> | |
| 2133 | + </td> | |
| 2134 | + </tr> | |
| 2135 | + </table><br /> | |
| 2136 | + <input name="save_err_msgs_lz" class="button button-primary action" value="<?php echo __('Save Error Messages','loginizer'); ?>" type="submit" /> | |
| 2137 | + </form> | |
| 2138 | + </div> | |
| 2139 | + </div> | |
| 1771 | 2140 | <?php |
| 1772 | 2141 | |
| 1773 | 2142 | loginizer_page_footer(); |
| 1774 | 2143 | |
| @@ -1793,7 +2162,10 @@ | ||
| 1793 | 2162 | delete_option('loginizer_options'); |
| 1794 | 2163 | delete_option('loginizer_last_reset'); |
| 1795 | 2164 | delete_option('loginizer_whitelist'); |
| 1796 | 2165 | delete_option('loginizer_blacklist'); |
| 2166 | + delete_option('loginizer_msg'); | |
| 2167 | + delete_option('loginizer_security'); | |
| 2168 | + delete_option('loginizer_wp_admin'); | |
| 1797 | 2169 | |
| 1798 | 2170 | } |
| 1799 | 2171 | |