Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2016-01-12 00:15:16 +0300
committerThomas Steur <thomas.steur@gmail.com>2016-01-12 00:41:20 +0300
commit0e65aee4cb1a5d2fdd46312b6a5da7d315b0399e (patch)
treed22d8d9f2bca0316fa22d7daac5dadefb943416e /plugins/API/API.php
parentfa5dcaec1eccd9bc3a8f28879e416cafb687c662 (diff)
make sure &gt; can be used in segments when using bulk requests
Diffstat (limited to 'plugins/API/API.php')
-rw-r--r--plugins/API/API.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 2f609b5e8b..bb287f9b7a 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -11,6 +11,7 @@ namespace Piwik\Plugins\API;
use Piwik\API\Proxy;
use Piwik\API\Request;
use Piwik\Columns\Dimension;
+use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\DataTable;
@@ -484,7 +485,21 @@ class API extends \Piwik\Plugin\API
$result = array();
foreach ($urls as $url) {
- $req = new Request($url . '&format=php&serialize=0');
+ $params = Request::getRequestArrayFromString($url . '&format=php&serialize=0');
+
+ if (isset($params['urls']) && $params['urls'] == $urls) {
+ // by default 'urls' is added to $params as Request::getRequestArrayFromString adds all $_GET/$_POST
+ // default parameters
+ unset($params['urls']);
+ }
+
+ if (!empty($params['segment']) && strpos($url, 'segment=') > -1) {
+ // only unsanitize input when segment is actually present in URL, not when it was used from
+ // $defaultRequest in Request::getRequestArrayFromString from $_GET/$_POST
+ $params['segment'] = urlencode(Common::unsanitizeInputValue($params['segment']));
+ }
+
+ $req = new Request($params);
$result[] = $req->process();
}
return $result;