Several fixes for extension handling
[mailer.git] / inc / filters.php
index 33c59228a02b7cc2329c13c3870f2834ee053ee9..b750c4a772aed5fe03084462a730e27ff7d63e42 100644 (file)
@@ -92,14 +92,14 @@ ORDER BY `filter_id` ASC", __FILE__, __LINE__);
 }
 
 // "Registers" a new filter function
-function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) {
+function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false) {
        global $filters;
 
        // Extend the filter function name
        $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
 
        // Is that filter already there?
-       if (isset($filters[$filterName][$filterFunction])) {
+       if ((isset($filters[$filterName][$filterFunction])) && (!$force)) {
                // Then abort here
                if (!$silentAbort) {
                        ADD_FATAL(sprintf(FILTER_FAILED_ALREADY_ADDED, $filterFunction, $filterName));
@@ -121,11 +121,14 @@ function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) {
 }
 
 // "Unregisters" a filter from the given chain
-function UNREGISTER_FILTER ($filterName, $filterFunction) {
+function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false) {
        global $filters;
 
+       // Extend the filter function name
+       $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
+
        // Is that filter there?
-       if (!isset($filters[$filterName][$filterFunction])) {
+       if ((!isset($filters[$filterName][$filterFunction])) && (!$force)) {
                // Not found, so abort here
                ADD_FATAL(sprintf(FILTER_FAILED_NOT_REMOVED, $filterFunction, $filterName));
                return false;