From: Andrew Dolgov Date: Thu, 18 May 2017 09:56:45 +0000 (+0300) Subject: af_zz_imgproxy: add optional no-cache mode X-Git-Tag: 17.12~181 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7611f0c052976b7c2b804b41d1b9805311cc32bb;p=tt-rss.git af_zz_imgproxy: add optional no-cache mode --- diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index c85ec642..7de0c022 100644 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -66,9 +66,14 @@ class Af_Zz_ImgProxy extends Plugin { $data = fetch_file_contents(array("url" => $url)); if ($data) { - if (file_put_contents($local_filename, $data)) { - $mimetype = mime_content_type($local_filename); - header("Content-type: $mimetype"); + + $disable_cache = $this->host->get($this, "disable_cache"); + + if (!$disable_cache) { + if (file_put_contents($local_filename, $data)) { + $mimetype = mime_content_type($local_filename); + header("Content-type: $mimetype"); + } } print $data; @@ -226,8 +231,11 @@ class Af_Zz_ImgProxy extends Plugin { $proxy_all = $this->host->get($this, "proxy_all"); print_checkbox("proxy_all", $proxy_all); + print " 
"; - print " "; + $disable_cache = $this->host->get($this, "disable_cache"); + print_checkbox("disable_cache", $disable_cache); + print " "; print "

"; print_button("submit", __("Save")); @@ -238,8 +246,10 @@ class Af_Zz_ImgProxy extends Plugin { function save() { $proxy_all = checkbox_to_sql_bool($_POST["proxy_all"]) == "true"; + $disable_cache = checkbox_to_sql_bool($_POST["disable_cache"]) == "true"; - $this->host->set($this, "proxy_all", $proxy_all); + $this->host->set($this, "proxy_all", $proxy_all, false); + $this->host->set($this, "disable_cache", $disable_cache); echo __("Configuration saved"); }