Extension ext-surfbar continued, fixes:
[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 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Handles the XML node 'admin-entry-meta-data'
44 function doXmlAdminEntryMetaData ($resource, $attributes) {
45         // There should be no attributes
46         if (count($attributes) > 0) {
47                 // Please don't add any attributes to foo-list nodes
48                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
49         } // END - if
50 }
51
52 // Handles the XML node 'callback-function'
53 function doXmlCallbackFunction ($resource, $attributes) {
54         // There are two attributes, by default
55         if (count($attributes) != 2) {
56                 // Not the right count
57                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
58         } elseif (!isset($attributes['TYPE'])) {
59                 // 'TYPE' not found
60                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
61         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
62                 // No valid type
63                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
64         } elseif (!isset($attributes['VALUE'])) {
65                 // 'VALUE' not found
66                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
67         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
68                 // Not valid/verifyable
69                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
70         }
71
72         // Add the function name and no attributes by default
73         $GLOBALS['__XML_CALLBACKS']['callbacks'][] = __FUNCTION__;
74         $GLOBALS['__XML_CALLBACKS']['functions'][__FUNCTION__][] = $attributes['VALUE'];
75         $GLOBALS['__XML_ARGUMENTS'][__FUNCTION__] = array();
76 }
77
78 // Handles the XML node 'post-data-identify-index'
79 function doXmlPostDataIdentifyIndex ($resource, $attributes) {
80         // There are three attributes, by default
81         if (count($attributes) != 3) {
82                 // Not the right count
83                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
84         } elseif (!isset($attributes['NAME'])) {
85                 // 'NAME' not found
86                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
87         } elseif (!isset($attributes['TYPE'])) {
88                 // 'TYPE' not found
89                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
90         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
91                 // No valid type
92                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
93         } elseif (!isset($attributes['VALUE'])) {
94                 // 'VALUE' not found
95                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
96         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
97                 // Not valid/verifyable
98                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
99         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
100                 // doXmlCallbackFunction is missing
101                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
102         }
103
104         // Add the POST data index for 'id'
105         addXmlValueToCallbackAttributes('id_index', $attributes);
106         //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['id_index'] = $attributes['VALUE'];
107 }
108
109 // Handles the XML node 'database-table'
110 function doXmlDatabaseTable ($resource, $attributes) {
111         // There are three attributes, by default
112         if (count($attributes) != 3) {
113                 // Not the right count
114                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
115         } elseif (!isset($attributes['NAME'])) {
116                 // 'NAME' not found
117                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
118         } elseif (!isset($attributes['TYPE'])) {
119                 // 'TYPE' not found
120                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
121         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
122                 // No valid type
123                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
124         } elseif (!isset($attributes['VALUE'])) {
125                 // 'VALUE' not found
126                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
127         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
128                 // Not valid/verifyable
129                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
130         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
131                 // doXmlCallbackFunction is missing
132                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
133         }
134
135         // Add the entry to the list
136         addXmlValueToCallbackAttributes('database_table', $attributes);
137         //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['database_table'] = $attributes['VALUE'];
138 }
139
140 // Handles the XML node 'database-column-list'
141 function doXmlDatabaseColumnList ($resource, $attributes) {
142         // There should be no attributes
143         if (count($attributes) > 0) {
144                 // Please don't add any attributes to foo-list nodes
145                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
146         } // END - if
147
148         // Add an empty list
149         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'] = array();
150 }
151
152 // Handles the XML node 'database-column-list-entry'
153 function doXmlDatabaseColumnListEntry ($resource, $attributes) {
154         // There are three attributes, by default
155         if (count($attributes) != 3) {
156                 // Not the right count
157                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
158         } elseif (!isset($attributes['NAME'])) {
159                 // 'NAME' not found
160                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
161         } elseif (!isset($attributes['TYPE'])) {
162                 // 'TYPE' not found
163                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
164         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
165                 // No valid type
166                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
167         } elseif (!isset($attributes['VALUE'])) {
168                 // 'VALUE' not found
169                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
170         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
171                 // Not valid/verifyable
172                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
173         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'])) {
174                 // doXmlCallbackFunction is missing
175                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/database-column-list not included around this node. Please fix your XML.');
176         }
177
178         // Add the entry to the list
179         addXmlValueToCallbackAttributes('column_list', $attributes);
180 }
181
182 // Handles the XML node 'callback-function-list'
183 function doXmlCallbackFunctionList ($resource, $attributes) {
184         // There should be no attributes
185         if (count($attributes) > 0) {
186                 // Please don't add any attributes to foo-list nodes
187                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
188         } // END - if
189
190         // Add an empty list
191         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array();
192 }
193
194 // Handles the XML node 'callback-function-list-entry'
195 function doXmlCallbackFunctionListEntry ($resource, $attributes) {
196         // There are three attributes, by default
197         if (count($attributes) != 3) {
198                 // Not the right count
199                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
200         } elseif (!isset($attributes['NAME'])) {
201                 // 'NAME' not found
202                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
203         } elseif (!isset($attributes['TYPE'])) {
204                 // 'TYPE' not found
205                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
206         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
207                 // No valid type
208                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
209         } elseif (!isset($attributes['VALUE'])) {
210                 // 'VALUE' not found
211                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
212         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
213                 // Not valid/verifyable
214                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
215         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'])) {
216                 // doXmlCallbackFunction is missing
217                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/callback-function-list not included around this node. Please fix your XML.');
218         }
219
220         // Add the entry to the list
221         addXmlValueToCallbackAttributes('callback_list', $attributes);
222 }
223
224 // Handles the XML node 'extra-parameter-list'
225 function doXmlExtraParameterList ($resource, $attributes) {
226         // There should be no attributes
227         if (count($attributes) > 0) {
228                 // Please don't add any attributes to foo-list nodes
229                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
230         } // END - if
231
232         // Add an empty list
233         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array();
234 }
235
236 // Handles the XML node 'extra-parameter-list-entry'
237 function doXmlExtraParameterListEntry ($resource, $attributes) {
238         // There are three attributes, by default
239         if (count($attributes) != 3) {
240                 // Not the right count
241                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
242         } elseif (!isset($attributes['NAME'])) {
243                 // 'NAME' not found
244                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
245         } elseif (!isset($attributes['TYPE'])) {
246                 // 'TYPE' not found
247                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
248         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
249                 // No valid type
250                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
251         } elseif (!isset($attributes['VALUE'])) {
252                 // 'VALUE' not found
253                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
254         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
255                 // Not valid/verifyable
256                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
257         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'])) {
258                 // doXmlCallbackFunction is missing
259                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
260         }
261
262         // Add the entry to the list
263         addXmlValueToCallbackAttributes('extra_list', $attributes);
264 }
265
266 // Handles the XML node 'extra-parameter-member-list'
267 function doXmlExtraParameterMemberList ($resource, $attributes) {
268         // There should be no attributes
269         if (count($attributes) > 0) {
270                 // Please don't add any attributes to foo-list nodes
271                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
272         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
273                 // This list should be created already
274                 debug_report_bug(__FUNCTION__, __LINE__, 'member_list should be already created.');
275         }
276 }
277
278 // Handles the XML node 'extra-parameter-member-list-entry'
279 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
280         // There are three attributes, by default
281         if (count($attributes) != 3) {
282                 // Not the right count
283                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
284         } elseif (!isset($attributes['NAME'])) {
285                 // 'NAME' not found
286                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
287         } elseif (!isset($attributes['TYPE'])) {
288                 // 'TYPE' not found
289                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
290         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
291                 // No valid type
292                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
293         } elseif (!isset($attributes['VALUE'])) {
294                 // 'VALUE' not found
295                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
296         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
297                 // Not valid/verifyable
298                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
299         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
300                 // doXmlCallbackFunction is missing
301                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
302         }
303
304         // Add the entry to the list
305         addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
306 }
307
308 // Handles the XML node 'status-change-column'
309 function doXmlStatusChangeColumn ($resource, $attributes) {
310         // There are three attributes, by default
311         if (count($attributes) != 3) {
312                 // Not the right count
313                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
314         } elseif (!isset($attributes['NAME'])) {
315                 // 'NAME' not found
316                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
317         } elseif (!isset($attributes['TYPE'])) {
318                 // 'TYPE' not found
319                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
320         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
321                 // No valid type
322                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
323         } elseif (!isset($attributes['VALUE'])) {
324                 // 'VALUE' not found
325                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
326         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
327                 // Not valid/verifyable
328                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
329         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
330                 // doXmlCallbackFunction is missing
331                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
332         }
333
334         // Add the entry to the list
335         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
336 }
337
338 // Handles the XML node 'status-change-list'
339 function doXmlStatusChangeList ($resource, $attributes) {
340         // There should be no attributes
341         if (count($attributes) > 0) {
342                 // Please don't add any attributes to foo-list nodes
343                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
344         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
345                 // doXmlCallbackFunction is missing
346                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.');
347         }
348 }
349
350 // Handles the XML node 'status-change-list-entry'
351 function doXmlStatusChangeListEntry ($resource, $attributes) {
352         // There are for attributes, by default
353         if (count($attributes) != 4) {
354                 // Not the right count
355                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 4 attributes, got ' . count($attributes));
356         } elseif (!isset($attributes['NAME'])) {
357                 // 'NAME' not found
358                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
359         } elseif (!isset($attributes['TYPE'])) {
360                 // 'TYPE' not found
361                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
362         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
363                 // No valid type
364                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
365         } elseif (!isset($attributes['VALUE'])) {
366                 // 'VALUE' not found
367                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
368         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['OLD'])) {
369                 // Not valid/verifyable
370                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
371         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
372                 // Not valid/verifyable
373                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
374         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
375                 // doXmlCallbackFunction is missing
376                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
377         }
378
379         // Add the entry to the list
380         addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
381 }
382
383 // Handles the XML node 'enable-modify-entries'
384 function doXmlEnableModifyEntries ($resource, $attributes) {
385         // There are three attributes, by default
386         if (count($attributes) != 3) {
387                 // Not the right count
388                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
389         } elseif (!isset($attributes['NAME'])) {
390                 // 'NAME' not found
391                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
392         } elseif (!isset($attributes['TYPE'])) {
393                 // 'TYPE' not found
394                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
395         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
396                 // No valid type
397                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
398         } elseif (!isset($attributes['VALUE'])) {
399                 // 'VALUE' not found
400                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
401         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
402                 // Not valid/verifyable
403                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
404         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
405                 // doXmlCallbackFunction is missing
406                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
407         }
408
409         // Add the entry to the list
410         addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
411         //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['enable_modify_entries'] = convertStringToBoolean($attributes['VALUE']);
412 }
413
414 // Handles the XML node 'table-id-column'
415 function doXmlTableIdColumn ($resource, $attributes) {
416         // There are three attributes, by default
417         if (count($attributes) != 3) {
418                 // Not the right count
419                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
420         } elseif (!isset($attributes['NAME'])) {
421                 // 'NAME' not found
422                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
423         } elseif (!isset($attributes['TYPE'])) {
424                 // 'TYPE' not found
425                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
426         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
427                 // No valid type
428                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
429         } elseif (!isset($attributes['VALUE'])) {
430                 // 'VALUE' not found
431                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
432         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
433                 // Not valid/verifyable
434                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
435         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
436                 // doXmlCallbackFunction is missing
437                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
438         }
439
440         // Add the entry to the array
441         addXmlValueToCallbackAttributes('table_id_column', $attributes);
442         //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_id_column'] = $attributes['VALUE'];
443 }
444
445 // Handles the XML node 'table-userid-column'
446 function doXmlTableUseridColumn ($resource, $attributes) {
447         // There are three attributes, by default
448         if (count($attributes) != 3) {
449                 // Not the right count
450                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
451         } elseif (!isset($attributes['NAME'])) {
452                 // 'NAME' not found
453                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
454         } elseif (!isset($attributes['TYPE'])) {
455                 // 'TYPE' not found
456                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
457         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
458                 // No valid type
459                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
460         } elseif (!isset($attributes['VALUE'])) {
461                 // 'VALUE' not found
462                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
463         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
464                 // Not valid/verifyable
465                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
466         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
467                 // doXmlCallbackFunction is missing
468                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
469         }
470
471         // Add the entry to the array
472         addXmlValueToCallbackAttributes('table_userid_column', $attributes);
473         //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_userid_column'] = $attributes['VALUE'];
474 }
475
476 // Handles the XML node 'raw-userid-column-key'
477 function doXmlRawUseridColumnKey ($resource, $attributes) {
478         // There are three attributes, by default
479         if (count($attributes) != 3) {
480                 // Not the right count
481                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
482         } elseif (!isset($attributes['NAME'])) {
483                 // 'NAME' not found
484                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
485         } elseif (!isset($attributes['TYPE'])) {
486                 // 'TYPE' not found
487                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
488         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
489                 // No valid type
490                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
491         } elseif (!isset($attributes['VALUE'])) {
492                 // 'VALUE' not found
493                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
494         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
495                 // Not valid/verifyable
496                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
497         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
498                 // doXmlCallbackFunction is missing
499                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
500         }
501
502         // Add the entry to the array
503         addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes);
504         //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['raw_userid_column_key'] = $attributes['VALUE'];
505 }
506
507 //-----------------------------------------------------------------------------
508 //           Call-back functions for listing of data in admin area
509 //-----------------------------------------------------------------------------
510
511 // Handles the XML node 'admin-list-data'
512 function doXmlAdminListData ($resource, $attributes) {
513         // There should be no attributes
514         if (count($attributes) > 0) {
515                 // Please don't add any attributes to foo-list nodes
516                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
517         } // END - if
518 }
519
520 // Handles the XML node 'data-tables'
521 function doXmlDataTables ($resource, $attributes) {
522         // There should be no attributes
523         if (count($attributes) > 0) {
524                 // Please don't add any attributes to foo-list nodes
525                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
526         } // END - if
527 }
528
529 // Handles the XML node 'data-table'
530 function doXmlDataTable ($resource, $attributes) {
531         // There are three attributes, by default
532         if (count($attributes) != 3) {
533                 // Not the right count
534                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
535         } elseif (!isset($attributes['VALUE'])) {
536                 // 'VALUE' not found
537                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
538         } elseif (!isset($attributes['TYPE'])) {
539                 // 'TYPE' not found
540                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
541         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
542                 // No valid type
543                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
544         } elseif (!isset($attributes['ALIAS'])) {
545                 // 'ALIAS' not found
546                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
547         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
548                 // Not valid/verifyable
549                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
550         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
551                 // Not valid/verifyable
552                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
553         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
554                 // doXmlCallbackFunction is missing
555                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
556         }
557
558         // Add the entry to the array
559         addXmlValueToCallbackAttributes('data_table', $attributes);
560 }
561
562 // Handles the XML node 'select-data-from-list'
563 function doXmlSelectDataFromList ($resource, $attributes) {
564         // There should be no attributes
565         if (count($attributes) > 0) {
566                 // Please don't add any attributes to foo-list nodes
567                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
568         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
569                 // doXmlCallbackFunction is missing
570                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
571         }
572
573         // Add an empty list
574         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
575 }
576
577 // Handles the XML node 'select-data-from-list-entry'
578 function doXmlSelectDataFromListEntry ($resource, $attributes) {
579         // There are five attributes, by default
580         if (count($attributes) != 5) {
581                 // Not the right count
582                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
583         } elseif (!isset($attributes['VALUE'])) {
584                 // 'VALUE' not found
585                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
586         } elseif (!isset($attributes['TYPE'])) {
587                 // 'TYPE' not found
588                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
589         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
590                 // No valid type
591                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
592         } elseif (!isset($attributes['ALIAS'])) {
593                 // 'ALIAS' not found
594                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
595         } elseif (!isset($attributes['FUNCTION'])) {
596                 // 'FUNCTION' not found
597                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
598         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
599                 // 'VALUE' not valid/verifyable
600                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
601         } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
602                 // 'ALIAS' not valid/verifyable
603                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
604         } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
605                 // 'FUNCTION' not valid/verifyable
606                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
607         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
608                 // doXmlCallbackFunction is missing
609                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
610         }
611
612         // Add the entry to the array
613         addXmlValueToCallbackAttributes('data_column_list', $attributes);
614 }
615
616 // Handles the XML node 'where-select-from-list'
617 function doXmlWhereSelectFromList ($resource, $attributes) {
618         // There should be no attributes
619         if (count($attributes) > 0) {
620                 // Please don't add any attributes to foo-list nodes
621                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
622         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
623                 // doXmlCallbackFunction is missing
624                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
625         }
626
627         // Add an empty list
628         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
629 }
630
631 // Handles the XML node 'order-by-list'
632 function doXmlOrderByList ($resource, $attributes) {
633         // There should be no attributes
634         if (count($attributes) > 0) {
635                 // Please don't add any attributes to foo-list nodes
636                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
637         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
638                 // doXmlCallbackFunction is missing
639                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
640         }
641
642         // Add an empty list
643         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
644 }
645
646 // Handles the XML node 'order-by-list-entry'
647 function doXmlOrderByListEntry ($resource, $attributes) {
648         // There are four attributes, by default
649         if (count($attributes) != 4) {
650                 // Not the right count
651                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
652         } elseif (!isset($attributes['ORDER'])) {
653                 // 'ORDER' not found
654                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
655         } elseif (!isset($attributes['TYPE'])) {
656                 // 'TYPE' not found
657                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
658         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
659                 // No valid type
660                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
661         } elseif (!isset($attributes['TABLE'])) {
662                 // 'TABLE' not found
663                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
664         } elseif (!isset($attributes['VALUE'])) {
665                 // 'VALUE' not found
666                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
667         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
668                 // 'ORDER' not valid/verifyable
669                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
670         } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
671                 // 'TABLE' not valid/verifyable
672                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
673         } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
674                 // 'VALUE' not valid/verifyable
675                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
676         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
677                 // doXmlCallbackFunction is missing
678                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
679         }
680
681         // Add the entry to the array
682         addXmlValueToCallbackAttributes('order_by_list', $attributes);
683 }
684
685 // Handles the XML node 'list-template'
686 function doXmlListTemplate ($resource, $attributes) {
687         // There are two attributes, by default
688         if (count($attributes) != 2) {
689                 // Not the right count
690                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
691         } elseif (!isset($attributes['VALUE'])) {
692                 // 'VALUE' not found
693                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
694         } elseif (!isset($attributes['TYPE'])) {
695                 // 'TYPE' not found
696                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
697         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
698                 // No valid type
699                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
700         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
701                 // Not valid/verifyable
702                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
703         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
704                 // doXmlCallbackFunction is missing
705                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
706         }
707
708         // Add the entry to the array
709         addXmlValueToCallbackAttributes('list_template', $attributes);
710 }
711
712 // Handles the XML node 'list-row-template'
713 function doXmlListRowTemplate ($resource, $attributes) {
714         // There are two attributes, by default
715         if (count($attributes) != 2) {
716                 // Not the right count
717                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
718         } elseif (!isset($attributes['VALUE'])) {
719                 // 'VALUE' not found
720                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
721         } elseif (!isset($attributes['TYPE'])) {
722                 // 'TYPE' not found
723                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
724         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
725                 // No valid type
726                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
727         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
728                 // Not valid/verifyable
729                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
730         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
731                 // doXmlCallbackFunction is missing
732                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
733         }
734
735         // Add the entry to the array
736         addXmlValueToCallbackAttributes('list_row_template', $attributes);
737 }
738
739 // Handles the XML node 'column-callback-list'
740 function doXmlColumnCallbackList ($resource, $attributes) {
741         // There should be no attributes
742         if (count($attributes) > 0) {
743                 // Please don't add any attributes to foo-list nodes
744                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
745         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
746                 // doXmlCallbackFunction is missing
747                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
748         }
749
750         // Add an empty list
751         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
752 }
753
754 // Handles the XML node 'column-callback-list-entry'
755 function doXmlColumnCallbackListEntry ($resource, $attributes) {
756         // There should be no attributes
757         if (count($attributes) > 0) {
758                 // Please don't add any attributes to foo-list nodes
759                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
760         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
761                 // doXmlCallbackFunction is missing
762                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
763         }
764 }
765
766 // Handles the XML node 'column-callback-data'
767 function doXmlColumnCallbackData ($resource, $attributes) {
768         // There are three attributes, by default
769         if (count($attributes) != 3) {
770                 // Not the right count
771                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
772         } elseif (!isset($attributes['VALUE'])) {
773                 // 'VALUE' not found
774                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
775         } elseif (!isset($attributes['TYPE'])) {
776                 // 'TYPE' not found
777                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
778         } elseif (!isset($attributes['CALLBACK'])) {
779                 // 'CALLBACK' not found
780                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
781         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
782                 // No valid type
783                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
784         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
785                 // Not valid/verifyable
786                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
787         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
788                 // doXmlCallbackFunction is missing
789                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
790         } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
791                 // 'CALLBACK' not valid/verifyable
792                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
793         }
794
795         // Add the entry to the array
796         addXmlValueToCallbackAttributes('column_callback_list', $attributes);
797 }
798
799 // Handles the XML node 'callback-extra-parameter-list'
800 function doXmlCallbackExtraParameterList ($resource, $attributes) {
801         // There should be no attributes
802         if (count($attributes) > 0) {
803                 // Please don't add any attributes to foo-list nodes
804                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
805         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
806                 // doXmlCallbackFunction is missing
807                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
808         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
809                 // Abort silently here, no one wants to kill this array
810                 return;
811         }
812
813         // Add an empty list
814         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
815 }
816
817 // Handles the XML node 'callback-extra-parameter-list-entry'
818 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
819         // There are three attributes, by default
820         if (count($attributes) != 3) {
821                 // Not the right count
822                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
823         } elseif (!isset($attributes['COLUMN'])) {
824                 // 'COLUMN' not found
825                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
826         } elseif (!isset($attributes['TYPE'])) {
827                 // 'TYPE' not found
828                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
829         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
830                 // No valid type
831                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
832         } elseif (!isset($attributes['VALUE'])) {
833                 // 'VALUE' not found
834                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
835         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
836                 // 'VALUE' not valid/verifyable
837                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
838         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
839                 // doXmlCallbackFunction is missing
840                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
841         }
842
843         // Add the entry to the array
844         addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
845 }
846
847 // Handles the XML node 'no-entry-found-message'
848 function doXmlNoEntryFoundMessage ($resource, $attributes) {
849         // There are two attributes, by default
850         if (count($attributes) != 2) {
851                 // Not the right count
852                 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
853         } elseif (!isset($attributes['VALUE'])) {
854                 // 'VALUE' not found
855                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
856         } elseif (!isset($attributes['TYPE'])) {
857                 // 'TYPE' not found
858                 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
859         } elseif (!isInvalidXmlType($attributes['TYPE'])) {
860                 // No valid type
861                 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
862         } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
863                 // Not valid/verifyable
864                 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
865         } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
866                 // doXmlCallbackFunction is missing
867                 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
868         }
869
870         // Add the entry to the array
871         addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
872 }
873
874 //-----------------------------------------------------------------------------
875 //                              XML type validation
876 //-----------------------------------------------------------------------------
877
878 // Checks for string without any added extra data
879 function isXmlTypeString ($value) {
880         // Just let SQL_ESCAPE() do the job
881         return ($value == SQL_ESCAPE($value));
882 }
883
884 // Fake-check for array type
885 function isXmlTypeArray ($value) {
886         // This value is always a string
887         return (is_string($value));
888 }
889
890 // Check for boolean type
891 function isXmlTypeBool ($value) {
892         // Trim value
893         $value = trim($value);
894
895         // This value is always a string
896         return (($value == 'true') || ($value == 'false'));
897 }
898
899 // Check for integer type
900 function isXmlTypeInt ($value) {
901         // Trim value
902         $value = trim($value);
903
904         // This value is always a string
905         return (bigintval($value) == $value);
906 }
907
908 //-----------------------------------------------------------------------------
909 //                               Private XML functions
910 //-----------------------------------------------------------------------------
911
912 // Adds given attribut to element
913 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
914         // What do we need to add?
915         /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
916         if ($attributes['TYPE'] == 'array') {
917                 // Another nested array
918                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=ARRAY, element=' . $element);
919                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
920         } elseif (!empty($extraKey)) {
921                 // Is it bool?
922                 if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
923                         // Then convert VALUE
924                         $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
925                 } // END - if
926
927                 // Sub-array (one level only)
928                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
929                 if (trim($attributes['NAME']) == '') {
930                         // Numerical index
931                         /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
932                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE'];
933                 } elseif (!empty($key)) {
934                         // Use from $key
935                         /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
936                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
937                 } else {
938                         // Use from NAME
939                         /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
940                         $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
941                 }
942         } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
943                 /*
944                  * ALIAS and FUNCTION detected? This may happen with SQL queries
945                  * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
946                  */
947                 // Init array
948                 $array =  array(
949                         'column'   => trim($attributes['VALUE']),
950                         'alias'    => trim($attributes['ALIAS']),
951                         'function' => trim($attributes['FUNCTION']),
952                         'table'    => trim($attributes['TABLE'])
953                 );
954
955                 // Add the entry
956                 /* 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'] . ')');
957                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
958         } elseif (isset($attributes['CALLBACK'])) {
959                 // CALLBACK/VALUE detected
960                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
961                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
962         } elseif (isset($attributes['ORDER'])) {
963                 // ORDER/TABLE detected
964                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
965                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
966         } elseif (isset($attributes['COLUMN'])) {
967                 // COLUMN/VALUE detected
968                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
969                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE'];
970         } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) {
971                 // Numerical index
972                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
973                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE'];
974         } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
975                 // Already created
976                 debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
977         } else {
978                 // Use from NAME
979                 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
980                 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
981         }
982         /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
983 }
984
985 //-----------------------------------------------------------------------------
986 //                            Execute call-back functions
987 //-----------------------------------------------------------------------------
988
989 // Execute function for doXmlCallbackFunction()
990 function doXmlCallbackFunctionExecute ($function, $args) {
991         // Is 'id_index' set and form sent?
992         if ((isset($args['id_index'])) && (isFormSent())) {
993                 // Prepare 'id_index'
994                 $args['id_index'] = postRequestParameter($args['id_index']);
995         } // END - if
996
997         // Just call it
998         //* DEBUG: */ die('<pre>'.print_r($args, true).'</pre>');
999         call_user_func_array($function, $args);
1000 }
1001
1002 // [EOF]
1003 ?>