My personal website built with Hugo https://mehl.mx
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

matomo-proxy.php 898B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. define('MATOMO_PROXY_FROM_ENDPOINT', 1);
  3. $path = 'index.php';
  4. $SUPPORTED_METHODS = [
  5. 'CoreAdminHome.optOut'
  6. ];
  7. $VALID_FILES = [
  8. 'plugins/CoreAdminHome/javascripts/optOut.js'
  9. ];
  10. $module = isset($_GET['module']) ? $_GET['module'] : null;
  11. if (empty($module)) {
  12. $module = isset($_POST['module']) ? $_POST['module'] : null;
  13. }
  14. $action = isset($_GET['action']) ? $_GET['action'] : null;
  15. if (empty($action)) {
  16. $action = isset($_POST['action']) ? $_POST['action'] : null;
  17. }
  18. $filerequest = isset($_GET['file']) ? $_GET['file'] : null;
  19. if (empty($filerequest)) {
  20. $filerequest = isset($_POST['file']) ? $_POST['file'] : null;
  21. }
  22. if (!(isset($filerequest) && in_array($filerequest, $VALID_FILES))
  23. && !(isset($module) && isset($action) && in_array("$module.$action", $SUPPORTED_METHODS))
  24. ) {
  25. http_response_code(404);
  26. exit;
  27. }
  28. include dirname(__FILE__) . '/proxy.php';