Changeset 767
- Timestamp:
- 12/21/06 11:58:05 (2 years ago)
- Files:
-
- devel/config-dist.php (modified) (1 diff)
- devel/lib/setup.php (modified) (1 diff)
- devel/lib/snoopy/Snoopy.class.inc (modified) (8 diffs)
- devel/units/magpie/function_actions.php (modified) (2 diffs)
- devel/units/magpie/function_init.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/config-dist.php
r703 r767 179 179 // and provide the lms with the username for that user. 180 180 // This user needs write access to {$CFG->dataroot}lms/incoming/ as that is where the incoming files will end up. 181 182 183 // For SSL feed *reading* support, Snoopy needs to know where the curl executable is. 184 // To disable, or if curl is not available (e.g. on Windows), set to false 185 //$CFG->curlpath = "/usr/bin/curl"; 186 $CFG->curlpath = false; 181 187 182 188 devel/lib/setup.php
r742 r767 64 64 if (empty($CFG->disable_publiccomments)) { 65 65 $CFG->disable_publiccomments = false; 66 } 67 68 if (empty($CFG->curlpath)) { 69 $CFG->curlpath = false; 66 70 } 67 71 devel/lib/snoopy/Snoopy.class.inc
r269 r767 43 43 44 44 var $host = "www.php.net"; // host name we are connecting to 45 var $port = 80; // port we are connecting to45 var $port = ""; // port we are connecting to 46 46 var $proxy_host = ""; // proxy host to use 47 47 var $proxy_port = ""; // proxy port to use … … 71 71 72 72 // http accept types 73 var $accept = " image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";73 var $accept = ""; 74 74 75 75 var $results = ""; // where the content is put … … 117 117 var $_isproxy = false; // set if using a proxy server 118 118 var $_fp_timeout = 30; // timeout for socket connection 119 120 121 // CHANGE FROM UPSTREAM - added constructor 122 function Snoopy () { 123 global $CFG; 124 $this->curl_path = $CFG->curlpath; 125 } 119 126 120 127 /*======================================================================*\ … … 145 152 case "http": 146 153 $this->host = $URI_PARTS["host"]; 147 if(!empty($URI_PARTS["port"])) 154 if(!empty($URI_PARTS["port"])) { 148 155 $this->port = $URI_PARTS["port"]; 156 } else { // CHANGE FROM UPSTREAM 157 $this->port = 80; 158 } 149 159 if($this->_connect($fp)) 150 160 { … … 209 219 return false; 210 220 $this->host = $URI_PARTS["host"]; 211 if(!empty($URI_PARTS["port"])) 221 if(!empty($URI_PARTS["port"])) { 212 222 $this->port = $URI_PARTS["port"]; 223 } else { // CHANGE FROM UPSTREAM 224 $this->port = 443; 225 } 213 226 if($this->_isproxy) 214 227 { … … 1000 1013 $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); 1001 1014 1015 $cmdline_params = ''; 1016 1002 1017 for($curr_header = 0; $curr_header < count($headers); $curr_header++) { 1003 1018 $safer_header = strtr( $headers[$curr_header], "\"", " " ); … … 1011 1026 $cmdline_params .= " -m ".$this->read_timeout; 1012 1027 1013 $headerfile = tempnam($temp_dir, "sno"); 1028 $headerfile = tempnam($this->temp_dir, "sno"); 1029 1030 $cmdline_params .= ' -k '; // CHANGE FROM UPSTREAM - ignore bad SSL certs 1014 1031 1015 1032 $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access … … 1053 1070 } 1054 1071 1055 if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) 1072 if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) { 1073 if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$result_headers[$currentHeader], $status)) // CHANGE FROM UPSTREAM 1074 { 1075 $this->status= $status[1]; 1076 } 1056 1077 $this->response_code = $result_headers[$currentHeader]; 1078 } 1057 1079 1058 1080 $this->headers[] = $result_headers[$currentHeader]; devel/units/magpie/function_actions.php
r667 r767 74 74 $url = trim(optional_param('url')); 75 75 if (!empty($url)) { 76 if ( substr($url,0,7) != "http://") {76 if (!preg_match('#https?://#', $url)) { 77 77 $url = "http://" . $url; 78 78 } … … 93 93 require_once($CFG->dirroot . 'lib/snoopy/Snoopy.class.inc'); 94 94 $client = new Snoopy(); 95 if (@$client->fetch($url) && $client->error == '') { 95 if (empty($CFG->curlpath) && substr($url,0,8) == "https://") { 96 $messages[] = __gettext("Feed subscription failed: SSL feed reading is not enabled."); 97 } else if (@$client->fetch($url) && $client->error == '') { 96 98 if (substr_count($client->results,"<channel") > 0 || substr_count($client->results,"<feed") > 0) { 97 99 $feed = new StdClass; devel/units/magpie/function_init.php
r632 r767 13 13 define('rss','true'); 14 14 define('MAGPIE_DIR', $CFG->dirroot . "units/magpie/"); 15 define('MAGPIE_OUTPUT_ENCODING', ' utf8');15 define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); 16 16 define('MAGPIE_USER_AGENT', "Elgg's furrepticiouf feed fetcher"); 17 17 require_once(MAGPIE_DIR . 'rss_fetch.inc');
