2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/24/2009 *
4 * =================== Last change: 06/20/2010 *
6 * -------------------------------------------------------------------- *
7 * File : reset_profile.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Sends out notifications to keep profiles updated *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Sendet Erinnerngen aus, damit die Profile *
12 * von den Mitgliedern aktuell gehalten werden *
13 * -------------------------------------------------------------------- *
16 * $Tag:: 0.2.1-FINAL $ *
18 * Needs to be in all Files and every File needs "svn propset *
19 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
20 * -------------------------------------------------------------------- *
21 * Copyright (c) 2003 - 2009 by Roland Haeder *
22 * Copyright (c) 2009, 2010 by Mailer Developer Team *
23 * For more information visit: http://www.mxchange.org *
25 * This program is free software; you can redistribute it and/or modify *
26 * it under the terms of the GNU General Public License as published by *
27 * the Free Software Foundation; either version 2 of the License, or *
28 * (at your option) any later version. *
30 * This program is distributed in the hope that it will be useful, *
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
33 * GNU General Public License for more details. *
35 * You should have received a copy of the GNU General Public License *
36 * along with this program; if not, write to the Free Software *
37 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
39 ************************************************************************/
41 // Some security stuff...
42 if (!defined('__SECURITY')) {
44 } elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) {
45 // Do not execute when script is in CSS mode or no daily reset
47 } elseif (!isExtensionActive('profile')) {
48 logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
52 if ((isSendProfileUpdateEnabled()) && (getProfileUpdate() > 0) && (getResendProfileUpdate() > 0)) {
54 $result = SQL_QUERY("SELECT
55 `userid`, `email`, `last_update`, `joined`
57 `{?_MYSQL_PREFIX?}_user_data`
59 `status`='CONFIRMED' AND (
61 `last_update` < (UNIX_TIMESTAMP() - {?profile_update?}) AND
63 `last_profile_sent` < (UNIX_TIMESTAMP() - {?resend_profile_update?})
66 `last_profile_sent` = 0 AND
67 `joined` < (UNIX_TIMESTAMP() - {?profile_update?})
71 `userid` ASC", __FILE__, __LINE__);
73 // Do we have some notifications to sent?
74 if (!SQL_HASZERONUMS($result)) {
75 // We need to send-out notifications...
76 while ($content = SQL_FETCHARRAY($result)) {
77 // Translate timestamp
78 $content['joined'] = generateDateTime($content['joined'], 0);
80 if (round($content['last_update']) == '0') {
81 // Has never changed his accont
82 $content['last_update'] = '{--MEMBER_PROFILE_NEVER_CHANGED--}';
84 // Has changed his account
85 $content['last_update'] = generateDateTime($content['last_update'], 0);
88 // Load email template and send mail away
89 $message = loadEmailTemplate('member_profile', $content, bigintval($content['userid']));
90 sendEmail($content['email'], '{--MEMBER_PROFILE_OUTDATED_SUBJECT--}', $message);
92 // Update profile data
93 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_profile_sent`=UNIX_TIMESTAMP(), `notified`='Y' WHERE `userid`=%s LIMIT 1",
94 array(bigintval($content['userid'])), __FILE__, __LINE__);
99 SQL_FREERESULT($result);