function sk2_get_url_content($url, $level = 0, $convert_case = false) { if ($level > 8) { return ""; } $file_content = sk2_url_fopen($url, $convert_case); if ($level >= 0) { if (preg_match_all("/<(?:script|iframe) [^>]*src=\\\"([^\\\"]*)\\\"[^>]*>/", $file_content, $matches)) { foreach ($matches[1] as $match) { $file_content .= "**embedded:{$match}**"; $new_url = $match; if (strncasecmp($new_url, "http", 4) != 0) { $new_url = $url . "/" . $new_url; } //echo "level: $level - match: $match - url: $new_url<br/>"; $file_content .= "***\n" . sk2_get_url_content($new_url, $level + 1); } } } return $file_content; }
function treat_this($cmt_object) { if ($this->get_option_value('do_submit') != "on") { return; } //do we need to submit at all? if ($cmt_object->karma > $this->get_option_value('submit_limit')) { return; } //check if we have curl if (function_exists('curl_init')) { $this->log_msg(__("Submitting to URL using CURL"), 3); //new submit logic // build a postlist of <ip|url>: <data> // submit using curl (needs updated sk2_functions.php) $postinfo = array(); $entries = 0; //author's IP if (!empty($cmt_object->author_ip)) { $postinfo["ip{$entries}"] = urlencode(trim($cmt_object->author_ip)); $entries++; } //author URL if (!empty($cmt_object->author_url['url'])) { $postinfo["url{$entries}"] = urlencode(trim($cmt_object->author_url['url'])); $entries++; } //all the URIs $found_uris = array_merge($cmt_object->content_links, $cmt_object->content_url_no_links); $done_uris = array(); foreach ($found_uris as $url_info) { if (!in_array($url_info['url'], $done_uris)) { $postinfo["url{$entries}"] = urlencode(trim($url_info['url'])); $done_urlis[] = $url_info['url']; } } //print_r($postinfo); //exit(); if (!empty($postinfo)) { //fetch result $result = sk2_url_fopen($this->get_option_value('submit_target'), false, $postinfo); $this->log_msg(sprintf(__("Submitted %s total entries to RBL using POST; got result %s", 'sk2'), sizeof($postinfo), $result), 4); } return; } //curl doesn't exist, so do it the old way... $this->log_msg(__("Submitting to URL using GET"), 3); $ipcount = $uricount = 0; //first, submit the author's ip $ip = $cmt_object->author_ip; if (!empty($ip)) { $url = sprintf($this->get_option_value('submit_ip_target'), $ip); $this->log_msg(__("Opening URL: ", 'sk2') . $url, 0); $result = sk2_url_fopen($url); $this->log_msg(sprintf(__("Adding IP %s to RBL returned %s", 'sk2'), $ip, $result), 2); $ipcount++; } //submit the author URI if (!empty($cmt_object->author_url['url'])) { $url = sprintf($this->get_option_value('submit_uri_target'), $cmt_object->author_url['url']); $this->log_msg(__("Opening URL: ", 'sk2') . $url, 0); $result = sk2_url_fopen($url); $this->log_msg(sprintf(__("Adding author URI %s to RBL returned %s", 'sk2'), $cmt_object->author_url['url'], $result), 2); $uricount++; } //now, submit all the URIs $found_uris = array_merge($cmt_object->content_links, $cmt_object->content_url_no_links); $done_uris = array(); foreach ($found_uris as $url_info) { if (!in_array($url_info['url'], $done_uris)) { $done_uris[] = $url_info['url']; $url = sprintf($this->get_option_value('submit_uri_target'), trim($url_info['url'])); $this->log_msg(__("Opening URL: ", 'sk2') . $url, 0); $result = sk2_url_fopen($url); $this->log_msg(sprintf(__("Adding URI %s to RBL returned %s", 'sk2'), $url_info['url'], $result), 2); $uricount++; } } $this->log_msg(sprintf(__("Submitted %d IP(s) and %d URI(s) to RBL using GET", 'sk2'), $ipcount, $uricount), 4); }