2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 08/03/2011 *
4 * =================== Last change: 08/03/2011 *
6 * -------------------------------------------------------------------- *
7 * File : earning_filter.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Filters for ext-earning *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Filter fuer ext-earning *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.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 function to add 'earning_group' POPUP
44 function FILTER_ADD_EARNING_GROUP_POPUP ($filterData) {
45 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
46 // Check if the current userid is same as in $filterData
47 if (getMemberId() != $filterData['userid']) {
49 debug_report_bug(__FUNCTION__, __LINE__, 'Validation of userid failed. ' . getMemberId() . '!=' . $filterData['userid']);
52 // Now check if the user has subscription and amount left
53 $result = SQL_QUERY_ESC("SELECT
56 u.`earning_current_amount`,
57 u.`earning_daily_amount`
59 `{?_MYSQL_PREFIX?}_user_earning` AS u
61 `{?_MYSQL_PREFIX?}_earning_data` AS d
63 u.`earning_id`=d.`earning_id`
65 u.`earning_userid`=%s AND
66 u.`earning_active`='Y' AND
67 u.`earning_current_amount` < u.`earning_daily_amount` AND
68 d.`earning_group`='POPUP'
70 d.`earning_sorting` ASC",
73 ), __FUNCTION__, __LINE__);
75 // Do we have entries left?
76 if (SQL_NUMROWS($result) > 0) {
78 while ($content = SQL_FETCHARRAY($result)) {
79 // Merge the $filterData array in
80 $content = merge_array($content, $filterData);
82 // Construct callback function name
83 $callbackName = 'get' . capitalizeUnderscoreString($content['earning_provider']) . 'DataByEarningArray';
86 $content = call_user_func($callbackName, $content);
91 SQL_FREERESULT($result);
94 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');