Constants.php 10.3 KB
Newer Older
1
2
3
4
5
6
7
8
<?php
/**
 * Created by PhpStorm.
 * User: crose
 * Date: 1/1/16
 * Time: 8:35 PM
 */

9
const EXT_KEY = 'qfq';
10
const CONFIG_INI = "config.ini";  // QFQ configuration file: db access
Carsten  Rose's avatar
Carsten Rose committed
11

12
13
14
const GFX_INFO = 'typo3conf/ext/qfq/Resources/Public/icons/note.gif';
const API_DIR = 'typo3conf/ext/qfq/qfq/api/';

Carsten  Rose's avatar
Carsten Rose committed
15
16
const QFQ_LOG = 'qfq.log';

17
18
const SESSION_LIFETIME_SECONDS = 86400;

19
20
const FORM_LOAD = 'form_load';
const FORM_SAVE = 'form_save';
21
22
23
24
25
26
const FORM_PERMISSION_SIP = 'sip';
const FORM_PERMISSION_LOGGED_IN = 'logged_id';
const FORM_PERMISSION_LOGGED_OUT = 'logged_out';
const FORM_PERMISSION_ALWAYS = 'always';
const FORM_PERMISSION_NEVER = 'never';

27
28
29
30
const FORM_FORWARD_MODE_NO = 'no';
const FORM_FORWARD_MODE_AUTO = 'auto';
const FORM_FORWARD_MODE_PAGE = 'page';

31
32
33
34
const SESSION_FE_USER_UID = 'fe_user_uid';

const RETURN_URL = 'return_url';
const RETURN_SIP = 'return_sip';
35

Carsten  Rose's avatar
Carsten Rose committed
36
37
const SQL_FORM_ELEMENT_SPECIFIC_CONTAINER = "SELECT *, ? AS 'nestedInFieldSet' FROM FormElement AS fe WHERE fe.formId = ? AND fe.deleted = 'no' AND FIND_IN_SET(fe.class, ? ) AND fe.feIdContainer = ? AND fe.enabled='yes' ORDER BY fe.ord, fe.id";
const SQL_FORM_ELEMENT_ALL_CONTAINER = "SELECT *, ? AS 'nestedInFieldSet' FROM FormElement AS fe WHERE fe.formId = ? AND fe.deleted = 'no' AND FIND_IN_SET(fe.class, ? ) AND fe.enabled='yes' ORDER BY fe.ord, fe.id";
38

Carsten  Rose's avatar
Carsten Rose committed
39
40
41
42
43
// SANITIZE Classifier
const SANITIZE_ALLOW_ALNUMX = "alnumx";
const SANITIZE_ALLOW_DIGIT = "digit";
const SANITIZE_ALLOW_ALL = "all";
const SANITIZE_DEFAULT = SANITIZE_ALLOW_DIGIT;
44

45
46
47
48
49
50
// Index wrap setup table
const WRAP_SETUP_TITLE = 'title';
const WRAP_SETUP_ELEMENT = 'element';
const WRAP_SETUP_LABEL = 'label';
const WRAP_SETUP_INPUT = 'input';
const WRAP_SETUP_NOTE = 'note';
51
const WRAP_SETUP_SUBRECORD = 'subrecord';
52
const WRAP_SETUP_IN_FIELDSET = 'inFieldset';
53
54
55
const WRAP_SETUP_START = 'start';
const WRAP_SETUP_END = 'end';

56
57
58
// dbQuerySimple
const ROW_REGULAR = "regular";
const ROW_IMPLODE_ALL = "implode_all";
59
60
61
62
const ROW_EXPECT_0 = "expect_0";
const ROW_EXPECT_1 = "expect_1";
const ROW_EXPECT_0_1 = "expect_0_1";
const ROW_EXPECT_GE_1 = "expect_ge_1";
63
const ROW_KEYS = "keys";
64

65
// KeyValueParser
66
67
const KVP_IF_VALUE_EMPTY_COPY_KEY = 'if_value_empty_copy_key';
const KVP_VALUE_GIVEN = 'value_given';
68

69
// BuildForm
70
const SUBRECORD_COLUMN_WIDTH = 20;
71
72
73
const FORM_ELEMENTS_NATIVE = 'native';
const FORM_ELEMENTS_SUBRECORD = 'subrecord';
const FORM_ELEMENTS_NATIVE_SUBRECORD = 'native_subrecord';
74

75
// QFQ Error Codes
Carsten  Rose's avatar
Carsten Rose committed
76
const ERROR_UNKNOW_SANITIZE_CLASS = 1001;
77

