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://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) != 6) {
125 // Not the right count
126 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 6 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['TABLE'])) {
138 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
139 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE'])) {
140 // Not valid/verifyable
141 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TYPE=' . $attributes['TYPE'] . ',TABLE=' . $attributes['TABLE']);
142 } elseif (!isset($attributes['ALIAS'])) {
144 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
145 } elseif (!isset($attributes['FUNCTION'])) {
146 // 'FUNCTION' not found
147 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
148 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
149 // 'ALIAS' not valid/verifyable
150 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
151 } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
152 // 'FUNCTION' not valid/verifyable
153 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
154 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'])) {
155 // doXmlCallbackFunction is missing
156 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/database-column-list not included around this node. Please fix your XML.');
159 // Add the entry to the list
160 addXmlValueToCallbackAttributes('column_list', $attributes);
163 // Handles the XML node 'callback-function-list'
164 function doXmlCallbackFunctionList ($resource, $attributes) {
165 // There should be no attributes
166 if (count($attributes) > 0) {
167 // Please don't add any attributes to foo-list nodes
168 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
172 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array();
175 // Handles the XML node 'callback-function-list-entry'
176 function doXmlCallbackFunctionListEntry ($resource, $attributes) {
177 // There are three attributes, by default
178 if (count($attributes) != 3) {
179 // Not the right count
180 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
181 } elseif (!isset($attributes['NAME'])) {
183 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
184 } elseif (!isset($attributes['TYPE'])) {
186 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
187 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
189 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
190 } elseif (!isset($attributes['VALUE'])) {
192 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
193 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
194 // Not valid/verifyable
195 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
196 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'])) {
197 // doXmlCallbackFunction is missing
198 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/callback-function-list not included around this node. Please fix your XML.');
201 // Add the entry to the list
202 addXmlValueToCallbackAttributes('callback_list', $attributes);
205 // Handles the XML node 'extra-parameter-list'
206 function doXmlExtraParameterList ($resource, $attributes) {
207 // There should be no attributes
208 if (count($attributes) > 0) {
209 // Please don't add any attributes to foo-list nodes
210 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
214 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array();
217 // Handles the XML node 'extra-parameter-list-entry'
218 function doXmlExtraParameterListEntry ($resource, $attributes) {
219 // There are three attributes, by default
220 if (count($attributes) != 3) {
221 // Not the right count
222 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
223 } elseif (!isset($attributes['NAME'])) {
225 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
226 } elseif (!isset($attributes['TYPE'])) {
228 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
229 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
231 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
232 } elseif (!isset($attributes['VALUE'])) {
234 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
235 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
236 // Not valid/verifyable
237 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
238 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'])) {
239 // doXmlCallbackFunction is missing
240 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
243 // Add the entry to the list
244 addXmlValueToCallbackAttributes('extra_list', $attributes);
247 // Handles the XML node 'extra-parameter-member-list'
248 function doXmlExtraParameterMemberList ($resource, $attributes) {
249 // There should be no attributes
250 if (count($attributes) > 0) {
251 // Please don't add any attributes to foo-list nodes
252 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
253 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
254 // This list should be created already
255 debug_report_bug(__FUNCTION__, __LINE__, 'member_list should be already created.');
259 // Handles the XML node 'extra-parameter-member-list-entry'
260 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
261 // There are three attributes, by default
262 if (count($attributes) != 3) {
263 // Not the right count
264 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
265 } elseif (!isset($attributes['NAME'])) {
267 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
268 } elseif (!isset($attributes['TYPE'])) {
270 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
271 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
273 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
274 } elseif (!isset($attributes['VALUE'])) {
276 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
277 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
278 // Not valid/verifyable
279 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
280 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
281 // doXmlCallbackFunction is missing
282 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
285 // Add the entry to the list
286 addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
289 // Handles the XML node 'extra-parameter-added-list'
290 function doXmlExtraParameterAddedList ($resource, $attributes) {
291 // There should be no attributes
292 if (count($attributes) > 0) {
293 // Please don't add any attributes to foo-list nodes
294 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
295 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
296 // This list should be created already
297 debug_report_bug(__FUNCTION__, __LINE__, 'added_list should be already created.');
301 // Handles the XML node 'extra-parameter-added-list-entry'
302 function doXmlExtraParameterAddedListEntry ($resource, $attributes) {
303 // There are three attributes, by default
304 if (count($attributes) != 3) {
305 // Not the right count
306 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
307 } elseif (!isset($attributes['NAME'])) {
309 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
310 } elseif (!isset($attributes['TYPE'])) {
312 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
313 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
315 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
316 } elseif (!isset($attributes['VALUE'])) {
318 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
319 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
320 // Not valid/verifyable
321 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
322 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
323 // doXmlCallbackFunction is missing
324 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/added-list not included around this node. Please fix your XML.');
327 // Add the entry to the list
328 addXmlValueToCallbackAttributes('extra_list', $attributes, 'added_list');
331 // Handles the XML node 'status-change-column'
332 function doXmlStatusChangeColumn ($resource, $attributes) {
333 // There are three attributes, by default
334 if (count($attributes) != 3) {
335 // Not the right count
336 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
337 } elseif (!isset($attributes['NAME'])) {
339 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
340 } elseif (!isset($attributes['TYPE'])) {
342 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
343 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
345 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
346 } elseif (!isset($attributes['VALUE'])) {
348 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
349 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
350 // Not valid/verifyable
351 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
352 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
353 // doXmlCallbackFunction is missing
354 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
357 // Add the entry to the list
358 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
361 // Handles the XML node 'status-change-list'
362 function doXmlStatusChangeList ($resource, $attributes) {
363 // There should be no attributes
364 if (count($attributes) > 0) {
365 // Please don't add any attributes to foo-list nodes
366 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
367 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
368 // doXmlCallbackFunction is missing
369 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.');
373 // Handles the XML node 'status-change-list-entry'
374 function doXmlStatusChangeListEntry ($resource, $attributes) {
375 // There are for attributes, by default
376 if (count($attributes) != 4) {
377 // Not the right count
378 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 4 attributes, got ' . count($attributes));
379 } elseif (!isset($attributes['NAME'])) {
381 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
382 } elseif (!isset($attributes['TYPE'])) {
384 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
385 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
387 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
388 } elseif (!isset($attributes['VALUE'])) {
390 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
391 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['OLD'])) {
392 // Not valid/verifyable
393 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
394 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
395 // Not valid/verifyable
396 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
397 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
398 // doXmlCallbackFunction is missing
399 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/change-list not included around this node. Please fix your XML.');
402 // Add the entry to the list
403 addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
406 // Handles the XML node 'enable-modify-entries'
407 function doXmlEnableModifyEntries ($resource, $attributes) {
408 // There are three attributes, by default
409 if (count($attributes) != 3) {
410 // Not the right count
411 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
412 } elseif (!isset($attributes['NAME'])) {
414 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
415 } elseif (!isset($attributes['TYPE'])) {
417 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
418 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
420 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
421 } elseif (!isset($attributes['VALUE'])) {
423 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
424 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
425 // Not valid/verifyable
426 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
427 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
428 // doXmlCallbackFunction is missing
429 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
432 // Add the entry to the list
433 addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
434 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['enable_modify_entries'] = convertStringToBoolean($attributes['VALUE']);
437 // Handles the XML node 'table-id-column'
438 function doXmlTableIdColumn ($resource, $attributes) {
439 // There are three attributes, by default
440 if (count($attributes) != 3) {
441 // Not the right count
442 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
443 } elseif (!isset($attributes['NAME'])) {
445 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
446 } elseif (!isset($attributes['TYPE'])) {
448 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
449 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
451 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
452 } elseif (!isset($attributes['VALUE'])) {
454 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
455 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
456 // Not valid/verifyable
457 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
458 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
459 // doXmlCallbackFunction is missing
460 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
463 // Add the entry to the array
464 addXmlValueToCallbackAttributes('table_id_column', $attributes);
465 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_id_column'] = $attributes['VALUE'];
468 // Handles the XML node 'table-userid-column'
469 function doXmlTableUseridColumn ($resource, $attributes) {
470 // There are three attributes, by default
471 if (count($attributes) != 3) {
472 // Not the right count
473 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
474 } elseif (!isset($attributes['NAME'])) {
476 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
477 } elseif (!isset($attributes['TYPE'])) {
479 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
480 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
482 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
483 } elseif (!isset($attributes['VALUE'])) {
485 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
486 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
487 // Not valid/verifyable
488 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
489 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
490 // doXmlCallbackFunction is missing
491 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
494 // Add the entry to the array
495 addXmlValueToCallbackAttributes('table_userid_column', $attributes);
496 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_userid_column'] = $attributes['VALUE'];
499 // Handles the XML node 'raw-userid-column-key'
500 function doXmlRawUseridColumnKey ($resource, $attributes) {
501 // There are three attributes, by default
502 if (count($attributes) != 3) {
503 // Not the right count
504 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
505 } elseif (!isset($attributes['NAME'])) {
507 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
508 } elseif (!isset($attributes['TYPE'])) {
510 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
511 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
513 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
514 } elseif (!isset($attributes['VALUE'])) {
516 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
517 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
518 // Not valid/verifyable
519 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
520 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
521 // doXmlCallbackFunction is missing
522 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
525 // Add the entry to the array
526 addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes);
527 //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['raw_userid_column_key'] = $attributes['VALUE'];
530 //-----------------------------------------------------------------------------
531 // Call-back functions for listing of data in admin area
532 //-----------------------------------------------------------------------------
534 // Handles the XML node 'admin-list-data'
535 function doXmlAdminListData ($resource, $attributes) {
536 // There should be no attributes
537 if (count($attributes) > 0) {
538 // Please don't add any attributes to foo-list nodes
539 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
543 // Handles the XML node 'data-tables'
544 function doXmlDataTables ($resource, $attributes) {
545 // There should be no attributes
546 if (count($attributes) > 0) {
547 // Please don't add any attributes to foo-list nodes
548 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
552 // Handles the XML node 'data-table'
553 function doXmlDataTable ($resource, $attributes) {
554 // There are three attributes, by default
555 if (count($attributes) != 3) {
556 // Not the right count
557 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
558 } elseif (!isset($attributes['VALUE'])) {
560 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
561 } elseif (!isset($attributes['TYPE'])) {
563 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
564 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
566 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
567 } elseif (!isset($attributes['ALIAS'])) {
569 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
570 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
571 // Not valid/verifyable
572 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
573 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
574 // Not valid/verifyable
575 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
576 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
577 // doXmlCallbackFunction is missing
578 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
581 // Add the entry to the array
582 addXmlValueToCallbackAttributes('data_table', $attributes);
585 // Handles the XML node 'select-data-from-list'
586 function doXmlSelectDataFromList ($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']['data_column_list'] = array();
600 // Handles the XML node 'select-data-from-list-entry'
601 function doXmlSelectDataFromListEntry ($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['VALUE'])) {
608 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
609 } elseif (!isset($attributes['TYPE'])) {
611 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
612 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
614 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
615 } elseif (!isset($attributes['ALIAS'])) {
617 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
618 } elseif (!isset($attributes['FUNCTION'])) {
619 // 'FUNCTION' not found
620 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
621 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
622 // 'VALUE' not valid/verifyable
623 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
624 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
625 // 'ALIAS' not valid/verifyable
626 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
627 } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
628 // 'FUNCTION' not valid/verifyable
629 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
630 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
631 // doXmlCallbackFunction is missing
632 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
635 // Add the entry to the array
636 addXmlValueToCallbackAttributes('data_column_list', $attributes);
639 // Handles the XML node 'where-select-from-list'
640 function doXmlWhereSelectFromList ($resource, $attributes) {
641 // There should be no attributes
642 if (count($attributes) > 0) {
643 // Please don't add any attributes to foo-list nodes
644 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
645 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
646 // doXmlCallbackFunction is missing
647 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
651 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
654 // Handles the XML node 'where-select-from-list-entry'
655 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
656 // There are five attributes, by default
657 if (count($attributes) != 5) {
658 // Not the right count
659 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
660 } elseif (!isset($attributes['TYPE'])) {
662 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
663 } elseif (!isset($attributes['TABLE'])) {
665 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
666 } elseif (!isset($attributes['VALUE'])) {
668 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
669 } elseif (!isset($attributes['CONDITION'])) {
670 // 'CONDITION' not found
671 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
672 } elseif (!isset($attributes['LOOK-FOR'])) {
673 // 'LOOK-FOR' not found
674 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
675 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
677 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
678 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
679 // 'TABLE' not valid/verifyable
680 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
681 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
682 // 'VALUE' not valid/verifyable
683 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
684 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
685 // 'CONDITION' not valid/verifyable
686 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
687 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['LOOK-FOR'])) {
688 // 'LOOK-FOR' not valid/verifyable
689 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute LOOK-FOR does not validate. LOOK-FOR=' . $attributes['LOOK-FOR']);
690 } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
691 // 'CONDITION' is not known
692 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. LOOK-FOR=' . $attributes['CONDITION']);
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('where_select_list', $attributes);
702 // Handles the XML node 'order-by-list'
703 function doXmlOrderByList ($resource, $attributes) {
704 // There should be no attributes
705 if (count($attributes) > 0) {
706 // Please don't add any attributes to foo-list nodes
707 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
708 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
709 // doXmlCallbackFunction is missing
710 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
714 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
717 // Handles the XML node 'order-by-list-entry'
718 function doXmlOrderByListEntry ($resource, $attributes) {
719 // There are four attributes, by default
720 if (count($attributes) != 4) {
721 // Not the right count
722 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
723 } elseif (!isset($attributes['ORDER'])) {
725 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
726 } elseif (!isset($attributes['TYPE'])) {
728 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
729 } elseif (!isset($attributes['TABLE'])) {
731 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
732 } elseif (!isset($attributes['VALUE'])) {
734 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
735 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
737 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
738 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
739 // 'ORDER' not valid/verifyable
740 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
741 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
742 // 'TABLE' not valid/verifyable
743 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
744 } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
745 // 'VALUE' not valid/verifyable
746 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
747 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
748 // doXmlCallbackFunction is missing
749 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
752 // Add the entry to the array
753 addXmlValueToCallbackAttributes('order_by_list', $attributes);
756 // Handles the XML node 'list-template'
757 function doXmlListTemplate ($resource, $attributes) {
758 // There are two attributes, by default
759 if (count($attributes) != 2) {
760 // Not the right count
761 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
762 } elseif (!isset($attributes['VALUE'])) {
764 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
765 } elseif (!isset($attributes['TYPE'])) {
767 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
768 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
770 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
771 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
772 // Not valid/verifyable
773 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
774 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
775 // doXmlCallbackFunction is missing
776 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
779 // Add the entry to the array
780 addXmlValueToCallbackAttributes('list_template', $attributes);
783 // Handles the XML node 'list-row-template'
784 function doXmlListRowTemplate ($resource, $attributes) {
785 // There are two attributes, by default
786 if (count($attributes) != 2) {
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 (!isInvalidXmlType($attributes['TYPE'])) {
797 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
798 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
799 // Not valid/verifyable
800 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
801 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
802 // doXmlCallbackFunction is missing
803 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
806 // Add the entry to the array
807 addXmlValueToCallbackAttributes('list_row_template', $attributes);
810 // Handles the XML node 'column-callback-list'
811 function doXmlColumnCallbackList ($resource, $attributes) {
812 // There should be no attributes
813 if (count($attributes) > 0) {
814 // Please don't add any attributes to foo-list nodes
815 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
816 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
817 // doXmlCallbackFunction is missing
818 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
822 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
825 // Handles the XML node 'column-callback-list-entry'
826 function doXmlColumnCallbackListEntry ($resource, $attributes) {
827 // There should be no attributes
828 if (count($attributes) > 0) {
829 // Please don't add any attributes to foo-list nodes
830 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
831 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
832 // doXmlCallbackFunction is missing
833 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
837 // Handles the XML node 'column-callback-data'
838 function doXmlColumnCallbackData ($resource, $attributes) {
839 // There are three attributes, by default
840 if (count($attributes) != 3) {
841 // Not the right count
842 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
843 } elseif (!isset($attributes['VALUE'])) {
845 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
846 } elseif (!isset($attributes['TYPE'])) {
848 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
849 } elseif (!isset($attributes['CALLBACK'])) {
850 // 'CALLBACK' not found
851 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
852 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
854 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
855 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
856 // Not valid/verifyable
857 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
858 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
859 // doXmlCallbackFunction is missing
860 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
861 } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
862 // 'CALLBACK' not valid/verifyable
863 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
866 // Add the entry to the array
867 addXmlValueToCallbackAttributes('column_callback_list', $attributes);
870 // Handles the XML node 'callback-extra-parameter-list'
871 function doXmlCallbackExtraParameterList ($resource, $attributes) {
872 // There should be no attributes
873 if (count($attributes) > 0) {
874 // Please don't add any attributes to foo-list nodes
875 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
876 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
877 // doXmlCallbackFunction is missing
878 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
879 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
880 // Abort silently here, no one wants to kill this array
885 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
888 // Handles the XML node 'callback-extra-parameter-list-entry'
889 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
890 // There are three attributes, by default
891 if (count($attributes) != 3) {
892 // Not the right count
893 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
894 } elseif (!isset($attributes['COLUMN'])) {
895 // 'COLUMN' not found
896 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
897 } elseif (!isset($attributes['TYPE'])) {
899 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
900 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
902 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
903 } elseif (!isset($attributes['VALUE'])) {
905 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
906 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
907 // 'VALUE' not valid/verifyable
908 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
909 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
910 // doXmlCallbackFunction is missing
911 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
914 // Add the entry to the array
915 addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
918 // Handles the XML node 'no-entry-found-message'
919 function doXmlNoEntryFoundMessage ($resource, $attributes) {
920 // There are two attributes, by default
921 if (count($attributes) != 2) {
922 // Not the right count
923 debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
924 } elseif (!isset($attributes['VALUE'])) {
926 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
927 } elseif (!isset($attributes['TYPE'])) {
929 debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
930 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
932 debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
933 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
934 // Not valid/verifyable
935 debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
936 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
937 // doXmlCallbackFunction is missing
938 debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
941 // Add the entry to the array
942 addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
945 //-----------------------------------------------------------------------------
946 // XML type validation
947 //-----------------------------------------------------------------------------
949 // Checks for string without any added extra data
950 function isXmlTypeString ($value) {
951 // Just let SQL_ESCAPE() do the job
952 return ($value == SQL_ESCAPE($value));
955 // Fake-check for array type
956 function isXmlTypeArray ($value) {
957 // This value is always a string
958 return (is_string($value));
961 // Check for boolean type
962 function isXmlTypeBool ($value) {
964 $value = trim($value);
966 // This value is always a string
967 return (($value == 'true') || ($value == 'false'));
970 // Check for integer type
971 function isXmlTypeInt ($value) {
973 $value = trim($value);
975 // This value is always a string
976 return (bigintval($value) == $value);
979 // Check for callback type
980 function isXmlTypeCallback ($value) {
982 $value = trim($value);
984 // This value is always a string
985 return (function_exists($value));
988 //-----------------------------------------------------------------------------
989 // Private XML functions
990 //-----------------------------------------------------------------------------
992 // Adds given attribut to element
993 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
994 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
995 // Is it boolean type?
996 if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
997 // Then convert VALUE
998 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!');
999 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
1000 } elseif ($attributes['TYPE'] == 'callback') {
1001 // It is a simple call-back type
1002 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!');
1003 $attributes['VALUE'] = call_user_func($attributes['VALUE']);
1006 // What do we need to add?
1007 if ($attributes['TYPE'] == 'array') {
1008 // Another nested array
1009 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element);
1010 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
1011 } elseif (!empty($extraKey)) {
1012 // Sub-array (one level only)
1013 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
1014 if (trim($attributes['NAME']) == '') {
1016 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1017 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE'];
1018 } elseif (!empty($key)) {
1020 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
1021 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
1024 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
1025 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
1027 } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
1029 * ALIAS and FUNCTION detected? This may happen with SQL queries
1030 * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
1034 'column' => trim($attributes['VALUE']),
1035 'alias' => trim($attributes['ALIAS']),
1036 'function' => trim($attributes['FUNCTION']),
1037 'table' => trim($attributes['TABLE']),
1038 'name' => trim($attributes['NAME'])
1042 //* 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'] . ')');
1043 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1044 } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
1045 // CONDITION/LOOK-FOR detected
1048 'column' => trim($attributes['VALUE']),
1049 'table' => trim($attributes['TABLE']),
1050 'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1051 'look_for' => trim($attributes['LOOK-FOR'])
1054 //* 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'] . ')');
1055 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array;
1056 } elseif (isset($attributes['CALLBACK'])) {
1057 // CALLBACK/VALUE detected
1058 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1059 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1060 } elseif (isset($attributes['ORDER'])) {
1061 // ORDER/TABLE detected
1062 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1063 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1064 } elseif (isset($attributes['COLUMN'])) {
1065 // COLUMN/VALUE detected
1066 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!');
1067 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE'];
1068 } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) {
1070 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1071 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE'];
1072 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1074 debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, true) . '</pre>');
1077 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1078 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1080 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1083 //-----------------------------------------------------------------------------
1084 // Execute call-back functions
1085 //-----------------------------------------------------------------------------
1087 // Execute function for doXmlCallbackFunction()
1088 function doXmlCallbackFunctionExecute ($callbackFunction, $args) {
1089 // Is 'id_index' set and form sent?
1090 if ((isset($args['id_index'])) && (isFormSent())) {
1091 // Prepare 'id_index'
1092 $args['id_index'] = postRequestElement($args['id_index']);
1096 //* DEBUG: */ die('callbackFunction=' . $callbackFunction . ',args=<pre>'.print_r($args, true).'</pre>');
1097 call_user_func_array($callbackFunction, $args);