2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 07/02/2011 *
4 * =================== Last change: 07/02/2011 *
6 * -------------------------------------------------------------------- *
7 * File : order_filter.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Filters for ext-order *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Filter fuer ext-order *
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 returning given user's points
44 function FILTER_USER_POINTS ($filterData) {
45 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
47 // Get the points and add them to the existing
48 $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'points');
50 // Return the data for next filter
51 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
55 // Filter for returning given user's locked points
56 function FILTER_LOCKED_USER_POINTS ($filterData) {
57 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
59 // Get the points and add them to the existing
60 $filterData['points'] += countSumTotalData($filterData['userid'], 'user_points', 'locked_points');
62 // Return the data for next filter
63 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
67 // Filter for returning all user points column names
68 function FILTER_GET_ALL_USER_POINTS_COLUMN_NAMES ($filterData) {
69 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
70 // Add 'points' and 'locked_points'
71 $filterData['columns'] .= $filterData['alias'] . 'points' . $filterData['separator'] . $filterData['alias'] . 'locked_points' . $filterData['separator'];
73 // Return the data for next filter
74 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
78 // Filter for excluding tester users in WHERE statements
79 function FILTER_TESTER_USER_EXCLUSION_SQL ($sql) {
80 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called! - sql(' . strlen($sql) . ')=' . $sql);
83 * Allow testers to be included? Do only this when you only want to test
84 * it, normally you don't want these accounts being included everywhere.
86 if (ifTesterAccountsAllowed()) {
87 // Do not exclude tester accounts
91 // Add it, as of this filter is registered only with ext-user >= 0.5.0
94 $sql = " WHERE `surname` NOT LIKE '{?tester_user_surname_prefix?}%%'";
97 $sql .= " AND `surname` NOT LIKE '{?tester_user_surname_prefix?}%%'";
100 // Return the data for next filter
101 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done! - sql(' . strlen($sql) . ')=' . $sql);
105 // Filter for including tester users in WHERE statements
106 function FILTER_TESTER_USER_INCLUSION_SQL ($sql) {
107 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called! - sql(' . strlen($sql) . ')=' . $sql);
108 // Add it, as of this filter is registered only with ext-user >= 0.5.0
111 $sql = " WHERE `surname` LIKE '{?tester_user_surname_prefix?}%%'";
114 $sql .= " AND `surname` LIKE '{?tester_user_surname_prefix?}%%'";
117 // Return the data for next filter
118 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done! - sql(' . strlen($sql) . ')=' . $sql);
122 // Filter to add SQL columns to user registration
123 function FILTER_TESTER_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) {
124 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
126 // Does the admin create a tester account?
127 if ((isAdmin()) && (isTesterUserName(postRequestElement('surname')))) {
128 // Yes, these accounts never needs confirmation (you can still test it by creating a usual account).
129 setPostRequestElement('status', 'CONFIRMED');
132 // Return filter data
133 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
134 //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=<pre>'.print_r($filterData,true).'</pre>';
138 // Filter to add 'converting' SQL statements
139 function FILTER_ADD_USER_DATA_CONVERT_SQL_COLUMNS ($sql) {
140 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called! - sql(' . strlen($sql) . ')=' . $sql);
143 $sql .= ', UNIX_TIMESTAMP(`lock_timestamp`) AS `lock_timestamp`';
145 // Return the data for next filter
146 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done! - sql(' . strlen($sql) . ')=' . $sql);