78
const ERROR_CODE_SHOULD_NOT_HAPPEN = 1003;
79
80
const ERROR_SIP_MALFORMED = 1005;
const ERROR_SIP_INVALID = 1006;
81
//const ERROR_MISSING_FORM_NAME = 1007;
82
83
84
85
86
87
88
const ERROR_IN_SQL_STATEMENT = 1008;
const ERROR_MISSING_SESSIONNAME = 1010;
const ERROR_BROKEN_PARAMETER = 1011;
const ERROR_FE_USER_UID_CHANGED = 1012;
const ERROR_SIP_NOT_FOUND = 1013;
const ERROR_SIP_NOT_ALLOWED_AS_PARAM = 1014;
const ERROR_SIP_NEEDED_FOR_THIS_FORM = 1015;
Carsten  Rose's avatar
Carsten Rose committed
89
90
91
92
93
94
95
96
const ERROR_SIP_EXIST_BUT_OTHER_PARAM_GIVEN_BY_CLIENT = 1016;
const ERROR_USER_NOT_LOGGED_IN = 1017;
const ERROR_USER_LOGGED_IN = 1018;
const ERROR_FORM_FORBIDDEN = 1019;
const ERROR_FORM_UNKNOWN_PERMISSION_MODE = 10120;
const ERROR_MULTI_SQL_MISSING = 1021;
const ERROR_MISSING_OPEN_DELIMITER = 1022;
const ERROR_RECURSION_TOO_DEEP = 1023;
97
const ERROR_CHECKBOXMODE_UNKNOWN = 1024;
98
const ERROR_MISSING_SQL1 = 1025;
99
100
const ERROR_CHECKBOX_EQUAL = 1026;
const ERROR_MISSING_ITEM_VALUES = 1027;
101
const ERROR_UNKNOWN_FORM_RENDER = 1028;
Carsten  Rose's avatar
Carsten Rose committed
102
const ERROR_NAME_LABEL_EMPTY = 1029;
Carsten  Rose's avatar
Carsten Rose committed
103
const ERROR_DEBUG = 1031;
104
105
106
const ERROR_UNKNOWN_MODE = 1032;
const ERROR_NOT_IMPLEMENTED = 1033;
const ERROR_RESERVED_KEY_NAME = 1034;
107
const ERROR_UNKNOWN_FORWARD_MODE = 1036;
Carsten  Rose's avatar
Carsten Rose committed
108
109
110
111
112
113
114
115
116
117
const ERROR_MISSING_HIDDEN_FIELD_IN_SIP = 1038;
const ERROR_MISSING_MIN_MAX = 1040;
const ERROR_MIN_MAX_VIOLATION = 1041;
const ERROR_UNKNOWN_CHECKTYPE = 1042;
const ERROR_PATTERN_VIOLATION = 1043;
const ERROR_RECORDID_0_FORBIDDEN = 1044;
const ERROR_LOG_NOT_WRITABLE = 1045;
const ERROR_UNNOWN_STORE = 1046;
const ERROR_GET_STORE_ZERO = 1047;
const ERROR_SET_STORE_ZERO = 1048;
118
const ERROR_MISSING_FORMELEMENT = 1049;
119
const ERROR_INVALID_OR_MISSING_PARAMETER = 1050;
120
const ERROR_UNKNOWN_SQL_LOG_MODE = 1051;
121

122
123
124
// Store
const ERROR_STORE_VALUE_ALREADY_CODPIED = 1100;
const ERROR_STORE_KEY_EXIST = 1101;
125

126
127
128
129
130
// I/O Error
const ERROR_IO_READ_FILE = 1200;
const ERROR_IO_WRITE = 1203;
const ERROR_IO_OPEN = 1204;

131
132
// KeyValueParser
const ERROR_KVP_VALUE_HAS_NO_KEY = 1900;
133

