Constants.php 8.14 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
 */

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

Carsten  Rose's avatar
Carsten Rose committed
11
12
const QFQ_LOG = 'qfq.log';

13
14
const FORM_LOAD = 'form_load';
const FORM_SAVE = 'form_save';
15
16
17
18
19
20
21
22
23
24
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';

const SESSION_FE_USER_UID = 'fe_user_uid';

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

Carsten  Rose's avatar
Carsten Rose committed
26
27
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";
28

29
// Sanatize Classifier
30
31
32
33
const SANATIZE_ALLOW_ALNUMX = "alnumx";
const SANATIZE_ALLOW_DIGIT = "digit";
const SANATIZE_ALLOW_ALL = "all";
const SANATIZE_DEFAULT = SANATIZE_ALLOW_DIGIT;
34

35
36
37
38
39
40
// 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';
41
const WRAP_SETUP_SUBRECORD = 'subrecord';
42
const WRAP_SETUP_IN_FIELDSET = 'inFieldset';
43
44
45
const WRAP_SETUP_START = 'start';
const WRAP_SETUP_END = 'end';

46
47
48
49
50
51
// dbQuerySimple
const ROW_REGULAR = "regular";
const ROW_IMPLODE_ALL = "implode_all";
const ROW_EXACT_1 = "exact_1";
const ROW_EMPTY_IS_OK = "empty_is_ok";

52
// KeyValueParser
53
54
const IF_VALUE_EMPTY_COPY_KEY = 'if_value_empty_copy_key';
const VALUE_GIVEN = 'value_given';
55

56
// BuildForm
57
const SUBRECORD_COLUMN_WIDTH = 20;
58
59
60
const FORM_ELEMENTS_NATIVE = 'native';
const FORM_ELEMENTS_SUBRECORD = 'subrecord';
const FORM_ELEMENTS_NATIVE_SUBRECORD = 'native_subrecord';
61

62
63
// QFQ Error Codes
const ERROR_UNKNOW_SANATIZE_CLASS = 1001;
64
const ERROR_OPEN_DATABASE = 1002;
65
const ERROR_CODE_SHOULD_NOT_HAPPEN = 1003;
Carsten  Rose's avatar
Carsten Rose committed
66
const ERROR_VALUE_ALREADY_CODPIED = 1004;
67
68
const ERROR_SIP_MALFORMED = 1005;
const ERROR_SIP_INVALID = 1006;
69
//const ERROR_MISSING_FORM_NAME = 1007;
70
71
72
73
74
75
76
77
78
79
80
81
const ERROR_IN_SQL_STATEMENT = 1008;
const ERROR_READ_FILE = 1009;
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;
const ERROR_USER_NOT_LOGGED_IN = 1016;
const ERROR_USER_LOGGED_IN = 1017;
const ERROR_FORM_FORBIDDEN = 1018;
const ERROR_FORM_UNKNOWN_PERMISSION_MODE = 1019;
82
83
84
const ERROR_MULTI_SQL_MISSING = 1020;
const ERROR_MISSING_OPEN_DELIMITER = 1021;
const ERROR_RECURSION_TOO_DEEP = 1022;
85
86
const ERROR_UNKNOWN_COLUMN = 1023;
const ERROR_CHECKBOXMODE_UNKNOWN = 1024;
87
const ERROR_MISSING_SQL1 = 1025;
88
89
const ERROR_CHECKBOX_EQUAL = 1026;
const ERROR_MISSING_ITEM_VALUES = 1027;
90
const ERROR_UNKNOWN_FORM_RENDER = 1028;
Carsten  Rose's avatar
Carsten Rose committed
91
const ERROR_NAME_LABEL_EMPTY = 1029;
Carsten  Rose's avatar
Carsten Rose committed
92
93
const ERROR_MISSING_COLUMN_ID = 1030;
const ERROR_DEBUG = 1031;
94
95
96
97
98
99
const ERROR_UNKNOWN_MODE = 1032;
const ERROR_NOT_IMPLEMENTED = 1033;
const ERROR_RESERVED_KEY_NAME = 1034;
const ERROR_VALUE_HAS_NO_KEY = 1035;
const ERROR_DB_EXECUTE = 1036;
const ERROR_COLUMN_NOT_FOUND_IN_TABLE = 1037;
Carsten  Rose's avatar
Carsten Rose committed
100
101
102
103
104
105
106
107
108
109
110
const ERROR_MISSING_HIDDEN_FIELD_IN_SIP = 1038;
const ERROR_KEY_EXIST_IN_STORE = 1039;
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;
111
const ERROR_MISSING_FORMELEMENT = 1049;
112

113

