PluginProbe
Loginizer / 2.0.6
Loginizer v2.0.6
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 +15 -101 2.0.12.0.6 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.0.1');
8 +define('LOGINIZER_VERSION', '2.0.6');
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');
@@ -357,60 +357,13 @@
357 357
358 358 if(is_admin()){
359 359 include_once LOGINIZER_DIR . '/main/admin.php';
360 360 }
361 -
361 +
362 362 // ----------------
363 363 // PRO INIT END
364 364 // ----------------
365 365
366 - // Is the premium features there ?
367 - if(!defined('LOGINIZER_PREMIUM')){
368 -
369 - if(current_user_can('activate_plugins')){
370 - // The promo time
371 - $loginizer['promo_time'] = get_option('loginizer_promo_time');
372 - if(empty($loginizer['promo_time'])){
373 - $loginizer['promo_time'] = time();
374 - update_option('loginizer_promo_time', $loginizer['promo_time']);
375 - }
376 -
377 - // Are we to show the loginizer promo
378 - if(!empty($loginizer['promo_time']) && $loginizer['promo_time'] > 0 && $loginizer['promo_time'] < (time() - (30*24*3600))){
379 -
380 - add_action('admin_notices', 'loginizer_promo');
381 -
382 - }
383 -
384 - if(!empty($loginizer['csrf_promo']) && $loginizer['csrf_promo'] > 0 && $loginizer['csrf_promo'] < (time() - 86400)){
385 -
386 - add_action('admin_notices', 'loginizer_csrf_promo');
387 -
388 - }
389 -
390 - // Are we to disable the promo
391 - if(isset($_GET['loginizer_promo']) && (int)$_GET['loginizer_promo'] == 0){
392 - update_option('loginizer_promo_time', (0 - time()) );
393 - die('DONE');
394 - }
395 -
396 - $loginizer['backuply_promo'] = get_option('loginizer_backuply_promo_time');
397 -
398 - if(empty($loginizer['backuply_promo'])){
399 - $loginizer['backuply_promo'] = abs($loginizer['promo_time']);
400 - update_option('loginizer_backuply_promo_time', $loginizer['backuply_promo']);
401 - }
402 -
403 - // Setting CSRF Promo time
404 - $loginizer['csrf_promo'] = get_option('loginizer_csrf_promo_time');
405 -
406 - if(empty($loginizer['csrf_promo'])){
407 - $loginizer['csrf_promo'] = abs($loginizer['promo_time']);
408 - update_option('loginizer_csrf_promo_time', $loginizer['csrf_promo']);
409 - }
410 - }
411 - }
412 -
413 366 // Secuity checks for social login.
414 367 if(!empty($_GET['lz_social_provider']) && loginizer_can_login() && empty($_GET['lz_api'])){
415 368 add_action('init', 'loginizer_social_login_load');
416 369 return;
@@ -541,26 +494,31 @@
541 494
542 495 if(empty($blacklist)){
543 496 return false;
544 497 }
545 -
498 +
499 + $current_ip_inet = inet_ptoi($loginizer['current_ip']);
500 +
546 501 foreach($blacklist as $k => $v){
547 -
502 +
503 + $start_inet = inet_ptoi($v['start']);
504 + $end_inet = inet_ptoi($v['end']);
505 +
548 506 // Is the IP in the blacklist ?
549 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
507 + if($start_inet <= $current_ip_inet && $current_ip_inet <= $end_inet){
550 508 $result = 1;
551 509 break;
552 510 }
553 -
511 +
554 512 // Is it in a wider range ?
555 - if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
513 + if($start_inet >= 0 && $end_inet < 0){
556 514
557 515 // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
558 516 // if the current IP is <= than the start of the range, it is within the range
559 517 // OR
560 518 // if the current IP is <= than the end of the range, it is within the range
561 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
562 - || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
519 + if($start_inet <= $current_ip_inet
520 + || $current_ip_inet <= $end_inet){
563 521 $result = 1;
564 522 break;
565 523 }
566 524
@@ -566,56 +524,12 @@
566 524
567 525 }
568 526
569 527 }
570 -
528 +
571 529 // You are blacklisted
572 530 if(!empty($result)){
573 531 $lz_error['ip_blacklisted'] = $loginizer['msg']['ip_blacklisted'];
574 - return true;
575 - }
576 -
577 - return false;
578 -
579 -}
580 -
581 -function loginizer_is_whitelisted(){
582 -
583 - global $wpdb, $loginizer, $lz_error;
584 -
585 - $whitelist = $loginizer['whitelist'];
586 -
587 - if(empty($whitelist)){
588 - return false;
589 - }
590 -
591 - foreach($whitelist as $k => $v){
592 -
593 - // Is the IP in the blacklist ?
594 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
595 - $result = 1;
596 - break;
597 - }
598 -
599 - // Is it in a wider range ?
600 - if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
601 -
602 - // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
603 - // if the current IP is <= than the start of the range, it is within the range
604 - // OR
605 - // if the current IP is <= than the end of the range, it is within the range
606 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
607 - || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
608 - $result = 1;
609 - break;
610 - }
611 -
612 - }
613 -
614 - }
615 -
616 - // You are whitelisted
617 - if(!empty($result)){
618 532 return true;
619 533 }
620 534
621 535 return false;