134
// DB Errors
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const ERROR_DB_OPEN = 2000;
const ERROR_DB_EXECUTE = 2001;
const ERROR_DB_PREPARE = 2002;
const ERROR_DB_BIND = 2003;
const ERROR_DB_QUERY = 2004;
const ERROR_DB_GENERIC_CHECK = 2005;
const ERROR_DB_TOO_FEW_ROWS = 2006;
const ERROR_DB_TOO_MANY_ROWS = 2007;
const ERROR_DB_COUNT_DO_NOT_MATCH = 2008;
const ERROR_DB_CLOSE_MYSQLI_RESULT = 2009;
const ERROR_DB_CLOSE_MYSQLI_STMT = 2010;
const ERROR_DB_UNKNOWN_COLUMN = 2011;
const ERROR_DB_MISSING_COLUMN_ID = 2012;
const ERROR_DB_COLUMN_NOT_FOUND_IN_TABLE = 2013;
149
150
151
//
// Store Names: Identifier
//
152
153
const STORE_FORM = "F";  // form, still not saved in database
const STORE_SIP = "S"; // SIP
Carsten  Rose's avatar
Carsten Rose committed
154
const STORE_RECORD = "R"; // selected record from primary table.
155
const STORE_PARENT_RECORD = "P"; // on multi forms the recent record of the outer query (multi).
156
157
const STORE_TABLE_DEFAULT = "D"; // definition of primary table.
const STORE_TABLE_COLUMN_TYPES = "M"; // column types of primary table.
158
const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
159
const STORE_TYPO3 = "T"; // Typo3 > Page content record > bodytext
160
const STORE_ZERO = "0"; // value: 0, might helpfull if variable is empty but used in an SQL statement, which might produce a SQL error otherwise if substituted with an empty string
Carsten  Rose's avatar
Carsten Rose committed
161
const STORE_SYSTEM = "Y"; // various system values like db connection credentials
162

163
const STORE_USE_DEFAULT = "FSRD";
164

165
//
Carsten  Rose's avatar
Carsten Rose committed
166
// Store: Definitions / Members
167
168
//

Carsten  Rose's avatar
Carsten Rose committed
169
// URL variables
170
171
const CLIENT_FORM = 'form';
const CLIENT_SIP = 's';
172
const CLIENT_RECORD_ID = 'r';
173
174
const CLIENT_KEY_SEM_ID = 'keySemId';
const CLIENT_KEY_SEM_ID_USER = 'keySemIdUser';
175
176
177
const CLIENT_PAGE_ID = 'id';
const CLIENT_PAGE_TYPE = 'type';
const CLIENT_PAGE_LANGUAGE = 'L';
Carsten  Rose's avatar
Carsten Rose committed
178

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// ALL $_SERVER variables: http://php.net/manual/en/reserved.variables.server.php
// The following exist and might be the most used ones.
const CLIENT_SCRIPT_URL = 'SCRIPT_URL';
const CLIENT_SCRIPT_URI = 'SCRIPT_URI';
const CLIENT_HTTP_HOST = 'HTTP_HOST';
const CLIENT_HTTP_USER_AGENT = 'HTTP_USER_AGENT';
const CLIENT_SERVER_NAME = 'SERVER_NAME';
const CLIENT_SERVER_ADDRESS = 'SERVER_ADDRESS';
const CLIENT_SERVER_PORT = 'SERVER_PORT';
const CLIENT_REMOTE_ADDRESS = 'REMOTE_ADDRESS';
const CLIENT_REQUEST_SCHEME = 'REQUEST_SCHEME';
const CLIENT_SCRIPT_FILENAME = 'SCRIPT_FILENAME';
const CLIENT_QUERY_STRING = 'QUERY_STRING';
const CLIENT_REQUEST_URI = 'REQUEST_URI';
const CLIENT_SCRIPT_NAME = 'SCRIPT_NAME';
const CLIENT_PHP_SELF = 'PHP_SELF';

Carsten  Rose's avatar
Carsten Rose committed
196
// T3 Bodytext Keywords
197
198
199
const TYPO3_FORM = CLIENT_FORM;
const TYPO3_DEBUG_LOAD = 'debugLoad';
const TYPO3_DEBUG_SAVE = 'debugSave';
200
const TYPO3_DEBUG_SHOW_STACK = 'debugShowStack';
201
202
203
const TYPO3_FE_USER = 'feUser';
const TYPO3_FE_USER_UID = 'feUserUid';
const TYPO3_FE_USER_GROUP = 'feUserGroup';
204
const TYPO3_TT_CONTENT_UID = 'ttcontentUid';
205
const TYPO3_PAGE_ID = 'typo3PageId';
206

207
// System
208
209
210
211
212
213
214
215
const SYSTEM_DB_USER = 'DB_USER';
const SYSTEM_DB_SERVER = 'DB_SERVER';
const SYSTEM_DB_PASSWORD = 'DB_PASSWORD';
const SYSTEM_DB_NAME = 'DB_NAME';
const SYSTEM_DB_NAME_TEST = 'DB_NAME_TEST';
const SYSTEM_SESSION_NAME = 'SESSION_NAME';
const SYSTEM_SQL_LOG = 'SQL_LOG'; //  Logging to file
const SYSTEM_SQL_LOG_MODE = 'SQL_LOG_MODE'; // Mode, which statements to log.
216
217
218
219
220

