2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 05/29/2004 *
4 * =================== Last change: 11/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : autopurge.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Automatical purging of outdated mail links *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Auto-Loeschung von veralteten Mail-Links *
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://www.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')) {
43 // Abort if autopurge is not active or disabled by admin
44 if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) {
49 // Shall I auto-purge unconfirmed accounts?
50 if (getConfig('autopurge_unconfirmed') == 'Y') {
51 // Init variables and find unconfirmed accounts which I shall auto-purge;
52 $result_uncon = SQL_QUERY("SELECT
53 `userid`, `email`, `joined`
55 `{?_MYSQL_PREFIX?}_user_data`
57 `status`='UNCONFIRMED' AND
58 (UNIX_TIMESTAMP() - `joined`) >= {?ap_unconfirmed_time?}
60 `userid` ASC", __FILE__, __LINE__);
61 if (!SQL_HASZERONUMS($result_uncon)) {
62 // Prepare variable...
64 $content['time'] = (getApUnconfirmedTime() / 60 / 60);
66 // Delete inactive accounts
67 while ($row = SQL_FETCHARRAY($result_uncon)) {
69 $content = merge_array($content, $row);
71 // Remember userids for the admin
72 $userids .= $content['userid'] . ', ';
74 // Get date/time from timestamp
75 $content['joined'] = generateDateTime($content['joined'], 0);
77 // Finnaly delete this inactive account
78 deleteUserAccount($content['userid'], loadEmailTemplate('member_autopurge_unconfirmed', $content, ''));
82 $userids = str_replace(', ', "\n", substr($userids, 0, -2));
84 // Send mail notification to admin
85 if (getConfig('ap_un_notify') == 'Y') {
86 sendAdminNotification('{--ADMIN_AUTOPURGE_UNCONFIRMED_SUBJECT--}', 'admin_autopurge_unconfirmed', $userids);
91 SQL_FREERESULT($result_uncon);