'.print_r($attributes,true).''); addXmlValueToCallbackAttributes('join_on_condition', $attributes); } // Handles the XML node 'select-data-from-list' function doXmlSelectDataFromList ($resource, $attributes) { // There should be no attributes if (isFilledArray($attributes)) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); } // Add an empty list $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array(); } // Handles the XML node 'select-data-from-list-entry' function doXmlSelectDataFromListEntry ($resource, $attributes) { // There are five attributes, by default if (count($attributes) != 5) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes)); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif (!isset($attributes['ALIAS'])) { // 'ALIAS' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.'); } elseif (!isset($attributes['FUNCTION'])) { // 'FUNCTION' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.'); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // 'VALUE' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) { // 'ALIAS' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']); } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) { // 'FUNCTION' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.'); } // Add the entry to the array addXmlValueToCallbackAttributes('data_column_list', $attributes); } // Handles the XML node 'where-select-from-list' function doXmlWhereSelectFromList ($resource, $attributes) { // There should be no attributes if (isFilledArray($attributes)) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); } // Add an empty list $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array(); } // Handles the XML node 'where-select-from-list-entry' function doXmlWhereSelectFromListEntry ($resource, $attributes) { // There are five attributes, by default if (count($attributes) != 5) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes)); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isset($attributes['TABLE'])) { // 'TABLE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.'); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isset($attributes['CONDITION'])) { // 'CONDITION' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.'); } elseif (!isset($attributes['LOOK-FOR'])) { // 'LOOK-FOR' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute LOOK-FOR not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) { // 'TABLE' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // 'VALUE' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) { // 'CONDITION' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']); } elseif (!isXmlConditionValid($attributes['CONDITION'])) { // 'CONDITION' is not known reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.'); } // Add the entry to the array addXmlValueToCallbackAttributes('where_select_list', $attributes); } // Handles the XML node 'where-condition' function doXmlWhereCondition ($resource, $attributes) { // There are two attributes, by default if (count($attributes) != 3) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes because this is a where-condition node, got ' . count($attributes)); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isset($attributes['CONDITION'])) { // 'CONDITION' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute CONDITION not found.'); } elseif (!isset($attributes['NAME'])) { // 'NAME' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME not found.'); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['CONDITION'])) { // 'CONDITION' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION does not validate. CONDITION=' . $attributes['CONDITION']); } elseif ((!empty($attributes['CONDITION'])) && (!isXmlConditionValid($attributes['CONDITION']))) { // 'CONDITION' is not known reportBug(__FUNCTION__, __LINE__, 'Attribute CONDITION is not valid. CONDITION=' . $attributes['CONDITION']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); } // Add an empty list addXmlValueToCallbackAttributes('where_condition', $attributes); } // Handles the XML node 'order-by-list' function doXmlOrderByList ($resource, $attributes) { // There should be no attributes if (isFilledArray($attributes)) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); } // Add an empty list $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array(); } // Handles the XML node 'order-by-list-entry' function doXmlOrderByListEntry ($resource, $attributes) { // There are four attributes, by default if (count($attributes) != 4) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes)); } elseif (!isset($attributes['ORDER'])) { // 'ORDER' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isset($attributes['TABLE'])) { // 'TABLE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.'); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) { // 'ORDER' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']); } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) { // 'TABLE' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']); } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) { // 'VALUE' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.'); } // Add the entry to the array addXmlValueToCallbackAttributes('order_by_list', $attributes); } // Handles the XML node 'list-template' function doXmlListTemplate ($resource, $attributes) { // There are two attributes, by default if (count($attributes) != 2) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the array addXmlValueToCallbackAttributes('list_template', $attributes); } // Handles the XML node 'list-row-template' function doXmlListRowTemplate ($resource, $attributes) { // There are two attributes, by default if (count($attributes) != 2) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the array addXmlValueToCallbackAttributes('list_row_template', $attributes); } // Handles the XML node 'column-callback-list' function doXmlColumnCallbackList ($resource, $attributes) { // There should be no attributes if (isFilledArray($attributes)) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); } // Add an empty list $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array(); } // Handles the XML node 'column-callback-list-entry' function doXmlColumnCallbackListEntry ($resource, $attributes) { // There should be no attributes if (isFilledArray($attributes)) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.'); } } // Handles the XML node 'column-callback-data' function doXmlColumnCallbackData ($resource, $attributes) { // There are three attributes, by default if (count($attributes) != 3) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isset($attributes['CALLBACK'])) { // 'CALLBACK' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) { // 'CALLBACK' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']); } // Add the entry to the array addXmlValueToCallbackAttributes('column_callback_list', $attributes); } // Handles the XML node 'callback-extra-parameter-list' function doXmlCallbackExtraParameterList ($resource, $attributes) { // There should be no attributes if (isFilledArray($attributes)) { // Please don't add any attributes to foo-list nodes reportBug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes)); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.'); } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) { // Abort silently here, no one wants to kill this array return; } // Add an empty list $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array(); } // Handles the XML node 'callback-extra-parameter-list-entry' function doXmlCallbackExtraParameterListEntry ($resource, $attributes) { // There are three attributes, by default if (count($attributes) != 3) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); } elseif (!isset($attributes['COLUMN'])) { // 'COLUMN' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif ((!isset($attributes['VALUE'])) && (!isset($attributes['DATA']))) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE/DATA not found.'); } elseif ((isset($attributes['VALUE'])) && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) { // 'VALUE' not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) { // doXmlCallbackFunction/__EXTRA_PARAMETER is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.'); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) { // doXmlCallbackFunction/data_column_list is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data_column_list not included around this node.'); } // Add the entry to the array addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes); } // Handles the XML node 'no-entry-found-message' function doXmlNoEntryFoundMessage ($resource, $attributes) { // There are two attributes, by default if (count($attributes) != 2) { // Not the right count reportBug(__FUNCTION__, __LINE__, 'Expected 2 attributes, got ' . count($attributes)); } elseif (!isset($attributes['VALUE'])) { // 'VALUE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); } elseif (!isset($attributes['TYPE'])) { // 'TYPE' not found reportBug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); } elseif (!isInvalidXmlType($attributes['TYPE'])) { // No valid type reportBug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { // doXmlCallbackFunction is missing reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the array addXmlValueToCallbackAttributes('no_entry_message_id', $attributes); } //----------------------------------------------------------------------------- // XML type validation //----------------------------------------------------------------------------- // Checks for string without any added extra data function isXmlTypeString ($value) { // Just let SQL_ESCAPE() do the job return ($value == sqlEscapeString($value)); } // Fake-check for array type function isXmlTypeArray ($value) { // This value is always a string return (is_string($value)); } // Check for boolean type function isXmlTypeBool ($value) { // Trim value $value = trim($value); // This value is always a string return (($value == 'true') || ($value == 'false')); } // Check for integer type function isXmlTypeInt ($value) { // Trim value $value = trim($value); // This value is always a string return (bigintval($value) == $value); } // Check for callback type function isXmlTypeCallback ($value) { // Trim value $value = trim($value); // This value is always a string return (function_exists($value)); } //----------------------------------------------------------------------------- // Private XML functions //----------------------------------------------------------------------------- // Adds given attribut to element function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') { //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!'); // Is it boolean type? if ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) { // Then convert VALUE //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CONVERTING!'); $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']); } elseif ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'callback')) { // It is a simple call-back type //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element . ' - CALLING!'); $attributes['VALUE'] = call_user_func($attributes['VALUE']); } // What do we need to add? if ((isset($attributes['TYPE'])) && ($attributes['TYPE'] == 'array')) { // Another nested array //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=' . $attributes['TYPE'] . ',element=' . $element); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array(); } elseif (!empty($extraKey)) { // Sub-array (one level only) //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...'); if (trim($attributes['NAME']) == '') { // Numerical index //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!'); if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey])) { $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey] = array(); } // END - if $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey])] = $attributes['VALUE']; } elseif (!empty($key)) { // Use from $key //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE']; } else { // Use from NAME //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE']; } } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) { /* * ALIAS and FUNCTION detected? This may happen with SQL queries * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp` */ // Fix missing 'NAME' if (!isset($attributes['NAME'])) { $attributes['NAME'] = ''; } // END - if // Init array $array = array( 'column' => trim($attributes['VALUE']), 'alias' => trim($attributes['ALIAS']), 'function' => trim($attributes['FUNCTION']), 'table' => trim($attributes['TABLE']), 'name' => trim($attributes['NAME']) ); // Add the entry //* 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'] . ')'); if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) { $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array(); } // END - if $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array; } elseif ((isset($attributes['NAME'])) && (isset($attributes['ALIAS']))) { // NAME/ALIAS detected $array = array( 'name' => trim($attributes['NAME']), 'alias' => trim($attributes['ALIAS']) ); //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',NAME=' . $attributes['NAME'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS']); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array; } elseif ((isset($attributes['VALUE'])) && (isset($attributes['ALIAS']))) { // NAME/ALIAS detected $array = array( 'value' => trim($attributes['VALUE']), 'alias' => trim($attributes['ALIAS']) ); //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',NAME=' . $attributes['VALUE'] . ',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS']); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array; } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['LOOK-FOR']))) { // CONDITION/LOOK-FOR detected // Init array $array = array( 'column' => trim($attributes['VALUE']), 'table' => trim($attributes['TABLE']), 'condition' => convertXmlContion(trim($attributes['CONDITION'])), 'look_for' => trim($attributes['LOOK-FOR']) ); //* 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'] . ')'); if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) { $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array(); } // END - if $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array; } elseif ((isset($attributes['CONDITION'])) && (isset($attributes['NAME']))) { // CONDITION/NAME detected //* 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!'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['CONDITION']; } elseif (isset($attributes['CONDITION'])) { // CONDITION detected //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CONDITION[' . gettype($attributes['CONDITION']) . ']=' . $attributes['CONDITION'] . ' - CONDITION!'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = convertXmlContion(trim($attributes['CONDITION'])); } elseif (isset($attributes['CALLBACK'])) { // CALLBACK/VALUE detected //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK']; } elseif (isset($attributes['ORDER'])) { // ORDER/TABLE detected //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE']; } elseif ((isset($attributes['TYPE'])) && (isset($attributes['NAME'])) && (isset($attributes['COLUMN']))) { // TYPE/NAME/COLUMN detected // Init array $array = array( 'name' => trim($attributes['NAME']), 'column' => trim($attributes['COLUMN']) ); //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ',NAME[' . gettype($attributes['NAME']) . ']=' . $attributes['NAME'] . ' - TYPE-COLUMN! (COLUMN=' . $attributes['COLUMN'] . ')'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $array; } elseif ((isset($attributes['COLUMN'])) && (isset($attributes['VALUE']))) { // COLUMN/VALUE detected //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN/VALUE!'); if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) { $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array(); } // END - if $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])] = $attributes['VALUE']; } elseif ((isset($attributes['COLUMN'])) && (isset($attributes['DATA']))) { // COLUMN/DATA detected //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',DATA[' . gettype($attributes['DATA']) . ']=' . $attributes['DATA'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN/DATA!'); if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])) { $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']] = array(); } // END - if $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']])] = $attributes['VALUE']; } elseif (((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) && (isset($attributes['VALUE']))) { // Numerical index //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!'); if (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])) { $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element] = array(); } // END - if $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $attributes['VALUE']; } elseif ((count($attributes) == 1) && (isset($attributes['TYPE']))) { // Only TYPE found //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',TYPE[' . gettype($attributes['TYPE']) . ']=' . $attributes['TYPE'] . ' - TYPE-ONLY!'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][count($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element])] = $attributes['TYPE']; } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) { // Already created reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=
' . print_r($attributes, TRUE) . '
'); } elseif ((isset($attributes['NAME'])) && (isset($attributes['VALUE']))) { // Use from NAME/VALUE //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!'); $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE']; } else { // Unknown stage reportBug(__FUNCTION__, __LINE__, 'Unexpected stage detected. element=' . $element . ',attributes()=' . count($attributes)); } //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!'); } //----------------------------------------------------------------------------- // Execute call-back functions //----------------------------------------------------------------------------- // Execute function for doXmlCallbackFunction() function doXmlCallbackFunctionExecute ($callbackName, $args, $columnIndex, $content) { // Is 'id_index' set and form sent? if ((isset($args['id_index'])) && (isFormSent())) { // Prepare 'id_index' $args['id_index'] = postRequestElement($args['id_index']); } // END - if // Add content $args['_content'] = $content; // Just call it //* DEBUG: */ die(__FUNCTION__.':callbackFunction=' . $callbackName . ',
columnIndex=' . $columnIndex . ',
args(' . count($args) . ')=
'.print_r($args, TRUE).'
'); //* DEBUG: */ reportBug(__FUNCTION__, __LINE__, 'Called!'); call_user_func_array($callbackName, $args); } // For 'doing' add referral level, the column-index is required function addXmlSpecialAdminAddDoReferralLevels () { // So set it all here $GLOBALS['__COLUMN_INDEX']['doXmlCallbackFunction'] = 'column'; $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_index'] = 'column'; } // [EOF] ?>