1 | <?php
|
---|
2 | /**
|
---|
3 | * Piwik - Open source web analytics
|
---|
4 | *
|
---|
5 | * @link http://piwik.org
|
---|
6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
---|
7 | * @version $Id: piwik.php 6103 2012-03-23 03:39:35Z matt $
|
---|
8 | *
|
---|
9 | * @package Piwik
|
---|
10 | */
|
---|
11 | $GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
|
---|
12 | $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
|
---|
13 | define('PIWIK_ENABLE_TRACKING', true);
|
---|
14 |
|
---|
15 | define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__)=='/'?'':dirname(__FILE__));
|
---|
16 | if(file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php'))
|
---|
17 | {
|
---|
18 | require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
|
---|
19 | }
|
---|
20 |
|
---|
21 | $GLOBALS['PIWIK_TRACKER_MODE'] = true;
|
---|
22 | error_reporting(E_ALL|E_NOTICE);
|
---|
23 | @ini_set('xdebug.show_exception_trace', 0);
|
---|
24 | @ini_set('magic_quotes_runtime', 0);
|
---|
25 |
|
---|
26 | if(!defined('PIWIK_USER_PATH'))
|
---|
27 | {
|
---|
28 | define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
|
---|
29 | }
|
---|
30 | if(!defined('PIWIK_INCLUDE_PATH'))
|
---|
31 | {
|
---|
32 | define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
|
---|
33 | }
|
---|
34 |
|
---|
35 | @ignore_user_abort(true);
|
---|
36 |
|
---|
37 | require_once PIWIK_INCLUDE_PATH .'/libs/upgradephp/upgrade.php';
|
---|
38 | require_once PIWIK_INCLUDE_PATH .'/libs/Event/Dispatcher.php';
|
---|
39 | require_once PIWIK_INCLUDE_PATH .'/libs/Event/Notification.php';
|
---|
40 | require_once PIWIK_INCLUDE_PATH .'/core/PluginsManager.php';
|
---|
41 | require_once PIWIK_INCLUDE_PATH .'/core/Plugin.php';
|
---|
42 | require_once PIWIK_INCLUDE_PATH .'/core/Common.php';
|
---|
43 | require_once PIWIK_INCLUDE_PATH .'/core/IP.php';
|
---|
44 | require_once PIWIK_INCLUDE_PATH .'/core/Tracker.php';
|
---|
45 | require_once PIWIK_INCLUDE_PATH .'/core/Config.php';
|
---|
46 | require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Db.php';
|
---|
47 | require_once PIWIK_INCLUDE_PATH .'/core/Tracker/IgnoreCookie.php';
|
---|
48 | require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Visit.php';
|
---|
49 | require_once PIWIK_INCLUDE_PATH .'/core/Tracker/GoalManager.php';
|
---|
50 | require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Action.php';
|
---|
51 | require_once PIWIK_INCLUDE_PATH .'/core/CacheFile.php';
|
---|
52 | require_once PIWIK_INCLUDE_PATH .'/core/Cookie.php';
|
---|
53 |
|
---|
54 | session_cache_limiter('nocache');
|
---|
55 | @date_default_timezone_set('UTC');
|
---|
56 |
|
---|
57 | if(!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING)
|
---|
58 | {
|
---|
59 | ob_start();
|
---|
60 | }
|
---|
61 | if($GLOBALS['PIWIK_TRACKER_DEBUG'] === true)
|
---|
62 | {
|
---|
63 | require_once PIWIK_INCLUDE_PATH .'/core/Loader.php';
|
---|
64 | require_once PIWIK_INCLUDE_PATH .'/core/ErrorHandler.php';
|
---|
65 | require_once PIWIK_INCLUDE_PATH .'/core/ExceptionHandler.php';
|
---|
66 | $timer = new Piwik_Timer();
|
---|
67 | set_error_handler('Piwik_ErrorHandler');
|
---|
68 | set_exception_handler('Piwik_ExceptionHandler');
|
---|
69 | printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true));
|
---|
70 | Piwik_Tracker_Db::enableProfiling();
|
---|
71 | Piwik::createConfigObject();
|
---|
72 | Piwik::createLogObject();
|
---|
73 | }
|
---|
74 |
|
---|
75 | if(!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING)
|
---|
76 | {
|
---|
77 | $process = new Piwik_Tracker();
|
---|
78 | try {
|
---|
79 | $process->main();
|
---|
80 | } catch(Exception $e) {
|
---|
81 | echo "Error:" . $e->getMessage();
|
---|
82 | }
|
---|
83 | ob_end_flush();
|
---|
84 | if($GLOBALS['PIWIK_TRACKER_DEBUG'] === true)
|
---|
85 | {
|
---|
86 | printDebug($_COOKIE);
|
---|
87 | printDebug($timer);
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|