]> git.mxchange.org Git - mailer.git/blobdiff - inc/callback-functions.php
Forgot it to comment out ... :(
[mailer.git] / inc / callback-functions.php
index 042781b9c1873f795de92fb6f2cb721460ccbac2..d22e6ee36b26337a3d90f6f6d322082f69c3207b 100644 (file)
@@ -319,6 +319,18 @@ function doXmlExtraParameterReloadList ($resource, $attributes) {
        }
 }
 
+// Handles the XML node 'extra-parameter-waiting-list'
+function doXmlExtraParameterWaitingList ($resource, $attributes) {
+       // There should be no attributes
+       if (count($attributes) > 0) {
+               // 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']['extra_list']['waiting_list'])) {
+               // This list should be created already
+               reportBug(__FUNCTION__, __LINE__, 'waiting_list should be already created.');
+       }
+}
+
 // Handles the XML node 'extra-parameter-member-list-entry'
 function doXmlExtraParameterMemberListEntry ($resource, $attributes) {
        // There are three attributes, by default
@@ -379,6 +391,36 @@ function doXmlExtraParameterReloadListEntry ($resource, $attributes) {
        addXmlValueToCallbackAttributes('extra_list', $attributes, 'reload_list');
 }
 
+// Handles the XML node 'extra-parameter-waiting-list-entry'
+function doXmlExtraParameterWaitingListEntry ($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['NAME'])) {
+               // 'NAME' not found
+               reportBug(__FUNCTION__, __LINE__, 'Required attribute NAME 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'])) {
+               // 'VALUE' not found
+               reportBug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.');
+       } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) {
+               // Not valid/verifyable
+               reportBug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']);
+       } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['waiting_list'])) {
+               // doXmlCallbackFunction is missing
+               reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/waiting-list not included around this node. Please fix your XML.');
+       }
+
+       // Add the entry to the list
+       addXmlValueToCallbackAttributes('extra_list', $attributes, 'waiting_list');
+}
+
 // Handles the XML node 'extra-parameter-added-list'
 function doXmlExtraParameterAddedList ($resource, $attributes) {
        // There should be no attributes
@@ -499,10 +541,13 @@ function doXmlStatusChangeList ($resource, $attributes) {
        if (count($attributes) > 0) {
                // 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']['status_list'])) {
+       } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) {
                // doXmlCallbackFunction is missing
-               reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.');
+               reportBug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.');
        }
+
+       // Add the entry to the list
+       $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'] = array();
 }
 
 // Handles the XML node 'status-change-list-entry'
@@ -1205,7 +1250,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] . ')');
@@ -1237,7 +1285,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
@@ -1249,7 +1300,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!');
@@ -1265,14 +1319,20 @@ 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=<pre>' . print_r($attributes, true) . '</pre>');
+               reportBug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=<pre>' . print_r($attributes, TRUE) . '</pre>');
        } else {
                // Use from NAME
                //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!');
@@ -1286,17 +1346,28 @@ function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '',
 //-----------------------------------------------------------------------------
 
 // Execute function for doXmlCallbackFunction()
-function doXmlCallbackFunctionExecute ($callbackName, $args, $columnIndex) {
+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('callbackFunction=' . $callbackName . ',columnIndex=' . $columnIndex . ',args=<pre>'.print_r($args, true).'</pre>');
+       //* DEBUG: */ die(__FUNCTION__.':callbackFunction=' . $callbackName . ',<br />columnIndex=' . $columnIndex . ',<br />args(' . count($args) . ')=<pre>'.print_r($args, TRUE).'</pre>');
+       //* 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]
 ?>