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