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 'database-table'
79 function doXmlDatabaseTable ($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 entry to the list
105 addXmlValueToCallbackAttributes('database_table', $attributes);
106 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['database_table'] = $attributes['VALUE'];
109 // Handles the XML node 'database-column-list'
110 function doXmlDatabaseColumnList ($resource, $attributes) {
111 // There should be no attributes
112 if (count($attributes) > 0) {
113 // Please don't add any attributes to foo-list nodes
114 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
118 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'] = array();
121 // Handles the XML node 'database-column-list-entry'
122 function doXmlDatabaseColumnListEntry ($resource, $attributes) {
123 // There are three attributes, by default
124 if (count($attributes) != 3) {
125 // Not the right count
126 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
127 } elseif (!isset($attributes['NAME'])) {
129 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
130 } elseif (!isset($attributes['TYPE'])) {
132 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
133 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
135 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
136 } elseif (!isset($attributes['VALUE'])) {
138 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
139 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
140 // Not valid/verifyable
141 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
142 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'])) {
143 // doXmlCallbackFunction is missing
144 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/database-column-list not included around this node. Please fix your XML.');
147 // Add the entry to the list
148 addXmlValueToCallbackAttributes('column_list', $attributes);
151 // Handles the XML node 'callback-function-list'
152 function doXmlCallbackFunctionList ($resource, $attributes) {
153 // There should be no attributes
154 if (count($attributes) > 0) {
155 // Please don't add any attributes to foo-list nodes
156 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
160 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array();
163 // Handles the XML node 'callback-function-list-entry'
164 function doXmlCallbackFunctionListEntry ($resource, $attributes) {
165 // There are three attributes, by default
166 if (count($attributes) != 3) {
167 // Not the right count
168 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
169 } elseif (!isset($attributes['NAME'])) {
171 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
172 } elseif (!isset($attributes['TYPE'])) {
174 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
175 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
177 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
178 } elseif (!isset($attributes['VALUE'])) {
180 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
181 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
182 // Not valid/verifyable
183 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
184 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'])) {
185 // doXmlCallbackFunction is missing
186 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/callback-function-list not included around this node. Please fix your XML.');
189 // Add the entry to the list
190 addXmlValueToCallbackAttributes('callback_list', $attributes);
193 // Handles the XML node 'extra-parameter-list'
194 function doXmlExtraParameterList ($resource, $attributes) {
195 // There should be no attributes
196 if (count($attributes) > 0) {
197 // Please don't add any attributes to foo-list nodes
198 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
202 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array();
205 // Handles the XML node 'extra-parameter-list-entry'
206 function doXmlExtraParameterListEntry ($resource, $attributes) {
207 // There are three attributes, by default
208 if (count($attributes) != 3) {
209 // Not the right count
210 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
211 } elseif (!isset($attributes['NAME'])) {
213 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
214 } elseif (!isset($attributes['TYPE'])) {
216 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
217 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
219 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
220 } elseif (!isset($attributes['VALUE'])) {
222 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
223 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
224 // Not valid/verifyable
225 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
226 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'])) {
227 // doXmlCallbackFunction is missing
228 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
231 // Add the entry to the list
232 addXmlValueToCallbackAttributes('extra_list', $attributes);
235 // Handles the XML node 'extra-parameter-member-list'
236 function doXmlExtraParameterMemberList ($resource, $attributes) {
237 // There should be no attributes
238 if (count($attributes) > 0) {
239 // Please don't add any attributes to foo-list nodes
240 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
241 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
242 // This list should be created already
243 debug_report_bug(__FUNCTION__, __LINE__, 'member_list should be already created.');
247 // Handles the XML node 'extra-parameter-member-list-entry'
248 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
249 // There are three attributes, by default
250 if (count($attributes) != 3) {
251 // Not the right count
252 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
253 } elseif (!isset($attributes['NAME'])) {
255 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
256 } elseif (!isset($attributes['TYPE'])) {
258 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
259 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
261 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
262 } elseif (!isset($attributes['VALUE'])) {
264 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
265 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
266 // Not valid/verifyable
267 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
268 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
269 // doXmlCallbackFunction is missing
270 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
273 // Add the entry to the list
274 addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
277 // Handles the XML node 'status-change-column'
278 function doXmlStatusChangeColumn ($resource, $attributes) {
279 // There are three attributes, by default
280 if (count($attributes) != 3) {
281 // Not the right count
282 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
283 } elseif (!isset($attributes['NAME'])) {
285 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
286 } elseif (!isset($attributes['TYPE'])) {
288 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
289 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
291 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
292 } elseif (!isset($attributes['VALUE'])) {
294 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
295 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
296 // Not valid/verifyable
297 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
298 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
299 // doXmlCallbackFunction is missing
300 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
303 // Add the entry to the list
304 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
307 // Handles the XML node 'status-change-list'
308 function doXmlStatusChangeList ($resource, $attributes) {
309 // There should be no attributes
310 if (count($attributes) > 0) {
311 // Please don't add any attributes to foo-list nodes
312 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
313 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
314 // doXmlCallbackFunction is missing
315 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.');
319 // Handles the XML node 'status-change-list-entry'
320 function doXmlStatusChangeListEntry ($resource, $attributes) {
321 // There are for attributes, by default
322 if (count($attributes) != 4) {
323 // Not the right count
324 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 4 attributes, got ' . count($attributes));
325 } elseif (!isset($attributes['NAME'])) {
327 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
328 } elseif (!isset($attributes['TYPE'])) {
330 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
331 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
333 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
334 } elseif (!isset($attributes['VALUE'])) {
336 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
337 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['OLD'])) {
338 // Not valid/verifyable
339 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
340 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
341 // Not valid/verifyable
342 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
343 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
344 // doXmlCallbackFunction is missing
345 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
348 // Add the entry to the list
349 addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
352 // Handles the XML node 'enable-modify-entries'
353 function doXmlEnableModifyEntries ($resource, $attributes) {
354 // There are three attributes, by default
355 if (count($attributes) != 3) {
356 // Not the right count
357 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
358 } elseif (!isset($attributes['NAME'])) {
360 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
361 } elseif (!isset($attributes['TYPE'])) {
363 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
364 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
366 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
367 } elseif (!isset($attributes['VALUE'])) {
369 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
370 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
371 // Not valid/verifyable
372 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
373 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
374 // doXmlCallbackFunction is missing
375 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
378 // Add the entry to the list
379 addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
380 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['enable_modify_entries'] = convertStringToBoolean($attributes['VALUE']);
383 // Handles the XML node 'table-id-column'
384 function doXmlTableIdColumn ($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 array
410 addXmlValueToCallbackAttributes('table_id_column', $attributes);
411 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_id_column'] = $attributes['VALUE'];
414 // Handles the XML node 'table-userid-column'
415 function doXmlTableUseridColumn ($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_userid_column', $attributes);
442 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_userid_column'] = $attributes['VALUE'];
445 // Handles the XML node 'raw-userid-column-key'
446 function doXmlRawUseridColumnKey ($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('raw_userid_column_key', $attributes);
473 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['raw_userid_column_key'] = $attributes['VALUE'];
476 //-----------------------------------------------------------------------------
477 // Call-back functions for listing of data in admin area
478 //-----------------------------------------------------------------------------
480 // Handles the XML node 'admin-list-data'
481 function doXmlAdminListData ($resource, $attributes) {
482 // There should be no attributes
483 if (count($attributes) > 0) {
484 // Please don't add any attributes to foo-list nodes
485 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
489 // Handles the XML node 'data-tables'
490 function doXmlDataTables ($resource, $attributes) {
491 // There should be no attributes
492 if (count($attributes) > 0) {
493 // Please don't add any attributes to foo-list nodes
494 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
498 // Handles the XML node 'data-table'
499 function doXmlDataTable ($resource, $attributes) {
500 // There are three attributes, by default
501 if (count($attributes) != 3) {
502 // Not the right count
503 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
504 } elseif (!isset($attributes['VALUE'])) {
506 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
507 } elseif (!isset($attributes['TYPE'])) {
509 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
510 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
512 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
513 } elseif (!isset($attributes['ALIAS'])) {
515 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
516 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
517 // Not valid/verifyable
518 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
519 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
520 // Not valid/verifyable
521 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
522 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
523 // doXmlCallbackFunction is missing
524 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
527 // Add the entry to the array
528 addXmlValueToCallbackAttributes('data_table', $attributes);
531 // Handles the XML node 'select-data-from-list'
532 function doXmlSelectDataFromList ($resource, $attributes) {
533 // There should be no attributes
534 if (count($attributes) > 0) {
535 // Please don't add any attributes to foo-list nodes
536 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
537 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
538 // doXmlCallbackFunction is missing
539 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
543 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
546 // Handles the XML node 'select-data-from-list-entry'
547 function doXmlSelectDataFromListEntry ($resource, $attributes) {
548 // There are five attributes, by default
549 if (count($attributes) != 5) {
550 // Not the right count
551 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
552 } elseif (!isset($attributes['VALUE'])) {
554 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
555 } elseif (!isset($attributes['TYPE'])) {
557 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
558 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
560 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
561 } elseif (!isset($attributes['ALIAS'])) {
563 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
564 } elseif (!isset($attributes['FUNCTION'])) {
565 // 'FUNCTION' not found
566 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
567 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
568 // 'VALUE' not valid/verifyable
569 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
570 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
571 // 'ALIAS' not valid/verifyable
572 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
573 } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
574 // 'FUNCTION' not valid/verifyable
575 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
576 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
577 // doXmlCallbackFunction is missing
578 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
581 // Add the entry to the array
582 addXmlValueToCallbackAttributes('data_column_list', $attributes);
585 // Handles the XML node 'where-select-from-list'
586 function doXmlWhereSelectFromList ($resource, $attributes) {
587 // There should be no attributes
588 if (count($attributes) > 0) {
589 // Please don't add any attributes to foo-list nodes
590 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
591 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
592 // doXmlCallbackFunction is missing
593 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
597 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
600 // Handles the XML node 'where-select-from-list-entry'
601 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
602 // There are five attributes, by default
603 if (count($attributes) != 5) {
604 // Not the right count
605 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
606 } elseif (!isset($attributes['TYPE'])) {
608 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
609 } elseif (!isset($attributes['TABLE'])) {
611 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
612 } elseif (!isset($attributes['VALUE'])) {
614 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
615 } elseif (!isset($attributes['CONDITION'])) {
616 // 'CONDITION' not found
617 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
618 } elseif (!isset($attributes['LOOK-FOR'])) {
619 // 'LOOK-FOR' not found
620 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
621 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
623 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
624 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
625 // 'TABLE' not valid/verifyable
626 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
627 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
628 // 'VALUE' not valid/verifyable
629 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
630 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
631 // 'CONDITION' not valid/verifyable
632 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
633 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['LOOK-FOR'])) {
634 // 'LOOK-FOR' not valid/verifyable
635 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute LOOK-FOR does not validate. LOOK-FOR=' . $attributes['LOOK-FOR']);
636 } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
637 // 'CONDITION' is not known
638 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. LOOK-FOR=' . $attributes['CONDITION']);
639 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
640 // doXmlCallbackFunction is missing
641 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
644 // Add the entry to the array
645 addXmlValueToCallbackAttributes('where_select_list', $attributes);
648 // Handles the XML node 'order-by-list'
649 function doXmlOrderByList ($resource, $attributes) {
650 // There should be no attributes
651 if (count($attributes) > 0) {
652 // Please don't add any attributes to foo-list nodes
653 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
654 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
655 // doXmlCallbackFunction is missing
656 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
660 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
663 // Handles the XML node 'order-by-list-entry'
664 function doXmlOrderByListEntry ($resource, $attributes) {
665 // There are four attributes, by default
666 if (count($attributes) != 4) {
667 // Not the right count
668 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
669 } elseif (!isset($attributes['ORDER'])) {
671 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
672 } elseif (!isset($attributes['TYPE'])) {
674 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
675 } elseif (!isset($attributes['TABLE'])) {
677 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
678 } elseif (!isset($attributes['VALUE'])) {
680 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
681 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
683 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
684 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
685 // 'ORDER' not valid/verifyable
686 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
687 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
688 // 'TABLE' not valid/verifyable
689 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
690 } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
691 // 'VALUE' not valid/verifyable
692 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
693 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
694 // doXmlCallbackFunction is missing
695 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
698 // Add the entry to the array
699 addXmlValueToCallbackAttributes('order_by_list', $attributes);
702 // Handles the XML node 'list-template'
703 function doXmlListTemplate ($resource, $attributes) {
704 // There are two attributes, by default
705 if (count($attributes) != 2) {
706 // Not the right count
707 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
708 } elseif (!isset($attributes['VALUE'])) {
710 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
711 } elseif (!isset($attributes['TYPE'])) {
713 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
714 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
716 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
717 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
718 // Not valid/verifyable
719 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
720 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
721 // doXmlCallbackFunction is missing
722 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
725 // Add the entry to the array
726 addXmlValueToCallbackAttributes('list_template', $attributes);
729 // Handles the XML node 'list-row-template'
730 function doXmlListRowTemplate ($resource, $attributes) {
731 // There are two attributes, by default
732 if (count($attributes) != 2) {
733 // Not the right count
734 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
735 } elseif (!isset($attributes['VALUE'])) {
737 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
738 } elseif (!isset($attributes['TYPE'])) {
740 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
741 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
743 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
744 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
745 // Not valid/verifyable
746 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
747 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
748 // doXmlCallbackFunction is missing
749 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
752 // Add the entry to the array
753 addXmlValueToCallbackAttributes('list_row_template', $attributes);
756 // Handles the XML node 'column-callback-list'
757 function doXmlColumnCallbackList ($resource, $attributes) {
758 // There should be no attributes
759 if (count($attributes) > 0) {
760 // Please don't add any attributes to foo-list nodes
761 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
762 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
763 // doXmlCallbackFunction is missing
764 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
768 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
771 // Handles the XML node 'column-callback-list-entry'
772 function doXmlColumnCallbackListEntry ($resource, $attributes) {
773 // There should be no attributes
774 if (count($attributes) > 0) {
775 // Please don't add any attributes to foo-list nodes
776 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
777 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
778 // doXmlCallbackFunction is missing
779 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
783 // Handles the XML node 'column-callback-data'
784 function doXmlColumnCallbackData ($resource, $attributes) {
785 // There are three attributes, by default
786 if (count($attributes) != 3) {
787 // Not the right count
788 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
789 } elseif (!isset($attributes['VALUE'])) {
791 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
792 } elseif (!isset($attributes['TYPE'])) {
794 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
795 } elseif (!isset($attributes['CALLBACK'])) {
796 // 'CALLBACK' not found
797 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
798 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
800 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
801 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
802 // Not valid/verifyable
803 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
804 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
805 // doXmlCallbackFunction is missing
806 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
807 } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
808 // 'CALLBACK' not valid/verifyable
809 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
812 // Add the entry to the array
813 addXmlValueToCallbackAttributes('column_callback_list', $attributes);
816 // Handles the XML node 'callback-extra-parameter-list'
817 function doXmlCallbackExtraParameterList ($resource, $attributes) {
818 // There should be no attributes
819 if (count($attributes) > 0) {
820 // Please don't add any attributes to foo-list nodes
821 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
822 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
823 // doXmlCallbackFunction is missing
824 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
825 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
826 // Abort silently here, no one wants to kill this array
831 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
834 // Handles the XML node 'callback-extra-parameter-list-entry'
835 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
836 // There are three attributes, by default
837 if (count($attributes) != 3) {
838 // Not the right count
839 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
840 } elseif (!isset($attributes['COLUMN'])) {
841 // 'COLUMN' not found
842 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
843 } elseif (!isset($attributes['TYPE'])) {
845 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
846 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
848 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
849 } elseif (!isset($attributes['VALUE'])) {
851 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
852 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
853 // 'VALUE' not valid/verifyable
854 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
855 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
856 // doXmlCallbackFunction is missing
857 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
860 // Add the entry to the array
861 addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
864 // Handles the XML node 'no-entry-found-message'
865 function doXmlNoEntryFoundMessage ($resource, $attributes) {
866 // There are two attributes, by default
867 if (count($attributes) != 2) {
868 // Not the right count
869 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
870 } elseif (!isset($attributes['VALUE'])) {
872 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
873 } elseif (!isset($attributes['TYPE'])) {
875 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
876 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
878 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
879 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
880 // Not valid/verifyable
881 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
882 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
883 // doXmlCallbackFunction is missing
884 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
887 // Add the entry to the array
888 addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
891 //-----------------------------------------------------------------------------
892 // XML type validation
893 //-----------------------------------------------------------------------------
895 // Checks for string without any added extra data
896 function isXmlTypeString ($value) {
897 // Just let SQL_ESCAPE() do the job
898 return ($value == SQL_ESCAPE($value));
901 // Fake-check for array type
902 function isXmlTypeArray ($value) {
903 // This value is always a string
904 return (is_string($value));
907 // Check for boolean type
908 function isXmlTypeBool ($value) {
910 $value = trim($value);
912 // This value is always a string
913 return (($value == 'true') || ($value == 'false'));
916 // Check for integer type
917 function isXmlTypeInt ($value) {
919 $value = trim($value);
921 // This value is always a string
922 return (bigintval($value) == $value);
925 // Check for callback type
926 function isXmlTypeCallback ($value) {
928 $value = trim($value);
930 // This value is always a string
931 return (function_exists($value));
934 //-----------------------------------------------------------------------------
935 // Private XML functions
936 //-----------------------------------------------------------------------------
938 // Adds given attribut to element
939 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
940 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
941 // Is it boolean type?
942 if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
943 // Then convert VALUE
944 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!');
945 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
946 } elseif ($attributes['TYPE'] == 'callback') {
947 // It is a simple call-back type
948 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!');
949 $attributes['VALUE'] = call_user_func($attributes['VALUE']);
952 // What do we need to add?
953 if ($attributes['TYPE'] == 'array') {
954 // Another nested array
955 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element);
956 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
957 } elseif (!empty($extraKey)) {
959 if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
960 // Then convert VALUE
961 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
964 // Sub-array (one level only)
965 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
966 if (trim($attributes['NAME']) == '') {
968 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
969 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE'];
970 } elseif (!empty($key)) {
972 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
973 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
976 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
977 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
979 } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
981 * ALIAS and FUNCTION detected? This may happen with SQL queries
982 * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
986 'column' => trim($attributes['VALUE']),
987 'alias' => trim($attributes['ALIAS']),
988 'function' => trim($attributes['FUNCTION']),
989 'table' => trim($attributes['TABLE'])
993 //* 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'] . ')');
994 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
995 } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
996 // CONDITION/LOOK-FOR detected
999 'column' => trim($attributes['VALUE']),
1000 'table' => trim($attributes['TABLE']),
1001 'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1002 'look_for' => trim($attributes['LOOK-FOR'])
1005 //* 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'] . ')');
1006 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1007 } elseif (isset($attributes['CALLBACK'])) {
1008 // CALLBACK/VALUE detected
1009 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1010 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1011 } elseif (isset($attributes['ORDER'])) {
1012 // ORDER/TABLE detected
1013 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1014 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1015 } elseif (isset($attributes['COLUMN'])) {
1016 // COLUMN/VALUE detected
1017 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
1018 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE'];
1019 } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) {
1021 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1022 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE'];
1023 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1025 debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
1028 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1029 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1031 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1034 //-----------------------------------------------------------------------------
1035 // Execute call-back functions
1036 //-----------------------------------------------------------------------------
1038 // Execute function for doXmlCallbackFunction()
1039 function doXmlCallbackFunctionExecute ($callbackFunction, $args) {
1040 // Is 'id_index' set and form sent?
1041 if ((isset($args['id_index'])) && (isFormSent())) {
1042 // Prepare 'id_index'
1043 $args['id_index'] = postRequestParameter($args['id_index']);
1047 //* DEBUG: */ die('callbackFunction=' . $callbackFunction . ',args=<pre>'.print_r($args, true).'</pre>');
1048 call_user_func_array($callbackFunction, $args);