Anchor the regexp. Thanks Thijs Kinkhorst.
[squirrelmail.git] / include / constants.php
1 <?php
2
3 /**
4 * constants.php
5 *
6 * Loads constants used by the rest of the SquirrelMail source.
7 *
8 * Before 1.5.2 script was stored in functions/constants.php
9 * @copyright &copy; 1999-2009 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @version $Id$
12 * @package squirrelmail
13 * @since 1.2.0
14 */
15
16 /** @ignore */
17
18 /**
19 * SquirrelMail version number -- DO NOT CHANGE
20 * @since 1.5.2
21 */
22 define('SM_VERSION', '1.5.2 [SVN]');
23
24 /**
25 * Year interval for copyright notices in the interface
26 * @since 1.5.2
27 */
28 define('SM_COPYRIGHT', '1999-2009');
29
30 /**************************************************************/
31 /* Set values for constants used by SquirrelMail preferences. */
32 /**************************************************************/
33
34 /**
35 * Define constants for SquirrelMail debug modes.
36 * Note that these are binary so that modes can be
37 * mixed and matched, and they are also ordered from
38 * minor to severe. When adding new modes, please
39 * order them in a sensical way (MODERATE is the 10th
40 * bit; ADVANCED is the 20th bit).
41 * @since 1.5.2
42 */
43 define('SM_DEBUG_MODE_OFF', 0); // complete error suppression
44 define('SM_DEBUG_MODE_SIMPLE', 1); // PHP E_ERROR
45 define('SM_DEBUG_MODE_MODERATE', 512); // PHP E_ALL
46 define('SM_DEBUG_MODE_ADVANCED', 524288); // PHP E_ALL plus log errors intentionally suppressed
47 define('SM_DEBUG_MODE_STRICT', 536870912); // PHP E_STRICT
48
49 /**
50 * Define basic, general purpose preference constants.
51 * @since 1.2.0
52 */
53 define('SMPREF_NO', 0);
54 define('SMPREF_OFF', 0);
55 define('SMPREF_YES', 1);
56 define('SMPREF_ON', 1);
57 define('SMPREF_NONE', 'none');
58
59 /**
60 * Define constants for location based preferences.
61 * @since 1.2.0
62 */
63 define('SMPREF_LOC_TOP', 'top');
64 define('SMPREF_LOC_BETWEEN', 'between');
65 define('SMPREF_LOC_BOTTOM', 'bottom');
66 define('SMPREF_LOC_LEFT', '');
67 define('SMPREF_LOC_RIGHT', 'right');
68
69 /**
70 * Define preferences for folder settings.
71 * @since 1.2.0
72 */
73 define('SMPREF_UNSEEN_NONE', 1);
74 define('SMPREF_UNSEEN_INBOX', 2);
75 define('SMPREF_UNSEEN_ALL', 3);
76 define('SMPREF_UNSEEN_SPECIAL', 4); // Only special folders (since 1.2.5)
77 define('SMPREF_UNSEEN_NORMAL', 5); // Only normal folders (since 1.2.5)
78 define('SMPREF_UNSEEN_ONLY', 1);
79 define('SMPREF_UNSEEN_TOTAL', 2);
80
81 define('SMPREF_MAILBOX_SELECT_LONG', 0);
82 define('SMPREF_MAILBOX_SELECT_INDENTED', 1);
83 define('SMPREF_MAILBOX_SELECT_DELIMITED', 2);
84
85 /**
86 * Define constants for time/date display preferences.
87 * @since 1.2.0
88 */
89 define('SMPREF_TIME_24HR', 1);
90 define('SMPREF_TIME_12HR', 2);
91
92 /**
93 * Define constants for javascript preferences.
94 * @since 1.2.0
95 */
96 define('SMPREF_JS_OFF', 0);
97 define('SMPREF_JS_ON', 1);
98 define('SMPREF_JS_AUTODETECT', 2);
99
100 /**
101 * default value for page_selector_max
102 * @since 1.5.1
103 */
104 define('PG_SEL_MAX', 10);
105
106
107 /**
108 * The number of pages to cache msg headers
109 * @since 1.5.1
110 */
111 define('SQM_MAX_PAGES_IN_CACHE',5);
112
113 /**
114 * The number of mailboxes to cache msg headers
115 * @since 1.5.1
116 */
117 define('SQM_MAX_MBX_IN_CACHE',3);
118
119 /**
120 * Sort constants used for sorting of messages
121 * @since 1.5.1
122 */
123 define('SQSORT_NONE',0);
124 define('SQSORT_DATE_ASC',1);
125 define('SQSORT_DATE_DESC',2);
126 define('SQSORT_FROM_ASC',3);
127 define('SQSORT_FROM_DESC',4);
128 define('SQSORT_SUBJ_ASC',5);
129 define('SQSORT_SUBJ_DESC',6);
130 define('SQSORT_SIZE_ASC',7);
131 define('SQSORT_SIZE_DESC',8);
132 define('SQSORT_TO_ASC',9);
133 define('SQSORT_TO_DESC',10);
134 define('SQSORT_CC_ASC',11);
135 define('SQSORT_CC_DESC',12);
136 define('SQSORT_INT_DATE_ASC',13);
137 define('SQSORT_INT_DATE_DESC',14);
138
139 /**
140 * Special sort constant thread which is added to above sort mode.
141 * By doing a bitwise check ($sort & SQSORT_THREAD) we know if the mailbox
142 * is sorted by thread.
143 * @since 1.5.1
144 */
145 define('SQSORT_THREAD',32);
146
147 /**
148 * Mailbox preference array keys
149 * @since 1.5.1
150 */
151 define('MBX_PREF_SORT',0);
152 define('MBX_PREF_LIMIT',1);
153 define('MBX_PREF_AUTO_EXPUNGE',2);
154 define('MBX_PREF_INTERNALDATE',3);
155 define('MBX_PREF_COLUMNS',4);
156 // define('MBX_PREF_FUTURE',unique integer key);
157
158 /**
159 * Email address array keys
160 * @since 1.5.1
161 */
162 define('SQM_ADDR_PERSONAL', 0);
163 define('SQM_ADDR_ADL', 1);
164 define('SQM_ADDR_MAILBOX', 2);
165 define('SQM_ADDR_HOST', 3);
166
167 /**
168 * Supported columns to show in a messages list
169 * The MBX_PREF_COLUMNS contains an ordered array with these columns
170 * @since 1.5.1
171 */
172 define('SQM_COL_CHECK',0);
173 define('SQM_COL_FROM',1);
174 define('SQM_COL_DATE', 2);
175 define('SQM_COL_SUBJ', 3);
176 define('SQM_COL_FLAGS', 4);
177 define('SQM_COL_SIZE', 5);
178 define('SQM_COL_PRIO', 6);
179 define('SQM_COL_ATTACHMENT', 7);
180 define('SQM_COL_INT_DATE', 8);
181 define('SQM_COL_TO', 9);
182 define('SQM_COL_CC', 10);
183 define('SQM_COL_BCC', 11);
184
185 /**
186 * Address book field list
187 * @since 1.4.16 and 1.5.2
188 */
189 define('SM_ABOOK_FIELD_NICKNAME', 0);
190 define('SM_ABOOK_FIELD_FIRSTNAME', 1);
191 define('SM_ABOOK_FIELD_LASTNAME', 2);
192 define('SM_ABOOK_FIELD_EMAIL', 3);
193 define('SM_ABOOK_FIELD_LABEL', 4);
194
195 /**
196 * Generic variable type constants
197 * @since 1.5.2
198 */
199 define('SQ_TYPE_INT', 'int');
200 define('SQ_TYPE_BIGINT', 'bigint');
201 define('SQ_TYPE_STRING', 'string');
202 define('SQ_TYPE_BOOL', 'bool');
203 define('SQ_TYPE_ARRAY', 'array');
204
205 /**
206 * Template engines supported
207 * @since 1.5.2
208 */
209 define('SQ_PHP_TEMPLATE', 'PHP_');
210 define('SQ_SMARTY_TEMPLATE', 'Smarty_');
211
212 /**
213 * Used by plugins to indicate an incompatibility with a SM version
214 * @since 1.5.2
215 */
216 define('SQ_INCOMPATIBLE', 'INCOMPATIBLE');
217
218 /**
219 * Define constants used in the options code
220 */
221
222 // Define constants for the various option types
223 define('SMOPT_TYPE_STRING', 0);
224 define('SMOPT_TYPE_STRLIST', 1);
225 define('SMOPT_TYPE_TEXTAREA', 2);
226 define('SMOPT_TYPE_INTEGER', 3);
227 define('SMOPT_TYPE_FLOAT', 4);
228 define('SMOPT_TYPE_BOOLEAN', 5);
229 define('SMOPT_TYPE_HIDDEN', 6);
230 define('SMOPT_TYPE_COMMENT', 7);
231 define('SMOPT_TYPE_FLDRLIST', 8);
232 define('SMOPT_TYPE_FLDRLIST_MULTI', 9);
233 define('SMOPT_TYPE_EDIT_LIST', 10);
234 define('SMOPT_TYPE_STRLIST_MULTI', 11);
235 define('SMOPT_TYPE_BOOLEAN_CHECKBOX', 12);
236 define('SMOPT_TYPE_BOOLEAN_RADIO', 13);
237 define('SMOPT_TYPE_STRLIST_RADIO', 14);
238 define('SMOPT_TYPE_SUBMIT', 15);
239 define('SMOPT_TYPE_INFO', 16);
240 define('SMOPT_TYPE_PASSWORD', 17);
241
242 // Define constants for the layout scheme for edit lists
243 define('SMOPT_EDIT_LIST_LAYOUT_LIST', 0);
244 define('SMOPT_EDIT_LIST_LAYOUT_SELECT', 1);
245
246 // Define constants for the options refresh levels
247 define('SMOPT_REFRESH_NONE', 0);
248 define('SMOPT_REFRESH_FOLDERLIST', 1);
249 define('SMOPT_REFRESH_ALL', 2);
250
251 // Define constants for the options size
252 define('SMOPT_SIZE_TINY', 0);
253 define('SMOPT_SIZE_SMALL', 1);
254 define('SMOPT_SIZE_MEDIUM', 2);
255 define('SMOPT_SIZE_LARGE', 3);
256 define('SMOPT_SIZE_HUGE', 4);
257 define('SMOPT_SIZE_NORMAL', 5);
258
259 // Define miscellaneous options constants
260 define('SMOPT_SAVE_DEFAULT', 'save_option');
261 define('SMOPT_SAVE_NOOP', 'save_option_noop');
262
263 // Convenience array of values 'a' through 'z'
264 $a_to_z = array(
265 'a' => 'a',
266 'b' => 'b',
267 'c' => 'c',
268 'd' => 'd',
269 'e' => 'e',
270 'f' => 'f',
271 'g' => 'g',
272 'h' => 'h',
273 'i' => 'i',
274 'j' => 'j',
275 'k' => 'k',
276 'l' => 'l',
277 'm' => 'm',
278 'n' => 'n',
279 'o' => 'o',
280 'p' => 'p',
281 'q' => 'q',
282 'r' => 'r',
283 's' => 's',
284 't' => 't',
285 'u' => 'u',
286 'v' => 'v',
287 'w' => 'w',
288 'x' => 'x',
289 'y' => 'y',
290 'z' => 'z',
291 );