Skip to content

Commit

Permalink
Only allow calling Treemap API directly
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Jan 10, 2025
1 parent 6afc4e4 commit 272921a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion API.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Piwik\API\Request;
use Piwik\Common;
use Piwik\DataTable;
use Piwik\Metrics;
use Piwik\Period\Range;
use Piwik\Plugins\TreemapVisualization\Visualizations\Treemap;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function getTreemapData(
$availableHeight = false,
$show_evolution_values = false
) {
if (trim($apiMethod) === 'TreemapVisualization.getTreemapData') {
if (!Request::isCurrentApiRequestTheRootApiRequest()) {
return [];
}

Expand All @@ -70,6 +71,10 @@ public function getTreemapData(

$dataTable = Request::processRequest("$apiMethod", $params);

if (!$dataTable instanceof DataTable) {
return [];
}

$columns = explode(',', $column);
$column = reset($columns);

Expand Down

0 comments on commit 272921a

Please sign in to comment.