diff --git a/index.php b/index.php index b21cd4c..778a4b2 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,8 @@ TODO : */ //define('PROXY_URL', 'tcp://192.168.0.0:28'); +// Set to true if you allow users to disable proxy usage for specific bridges +define('PROXY_BYBRIDGE',false); // keep PROXY_NAME empty to display PROXY_URL instead define('PROXY_NAME','Hidden Proxy Name'); @@ -113,8 +115,10 @@ try{ } else { $bridge->setCache($cache); // just add disable cache to your query to disable caching } - if(isset($_REQUEST['_p'])){ - $bridge->useProxy=true; + if(defined('PROXY_URL') && PROXY_BYBRIDGE && + isset($_REQUEST['_noproxy']) + ){ + $bridge->useProxy=false; } $bridge->setDatas($_REQUEST); $bridge->loadMetadatas(); diff --git a/lib/Bridge.php b/lib/Bridge.php index 2af6c15..664fc93 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -21,7 +21,7 @@ abstract class BridgeAbstract implements BridgeInterface{ public $uri = ""; public $description = 'No description provided'; public $maintainer = 'No maintainer'; - public $useProxy = false; + public $useProxy = true; public $parameters = array(); /** diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index 7cf1ec3..1ab7799 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -28,10 +28,10 @@ CARD; $card .= HTMLUtils::getFormHeader($bridgeName); if ($isActive){ - if(defined('PROXY_URL')){ - $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode('proxy') . '-' . urlencode('_p'); - $card .= '' . PHP_EOL; - $card .= '
' . PHP_EOL; + if(defined('PROXY_URL') && PROXY_BYBRIDGE){ + $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode('proxyoff') . '-' . urlencode('_noproxy'); + $card .= '' . PHP_EOL; + $card .= '
' . PHP_EOL; } $card .= HTMLUtils::getHelperButtonsFormat($formats); @@ -106,10 +106,10 @@ CARD; } if ($isActive){ - if(defined('PROXY_URL')){ - $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode('proxy') . '-' . urlencode('_p'); - $card .= '' . PHP_EOL; - $card .= '
' . PHP_EOL; + if(defined('PROXY_URL') && PROXY_BYBRIDGE){ + $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode('proxyoff') . '-' . urlencode('_noproxy'); + $card .= '' . PHP_EOL; + $card .= '
' . PHP_EOL; } $card .= HTMLUtils::getHelperButtonsFormat($formats);