diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-11-11 18:18:54 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-11-11 18:18:54 +0100 |
| commit | 0be537e8c72912c858012ee015cdd62eeab0d0f0 (patch) | |
| tree | d2b75e56ce028f0a649da75a799a6cb121fe55a7 /matomo/matomo-proxy.php | |
| parent | 7a8d83314fe067ecae73b7a89c3565beddd8f204 (diff) | |
fix: move matomo outside config and configure it correctly
Diffstat (limited to 'matomo/matomo-proxy.php')
| -rw-r--r-- | matomo/matomo-proxy.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/matomo/matomo-proxy.php b/matomo/matomo-proxy.php new file mode 100644 index 0000000..c049bd6 --- /dev/null +++ b/matomo/matomo-proxy.php @@ -0,0 +1,36 @@ +<?php + +define('MATOMO_PROXY_FROM_ENDPOINT', 1); + +$path = 'index.php'; + +$SUPPORTED_METHODS = [ + 'CoreAdminHome.optOut' +]; +$VALID_FILES = [ + 'plugins/CoreAdminHome/javascripts/optOut.js' +]; + +$module = isset($_GET['module']) ? $_GET['module'] : null; +if (empty($module)) { + $module = isset($_POST['module']) ? $_POST['module'] : null; +} + +$action = isset($_GET['action']) ? $_GET['action'] : null; +if (empty($action)) { + $action = isset($_POST['action']) ? $_POST['action'] : null; +} + +$filerequest = isset($_GET['file']) ? $_GET['file'] : null; +if (empty($filerequest)) { + $filerequest = isset($_POST['file']) ? $_POST['file'] : null; +} + +if (!(isset($filerequest) && in_array($filerequest, $VALID_FILES)) + && !(isset($module) && isset($action) && in_array("$module.$action", $SUPPORTED_METHODS)) +) { + http_response_code(404); + exit; +} + +include __DIR__ . '/proxy.php'; |
