forked from eventum/eventum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
149 lines (120 loc) · 4.38 KB
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
if (!file_exists(__DIR__ . '/config/config.php') || !filesize(__DIR__ . '/config/config.php')) {
header('Location: setup/');
exit(0);
}
// setup change some PHP settings
ini_set('memory_limit', '512M');
// prevent session from messing up the browser cache
ini_set('session.cache_limiter', 'nocache');
define('APP_URL', 'https://github.com/eventum/eventum');
define('APP_VERSION', '3.1.3-dev');
// define base path
define('APP_PATH', __DIR__);
$define = function ($name, $value) {
if (defined($name)) {
return;
}
define($name, $value);
};
$define('APP_CONFIG_PATH', APP_PATH . '/config');
// include local site config. may override any default
require_once APP_CONFIG_PATH . '/config.php';
/**
* Path for local overrides:
* APP_LOCAL_PATH/crm
* APP_LOCAL_PATH/custom_field
* APP_LOCAL_PATH/include
* APP_LOCAL_PATH/partner
* APP_LOCAL_PATH/templates
* APP_LOCAL_PATH/workflow
*/
$define('APP_LOCAL_PATH', APP_CONFIG_PATH);
$define('APP_COOKIE', 'eventum');
// /var path for writable data
$define('APP_VAR_PATH', APP_PATH . '/var');
// define other paths
$define('APP_SETUP_FILE', APP_CONFIG_PATH . '/setup.php');
$define('APP_INC_PATH', APP_PATH . '/lib/eventum');
$define('APP_TPL_PATH', APP_PATH . '/templates');
$define('APP_TPL_COMPILE_PATH', APP_VAR_PATH . '/cache');
$define('APP_LOCKS_PATH', APP_VAR_PATH . '/lock');
$define('APP_LOG_PATH', APP_VAR_PATH . '/log');
$define('APP_ERROR_LOG', APP_LOG_PATH . '/errors.log');
// define the user_id of system user
$define('APP_SYSTEM_USER_ID', 1);
// email address of anonymous user.
// if you want anonymous users getting access to your eventum.
$define('APP_ANON_USER', '');
// if full text searching is enabled
$define('APP_ENABLE_FULLTEXT', false);
$define('APP_FULLTEXT_SEARCH_CLASS', 'MySQL_Fulltext_Search');
$define('APP_AUTH_BACKEND', 'Mysql_Auth_Backend');
$define('APP_AUTH_BACKEND_ALLOW_FALLBACK', false);
$define('APP_DEFAULT_ASSIGNED_EMAILS', 1);
$define('APP_DEFAULT_NEW_EMAILS', 0);
$define('APP_DEFAULT_COPY_OF_OWN_ACTION', 0);
$define('APP_RELATIVE_URL', '/');
$define('APP_COOKIE_URL', APP_RELATIVE_URL);
$define('APP_COOKIE_DOMAIN', null);
$define('APP_DEFAULT_LOCALE', 'en_US');
$define('APP_CHARSET', 'UTF-8');
$define('APP_DEFAULT_TIMEZONE', 'UTC');
$define('APP_DEFAULT_WEEKDAY', 0);
if (!defined('APP_EMAIL_ENCODING')) {
if (APP_CHARSET == 'UTF-8') {
define('APP_EMAIL_ENCODING', '8bit');
} else {
define('APP_EMAIL_ENCODING', '7bit');
}
}
// Number of failed attempts before Back-Off locking kicks in.
// If set to false do not use Back-Off locking.
$define('APP_FAILED_LOGIN_BACKOFF_COUNT', false);
// How many minutes to lock account for during Back-Off
$define('APP_FAILED_LOGIN_BACKOFF_MINUTES', 15);
$define('APP_HIDE_CLOSED_STATS_COOKIE', 'eventum_hide_closed_stats');
// if set, normal calls to eventum are redirected to a maintenance page while
// requests to /manage/ still work
$define('APP_MAINTENANCE', false);
require_once APP_PATH . '/autoload.php';
Misc::stripInput($_POST);
// set default timezone
date_default_timezone_set(APP_DEFAULT_TIMEZONE);
Eventum\Monolog\Logger::initialize();
Language::setup();
// set charset
header('Content-Type: text/html; charset=' . APP_CHARSET);
// display maintenance message if requested.
if (APP_MAINTENANCE) {
$is_manage = (strpos($_SERVER['PHP_SELF'], '/manage/') !== false);
if (APP_MAINTENANCE && !$is_manage) {
$tpl = new Template_Helper();
$tpl->setTemplate("maintenance.tpl.html");
$tpl->displayTemplate();
exit(0);
}
}
// Default IRC category
$define("APP_EVENTUM_IRC_CATEGORY_DEFAULT", "default");
$define("APP_EVENTUM_IRC_CATEGORY_REMINDER", APP_EVENTUM_IRC_CATEGORY_DEFAULT);
// legacy constants, enable this block if you need time to migrate custom workflow, custom_field, customer, etc classes
/*
if (!defined('APP_DEFAULT_DB') || !defined('APP_TABLE_PREFIX')) {
$dbconfig = DB_Helper::getConfig();
$define('APP_DEFAULT_DB', $dbconfig['database']);
$define('APP_TABLE_PREFIX', $dbconfig['table_prefix']);
unset($dbconfig);
}
*/
Eventum\DebugBar::initialize();