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