Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / filter / forced_filter.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 07/27/2011 *
4  * ===================                          Last change: 07/27/2011 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : forced_filter.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Filters for ext-forced                           *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Filter fuer ext-forced                           *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Filter to add default forced-ad types
44 function FILTER_FORCED_AD_TYPE_DEFAULTS ($filterData) {
45         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
46         // Forced-Banner
47         array_push(
48                 $filterData,
49                 array(
50                         // Forced-Banner
51                         'type' => 'BANNER',
52                 ), array(
53                         // Forced-Textlinks
54                         'type' => 'TEXTLINK',
55                 ), array(
56                         // Forced-PopUp
57                         'type' => 'POPUP',
58                 )
59         );
60
61         // Return data
62         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
63         return $filterData;
64 }
65
66 // Filter for collecting data for the member table
67 function FILTER_FORCED_POPUP_TABLE_DATA ($filterData) {
68         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
69         // Is this the right filter?
70         if ($filterData['earning_provider'] == 'FORCED_POPUP') {
71                 // Set group
72                 $filterData['earning_group'] = 'POPUP';
73
74                 // Get max/min/count of all popups
75                 // @TODO This part is unfinished
76                 die(__FUNCTION__ . ':filterData=<pre>' . print_r($filterData, TRUE) . '</pre>');
77         } // END - if
78
79         // Return filter data array
80         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
81         return $filterData;
82 }
83
84 // Filter for changing URL status
85 function FILTER_FORCED_CHANGE_CAMPAIGN_STATUS ($filterData) {
86         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
87         /*
88         // Do some dirty fixing here:
89         if (($filterData['data']['forced_campaign_status'] == 'STOPPED') && ($filterData['new_status'] == 'pending')) {
90                 // Fix for template change
91                 $filterData['new_status'] = 'continued';
92         } // END - if
93         */
94
95         // Send admin notification
96         doForcedNotifyAdmin('campaign_' . strtolower($filterData['data']['forced_campaign_status']) . '_' . $filterData['new_status'], $filterData['data']);
97
98         // Send user notification
99         doForcedNotifyMember('campaign_' . strtolower($filterData['data']['forced_campaign_status']) . '_' . $filterData['new_status'], $filterData['data']);
100
101         // Return filter data
102         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
103         return $filterData;
104 }
105
106 // Filter for validating status
107 function FILTER_FORCED_CHANGE_CAMPAIGN_VALIDATE_DATA ($filterData) {
108         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
109         // Is the new status set?
110         if ((!is_string($filterData['new_status'])) || (empty($filterData['new_status']))) {
111                 // Abort here, not fine
112                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'newStatus[' . gettype($filterData['new_status']) . ']=' . $filterData['new_status'] . ' - EXIT!');
113                 interruptFilterChain();
114         } elseif ($filterData['data']['forced_campaign_status'] != $filterData['prev_status']) {
115                 // Status is not like prevStatus
116                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterData['data']['forced_campaign_status'] . '!=' . $filterData['prev_status'] . ' - EXIT!');
117                 continueFilterChain();
118         } // END - if
119
120         // Return filter data
121         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
122         return $filterData;
123 }
124
125 // Filter for handling click on forced ad
126 function FILTER_HANDLE_FORCED_AD_CLICK ($filterData) {
127         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
128         // Are all required parameters set?
129         die(__FUNCTION__ . ': filterData=<pre>' . print_r($filterData, TRUE) . '</pre>');
130
131         // Return filter data
132         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
133         return $filterData;
134 }
135
136 // Filter for handling viewing forced banner
137 function FILTER_HANDLE_FORCED_AD_VIEW ($filterData) {
138         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
139         // Are all required parameters set?
140         die(__FUNCTION__ . ': filterData=<pre>' . print_r($filterData, TRUE) . '</pre>');
141
142         // Return filter data
143         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
144         return $filterData;
145 }
146
147 // [EOF]
148 ?>