Pull out TOR_PROXY as a constant in config.php, a=chris

Chris Pollett [2013-12-01 18:Dec:st]
Pull out TOR_PROXY as a constant in config.php, a=chris
Filename
configs/config.php
lib/fetch_url.php
lib/indexing_plugins/wordfilter_plugin.php
diff --git a/configs/config.php b/configs/config.php
index ee1cfdcfa..fe94025d3 100644
--- a/configs/config.php
+++ b/configs/config.php
@@ -411,9 +411,14 @@ define('ERROR_CRAWL_DELAY', 20);
 /** how often should we make in OPIC the sum of weights totals MAX_URLS */
 define('NORMALIZE_FREQUENCY', 10000);

+/** Proxy to use when try to download TOR pages */
+if(!defined('TOR_PROXY')) {
+    define('TOR_PROXY', '127.0.0.1:9150');
+}
+
 /**
  * @global array file extensions which can be handled by the search engine,
- * other extensions will be ignored. This array is populated in the individual
+ * other extensions will be ignored. This array is populated in the individual
  * lib/processors page processors
  */
 $INDEXED_FILE_TYPES = array("unknown");
diff --git a/lib/fetch_url.php b/lib/fetch_url.php
index 345da03c8..865450442 100755
--- a/lib/fetch_url.php
+++ b/lib/fetch_url.php
@@ -116,7 +116,7 @@ class FetchUrl implements CrawlConstants
                 curl_setopt($sites[$i][0], CURLOPT_CONNECTTIMEOUT,PAGE_TIMEOUT);
                 curl_setopt($sites[$i][0], CURLOPT_TIMEOUT, PAGE_TIMEOUT);
                 if (stripos($url,'.onion') !== false) {
-                    curl_setopt($sites[$i][0], CURLOPT_PROXY, '127.0.0.1:9150');
+                    curl_setopt($sites[$i][0], CURLOPT_PROXY, TOR_PROXY);
                     curl_setopt($sites[$i][0], CURLOPT_PROXYTYPE, 7);
                 }
                 if(!$minimal) {
@@ -575,8 +575,8 @@ class FetchUrl implements CrawlConstants
         curl_setopt($agents[$host], CURLOPT_FAILONERROR, true);
         curl_setopt($agents[$host], CURLOPT_TIMEOUT, SINGLE_PAGE_TIMEOUT);
         curl_setopt($agents[$host], CURLOPT_CONNECTTIMEOUT, PAGE_TIMEOUT);
-        if (stripos($url,'.onion') !== false) {
-            curl_setopt($agents[$host], CURLOPT_PROXY, '127.0.0.1:9150');
+        if (stripos($site,'.onion') !== false) {
+            curl_setopt($agents[$host], CURLOPT_PROXY, TOR_PROXY);
             curl_setopt($agents[$host], CURLOPT_PROXYTYPE, 7);
         }
         //make lighttpd happier
diff --git a/lib/indexing_plugins/wordfilter_plugin.php b/lib/indexing_plugins/wordfilter_plugin.php
index d56ce782d..9f5ceed7e 100644
--- a/lib/indexing_plugins/wordfilter_plugin.php
+++ b/lib/indexing_plugins/wordfilter_plugin.php
@@ -161,10 +161,10 @@ class WordfilterPlugin extends IndexingPlugin implements CrawlConstants
      *  @param array $configuration an associative array of word => actions
      *      that say how this plugin should behave
      */
-    function saveConfiguration($confguration)
+    function saveConfiguration($configuration)
     {
         $config_file = WORK_DIRECTORY."/data/word_filter_plugin.txt";
-        file_put_contents($config_file, serialize($confguration));
+        file_put_contents($config_file, serialize($configuration));
     }

     /**
ViewGit