Changeset 2125581
- Timestamp:
- 07/19/2019 04:29:19 AM (7 years ago)
- Location:
- vigilantor/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
vigilantor.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vigilantor/trunk/readme.txt
r1989355 r2125581 4 4 Tags: tor, tor blocker, comments, spam, proxy, security, block, registration, captcha 5 5 Requires at least: 4.0 6 Tested up to: 5. 0.17 Stable tag: 1.3. 36 Tested up to: 5.2.3 7 Stable tag: 1.3.4 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl.txt -
vigilantor/trunk/vigilantor.php
r1868792 r2125581 4 4 Plugin URI: https://drew-phillips.com/ 5 5 Description: Provides protections from Tor users visiting your site 6 Version: 1.3. 36 Version: 1.3.4 7 7 Author: Drew Phillips 8 8 Author URI: https://drew-phillips.com … … 10 10 */ 11 11 12 /* Copyright (C) 201 8Drew Phillips12 /* Copyright (C) 2019 Drew Phillips 13 13 14 14 This program is free software; you can redistribute it and/or modify … … 27 27 */ 28 28 29 defined('VIGILANTOR_VERSION') || define('VIGILANTOR_VERSION', '1.3. 3');29 defined('VIGILANTOR_VERSION') || define('VIGILANTOR_VERSION', '1.3.4'); 30 30 31 31 if (class_exists('VigilanTorWP')) { … … 55 55 private static $_instance = null; 56 56 57 const EXIT_LIST_UPDATE_URL = '//openinternet.io/tor/tor-ip-list.txt'; 57 const EXIT_LIST_UPDATE_URLS = [ 58 //'//www2.openinternet.io/tor/tor-ip-list.txt', 59 //'//openinternet.io/tor/tor-ip-list.txt', 60 ]; 58 61 59 62 private function __construct() … … 229 232 ); 230 233 } else { 231 header( 'HTTP/1.1403 Forbidden');234 header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); 232 235 233 236 // some themes reference $id in page templates … … 391 394 // this prevents the update from slowing down the page load for the visitor 392 395 // if wp-cron is working properly, the update will never need to be forced like this 393 add_action('wp_footer', array(&$this, 'enqueueUpdateScript')); 396 if (mt_rand(0, 100000) % 10 == 0) { 397 // ~ 10% chance to enqueue the update script 398 add_action('wp_footer', array(&$this, 'enqueueUpdateScript')); 399 } 394 400 } 395 401 } … … 617 623 public function enqueueUpdateScript() 618 624 { 619 $url = addslashes(get_site_url( ) . '?_vitor_action=update');625 $url = addslashes(get_site_url(null, '?_vitor_action=update')); 620 626 echo "<script type='text/javascript'>jQuery.ajax({ url: '{$url}' });</script>\n"; 621 627 } … … 843 849 } 844 850 845 $url = ($use_ssl ? 'https:' : 'http:') . self::EXIT_LIST_UPDATE_URL;846 847 851 add_filter('http_headers_useragent', array(&$this, 'filterUserAgent'), 99, 1); 848 852 849 $try = true;850 853 $success = false; 854 $i = 0; 851 855 852 856 do { 853 $req = new WP_Http(); 857 $req = new WP_Http(); // NB: default timeout is 5 seconds 858 $url = ($use_ssl ? 'https:' : 'http:') . self::EXIT_LIST_UPDATE_URLS[$i]; 854 859 $res = $req->request($url, array('httpversion' => '1.1')); 855 860 856 if (is_wp_error($res)) { 857 if ($use_ssl) { 858 $use_ssl = false; 859 $url = 'http:' . self::EXIT_LIST_UPDATE_URL; 860 continue; // try again with http 861 } 862 $try = false; 863 } else { 861 if (!is_wp_error($res)) { 864 862 $res = $res['body']; 865 $try = false;866 863 $success = true; 867 } 868 } while($try); 864 break; 865 } 866 } while(++$i < sizeof(self::EXIT_LIST_UPDATE_URLS)); 869 867 870 868 if (!$success && is_wp_error($res)) { … … 880 878 private function getClientIpAddress() 881 879 { 882 // TODO: look for IP in other headers (e.g. X-Forwarded-For, X-Proxy-IP) 880 // TODO: look for IP in other headers (e.g. X-Forwarded-For, X-Proxy-IP), but only if trusted 883 881 return $_SERVER['REMOTE_ADDR']; 884 882 } … … 932 930 933 931 // check that a captcha id was submitted with the form 934 if (!empty($_POST['s iwp_captcha_id'])) {935 $captchaId = trim(stripslashes($_POST['s iwp_captcha_id']));932 if (!empty($_POST['scid'])) { 933 $captchaId = trim(stripslashes($_POST['scid'])); 936 934 $code = trim(stripslashes($_POST['siwp_captcha_value'])); 937 935
Note: See TracChangeset
for help on using the changeset viewer.