]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/forced_filter.php
mailer project continued:
[mailer.git] / inc / filter / forced_filter.php
index a2bb805336a398044820cb70b211116ddbae0ec1..418746971fd938552f9d3ff759cf80fa18506d13 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -43,18 +43,18 @@ if (!defined('__SECURITY')) {
 // Filter to add default forced-ad types
 function FILTER_FORCED_AD_TYPE_DEFAULTS ($data) {
        // Forced-Banner
-       $data[] = array(
-               'type'   => 'BANNER',
-       );
-
-       // Forced-Textlinks
-       $data[] = array(
-               'type'   => 'TEXTLINK',
-       );
-
-       // Forced-Popups
-       $data[] = array(
-               'type'   => 'POPUP',
+       array_push(
+               $data,
+               array(
+                       // Forced-Banner
+                       'type' => 'BANNER',
+               ), array(
+                       // Forced-Textlinks
+                       'type' => 'TEXTLINK',
+               ), array(
+                       // Forced-PopUp
+                       'type' => 'POPUP',
+               )
        );
 
        // Return data
@@ -79,5 +79,45 @@ function FILTER_FORCED_POPUP_TABLE_DATA ($filterData) {
        return $filterData;
 }
 
+// Filter for changing URL status
+function FILTER_FORCED_CHANGE_CAMPAIGN_STATUS ($filterData) {
+       /*
+       // Do some dirty fixing here:
+       if (($filterData['data']['forced_campaign_status'] == 'STOPPED') && ($filterData['new_status'] == 'pending')) {
+               // Fix for template change
+               $filterData['new_status'] = 'continued';
+       } // END - if
+       */
+
+       // Send admin notification
+       doForcedNotifyAdmin('campaign_' . strtolower($filterData['data']['forced_campaign_status']) . '_' . $filterData['new_status'], $filterData['data']);
+
+       // Send user notification
+       doForcedNotifyMember('campaign_' . strtolower($filterData['data']['forced_campaign_status']) . '_' . $filterData['new_status'], $filterData['data']);
+
+       // Return filter data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
+// Filter for validating status
+function FILTER_FORCED_CHANGE_CAMPAIGN_VALIDATE_DATA ($filterData) {
+       // Is the new status set?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+       if ((!is_string($filterData['new_status'])) || (empty($filterData['new_status']))) {
+               // Abort here, not fine
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newStatus[' . gettype($filterData['new_status']) . ']=' . $filterData['new_status'] . ' - EXIT!');
+               $filterData['abort'] = false;
+       } elseif ($filterData['data']['forced_campaign_status'] != $filterData['prev_status']) {
+               // Status is not like prevStatus
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterData['data']['forced_campaign_status'] . '!=' . $filterData['prev_status'] . ' - EXIT!');
+               $filterData['abort'] = false;
+       } // END - if
+
+       // Return filter data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $filterData;
+}
+
 // [EOF]
 ?>