PluginProbe
Loginizer / 1.9.3
Loginizer v1.9.3
2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 74 releases
← All changes | init.php +210 -260 trunk1.9.3 View file →
@@ -4,9 +4,9 @@
4 4 echo 'You are not allowed to access this page directly.';
5 5 exit;
6 6 }
7 7
8 -define('LOGINIZER_VERSION', '2.1.0');
8 +define('LOGINIZER_VERSION', '1.9.3');
9 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_PRICING_URL', 'https://loginizer.com/pricing');
@@ -45,14 +45,9 @@
45 45 add_option('loginizer_last_reset', 0);
46 46 add_option('loginizer_whitelist', array());
47 47 add_option('loginizer_blacklist', array());
48 48 add_option('loginizer_2fa_whitelist', array());
49 -
50 - // TODO:: REMOVE THIS AFTER MARCH 2025
51 - $softwp_upgrade = get_option('loginizer_softwp_upgrade', 0);
52 - if(!defined('SITEPAD') && empty($softwp_upgrade)){
53 - loginizer_check_softaculous();
54 - }
49 +
55 50 }
56 51
57 52 /**
58 53 * Updates the database structure for Loginizer
@@ -89,9 +84,9 @@
89 84 // Trick the following if conditions to not run
90 85 $version = (int) str_replace('.', '', LOGINIZER_VERSION);
91 86
92 87 }
93 -
88 +
94 89 // Is it less than 1.0.1 ?
95 90 if($version < 101){
96 91
97 92 // TODO : GET the existing settings
@@ -187,38 +182,11 @@
187 182 $wpdb->query("ALTER TABLE ".$wpdb->prefix."loginizer_logs ADD `url` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ip`;");
188 183
189 184 }
190 185
191 - // Setting alignment to left in social login ?
192 - if($version < 201){
193 - $social_settings = get_option('loginizer_social_settings', []);
194 -
195 - if(!empty($social_settings)){
196 - if(!empty($social_settings['login']) && (!empty($social_settings['login']['login_form']) || !empty($social_settings['login']['registration_form']))){
197 - $social_settings['login']['button_alignment'] = 'left';
198 - }
199 -
200 - if(!empty($social_settings['woocommerce']) && (!empty($social_settings['woocommmerce']['login_form']) || !empty($social_settings['woocommerce']['registration_form']))){
201 - $social_settings['woocommerce']['button_alignment'] = 'left';
202 - }
203 -
204 - if(!empty($social_settings['comment']) && !empty($social_settings['comment']['enable_buttons'])){
205 - $social_settings['comment']['button_alignment'] = 'left';
206 - }
207 -
208 - update_option('loginizer_social_settings', $social_settings);
209 - }
210 - }
211 -
212 186 // Save the new Version
213 187 update_option('loginizer_version', LOGINIZER_VERSION);
214 188
215 - // TODO:: REMOVE THIS AFTER MARCH 2025
216 - $softwp_upgrade = get_option('loginizer_softwp_upgrade', 0);
217 - if(!defined('SITEPAD') && empty($softwp_upgrade)){
218 - loginizer_check_softaculous();
219 - }
220 -
221 189 // In Sitepad Math Captcha is enabled by default
222 190 if(defined('SITEPAD') && get_option('loginizer_captcha') === false){
223 191 $option['captcha_no_google'] = 1;
224 192 add_option('loginizer_captcha', $option);
@@ -272,13 +240,53 @@
272 240 }
273 241
274 242 // Login Success Email Notification.
275 243 $loginizer['login_mail'] = get_option('loginizer_login_mail', []);
276 - add_action('init', 'loginizer_load_translation_vars', 0);
244 + $loginizer['login_mail_default_sub'] = __('Login Successful at $sitename', 'loginizer');
245 + $loginizer['login_mail_default_msg'] = __('Hello $user_login,
277 246
278 - $loginizer['login_mail_subject'] = empty($loginizer['login_mail']['subject']) ? '' : $loginizer['login_mail']['subject'];
279 - $loginizer['login_mail_body'] = empty($loginizer['login_mail']['body']) ? '' : $loginizer['login_mail']['body'];
247 +Your account was recently logged in from the IP : $ip
248 +Time : $date
249 +If it was not you who logged in then please report this to us immediately.
280 250
251 +Regards,
252 +$sitename','loginizer');
253 +
254 + $loginizer['login_mail_subject'] = empty($loginizer['login_mail']['subject']) ? $loginizer['login_mail_default_sub']: $loginizer['login_mail']['subject'];
255 + $loginizer['login_mail_body'] = empty($loginizer['login_mail']['body']) ? $loginizer['login_mail_default_msg'] : $loginizer['login_mail']['body'];
256 +
257 + // Default messages
258 + $loginizer['d_msg']['inv_userpass'] = __('Incorrect Username or Password', 'loginizer');
259 + $loginizer['d_msg']['ip_blacklisted'] = __('Your IP has been blacklisted', 'loginizer');
260 + $loginizer['d_msg']['attempts_left'] = __('attempt(s) left', 'loginizer');
261 + $loginizer['d_msg']['lockout_err'] = __('You have exceeded maximum login retries<br /> Please try after', 'loginizer');
262 + $loginizer['d_msg']['minutes_err'] = __('minute(s)', 'loginizer');
263 + $loginizer['d_msg']['hours_err'] = __('hour(s)', 'loginizer');
264 +
265 + // Message Strings
266 + $loginizer['msg'] = get_option('loginizer_msg', []);
267 +
268 + foreach($loginizer['d_msg'] as $lk => $lv){
269 + if(empty($loginizer['msg'][$lk])){
270 + $loginizer['msg'][$lk] = $loginizer['d_msg'][$lk];
271 + }
272 + }
273 +
274 + $loginizer['2fa_d_msg']['otp_app'] = __('Please enter the OTP as seen in your App', 'loginizer');
275 + $loginizer['2fa_d_msg']['otp_email'] = __('Please enter the OTP emailed to you', 'loginizer');
276 + $loginizer['2fa_d_msg']['otp_field'] = __('One Time Password', 'loginizer');
277 + $loginizer['2fa_d_msg']['otp_question'] = __('Please answer your security question', 'loginizer');
278 + $loginizer['2fa_d_msg']['otp_answer'] = __('Your Answer', 'loginizer');
279 +
280 + // Message Strings
281 + $loginizer['2fa_msg'] = get_option('loginizer_2fa_msg', []);
282 +
283 + foreach($loginizer['2fa_d_msg'] as $lk => $lv){
284 + if(empty($loginizer['2fa_msg'][$lk])){
285 + $loginizer['2fa_msg'][$lk] = $loginizer['2fa_d_msg'][$lk];
286 + }
287 + }
288 +
281 289 // Load the blacklist and whitelist
282 290 $loginizer['blacklist'] = get_option('loginizer_blacklist', []);
283 291 $loginizer['whitelist'] = get_option('loginizer_whitelist', []);
284 292 $loginizer['2fa_whitelist'] = get_option('loginizer_2fa_whitelist');
@@ -289,14 +297,8 @@
289 297 }
290 298
291 299 // When was the database cleared last time
292 300 $loginizer['last_reset'] = get_option('loginizer_last_reset');
293 -
294 - if(!isset($loginizer['ultimate-member-active'])){
295 - $um_is_active = in_array('ultimate-member/ultimate-member.php', apply_filters('active_plugins', get_option('active_plugins', [])));
296 -
297 - $loginizer['ultimate-member-active'] = !empty($um_is_active) ? true : false;
298 - }
299 301
300 302 //print_r($loginizer);
301 303
302 304 // Clear retries
@@ -332,22 +334,17 @@
332 334 // Is called before displaying the error message so that we dont show that the username is wrong or the password
333 335 // Update Error message
334 336 add_action('wp_login_errors', 'loginizer_error_handler', 10001, 2);
335 337 add_action('woocommerce_login_failed', 'loginizer_woocommerce_error_handler', 10001);
336 - add_action('wp_login', 'loginizer_login_success', 11, 2);
337 - add_action('rsssl_two_factor_user_authenticated', 'loginizer_rsssl_2fa_success');
338 -
339 - if(!empty($loginizer['ultimate-member-active'])){
340 - add_action('wp_login_failed', 'loginizer_ultimatemember_error_handler', 10001);
341 - }
338 + add_action('wp_login', 'loginizer_login_success', 10, 2);
342 339
343 - if(!empty($_COOKIE['lz_social_error']) && !empty($loginizer['social_settings'])){
340 + if(!empty($_COOKIE['lz_social_error']) && !empty($loginizer['social_settings']) && !loginizer_is_blacklisted()){
344 341 add_filter('wp_login_errors', 'loginizer_social_login_error_handler', 10000, 2);
345 342 }
346 343 }
347 344
348 345 // Social Login Form Actions
349 - if(!empty($loginizer['social_settings'])){
346 + if(!empty($loginizer['social_settings']) && !loginizer_is_blacklisted()){
350 347 if(!empty($loginizer['social_settings']['login']['login_form'])){
351 348 add_action('login_form', 'loginizer_social_btn_login');
352 349 }
353 350 }
@@ -358,16 +355,63 @@
358 355
359 356 if(is_admin()){
360 357 include_once LOGINIZER_DIR . '/main/admin.php';
361 358 }
362 -
359 +
363 360 // ----------------
364 361 // PRO INIT END
365 362 // ----------------
366 363
364 + // Is the premium features there ?
365 + if(!defined('LOGINIZER_PREMIUM')){
366 +
367 + if(current_user_can('activate_plugins')){
368 + // The promo time
369 + $loginizer['promo_time'] = get_option('loginizer_promo_time');
370 + if(empty($loginizer['promo_time'])){
371 + $loginizer['promo_time'] = time();
372 + update_option('loginizer_promo_time', $loginizer['promo_time']);
373 + }
374 +
375 + // Are we to show the loginizer promo
376 + if(!empty($loginizer['promo_time']) && $loginizer['promo_time'] > 0 && $loginizer['promo_time'] < (time() - (30*24*3600))){
377 +
378 + add_action('admin_notices', 'loginizer_promo');
379 +
380 + }
381 +
382 + if(!empty($loginizer['csrf_promo']) && $loginizer['csrf_promo'] > 0 && $loginizer['csrf_promo'] < (time() - 86400)){
383 +
384 + add_action('admin_notices', 'loginizer_csrf_promo');
385 +
386 + }
387 +
388 + // Are we to disable the promo
389 + if(isset($_GET['loginizer_promo']) && (int)$_GET['loginizer_promo'] == 0){
390 + update_option('loginizer_promo_time', (0 - time()) );
391 + die('DONE');
392 + }
393 +
394 + $loginizer['backuply_promo'] = get_option('loginizer_backuply_promo_time');
395 +
396 + if(empty($loginizer['backuply_promo'])){
397 + $loginizer['backuply_promo'] = abs($loginizer['promo_time']);
398 + update_option('loginizer_backuply_promo_time', $loginizer['backuply_promo']);
399 + }
400 +
401 + // Setting CSRF Promo time
402 + $loginizer['csrf_promo'] = get_option('loginizer_csrf_promo_time');
403 +
404 + if(empty($loginizer['csrf_promo'])){
405 + $loginizer['csrf_promo'] = abs($loginizer['promo_time']);
406 + update_option('loginizer_csrf_promo_time', $loginizer['csrf_promo']);
407 + }
408 + }
409 + }
410 +
367 411 // Secuity checks for social login.
368 - if(!empty($_GET['lz_social_provider']) && loginizer_can_login() && empty($_GET['lz_api'])){
369 - add_action('init', 'loginizer_social_login_load');
412 + if(!empty($_GET['lz_social_provider']) && loginizer_can_login()){
413 + include_once LOGINIZER_DIR . '/main/social-login.php';
370 414 return;
371 415 }
372 416 }
373 417
@@ -476,11 +520,8 @@
476 520 }
477 521
478 522 $lz_error['ip_blocked'] = $loginizer['msg']['lockout_err'].' '.$_time;
479 523
480 - if(!empty($loginizer['ultimate-member-active']) && class_exists('UM')){
481 - \UM()->form()->add_error('blocked_msg', $lz_error['ip_blocked']);
482 - }
483 524 return false;
484 525 }
485 526 }
486 527
@@ -495,31 +536,26 @@
495 536
496 537 if(empty($blacklist)){
497 538 return false;
498 539 }
499 -
500 - $current_ip_inet = inet_ptoi($loginizer['current_ip']);
501 -
540 +
502 541 foreach($blacklist as $k => $v){
503 -
504 - $start_inet = inet_ptoi($v['start']);
505 - $end_inet = inet_ptoi($v['end']);
506 -
542 +
507 543 // Is the IP in the blacklist ?
508 - if($start_inet <= $current_ip_inet && $current_ip_inet <= $end_inet){
544 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
509 545 $result = 1;
510 546 break;
511 547 }
512 -
548 +
513 549 // Is it in a wider range ?
514 - if($start_inet >= 0 && $end_inet < 0){
550 + if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
515 551
516 552 // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
517 553 // if the current IP is <= than the start of the range, it is within the range
518 554 // OR
519 555 // if the current IP is <= than the end of the range, it is within the range
520 - if($start_inet <= $current_ip_inet
521 - || $current_ip_inet <= $end_inet){
556 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
557 + || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
522 558 $result = 1;
523 559 break;
524 560 }
525 561
@@ -525,9 +561,9 @@
525 561
526 562 }
527 563
528 564 }
529 -
565 +
530 566 // You are blacklisted
531 567 if(!empty($result)){
532 568 $lz_error['ip_blacklisted'] = $loginizer['msg']['ip_blacklisted'];
533 569 return true;
@@ -536,8 +572,52 @@
536 572 return false;
537 573
538 574 }
539 575
576 +function loginizer_is_whitelisted(){
577 +
578 + global $wpdb, $loginizer, $lz_error;
579 +
580 + $whitelist = $loginizer['whitelist'];
581 +
582 + if(empty($whitelist)){
583 + return false;
584 + }
585 +
586 + foreach($whitelist as $k => $v){
587 +
588 + // Is the IP in the blacklist ?
589 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
590 + $result = 1;
591 + break;
592 + }
593 +
594 + // Is it in a wider range ?
595 + if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
596 +
597 + // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
598 + // if the current IP is <= than the start of the range, it is within the range
599 + // OR
600 + // if the current IP is <= than the end of the range, it is within the range
601 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
602 + || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
603 + $result = 1;
604 + break;
605 + }
606 +
607 + }
608 +
609 + }
610 +
611 + // You are whitelisted
612 + if(!empty($result)){
613 + return true;
614 + }
615 +
616 + return false;
617 +
618 +}
619 +
540 620 // When the login fails, then this is called
541 621 // We need to update the database
542 622 function loginizer_login_failed($username, $is_2fa = ''){
543 623
@@ -556,78 +636,53 @@
556 636
557 637 if(empty($lz_cannot_login) && empty($loginizer['ip_is_whitelisted']) && empty($loginizer['no_loginizer_logs'])){
558 638
559 639 // The params which comes when social login returns an error, have some characters, which WordPress could not save.
560 - // REQUEST_URI / HTTP_HOST are not always set (WP-CLI, some CGI and XML-RPC setups)
561 - $server_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
562 - $http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
563 -
564 - if(!empty($server_uri) && strpos($server_uri, 'lz_social_provider') !== FALSE){
565 - $request_uri = explode('=', $server_uri);
640 + $server_uri = $_SERVER['REQUEST_URI'];
641 + if(!empty($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'lz_social_provider') !== FALSE){
642 + $request_uri = explode('=', $_SERVER['REQUEST_URI']);
566 643 $server_uri = $request_uri[0];
567 644 }
568 645
569 - // No addslashes() here, $wpdb->prepare() below does the escaping
570 - $url = esc_url((!empty($_SERVER['HTTPS']) ? 'https://' : 'http://').$http_host.$server_uri);
646 + $url = @addslashes((!empty($_SERVER['HTTPS']) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$server_uri);
647 + $url = esc_url($url);
571 648
572 - // Must never be 0, we divide by it below
573 - $max_retries = (int) $loginizer['max_retries'] < 1 ? 1 : (int) $loginizer['max_retries'];
574 -
575 - // This way is atomic now, the earlier one were causing race condition.
576 - // NOTE : In the UPDATE part `count` is already the new value, as MySQL / MariaDB
577 - // evaluate the assignments from left to right, so lockout must NOT add 1 again
578 - $upsert = $wpdb->prepare(
579 - "INSERT INTO `".$wpdb->prefix."loginizer_logs`
580 - (username, time, count, ip, lockout, url)
581 - VALUES
582 - (%s, %d, 1, %s, FLOOR(1 / %d), %s)
583 - ON DUPLICATE KEY UPDATE
584 - username = VALUES(username),
585 - time = VALUES(time),
586 - count = count + 1,
587 - lockout = FLOOR(count / %d),
588 - url = VALUES(url)",
589 - $username,
590 - time(),
591 - $loginizer['current_ip'],
592 - $max_retries,
593 - $url,
594 - $max_retries
595 - );
596 - $wpdb->query($upsert);
597 -
598 - // Re-read the persisted row so email/retries-left reflect the actual count
599 649 $sel_query = $wpdb->prepare("SELECT * FROM `".$wpdb->prefix."loginizer_logs` WHERE `ip` = %s", $loginizer['current_ip']);
600 650 $result = lz_selectquery($sel_query);
651 +
652 + if(!empty($result)){
653 + $lockout = floor((($result['count']+1) / $loginizer['max_retries']));
654 +
655 + $update_data = array('username' => $username,
656 + 'time' => time(),
657 + 'count' => $result['count']+1,
658 + 'lockout' => $lockout,
659 + 'url' => $url);
660 +
661 + $where_data = array('ip' => $loginizer['current_ip']);
662 +
663 + $format = array('%s','%d','%d','%d','%s');
664 + $where_format = array('%s');
665 +
666 + $wpdb->update($wpdb->prefix.'loginizer_logs', $update_data, $where_data, $format, $where_format);
667 +
668 + // Do we need to email admin ?
669 + if(!empty($loginizer['notify_email']) && $lockout >= $loginizer['notify_email']){
670 +
671 + $lockout_time = $loginizer['lockout_time'];
672 +
673 + if($lockout >= $loginizer['max_lockouts']){
674 + // extended lockout is in hours so we have to convert to minute
675 + $lockout_time = $loginizer['lockouts_extend'];
676 + }
677 +
678 + $sitename = lz_is_multisite() ? get_site_option('site_name') : get_option('blogname');
679 + $mail = array();
680 + $mail['to'] = $loginizer['notify_email_address'];
681 + $mail['subject'] = 'Failed '.$fail_type.' Attempts from IP '.$loginizer['current_ip'].' ('.$sitename.')';
682 + $mail['message'] = 'Hi,
601 683
602 - if(empty($result)){
603 - $result = array('count' => 0);
604 - }
605 -
606 - $count = (int) $result['count'];
607 - $lockout = !empty($result['lockout']) ? (int) $result['lockout'] : 0;
608 -
609 - // The lockout goes up only on every max_retries'th failure, which is the
610 - // attempt that actually locks the IP out. On the failures in between there
611 - // is nothing new to report, so we must not email on each one of them
612 - $is_new_lockout = !empty($count) && ($count % $max_retries) == 0;
613 -
614 - // Do we need to email admin ?
615 - if(!empty($loginizer['notify_email']) && !empty($is_new_lockout) && $lockout >= $loginizer['notify_email']){
616 -
617 - $lockout_time = $loginizer['lockout_time'];
618 -
619 - if($lockout >= $loginizer['max_lockouts']){
620 - $lockout_time = $loginizer['lockouts_extend'];
621 - }
622 -
623 - $sitename = lz_is_multisite() ? get_site_option('site_name') : get_option('blogname');
624 - $mail = array();
625 - $mail['to'] = $loginizer['notify_email_address'];
626 - $mail['subject'] = 'Failed '.$fail_type.' Attempts from IP '.$loginizer['current_ip'].' ('.$sitename.')';
627 - $mail['message'] = 'Hi,
628 -
629 -'.(int) $result['count'].' failed '.strtolower($fail_type).' attempts and '.$lockout.' lockout(s) from IP '.$loginizer['current_ip'].' on your site :
684 +'.($result['count']+1).' failed '.strtolower($fail_type).' attempts and '.$lockout.' lockout(s) from IP '.$loginizer['current_ip'].' on your site :
630 685 '.home_url().'
631 686
632 687 Last '.$fail_type.' Attempt : '.date('d/M/Y H:i:s P', time()).'
633 688 Last User Attempt : '.$username.'
@@ -635,22 +690,35 @@
635 690
636 691 Regards,
637 692 Loginizer';
638 693
639 - @wp_mail($mail['to'], $mail['subject'], $mail['message']);
694 + @wp_mail($mail['to'], $mail['subject'], $mail['message']);
695 + }
696 + }else{
697 + $result = array();
698 + $result['count'] = 0;
699 +
700 + $insert_data = array('username' => $username,
701 + 'time' => time(),
702 + 'count' => 1,
703 + 'ip' => $loginizer['current_ip'],
704 + 'lockout' => 0,
705 + 'url' => $url);
706 +
707 + $format = array('%s','%d','%d','%s','%d','%s');
708 +
709 + $wpdb->insert($wpdb->prefix.'loginizer_logs', $insert_data, $format);
640 710 }
641 -
711 +
712 + // We need to add one as this is a failed attempt as well
713 + $result['count'] = $result['count'] + 1;
642 714 loginizer_update_attempt_stats(0);
643 - $loginizer['retries_left'] = $max_retries - ($count % $max_retries);
644 - $loginizer['retries_left'] = $loginizer['retries_left'] == $max_retries ? 0 : $loginizer['retries_left'];
715 + $loginizer['retries_left'] = ($loginizer['max_retries'] - ($result['count'] % $loginizer['max_retries']));
716 + $loginizer['retries_left'] = $loginizer['retries_left'] == $loginizer['max_retries'] ? 0 : $loginizer['retries_left'];
645 717
646 718 }
647 719 }
648 720
649 -function loginizer_rsssl_2fa_success($user){
650 - loginizer_login_success('', $user);
651 -}
652 -
653 721 function loginizer_login_success($user_login, $user) {
654 722 global $wp_version, $loginizer;
655 723
656 724 loginizer_update_attempt_stats(1);
@@ -804,22 +872,11 @@
804 872 wc_add_notice( loginizer_retries_left(), 'error' );
805 873 }
806 874 }
807 875
808 -function loginizer_ultimatemember_error_handler(){
809 -
810 - if(class_exists('UM')){
811 - \UM()->form()->add_error('remaining_tries', loginizer_retries_left());
812 - }
813 -}
814 -
815 876 // Handles social login URL
816 877 function loginizer_social_login_error_handler($errors = '', $redirect_to = ''){
817 878 global $loginizer;
818 -
819 - if(loginizer_is_blacklisted()){
820 - return $errors;
821 - }
822 879
823 880 loginizer_get_social_error();
824 881
825 882 if(empty($loginizer['social_errors'])){
@@ -861,115 +918,8 @@
861 918 $result = $wpdb->query($del_query);
862 919
863 920 update_option('loginizer_last_reset', time());
864 921
865 -}
866 -
867 -function loginizer_load_translation_vars(){
868 - global $loginizer;
869 -
870 - $loginizer['login_mail_default_sub'] = __('Login Successful at $sitename', 'loginizer');
871 - $loginizer['login_mail_default_msg'] = __('Hello $user_login,
872 -
873 -Your account was recently logged in from the IP : $ip
874 -Time : $date
875 -If it was not you who logged in then please report this to us immediately.
876 -
877 -Regards,
878 -$sitename','loginizer');
879 -
880 - if(empty($loginizer['login_mail_subject'])){
881 - $loginizer['login_mail_subject'] = $loginizer['login_mail_default_sub'];
882 - }
883 -
884 - if(empty($loginizer['login_mail_body'])){
885 - $loginizer['login_mail_body'] = $loginizer['login_mail_default_msg'];
886 - }
887 -
888 - // Default messages
889 - $loginizer['d_msg']['inv_userpass'] = __('Incorrect Username or Password', 'loginizer');
890 - $loginizer['d_msg']['ip_blacklisted'] = __('Your IP has been blacklisted', 'loginizer');
891 - $loginizer['d_msg']['attempts_left'] = __('attempt(s) left', 'loginizer');
892 - $loginizer['d_msg']['lockout_err'] = __('You have exceeded maximum login retries<br /> Please try after', 'loginizer');
893 - $loginizer['d_msg']['minutes_err'] = __('minute(s)', 'loginizer');
894 - $loginizer['d_msg']['hours_err'] = __('hour(s)', 'loginizer');
895 -
896 - // Message Strings
897 - $loginizer['msg'] = get_option('loginizer_msg', []);
898 -
899 - foreach($loginizer['d_msg'] as $lk => $lv){
900 - if(empty($loginizer['msg'][$lk])){
901 - $loginizer['msg'][$lk] = $loginizer['d_msg'][$lk];
902 - }
903 - }
904 -
905 - $loginizer['2fa_d_msg']['otp_app'] = __('Please enter the OTP as seen in your App', 'loginizer');
906 - $loginizer['2fa_d_msg']['otp_email'] = __('Please enter the OTP emailed to you', 'loginizer');
907 - $loginizer['2fa_d_msg']['otp_field'] = __('One Time Password', 'loginizer');
908 - $loginizer['2fa_d_msg']['otp_question'] = __('Please answer your security question', 'loginizer');
909 - $loginizer['2fa_d_msg']['otp_answer'] = __('Your Answer', 'loginizer');
910 -
911 - // Message Strings
912 - $loginizer['2fa_msg'] = get_option('loginizer_2fa_msg', []);
913 -
914 - foreach($loginizer['2fa_d_msg'] as $lk => $lv){
915 - if(empty($loginizer['2fa_msg'][$lk])){
916 - $loginizer['2fa_msg'][$lk] = $loginizer['2fa_d_msg'][$lk];
917 - }
918 - }
919 -
920 -}
921 -
922 -function loginizer_social_login_load(){
923 - include_once LOGINIZER_DIR . '/main/social-login.php';
924 -}
925 -
926 -// Checks if softaculous is installed on the server.
927 -function loginizer_check_softaculous(){
928 -
929 - // Checking if we have Softaculous installed?
930 - if(!preg_match('/^\/home(?:\d+)?\/.*\//U', ABSPATH, $matches)){
931 - return false;
932 - }
933 -
934 - if(empty($matches) || empty($matches[0])){
935 - return false;
936 - }
937 -
938 - $softaculous_path = $matches[0] . '.softaculous/installations.php';
939 - if(!file_exists($softaculous_path)){
940 - return false;
941 - }
942 -
943 - // Checking if users has changed the branding of Softaculous.
944 - $universal_file = '';
945 - // Plesk, ISPManager, ISPConfig, InterWorx, H-Sphere, CentOS Web Panel, Softaculous Remote and Softaculous Enterprise
946 - if(file_exists('/usr/local/softaculous/enduser/universal.php')){
947 - $universal_file = '/usr/local/softaculous/enduser/universal.php';
948 - }else if(file_exists('/usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/universal.php')){
949 - $universal_file = '/usr/local/cpanel/whostmgr/docroot/cgi/softaculous/enduser/universal.php';
950 - }else if(file_exists('/usr/local/directadmin/plugins/softaculous/enduser/universal.php')){
951 - $universal_file = '/usr/local/directadmin/plugins/softaculous/enduser/universal.php';
952 - }else if(file_exists('/usr/local/vesta/softaculous/enduser/universal.php')){
953 - $universal_file = '/usr/local/vesta/softaculous/enduser/universal.php';
954 - }
955 -
956 - if(empty($universal_file)){
957 - return false;
958 - }
959 -
960 - $universal = file_get_contents($universal_file);
961 -
962 - if(empty($universal)){
963 - return false;
964 - }
965 -
966 - // Checking if Softaculous is being whitelabeled
967 - if(preg_match('/\$globals\[["\']sn["\']\]\s.?=\s.?["\']Softaculous["\']/', $universal)){
968 - update_option('loginizer_softwp_upgrade', time());
969 - }
970 -
971 - return false;
972 922 }
973 923
974 924 // Sorry to see you going
975 925 register_uninstall_hook(LOGINIZER_FILE, 'loginizer_deactivation');