2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 07/31/2011 *
4 * =================== Last change: 07/31/2011 *
6 * -------------------------------------------------------------------- *
7 * File : what-earnings.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Extra earnings for the user *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Zusatzverdienst fuer die Mitglieder *
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')) {
41 } elseif (!isMember()) {
42 redirectToIndexMemberOnlyModule();
45 // Add description as navigation point
46 addYouAreHereLink('member', __FILE__);
50 // Then handle the extra earning request
52 postRequestElement('earning_id'),
53 postRequestElement('earning_daily_amount'),
54 postRequestElement('earning_active')
58 // Check for all earnings
59 $result = SQL_QUERY('SELECT
64 `{?_MYSQL_PREFIX?}_earning_data` AS d
66 d.`earning_sorting` ASC', __FILE__, __LINE__);
69 if (!SQL_HASZERONUMS($result)) {
74 while ($content = SQL_FETCHARRAY($result)) {
75 // Load user_earning data
76 $result2 = SQL_QUERY_ESC('SELECT
78 UNIX_TIMESTAMP(u.`earning_added`) AS `earning_added`,
79 UNIX_TIMESTAMP(u.`earning_canceled`) AS `earning_canceled`,
80 u.`earning_daily_amount`,
83 `{?_MYSQL_PREFIX?}_user_earning` AS u
89 bigintval($content['earning_id']),
91 ), __FILE__, __LINE__);
94 if (SQL_NUMROWS($result2) == 1) {
96 $content = merge_array($content, SQL_FETCHARRAY($result2));
100 SQL_FREERESULT($result2);
102 // Is there user_earning data available?
103 if (!isset($content['earning_active'])) {
104 // Load row template "open subscription"
105 $OUT .= loadTemplate('member_earning_' . strtolower($content['earning_group']) . '_form_row', TRUE, $content);
107 // Load row template "already subscribed"
108 $OUT .= loadTemplate('member_earning_' . strtolower($content['earning_group']) . '_row', TRUE, $content);
112 // Load main template
113 loadTemplate('member_earning', FALSE, $OUT);
116 displayMessage('{--MEMBER_EARNINGS_404--}');
120 SQL_FREERESULT($result);