114
115
116
117
118
119
120
121
// DB Errors
//const ERROR_DB_QUERY_SIMPLE = 2000;
const ERROR_DB_GENERIC_CHECK = 2001;
const ERROR_DB_TOO_FEW_ROWS = 2002;
const ERROR_DB_TOO_MANY_ROWS = 2003;
//
// Store Names: Identifier
//
122
123
const STORE_FORM = "F";  // form, still not saved in database
const STORE_SIP = "S"; // SIP
Carsten  Rose's avatar
Carsten Rose committed
124
const STORE_RECORD = "R"; // selected record from primary table.
125
const STORE_PARENT_RECORD = "P"; // on multi forms the recent record of the outer query (multi).
126
127
const STORE_TABLE_DEFAULT = "D"; // definition of primary table.
const STORE_TABLE_COLUMN_TYPES = "M"; // column types of primary table.
128
const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
129
const STORE_TYPO3 = "T"; // Typo3 > Page content record > bodytext
130
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
131
const STORE_SYSTEM = "Y"; // various system values like db connection credentials
132

133
const USE_STORE_DEFAULT = "FSRD";
134

135
//
Carsten  Rose's avatar
Carsten Rose committed
136
// Store: Definitions / Members
137
138
//

Carsten  Rose's avatar
Carsten Rose committed
139
// URL variables
140
141
const CLIENT_FORM = 'form';
const CLIENT_SIP = 's';
142
const CLIENT_RECORD_ID = 'r';
143
144
145
146
147
const CLIENT_KEY_SEM_ID = 'keySemId';
const CLIENT_KEY_SEM_ID_USER = 'keySemIdUser';
const CLIENT_PAGE_ID = 'pageId';
const CLIENT_PAGE_TYPE = 'pageType';
const CLIENT_PAGE_LANGUAGE = 'pageLanguage';
Carsten  Rose's avatar
Carsten Rose committed
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// 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
166
// T3 Bodytext Keywords
167
168
169
const TYPO3_FORM = CLIENT_FORM;
const TYPO3_DEBUG_LOAD = 'debugLoad';
const TYPO3_DEBUG_SAVE = 'debugSave';
170
const TYPO3_DEBUG_SHOW_STACK = 'debugShowStack';
171
172
173
const TYPO3_FE_USER = 'feUser';
const TYPO3_FE_USER_UID = 'feUserUid';
const TYPO3_FE_USER_GROUP = 'feUserGroup';
174
175
176
177
178
179
180

// System
const SYSTEM_DBUSER = 'DBUSER';
const SYSTEM_DBSERVER = 'DBSERVER';
const SYSTEM_DBPW = 'DBPW';
const SYSTEM_DB = 'DB';
const SYSTEM_TESTDB = 'TESTDB';
181
182
const SYSTEM_SESSIONNAME = 'SESSIONNAME';
const SYSTEM_DBH = 'dataBaseHandle';
183
184
185
186
187
188
189
190
// Information for: Log / Debug / Exception
const SYSTEM_SQL_RAW = 'sqlRaw';  // Type: SANATIZE_ALL / String. SQL Query (before substitute). Useful for error reporting.
const SYSTEM_SQL_FINAL = 'sqlFinal'; //  Type: SANATIZE_ALL / String. SQL Query (after substitute). Useful for error reporting.
const SYSTEM_SQL_COUNT = 'sqlCount'; //  Type: SANATIZE_DIGIT / Int.Number of rows in SQL ResultSet. Useful for error reporting.
const SYSTEM_SQL_PARAM_ARRAY = 'sqlParamArray'; //  Type: SANATIZE_ALL / Parameter of prepared SQL Statement. Useful for error reporting.
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>'
191

192
193
194
195
// die folgenden Elemente sind vermutlich nicht noetig, wenn Store Klassen gloable Vars benutzt.
//const SYSTEM_FORM_DEF = 'formDefinition'; // Type: SANATIZE_ALNUMX / AssocArray. Final form to process. Useful for error reporting.
//const SYSTEM_FORM_ELEMENT_DEF = 'formElementDefinition'; // Type: SANATIZE_ALL / AssocArray. Formelement which are processed at the moment. Useful for error reporting.
//const SYSTEM_FORM_ELEMENT_FIELD = 'formElementField'; // Type: SANATIZE_ALNUMX / String. Fieldname of processed Formelement. Useful for error reporting.
196

197
198
199
200
const SIP_SIP = CLIENT_SIP;
const SIP_RECORD_ID = CLIENT_RECORD_ID;
const SIP_FORM = CLIENT_FORM;
const SIP_URLPARAM = 'urlparam';
Carsten  Rose's avatar
Carsten Rose committed
201
// FURTHER: all extracted params from 'urlparam
202

203
// FORM - copy from table 'form' of processed form
204
//const DEF_FORM_NAME = CLIENT_FORM;
205
206

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