-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
133 lines (114 loc) · 2.96 KB
/
index.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
<?php
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*/
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
switch (ENVIRONMENT)
{
case 'development':
error_reporting(-1);
ini_set('display_errors', 1);
break;
case 'testing':
case 'production':
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>='))
{
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
else
{
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}
break;
default:
header('HTTP/1.1 503 Service Unavailable.', true, 503);
echo 'The application environment is not set correctly.';
exit(1); // EXIT_ERROR
}
/**
* Defined DIRECTORY_SEPARATOR constant.
*/
defined('DS') OR define('DS', DIRECTORY_SEPARATOR);
/**
* Define PHP extension
*/
defined('EXT') OR define('EXT', '.php');
/**
* Define Application name and version.
*/
defined('APP_NAME') OR define('APP_NAME', 'CodeIgniter');
defined('APP_VERSION') OR define('APP_VERSION', '0.1.0');
/**
* Site public root.
*/
define('FCPATH', __DIR__.DS);
/**
* The name of this file
*/
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
/**
* Website document root.
*/
define('DOCROOT', realpath(__DIR__.DS.'cibase/').DS);
/**
* The path to CodeIgniter system folder.
*/
define('BASEPATH', realpath(DOCROOT.'core/').DS);
// Name of the "system" directory
define('SYSDIR', basename(BASEPATH));
/**
* The path to CodeIgniter application folder.
*/
define('APPPATH', realpath(DOCROOT.DS.'app/').DS);
/**
* The path to default views folder
*/
define('VIEWPATH', realpath(APPPATH.'views/').DS);
/**
* Path to common modules path.
*/
define('MODPATH', realpath(DOCROOT.'modules/').DS);
/**
* Path to default packages folder.
*/
define('PKGPATH', realpath(DOCROOT.'packages/').DS);
// Set the current directory correctly for CLI requests
if (defined('STDIN'))
{
chdir(dirname(__FILE__));
}
/**
* Add some helpers.
*/
require_once DOCROOT.'vendor/common/common.php';
if (ENVIRONMENT <> 'production')
{
require_once DOCROOT.'vendor/common/print_d.php';
}
/**
* Load the bootstrap file
*/
require_once BASEPATH.'bootstrap.php';