Some old lost copyright lines fixed, edit/delete admin functions rewritten
[mailer.git] / inc / functions.php
index 29421f39225739df8e8d4c591273093cbe8535e8..0bfa73075cb3eb8c3ec2584602d62f597008d900 100644 (file)
@@ -341,7 +341,7 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML='N', $FROM="") {
        $SUBJECT = html_entity_decode($SUBJECT);
 
        // Set from header
-       if (!eregi("@", $TO)) {
+       if ((!eregi("@", $TO)) && ($TO > 0)) {
                // Value detected, load email from database
                if (EXT_IS_ACTIVE("msg")) {
                        ADD_MESSAGE_TO_BOX($TO, $SUBJECT, $MSG, $HTML);
@@ -351,6 +351,9 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML='N', $FROM="") {
                        list($TO) = SQL_FETCHROW($result_email);
                        SQL_FREERESULT($result_email);
                }
+       } elseif ($TO == 0) {
+               // Is the webmaster!
+               $TO = WEBMASTER;
        }
 
        // Not in PHPMailer-Mode
@@ -2402,6 +2405,35 @@ function RESET_ADD_INCLUDES () {
                UPDATE_CONFIG("last_month", $currMonth);
        } // END - if
 }
+// Handle extra values
+function HANDLE_EXTRA_VALUES ($filterFunction, $value, $extraValue) {
+       // Default is the value itself
+       $ret = $value;
+
+       // Do we have a special filter function?
+       if (!empty($filterFunction)) {
+               // Do we have extra parameters here?
+               if (!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 = array_merge(array($vaue), $extraValue);
+                       } // END - if
+
+                       // Call the multi-parameter call-back
+                       $ret = call_user_func_array($filterFunction, $args);
+               } else {
+                       // One parameter call
+                       $ret = call_user_func($filterFunction, $value);
+               }
+       } // END - if
+
+       // Return the value
+       return $ret;
+}
 //
 //////////////////////////////////////////////////
 //                                              //