Constants.php 5.62 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

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

24
// Sanatize Classifier
25
26
27
28
const SANATIZE_ALLOW_ALNUMX = "alnumx";
const SANATIZE_ALLOW_DIGIT = "digit";
const SANATIZE_ALLOW_ALL = "all";
const SANATIZE_DEFAULT = SANATIZE_ALLOW_DIGIT;
29

30
31
32
33
34
35
// 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";

36
37
// QFQ Error Codes
const ERROR_UNKNOW_SANATIZE_CLASS = 1001;
38
const ERROR_OPEN_DATABASE = 1002;
39
const ERROR_CODE_SHOULD_NOT_HAPPEN = 1003;
Carsten  Rose's avatar
Carsten Rose committed
40
const ERROR_VALUE_ALREADY_CODPIED = 1004;
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const ERROR_SIP_MALFORMED = 1005;
const ERROR_SIP_INVALID = 1006;
const ERROR_MISSING_FORM_NAME = 1007;
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;
56
57
58
const ERROR_MULTI_SQL_MISSING = 1020;
const ERROR_MISSING_OPEN_DELIMITER = 1021;
const ERROR_RECURSION_TOO_DEEP = 1022;
59

60
61
62
63
64
65
66
67
// 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
//
68
69
const STORE_FORM = "F";  // form, still not saved in database
const STORE_SIP = "S"; // SIP
Carsten  Rose's avatar
Carsten Rose committed
70
const STORE_RECORD = "R"; // selected record from primary table.
71
72
const STORE_PARENT_RECORD = "P"; // on multi forms the recent record of the outer query (multi).
const STORE_TABLE_DEFINITION = "D"; // table definition in database of primary table.
73
const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
74
const STORE_TYPO3 = "T"; // Typo3 > Page content record > bodytext
75
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
76
const STORE_SYSTEM = "Y"; // various system values like db connection credentials
77

78
const USE_STORE_DEFAULT = "FSRD";
79

80
81
82
83
//
// Store: Definitions
//

Carsten  Rose's avatar
Carsten Rose committed
84
// URL variables
85
86
const CLIENT_FORM = 'form';
const CLIENT_SIP = 's';
87
const CLIENT_RECORD_ID = 'r';
88
89
90
91
92
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
93

94
95
96
const CLIENT_GET_SIP = 'getSip';
const CLIENT_POST_SIP = 'postSip';

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// 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
114
// T3 Bodytext Keywords
115
116
117
118
119
120
const TYPO3_FORM = CLIENT_FORM;
const TYPO3_DEBUG_LOAD = 'debugLoad';
const TYPO3_DEBUG_SAVE = 'debugSave';
const TYPO3_FE_USER = 'feUser';
const TYPO3_FE_USER_UID = 'feUserUid';
const TYPO3_FE_USER_GROUP = 'feUserGroup';
121
122
123
124
125
126
127

// System
const SYSTEM_DBUSER = 'DBUSER';
const SYSTEM_DBSERVER = 'DBSERVER';
const SYSTEM_DBPW = 'DBPW';
const SYSTEM_DB = 'DB';
const SYSTEM_TESTDB = 'TESTDB';
128
129
130
const SYSTEM_SESSIONNAME = 'SESSIONNAME';
const SYSTEM_DBH = 'dataBaseHandle';

131
132
133
134
135
136
137
// 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.
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.
Carsten  Rose's avatar
Carsten Rose committed
138
const SYSTEM_SQL_PARAM_ARRAY = 'sqlParamArray'; //  Type: SANATIZE_ALL / Paramter of prepared SQL Statement. Useful for error reporting.
139

140
141
142
143
144
const SIP_SIP = CLIENT_SIP;
const SIP_RECORD_ID = CLIENT_RECORD_ID;
const SIP_FORM = CLIENT_FORM;
const SIP_URLPARAM = 'urlparam';

145
// FORM - copy from table 'form' of processed form
146
//const DEF_FORM_NAME = CLIENT_FORM;
147
148

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