diff --git a/index.php b/index.php index 94406256..b26741ca 100644 --- a/index.php +++ b/index.php @@ -100,7 +100,7 @@ try{ // whitelist control if(!Bridge::isWhitelisted($whitelist_selection, $bridge)) { throw new \HttpException('This bridge is not whitelisted', 401); - die; + die; } $cache = Cache::create('FileCache'); @@ -111,6 +111,10 @@ try{ } else { $bridge->setCache($cache); // just add disable cache to your query to disable caching } + if(isset($_REQUEST['_p'])){ + $bridge->useProxy=true; + } + $bridge->setDatas($_REQUEST); $bridge->loadMetadatas(); $bridge->setDatas($_REQUEST); // Data transformation diff --git a/lib/Bridge.php b/lib/Bridge.php index a8732e06..2af6c156 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -21,6 +21,7 @@ abstract class BridgeAbstract implements BridgeInterface{ public $uri = ""; public $description = 'No description provided'; public $maintainer = 'No maintainer'; + public $useProxy = false; public $parameters = array(); /** @@ -111,7 +112,7 @@ abstract class BridgeAbstract implements BridgeInterface{ ), ); - if(defined('PROXY_URL')) { + if(defined('PROXY_URL') && $this->useProxy) { $contextOptions['http']['proxy'] = PROXY_URL; $contextOptions['http']['request_fulluri'] = true; diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index ade0ca42..7547dfc9 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -28,6 +28,12 @@ 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; + } + $card .= HTMLUtils::getHelperButtonsFormat($formats); } else { $card .= 'Inactive'; @@ -40,13 +46,13 @@ CARD; if($hasGlobalParameter) $globalParameters = json_decode($bridgeElement->parameters['global'], true); - + foreach($bridgeElement->parameters as $parameterName => $parameter){ $parameter = json_decode($parameter, true); if(!is_numeric($parameterName) && $parameterName == 'global') continue; - + if($hasGlobalParameter) $parameter = array_merge($parameter, $globalParameters); @@ -82,7 +88,7 @@ CARD; $card .= '
' . PHP_EOL; } else if($inputEntry['type'] == 'list') { $card .= '' . PHP_EOL; + $card .= '
' . PHP_EOL; + } + $card .= HTMLUtils::getHelperButtonsFormat($formats); } else { $card .= 'Inactive'; } - + $card .= '' . PHP_EOL; } @@ -161,7 +173,7 @@ class HTMLSanitizer { $element->outertext = ''; } else { foreach($element->getAllAttributes() as $attributeName => $attribute) { - if(!in_array($attributeName, $this->keptAttributes)) + if(!in_array($attributeName, $this->keptAttributes)) $element->removeAttribute($attributeName); } }