X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fexpression-functions.php;h=6d393659b1f49371ddbfa2a5c03ebb3293402191;hb=218f69fc35e2ff9e003324618208ec97e9cbf034;hp=29d412872442de503769cb4e0bdc05c5a0856290;hpb=ffe213c8e3f85119ddd5544214d0de9ecb833d98;p=mailer.git diff --git a/inc/expression-functions.php b/inc/expression-functions.php index 29d4128724..6d393659b1 100644 --- a/inc/expression-functions.php +++ b/inc/expression-functions.php @@ -138,42 +138,6 @@ function doExpressionServer ($data) { return $code; } -// Expression call-back function for fetching user data -function doExpressionUser ($data) { - // Use current userid by default - $functionName = 'getMemberId()'; - - // User-related data, so is there a userid? - if (!empty($data['matches'][4][$data['key']])) { - // Do we have a userid or $userid? - if ($data['matches'][4][$data['key']] == '$userid') { - // Use dynamic call - $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')"; - } elseif (!empty($data['matches'][4][$data['key']])) { - // User data found - $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')"; - } - } elseif ((!empty($data['callback'])) && (isUserDataValid())) { - // "Call-back" alias column for current logged in user's data - $functionName = "getUserData('" . $data['callback'] . "')"; - } - - // Do we have another function to run (e.g. translations) - if (!empty($data['extra_func'])) { - // Surround the original function call with it - $functionName = $data['extra_func'] . '(' . $functionName . ')'; - } // END - if - - // Generate replacer - $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}'; - - // Now replace the code - $code = replaceExpressionCode($data, $replacer); - - // Return replaced code - return $code; -} - // Expression call-back function for getting extension data function doExpressionExt ($data) { // Not installed is default @@ -222,16 +186,17 @@ function doExpressionPipe ($data) { // We need callback and extra_func: callback is really the call-back function, extra_func is our value $replacer = $data['extra_func']; - // Is the extra_func empty and value set? - if ((empty($replacer)) && (isset($data['value']))) { - // Then use this - $replacer = $data['value']; - } // END - if - // Do we have a call-back? Should always be there! if (!empty($data['callback'])) { - // Parse it through this function - $replacer = '{DQUOTE} . ' . $data['extra_func'] . '(' . $data['callback'] . "('" . $replacer . "')) . {DQUOTE}"; + //if ($data['callback'] == 'getMemberId') die('
'.encodeEntities(print_r($data, true)).'
'); + // If the value is empty, we don't add it + if (empty($data['value'])) { + // No value is set + $replacer = '{DQUOTE} . ' . $data['extra_func2'] . '(' . $data['extra_func'] . '(' . $data['callback'] . '())) . {DQUOTE}'; + } else { + // Some value is set + $replacer = '{DQUOTE} . ' . $data['extra_func2'] . '(' . $data['extra_func'] . '(' . $data['callback'] . "('" . $data['value'] . "'))) . {DQUOTE}"; + } } // END - if // Replace the config entry @@ -302,7 +267,16 @@ function doExpressionMessage ($data) { function doExpressionTemplate ($data) { // Do the replacement //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']); - $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true) . {DQUOTE}"; + $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true"; + + // Is 'value' set? + if (!empty($data['value'])) { + // Then include it as well + $replacer .= ", '" . $data['value'] . "'"; + } // END - if + + // Replacer is ready + $replacer .= ') . {DQUOTE}'; // Replace the code $code = replaceExpressionCode($data, $replacer);