Move Proxy\isSecureConnection() to helpers
This commit is contained in:
parent
ba4aa5173d
commit
5c8b01ac96
@ -2,6 +2,11 @@
|
||||
|
||||
namespace Helper;
|
||||
|
||||
function isSecureConnection()
|
||||
{
|
||||
return ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
|
||||
}
|
||||
|
||||
/*
|
||||
* get Version number from git archive output
|
||||
*/
|
||||
@ -56,7 +61,7 @@ function css()
|
||||
|
||||
function get_current_base_url()
|
||||
{
|
||||
$url = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
|
||||
$url = isSecureConnection() ? 'https://' : 'http://';
|
||||
$url .= $_SERVER['SERVER_NAME'];
|
||||
$url .= $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443 ? '' : ':'.$_SERVER['SERVER_PORT'];
|
||||
$url .= dirname($_SERVER['PHP_SELF']) !== '/' ? dirname($_SERVER['PHP_SELF']).'/' : '/';
|
||||
|
@ -2,21 +2,17 @@
|
||||
|
||||
namespace Model\Proxy;
|
||||
|
||||
use Helper;
|
||||
use Model\Config;
|
||||
use PicoFeed\Config\Config as PicoFeedConfig;
|
||||
use PicoFeed\Filter\Filter;
|
||||
use PicoFeed\Client\Client;
|
||||
use PicoFeed\Logging\Logger;
|
||||
|
||||
function isSecureConnection()
|
||||
{
|
||||
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
|
||||
}
|
||||
|
||||
function addProxyToLink($link)
|
||||
{
|
||||
if (isSecureConnection() && strpos($link, 'http:') === 0) {
|
||||
$link = '?action=proxy&url='.urlencode($link);
|
||||
if (Helper\isSecureConnection() && strpos($link, 'http:') === 0) {
|
||||
$link = '?action=proxy&url='.rawurlencode($link);
|
||||
}
|
||||
|
||||
return $link;
|
||||
@ -26,7 +22,7 @@ function addProxyToTags($html, $website, $proxy_images, $cloak_referrer)
|
||||
{
|
||||
if ($html === '' // no content, no proxy
|
||||
|| (! $cloak_referrer && ! $proxy_images) // neither cloaking nor proxing enabled
|
||||
|| (! $cloak_referrer && $proxy_images && ! isSecureConnection())) { // only proxy enabled, but not connected via HTTPS
|
||||
|| (! $cloak_referrer && $proxy_images && ! Helper\isSecureConnection())) { // only proxy enabled, but not connected via HTTPS
|
||||
|
||||
return $html;
|
||||
}
|
||||
@ -39,7 +35,7 @@ function addProxyToTags($html, $website, $proxy_images, $cloak_referrer)
|
||||
// they do not trigger mixed content warnings.
|
||||
$config->setFilterImageProxyProtocol('http');
|
||||
}
|
||||
elseif (! $proxy_images && $cloak_referrer && isSecureConnection()) {
|
||||
elseif (! $proxy_images && $cloak_referrer && Helper\isSecureConnection()) {
|
||||
// cloaking mode only: if a request from a HTTPS connection to a HTTP
|
||||
// connection is made, the referrer will be omitted by the browser.
|
||||
// Only the referrer for HTTPS to HTTPs requests needs to be cloaked.
|
||||
|
Loading…
Reference in New Issue
Block a user