1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: define('CON_EXTENSION_AVAILABLE', 1);
19:
20: define('CON_EXTENSION_UNAVAILABLE', 2);
21:
22: define('CON_EXTENSION_CANTCHECK', 3);
23:
24: 25: 26: 27: 28:
29: function getPHPIniSetting($setting) {
30:
31: $value = @ini_get($setting);
32:
33: return $value;
34: }
35:
36: 37: 38:
39: function canPHPurlfopen() {
40: return getPHPIniSetting('allow_url_fopen');
41: }
42:
43: 44: 45: 46: 47: 48: 49: 50:
51: function checkPHPiniget() {
52: $value = @ini_get('y2k_compliance');
53:
54: if ($value === NULL) {
55: return false;
56: } else {
57: return true;
58: }
59: }
60:
61: function getPHPDisplayErrorSetting() {
62: return getPHPIniSetting('display_errors');
63: }
64:
65: function getPHPFileUploadSetting() {
66: return getPHPIniSetting('file_uploads');
67: }
68:
69: function getPHPGPCOrder() {
70: return getPHPIniSetting('gpc_order');
71: }
72:
73: function getPHPMagicQuotesGPC() {
74: return getPHPIniSetting('magic_quotes_gpc');
75: }
76:
77: function getPHPMagicQuotesRuntime() {
78: return getPHPIniSetting('magic_quotes_runtime');
79: }
80:
81:
82: function getPHPMagicQuotesSybase() {
83: return getPHPIniSetting('magic_quotes_sybase');
84: }
85:
86: function getPHPMaxExecutionTime() {
87: return getPHPIniSetting('max_execution_time');
88: }
89:
90: function getPHPOpenBasedirSetting() {
91: return getPHPIniSetting('open_basedir');
92: }
93:
94: function getPHPMaxPostSize() {
95: return getPHPIniSetting('post_max_size');
96: }
97:
98: function checkPHPSQLSafeMode() {
99: return getPHPIniSetting('sql.safe_mode');
100: }
101:
102: function checkPHPUploadMaxFilesize() {
103: return getPHPIniSetting('upload_max_filesize');
104: }
105:
106: function getAsBytes($val) {
107: if (strlen($val) == 0) {
108: return 0;
109: }
110: $val = trim($val);
111: $last = $val{strlen($val) - 1};
112: switch ($last) {
113: case 'k':
114: case 'K':
115: return (int) $val * 1024;
116: break;
117: case 'm':
118: case 'M':
119: return (int) $val * 1048576;
120: break;
121: default:
122: return $val;
123: }
124: }
125:
126: function isPHPExtensionLoaded($extension) {
127: $value = extension_loaded($extension);
128:
129: if ($value === NULL) {
130: return CON_EXTENSION_CANTCHECK;
131: }
132:
133: if ($value === true) {
134: return CON_EXTENSION_AVAILABLE;
135: }
136:
137: if ($value === false) {
138: return CON_EXTENSION_UNAVAILABLE;
139: }
140: }
141:
142: function isRegisterLongArraysActive() {
143: if (getPHPIniSetting('register_long_arrays') == false) {
144: return false;
145: }
146:
147: return true;
148: }
149:
150: 151: 152: 153:
154: function isPHPCompatible() {
155: if (version_compare(PHP_VERSION, CON_SETUP_MIN_PHP_VERSION, '>=') == true) {
156: return true;
157: } else {
158: return false;
159: }
160: }
161:
162: ?>