diff options
author | Andrew Dolgov <[email protected]> | 2015-11-20 13:34:52 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-11-20 13:34:52 +0300 |
commit | aa03bac42490673b4cd027c779655a027b1dd0fc (patch) | |
tree | 35720efb77a997c9708aea209186e4a384ec5b25 /plugins | |
parent | 4c46702672631c0cf84067d6f2c55b3bfda1db6f (diff) |
allow NO_CURL to disable several CURL-related checks in plugins
af_readability: skip http content-type checking when open_basedir is enabled
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/af_readability/init.php | 6 | ||||
-rwxr-xr-x | plugins/af_redditimgur/init.php | 2 | ||||
-rwxr-xr-x | plugins/af_unburn/init.php | 2 | ||||
-rw-r--r-- | plugins/af_zz_imgsetsizes/init.php | 3 |
4 files changed, 8 insertions, 5 deletions
diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index 6216d510a..675e5c5d5 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -100,13 +100,15 @@ class Af_Readability extends Plugin { if (!class_exists("Readability")) require_once(dirname(dirname(__DIR__)). "/lib/readability/Readability.php"); - if (function_exists("curl_init")) { + if (!defined('NO_CURL') && function_exists('curl_init') && !ini_get("open_basedir")) { + $ch = curl_init($article["link"]); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir")); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT); @$result = curl_exec($ch); diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index f99941477..3ff960729 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -244,7 +244,7 @@ class Af_RedditImgur extends Plugin { $found = $this->inline_stuff($article, $doc, $xpath); - if (function_exists("curl_init") && !$found && $this->host->get($this, "enable_readability") && + if (!defined('NO_CURL') && function_exists("curl_init") && !$found && $this->host->get($this, "enable_readability") && mb_strlen(strip_tags($article["content"])) <= 150) { if (!class_exists("Readability")) require_once(dirname(dirname(__DIR__)). "/lib/readability/Readability.php"); diff --git a/plugins/af_unburn/init.php b/plugins/af_unburn/init.php index 593038871..263997dbf 100755 --- a/plugins/af_unburn/init.php +++ b/plugins/af_unburn/init.php @@ -17,7 +17,7 @@ class Af_Unburn extends Plugin { function hook_article_filter($article) { $owner_uid = $article["owner_uid"]; - if (!function_exists("curl_init") || ini_get("open_basedir")) + if (defined('NO_CURL') || !function_exists("curl_init") || ini_get("open_basedir")) return $article; if ((strpos($article["link"], "feedproxy.google.com") !== FALSE || diff --git a/plugins/af_zz_imgsetsizes/init.php b/plugins/af_zz_imgsetsizes/init.php index d71ec096e..96afbbfe0 100644 --- a/plugins/af_zz_imgsetsizes/init.php +++ b/plugins/af_zz_imgsetsizes/init.php @@ -18,7 +18,8 @@ class Af_Zz_ImgSetSizes extends Plugin { function hook_article_filter($article) { - $owner_uid = $article["owner_uid"]; + if (defined('NO_CURL') || !function_exists("curl_init")) + return $article; $charset_hack = '<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |