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 ($filterData) {
56 // Do stuff only when not in CSS mode
57 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
58 if (!isCssOutputMode()) {
59 // Run filter to get SQL "addons"
60 $sqlAddons = runFilterChain('add_rallye_notify_sqls', array(
65 // Check for new started but not notified rallyes
66 $result = SQL_QUERY("SELECT SQL_SMALL_RESULT
72 " . $sqlAddons['add'] . "
74 `{?_MYSQL_PREFIX?}_rallye_data` AS d
79 d.`start_time` <= UNIX_TIMESTAMP() AND
80 d.`end_time` > UNIX_TIMESTAMP()
81 LIMIT 1", __FILE__, __LINE__);
82 if (SQL_NUMROWS($result) == 1) {
84 autostartReferralRallyes($result);
88 SQL_FREERESULT($result);
90 // Check for expired rallyes
91 $result = SQL_QUERY("SELECT SQL_SMALL_RESULT
97 " . $sqlAddons['add'] . "
99 `{?_MYSQL_PREFIX?}_rallye_data` AS d
101 d.`is_active`='Y' AND
104 (d.`end_time` <= UNIX_TIMESTAMP()" . $sqlAddons['or'] . ")
105 LIMIT 1", __FILE__, __LINE__);
106 if ((SQL_NUMROWS($result) == 1) && (isExtensionActive('autopurge'))) {
107 // End rallye here...
108 stopRallyeByResult($result);
112 SQL_FREERESULT($result);
116 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
120 // Filter for adding SQL columns
121 function FILTER_ADD_RALLYE_SQL_COLUMNS ($filterData) {
122 // Are all requirements met?
123 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
124 if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
125 // Add more data on higher versions
126 $filterData['add'] .= ',`min_users`,`min_prices`';
127 $filterData['or'] .= ' OR (d.`min_users` <= ' . getTotalConfirmedUser() . ' AND d.`min_users` > 0)';
131 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');