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 - 2013 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 (isFilledArray($attributes)) {
47 // Please don't add any attributes to foo-list nodes
48 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
52 // Handles the XML node 'member-entry-meta-data'
53 function doXmlMemberEntryMetaData ($resource, $attributes) {
54 // There should be no attributes
55 if (isFilledArray($attributes)) {
56 // Please don't add any attributes to foo-list nodes
57 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
61 // Handles the XML node 'callback-function'
62 function doXmlCallbackFunction ($resource, $attributes) {
63 // There are two attributes, by default
64 if (count($attributes) != 2) {
65 // Not the right count
66 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
67 } elseif (!isset($attributes['TYPE'])) {
69 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
70 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
72 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
73 } elseif (!isset($attributes['VALUE'])) {
75 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
76 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
77 // Not valid/verifyable
78 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
81 // Add the function name and no attributes by default
82 $GLOBALS['__XML_CALLBACKS']['callbacks'][] = __FUNCTION__;
83 $GLOBALS['__XML_CALLBACKS']['functions'][__FUNCTION__][] = $attributes['VALUE'];
84 $GLOBALS['__XML_ARGUMENTS'][__FUNCTION__] = array();
85 $GLOBALS['__COLUMN_INDEX'][__FUNCTION__] = 'column';
88 // Handles the XML node 'database-table'
89 function doXmlDatabaseTable ($resource, $attributes) {
90 // There are three attributes, by default
91 if (count($attributes) != 3) {
92 // Not the right count
93 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
94 } elseif (!isset($attributes['NAME'])) {
96 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
97 } elseif (!isset($attributes['TYPE'])) {
99 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
100 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
102 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
103 } elseif (!isset($attributes['VALUE'])) {
105 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
106 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
107 // Not valid/verifyable
108 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
109 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
110 // doXmlCallbackFunction is missing
111 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
114 // Add the entry to the list
115 addXmlValueToCallbackAttributes('database_table', $attributes);
118 // Handles the XML node 'database-column-list'
119 function doXmlDatabaseColumnList ($resource, $attributes) {
120 // There should be no attributes
121 if (isFilledArray($attributes)) {
122 // Please don't add any attributes to foo-list nodes
123 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
127 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'] = array();
130 // Handles the XML node 'database-column-list-entry'
131 function doXmlDatabaseColumnListEntry ($resource, $attributes) {
132 // There are three attributes, by default
133 if (count($attributes) != 6) {
134 // Not the right count
135 reportBug(__FUNCTION__, __LINE__, 'Expected 6 attributes, got ' . count($attributes));
136 } elseif (!isset($attributes['NAME'])) {
138 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
139 } elseif (!isset($attributes['TYPE'])) {
141 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
142 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
144 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
145 } elseif (!isset($attributes['TABLE'])) {
147 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
148 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE'])) {
149 // Not valid/verifyable
150 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TYPE=' . $attributes['TYPE'] . ',TABLE=' . $attributes['TABLE']);
151 } elseif (!isset($attributes['ALIAS'])) {
153 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
154 } elseif (!isset($attributes['FUNCTION'])) {
155 // 'FUNCTION' not found
156 reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
157 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
158 // 'ALIAS' not valid/verifyable
159 reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
160 } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
161 // 'FUNCTION' not valid/verifyable
162 reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
163 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'])) {
164 // doXmlCallbackFunction is missing
165 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/database-column-list not included around this node. Please fix your XML.');
168 // Add the entry to the list
169 addXmlValueToCallbackAttributes('column_list', $attributes);
172 // Handles the XML node 'callback-function-list'
173 function doXmlCallbackFunctionList ($resource, $attributes) {
174 // There should be no attributes
175 if (isFilledArray($attributes)) {
176 // Please don't add any attributes to foo-list nodes
177 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
181 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array();
184 // Handles the XML node 'callback-function-list-entry'
185 function doXmlCallbackFunctionListEntry ($resource, $attributes) {
186 // There are three attributes, by default
187 if (count($attributes) != 3) {
188 // Not the right count
189 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
190 } elseif (!isset($attributes['NAME'])) {
192 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
193 } elseif (!isset($attributes['TYPE'])) {
195 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
196 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
198 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
199 } elseif (!isset($attributes['VALUE'])) {
201 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
202 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
203 // Not valid/verifyable
204 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
205 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'])) {
206 // doXmlCallbackFunction is missing
207 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/callback-function-list not included around this node. Please fix your XML.');
210 // Add the entry to the list
211 addXmlValueToCallbackAttributes('callback_list', $attributes);
214 // Handles the XML node 'extra-parameter-list'
215 function doXmlExtraParameterList ($resource, $attributes) {
216 // There should be no attributes
217 if (isFilledArray($attributes)) {
218 // Please don't add any attributes to foo-list nodes
219 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
223 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array();
226 // Handles the XML node 'extra-parameter-list-entry'
227 function doXmlExtraParameterListEntry ($resource, $attributes) {
228 // There are three attributes, by default
229 if (count($attributes) != 3) {
230 // Not the right count
231 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
232 } elseif (!isset($attributes['NAME'])) {
234 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
235 } elseif (!isset($attributes['TYPE'])) {
237 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
238 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
240 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
241 } elseif (!isset($attributes['VALUE'])) {
243 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
244 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
245 // Not valid/verifyable
246 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
247 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'])) {
248 // doXmlCallbackFunction is missing
249 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
252 // Add the entry to the list
253 addXmlValueToCallbackAttributes('extra_list', $attributes);
256 // Handles the XML node 'time-columns-list'
257 function doXmlTimeColumnsList ($resource, $attributes) {
258 // There should be no attributes
259 if (isFilledArray($attributes)) {
260 // Please don't add any attributes to foo-list nodes
261 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
265 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['time_columns'] = array();
268 // Handles the XML node 'time-columns-list-entry'
269 function doXmlTimeColumnsListEntry ($resource, $attributes) {
270 // There are three attributes, by default
271 if (count($attributes) != 3) {
272 // Not the right count
273 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
274 } elseif (!isset($attributes['NAME'])) {
276 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
277 } elseif (!isset($attributes['TYPE'])) {
279 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
280 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
282 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
283 } elseif (!isset($attributes['VALUE'])) {
285 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
286 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
287 // Not valid/verifyable
288 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
289 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['time_columns'])) {
290 // doXmlCallbackFunction is missing
291 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.');
294 // Add the entry to the list
295 addXmlValueToCallbackAttributes('time_columns', $attributes);
298 // Handles the XML node 'extra-parameter-member-list'
299 function doXmlExtraParameterMemberList ($resource, $attributes) {
300 // There should be no attributes
301 if (isFilledArray($attributes)) {
302 // Please don't add any attributes to foo-list nodes
303 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
304 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
305 // This list should be created already
306 reportBug(__FUNCTION__, __LINE__, 'member_list should be already created.');
310 // Handles the XML node 'extra-parameter-reload-list'
311 function doXmlExtraParameterReloadList ($resource, $attributes) {
312 // There should be no attributes
313 if (isFilledArray($attributes)) {
314 // Please don't add any attributes to foo-list nodes
315 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
316 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['reload_list'])) {
317 // This list should be created already
318 reportBug(__FUNCTION__, __LINE__, 'reload_list should be already created.');
322 // Handles the XML node 'extra-parameter-waiting-list'
323 function doXmlExtraParameterWaitingList ($resource, $attributes) {
324 // There should be no attributes
325 if (isFilledArray($attributes)) {
326 // Please don't add any attributes to foo-list nodes
327 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
328 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['waiting_list'])) {
329 // This list should be created already
330 reportBug(__FUNCTION__, __LINE__, 'waiting_list should be already created.');
334 // Handles the XML node 'extra-parameter-member-list-entry'
335 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
336 // There are three attributes, by default
337 if (count($attributes) != 3) {
338 // Not the right count
339 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
340 } elseif (!isset($attributes['NAME'])) {
342 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
343 } elseif (!isset($attributes['TYPE'])) {
345 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
346 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
348 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
349 } elseif (!isset($attributes['VALUE'])) {
351 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
352 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
353 // Not valid/verifyable
354 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
355 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) {
356 // doXmlCallbackFunction is missing
357 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.');
360 // Add the entry to the list
361 addXmlValueToCallbackAttributes('extra_list', $attributes, 'member_list');
364 // Handles the XML node 'extra-parameter-reload-list-entry'
365 function doXmlExtraParameterReloadListEntry ($resource, $attributes) {
366 // There are three attributes, by default
367 if (count($attributes) != 3) {
368 // Not the right count
369 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
370 } elseif (!isset($attributes['NAME'])) {
372 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
373 } elseif (!isset($attributes['TYPE'])) {
375 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
376 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
378 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
379 } elseif (!isset($attributes['VALUE'])) {
381 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
382 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
383 // Not valid/verifyable
384 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
385 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['reload_list'])) {
386 // doXmlCallbackFunction is missing
387 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/reload-list not included around this node. Please fix your XML.');
390 // Add the entry to the list
391 addXmlValueToCallbackAttributes('extra_list', $attributes, 'reload_list');
394 // Handles the XML node 'extra-parameter-waiting-list-entry'
395 function doXmlExtraParameterWaitingListEntry ($resource, $attributes) {
396 // There are three attributes, by default
397 if (count($attributes) != 3) {
398 // Not the right count
399 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
400 } elseif (!isset($attributes['NAME'])) {
402 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
403 } elseif (!isset($attributes['TYPE'])) {
405 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
406 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
408 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
409 } elseif (!isset($attributes['VALUE'])) {
411 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
412 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
413 // Not valid/verifyable
414 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
415 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['waiting_list'])) {
416 // doXmlCallbackFunction is missing
417 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/waiting-list not included around this node. Please fix your XML.');
420 // Add the entry to the list
421 addXmlValueToCallbackAttributes('extra_list', $attributes, 'waiting_list');
424 // Handles the XML node 'extra-parameter-added-list'
425 function doXmlExtraParameterAddedList ($resource, $attributes) {
426 // There should be no attributes
427 if (isFilledArray($attributes)) {
428 // Please don't add any attributes to foo-list nodes
429 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
430 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
431 // This list should be created already
432 reportBug(__FUNCTION__, __LINE__, 'added_list should be already created.');
436 // Handles the XML node 'extra-parameter-added-list-entry'
437 function doXmlExtraParameterAddedListEntry ($resource, $attributes) {
438 // There are three attributes, by default
439 if (count($attributes) != 3) {
440 // Not the right count
441 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
442 } elseif (!isset($attributes['NAME'])) {
444 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
445 } elseif (!isset($attributes['TYPE'])) {
447 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
448 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
450 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
451 } elseif (!isset($attributes['VALUE'])) {
453 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
454 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
455 // Not valid/verifyable
456 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
457 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['added_list'])) {
458 // doXmlCallbackFunction is missing
459 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/added-list not included around this node. Please fix your XML.');
462 // Add the entry to the list
463 addXmlValueToCallbackAttributes('extra_list', $attributes, 'added_list');
466 // Handles the XML node 'extra-parameter-created-list'
467 function doXmlExtraParameterCreatedList ($resource, $attributes) {
468 // There should be no attributes
469 if (isFilledArray($attributes)) {
470 // Please don't add any attributes to foo-list nodes
471 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
472 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['created_list'])) {
473 // This list should be created already
474 reportBug(__FUNCTION__, __LINE__, 'created_list should be already created.');
478 // Handles the XML node 'extra-parameter-created-list-entry'
479 function doXmlExtraParameterCreatedListEntry ($resource, $attributes) {
480 // There are three attributes, by default
481 if (count($attributes) != 3) {
482 // Not the right count
483 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
484 } elseif (!isset($attributes['NAME'])) {
486 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
487 } elseif (!isset($attributes['TYPE'])) {
489 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
490 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
492 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
493 } elseif (!isset($attributes['VALUE'])) {
495 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
496 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
497 // Not valid/verifyable
498 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
499 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['created_list'])) {
500 // doXmlCallbackFunction is missing
501 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/created-list not included around this node. Please fix your XML.');
504 // Add the entry to the list
505 addXmlValueToCallbackAttributes('extra_list', $attributes, 'created_list');
508 // Handles the XML node 'status-change-column'
509 function doXmlStatusChangeColumn ($resource, $attributes) {
510 // There are three attributes, by default
511 if (count($attributes) != 3) {
512 // Not the right count
513 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
514 } elseif (!isset($attributes['NAME'])) {
516 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
517 } elseif (!isset($attributes['TYPE'])) {
519 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
520 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
522 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
523 } elseif (!isset($attributes['VALUE'])) {
525 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
526 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
527 // Not valid/verifyable
528 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
529 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
530 // doXmlCallbackFunction is missing
531 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
534 // Add the entry to the list
535 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array();
538 // Handles the XML node 'status-change-list'
539 function doXmlStatusChangeList ($resource, $attributes) {
540 // There should be no attributes
541 if (isFilledArray($attributes)) {
542 // Please don't add any attributes to foo-list nodes
543 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
544 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
545 // doXmlCallbackFunction is missing
546 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
549 // Add the entry to the list
550 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'] = array();
553 // Handles the XML node 'status-change-list-entry'
554 function doXmlStatusChangeListEntry ($resource, $attributes) {
555 // There are for attributes, by default
556 if (count($attributes) != 4) {
557 // Not the right count
558 reportBug(__FUNCTION__, __LINE__, 'Expected 4 attributes, got ' . count($attributes));
559 } elseif (!isset($attributes['NAME'])) {
561 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
562 } elseif (!isset($attributes['TYPE'])) {
564 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
565 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
567 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
568 } elseif (!isset($attributes['VALUE'])) {
570 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
571 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['OLD'])) {
572 // Not valid/verifyable
573 reportBug(__FUNCTION__, __LINE__, 'Attribute OLD does not validate. TYPE=' . $attributes['TYPE'] . ',OLD=' . $attributes['OLD']);
574 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
575 // Not valid/verifyable
576 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
577 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) {
578 // doXmlCallbackFunction is missing
579 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/change-list not included around this node. Please fix your XML.');
582 // Add the entry to the list
583 addXmlValueToCallbackAttributes('status_list', $attributes, $attributes['NAME'], 'OLD');
586 // Handles the XML node 'enable-modify-entries'
587 function doXmlEnableModifyEntries ($resource, $attributes) {
588 // There are three attributes, by default
589 if (count($attributes) != 3) {
590 // Not the right count
591 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
592 } elseif (!isset($attributes['NAME'])) {
594 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
595 } elseif (!isset($attributes['TYPE'])) {
597 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
598 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
600 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
601 } elseif (!isset($attributes['VALUE'])) {
603 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
604 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
605 // Not valid/verifyable
606 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
607 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
608 // doXmlCallbackFunction is missing
609 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
612 // Add the entry to the list
613 addXmlValueToCallbackAttributes('enable_modify_entries', $attributes);
616 // Handles the XML node 'table-id-column'
617 function doXmlTableIdColumn ($resource, $attributes) {
618 // There are three attributes, by default
619 if (count($attributes) != 3) {
620 // Not the right count
621 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
622 } elseif (!isset($attributes['NAME'])) {
624 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
625 } elseif (!isset($attributes['TYPE'])) {
627 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
628 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
630 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
631 } elseif (!isset($attributes['VALUE'])) {
633 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
634 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
635 // Not valid/verifyable
636 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
637 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
638 // doXmlCallbackFunction is missing
639 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
642 // Add the entry to the array
643 addXmlValueToCallbackAttributes('table_id_column', $attributes);
646 // Handles the XML node 'table-userid-column'
647 function doXmlTableUseridColumn ($resource, $attributes) {
648 // There are three attributes, by default
649 if (count($attributes) != 3) {
650 // Not the right count
651 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
652 } elseif (!isset($attributes['NAME'])) {
654 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
655 } elseif (!isset($attributes['TYPE'])) {
657 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
658 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
660 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
661 } elseif (!isset($attributes['VALUE'])) {
663 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
664 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
665 // Not valid/verifyable
666 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
667 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
668 // doXmlCallbackFunction is missing
669 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
672 // Add the entry to the array
673 addXmlValueToCallbackAttributes('table_userid_column', $attributes);
676 // Handles the XML node 'raw-userid-column-key'
677 function doXmlRawUseridColumnKey ($resource, $attributes) {
678 // There are three attributes, by default
679 if (count($attributes) != 3) {
680 // Not the right count
681 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
682 } elseif (!isset($attributes['NAME'])) {
684 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
685 } elseif (!isset($attributes['TYPE'])) {
687 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
688 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
690 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
691 } elseif (!isset($attributes['VALUE'])) {
693 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
694 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
695 // Not valid/verifyable
696 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
697 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
698 // doXmlCallbackFunction is missing
699 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
702 // Add the entry to the array
703 addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes);
706 // Handles the XML node 'cache-file'
707 function doXmlCacheFile ($resource, $attributes) {
708 // There are three attributes, by default
709 if (count($attributes) != 3) {
710 // Not the right count
711 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
712 } elseif (!isset($attributes['NAME'])) {
714 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
715 } elseif (!isset($attributes['TYPE'])) {
717 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
718 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
720 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
721 } elseif (!isset($attributes['VALUE'])) {
723 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
724 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
725 // Not valid/verifyable
726 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
727 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
728 // doXmlCallbackFunction is missing
729 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
732 // Add the entry to the array
733 addXmlValueToCallbackAttributes('cache_file', $attributes);
736 //-----------------------------------------------------------------------------
737 // Call-back functions for listing of data in admin area
738 //-----------------------------------------------------------------------------
740 // Handles the XML node 'admin-list-data'
741 function doXmlAdminListData ($resource, $attributes) {
742 // There should be no attributes
743 if (isFilledArray($attributes)) {
744 // Please don't add any attributes to foo-list nodes
745 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
749 // Handles the XML node 'member-list-data'
750 function doXmlMemberListData ($resource, $attributes) {
751 // There should be no attributes
752 if (isFilledArray($attributes)) {
753 // Please don't add any attributes to foo-list nodes
754 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
758 // Handles the XML node 'data-tables'
759 function doXmlDataTables ($resource, $attributes) {
760 // There should be no attributes
761 if (isFilledArray($attributes)) {
762 // Please don't add any attributes to foo-list nodes
763 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
767 // Handles the XML node 'data-table'
768 function doXmlDataTable ($resource, $attributes) {
769 // There are three attributes, by default
770 if (count($attributes) != 3) {
771 // Not the right count
772 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
773 } elseif (!isset($attributes['VALUE'])) {
775 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
776 } elseif (!isset($attributes['TYPE'])) {
778 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
779 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
781 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
782 } elseif (!isset($attributes['ALIAS'])) {
784 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
785 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
786 // Not valid/verifyable
787 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
788 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
789 // Not valid/verifyable
790 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']);
791 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
792 // doXmlCallbackFunction is missing
793 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
797 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'] = array();
799 // Add the entry to the array
800 addXmlValueToCallbackAttributes('data_table', $attributes);
803 // Handles the XML node 'table-join-condition'
804 function doXmlTableJoinCondition ($resource, $attributes) {
805 // There should be no attributes
806 if (isFilledArray($attributes)) {
807 // Please don't add any attributes to foo-list nodes
808 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
812 // Handles the XML node 'table-join-type'
813 function doXmlTableJoinType ($resource, $attributes) {
814 if (count($attributes) != 1) {
815 // Not the right count
816 reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes, got ' . count($attributes));
817 } elseif (!isset($attributes['TYPE'])) {
819 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
820 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_type'])) {
821 // Array is already defined
822 reportBug(__FUNCTION__, __LINE__, 'Required XML node table-join-type already set. Only one JOIN is currently supported.');
826 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_type'] = array();
828 // Add the entry to the array
829 addXmlValueToCallbackAttributes('table_join_type', $attributes);
832 // Handles the XML node 'table-join-name'
833 function doXmlTableJoinName ($resource, $attributes) {
834 if (count($attributes) != 2) {
835 // Not the right count
836 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
837 } elseif (!isset($attributes['NAME'])) {
839 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
840 } elseif (!isset($attributes['ALIAS'])) {
842 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
843 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_name'])) {
844 // Array is already defined
845 reportBug(__FUNCTION__, __LINE__, 'Required XML node table-join-name already set. Only one JOIN is currently supported.');
849 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_join_name'] = array();
851 // Add the entry to the array
852 addXmlValueToCallbackAttributes('table_join_name', $attributes);
855 // Handles the XML node 'join-on'
856 function doXmlJoinOn ($resource, $attributes) {
857 // There should be no attributes
858 if (isFilledArray($attributes)) {
859 // Please don't add any attributes to foo-list nodes
860 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes));
864 // Handles the XML node 'join-on-left-table'
865 function doXmlJoinOnLeftTable ($resource, $attributes) {
866 if (count($attributes) != 3) {
867 // Not the right count
868 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
869 } elseif (!isset($attributes['TYPE'])) {
871 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
872 } elseif (!isset($attributes['NAME'])) {
874 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
875 } elseif (!isset($attributes['COLUMN'])) {
876 // 'COLUMN' not found
877 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
878 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['NAME'])) {
879 // 'NAME' not valid/verifyable
880 reportBug(__FUNCTION__, __LINE__, 'Attribute NAME does not validate. NAME=' . $attributes['NAME']);
881 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['COLUMN'])) {
882 // 'COLUMN' not valid/verifyable
883 reportBug(__FUNCTION__, __LINE__, 'Attribute COLUMN does not validate. COLUMN=' . $attributes['COLUMN']);
884 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_left_table'])) {
885 // Array is already defined
886 reportBug(__FUNCTION__, __LINE__, 'Required XML node join-on-left-table already set. Only one JOIN is currently supported.');
890 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_left_table'] = array();
892 // Add the entry to the array
893 addXmlValueToCallbackAttributes('join_on_left_table', $attributes);
896 // Handles the XML node 'join-on-right-table'
897 function doXmlJoinOnRightTable ($resource, $attributes) {
898 if (count($attributes) != 3) {
899 // Not the right count
900 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
901 } elseif (!isset($attributes['TYPE'])) {
903 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
904 } elseif (!isset($attributes['NAME'])) {
906 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
907 } elseif (!isset($attributes['COLUMN'])) {
908 // 'COLUMN' not found
909 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
910 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['NAME'])) {
911 // 'NAME' not valid/verifyable
912 reportBug(__FUNCTION__, __LINE__, 'Attribute NAME does not validate. NAME=' . $attributes['NAME']);
913 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['COLUMN'])) {
914 // 'COLUMN' not valid/verifyable
915 reportBug(__FUNCTION__, __LINE__, 'Attribute COLUMN does not validate. COLUMN=' . $attributes['COLUMN']);
916 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_right_table'])) {
917 // Array is already defined
918 reportBug(__FUNCTION__, __LINE__, 'Required XML node join-on-right-table already set. Only one JOIN is currently supported.');
922 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_right_table'] = array();
924 // Add the entry to the array
925 addXmlValueToCallbackAttributes('join_on_right_table', $attributes);
928 // Handles the XML node 'join-on-condition'
929 function doXmlJoinOnCondition ($resource, $attributes) {
930 if (count($attributes) != 2) {
931 // Not the right count
932 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
933 } elseif (!isset($attributes['TYPE'])) {
935 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
936 } elseif (!isset($attributes['CONDITION'])) {
937 // 'CONDITION' not found
938 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
939 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
940 // 'CONDITION' not valid/verifyable
941 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
942 } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
943 // 'CONDITION' is not known
944 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']);
945 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_condition'])) {
946 // Array is already defined
947 reportBug(__FUNCTION__, __LINE__, 'Required XML node join-on-condition already set. Only one JOIN is currently supported.');
951 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['join_on_condition'] = array();
953 // Add the entry to the array
954 //die('<pre>'.print_r($attributes,true).'</pre>');
955 addXmlValueToCallbackAttributes('join_on_condition', $attributes);
958 // Handles the XML node 'select-data-from-list'
959 function doXmlSelectDataFromList ($resource, $attributes) {
960 // There should be no attributes
961 if (isFilledArray($attributes)) {
962 // Please don't add any attributes to foo-list nodes
963 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
964 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
965 // doXmlCallbackFunction is missing
966 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
970 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array();
973 // Handles the XML node 'select-data-from-list-entry'
974 function doXmlSelectDataFromListEntry ($resource, $attributes) {
975 // There are five attributes, by default
976 if (count($attributes) != 5) {
977 // Not the right count
978 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
979 } elseif (!isset($attributes['VALUE'])) {
981 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
982 } elseif (!isset($attributes['TYPE'])) {
984 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
985 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
987 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
988 } elseif (!isset($attributes['ALIAS'])) {
990 reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.');
991 } elseif (!isset($attributes['FUNCTION'])) {
992 // 'FUNCTION' not found
993 reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.');
994 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
995 // 'VALUE' not valid/verifyable
996 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
997 } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) {
998 // 'ALIAS' not valid/verifyable
999 reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']);
1000 } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) {
1001 // 'FUNCTION' not valid/verifyable
1002 reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']);
1003 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1004 // doXmlCallbackFunction is missing
1005 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.');
1008 // Add the entry to the array
1009 addXmlValueToCallbackAttributes('data_column_list', $attributes);
1012 // Handles the XML node 'where-select-from-list'
1013 function doXmlWhereSelectFromList ($resource, $attributes) {
1014 // There should be no attributes
1015 if (isFilledArray($attributes)) {
1016 // Please don't add any attributes to foo-list nodes
1017 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1018 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1019 // doXmlCallbackFunction is missing
1020 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1023 // Add an empty list
1024 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array();
1027 // Handles the XML node 'where-select-from-list-entry'
1028 function doXmlWhereSelectFromListEntry ($resource, $attributes) {
1029 // There are five attributes, by default
1030 if (count($attributes) != 5) {
1031 // Not the right count
1032 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1033 } elseif (!isset($attributes['TYPE'])) {
1035 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1036 } elseif (!isset($attributes['TABLE'])) {
1037 // 'TABLE' not found
1038 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
1039 } elseif (!isset($attributes['VALUE'])) {
1040 // 'VALUE' not found
1041 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1042 } elseif (!isset($attributes['CONDITION'])) {
1043 // 'CONDITION' not found
1044 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
1045 } elseif (!isset($attributes['LOOK-FOR'])) {
1046 // 'LOOK-FOR' not found
1047 reportBug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.');
1048 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1050 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1051 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
1052 // 'TABLE' not valid/verifyable
1053 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
1054 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1055 // 'VALUE' not valid/verifyable
1056 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1057 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
1058 // 'CONDITION' not valid/verifyable
1059 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
1060 } elseif (!isXmlConditionValid($attributes['CONDITION'])) {
1061 // 'CONDITION' is not known
1062 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']);
1063 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1064 // doXmlCallbackFunction is missing
1065 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
1068 // Add the entry to the array
1069 addXmlValueToCallbackAttributes('where_select_list', $attributes);
1072 // Handles the XML node 'where-condition'
1073 function doXmlWhereCondition ($resource, $attributes) {
1074 // There are two attributes, by default
1075 if (count($attributes) != 3) {
1076 // Please don't add any attributes to foo-list nodes
1077 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes because this is a where-condition node, got ' . count($attributes));
1078 } elseif (!isset($attributes['TYPE'])) {
1080 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1081 } elseif (!isset($attributes['CONDITION'])) {
1082 // 'CONDITION' not found
1083 reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.');
1084 } elseif (!isset($attributes['NAME'])) {
1086 reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.');
1087 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) {
1088 // 'CONDITION' not valid/verifyable
1089 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']);
1090 } elseif ((!empty($attributes['CONDITION'])) && (!isXmlConditionValid($attributes['CONDITION']))) {
1091 // 'CONDITION' is not known
1092 reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']);
1093 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1094 // doXmlCallbackFunction is missing
1095 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1098 // Add an empty list
1099 addXmlValueToCallbackAttributes('where_condition', $attributes);
1102 // Handles the XML node 'order-by-list'
1103 function doXmlOrderByList ($resource, $attributes) {
1104 // There should be no attributes
1105 if (isFilledArray($attributes)) {
1106 // Please don't add any attributes to foo-list nodes
1107 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1108 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1109 // doXmlCallbackFunction is missing
1110 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1113 // Add an empty list
1114 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array();
1117 // Handles the XML node 'order-by-list-entry'
1118 function doXmlOrderByListEntry ($resource, $attributes) {
1119 // There are four attributes, by default
1120 if (count($attributes) != 4) {
1121 // Not the right count
1122 reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes));
1123 } elseif (!isset($attributes['ORDER'])) {
1124 // 'ORDER' not found
1125 reportBug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.');
1126 } elseif (!isset($attributes['TYPE'])) {
1128 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1129 } elseif (!isset($attributes['TABLE'])) {
1130 // 'TABLE' not found
1131 reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.');
1132 } elseif (!isset($attributes['VALUE'])) {
1133 // 'VALUE' not found
1134 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1135 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1137 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1138 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) {
1139 // 'ORDER' not valid/verifyable
1140 reportBug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']);
1141 } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) {
1142 // 'TABLE' not valid/verifyable
1143 reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']);
1144 } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
1145 // 'VALUE' not valid/verifyable
1146 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1147 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1148 // doXmlCallbackFunction is missing
1149 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.');
1152 // Add the entry to the array
1153 addXmlValueToCallbackAttributes('order_by_list', $attributes);
1156 // Handles the XML node 'list-template'
1157 function doXmlListTemplate ($resource, $attributes) {
1158 // There are two attributes, by default
1159 if (count($attributes) != 2) {
1160 // Not the right count
1161 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1162 } elseif (!isset($attributes['VALUE'])) {
1163 // 'VALUE' not found
1164 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1165 } elseif (!isset($attributes['TYPE'])) {
1167 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1168 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1170 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1171 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1172 // Not valid/verifyable
1173 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1174 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1175 // doXmlCallbackFunction is missing
1176 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1179 // Add the entry to the array
1180 addXmlValueToCallbackAttributes('list_template', $attributes);
1183 // Handles the XML node 'list-row-template'
1184 function doXmlListRowTemplate ($resource, $attributes) {
1185 // There are two attributes, by default
1186 if (count($attributes) != 2) {
1187 // Not the right count
1188 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1189 } elseif (!isset($attributes['VALUE'])) {
1190 // 'VALUE' not found
1191 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1192 } elseif (!isset($attributes['TYPE'])) {
1194 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1195 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1197 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1198 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1199 // Not valid/verifyable
1200 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1201 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1202 // doXmlCallbackFunction is missing
1203 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1206 // Add the entry to the array
1207 addXmlValueToCallbackAttributes('list_row_template', $attributes);
1210 // Handles the XML node 'column-callback-list'
1211 function doXmlColumnCallbackList ($resource, $attributes) {
1212 // There should be no attributes
1213 if (isFilledArray($attributes)) {
1214 // Please don't add any attributes to foo-list nodes
1215 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1216 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) {
1217 // doXmlCallbackFunction is missing
1218 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.');
1221 // Add an empty list
1222 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array();
1225 // Handles the XML node 'column-callback-list-entry'
1226 function doXmlColumnCallbackListEntry ($resource, $attributes) {
1227 // There should be no attributes
1228 if (isFilledArray($attributes)) {
1229 // Please don't add any attributes to foo-list nodes
1230 reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes));
1231 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1232 // doXmlCallbackFunction is missing
1233 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.');
1237 // Handles the XML node 'column-callback-data'
1238 function doXmlColumnCallbackData ($resource, $attributes) {
1239 // There are three attributes, by default
1240 if (count($attributes) != 3) {
1241 // Not the right count
1242 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1243 } elseif (!isset($attributes['VALUE'])) {
1244 // 'VALUE' not found
1245 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1246 } elseif (!isset($attributes['TYPE'])) {
1248 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1249 } elseif (!isset($attributes['CALLBACK'])) {
1250 // 'CALLBACK' not found
1251 reportBug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.');
1252 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1254 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1255 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1256 // Not valid/verifyable
1257 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1258 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1259 // doXmlCallbackFunction is missing
1260 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1261 } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) {
1262 // 'CALLBACK' not valid/verifyable
1263 reportBug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']);
1266 // Add the entry to the array
1267 addXmlValueToCallbackAttributes('column_callback_list', $attributes);
1270 // Handles the XML node 'callback-extra-parameter-list'
1271 function doXmlCallbackExtraParameterList ($resource, $attributes) {
1272 // There should be no attributes
1273 if (isFilledArray($attributes)) {
1274 // Please don't add any attributes to foo-list nodes
1275 reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes));
1276 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) {
1277 // doXmlCallbackFunction is missing
1278 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.');
1279 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1280 // Abort silently here, no one wants to kill this array
1284 // Add an empty list
1285 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array();
1288 // Handles the XML node 'callback-extra-parameter-list-entry'
1289 function doXmlCallbackExtraParameterListEntry ($resource, $attributes) {
1290 // There are three attributes, by default
1291 if (count($attributes) != 3) {
1292 // Not the right count
1293 reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes));
1294 } elseif (!isset($attributes['COLUMN'])) {
1295 // 'COLUMN' not found
1296 reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.');
1297 } elseif (!isset($attributes['TYPE'])) {
1299 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1300 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1302 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1303 } elseif ((!isset($attributes['VALUE'])) && (!isset($attributes['DATA']))) {
1304 // 'VALUE' not found
1305 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE/DATA not found.');
1306 } elseif ((isset($attributes['VALUE'])) && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) {
1307 // 'VALUE' not valid/verifyable
1308 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1309 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) {
1310 // doXmlCallbackFunction/__EXTRA_PARAMETER is missing
1311 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.');
1312 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) {
1313 // doXmlCallbackFunction/data_column_list is missing
1314 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data_column_list not included around this node.');
1317 // Add the entry to the array
1318 addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes);
1321 // Handles the XML node 'no-entry-found-message'
1322 function doXmlNoEntryFoundMessage ($resource, $attributes) {
1323 // There are two attributes, by default
1324 if (count($attributes) != 2) {
1325 // Not the right count
1326 reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes));
1327 } elseif (!isset($attributes['VALUE'])) {
1328 // 'VALUE' not found
1329 reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
1330 } elseif (!isset($attributes['TYPE'])) {
1332 reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.');
1333 } elseif (!isInvalidXmlType($attributes['TYPE'])) {
1335 reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']);
1336 } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
1337 // Not valid/verifyable
1338 reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']);
1339 } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
1340 // doXmlCallbackFunction is missing
1341 reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
1344 // Add the entry to the array
1345 addXmlValueToCallbackAttributes('no_entry_message_id', $attributes);
1348 //-----------------------------------------------------------------------------
1349 // XML type validation
1350 //-----------------------------------------------------------------------------
1352 // Checks for string without any added extra data
1353 function isXmlTypeString ($value) {
1354 // Just let SQL_ESCAPE() do the job
1355 return ($value == sqlEscapeString($value));
1358 // Fake-check for array type
1359 function isXmlTypeArray ($value) {
1360 // This value is always a string
1361 return (is_string($value));
1364 // Check for boolean type
1365 function isXmlTypeBool ($value) {
1367 $value = trim($value);
1369 // This value is always a string
1370 return (($value == 'true') || ($value == 'false'));
1373 // Check for integer type
1374 function isXmlTypeInt ($value) {
1376 $value = trim($value);
1378 // This value is always a string
1379 return (bigintval($value) == $value);
1382 // Check for callback type
1383 function isXmlTypeCallback ($value) {
1385 $value = trim($value);
1387 // This value is always a string
1388 return (function_exists($value));
1391 //-----------------------------------------------------------------------------
1392 // Private XML functions
1393 //-----------------------------------------------------------------------------
1395 // Adds given attribut to element
1396 function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') {
1397 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!');
1398 // Is it boolean type?
1399 if ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) {
1400 // Then convert VALUE
1401 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!');
1402 $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']);
1403 } elseif ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'callback')) {
1404 // It is a simple call-back type
1405 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!');
1406 $attributes['VALUE'] = call_user_func($attributes['VALUE']);
1409 // What do we need to add?
1410 if ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'array')) {
1411 // Another nested array
1412 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element);
1413 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array();
1414 } elseif (!empty($extraKey)) {
1415 // Sub-array (one level only)
1416 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...');
1417 if (trim($attributes['NAME']) == '') {
1419 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1420 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey])) {
1421 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey] = array();
1423 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey])] = $attributes['VALUE'];
1424 } elseif (!empty($key)) {
1426 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')');
1427 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE'];
1430 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')');
1431 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE'];
1433 } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) {
1435 * ALIAS and FUNCTION detected? This may happen with SQL queries
1436 * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp`
1439 // Fix missing 'NAME'
1440 if (!isset($attributes['NAME'])) {
1441 $attributes['NAME'] = '';
1446 'column' => trim($attributes['VALUE']),
1447 'alias' => trim($attributes['ALIAS']),
1448 'function' => trim($attributes['FUNCTION']),
1449 'table' => trim($attributes['TABLE']),
1450 'name' => trim($attributes['NAME'])
1454 //* 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'] . ')');
1455 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) {
1456 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array();
1458 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1459 } elseif ((isset($attributes['NAME'])) && (isset($attributes['ALIAS']))) {
1460 // NAME/ALIAS detected
1462 'name' => trim($attributes['NAME']),
1463 'alias' => trim($attributes['ALIAS'])
1465 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',NAME=' . $attributes['NAME'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS']);
1466 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1467 } elseif ((isset($attributes['VALUE'])) && (isset($attributes['ALIAS']))) {
1468 // NAME/ALIAS detected
1470 'value' => trim($attributes['VALUE']),
1471 'alias' => trim($attributes['ALIAS'])
1473 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',NAME=' . $attributes['VALUE'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS']);
1474 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1475 } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) {
1476 // CONDITION/LOOK-FOR detected
1479 'column' => trim($attributes['VALUE']),
1480 'table' => trim($attributes['TABLE']),
1481 'condition' => convertXmlContion(trim($attributes['CONDITION'])),
1482 'look_for' => trim($attributes['LOOK-FOR'])
1485 //* 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'] . ')');
1486 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) {
1487 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array();
1489 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1490 } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['NAME']))) {
1491 // CONDITION/NAME detected
1492 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - CONDITION-NAME!');
1493 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['CONDITION'];
1494 } elseif (isset($attributes['CONDITION'])) {
1495 // CONDITION detected
1496 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ' - CONDITION!');
1497 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = convertXmlContion(trim($attributes['CONDITION']));
1498 } elseif (isset($attributes['CALLBACK'])) {
1499 // CALLBACK/VALUE detected
1500 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')');
1501 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK'];
1502 } elseif (isset($attributes['ORDER'])) {
1503 // ORDER/TABLE detected
1504 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')');
1505 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE'];
1506 } elseif ((isset($attributes['TYPE'])) && (isset($attributes['NAME'])) && (isset($attributes['COLUMN']))) {
1507 // TYPE/NAME/COLUMN detected
1510 'name' => trim($attributes['NAME']),
1511 'column' => trim($attributes['COLUMN'])
1513 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - TYPE-COLUMN! (COLUMN=' . $attributes['COLUMN'] . ')');
1514 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array;
1515 } elseif ((isset($attributes['COLUMN'])) && (isset($attributes['VALUE']))) {
1516 // COLUMN/VALUE detected
1517 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN/VALUE!');
1518 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) {
1519 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array();
1521 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])] = $attributes['VALUE'];
1522 } elseif ((isset($attributes['COLUMN'])) && (isset($attributes['DATA']))) {
1523 // COLUMN/DATA detected
1524 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',DATA[' . gettype($attributes['DATA']) . ']=' . $attributes['DATA'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN/DATA!');
1525 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) {
1526 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array();
1528 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])] = $attributes['VALUE'];
1529 } elseif (((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) && (isset($attributes['VALUE']))) {
1531 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!');
1532 if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) {
1533 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array();
1535 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $attributes['VALUE'];
1536 } elseif ((count($attributes) == 1) && (isset($attributes['TYPE']))) {
1538 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',TYPE[' . gettype($attributes['TYPE']) . ']=' . $attributes['TYPE'] . ' - TYPE-ONLY!');
1539 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $attributes['TYPE'];
1540 } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) {
1542 reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, TRUE) . '</pre>');
1543 } elseif ((isset($attributes['NAME'])) && (isset($attributes['VALUE']))) {
1544 // Use from NAME/VALUE
1545 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
1546 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE'];
1549 reportBug(__FUNCTION__, __LINE__, 'Unexpected stage detected. element=' . $element . ',attributes()=' . count($attributes));
1551 //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!');
1554 //-----------------------------------------------------------------------------
1555 // Execute call-back functions
1556 //-----------------------------------------------------------------------------
1558 // Execute function for doXmlCallbackFunction()
1559 function doXmlCallbackFunctionExecute ($callbackName, $args, $columnIndex, $content) {
1560 // Is 'id_index' set and form sent?
1561 if ((isset($args['id_index'])) && (isFormSent())) {
1562 // Prepare 'id_index'
1563 $args['id_index'] = postRequestElement($args['id_index']);
1567 $args['_content'] = $content;
1570 //* DEBUG: */ die(__FUNCTION__.':callbackFunction=' . $callbackName . ',<br />columnIndex=' . $columnIndex . ',<br />args(' . count($args) . ')=<pre>'.print_r($args, TRUE).'</pre>');
1571 //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'Called!');
1572 call_user_func_array($callbackName, $args);
1575 // For 'doing' add referral level, the column-index is required
1576 function addXmlSpecialAdminAddDoReferralLevels () {
1577 // So set it all here
1578 $GLOBALS['__COLUMN_INDEX']['doXmlCallbackFunction'] = 'column';
1579 $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_index'] = 'column';