Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
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.

piwik.php 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * Piwik - free/libre analytics platform
  4. *
  5. * @link http://piwik.org
  6. * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
  7. *
  8. * @package Piwik
  9. */
  10. use Piwik\Common;
  11. use Piwik\Timer;
  12. use Piwik\Tracker;
  13. // Note: if you wish to debug the Tracking API please see this documentation:
  14. // http://developer.piwik.org/api-reference/tracking-api#debugging-the-tracker
  15. $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
  16. define('PIWIK_ENABLE_TRACKING', true);
  17. if (!defined('PIWIK_DOCUMENT_ROOT')) {
  18. define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__));
  19. }
  20. if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) {
  21. require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
  22. }
  23. $GLOBALS['PIWIK_TRACKER_MODE'] = true;
  24. error_reporting(E_ALL | E_NOTICE);
  25. @ini_set('xdebug.show_exception_trace', 0);
  26. @ini_set('magic_quotes_runtime', 0);
  27. if (!defined('PIWIK_USER_PATH')) {
  28. define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
  29. }
  30. if (!defined('PIWIK_INCLUDE_PATH')) {
  31. define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
  32. }
  33. @ignore_user_abort(true);
  34. if (file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')) {
  35. $vendorDirectory = PIWIK_INCLUDE_PATH . '/vendor';
  36. } else {
  37. $vendorDirectory = PIWIK_INCLUDE_PATH . '/../..';
  38. }
  39. require_once $vendorDirectory . '/autoload.php';
  40. require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Controller.php';
  41. require_once PIWIK_INCLUDE_PATH . '/core/Plugin/ControllerAdmin.php';
  42. \Piwik\Plugin\ControllerAdmin::disableEacceleratorIfEnabled();
  43. require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
  44. require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
  45. require_once PIWIK_INCLUDE_PATH . '/core/Singleton.php';
  46. require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Manager.php';
  47. require_once PIWIK_INCLUDE_PATH . '/core/Plugin.php';
  48. require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
  49. require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php';
  50. require_once PIWIK_INCLUDE_PATH . '/core/IP.php';
  51. require_once PIWIK_INCLUDE_PATH . '/core/UrlHelper.php';
  52. require_once PIWIK_INCLUDE_PATH . '/core/Url.php';
  53. require_once PIWIK_INCLUDE_PATH . '/core/SettingsPiwik.php';
  54. require_once PIWIK_INCLUDE_PATH . '/core/Tracker.php';
  55. require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
  56. require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
  57. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Cache.php';
  58. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db.php';
  59. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/DbException.php';
  60. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/IgnoreCookie.php';
  61. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/VisitInterface.php';
  62. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Visit.php';
  63. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/GoalManager.php';
  64. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/PageUrl.php';
  65. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/TableLogAction.php';
  66. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Action.php';
  67. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/ActionPageview.php';
  68. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Request.php';
  69. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/VisitExcluded.php';
  70. require_once PIWIK_INCLUDE_PATH . '/core/Tracker/VisitorNotFoundInDb.php';
  71. require_once PIWIK_INCLUDE_PATH . '/core/CacheFile.php';
  72. require_once PIWIK_INCLUDE_PATH . '/core/Filesystem.php';
  73. require_once PIWIK_INCLUDE_PATH . '/core/Cookie.php';
  74. session_cache_limiter('nocache');
  75. @date_default_timezone_set('UTC');
  76. if (!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING) {
  77. ob_start();
  78. }
  79. \Piwik\FrontController::createConfigObject();
  80. $GLOBALS['PIWIK_TRACKER_DEBUG'] = (bool) \Piwik\Config::getInstance()->Tracker['debug'];
  81. if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
  82. require_once PIWIK_INCLUDE_PATH . '/core/Error.php';
  83. \Piwik\Error::setErrorHandler();
  84. require_once PIWIK_INCLUDE_PATH . '/core/ExceptionHandler.php';
  85. \Piwik\ExceptionHandler::setUp();
  86. $timer = new Timer();
  87. Common::printDebug("Debug enabled - Input parameters: ");
  88. Common::printDebug(var_export($_GET, true));
  89. \Piwik\Tracker\Db::enableProfiling();
  90. }
  91. if (!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING) {
  92. $process = new Tracker();
  93. try {
  94. $process->main();
  95. } catch (Exception $e) {
  96. echo "Error:" . $e->getMessage();
  97. exit(1);
  98. }
  99. ob_end_flush();
  100. if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
  101. Common::printDebug($_COOKIE);
  102. Common::printDebug((string)$timer);
  103. }
  104. }