]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
WARNING: id is very generic, it has been now renamed to booking_id, please fix your...
[mailer.git] / inc / functions.php
index 6aecfae83a22d43bd0baf18a1d09335d5f0841f3..a941932a6ca5d471dbe8008484b418f6c5802fbd 100644 (file)
@@ -1290,41 +1290,41 @@ function handleExtraValues ($filterFunction, $value, $extraValue) {
        $ret = $value;
 
        // Is there a special filter function?
-       if (!empty($filterFunction)) {
-               // Does the filter function exist?
-               if (function_exists($filterFunction)) {
-                       // Is there extra parameters here?
-                       if ((!is_null($extraValue)) && (!empty($extraValue))) {
-                               // Put both parameters in one new array by default
-                               $args = array($value, $extraValue);
-
-                               // If we have an array simply use it and pre-extend it with our value
-                               if (is_array($extraValue)) {
-                                       // Make the new args array
-                                       $args = merge_array(array($value), $extraValue);
-                               } // END - if
+       if ((empty($filterFunction)) || (!function_exists($filterFunction))) {
+               // Call-back function does not exist or is empty
+               reportBug(__FUNCTION__, __LINE__, 'Filter function ' . $filterFunction . ' does not exist or is empty: value[' . gettype($value) . ']=' . $value . ',extraValue[' . gettype($extraValue) . ']=' . $extraValue);
+       } // END - if
 
-                               // Call the multi-parameter call-back
-                               $ret = call_user_func_array($filterFunction, $args);
+       // Is there extra parameters here?
+       if ((!is_null($extraValue)) && (!empty($extraValue))) {
+               // Put both parameters in one new array by default
+               $args = array($value, $extraValue);
 
-                               // Is $ret 'true'?
-                               if ($ret === TRUE) {
-                                       // Test passed, so write direct value
-                                       $ret = $args;
-                               } // END - if
-                       } else {
-                               // One parameter call
-                               $ret = call_user_func($filterFunction, $value);
-                               //* BUG */ die('ret['.gettype($ret).']=' . $ret . ',value=' . $value.',filterFunction=' . $filterFunction);
-
-                               // Is $ret 'true'?
-                               if ($ret === TRUE) {
-                                       // Test passed, so write direct value
-                                       $ret = $value;
-                               } // END - if
-                       }
+               // If we have an array simply use it and pre-extend it with our value
+               if (is_array($extraValue)) {
+                       // Make the new args array
+                       $args = merge_array(array($value), $extraValue);
                } // END - if
-       } // END - if
+
+               // Call the multi-parameter call-back
+               $ret = call_user_func_array($filterFunction, $args);
+
+               // Is $ret 'true'?
+               if ($ret === TRUE) {
+                       // Test passed, so write direct value
+                       $ret = $args;
+               } // END - if
+       } else {
+               // One parameter call
+               $ret = call_user_func($filterFunction, $value);
+               //* BUG */ die('ret['.gettype($ret).']=' . $ret . ',value=' . $value.',filterFunction=' . $filterFunction);
+
+               // Is $ret 'true'?
+               if ($ret === TRUE) {
+                       // Test passed, so write direct value
+                       $ret = $value;
+               } // END - if
+       }
 
        // Return the value
        return $ret;
@@ -2409,6 +2409,21 @@ function isIp4AddressValid ($address) {
        return $GLOBALS[__FUNCTION__][$address];
 }
 
+// Returns the string if not empty or FALSE if empty
+function validateIsEmpty ($str) {
+       // Trim it
+       $trimmed = trim($str);
+
+       // Is the string empty?
+       if (empty($trimmed)) {
+               // Then set FALSE
+               $str = FALSE;
+       } // END - if
+
+       // Return it
+       return $str;
+}
+
 // ----------------------------------------------------------------------------
 //              "Translatation" functions for points_data table
 // ----------------------------------------------------------------------------