config
3 months ago
core
3 months ago
js
3 months ago
lang
3 months ago
libs
3 months ago
node_modules
4 months ago
plugins
3 months ago
vendor
3 months ago
.htaccess
6 years ago
DIObject.php
2 years ago
LEGALNOTICE
6 months ago
LICENSE
2 years ago
LegacyAutoloader.php
2 years ago
PRIVACY.md
5 years ago
README.md
6 months ago
SECURITY.md
2 years ago
bootstrap.php
1 year ago
console
6 years ago
favicon.ico
2 years ago
index.php
2 years ago
matomo.js
3 months ago
matomo.php
2 years ago
offline-service-worker.js
5 years ago
piwik.js
3 months ago
piwik.php
6 months ago
robots.txt
5 years ago
piwik.php
75 lines
| 1 | <?php |
| 2 | |
| 3 | namespace { |
| 4 | /** |
| 5 | * Matomo - free/libre analytics platform |
| 6 | * |
| 7 | * @link https://matomo.org |
| 8 | * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 9 | */ |
| 10 | use Piwik\SettingsServer; |
| 11 | use Piwik\Tracker\RequestSet; |
| 12 | use Piwik\Tracker; |
| 13 | use Piwik\Tracker\Handler; |
| 14 | use Piwik\API\CORSHandler; |
| 15 | @\ignore_user_abort(\true); |
| 16 | // Note: if you wish to debug the Tracking API please see this documentation: |
| 17 | // https://developer.matomo.org/api-reference/tracking-api#debugging-the-tracker |
| 18 | if (!\defined('PIWIK_DOCUMENT_ROOT')) { |
| 19 | \define('PIWIK_DOCUMENT_ROOT', \dirname(__FILE__) == '/' ? '' : \dirname(__FILE__)); |
| 20 | } |
| 21 | if (\file_exists(\PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) { |
| 22 | require_once \PIWIK_DOCUMENT_ROOT . '/bootstrap.php'; |
| 23 | } |
| 24 | if (!\defined('PIWIK_INCLUDE_PATH')) { |
| 25 | \define('PIWIK_INCLUDE_PATH', \PIWIK_DOCUMENT_ROOT); |
| 26 | } |
| 27 | require_once \PIWIK_INCLUDE_PATH . '/core/bootstrap.php'; |
| 28 | require_once \PIWIK_INCLUDE_PATH . '/core/Request/AuthenticationToken.php'; |
| 29 | require_once \PIWIK_INCLUDE_PATH . '/core/Plugin/Controller.php'; |
| 30 | require_once \PIWIK_INCLUDE_PATH . '/core/Exception/NotYetInstalledException.php'; |
| 31 | require_once \PIWIK_INCLUDE_PATH . '/core/Plugin/ControllerAdmin.php'; |
| 32 | require_once \PIWIK_INCLUDE_PATH . '/core/Singleton.php'; |
| 33 | require_once \PIWIK_INCLUDE_PATH . '/core/Plugin/Manager.php'; |
| 34 | require_once \PIWIK_INCLUDE_PATH . '/core/Plugin.php'; |
| 35 | require_once \PIWIK_INCLUDE_PATH . '/core/Common.php'; |
| 36 | require_once \PIWIK_INCLUDE_PATH . '/core/Piwik.php'; |
| 37 | require_once \PIWIK_INCLUDE_PATH . '/core/IP.php'; |
| 38 | require_once \PIWIK_INCLUDE_PATH . '/core/UrlHelper.php'; |
| 39 | require_once \PIWIK_INCLUDE_PATH . '/core/Url.php'; |
| 40 | require_once \PIWIK_INCLUDE_PATH . '/core/SettingsPiwik.php'; |
| 41 | require_once \PIWIK_INCLUDE_PATH . '/core/SettingsServer.php'; |
| 42 | require_once \PIWIK_INCLUDE_PATH . '/core/Tracker.php'; |
| 43 | require_once \PIWIK_INCLUDE_PATH . '/core/Config.php'; |
| 44 | require_once \PIWIK_INCLUDE_PATH . '/core/Tracker/Cache.php'; |
| 45 | require_once \PIWIK_INCLUDE_PATH . '/core/Tracker/Request.php'; |
| 46 | require_once \PIWIK_INCLUDE_PATH . '/core/Cookie.php'; |
| 47 | require_once \PIWIK_INCLUDE_PATH . '/core/API/CORSHandler.php'; |
| 48 | SettingsServer::setIsTrackerApiRequest(); |
| 49 | $environment = new \Piwik\Application\Environment('tracker'); |
| 50 | try { |
| 51 | $environment->init(); |
| 52 | } catch (\Piwik\Exception\NotYetInstalledException $e) { |
| 53 | die($e->getMessage()); |
| 54 | } |
| 55 | Tracker::loadTrackerEnvironment(); |
| 56 | $corsHandler = new CORSHandler(); |
| 57 | $corsHandler->handle(); |
| 58 | $tracker = new Tracker(); |
| 59 | $requestSet = new RequestSet(); |
| 60 | \ob_start(); |
| 61 | try { |
| 62 | $handler = Handler\Factory::make(); |
| 63 | $response = $tracker->main($handler, $requestSet); |
| 64 | if (!\is_null($response)) { |
| 65 | echo $response; |
| 66 | } |
| 67 | } catch (\Exception $e) { |
| 68 | echo "Error:" . $e->getMessage(); |
| 69 | exit(1); |
| 70 | } |
| 71 | if (\ob_get_level() > 1) { |
| 72 | \ob_end_flush(); |
| 73 | } |
| 74 | } |
| 75 |