X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=plugins%2Faf_unburn%2Finit.php;h=5c9bc138733efd1b999599e3dc73e5f6ed0822a9;hb=129d62635430167fbdf837420ca952ccbef7a331;hp=a0c51c97eadff495e151e7db1294be9118061599;hpb=44ae16ce27cf89fa03c49b535492cc14c2f99605;p=tt-rss.git diff --git a/plugins/af_unburn/init.php b/plugins/af_unburn/init.php index a0c51c97..5c9bc138 100644 --- a/plugins/af_unburn/init.php +++ b/plugins/af_unburn/init.php @@ -1,7 +1,5 @@ link = $host->get_link(); $this->host = $host; $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); @@ -27,16 +24,23 @@ class Af_Unburn extends Plugin { strpos($article["link"], "/~r/") !== FALSE || strpos($article["link"], "feedsportal.com") !== FALSE)) { - if (strpos($article["plugin_data"], "unburn,$owner_uid:") === FALSE) { + if (ini_get("safe_mode") || ini_get("open_basedir")) { + $ch = curl_init(geturl($article["link"])); + } else { + $ch = curl_init($article["link"]); + } - $ch = curl_init(geturl($article["link"])); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); - //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("safe_mode") && !ini_get("open_basedir")); curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT); - $contents = @curl_exec($ch); + if (defined('_CURL_HTTP_PROXY')) { + curl_setopt($ch, CURLOPT_PROXY, _CURL_HTTP_PROXY); + } + + @curl_exec($ch); $real_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); @@ -67,14 +71,11 @@ class Af_Unburn extends Plugin { $article["plugin_data"] = "unburn,$owner_uid:" . $article["plugin_data"]; $article["link"] = $real_url; } - } else if (isset($article["stored"]["link"])) { - $article["link"] = $article["stored"]["link"]; - } } return $article; } - + function geturl($url){ (function_exists('curl_init')) ? '' : die('cURL Must be installed for geturl function to work. Ask your host to enable it or uncomment extension=php_curl.dll in php.ini'); @@ -112,7 +113,7 @@ class Af_Unburn extends Plugin { preg_match("/(Location:|URI:)[^(\n)]*/", $header, $matches); $url = trim(str_replace($matches[1],"",$matches[0])); $url_parsed = parse_url($url); - return (isset($url_parsed))? geturl($url, $referer):''; + return (isset($url_parsed))? geturl($url):''; } $oline=''; foreach($status as $key=>$eline){$oline.='['.$key.']'.$eline.' ';} @@ -123,5 +124,10 @@ class Af_Unburn extends Plugin { } return $url; } + + function api_version() { + return 2; + } + } ?>