Fixes for various bugs (e.g.: 'secret file could not be read', SQL error and more)
[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 - 2013 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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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 (isFilledArray($attributes)) {
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'])) {
545                 // doXmlCallbackFunction is missing
546                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
547         }
548
549         // Add the entry to the list
550         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'] = array();
551 }
552
553 // Handles the XML node 'status-change-list-entry'
554 function doXmlStatusChangeListEntry ($resource, $attributes) {
555         // There are for attributes, by default
556         if (count($attributes) != 4) {
557                 // Not the right count
558                 reportBug(__FUNCTION__, __LINE__, 'Expected 4 attributes, got ' . count($attributes));
559         } elseif (!isset($attributes['NAME'])) {
560                 // 'NAME' not found
561                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
562         } elseif (!isset($attributes['TYPE'])) {
563                 // 'TYPE' not found
564                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
565         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
566                 // No valid type
567                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
568         } elseif (!isset($attributes['VALUE'])) {
569                 // 'VALUE' not found
570                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
571         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['OLD'])) {
572                 // Not valid/verifyable
573                 reportBug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
574         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
575                 // Not valid/verifyable
576                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
577         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
578                 // doXmlCallbackFunction is missing
579                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/change-list not included around this node. Please fix your XML.');
580         }
581
582         // Add the entry to the list
583         addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
584 }
585
586 // Handles the XML node 'enable-modify-entries'
587 function doXmlEnableModifyEntries ($resource, $attributes) {
588         // There are three attributes, by default
589         if (count($attributes) != 3) {
590                 // Not the right count
591                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
592         } elseif (!isset($attributes['NAME'])) {
593                 // 'NAME' not found
594                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
595         } elseif (!isset($attributes['TYPE'])) {
596                 // 'TYPE' not found
597                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
598         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
599                 // No valid type
600                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
601         } elseif (!isset($attributes['VALUE'])) {
602                 // 'VALUE' not found
603                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
604         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
605                 // Not valid/verifyable
606                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
607         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
608                 // doXmlCallbackFunction is missing
609                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
610         }
611
612         // Add the entry to the list
613         addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
614 }
615
616 // Handles the XML node 'table-id-column'
617 function doXmlTableIdColumn ($resource, $attributes) {
618         // There are three attributes, by default
619         if (count($attributes) != 3) {
620                 // Not the right count
621                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
622         } elseif (!isset($attributes['NAME'])) {
623                 // 'NAME' not found
624                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
625         } elseif (!isset($attributes['TYPE'])) {
626                 // 'TYPE' not found
627                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
628         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
629                 // No valid type
630                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
631         } elseif (!isset($attributes['VALUE'])) {
632                 // 'VALUE' not found
633                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
634         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
635                 // Not valid/verifyable
636                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
637         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
638                 // doXmlCallbackFunction is missing
639                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
640         }
641
642         // Add the entry to the array
643         addXmlValueToCallbackAttributes('table_id_column', $attributes);
644 }
645
646 // Handles the XML node 'table-userid-column'
647 function doXmlTableUseridColumn ($resource, $attributes) {
648         // There are three attributes, by default
649         if (count($attributes) != 3) {
650                 // Not the right count
651                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
652         } elseif (!isset($attributes['NAME'])) {
653                 // 'NAME' not found
654                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
655         } elseif (!isset($attributes['TYPE'])) {
656                 // 'TYPE' not found
657                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
658         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
659                 // No valid type
660                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
661         } elseif (!isset($attributes['VALUE'])) {
662                 // 'VALUE' not found
663                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
664         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
665                 // Not valid/verifyable
666                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
667         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
668                 // doXmlCallbackFunction is missing
669                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
670         }
671
672         // Add the entry to the array
673         addXmlValueToCallbackAttributes('table_userid_column', $attributes);
674 }
675
676 // Handles the XML node 'raw-userid-column-key'
677 function doXmlRawUseridColumnKey ($resource, $attributes) {
678         // There are three attributes, by default
679         if (count($attributes) != 3) {
680                 // Not the right count
681                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
682         } elseif (!isset($attributes['NAME'])) {
683                 // 'NAME' not found
684                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
685         } elseif (!isset($attributes['TYPE'])) {
686                 // 'TYPE' not found
687                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
688         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
689                 // No valid type
690                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
691         } elseif (!isset($attributes['VALUE'])) {
692                 // 'VALUE' not found
693                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
694         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
695                 // Not valid/verifyable
696                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
697         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
698                 // doXmlCallbackFunction is missing
699                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
700         }
701
702         // Add the entry to the array
703         addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes);
704 }
705
706 // Handles the XML node 'cache-file'
707 function doXmlCacheFile ($resource, $attributes) {
708         // There are three attributes, by default
709         if (count($attributes) != 3) {
710                 // Not the right count
711                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
712         } elseif (!isset($attributes['NAME'])) {
713                 // 'NAME' not found
714                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
715         } elseif (!isset($attributes['TYPE'])) {
716                 // 'TYPE' not found
717                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
718         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
719                 // No valid type
720                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
721         } elseif (!isset($attributes['VALUE'])) {
722                 // 'VALUE' not found
723                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
724         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
725                 // Not valid/verifyable
726                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
727         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
728                 // doXmlCallbackFunction is missing
729                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
730         }
731
732         // Add the entry to the array
733         addXmlValueToCallbackAttributes('cache_file', $attributes);
734 }
735
736 //-----------------------------------------------------------------------------
737 //           Call-back functions for listing of data in admin area
738 //-----------------------------------------------------------------------------
739
740 // Handles the XML node 'admin-list-data'
741 function doXmlAdminListData ($resource, $attributes) {
742         // There should be no attributes
743         if (isFilledArray($attributes)) {
744                 // Please don't add any attributes to foo-list nodes
745                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
746         } // END - if
747 }
748
749 // Handles the XML node 'member-list-data'
750 function doXmlMemberListData ($resource, $attributes) {
751         // There should be no attributes
752         if (isFilledArray($attributes)) {
753                 // Please don't add any attributes to foo-list nodes
754                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
755         } // END - if
756 }
757
758 // Handles the XML node 'data-tables'
759 function doXmlDataTables ($resource, $attributes) {
760         // There should be no attributes
761         if (isFilledArray($attributes)) {
762                 // Please don't add any attributes to foo-list nodes
763                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
764         } // END - if
765 }
766
767 // Handles the XML node 'data-table'
768 function doXmlDataTable ($resource, $attributes) {
769         // There are three attributes, by default
770         if (count($attributes) != 3) {
771                 // Not the right count
772                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
773         } elseif (!isset($attributes['VALUE'])) {
774                 // 'VALUE' not found
775                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
776         } elseif (!isset($attributes['TYPE'])) {
777                 // 'TYPE' not found
778                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
779         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
780                 // No valid type
781                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
782         } elseif (!isset($attributes['ALIAS'])) {
783                 // 'ALIAS' not found
784                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
785         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
786                 // Not valid/verifyable
787                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
788         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
789                 // Not valid/verifyable
790                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
791         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
792                 // doXmlCallbackFunction is missing
793                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
794         }
795
796         // Init array
797         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'] = array();
798
799         // Add the entry to the array
800         addXmlValueToCallbackAttributes('data_table', $attributes);
801 }
802
803 // Handles the XML node 'table-join-condition'
804 function doXmlTableJoinCondition ($resource, $attributes) {
805         // There should be no attributes
806         if (isFilledArray($attributes)) {
807                 // Please don't add any attributes to foo-list nodes
808                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
809         } // END - if
810 }
811
812 // Handles the XML node 'table-join-type'
813 function doXmlTableJoinType ($resource, $attributes) {
814         if (count($attributes) != 1) {
815                 // Not the right count
816                 reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes, got ' . count($attributes));
817         } elseif (!isset($attributes['TYPE'])) {
818                 // 'TYPE' not found
819                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
820         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_type'])) {
821                 // Array is already defined
822                 reportBug(__FUNCTION__, __LINE__, 'Required XML node table-join-type already set. Only one JOIN is currently supported.');
823         }
824
825         // Init array
826         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_type'] = array();
827
828         // Add the entry to the array
829         addXmlValueToCallbackAttributes('table_join_type', $attributes);
830 }
831
832 // Handles the XML node 'table-join-name'
833 function doXmlTableJoinName ($resource, $attributes) {
834         if (count($attributes) != 2) {
835                 // Not the right count
836                 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
837         } elseif (!isset($attributes['NAME'])) {
838                 // 'NAME' not found
839                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
840         } elseif (!isset($attributes['ALIAS'])) {
841                 // 'ALIAS' not found
842                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
843         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_name'])) {
844                 // Array is already defined
845                 reportBug(__FUNCTION__, __LINE__, 'Required XML node table-join-name already set. Only one JOIN is currently supported.');
846         }
847
848         // Init array
849         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_name'] = array();
850
851         // Add the entry to the array
852         addXmlValueToCallbackAttributes('table_join_name', $attributes);
853 }
854
855 // Handles the XML node 'join-on'
856 function doXmlJoinOn ($resource, $attributes) {
857         // There should be no attributes
858         if (isFilledArray($attributes)) {
859                 // Please don't add any attributes to foo-list nodes
860                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
861         } // END - if
862 }
863
864 // Handles the XML node 'join-on-left-table'
865 function doXmlJoinOnLeftTable ($resource, $attributes) {
866         if (count($attributes) != 3) {
867                 // Not the right count
868                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
869         } elseif (!isset($attributes['TYPE'])) {
870                 // 'TYPE' not found
871                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
872         } elseif (!isset($attributes['NAME'])) {
873                 // 'NAME' not found
874                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
875         } elseif (!isset($attributes['COLUMN'])) {
876                 // 'COLUMN' not found
877                 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
878         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['NAME'])) {
879                 // 'NAME' not valid/verifyable
880                 reportBug(__FUNCTION__, __LINE__, 'Attribute NAME does not validate. NAME=' . $attributes['NAME']);
881         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['COLUMN'])) {
882                 // 'COLUMN' not valid/verifyable
883                 reportBug(__FUNCTION__, __LINE__, 'Attribute COLUMN does not validate. COLUMN=' . $attributes['COLUMN']);
884         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_left_table'])) {
885                 // Array is already defined
886                 reportBug(__FUNCTION__, __LINE__, 'Required XML node join-on-left-table already set. Only one JOIN is currently supported.');
887         }
888
889         // Init array
890         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_left_table'] = array();
891
892         // Add the entry to the array
893         addXmlValueToCallbackAttributes('join_on_left_table', $attributes);
894 }
895
896 // Handles the XML node 'join-on-right-table'
897 function doXmlJoinOnRightTable ($resource, $attributes) {
898         if (count($attributes) != 3) {
899                 // Not the right count
900                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
901         } elseif (!isset($attributes['TYPE'])) {
902                 // 'TYPE' not found
903                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
904         } elseif (!isset($attributes['NAME'])) {
905                 // 'NAME' not found
906                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
907         } elseif (!isset($attributes['COLUMN'])) {
908                 // 'COLUMN' not found
909                 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
910         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['NAME'])) {
911                 // 'NAME' not valid/verifyable
912                 reportBug(__FUNCTION__, __LINE__, 'Attribute NAME does not validate. NAME=' . $attributes['NAME']);
913         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['COLUMN'])) {
914                 // 'COLUMN' not valid/verifyable
915                 reportBug(__FUNCTION__, __LINE__, 'Attribute COLUMN does not validate. COLUMN=' . $attributes['COLUMN']);
916         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_right_table'])) {
917                 // Array is already defined
918                 reportBug(__FUNCTION__, __LINE__, 'Required XML node join-on-right-table already set. Only one JOIN is currently supported.');
919         }
920
921         // Init array
922         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_right_table'] = array();
923
924         // Add the entry to the array
925         addXmlValueToCallbackAttributes('join_on_right_table', $attributes);
926 }
927
928 // Handles the XML node 'join-on-condition'
929 function doXmlJoinOnCondition ($resource, $attributes) {
930         if (count($attributes) != 2) {
931                 // Not the right count
932                 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
933         } elseif (!isset($attributes['TYPE'])) {
934                 // 'TYPE' not found
935                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
936         } elseif (!isset($attributes['CONDITION'])) {
937                 // 'CONDITION' not found
938                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
939         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
940                 // 'CONDITION' not valid/verifyable
941                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
942         } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
943                 // 'CONDITION' is not known
944                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']);
945         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_condition'])) {
946                 // Array is already defined
947                 reportBug(__FUNCTION__, __LINE__, 'Required XML node join-on-condition already set. Only one JOIN is currently supported.');
948         }
949
950         // Init array
951         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_condition'] = array();
952
953         // Add the entry to the array
954         //die('<pre>'.print_r($attributes,true).'</pre>');
955         addXmlValueToCallbackAttributes('join_on_condition', $attributes);
956 }
957
958 // Handles the XML node 'select-data-from-list'
959 function doXmlSelectDataFromList ($resource, $attributes) {
960         // There should be no attributes
961         if (isFilledArray($attributes)) {
962                 // Please don't add any attributes to foo-list nodes
963                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
964         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
965                 // doXmlCallbackFunction is missing
966                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
967         }
968
969         // Add an empty list
970         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
971 }
972
973 // Handles the XML node 'select-data-from-list-entry'
974 function doXmlSelectDataFromListEntry ($resource, $attributes) {
975         // There are five attributes, by default
976         if (count($attributes) != 5) {
977                 // Not the right count
978                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
979         } elseif (!isset($attributes['VALUE'])) {
980                 // 'VALUE' not found
981                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
982         } elseif (!isset($attributes['TYPE'])) {
983                 // 'TYPE' not found
984                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
985         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
986                 // No valid type
987                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
988         } elseif (!isset($attributes['ALIAS'])) {
989                 // 'ALIAS' not found
990                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
991         } elseif (!isset($attributes['FUNCTION'])) {
992                 // 'FUNCTION' not found
993                 reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
994         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
995                 // 'VALUE' not valid/verifyable
996                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
997         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
998                 // 'ALIAS' not valid/verifyable
999                 reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
1000         } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
1001                 // 'FUNCTION' not valid/verifyable
1002                 reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
1003         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1004                 // doXmlCallbackFunction is missing
1005                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
1006         }
1007
1008         // Add the entry to the array
1009         addXmlValueToCallbackAttributes('data_column_list', $attributes);
1010 }
1011
1012 // Handles the XML node 'where-select-from-list'
1013 function doXmlWhereSelectFromList ($resource, $attributes) {
1014         // There should be no attributes
1015         if (isFilledArray($attributes)) {
1016                 // Please don't add any attributes to foo-list nodes
1017                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1018         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1019                 // doXmlCallbackFunction is missing
1020                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1021         }
1022
1023         // Add an empty list
1024         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
1025 }
1026
1027 // Handles the XML node 'where-select-from-list-entry'
1028 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
1029         // There are five attributes, by default
1030         if (count($attributes) != 5) {
1031                 // Not the right count
1032                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1033         } elseif (!isset($attributes['TYPE'])) {
1034                 // 'TYPE' not found
1035                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1036         } elseif (!isset($attributes['TABLE'])) {
1037                 // 'TABLE' not found
1038                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
1039         } elseif (!isset($attributes['VALUE'])) {
1040                 // 'VALUE' not found
1041                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1042         } elseif (!isset($attributes['CONDITION'])) {
1043                 // 'CONDITION' not found
1044                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
1045         } elseif (!isset($attributes['LOOK-FOR'])) {
1046                 // 'LOOK-FOR' not found
1047                 reportBug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
1048         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1049                 // No valid type
1050                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1051         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
1052                 // 'TABLE' not valid/verifyable
1053                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
1054         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1055                 // 'VALUE' not valid/verifyable
1056                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1057         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
1058                 // 'CONDITION' not valid/verifyable
1059                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
1060         } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
1061                 // 'CONDITION' is not known
1062                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']);
1063         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1064                 // doXmlCallbackFunction is missing
1065                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
1066         }
1067
1068         // Add the entry to the array
1069         addXmlValueToCallbackAttributes('where_select_list', $attributes);
1070 }
1071
1072 // Handles the XML node 'where-condition'
1073 function doXmlWhereCondition ($resource, $attributes) {
1074         // There are two attributes, by default
1075         if (count($attributes) != 3) {
1076                 // Please don't add any attributes to foo-list nodes
1077                 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes because this is a where-condition node, got ' . count($attributes));
1078         } elseif (!isset($attributes['TYPE'])) {
1079                 // 'TYPE' not found
1080                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1081         } elseif (!isset($attributes['CONDITION'])) {
1082                 // 'CONDITION' not found
1083                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
1084         } elseif (!isset($attributes['NAME'])) {
1085                 // 'NAME' not found
1086                 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
1087         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
1088                 // 'CONDITION' not valid/verifyable
1089                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
1090         } elseif ((!empty($attributes['CONDITION'])) && (!isXmlConditionValid($attributes['CONDITION']))) {
1091                 // 'CONDITION' is not known
1092                 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']);
1093         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1094                 // doXmlCallbackFunction is missing
1095                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1096         }
1097
1098         // Add an empty list
1099         addXmlValueToCallbackAttributes('where_condition', $attributes);
1100 }
1101
1102 // Handles the XML node 'order-by-list'
1103 function doXmlOrderByList ($resource, $attributes) {
1104         // There should be no attributes
1105         if (isFilledArray($attributes)) {
1106                 // Please don't add any attributes to foo-list nodes
1107                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1108         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1109                 // doXmlCallbackFunction is missing
1110                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1111         }
1112
1113         // Add an empty list
1114         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
1115 }
1116
1117 // Handles the XML node 'order-by-list-entry'
1118 function doXmlOrderByListEntry ($resource, $attributes) {
1119         // There are four attributes, by default
1120         if (count($attributes) != 4) {
1121                 // Not the right count
1122                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1123         } elseif (!isset($attributes['ORDER'])) {
1124                 // 'ORDER' not found
1125                 reportBug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
1126         } elseif (!isset($attributes['TYPE'])) {
1127                 // 'TYPE' not found
1128                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1129         } elseif (!isset($attributes['TABLE'])) {
1130                 // 'TABLE' not found
1131                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
1132         } elseif (!isset($attributes['VALUE'])) {
1133                 // 'VALUE' not found
1134                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1135         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1136                 // No valid type
1137                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1138         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
1139                 // 'ORDER' not valid/verifyable
1140                 reportBug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
1141         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
1142                 // 'TABLE' not valid/verifyable
1143                 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
1144         } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
1145                 // 'VALUE' not valid/verifyable
1146                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1147         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1148                 // doXmlCallbackFunction is missing
1149                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
1150         }
1151
1152         // Add the entry to the array
1153         addXmlValueToCallbackAttributes('order_by_list', $attributes);
1154 }
1155
1156 // Handles the XML node 'list-template'
1157 function doXmlListTemplate ($resource, $attributes) {
1158         // There are two attributes, by default
1159         if (count($attributes) != 2) {
1160                 // Not the right count
1161                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1162         } elseif (!isset($attributes['VALUE'])) {
1163                 // 'VALUE' not found
1164                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1165         } elseif (!isset($attributes['TYPE'])) {
1166                 // 'TYPE' not found
1167                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1168         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1169                 // No valid type
1170                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1171         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1172                 // Not valid/verifyable
1173                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1174         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1175                 // doXmlCallbackFunction is missing
1176                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1177         }
1178
1179         // Add the entry to the array
1180         addXmlValueToCallbackAttributes('list_template', $attributes);
1181 }
1182
1183 // Handles the XML node 'list-row-template'
1184 function doXmlListRowTemplate ($resource, $attributes) {
1185         // There are two attributes, by default
1186         if (count($attributes) != 2) {
1187                 // Not the right count
1188                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1189         } elseif (!isset($attributes['VALUE'])) {
1190                 // 'VALUE' not found
1191                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1192         } elseif (!isset($attributes['TYPE'])) {
1193                 // 'TYPE' not found
1194                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1195         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1196                 // No valid type
1197                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1198         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1199                 // Not valid/verifyable
1200                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1201         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1202                 // doXmlCallbackFunction is missing
1203                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1204         }
1205
1206         // Add the entry to the array
1207         addXmlValueToCallbackAttributes('list_row_template', $attributes);
1208 }
1209
1210 // Handles the XML node 'column-callback-list'
1211 function doXmlColumnCallbackList ($resource, $attributes) {
1212         // There should be no attributes
1213         if (isFilledArray($attributes)) {
1214                 // Please don't add any attributes to foo-list nodes
1215                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1216         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1217                 // doXmlCallbackFunction is missing
1218                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1219         }
1220
1221         // Add an empty list
1222         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
1223 }
1224
1225 // Handles the XML node 'column-callback-list-entry'
1226 function doXmlColumnCallbackListEntry ($resource, $attributes) {
1227         // There should be no attributes
1228         if (isFilledArray($attributes)) {
1229                 // Please don't add any attributes to foo-list nodes
1230                 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1231         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1232                 // doXmlCallbackFunction is missing
1233                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
1234         }
1235 }
1236
1237 // Handles the XML node 'column-callback-data'
1238 function doXmlColumnCallbackData ($resource, $attributes) {
1239         // There are three attributes, by default
1240         if (count($attributes) != 3) {
1241                 // Not the right count
1242                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1243         } elseif (!isset($attributes['VALUE'])) {
1244                 // 'VALUE' not found
1245                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1246         } elseif (!isset($attributes['TYPE'])) {
1247                 // 'TYPE' not found
1248                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1249         } elseif (!isset($attributes['CALLBACK'])) {
1250                 // 'CALLBACK' not found
1251                 reportBug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
1252         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1253                 // No valid type
1254                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1255         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1256                 // Not valid/verifyable
1257                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1258         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1259                 // doXmlCallbackFunction is missing
1260                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1261         } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
1262                 // 'CALLBACK' not valid/verifyable
1263                 reportBug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
1264         }
1265
1266         // Add the entry to the array
1267         addXmlValueToCallbackAttributes('column_callback_list', $attributes);
1268 }
1269
1270 // Handles the XML node 'callback-extra-parameter-list'
1271 function doXmlCallbackExtraParameterList ($resource, $attributes) {
1272         // There should be no attributes
1273         if (isFilledArray($attributes)) {
1274                 // Please don't add any attributes to foo-list nodes
1275                 reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
1276         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1277                 // doXmlCallbackFunction is missing
1278                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
1279         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1280                 // Abort silently here, no one wants to kill this array
1281                 return;
1282         }
1283
1284         // Add an empty list
1285         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
1286 }
1287
1288 // Handles the XML node 'callback-extra-parameter-list-entry'
1289 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
1290         // There are three attributes, by default
1291         if (count($attributes) != 3) {
1292                 // Not the right count
1293                 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1294         } elseif (!isset($attributes['COLUMN'])) {
1295                 // 'COLUMN' not found
1296                 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
1297         } elseif (!isset($attributes['TYPE'])) {
1298                 // 'TYPE' not found
1299                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1300         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1301                 // No valid type
1302                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1303         } elseif (!isset($attributes['VALUE'])) {
1304                 // 'VALUE' not found
1305                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1306         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1307                 // 'VALUE' not valid/verifyable
1308                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1309         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1310                 // doXmlCallbackFunction is missing
1311                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
1312         }
1313
1314         // Add the entry to the array
1315         addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
1316 }
1317
1318 // Handles the XML node 'no-entry-found-message'
1319 function doXmlNoEntryFoundMessage ($resource, $attributes) {
1320         // There are two attributes, by default
1321         if (count($attributes) != 2) {
1322                 // Not the right count
1323                 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1324         } elseif (!isset($attributes['VALUE'])) {
1325                 // 'VALUE' not found
1326                 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1327         } elseif (!isset($attributes['TYPE'])) {
1328                 // 'TYPE' not found
1329                 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1330         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1331                 // No valid type
1332                 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1333         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1334                 // Not valid/verifyable
1335                 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1336         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1337                 // doXmlCallbackFunction is missing
1338                 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1339         }
1340
1341         // Add the entry to the array
1342         addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
1343 }
1344
1345 //-----------------------------------------------------------------------------
1346 //                              XML type validation
1347 //-----------------------------------------------------------------------------
1348
1349 // Checks for string without any added extra data
1350 function isXmlTypeString ($value) {
1351         // Just let SQL_ESCAPE() do the job
1352         return ($value == sqlEscapeString($value));
1353 }
1354
1355 // Fake-check for array type
1356 function isXmlTypeArray ($value) {
1357         // This value is always a string
1358         return (is_string($value));
1359 }
1360
1361 // Check for boolean type
1362 function isXmlTypeBool ($value) {
1363         // Trim value
1364         $value = trim($value);
1365
1366         // This value is always a string
1367         return (($value == 'true') || ($value == 'false'));
1368 }
1369
1370 // Check for integer type
1371 function isXmlTypeInt ($value) {
1372         // Trim value
1373         $value = trim($value);
1374
1375         // This value is always a string
1376         return (bigintval($value) == $value);
1377 }
1378
1379 // Check for callback type
1380 function isXmlTypeCallback ($value) {
1381         // Trim value
1382         $value = trim($value);
1383
1384         // This value is always a string
1385         return (function_exists($value));
1386 }
1387
1388 //-----------------------------------------------------------------------------
1389 //                               Private XML functions
1390 //-----------------------------------------------------------------------------
1391
1392 // Adds given attribut to element
1393 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
1394         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
1395         // Is it boolean type?
1396         if ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
1397                 // Then convert VALUE
1398                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!');
1399                 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
1400         } elseif ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'callback')) {
1401                 // It is a simple call-back type
1402                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!');
1403                 $attributes['VALUE'] = call_user_func($attributes['VALUE']);
1404         }
1405
1406         // What do we need to add?
1407         if ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'array')) {
1408                 // Another nested array
1409                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element);
1410                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
1411         } elseif (!empty($extraKey)) {
1412                 // Sub-array (one level only)
1413                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
1414                 if (trim($attributes['NAME']) == '') {
1415                         // Numerical index
1416                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1417                         if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey])) {
1418                                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey] = array();
1419                         } // END - if
1420                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey])] = $attributes['VALUE'];
1421                 } elseif (!empty($key)) {
1422                         // Use from $key
1423                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
1424                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
1425                 } else {
1426                         // Use from NAME
1427                         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
1428                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
1429                 }
1430         } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
1431                 /*
1432                  * ALIAS and FUNCTION detected? This may happen with SQL queries
1433                  * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
1434                  */
1435
1436                 // Fix missing 'NAME'
1437                 if (!isset($attributes['NAME'])) {
1438                         $attributes['NAME'] = '';
1439                 } // END - if
1440
1441                 // Init array
1442                 $array = array(
1443                         'column'   => trim($attributes['VALUE']),
1444                         'alias'    => trim($attributes['ALIAS']),
1445                         'function' => trim($attributes['FUNCTION']),
1446                         'table'    => trim($attributes['TABLE']),
1447                         'name'     => trim($attributes['NAME'])
1448                 );
1449
1450                 // Add the entry
1451                 //* 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'] . ')');
1452                 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) {
1453                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array();
1454                 } // END - if
1455                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1456         } elseif ((isset($attributes['NAME'])) && (isset($attributes['ALIAS']))) {
1457                 // NAME/ALIAS detected
1458                 $array = array(
1459                         'name'  => trim($attributes['NAME']),
1460                         'alias' => trim($attributes['ALIAS'])
1461                 );
1462                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',NAME=' . $attributes['NAME'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS']);
1463                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1464         } elseif ((isset($attributes['VALUE'])) && (isset($attributes['ALIAS']))) {
1465                 // NAME/ALIAS detected
1466                 $array = array(
1467                         'value' => trim($attributes['VALUE']),
1468                         'alias' => trim($attributes['ALIAS'])
1469                 );
1470                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',NAME=' . $attributes['VALUE'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS']);
1471                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1472         } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
1473                 // CONDITION/LOOK-FOR detected
1474                 // Init array
1475                 $array = array(
1476                         'column'    => trim($attributes['VALUE']),
1477                         'table'     => trim($attributes['TABLE']),
1478                         'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1479                         'look_for'  => trim($attributes['LOOK-FOR'])
1480                 );
1481
1482                 //* 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'] . ')');
1483                 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) {
1484                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array();
1485                 } // END - if
1486                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1487         } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['NAME']))) {
1488                 // CONDITION/NAME detected
1489                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - CONDITION-NAME!');
1490                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['CONDITION'];
1491         } elseif (isset($attributes['CONDITION'])) {
1492                 // CONDITION detected
1493                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ' - CONDITION!');
1494                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = convertXmlContion(trim($attributes['CONDITION']));
1495         } elseif (isset($attributes['CALLBACK'])) {
1496                 // CALLBACK/VALUE detected
1497                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1498                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1499         } elseif (isset($attributes['ORDER'])) {
1500                 // ORDER/TABLE detected
1501                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1502                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1503         } elseif ((isset($attributes['TYPE'])) && (isset($attributes['NAME'])) && (isset($attributes['COLUMN']))) {
1504                 // TYPE/NAME/COLUMN detected
1505                 // Init array
1506                 $array = array(
1507                         'name'   => trim($attributes['NAME']),
1508                         'column' => trim($attributes['COLUMN'])
1509                 );
1510                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - TYPE-COLUMN! (COLUMN=' . $attributes['COLUMN'] . ')');
1511                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1512         } elseif (isset($attributes['COLUMN'])) {
1513                 // COLUMN/VALUE detected
1514                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
1515                 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) {
1516                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array();
1517                 } // END - if
1518                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])] = $attributes['VALUE'];
1519         } elseif (((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) && (isset($attributes['VALUE']))) {
1520                 // Numerical index
1521                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1522                 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) {
1523                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array();
1524                 } // END - if
1525                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $attributes['VALUE'];
1526         } elseif ((count($attributes) == 1) && (isset($attributes['TYPE']))) {
1527                 // Only TYPE found
1528                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',TYPE[' . gettype($attributes['TYPE']) . ']=' . $attributes['TYPE'] . ' - TYPE-ONLY!');
1529                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $attributes['TYPE'];
1530         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1531                 // Already created
1532                 reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, TRUE) . '</pre>');
1533         } else {
1534                 // Use from NAME
1535                 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1536                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1537         }
1538         //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1539 }
1540
1541 //-----------------------------------------------------------------------------
1542 //                            Execute call-back functions
1543 //-----------------------------------------------------------------------------
1544
1545 // Execute function for doXmlCallbackFunction()
1546 function doXmlCallbackFunctionExecute ($callbackName, $args, $columnIndex, $content) {
1547         // Is 'id_index' set and form sent?
1548         if ((isset($args['id_index'])) && (isFormSent())) {
1549                 // Prepare 'id_index'
1550                 $args['id_index'] = postRequestElement($args['id_index']);
1551         } // END - if
1552
1553         // Add content
1554         $args['_content'] = $content;
1555
1556         // Just call it
1557         //* DEBUG: */ die(__FUNCTION__.':callbackFunction=' . $callbackName . ',<br />columnIndex=' . $columnIndex . ',<br />args(' . count($args) . ')=<pre>'.print_r($args, TRUE).'</pre>');
1558         //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'Called!');
1559         call_user_func_array($callbackName, $args);
1560 }
1561
1562 // For 'doing' add referral level, the column-index is required
1563 function addXmlSpecialAdminAddDoReferralLevels () {
1564         // So set it all here
1565         $GLOBALS['__COLUMN_INDEX']['doXmlCallbackFunction']  = 'column';
1566         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_index'] = 'column';
1567 }
1568
1569 // [EOF]
1570 ?>