Added more wrapper, commented out another noisy debug line
[mailer.git] / inc / callback-functions.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 07/08/2011 *
4  * ===================                          Last change: 07/08/2011 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : callback-functions.php                           *
8  * -------------------------------------------------------------------- *
9  * Short description : Call-back functions for XML templates            *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Call-Back-Funktionen fuer XML-Templates          *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Handles the XML node 'admin-entry-meta-data'
44 function doXmlAdminEntryMetaData ($resource, $attributes) {
45         // There should be no attributes
46         if (count($attributes) > 0) {
47                 // Please don't add any attributes to foo-list nodes
48                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
49         } // END - if
50 }
51
52 // Handles the XML node 'callback-function'
53 function doXmlCallbackFunction ($resource, $attributes) {
54         // There are two attributes, by default
55         if (count($attributes) != 2) {
56                 // Not the right count
57                 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
58         } elseif (!isset($attributes['TYPE'])) {
59                 // 'TYPE' not found
60                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
61         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
62                 // No valid type
63                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
64         } elseif (!isset($attributes['VALUE'])) {
65                 // 'VALUE' not found
66                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
67         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
68                 // Not valid/verifyable
69                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
70         }
71
72         // Add the function name and no attributes by default
73         $GLOBALS['__XML_CALLBACKS']['callbacks'][] = __FUNCTION__;
74         $GLOBALS['__XML_CALLBACKS']['functions'][__FUNCTION__][] = $attributes['VALUE'];
75         $GLOBALS['__XML_ARGUMENTS'][__FUNCTION__] = array();
76         $GLOBALS['__COLUMN_INDEX'][__FUNCTION__] = 'column';
77 }
78
79 // Handles the XML node 'database-table'
80 function doXmlDatabaseTable ($resource, $attributes) {
81         // There are three attributes, by default
82         if (count($attributes) != 3) {
83                 // Not the right count
84                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
85         } elseif (!isset($attributes['NAME'])) {
86                 // 'NAME' not found
87                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
88         } elseif (!isset($attributes['TYPE'])) {
89                 // 'TYPE' not found
90                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
91         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
92                 // No valid type
93                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
94         } elseif (!isset($attributes['VALUE'])) {
95                 // 'VALUE' not found
96                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
97         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
98                 // Not valid/verifyable
99                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
100         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
101                 // doXmlCallbackFunction is missing
102                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
103         }
104
105         // Add the entry to the list
106         addXmlValueToCallbackAttributes('database_table', $attributes);
107 }
108
109 // Handles the XML node 'database-column-list'
110 function doXmlDatabaseColumnList ($resource, $attributes) {
111         // There should be no attributes
112         if (count($attributes) > 0) {
113                 // Please don't add any attributes to foo-list nodes
114                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
115         } // END - if
116
117         // Add an empty list
118         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'] = array();
119 }
120
121 // Handles the XML node 'database-column-list-entry'
122 function doXmlDatabaseColumnListEntry ($resource, $attributes) {
123         // There are three attributes, by default
124         if (count($attributes) != 6) {
125                 // Not the right count
126                 reportBug(__FUNCTION__, __LINE__, 'Expected 6 attributes, got ' . count($attributes));
127         } elseif (!isset($attributes['NAME'])) {
128                 // 'NAME' not found
129                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
130         } elseif (!isset($attributes['TYPE'])) {
131                 // 'TYPE' not found
132                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
133         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
134                 // No valid type
135                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
136         } elseif (!isset($attributes['TABLE'])) {
137                 // 'TABLE' not found
138                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
139         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE'])) {
140                 // Not valid/verifyable
141                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TYPE=' . $attributes['TYPE'] . ',TABLE=' . $attributes['TABLE']);
142         } elseif (!isset($attributes['ALIAS'])) {
143                 // 'ALIAS' not found
144                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
145         } elseif (!isset($attributes['FUNCTION'])) {
146                 // 'FUNCTION' not found
147                 reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
148         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
149                 // 'ALIAS' not valid/verifyable
150                 reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
151         } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
152                 // 'FUNCTION' not valid/verifyable
153                 reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
154         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'])) {
155                 // doXmlCallbackFunction is missing
156                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/database-column-list not included around this node. Please fix your XML.');
157         }
158
159         // Add the entry to the list
160         addXmlValueToCallbackAttributes('column_list', $attributes);
161 }
162
163 // Handles the XML node 'callback-function-list'
164 function doXmlCallbackFunctionList ($resource, $attributes) {
165         // There should be no attributes
166         if (count($attributes) > 0) {
167                 // Please don't add any attributes to foo-list nodes
168                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
169         } // END - if
170
171         // Add an empty list
172         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array();
173 }
174
175 // Handles the XML node 'callback-function-list-entry'
176 function doXmlCallbackFunctionListEntry ($resource, $attributes) {
177         // There are three attributes, by default
178         if (count($attributes) != 3) {
179                 // Not the right count
180                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
181         } elseif (!isset($attributes['NAME'])) {
182                 // 'NAME' not found
183                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
184         } elseif (!isset($attributes['TYPE'])) {
185                 // 'TYPE' not found
186                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
187         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
188                 // No valid type
189                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
190         } elseif (!isset($attributes['VALUE'])) {
191                 // 'VALUE' not found
192                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
193         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
194                 // Not valid/verifyable
195                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
196         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'])) {
197                 // doXmlCallbackFunction is missing
198                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/callback-function-list not included around this node. Please fix your XML.');
199         }
200
201         // Add the entry to the list
202         addXmlValueToCallbackAttributes('callback_list', $attributes);
203 }
204
205 // Handles the XML node 'extra-parameter-list'
206 function doXmlExtraParameterList ($resource, $attributes) {
207         // There should be no attributes
208         if (count($attributes) > 0) {
209                 // Please don't add any attributes to foo-list nodes
210                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
211         } // END - if
212
213         // Add an empty list
214         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array();
215 }
216
217 // Handles the XML node 'extra-parameter-list-entry'
218 function doXmlExtraParameterListEntry ($resource, $attributes) {
219         // There are three attributes, by default
220         if (count($attributes) != 3) {
221                 // Not the right count
222                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
223         } elseif (!isset($attributes['NAME'])) {
224                 // 'NAME' not found
225                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
226         } elseif (!isset($attributes['TYPE'])) {
227                 // 'TYPE' not found
228                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
229         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
230                 // No valid type
231                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
232         } elseif (!isset($attributes['VALUE'])) {
233                 // 'VALUE' not found
234                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
235         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
236                 // Not valid/verifyable
237                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
238         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'])) {
239                 // doXmlCallbackFunction is missing
240                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
241         }
242
243         // Add the entry to the list
244         addXmlValueToCallbackAttributes('extra_list', $attributes);
245 }
246
247 // Handles the XML node 'time-columns-list'
248 function doXmlTimeColumnsList ($resource, $attributes) {
249         // There should be no attributes
250         if (count($attributes) > 0) {
251                 // Please don't add any attributes to foo-list nodes
252                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
253         } // END - if
254
255         // Add an empty list
256         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['time_columns'] = array();
257 }
258
259 // Handles the XML node 'time-columns-list-entry'
260 function doXmlTimeColumnsListEntry ($resource, $attributes) {
261         // There are three attributes, by default
262         if (count($attributes) != 3) {
263                 // Not the right count
264                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
265         } elseif (!isset($attributes['NAME'])) {
266                 // 'NAME' not found
267                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
268         } elseif (!isset($attributes['TYPE'])) {
269                 // 'TYPE' not found
270                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
271         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
272                 // No valid type
273                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
274         } elseif (!isset($attributes['VALUE'])) {
275                 // 'VALUE' not found
276                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
277         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
278                 // Not valid/verifyable
279                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
280         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['time_columns'])) {
281                 // doXmlCallbackFunction is missing
282                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
283         }
284
285         // Add the entry to the list
286         addXmlValueToCallbackAttributes('time_columns', $attributes);
287 }
288
289 // Handles the XML node 'extra-parameter-member-list'
290 function doXmlExtraParameterMemberList ($resource, $attributes) {
291         // There should be no attributes
292         if (count($attributes) > 0) {
293                 // Please don't add any attributes to foo-list nodes
294                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
295         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
296                 // This list should be created already
297                 reportBug(__FUNCTION__, __LINE__, 'member_list should be already created.');
298         }
299 }
300
301 // Handles the XML node 'extra-parameter-reload-list'
302 function doXmlExtraParameterReloadList ($resource, $attributes) {
303         // There should be no attributes
304         if (count($attributes) > 0) {
305                 // Please don't add any attributes to foo-list nodes
306                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
307         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['reload_list'])) {
308                 // This list should be created already
309                 reportBug(__FUNCTION__, __LINE__, 'reload_list should be already created.');
310         }
311 }
312
313 // Handles the XML node 'extra-parameter-member-list-entry'
314 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
315         // There are three attributes, by default
316         if (count($attributes) != 3) {
317                 // Not the right count
318                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
319         } elseif (!isset($attributes['NAME'])) {
320                 // 'NAME' not found
321                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
322         } elseif (!isset($attributes['TYPE'])) {
323                 // 'TYPE' not found
324                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
325         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
326                 // No valid type
327                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
328         } elseif (!isset($attributes['VALUE'])) {
329                 // 'VALUE' not found
330                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
331         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
332                 // Not valid/verifyable
333                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
334         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
335                 // doXmlCallbackFunction is missing
336                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
337         }
338
339         // Add the entry to the list
340         addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
341 }
342
343 // Handles the XML node 'extra-parameter-reload-list-entry'
344 function doXmlExtraParameterReloadListEntry ($resource, $attributes) {
345         // There are three attributes, by default
346         if (count($attributes) != 3) {
347                 // Not the right count
348                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
349         } elseif (!isset($attributes['NAME'])) {
350                 // 'NAME' not found
351                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
352         } elseif (!isset($attributes['TYPE'])) {
353                 // 'TYPE' not found
354                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
355         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
356                 // No valid type
357                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
358         } elseif (!isset($attributes['VALUE'])) {
359                 // 'VALUE' not found
360                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
361         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
362                 // Not valid/verifyable
363                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
364         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['reload_list'])) {
365                 // doXmlCallbackFunction is missing
366                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/reload-list not included around this node. Please fix your XML.');
367         }
368
369         // Add the entry to the list
370         addXmlValueToCallbackAttributes('extra_list', $attributes, 'reload_list');
371 }
372
373 // Handles the XML node 'extra-parameter-added-list'
374 function doXmlExtraParameterAddedList ($resource, $attributes) {
375         // There should be no attributes
376         if (count($attributes) > 0) {
377                 // Please don't add any attributes to foo-list nodes
378                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
379         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
380                 // This list should be created already
381                 reportBug(__FUNCTION__, __LINE__, 'added_list should be already created.');
382         }
383 }
384
385 // Handles the XML node 'extra-parameter-added-list-entry'
386 function doXmlExtraParameterAddedListEntry ($resource, $attributes) {
387         // There are three attributes, by default
388         if (count($attributes) != 3) {
389                 // Not the right count
390                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
391         } elseif (!isset($attributes['NAME'])) {
392                 // 'NAME' not found
393                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
394         } elseif (!isset($attributes['TYPE'])) {
395                 // 'TYPE' not found
396                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
397         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
398                 // No valid type
399                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
400         } elseif (!isset($attributes['VALUE'])) {
401                 // 'VALUE' not found
402                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
403         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
404                 // Not valid/verifyable
405                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
406         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
407                 // doXmlCallbackFunction is missing
408                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/added-list not included around this node. Please fix your XML.');
409         }
410
411         // Add the entry to the list
412         addXmlValueToCallbackAttributes('extra_list', $attributes, 'added_list');
413 }
414
415 // Handles the XML node 'extra-parameter-created-list'
416 function doXmlExtraParameterCreatedList ($resource, $attributes) {
417         // There should be no attributes
418         if (count($attributes) > 0) {
419                 // Please don't add any attributes to foo-list nodes
420                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
421         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['created_list'])) {
422                 // This list should be created already
423                 reportBug(__FUNCTION__, __LINE__, 'created_list should be already created.');
424         }
425 }
426
427 // Handles the XML node 'extra-parameter-created-list-entry'
428 function doXmlExtraParameterCreatedListEntry ($resource, $attributes) {
429         // There are three attributes, by default
430         if (count($attributes) != 3) {
431                 // Not the right count
432                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
433         } elseif (!isset($attributes['NAME'])) {
434                 // 'NAME' not found
435                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
436         } elseif (!isset($attributes['TYPE'])) {
437                 // 'TYPE' not found
438                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
439         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
440                 // No valid type
441                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
442         } elseif (!isset($attributes['VALUE'])) {
443                 // 'VALUE' not found
444                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
445         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
446                 // Not valid/verifyable
447                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
448         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['created_list'])) {
449                 // doXmlCallbackFunction is missing
450                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/created-list not included around this node. Please fix your XML.');
451         }
452
453         // Add the entry to the list
454         addXmlValueToCallbackAttributes('extra_list', $attributes, 'created_list');
455 }
456
457 // Handles the XML node 'status-change-column'
458 function doXmlStatusChangeColumn ($resource, $attributes) {
459         // There are three attributes, by default
460         if (count($attributes) != 3) {
461                 // Not the right count
462                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
463         } elseif (!isset($attributes['NAME'])) {
464                 // 'NAME' not found
465                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
466         } elseif (!isset($attributes['TYPE'])) {
467                 // 'TYPE' not found
468                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
469         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
470                 // No valid type
471                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
472         } elseif (!isset($attributes['VALUE'])) {
473                 // 'VALUE' not found
474                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
475         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
476                 // Not valid/verifyable
477                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
478         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
479                 // doXmlCallbackFunction is missing
480                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
481         }
482
483         // Add the entry to the list
484         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
485 }
486
487 // Handles the XML node 'status-change-list'
488 function doXmlStatusChangeList ($resource, $attributes) {
489         // There should be no attributes
490         if (count($attributes) > 0) {
491                 // Please don't add any attributes to foo-list nodes
492                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
493         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
494                 // doXmlCallbackFunction is missing
495                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.');
496         }
497 }
498
499 // Handles the XML node 'status-change-list-entry'
500 function doXmlStatusChangeListEntry ($resource, $attributes) {
501         // There are for attributes, by default
502         if (count($attributes) != 4) {
503                 // Not the right count
504                 reportBug(__FUNCTION__, __LINE__, 'Expected 4 attributes, got ' . count($attributes));
505         } elseif (!isset($attributes['NAME'])) {
506                 // 'NAME' not found
507                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
508         } elseif (!isset($attributes['TYPE'])) {
509                 // 'TYPE' not found
510                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
511         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
512                 // No valid type
513                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
514         } elseif (!isset($attributes['VALUE'])) {
515                 // 'VALUE' not found
516                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
517         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['OLD'])) {
518                 // Not valid/verifyable
519                 reportBug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
520         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
521                 // Not valid/verifyable
522                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
523         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
524                 // doXmlCallbackFunction is missing
525                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/change-list not included around this node. Please fix your XML.');
526         }
527
528         // Add the entry to the list
529         addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
530 }
531
532 // Handles the XML node 'enable-modify-entries'
533 function doXmlEnableModifyEntries ($resource, $attributes) {
534         // There are three attributes, by default
535         if (count($attributes) != 3) {
536                 // Not the right count
537                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
538         } elseif (!isset($attributes['NAME'])) {
539                 // 'NAME' not found
540                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
541         } elseif (!isset($attributes['TYPE'])) {
542                 // 'TYPE' not found
543                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
544         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
545                 // No valid type
546                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
547         } elseif (!isset($attributes['VALUE'])) {
548                 // 'VALUE' not found
549                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
550         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
551                 // Not valid/verifyable
552                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
553         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
554                 // doXmlCallbackFunction is missing
555                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
556         }
557
558         // Add the entry to the list
559         addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
560 }
561
562 // Handles the XML node 'table-id-column'
563 function doXmlTableIdColumn ($resource, $attributes) {
564         // There are three attributes, by default
565         if (count($attributes) != 3) {
566                 // Not the right count
567                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
568         } elseif (!isset($attributes['NAME'])) {
569                 // 'NAME' not found
570                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
571         } elseif (!isset($attributes['TYPE'])) {
572                 // 'TYPE' not found
573                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
574         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
575                 // No valid type
576                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
577         } elseif (!isset($attributes['VALUE'])) {
578                 // 'VALUE' not found
579                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
580         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
581                 // Not valid/verifyable
582                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
583         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
584                 // doXmlCallbackFunction is missing
585                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
586         }
587
588         // Add the entry to the array
589         addXmlValueToCallbackAttributes('table_id_column', $attributes);
590 }
591
592 // Handles the XML node 'table-userid-column'
593 function doXmlTableUseridColumn ($resource, $attributes) {
594         // There are three attributes, by default
595         if (count($attributes) != 3) {
596                 // Not the right count
597                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
598         } elseif (!isset($attributes['NAME'])) {
599                 // 'NAME' not found
600                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
601         } elseif (!isset($attributes['TYPE'])) {
602                 // 'TYPE' not found
603                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
604         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
605                 // No valid type
606                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
607         } elseif (!isset($attributes['VALUE'])) {
608                 // 'VALUE' not found
609                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
610         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
611                 // Not valid/verifyable
612                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
613         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
614                 // doXmlCallbackFunction is missing
615                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
616         }
617
618         // Add the entry to the array
619         addXmlValueToCallbackAttributes('table_userid_column', $attributes);
620 }
621
622 // Handles the XML node 'raw-userid-column-key'
623 function doXmlRawUseridColumnKey ($resource, $attributes) {
624         // There are three attributes, by default
625         if (count($attributes) != 3) {
626                 // Not the right count
627                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
628         } elseif (!isset($attributes['NAME'])) {
629                 // 'NAME' not found
630                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
631         } elseif (!isset($attributes['TYPE'])) {
632                 // 'TYPE' not found
633                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
634         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
635                 // No valid type
636                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
637         } elseif (!isset($attributes['VALUE'])) {
638                 // 'VALUE' not found
639                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
640         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
641                 // Not valid/verifyable
642                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
643         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
644                 // doXmlCallbackFunction is missing
645                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
646         }
647
648         // Add the entry to the array
649         addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes);
650 }
651
652 // Handles the XML node 'cache-file'
653 function doXmlCacheFile ($resource, $attributes) {
654         // There are three attributes, by default
655         if (count($attributes) != 3) {
656                 // Not the right count
657                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
658         } elseif (!isset($attributes['NAME'])) {
659                 // 'NAME' not found
660                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
661         } elseif (!isset($attributes['TYPE'])) {
662                 // 'TYPE' not found
663                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
664         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
665                 // No valid type
666                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
667         } elseif (!isset($attributes['VALUE'])) {
668                 // 'VALUE' not found
669                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
670         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
671                 // Not valid/verifyable
672                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
673         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
674                 // doXmlCallbackFunction is missing
675                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
676         }
677
678         // Add the entry to the array
679         addXmlValueToCallbackAttributes('cache_file', $attributes);
680 }
681
682 //-----------------------------------------------------------------------------
683 //           Call-back functions for listing of data in admin area
684 //-----------------------------------------------------------------------------
685
686 // Handles the XML node 'admin-list-data'
687 function doXmlAdminListData ($resource, $attributes) {
688         // There should be no attributes
689         if (count($attributes) > 0) {
690                 // Please don't add any attributes to foo-list nodes
691                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
692         } // END - if
693 }
694
695 // Handles the XML node 'data-tables'
696 function doXmlDataTables ($resource, $attributes) {
697         // There should be no attributes
698         if (count($attributes) > 0) {
699                 // Please don't add any attributes to foo-list nodes
700                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
701         } // END - if
702 }
703
704 // Handles the XML node 'data-table'
705 function doXmlDataTable ($resource, $attributes) {
706         // There are three attributes, by default
707         if (count($attributes) != 3) {
708                 // Not the right count
709                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
710         } elseif (!isset($attributes['VALUE'])) {
711                 // 'VALUE' not found
712                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
713         } elseif (!isset($attributes['TYPE'])) {
714                 // 'TYPE' not found
715                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
716         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
717                 // No valid type
718                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
719         } elseif (!isset($attributes['ALIAS'])) {
720                 // 'ALIAS' not found
721                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
722         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
723                 // Not valid/verifyable
724                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
725         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
726                 // Not valid/verifyable
727                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
728         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
729                 // doXmlCallbackFunction is missing
730                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
731         }
732
733         // Add the entry to the array
734         addXmlValueToCallbackAttributes('data_table', $attributes);
735 }
736
737 // Handles the XML node 'select-data-from-list'
738 function doXmlSelectDataFromList ($resource, $attributes) {
739         // There should be no attributes
740         if (count($attributes) > 0) {
741                 // Please don't add any attributes to foo-list nodes
742                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
743         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
744                 // doXmlCallbackFunction is missing
745                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
746         }
747
748         // Add an empty list
749         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
750 }
751
752 // Handles the XML node 'select-data-from-list-entry'
753 function doXmlSelectDataFromListEntry ($resource, $attributes) {
754         // There are five attributes, by default
755         if (count($attributes) != 5) {
756                 // Not the right count
757                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
758         } elseif (!isset($attributes['VALUE'])) {
759                 // 'VALUE' not found
760                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
761         } elseif (!isset($attributes['TYPE'])) {
762                 // 'TYPE' not found
763                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
764         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
765                 // No valid type
766                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
767         } elseif (!isset($attributes['ALIAS'])) {
768                 // 'ALIAS' not found
769                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
770         } elseif (!isset($attributes['FUNCTION'])) {
771                 // 'FUNCTION' not found
772                 reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
773         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
774                 // 'VALUE' not valid/verifyable
775                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
776         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
777                 // 'ALIAS' not valid/verifyable
778                 reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
779         } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
780                 // 'FUNCTION' not valid/verifyable
781                 reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
782         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
783                 // doXmlCallbackFunction is missing
784                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
785         }
786
787         // Add the entry to the array
788         addXmlValueToCallbackAttributes('data_column_list', $attributes);
789 }
790
791 // Handles the XML node 'where-select-from-list'
792 function doXmlWhereSelectFromList ($resource, $attributes) {
793         // There should be no attributes
794         if (count($attributes) > 0) {
795                 // Please don't add any attributes to foo-list nodes
796                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
797         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
798                 // doXmlCallbackFunction is missing
799                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
800         }
801
802         // Add an empty list
803         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
804 }
805
806 // Handles the XML node 'where-select-from-list-entry'
807 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
808         // There are five attributes, by default
809         if (count($attributes) != 5) {
810                 // Not the right count
811                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
812         } elseif (!isset($attributes['TYPE'])) {
813                 // 'TYPE' not found
814                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
815         } elseif (!isset($attributes['TABLE'])) {
816                 // 'TABLE' not found
817                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
818         } elseif (!isset($attributes['VALUE'])) {
819                 // 'VALUE' not found
820                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
821         } elseif (!isset($attributes['CONDITION'])) {
822                 // 'CONDITION' not found
823                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
824         } elseif (!isset($attributes['LOOK-FOR'])) {
825                 // 'LOOK-FOR' not found
826                 reportBug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
827         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
828                 // No valid type
829                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
830         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
831                 // 'TABLE' not valid/verifyable
832                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
833         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
834                 // 'VALUE' not valid/verifyable
835                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
836         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
837                 // 'CONDITION' not valid/verifyable
838                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
839         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['LOOK-FOR'])) {
840                 // 'LOOK-FOR' not valid/verifyable
841                 reportBug(__FUNCTION__, __LINE__, 'Attribute LOOK-FOR does not validate. LOOK-FOR=' . $attributes['LOOK-FOR']);
842         } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
843                 // 'CONDITION' is not known
844                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. LOOK-FOR=' . $attributes['CONDITION']);
845         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
846                 // doXmlCallbackFunction is missing
847                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
848         }
849
850         // Add the entry to the array
851         addXmlValueToCallbackAttributes('where_select_list', $attributes);
852 }
853
854 // Handles the XML node 'where-condition'
855 function doXmlWhereCondition ($resource, $attributes) {
856         // There are two attributes, by default
857         if (count($attributes) != 3) {
858                 // Please don't add any attributes to foo-list nodes
859                 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes because this is a where-condition node, got ' . count($attributes));
860         } elseif (!isset($attributes['TYPE'])) {
861                 // 'TYPE' not found
862                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
863         } elseif (!isset($attributes['CONDITION'])) {
864                 // 'CONDITION' not found
865                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
866         } elseif (!isset($attributes['NAME'])) {
867                 // 'NAME' not found
868                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
869         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
870                 // doXmlCallbackFunction is missing
871                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
872         }
873
874         // Add an empty list
875         addXmlValueToCallbackAttributes('where_condition', $attributes);
876 }
877
878 // Handles the XML node 'order-by-list'
879 function doXmlOrderByList ($resource, $attributes) {
880         // There should be no attributes
881         if (count($attributes) > 0) {
882                 // Please don't add any attributes to foo-list nodes
883                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
884         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
885                 // doXmlCallbackFunction is missing
886                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
887         }
888
889         // Add an empty list
890         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
891 }
892
893 // Handles the XML node 'order-by-list-entry'
894 function doXmlOrderByListEntry ($resource, $attributes) {
895         // There are four attributes, by default
896         if (count($attributes) != 4) {
897                 // Not the right count
898                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
899         } elseif (!isset($attributes['ORDER'])) {
900                 // 'ORDER' not found
901                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
902         } elseif (!isset($attributes['TYPE'])) {
903                 // 'TYPE' not found
904                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
905         } elseif (!isset($attributes['TABLE'])) {
906                 // 'TABLE' not found
907                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
908         } elseif (!isset($attributes['VALUE'])) {
909                 // 'VALUE' not found
910                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
911         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
912                 // No valid type
913                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
914         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
915                 // 'ORDER' not valid/verifyable
916                 reportBug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
917         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
918                 // 'TABLE' not valid/verifyable
919                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
920         } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
921                 // 'VALUE' not valid/verifyable
922                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
923         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
924                 // doXmlCallbackFunction is missing
925                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
926         }
927
928         // Add the entry to the array
929         addXmlValueToCallbackAttributes('order_by_list', $attributes);
930 }
931
932 // Handles the XML node 'list-template'
933 function doXmlListTemplate ($resource, $attributes) {
934         // There are two attributes, by default
935         if (count($attributes) != 2) {
936                 // Not the right count
937                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
938         } elseif (!isset($attributes['VALUE'])) {
939                 // 'VALUE' not found
940                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
941         } elseif (!isset($attributes['TYPE'])) {
942                 // 'TYPE' not found
943                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
944         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
945                 // No valid type
946                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
947         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
948                 // Not valid/verifyable
949                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
950         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
951                 // doXmlCallbackFunction is missing
952                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
953         }
954
955         // Add the entry to the array
956         addXmlValueToCallbackAttributes('list_template', $attributes);
957 }
958
959 // Handles the XML node 'list-row-template'
960 function doXmlListRowTemplate ($resource, $attributes) {
961         // There are two attributes, by default
962         if (count($attributes) != 2) {
963                 // Not the right count
964                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
965         } elseif (!isset($attributes['VALUE'])) {
966                 // 'VALUE' not found
967                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
968         } elseif (!isset($attributes['TYPE'])) {
969                 // 'TYPE' not found
970                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
971         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
972                 // No valid type
973                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
974         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
975                 // Not valid/verifyable
976                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
977         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
978                 // doXmlCallbackFunction is missing
979                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
980         }
981
982         // Add the entry to the array
983         addXmlValueToCallbackAttributes('list_row_template', $attributes);
984 }
985
986 // Handles the XML node 'column-callback-list'
987 function doXmlColumnCallbackList ($resource, $attributes) {
988         // There should be no attributes
989         if (count($attributes) > 0) {
990                 // Please don't add any attributes to foo-list nodes
991                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
992         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
993                 // doXmlCallbackFunction is missing
994                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
995         }
996
997         // Add an empty list
998         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
999 }
1000
1001 // Handles the XML node 'column-callback-list-entry'
1002 function doXmlColumnCallbackListEntry ($resource, $attributes) {
1003         // There should be no attributes
1004         if (count($attributes) > 0) {
1005                 // Please don't add any attributes to foo-list nodes
1006                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1007         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1008                 // doXmlCallbackFunction is missing
1009                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
1010         }
1011 }
1012
1013 // Handles the XML node 'column-callback-data'
1014 function doXmlColumnCallbackData ($resource, $attributes) {
1015         // There are three attributes, by default
1016         if (count($attributes) != 3) {
1017                 // Not the right count
1018                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1019         } elseif (!isset($attributes['VALUE'])) {
1020                 // 'VALUE' not found
1021                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1022         } elseif (!isset($attributes['TYPE'])) {
1023                 // 'TYPE' not found
1024                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1025         } elseif (!isset($attributes['CALLBACK'])) {
1026                 // 'CALLBACK' not found
1027                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
1028         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1029                 // No valid type
1030                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1031         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1032                 // Not valid/verifyable
1033                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1034         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1035                 // doXmlCallbackFunction is missing
1036                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1037         } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
1038                 // 'CALLBACK' not valid/verifyable
1039                 reportBug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
1040         }
1041
1042         // Add the entry to the array
1043         addXmlValueToCallbackAttributes('column_callback_list', $attributes);
1044 }
1045
1046 // Handles the XML node 'callback-extra-parameter-list'
1047 function doXmlCallbackExtraParameterList ($resource, $attributes) {
1048         // There should be no attributes
1049         if (count($attributes) > 0) {
1050                 // Please don't add any attributes to foo-list nodes
1051                 reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
1052         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1053                 // doXmlCallbackFunction is missing
1054                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
1055         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1056                 // Abort silently here, no one wants to kill this array
1057                 return;
1058         }
1059
1060         // Add an empty list
1061         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
1062 }
1063
1064 // Handles the XML node 'callback-extra-parameter-list-entry'
1065 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
1066         // There are three attributes, by default
1067         if (count($attributes) != 3) {
1068                 // Not the right count
1069                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1070         } elseif (!isset($attributes['COLUMN'])) {
1071                 // 'COLUMN' not found
1072                 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
1073         } elseif (!isset($attributes['TYPE'])) {
1074                 // 'TYPE' not found
1075                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1076         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1077                 // No valid type
1078                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1079         } elseif (!isset($attributes['VALUE'])) {
1080                 // 'VALUE' not found
1081                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1082         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1083                 // 'VALUE' not valid/verifyable
1084                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1085         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1086                 // doXmlCallbackFunction is missing
1087                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
1088         }
1089
1090         // Add the entry to the array
1091         addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
1092 }
1093
1094 // Handles the XML node 'no-entry-found-message'
1095 function doXmlNoEntryFoundMessage ($resource, $attributes) {
1096         // There are two attributes, by default
1097         if (count($attributes) != 2) {
1098                 // Not the right count
1099                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1100         } elseif (!isset($attributes['VALUE'])) {
1101                 // 'VALUE' not found
1102                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1103         } elseif (!isset($attributes['TYPE'])) {
1104                 // 'TYPE' not found
1105                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1106         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1107                 // No valid type
1108                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1109         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1110                 // Not valid/verifyable
1111                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1112         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1113                 // doXmlCallbackFunction is missing
1114                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1115         }
1116
1117         // Add the entry to the array
1118         addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
1119 }
1120
1121 //-----------------------------------------------------------------------------
1122 //                              XML type validation
1123 //-----------------------------------------------------------------------------
1124
1125 // Checks for string without any added extra data
1126 function isXmlTypeString ($value) {
1127         // Just let SQL_ESCAPE() do the job
1128         return ($value == SQL_ESCAPE($value));
1129 }
1130
1131 // Fake-check for array type
1132 function isXmlTypeArray ($value) {
1133         // This value is always a string
1134         return (is_string($value));
1135 }
1136
1137 // Check for boolean type
1138 function isXmlTypeBool ($value) {
1139         // Trim value
1140         $value = trim($value);
1141
1142         // This value is always a string
1143         return (($value == 'true') || ($value == 'false'));
1144 }
1145
1146 // Check for integer type
1147 function isXmlTypeInt ($value) {
1148         // Trim value
1149         $value = trim($value);
1150
1151         // This value is always a string
1152         return (bigintval($value) == $value);
1153 }
1154
1155 // Check for callback type
1156 function isXmlTypeCallback ($value) {
1157         // Trim value
1158         $value = trim($value);
1159
1160         // This value is always a string
1161         return (function_exists($value));
1162 }
1163
1164 //-----------------------------------------------------------------------------
1165 //                               Private XML functions
1166 //-----------------------------------------------------------------------------
1167
1168 // Adds given attribut to element
1169 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
1170         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
1171         // Is it boolean type?
1172         if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
1173                 // Then convert VALUE
1174                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!');
1175                 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
1176         } elseif ($attributes['TYPE'] == 'callback') {
1177                 // It is a simple call-back type
1178                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!');
1179                 $attributes['VALUE'] = call_user_func($attributes['VALUE']);
1180         }
1181
1182         // What do we need to add?
1183         if ($attributes['TYPE'] == 'array') {
1184                 // Another nested array
1185                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element);
1186                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
1187         } elseif (!empty($extraKey)) {
1188                 // Sub-array (one level only)
1189                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
1190                 if (trim($attributes['NAME']) == '') {
1191                         // Numerical index
1192                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1193                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE'];
1194                 } elseif (!empty($key)) {
1195                         // Use from $key
1196                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
1197                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
1198                 } else {
1199                         // Use from NAME
1200                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
1201                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
1202                 }
1203         } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
1204                 /*
1205                  * ALIAS and FUNCTION detected? This may happen with SQL queries
1206                  * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
1207                  */
1208
1209                 // Fix missing 'NAME'
1210                 if (!isset($attributes['NAME'])) {
1211                         $attributes['NAME'] = '';
1212                 } // END - if
1213
1214                 // Init array
1215                 $array =  array(
1216                         'column'   => trim($attributes['VALUE']),
1217                         'alias'    => trim($attributes['ALIAS']),
1218                         'function' => trim($attributes['FUNCTION']),
1219                         'table'    => trim($attributes['TABLE']),
1220                         'name'     => trim($attributes['NAME'])
1221                 );
1222
1223                 // Add the entry
1224                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS'] . ',FUNCTION[' . gettype($attributes['FUNCTION']) . ']=' . $attributes['FUNCTION'] . ' - FUNCTION! (VALUE=' . $attributes['VALUE'] . ')');
1225                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1226         } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
1227                 // CONDITION/LOOK-FOR detected
1228                 // Init array
1229                 $array =  array(
1230                         'column'    => trim($attributes['VALUE']),
1231                         'table'     => trim($attributes['TABLE']),
1232                         'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1233                         'look_for'  => trim($attributes['LOOK-FOR'])
1234                 );
1235
1236                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ',LOOK-FOR[' . gettype($attributes['LOOK-FOR']) . ']=' . $attributes['LOOK-FOR'] . ' - CONDITION! (VALUE=' . $attributes['VALUE'] . ')');
1237                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1238         } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['NAME']))) {
1239                 // CONDITION/NAME detected
1240                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - CONDITION!');
1241                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['CONDITION'];
1242         } elseif (isset($attributes['CALLBACK'])) {
1243                 // CALLBACK/VALUE detected
1244                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1245                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1246         } elseif (isset($attributes['ORDER'])) {
1247                 // ORDER/TABLE detected
1248                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1249                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1250         } elseif (isset($attributes['COLUMN'])) {
1251                 // COLUMN/VALUE detected
1252                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
1253                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE'];
1254         } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) {
1255                 // Numerical index
1256                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1257                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE'];
1258         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1259                 // Already created
1260                 reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
1261         } else {
1262                 // Use from NAME
1263                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1264                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1265         }
1266         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1267 }
1268
1269 //-----------------------------------------------------------------------------
1270 //                            Execute call-back functions
1271 //-----------------------------------------------------------------------------
1272
1273 // Execute function for doXmlCallbackFunction()
1274 function doXmlCallbackFunctionExecute ($callbackName, $args, $columnIndex) {
1275         // Is 'id_index' set and form sent?
1276         if ((isset($args['id_index'])) && (isFormSent())) {
1277                 // Prepare 'id_index'
1278                 $args['id_index'] = postRequestElement($args['id_index']);
1279         } // END - if
1280
1281         // Just call it
1282         //* DEBUG: */ die('callbackFunction=' . $callbackName . ',columnIndex=' . $columnIndex . ',args=<pre>'.print_r($args, true).'</pre>');
1283         call_user_func_array($callbackName, $args);
1284 }
1285
1286 // [EOF]
1287 ?>