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 'where-select-from-list-entry'
632 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
633 // There are five attributes, by default
634 if (count($attributes) != 5) {
635 // Not the right count
636 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
637 } elseif (!isset($attributes['TYPE'])) {
639 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
640 } elseif (!isset($attributes['TABLE'])) {
642 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
643 } elseif (!isset($attributes['VALUE'])) {
645 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
646 } elseif (!isset($attributes['CONDITION'])) {
647 // 'CONDITION' not found
648 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
649 } elseif (!isset($attributes['LOOK-FOR'])) {
650 // 'LOOK-FOR' not found
651 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
652 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
654 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
655 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
656 // 'TABLE' not valid/verifyable
657 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
658 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
659 // 'VALUE' not valid/verifyable
660 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
661 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
662 // 'CONDITION' not valid/verifyable
663 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
664 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['LOOK-FOR'])) {
665 // 'LOOK-FOR' not valid/verifyable
666 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute LOOK-FOR does not validate. LOOK-FOR=' . $attributes['LOOK-FOR']);
667 } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
668 // 'CONDITION' is not known
669 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. LOOK-FOR=' . $attributes['CONDITION']);
670 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
671 // doXmlCallbackFunction is missing
672 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
675 // Add the entry to the array
676 addXmlValueToCallbackAttributes('where_select_list', $attributes);
679 // Handles the XML node 'order-by-list'
680 function doXmlOrderByList ($resource, $attributes) {
681 // There should be no attributes
682 if (count($attributes) > 0) {
683 // Please don't add any attributes to foo-list nodes
684 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
685 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
686 // doXmlCallbackFunction is missing
687 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
691 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
694 // Handles the XML node 'order-by-list-entry'
695 function doXmlOrderByListEntry ($resource, $attributes) {
696 // There are four attributes, by default
697 if (count($attributes) != 4) {
698 // Not the right count
699 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
700 } elseif (!isset($attributes['ORDER'])) {
702 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
703 } elseif (!isset($attributes['TYPE'])) {
705 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
706 } elseif (!isset($attributes['TABLE'])) {
708 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
709 } elseif (!isset($attributes['VALUE'])) {
711 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
712 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
714 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
715 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
716 // 'ORDER' not valid/verifyable
717 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
718 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
719 // 'TABLE' not valid/verifyable
720 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
721 } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
722 // 'VALUE' not valid/verifyable
723 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
724 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
725 // doXmlCallbackFunction is missing
726 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
729 // Add the entry to the array
730 addXmlValueToCallbackAttributes('order_by_list', $attributes);
733 // Handles the XML node 'list-template'
734 function doXmlListTemplate ($resource, $attributes) {
735 // There are two attributes, by default
736 if (count($attributes) != 2) {
737 // Not the right count
738 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
739 } elseif (!isset($attributes['VALUE'])) {
741 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
742 } elseif (!isset($attributes['TYPE'])) {
744 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
745 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
747 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
748 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
749 // Not valid/verifyable
750 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
751 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
752 // doXmlCallbackFunction is missing
753 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
756 // Add the entry to the array
757 addXmlValueToCallbackAttributes('list_template', $attributes);
760 // Handles the XML node 'list-row-template'
761 function doXmlListRowTemplate ($resource, $attributes) {
762 // There are two attributes, by default
763 if (count($attributes) != 2) {
764 // Not the right count
765 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
766 } elseif (!isset($attributes['VALUE'])) {
768 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
769 } elseif (!isset($attributes['TYPE'])) {
771 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
772 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
774 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
775 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
776 // Not valid/verifyable
777 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
778 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
779 // doXmlCallbackFunction is missing
780 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
783 // Add the entry to the array
784 addXmlValueToCallbackAttributes('list_row_template', $attributes);
787 // Handles the XML node 'column-callback-list'
788 function doXmlColumnCallbackList ($resource, $attributes) {
789 // There should be no attributes
790 if (count($attributes) > 0) {
791 // Please don't add any attributes to foo-list nodes
792 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
793 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
794 // doXmlCallbackFunction is missing
795 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
799 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
802 // Handles the XML node 'column-callback-list-entry'
803 function doXmlColumnCallbackListEntry ($resource, $attributes) {
804 // There should be no attributes
805 if (count($attributes) > 0) {
806 // Please don't add any attributes to foo-list nodes
807 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
808 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
809 // doXmlCallbackFunction is missing
810 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
814 // Handles the XML node 'column-callback-data'
815 function doXmlColumnCallbackData ($resource, $attributes) {
816 // There are three attributes, by default
817 if (count($attributes) != 3) {
818 // Not the right count
819 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
820 } elseif (!isset($attributes['VALUE'])) {
822 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
823 } elseif (!isset($attributes['TYPE'])) {
825 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
826 } elseif (!isset($attributes['CALLBACK'])) {
827 // 'CALLBACK' not found
828 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
829 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
831 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
832 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
833 // Not valid/verifyable
834 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
835 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
836 // doXmlCallbackFunction is missing
837 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
838 } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
839 // 'CALLBACK' not valid/verifyable
840 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
843 // Add the entry to the array
844 addXmlValueToCallbackAttributes('column_callback_list', $attributes);
847 // Handles the XML node 'callback-extra-parameter-list'
848 function doXmlCallbackExtraParameterList ($resource, $attributes) {
849 // There should be no attributes
850 if (count($attributes) > 0) {
851 // Please don't add any attributes to foo-list nodes
852 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
853 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
854 // doXmlCallbackFunction is missing
855 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
856 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
857 // Abort silently here, no one wants to kill this array
862 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
865 // Handles the XML node 'callback-extra-parameter-list-entry'
866 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
867 // There are three attributes, by default
868 if (count($attributes) != 3) {
869 // Not the right count
870 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
871 } elseif (!isset($attributes['COLUMN'])) {
872 // 'COLUMN' not found
873 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
874 } elseif (!isset($attributes['TYPE'])) {
876 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
877 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
879 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
880 } elseif (!isset($attributes['VALUE'])) {
882 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
883 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
884 // 'VALUE' not valid/verifyable
885 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
886 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
887 // doXmlCallbackFunction is missing
888 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
891 // Add the entry to the array
892 addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
895 // Handles the XML node 'no-entry-found-message'
896 function doXmlNoEntryFoundMessage ($resource, $attributes) {
897 // There are two attributes, by default
898 if (count($attributes) != 2) {
899 // Not the right count
900 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
901 } elseif (!isset($attributes['VALUE'])) {
903 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
904 } elseif (!isset($attributes['TYPE'])) {
906 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
907 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
909 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
910 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
911 // Not valid/verifyable
912 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
913 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
914 // doXmlCallbackFunction is missing
915 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
918 // Add the entry to the array
919 addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
922 //-----------------------------------------------------------------------------
923 // XML type validation
924 //-----------------------------------------------------------------------------
926 // Checks for string without any added extra data
927 function isXmlTypeString ($value) {
928 // Just let SQL_ESCAPE() do the job
929 return ($value == SQL_ESCAPE($value));
932 // Fake-check for array type
933 function isXmlTypeArray ($value) {
934 // This value is always a string
935 return (is_string($value));
938 // Check for boolean type
939 function isXmlTypeBool ($value) {
941 $value = trim($value);
943 // This value is always a string
944 return (($value == 'true') || ($value == 'false'));
947 // Check for integer type
948 function isXmlTypeInt ($value) {
950 $value = trim($value);
952 // This value is always a string
953 return (bigintval($value) == $value);
956 //-----------------------------------------------------------------------------
957 // Private XML functions
958 //-----------------------------------------------------------------------------
960 // Adds given attribut to element
961 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
962 // What do we need to add?
963 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
964 if ($attributes['TYPE'] == 'array') {
965 // Another nested array
966 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=ARRAY, element=' . $element);
967 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
968 } elseif (!empty($extraKey)) {
970 if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
971 // Then convert VALUE
972 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
975 // Sub-array (one level only)
976 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
977 if (trim($attributes['NAME']) == '') {
979 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
980 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE'];
981 } elseif (!empty($key)) {
983 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
984 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
987 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
988 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
990 } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
992 * ALIAS and FUNCTION detected? This may happen with SQL queries
993 * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
997 'column' => trim($attributes['VALUE']),
998 'alias' => trim($attributes['ALIAS']),
999 'function' => trim($attributes['FUNCTION']),
1000 'table' => trim($attributes['TABLE'])
1004 /* 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'] . ')');
1005 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1006 } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
1007 // CONDITION/LOOK-FOR detected
1010 'column' => trim($attributes['VALUE']),
1011 'table' => trim($attributes['TABLE']),
1012 'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1013 'look_for' => trim($attributes['LOOK-FOR'])
1016 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ',LOOK-FOR[' . gettype($attributes['LOOK-FOR']) . ']=' . $attributes['LOOK-FOR'] . ' - CONDITION! (VALUE=' . $attributes['VALUE'] . ')');
1017 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1018 } elseif (isset($attributes['CALLBACK'])) {
1019 // CALLBACK/VALUE detected
1020 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1021 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1022 } elseif (isset($attributes['ORDER'])) {
1023 // ORDER/TABLE detected
1024 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1025 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1026 } elseif (isset($attributes['COLUMN'])) {
1027 // COLUMN/VALUE detected
1028 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
1029 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE'];
1030 } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) {
1032 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1033 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE'];
1034 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1036 debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
1039 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1040 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1042 /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1045 //-----------------------------------------------------------------------------
1046 // Execute call-back functions
1047 //-----------------------------------------------------------------------------
1049 // Execute function for doXmlCallbackFunction()
1050 function doXmlCallbackFunctionExecute ($function, $args) {
1051 // Is 'id_index' set and form sent?
1052 if ((isset($args['id_index'])) && (isFormSent())) {
1053 // Prepare 'id_index'
1054 $args['id_index'] = postRequestParameter($args['id_index']);
1058 //* DEBUG: */ die('<pre>'.print_r($args, true).'</pre>');
1059 call_user_func_array($function, $args);