2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/23/2003 *
4 * =================== Last change: 09/23/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-sub_points.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Add manually points to a user *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Manuell einem Mitglied Punkte gutschreiben *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
48 if (getRequestParameter('userid') == 'all') {
49 // Add points to all accounts
50 $content['points'] = bigintval(postRequestParameter('points'));
53 if ((isFormSent()) && (postRequestParameter('points') > 0)) {
54 $result_main = SQL_QUERY("SELECT userid, email FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC",
56 while ($content = merge_array($content, SQL_FETCHARRAY($result_main))) {
57 // Ok, add points to used points and send an email to him...
58 subtractPoints('admin_all', $content['userid'], postRequestParameter('points'));
61 $content['text'] = SQL_ESCAPE(postRequestParameter('reason'));
62 $content['points'] = bigintval(postRequestParameter('points'));
64 // Load message and send it away
65 $message = loadEmailTemplate('sub-points', $content, bigintval($content['userid']));
66 sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $message);
70 SQL_FREERESULT($result_main);
73 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ALL_POINTS_SUBTRACTED'));
75 // Display form add points
76 loadTemplate('admin_sub_points_all');
78 } elseif (isGetRequestParameterSet('userid')) {
79 // User id found in URL so we use this give him some credits
80 if (fetchUserData(getRequestParameter('userid'))) {
81 // Selected user does exist
82 $content = getUserDataArray();
84 if ((isFormSent()) && (isPostRequestParameterSet('points'))) {
85 // Ok, add to used points and send an email to him...
86 subtractPoints('admin_single', bigintval(getRequestParameter('userid')), postRequestParameter('points'));
89 $content['text'] = SQL_ESCAPE(postRequestParameter('reason'));
90 $content['points'] = bigintval(postRequestParameter('points'));
92 // Load email and send it away
93 $message = loadEmailTemplate('sub-points', $content, bigintval(getRequestParameter('userid')));
94 sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $message);
97 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_SUBTRACTED'));
100 $content['user'] = '<a href="' . generateEmailLink($content['email'], 'user_data') . '">' . $content['surname'] . ' ' . $content['family'] . '</a>';
101 $content['userid'] = bigintval(getRequestParameter('userid'));
104 loadTemplate('admin_sub_points', false, $content);
108 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', getRequestParameter('userid')) . '</div>');
111 // Output selection form with all confirmed user accounts listed
112 addMemberSelectionBox(0, true);