From: Roland Häder Date: Sat, 10 Nov 2012 15:44:07 +0000 (+0000) Subject: Additional fixes for XML handler and listing builder X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5bb4af7ad275a532206a773edb2f36d5ad355e06;p=mailer.git Additional fixes for XML handler and listing builder --- diff --git a/inc/callback-functions.php b/inc/callback-functions.php index 8f5aada84d..d42f017e3a 100644 --- a/inc/callback-functions.php +++ b/inc/callback-functions.php @@ -1247,7 +1247,10 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', 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!'); - $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE']; + 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] . ')'); @@ -1279,7 +1282,10 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', // 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'] . ')'); - $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array; + 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['LOOK-FOR']))) { // CONDITION/LOOK-FOR detected // Init array @@ -1291,7 +1297,10 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', ); //* 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'] . ')'); - $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array; + 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!'); @@ -1307,11 +1316,17 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', } elseif (isset($attributes['COLUMN'])) { // COLUMN/VALUE detected //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!'); - $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['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['NAME'])) || (trim($attributes['NAME']) == '')) { // Numerical index //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!'); - $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $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])] = $attributes['VALUE']; } 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) . '
'); diff --git a/inc/functions.php b/inc/functions.php index 5fae9029ad..ff6852bb84 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1369,6 +1369,24 @@ function doHandleExtraValues ($filterFunctions, $extraValues, $key, $entries, $u // Then log it /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',extraValues=' . $extraValues[$key] . ',key=' . $key . ',id=' . $id . ',entries[' . gettype($entries) . ']=' . $entries . ' - AFTER!'); } // END - if + } elseif ((!empty($filterFunctions[$search])) && (!empty($extraValues[$search]))) { + // Debug mode enabled? + if (isDebugModeEnabled()) { + // Then log it + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',key=' . $key . ',search=' . $search . ',entries[' . gettype($entries) . ']=' . $entries . ' - BEFORE!'); + } // END - if + + // Handle extra values + $entries = handleExtraValues($filterFunctions[$search], $entries, $extraValues[$search]); + + // Debug mode enabled? + if (isDebugModeEnabled()) { + // Then log it + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'search=' . $search . ',filterFunctions=' . $filterFunctions[$search] . ',key=' . $key . ',search=' . $search . ',entries[' . gettype($entries) . ']=' . $entries . ' - AFTER!'); + } // END - if + + // Make sure entries is not bool, then something went wrong + assert(!is_bool($entries)); } elseif (!empty($filterFunctions[$search])) { // Debug mode enabled? if (isDebugModeEnabled()) { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index a9ba796101..e8257ceaee 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -495,7 +495,7 @@ ORDER BY while ($content = SQL_FETCHARRAY($result)) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . intval($userid) . '/' . $content['userid']); $OUT .= '