2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/24/2009 *
4 * =================== Last change: 06/20/2010 *
6 * -------------------------------------------------------------------- *
7 * File : daily_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 * -------------------------------------------------------------------- *
14 * Copyright (c) 2003 - 2009 by Roland Haeder *
15 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
16 * For more information visit: http://mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
37 } elseif ((!isHtmlOutputMode()) || (!isDailyResetEnabled())) {
38 // Do not execute when script is in non-HTML mode or no daily reset
40 } elseif (!isExtensionActive('profile')) {
41 logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension ext-profile disabled.');
46 //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset started.');
48 if ((isSendProfileUpdateEnabled()) && (getProfileUpdate() > 0) && (getResendProfileUpdate() > 0)) {
50 $result = sqlQuery("SELECT
56 `{?_MYSQL_PREFIX?}_user_data`
59 " . runFilterChain('user_exclusion_sql', ' ') . " AND (
61 (UNIX_TIMESTAMP() - `last_update`) >= {?profile_update?} AND
63 (UNIX_TIMESTAMP() - `last_profile_sent`) >= {?resend_profile_update?}
66 `last_profile_sent` = 0 AND
67 (UNIX_TIMESTAMP() - `joined`) >= {?profile_update?}
71 `userid` ASC", __FILE__, __LINE__);
73 // Are there some notifications to sent?
74 if (!ifSqlHasZeroNums($result)) {
75 // We need to send-out notifications...
76 while ($content = sqlFetchArray($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['userid'], '{--MEMBER_PROFILE_OUTDATED_SUBJECT--}', $message);
92 // Update profile data
93 sqlQueryEscaped("UPDATE
94 `{?_MYSQL_PREFIX?}_user_data`
96 `last_profile_sent`=UNIX_TIMESTAMP(),
101 array(bigintval($content['userid'])), __FILE__, __LINE__);
106 sqlFreeResult($result);
110 //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Daily reset ended.');