1
|
|
|
<?php |
|
|
|
|
2
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed'); |
3
|
|
|
|
4
|
|
|
define('SPRINT_VERSION', '1.0-beta1'); |
5
|
|
|
|
6
|
|
|
/* |
7
|
|
|
|-------------------------------------------------------------------------- |
8
|
|
|
| Display Debug backtrace |
9
|
|
|
|-------------------------------------------------------------------------- |
10
|
|
|
| |
11
|
|
|
| If set to TRUE, a backtrace will be displayed along with php errors. If |
12
|
|
|
| error_reporting is disabled, the backtrace will not display, regardless |
13
|
|
|
| of this setting |
14
|
|
|
| |
15
|
|
|
*/ |
16
|
|
|
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE); |
17
|
|
|
|
18
|
|
|
/* |
19
|
|
|
|-------------------------------------------------------------------------- |
20
|
|
|
| File and Directory Modes |
21
|
|
|
|-------------------------------------------------------------------------- |
22
|
|
|
| |
23
|
|
|
| These prefs are used when checking and setting modes when working |
24
|
|
|
| with the file system. The defaults are fine on servers with proper |
25
|
|
|
| security, but you may wish (or even need) to change the values in |
26
|
|
|
| certain environments (Apache running a separate process for each |
27
|
|
|
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should |
28
|
|
|
| always be used to set the mode correctly. |
29
|
|
|
| |
30
|
|
|
*/ |
31
|
|
|
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644); |
32
|
|
|
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666); |
33
|
|
|
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755); |
34
|
|
|
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755); |
35
|
|
|
|
36
|
|
|
/* |
37
|
|
|
|-------------------------------------------------------------------------- |
38
|
|
|
| File Stream Modes |
39
|
|
|
|-------------------------------------------------------------------------- |
40
|
|
|
| |
41
|
|
|
| These modes are used when working with fopen()/popen() |
42
|
|
|
| |
43
|
|
|
*/ |
44
|
|
|
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb'); |
45
|
|
|
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b'); |
46
|
|
|
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
47
|
|
|
defined('FOPEN_READ_WRITE_CREATE_DESCTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care |
48
|
|
|
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab'); |
49
|
|
|
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
50
|
|
|
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
51
|
|
|
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
52
|
|
|
|
53
|
|
|
/* |
54
|
|
|
|-------------------------------------------------------------------------- |
55
|
|
|
| Exit Status Codes |
56
|
|
|
|-------------------------------------------------------------------------- |
57
|
|
|
| |
58
|
|
|
| Used to indicate the conditions under which the script is exit()ing. |
59
|
|
|
| While there is no universal standard for error codes, there are some |
60
|
|
|
| broad conventions. Three such conventions are mentioned below, for |
61
|
|
|
| those who wish to make use of them. The CodeIgniter defaults were |
62
|
|
|
| chosen for the least overlap with these conventions, while still |
63
|
|
|
| leaving room for others to be defined in future versions and user |
64
|
|
|
| applications. |
65
|
|
|
| |
66
|
|
|
| The three main conventions used for determining exit status codes |
67
|
|
|
| are as follows: |
68
|
|
|
| |
69
|
|
|
| Standard C/C++ Library (stdlibc): |
70
|
|
|
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html |
71
|
|
|
| (This link also contains other GNU-specific conventions) |
72
|
|
|
| BSD sysexits.h: |
73
|
|
|
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits |
74
|
|
|
| Bash scripting: |
75
|
|
|
| http://tldp.org/LDP/abs/html/exitcodes.html |
76
|
|
|
| |
77
|
|
|
*/ |
78
|
|
|
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors |
79
|
|
|
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error |
80
|
|
|
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error |
81
|
|
|
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found |
82
|
|
|
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class |
83
|
|
|
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member |
84
|
|
|
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input |
85
|
|
|
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error |
86
|
|
|
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code |
87
|
|
|
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code |
88
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.