2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 06/02/2011 *
4 * =================== Last change: 06/02/2011 *
6 * -------------------------------------------------------------------- *
8 * -------------------------------------------------------------------- *
9 * Short description : Filters for ext- *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Filter fuer ext- *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
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. *
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. *
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, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Filter for extra-autpurge
44 function FILTER_RALLYE_EXTRA_AUTOPURGE ($filterData) {
45 // Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
46 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
47 purgeExpiredReferralRallyes();
50 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
54 // Run filter for notifying users about rallyes
55 function FILTER_RALLYE_NOTIFY_USERS ($filerData) {
56 // Do stuff only when not in CSS mode
57 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
58 if (!isCssOutputMode()) {
59 // Get total member count
60 $total = getTotalConfirmedUser();
62 // Run filter to get SQL "addons"
63 $sqlAddons = runFilterChain('add_rallye_notify_sqls', array(
68 // Check for new started but not notified rallyes
69 $result = SQL_QUERY("SELECT SQL_SMALL_RESULT
75 " . $sqlAddons['add'] . "
77 `{?_MYSQL_PREFIX?}_rallye_data` AS d
82 d.`start_time` <= UNIX_TIMESTAMP() AND
83 d.`end_time` > UNIX_TIMESTAMP()
84 LIMIT 1", __FILE__, __LINE__);
85 if (SQL_NUMROWS($result) == 1) {
87 autostartReferralRallyes($result);
91 SQL_FREERESULT($result);
93 // Check for expired rallyes
94 $result = SQL_QUERY("SELECT SQL_SMALL_RESULT
100 " . $sqlAddons['add'] . "
102 `{?_MYSQL_PREFIX?}_rallye_data` AS d
104 d.`is_active`='Y' AND
107 (d.`end_time` <= UNIX_TIMESTAMP()" . $sqlAddons['or'] . ")
108 LIMIT 1", __FILE__, __LINE__);
109 if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('autopurge'))) {
110 // End rallye here...
111 stopRallyeByResult($result);
115 SQL_FREERESULT($result);
119 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
123 // Filter for adding SQL columns
124 function FILTER_ADD_RALLYE_SQL_COLUMNS ($filterData) {
125 // Are all requirements met?
126 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
127 if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
128 // Add more data on higher versions
129 $filterData['add'] .= ',`min_users`,`min_prices`';
130 $filterData['or'] .= ' OR (d.`min_users` <= ' . $total . ' AND d.`min_users` > 0)';
134 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');