]> git.mxchange.org Git - mailer.git/blob - inc/autopurge/purge-unconfirmed.php
Ref link fixed, nickname fixed, several rewrites, TODOs.txt updated:
[mailer.git] / inc / autopurge / purge-unconfirmed.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 05/29/2004 *
4  * ===============                              Last change: 11/26/2004 *
5  *                                                                      *
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  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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 - 2008 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 } // END - if
44
45 // Abort if autopurge is not active or disabled by admin
46 if ((!EXT_IS_ACTIVE('autopurge')) || (getConfig('auto_purge_active') != 'Y')) {
47         // Abort here
48         return false;
49 } // END - if
50
51 // Shall I auto-purge unconfirmed accounts?
52 if (getConfig('autopurge_unconfirmed') == 'Y') {
53         // Init variables and find unconfirmed accounts which I shall auto-purge;
54         $result_uncon = SQL_QUERY_ESC("SELECT `userid`, `email`, `joined`
55 FROM `{!_MYSQL_PREFIX!}_user_data`
56 WHERE `status`='UNCONFIRMED' AND `joined` < (UNIX_TIMESTAMP() - %s)
57 ORDER BY `userid` ASC",
58                 array(getConfig('ap_un_time')), __FILE__, __LINE__);
59         if (SQL_NUMROWS($result_uncon) > 0) {
60                 // Prepare variable...
61                 $UIDs = '';
62                 define('__UNCONFIRMED_TIME' , (getConfig('ap_un_time')  / 60 / 60));
63
64                 // Delete inactive accounts
65                 while ($content = SQL_FETCHARRAY($result_uncon)) {
66                         // Remember userids for the admin
67                         $UIDs .= $content['userid'] . ', ';
68
69                         // Get date/time from timestamp
70                         $content['joined'] = generateDateTime($content['joined'], '0');
71
72                         // Finnaly delete this inactive account
73                         deleteUserAccount($content['userid'], LOAD_EMAIL_TEMPLATE('member_autopurge_unconfirmed', $content['joined'], ''));
74                 } // END - while
75
76                 // Remove last comma
77                 $UIDs = str_replace(", ", "\n", substr($UIDs, 0, -2));
78
79                 // Send mail notification to admin
80                 if (getConfig('ap_un_notify') == 'Y') {
81                         sendAdminNotification(getMessage('AUTOPURGE_ADMIN_UNCONFIRMED_SUBJECT'), 'admin_autopurge_unconfirmed', $UIDs, '');
82                 } // END - if
83         } // END - if
84
85         // Free memory
86         SQL_FREERESULT($result_uncon);
87 }
88
89 //
90 ?>