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