2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 07/08/2011 *
4 * =================== Last change: 07/08/2011 *
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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 *
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. *
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. *
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, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
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));
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'])) {
60 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
61 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
63 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
64 } elseif (!isset($attributes['VALUE'])) {
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']);
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();
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'])) {
86 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
87 } elseif (!isset($attributes['TYPE'])) {
89 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
90 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
92 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
93 } elseif (!isset($attributes['VALUE'])) {
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.');
104 // Add the POST data index for 'id'
105 addXmlValueToCallbackAttributes('id_index', $attributes);
106 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['id_index'] = $attributes['VALUE'];
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'])) {
117 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
118 } elseif (!isset($attributes['TYPE'])) {
120 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
121 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
123 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
124 } elseif (!isset($attributes['VALUE'])) {
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.');
135 // Add the entry to the list
136 addXmlValueToCallbackAttributes('database_table', $attributes);
137 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['database_table'] = $attributes['VALUE'];
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));
149 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'] = array();
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'])) {
160 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
161 } elseif (!isset($attributes['TYPE'])) {
163 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
164 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
166 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
167 } elseif (!isset($attributes['VALUE'])) {
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.');
178 // Add the entry to the list
179 addXmlValueToCallbackAttributes('column_list', $attributes);
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));
191 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array();
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'])) {
202 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
203 } elseif (!isset($attributes['TYPE'])) {
205 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
206 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
208 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
209 } elseif (!isset($attributes['VALUE'])) {
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.');
220 // Add the entry to the list
221 addXmlValueToCallbackAttributes('callback_list', $attributes);
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));
233 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array();
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'])) {
244 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
245 } elseif (!isset($attributes['TYPE'])) {
247 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
248 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
250 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
251 } elseif (!isset($attributes['VALUE'])) {
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.');
262 // Add the entry to the list
263 addXmlValueToCallbackAttributes('extra_list', $attributes);
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.');
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'])) {
286 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
287 } elseif (!isset($attributes['TYPE'])) {
289 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
290 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
292 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
293 } elseif (!isset($attributes['VALUE'])) {
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.');
304 // Add the entry to the list
305 addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
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'])) {
316 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
317 } elseif (!isset($attributes['TYPE'])) {
319 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
320 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
322 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
323 } elseif (!isset($attributes['VALUE'])) {
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.');
334 // Add the entry to the list
335 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
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.');
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'])) {
358 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
359 } elseif (!isset($attributes['TYPE'])) {
361 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
362 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
364 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
365 } elseif (!isset($attributes['VALUE'])) {
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.');
379 // Add the entry to the list
380 addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
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'])) {
391 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
392 } elseif (!isset($attributes['TYPE'])) {
394 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
395 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
397 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
398 } elseif (!isset($attributes['VALUE'])) {
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.');
409 // Add the entry to the list
410 addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
411 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['enable_modify_entries'] = convertStringToBoolean($attributes['VALUE']);
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'])) {
422 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
423 } elseif (!isset($attributes['TYPE'])) {
425 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
426 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
428 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
429 } elseif (!isset($attributes['VALUE'])) {
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.');
440 // Add the entry to the array
441 addXmlValueToCallbackAttributes('table_id_column', $attributes);
442 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_id_column'] = $attributes['VALUE'];
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'])) {
453 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
454 } elseif (!isset($attributes['TYPE'])) {
456 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
457 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
459 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
460 } elseif (!isset($attributes['VALUE'])) {
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.');
471 // Add the entry to the array
472 addXmlValueToCallbackAttributes('table_userid_column', $attributes);
473 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_userid_column'] = $attributes['VALUE'];
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'])) {
484 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
485 } elseif (!isset($attributes['TYPE'])) {
487 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
488 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
490 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
491 } elseif (!isset($attributes['VALUE'])) {
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.');
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'];
507 //-----------------------------------------------------------------------------
508 // Call-back functions for listing of data in admin area
509 //-----------------------------------------------------------------------------
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));
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));
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'])) {
537 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
538 } elseif (!isset($attributes['TYPE'])) {
540 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
541 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
543 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
544 } elseif (!isset($attributes['ALIAS'])) {
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.');
558 // Add the entry to the array
559 addXmlValueToCallbackAttributes('data_table', $attributes);
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.');
574 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
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'])) {
585 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
586 } elseif (!isset($attributes['TYPE'])) {
588 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
589 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
591 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
592 } elseif (!isset($attributes['ALIAS'])) {
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.');
612 // Add the entry to the array
613 addXmlValueToCallbackAttributes('data_column_list', $attributes);
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.');
628 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
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.');
643 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
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'])) {
654 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
655 } elseif (!isset($attributes['TYPE'])) {
657 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
658 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
660 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
661 } elseif (!isset($attributes['TABLE'])) {
663 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
664 } elseif (!isset($attributes['VALUE'])) {
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.');
681 // Add the entry to the array
682 addXmlValueToCallbackAttributes('order_by_list', $attributes);
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'])) {
693 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
694 } elseif (!isset($attributes['TYPE'])) {
696 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
697 } elseif (!isInvalidXmlType($attributes['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.');
708 // Add the entry to the array
709 addXmlValueToCallbackAttributes('list_template', $attributes);
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'])) {
720 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
721 } elseif (!isset($attributes['TYPE'])) {
723 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
724 } elseif (!isInvalidXmlType($attributes['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.');
735 // Add the entry to the array
736 addXmlValueToCallbackAttributes('list_row_template', $attributes);
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.');
751 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
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.');
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'])) {
774 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
775 } elseif (!isset($attributes['TYPE'])) {
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'])) {
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']);
795 // Add the entry to the array
796 addXmlValueToCallbackAttributes('column_callback_list', $attributes);
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
814 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
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'])) {
828 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
829 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
831 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
832 } elseif (!isset($attributes['VALUE'])) {
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.');
843 // Add the entry to the array
844 addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
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'])) {
855 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
856 } elseif (!isset($attributes['TYPE'])) {
858 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
859 } elseif (!isInvalidXmlType($attributes['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.');
870 // Add the entry to the array
871 addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
874 //-----------------------------------------------------------------------------
875 // XML type validation
876 //-----------------------------------------------------------------------------
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));
884 // Fake-check for array type
885 function isXmlTypeArray ($value) {
886 // This value is always a string
887 return (is_string($value));
890 // Check for boolean type
891 function isXmlTypeBool ($value) {
893 $value = trim($value);
895 // This value is always a string
896 return (($value == 'true') || ($value == 'false'));
899 // Check for integer type
900 function isXmlTypeInt ($value) {
902 $value = trim($value);
904 // This value is always a string
905 return (bigintval($value) == $value);
908 //-----------------------------------------------------------------------------
909 // Private XML functions
910 //-----------------------------------------------------------------------------
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)) {
922 if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
923 // Then convert VALUE
924 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
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']) == '') {
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)) {
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'];
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'];
942 } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
944 * ALIAS and FUNCTION detected? This may happen with SQL queries
945 * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
949 'column' => trim($attributes['VALUE']),
950 'alias' => trim($attributes['ALIAS']),
951 'function' => trim($attributes['FUNCTION']),
952 'table' => trim($attributes['TABLE'])
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']) == '')) {
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']])) {
976 debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
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'];
982 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
985 //-----------------------------------------------------------------------------
986 // Execute call-back functions
987 //-----------------------------------------------------------------------------
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']);
998 //* DEBUG: */ die('<pre>'.print_r($args, true).'</pre>');
999 call_user_func_array($function, $args);