const SYSTEM_SHOW_DEBUG_INFO = 'SHOW_DEBUG_INFO';
const SYSTEM_CSS_LINK_CLASS_INTERNAL = 'CSS_LINK_CLASS_INTERNAL';
const SYSTEM_CSS_LINK_CLASS_EXTERNAL = 'CSS_LINK_CLASS_EXTERNAL';

221
222
223
// computed automatically during runtime
const SYSTEM_PATH_EXT = 'EXT_PATH';

224
// Information for: Log / Debug / Exception
Carsten  Rose's avatar
Carsten Rose committed
225
226
227
228
const SYSTEM_SQL_RAW = 'sqlRaw';  // Type: SANITIZE_ALL / String. SQL Query (before substitute). Useful for error reporting.
const SYSTEM_SQL_FINAL = 'sqlFinal'; //  Type: SANITIZE_ALL / String. SQL Query (after substitute). Useful for error reporting.
const SYSTEM_SQL_COUNT = 'sqlCount'; //  Type: SANITIZE_DIGIT / Int.Number of rows in SQL ResultSet. Useful for error reporting.
const SYSTEM_SQL_PARAM_ARRAY = 'sqlParamArray'; //  Type: SANITIZE_ALL / Parameter of prepared SQL Statement. Useful for error reporting.
229
230
231
const SYSTEM_FORM = CLIENT_FORM;                        // '<formName> / <formId>'
const SYSTEM_FORM_ELEMENT = 'formElement';              // '<formElementName> / <formElementeId>'
const SYSTEM_FORM_ELEMENT_COLUMN = 'formElementColumn'; // '<columnname of current processed formElement>'
232
const SYSTEM_FORM_ELEMENT_MESSAGE = 'formElementMessage'; // '<columnname of current processed formElement>'
233

234
// die folgenden Elemente sind vermutlich nicht noetig, wenn Store Klassen gloable Vars benutzt.
Carsten  Rose's avatar
Carsten Rose committed
235
236
237
//const SYSTEM_FORM_DEF = 'formDefinition'; // Type: SANITIZE_ALNUMX / AssocArray. Final form to process. Useful for error reporting.
//const SYSTEM_FORM_ELEMENT_DEF = 'formElementDefinition'; // Type: SANITIZE_ALL / AssocArray. Formelement which are processed at the moment. Useful for error reporting.
//const SYSTEM_FORM_ELEMENT_FIELD = 'formElementField'; // Type: SANITIZE_ALNUMX / String. Fieldname of processed Formelement. Useful for error reporting.
238

239
240
const SIP_SIP = CLIENT_SIP;  // s
const SIP_RECORD_ID = CLIENT_RECORD_ID; // r
241
const SIP_FORM = CLIENT_FORM;
242
const SIP_TABLE = 'table'; // delete a record from 'table'
243
const SIP_URLPARAM = 'urlparam';
Carsten  Rose's avatar
Carsten Rose committed
244
// FURTHER: all extracted params from 'urlparam
245

246
// FORM - copy from table 'form' of processed form
247
//const DEF_FORM_NAME = CLIENT_FORM;
248
249

// FORMELEMENT - copy of all formElements of processed form
250
//const DEF_FORM_ELEMENT_ID = 'id';
251

252
253
254
255
// SQL logging Modes
const SQL_LOG_MODE_ALL = 'all';
const SQL_LOG_MODE_MODIFY = 'modify';

256
257
258
259
260
261
262
263
264
265
266
267
268
// api/save.php, api/delete.php
const API_STATUS = 'status';
const API_MESSAGE = 'message';
const API_REDIRECT = 'redirect';
const API_REDIRECT_URL = 'redirect-url';
const API_FIELD_NAME = 'field-name';
const API_FIELD_MESSAGE = 'field-message';

const API_ANSWER_STATUS_SUCCESS = 'success';
const API_ANSWER_STATUS_ERROR = 'error';
const API_ANSWER_REDIRECT_CLIENT = 'client';
const API_ANSWER_REDIRECT_NO = 'no';
const API_ANSWER_REDIRECT_URL = 'url';
269

270
// FORM
271
272
const SYMBOL_NEW = 'new';
const SYMBOL_EDIT = 'edit';
273
274
275
276

//CHECKBOX
const CHECKBOX_VALUE_CHECKED = 'checked';
const CHECKBOX_VALUE_UNCHECKED = 'unchecked';