2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/23/2003 *
4 * =================== Last change: 09/23/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-add_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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 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')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 if (getRequestElement('userid') == 'all') {
47 // Add points to all accounts
48 if ((isFormSent()) && (postRequestElement('points') > 0)) {
50 $content['points'] = bigintval(postRequestElement('points'));
53 $result_main = SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC",
56 // Process all entries
57 while ($row = SQL_FETCHARRAY($result_main)) {
58 // Merge $row into $content
59 $content = merge_array($content, $row);
61 // Ok, add points and send an email to him...
62 addPointsDirectly('admin_add_all', $content['userid'], bigintval(postRequestElement('points')));
66 'reason' => SQL_ESCAPE(postRequestElement('reason')),
67 'points' => bigintval(postRequestElement('points')),
68 'userid' => $row['userid'],
69 'subject' => 'admin_add_all',
72 // Load email template and send email away
73 $message = loadEmailTemplate('member_add_points', $content, bigintval($content['userid']));
74 sendEmail(bigintval($content['userid']), '{--ADMIN_ADD_SUBJECT--}', $message);
78 SQL_FREERESULT($result_main);
81 displayMessage('{--ADMIN_ALL_POINTS_ADDED--}');
83 // Display form add points
84 loadTemplate('admin_add_points_all');
86 } elseif (isGetRequestElementSet('userid')) {
87 // User id found in URL so we use this give him some credits
88 if (fetchUserData(getRequestElement('userid'))) {
89 // Selected user does exist
90 $content = getUserDataArray();
92 if ((isFormSent()) && (isPostRequestElementSet('points'))) {
93 // Add points and send an email to him...
94 addPointsDirectly('admin_add_single', bigintval(getRequestElement('userid')), bigintval(postRequestElement('points')));
98 'reason' => SQL_ESCAPE(postRequestElement('reason')),
99 'points' => bigintval(postRequestElement('points')),
100 'subject' => 'admin_add_single',
104 $message = loadEmailTemplate('member_add_points', $content, bigintval(getRequestElement('userid')));
106 // Send the email out
107 sendEmail(bigintval(getRequestElement('userid')), '{--ADMIN_ADD_SUBJECT--}', $message);
109 // .. and display a message
110 displayMessage('{--ADMIN_POINTS_ADDED--}');
113 $content['userid'] = bigintval(getRequestElement('userid'));
116 loadTemplate('admin_add_points', false, $content);
120 loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_MEMBER_404=' . bigintval(getRequestElement('userid')) . '%}');
123 // Output selection form with all confirmed user accounts listed
124 addMemberSelectionBox(0, true);