Ticket #8776: func.php

File func.php, 2.8 KB (added by Slavon, 6 years ago)

http://tostopby.tumblr.com/

Line 
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;
13define('PIWIK_ENABLE_TRACKING', true);
14
15define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__)=='/'?'':dirname(__FILE__));
16if(file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php'))
17{
18    require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php';
19}
20
21$GLOBALS['PIWIK_TRACKER_MODE'] = true;
22error_reporting(E_ALL|E_NOTICE);
23@ini_set('xdebug.show_exception_trace', 0);
24@ini_set('magic_quotes_runtime', 0);
25
26if(!defined('PIWIK_USER_PATH'))
27{
28    define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
29}
30if(!defined('PIWIK_INCLUDE_PATH'))
31{
32    define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
33}
34
35@ignore_user_abort(true);
36
37require_once PIWIK_INCLUDE_PATH .'/libs/upgradephp/upgrade.php';
38require_once PIWIK_INCLUDE_PATH .'/libs/Event/Dispatcher.php';
39require_once PIWIK_INCLUDE_PATH .'/libs/Event/Notification.php';
40require_once PIWIK_INCLUDE_PATH .'/core/PluginsManager.php';
41require_once PIWIK_INCLUDE_PATH .'/core/Plugin.php';
42require_once PIWIK_INCLUDE_PATH .'/core/Common.php';
43require_once PIWIK_INCLUDE_PATH .'/core/IP.php';
44require_once PIWIK_INCLUDE_PATH .'/core/Tracker.php';
45require_once PIWIK_INCLUDE_PATH .'/core/Config.php';
46require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Db.php';
47require_once PIWIK_INCLUDE_PATH .'/core/Tracker/IgnoreCookie.php';
48require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Visit.php';
49require_once PIWIK_INCLUDE_PATH .'/core/Tracker/GoalManager.php';
50require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Action.php';
51require_once PIWIK_INCLUDE_PATH .'/core/CacheFile.php';
52require_once PIWIK_INCLUDE_PATH .'/core/Cookie.php';
53
54session_cache_limiter('nocache');
55@date_default_timezone_set('UTC');
56
57if(!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING)
58{
59    ob_start();
60}
61if($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
75if(!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