Rewrote 'we' word a little, rewrote mail order to use SQL_INSERTID() instead of anoth...
[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-member-list-entry'
323 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
324         // There are three attributes, by default
325         if (count($attributes) != 3) {
326                 // Not the right count
327                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
328         } elseif (!isset($attributes['NAME'])) {
329                 // 'NAME' not found
330                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
331         } elseif (!isset($attributes['TYPE'])) {
332                 // 'TYPE' not found
333                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
334         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
335                 // No valid type
336                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
337         } elseif (!isset($attributes['VALUE'])) {
338                 // 'VALUE' not found
339                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
340         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
341                 // Not valid/verifyable
342                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
343         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
344                 // doXmlCallbackFunction is missing
345                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
346         }
347
348         // Add the entry to the list
349         addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
350 }
351
352 // Handles the XML node 'extra-parameter-reload-list-entry'
353 function doXmlExtraParameterReloadListEntry ($resource, $attributes) {
354         // There are three attributes, by default
355         if (count($attributes) != 3) {
356                 // Not the right count
357                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
358         } elseif (!isset($attributes['NAME'])) {
359                 // 'NAME' not found
360                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
361         } elseif (!isset($attributes['TYPE'])) {
362                 // 'TYPE' not found
363                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
364         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
365                 // No valid type
366                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
367         } elseif (!isset($attributes['VALUE'])) {
368                 // 'VALUE' not found
369                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
370         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
371                 // Not valid/verifyable
372                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
373         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['reload_list'])) {
374                 // doXmlCallbackFunction is missing
375                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/reload-list not included around this node. Please fix your XML.');
376         }
377
378         // Add the entry to the list
379         addXmlValueToCallbackAttributes('extra_list', $attributes, 'reload_list');
380 }
381
382 // Handles the XML node 'extra-parameter-added-list'
383 function doXmlExtraParameterAddedList ($resource, $attributes) {
384         // There should be no attributes
385         if (count($attributes) > 0) {
386                 // Please don't add any attributes to foo-list nodes
387                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
388         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
389                 // This list should be created already
390                 reportBug(__FUNCTION__, __LINE__, 'added_list should be already created.');
391         }
392 }
393
394 // Handles the XML node 'extra-parameter-added-list-entry'
395 function doXmlExtraParameterAddedListEntry ($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']['added_list'])) {
416                 // doXmlCallbackFunction is missing
417                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/added-list not included around this node. Please fix your XML.');
418         }
419
420         // Add the entry to the list
421         addXmlValueToCallbackAttributes('extra_list', $attributes, 'added_list');
422 }
423
424 // Handles the XML node 'extra-parameter-created-list'
425 function doXmlExtraParameterCreatedList ($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']['created_list'])) {
431                 // This list should be created already
432                 reportBug(__FUNCTION__, __LINE__, 'created_list should be already created.');
433         }
434 }
435
436 // Handles the XML node 'extra-parameter-created-list-entry'
437 function doXmlExtraParameterCreatedListEntry ($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']['created_list'])) {
458                 // doXmlCallbackFunction is missing
459                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/created-list not included around this node. Please fix your XML.');
460         }
461
462         // Add the entry to the list
463         addXmlValueToCallbackAttributes('extra_list', $attributes, 'created_list');
464 }
465
466 // Handles the XML node 'status-change-column'
467 function doXmlStatusChangeColumn ($resource, $attributes) {
468         // There are three attributes, by default
469         if (count($attributes) != 3) {
470                 // Not the right count
471                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
472         } elseif (!isset($attributes['NAME'])) {
473                 // 'NAME' not found
474                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
475         } elseif (!isset($attributes['TYPE'])) {
476                 // 'TYPE' not found
477                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
478         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
479                 // No valid type
480                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
481         } elseif (!isset($attributes['VALUE'])) {
482                 // 'VALUE' not found
483                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
484         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
485                 // Not valid/verifyable
486                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
487         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
488                 // doXmlCallbackFunction is missing
489                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
490         }
491
492         // Add the entry to the list
493         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
494 }
495
496 // Handles the XML node 'status-change-list'
497 function doXmlStatusChangeList ($resource, $attributes) {
498         // There should be no attributes
499         if (count($attributes) > 0) {
500                 // Please don't add any attributes to foo-list nodes
501                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
502         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
503                 // doXmlCallbackFunction is missing
504                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.');
505         }
506 }
507
508 // Handles the XML node 'status-change-list-entry'
509 function doXmlStatusChangeListEntry ($resource, $attributes) {
510         // There are for attributes, by default
511         if (count($attributes) != 4) {
512                 // Not the right count
513                 reportBug(__FUNCTION__, __LINE__, 'Expected 4 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['OLD'])) {
527                 // Not valid/verifyable
528                 reportBug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
529         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
530                 // Not valid/verifyable
531                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
532         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
533                 // doXmlCallbackFunction is missing
534                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/change-list not included around this node. Please fix your XML.');
535         }
536
537         // Add the entry to the list
538         addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
539 }
540
541 // Handles the XML node 'enable-modify-entries'
542 function doXmlEnableModifyEntries ($resource, $attributes) {
543         // There are three attributes, by default
544         if (count($attributes) != 3) {
545                 // Not the right count
546                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
547         } elseif (!isset($attributes['NAME'])) {
548                 // 'NAME' not found
549                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
550         } elseif (!isset($attributes['TYPE'])) {
551                 // 'TYPE' not found
552                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
553         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
554                 // No valid type
555                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
556         } elseif (!isset($attributes['VALUE'])) {
557                 // 'VALUE' not found
558                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
559         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
560                 // Not valid/verifyable
561                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
562         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
563                 // doXmlCallbackFunction is missing
564                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
565         }
566
567         // Add the entry to the list
568         addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
569 }
570
571 // Handles the XML node 'table-id-column'
572 function doXmlTableIdColumn ($resource, $attributes) {
573         // There are three attributes, by default
574         if (count($attributes) != 3) {
575                 // Not the right count
576                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
577         } elseif (!isset($attributes['NAME'])) {
578                 // 'NAME' not found
579                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
580         } elseif (!isset($attributes['TYPE'])) {
581                 // 'TYPE' not found
582                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
583         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
584                 // No valid type
585                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
586         } elseif (!isset($attributes['VALUE'])) {
587                 // 'VALUE' not found
588                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
589         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
590                 // Not valid/verifyable
591                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
592         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
593                 // doXmlCallbackFunction is missing
594                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
595         }
596
597         // Add the entry to the array
598         addXmlValueToCallbackAttributes('table_id_column', $attributes);
599 }
600
601 // Handles the XML node 'table-userid-column'
602 function doXmlTableUseridColumn ($resource, $attributes) {
603         // There are three attributes, by default
604         if (count($attributes) != 3) {
605                 // Not the right count
606                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
607         } elseif (!isset($attributes['NAME'])) {
608                 // 'NAME' not found
609                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
610         } elseif (!isset($attributes['TYPE'])) {
611                 // 'TYPE' not found
612                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
613         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
614                 // No valid type
615                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
616         } elseif (!isset($attributes['VALUE'])) {
617                 // 'VALUE' not found
618                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
619         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
620                 // Not valid/verifyable
621                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
622         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
623                 // doXmlCallbackFunction is missing
624                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
625         }
626
627         // Add the entry to the array
628         addXmlValueToCallbackAttributes('table_userid_column', $attributes);
629 }
630
631 // Handles the XML node 'raw-userid-column-key'
632 function doXmlRawUseridColumnKey ($resource, $attributes) {
633         // There are three attributes, by default
634         if (count($attributes) != 3) {
635                 // Not the right count
636                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
637         } elseif (!isset($attributes['NAME'])) {
638                 // 'NAME' not found
639                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
640         } elseif (!isset($attributes['TYPE'])) {
641                 // 'TYPE' not found
642                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
643         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
644                 // No valid type
645                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
646         } elseif (!isset($attributes['VALUE'])) {
647                 // 'VALUE' not found
648                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
649         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
650                 // Not valid/verifyable
651                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
652         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
653                 // doXmlCallbackFunction is missing
654                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
655         }
656
657         // Add the entry to the array
658         addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes);
659 }
660
661 // Handles the XML node 'cache-file'
662 function doXmlCacheFile ($resource, $attributes) {
663         // There are three attributes, by default
664         if (count($attributes) != 3) {
665                 // Not the right count
666                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
667         } elseif (!isset($attributes['NAME'])) {
668                 // 'NAME' not found
669                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
670         } elseif (!isset($attributes['TYPE'])) {
671                 // 'TYPE' not found
672                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
673         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
674                 // No valid type
675                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
676         } elseif (!isset($attributes['VALUE'])) {
677                 // 'VALUE' not found
678                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
679         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
680                 // Not valid/verifyable
681                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
682         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
683                 // doXmlCallbackFunction is missing
684                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
685         }
686
687         // Add the entry to the array
688         addXmlValueToCallbackAttributes('cache_file', $attributes);
689 }
690
691 //-----------------------------------------------------------------------------
692 //           Call-back functions for listing of data in admin area
693 //-----------------------------------------------------------------------------
694
695 // Handles the XML node 'admin-list-data'
696 function doXmlAdminListData ($resource, $attributes) {
697         // There should be no attributes
698         if (count($attributes) > 0) {
699                 // Please don't add any attributes to foo-list nodes
700                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
701         } // END - if
702 }
703
704 // Handles the XML node 'member-list-data'
705 function doXmlMemberListData ($resource, $attributes) {
706         // There should be no attributes
707         if (count($attributes) > 0) {
708                 // Please don't add any attributes to foo-list nodes
709                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
710         } // END - if
711 }
712
713 // Handles the XML node 'data-tables'
714 function doXmlDataTables ($resource, $attributes) {
715         // There should be no attributes
716         if (count($attributes) > 0) {
717                 // Please don't add any attributes to foo-list nodes
718                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
719         } // END - if
720 }
721
722 // Handles the XML node 'data-table'
723 function doXmlDataTable ($resource, $attributes) {
724         // There are three attributes, by default
725         if (count($attributes) != 3) {
726                 // Not the right count
727                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
728         } elseif (!isset($attributes['VALUE'])) {
729                 // 'VALUE' not found
730                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
731         } elseif (!isset($attributes['TYPE'])) {
732                 // 'TYPE' not found
733                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
734         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
735                 // No valid type
736                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
737         } elseif (!isset($attributes['ALIAS'])) {
738                 // 'ALIAS' not found
739                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
740         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
741                 // Not valid/verifyable
742                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
743         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
744                 // Not valid/verifyable
745                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
746         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
747                 // doXmlCallbackFunction is missing
748                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
749         }
750
751         // Add the entry to the array
752         addXmlValueToCallbackAttributes('data_table', $attributes);
753 }
754
755 // Handles the XML node 'select-data-from-list'
756 function doXmlSelectDataFromList ($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 because this is a foo-list node, got ' . count($attributes));
761         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
762                 // doXmlCallbackFunction is missing
763                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
764         }
765
766         // Add an empty list
767         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
768 }
769
770 // Handles the XML node 'select-data-from-list-entry'
771 function doXmlSelectDataFromListEntry ($resource, $attributes) {
772         // There are five attributes, by default
773         if (count($attributes) != 5) {
774                 // Not the right count
775                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
776         } elseif (!isset($attributes['VALUE'])) {
777                 // 'VALUE' not found
778                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
779         } elseif (!isset($attributes['TYPE'])) {
780                 // 'TYPE' not found
781                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
782         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
783                 // No valid type
784                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
785         } elseif (!isset($attributes['ALIAS'])) {
786                 // 'ALIAS' not found
787                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
788         } elseif (!isset($attributes['FUNCTION'])) {
789                 // 'FUNCTION' not found
790                 reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
791         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
792                 // 'VALUE' not valid/verifyable
793                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
794         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
795                 // 'ALIAS' not valid/verifyable
796                 reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
797         } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
798                 // 'FUNCTION' not valid/verifyable
799                 reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
800         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
801                 // doXmlCallbackFunction is missing
802                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
803         }
804
805         // Add the entry to the array
806         addXmlValueToCallbackAttributes('data_column_list', $attributes);
807 }
808
809 // Handles the XML node 'where-select-from-list'
810 function doXmlWhereSelectFromList ($resource, $attributes) {
811         // There should be no attributes
812         if (count($attributes) > 0) {
813                 // Please don't add any attributes to foo-list nodes
814                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
815         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
816                 // doXmlCallbackFunction is missing
817                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
818         }
819
820         // Add an empty list
821         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
822 }
823
824 // Handles the XML node 'where-select-from-list-entry'
825 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
826         // There are five attributes, by default
827         if (count($attributes) != 5) {
828                 // Not the right count
829                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
830         } elseif (!isset($attributes['TYPE'])) {
831                 // 'TYPE' not found
832                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
833         } elseif (!isset($attributes['TABLE'])) {
834                 // 'TABLE' not found
835                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
836         } elseif (!isset($attributes['VALUE'])) {
837                 // 'VALUE' not found
838                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
839         } elseif (!isset($attributes['CONDITION'])) {
840                 // 'CONDITION' not found
841                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
842         } elseif (!isset($attributes['LOOK-FOR'])) {
843                 // 'LOOK-FOR' not found
844                 reportBug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
845         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
846                 // No valid type
847                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
848         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
849                 // 'TABLE' not valid/verifyable
850                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
851         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
852                 // 'VALUE' not valid/verifyable
853                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
854         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
855                 // 'CONDITION' not valid/verifyable
856                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
857         } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
858                 // 'CONDITION' is not known
859                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. LOOK-FOR=' . $attributes['CONDITION']);
860         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
861                 // doXmlCallbackFunction is missing
862                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
863         }
864
865         // Add the entry to the array
866         addXmlValueToCallbackAttributes('where_select_list', $attributes);
867 }
868
869 // Handles the XML node 'where-condition'
870 function doXmlWhereCondition ($resource, $attributes) {
871         // There are two attributes, by default
872         if (count($attributes) != 3) {
873                 // Please don't add any attributes to foo-list nodes
874                 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes because this is a where-condition node, got ' . count($attributes));
875         } elseif (!isset($attributes['TYPE'])) {
876                 // 'TYPE' not found
877                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
878         } elseif (!isset($attributes['CONDITION'])) {
879                 // 'CONDITION' not found
880                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
881         } elseif (!isset($attributes['NAME'])) {
882                 // 'NAME' not found
883                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
884         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
885                 // doXmlCallbackFunction is missing
886                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
887         }
888
889         // Add an empty list
890         addXmlValueToCallbackAttributes('where_condition', $attributes);
891 }
892
893 // Handles the XML node 'order-by-list'
894 function doXmlOrderByList ($resource, $attributes) {
895         // There should be no attributes
896         if (count($attributes) > 0) {
897                 // Please don't add any attributes to foo-list nodes
898                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
899         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
900                 // doXmlCallbackFunction is missing
901                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
902         }
903
904         // Add an empty list
905         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
906 }
907
908 // Handles the XML node 'order-by-list-entry'
909 function doXmlOrderByListEntry ($resource, $attributes) {
910         // There are four attributes, by default
911         if (count($attributes) != 4) {
912                 // Not the right count
913                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
914         } elseif (!isset($attributes['ORDER'])) {
915                 // 'ORDER' not found
916                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
917         } elseif (!isset($attributes['TYPE'])) {
918                 // 'TYPE' not found
919                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
920         } elseif (!isset($attributes['TABLE'])) {
921                 // 'TABLE' not found
922                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
923         } elseif (!isset($attributes['VALUE'])) {
924                 // 'VALUE' not found
925                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
926         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
927                 // No valid type
928                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
929         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
930                 // 'ORDER' not valid/verifyable
931                 reportBug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
932         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
933                 // 'TABLE' not valid/verifyable
934                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
935         } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
936                 // 'VALUE' not valid/verifyable
937                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
938         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
939                 // doXmlCallbackFunction is missing
940                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
941         }
942
943         // Add the entry to the array
944         addXmlValueToCallbackAttributes('order_by_list', $attributes);
945 }
946
947 // Handles the XML node 'list-template'
948 function doXmlListTemplate ($resource, $attributes) {
949         // There are two attributes, by default
950         if (count($attributes) != 2) {
951                 // Not the right count
952                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
953         } elseif (!isset($attributes['VALUE'])) {
954                 // 'VALUE' not found
955                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
956         } elseif (!isset($attributes['TYPE'])) {
957                 // 'TYPE' not found
958                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
959         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
960                 // No valid type
961                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
962         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
963                 // Not valid/verifyable
964                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
965         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
966                 // doXmlCallbackFunction is missing
967                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
968         }
969
970         // Add the entry to the array
971         addXmlValueToCallbackAttributes('list_template', $attributes);
972 }
973
974 // Handles the XML node 'list-row-template'
975 function doXmlListRowTemplate ($resource, $attributes) {
976         // There are two attributes, by default
977         if (count($attributes) != 2) {
978                 // Not the right count
979                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
980         } elseif (!isset($attributes['VALUE'])) {
981                 // 'VALUE' not found
982                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
983         } elseif (!isset($attributes['TYPE'])) {
984                 // 'TYPE' not found
985                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
986         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
987                 // No valid type
988                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
989         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
990                 // Not valid/verifyable
991                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
992         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
993                 // doXmlCallbackFunction is missing
994                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
995         }
996
997         // Add the entry to the array
998         addXmlValueToCallbackAttributes('list_row_template', $attributes);
999 }
1000
1001 // Handles the XML node 'column-callback-list'
1002 function doXmlColumnCallbackList ($resource, $attributes) {
1003         // There should be no attributes
1004         if (count($attributes) > 0) {
1005                 // Please don't add any attributes to foo-list nodes
1006                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1007         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1008                 // doXmlCallbackFunction is missing
1009                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1010         }
1011
1012         // Add an empty list
1013         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
1014 }
1015
1016 // Handles the XML node 'column-callback-list-entry'
1017 function doXmlColumnCallbackListEntry ($resource, $attributes) {
1018         // There should be no attributes
1019         if (count($attributes) > 0) {
1020                 // Please don't add any attributes to foo-list nodes
1021                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1022         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1023                 // doXmlCallbackFunction is missing
1024                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
1025         }
1026 }
1027
1028 // Handles the XML node 'column-callback-data'
1029 function doXmlColumnCallbackData ($resource, $attributes) {
1030         // There are three attributes, by default
1031         if (count($attributes) != 3) {
1032                 // Not the right count
1033                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1034         } elseif (!isset($attributes['VALUE'])) {
1035                 // 'VALUE' not found
1036                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1037         } elseif (!isset($attributes['TYPE'])) {
1038                 // 'TYPE' not found
1039                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1040         } elseif (!isset($attributes['CALLBACK'])) {
1041                 // 'CALLBACK' not found
1042                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
1043         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1044                 // No valid type
1045                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1046         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1047                 // Not valid/verifyable
1048                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1049         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1050                 // doXmlCallbackFunction is missing
1051                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1052         } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
1053                 // 'CALLBACK' not valid/verifyable
1054                 reportBug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
1055         }
1056
1057         // Add the entry to the array
1058         addXmlValueToCallbackAttributes('column_callback_list', $attributes);
1059 }
1060
1061 // Handles the XML node 'callback-extra-parameter-list'
1062 function doXmlCallbackExtraParameterList ($resource, $attributes) {
1063         // There should be no attributes
1064         if (count($attributes) > 0) {
1065                 // Please don't add any attributes to foo-list nodes
1066                 reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
1067         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1068                 // doXmlCallbackFunction is missing
1069                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
1070         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1071                 // Abort silently here, no one wants to kill this array
1072                 return;
1073         }
1074
1075         // Add an empty list
1076         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
1077 }
1078
1079 // Handles the XML node 'callback-extra-parameter-list-entry'
1080 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
1081         // There are three attributes, by default
1082         if (count($attributes) != 3) {
1083                 // Not the right count
1084                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1085         } elseif (!isset($attributes['COLUMN'])) {
1086                 // 'COLUMN' not found
1087                 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
1088         } elseif (!isset($attributes['TYPE'])) {
1089                 // 'TYPE' not found
1090                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1091         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1092                 // No valid type
1093                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1094         } elseif (!isset($attributes['VALUE'])) {
1095                 // 'VALUE' not found
1096                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1097         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1098                 // 'VALUE' not valid/verifyable
1099                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1100         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1101                 // doXmlCallbackFunction is missing
1102                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
1103         }
1104
1105         // Add the entry to the array
1106         addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
1107 }
1108
1109 // Handles the XML node 'no-entry-found-message'
1110 function doXmlNoEntryFoundMessage ($resource, $attributes) {
1111         // There are two attributes, by default
1112         if (count($attributes) != 2) {
1113                 // Not the right count
1114                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1115         } elseif (!isset($attributes['VALUE'])) {
1116                 // 'VALUE' not found
1117                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1118         } elseif (!isset($attributes['TYPE'])) {
1119                 // 'TYPE' not found
1120                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1121         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1122                 // No valid type
1123                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1124         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1125                 // Not valid/verifyable
1126                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1127         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1128                 // doXmlCallbackFunction is missing
1129                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1130         }
1131
1132         // Add the entry to the array
1133         addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
1134 }
1135
1136 //-----------------------------------------------------------------------------
1137 //                              XML type validation
1138 //-----------------------------------------------------------------------------
1139
1140 // Checks for string without any added extra data
1141 function isXmlTypeString ($value) {
1142         // Just let SQL_ESCAPE() do the job
1143         return ($value == SQL_ESCAPE($value));
1144 }
1145
1146 // Fake-check for array type
1147 function isXmlTypeArray ($value) {
1148         // This value is always a string
1149         return (is_string($value));
1150 }
1151
1152 // Check for boolean type
1153 function isXmlTypeBool ($value) {
1154         // Trim value
1155         $value = trim($value);
1156
1157         // This value is always a string
1158         return (($value == 'true') || ($value == 'false'));
1159 }
1160
1161 // Check for integer type
1162 function isXmlTypeInt ($value) {
1163         // Trim value
1164         $value = trim($value);
1165
1166         // This value is always a string
1167         return (bigintval($value) == $value);
1168 }
1169
1170 // Check for callback type
1171 function isXmlTypeCallback ($value) {
1172         // Trim value
1173         $value = trim($value);
1174
1175         // This value is always a string
1176         return (function_exists($value));
1177 }
1178
1179 //-----------------------------------------------------------------------------
1180 //                               Private XML functions
1181 //-----------------------------------------------------------------------------
1182
1183 // Adds given attribut to element
1184 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
1185         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
1186         // Is it boolean type?
1187         if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
1188                 // Then convert VALUE
1189                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!');
1190                 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
1191         } elseif ($attributes['TYPE'] == 'callback') {
1192                 // It is a simple call-back type
1193                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!');
1194                 $attributes['VALUE'] = call_user_func($attributes['VALUE']);
1195         }
1196
1197         // What do we need to add?
1198         if ($attributes['TYPE'] == 'array') {
1199                 // Another nested array
1200                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element);
1201                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
1202         } elseif (!empty($extraKey)) {
1203                 // Sub-array (one level only)
1204                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
1205                 if (trim($attributes['NAME']) == '') {
1206                         // Numerical index
1207                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1208                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE'];
1209                 } elseif (!empty($key)) {
1210                         // Use from $key
1211                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
1212                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
1213                 } else {
1214                         // Use from NAME
1215                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
1216                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
1217                 }
1218         } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
1219                 /*
1220                  * ALIAS and FUNCTION detected? This may happen with SQL queries
1221                  * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
1222                  */
1223
1224                 // Fix missing 'NAME'
1225                 if (!isset($attributes['NAME'])) {
1226                         $attributes['NAME'] = '';
1227                 } // END - if
1228
1229                 // Init array
1230                 $array =  array(
1231                         'column'   => trim($attributes['VALUE']),
1232                         'alias'    => trim($attributes['ALIAS']),
1233                         'function' => trim($attributes['FUNCTION']),
1234                         'table'    => trim($attributes['TABLE']),
1235                         'name'     => trim($attributes['NAME'])
1236                 );
1237
1238                 // Add the entry
1239                 //* 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'] . ')');
1240                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1241         } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
1242                 // CONDITION/LOOK-FOR detected
1243                 // Init array
1244                 $array =  array(
1245                         'column'    => trim($attributes['VALUE']),
1246                         'table'     => trim($attributes['TABLE']),
1247                         'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1248                         'look_for'  => trim($attributes['LOOK-FOR'])
1249                 );
1250
1251                 //* 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'] . ')');
1252                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1253         } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['NAME']))) {
1254                 // CONDITION/NAME detected
1255                 //* 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!');
1256                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['CONDITION'];
1257         } elseif (isset($attributes['CALLBACK'])) {
1258                 // CALLBACK/VALUE detected
1259                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1260                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1261         } elseif (isset($attributes['ORDER'])) {
1262                 // ORDER/TABLE detected
1263                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1264                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1265         } elseif (isset($attributes['COLUMN'])) {
1266                 // COLUMN/VALUE detected
1267                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
1268                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE'];
1269         } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) {
1270                 // Numerical index
1271                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1272                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE'];
1273         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1274                 // Already created
1275                 reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
1276         } else {
1277                 // Use from NAME
1278                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1279                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1280         }
1281         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1282 }
1283
1284 //-----------------------------------------------------------------------------
1285 //                            Execute call-back functions
1286 //-----------------------------------------------------------------------------
1287
1288 // Execute function for doXmlCallbackFunction()
1289 function doXmlCallbackFunctionExecute ($callbackName, $args, $columnIndex) {
1290         // Is 'id_index' set and form sent?
1291         if ((isset($args['id_index'])) && (isFormSent())) {
1292                 // Prepare 'id_index'
1293                 $args['id_index'] = postRequestElement($args['id_index']);
1294         } // END - if
1295
1296         // Just call it
1297         //* DEBUG: */ die('callbackFunction=' . $callbackName . ',columnIndex=' . $columnIndex . ',args=<pre>'.print_r($args, true).'</pre>');
1298         call_user_func_array($callbackName, $args);
1299 }
1300
1301 // [EOF]
1302 ?>