Copyright updated
[mailer.git] / 0.2.1 / inc / modules / admin / what-list_autopurge.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 06/26/2004 *\r
4  * ================                             Last change: 06/26/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-list_autopurge.php                          *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Find inactive accounts and just list them        *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Inaktive Accounts finden und dann auflisten      *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\r
18  * This program is free software; you can redistribute it and/or modify *\r
19  * it under the terms of the GNU General Public License as published by *\r
20  * the Free Software Foundation; either version 2 of the License, or    *\r
21  * (at your option) any later version.                                  *\r
22  *                                                                      *\r
23  * This program is distributed in the hope that it will be useful,      *\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
26  * GNU General Public License for more details.                         *\r
27  *                                                                      *\r
28  * You should have received a copy of the GNU General Public License    *\r
29  * along with this program; if not, write to the Free Software          *\r
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
31  * MA  02110-1301  USA                                                  *\r
32  ************************************************************************/\r
33 \r
34 // Some security stuff...\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
38         require($INC);\r
39 }\r
40 // Add description as navigation point\r
41 ADD_DESCR("admin", basename(__FILE__));\r
42 \r
43 // Ok, let's have a look...\r
44 $since = bigintval(time() - $CONFIG['ap_in_since']);\r
45 $EXCLUDE_LIST = " AND d.userid != c.def_refid";\r
46 \r
47 // Check for more extensions\r
48 if (EXT_IS_ACTIVE("beg"))     $EXCLUDE_LIST .= " AND d.userid != c.beg_uid";\r
49 if (EXT_IS_ACTIVE("bonus"))   $EXCLUDE_LIST .= " AND d.userid != c.bonus_uid";\r
50 if (EXT_IS_ACTIVE("doubler")) $EXCLUDE_LIST .= " AND d.userid != c.doubler_uid";\r
51 \r
52 // Check for all accounts\r
53 $result = SQL_QUERY_ESC("SELECT DISTINCT d.userid, d.sex, d.surname, d.family, d.email, d.joined, d.last_online, d.ap_notified\r
54 FROM "._MYSQL_PREFIX."_user_data AS d, "._MYSQL_PREFIX."_config AS c\r
55 WHERE d.status='CONFIRMED' AND d.joined < %s AND d.last_online < %s AND d.ap_notified < %s\r
56 ".$EXCLUDE_LIST."\r
57 ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);\r
58 \r
59 if (SQL_NUMROWS($result) > 0)\r
60 {\r
61         // Ok, we have found some inactive accounts\r
62         $SW = 2; $OUT = "";\r
63         while(list($uid, $sex, $sname, $fname, $email, $joined, $last, $notified) = SQL_FETCHROW($result))\r
64         {\r
65                 // Prepare data for the row template\r
66                 $content = array(\r
67                         'sw'       => $SW,\r
68                         'uid'      => ADMIN_USER_PROFILE_LINK($uid),\r
69                         'sex'      => TRANSLATE_SEX($sex),\r
70                         'sname'    => $sname,\r
71                         'fname'    => $fname,\r
72                         'email'    => "<A href=\"".CREATE_EMAIL_LINK($email, "user_data")."\">".$email."</A>",\r
73                         'joined'   => MAKE_DATETIME($joined, "2"),\r
74                         'last'     => MAKE_DATETIME($last, "2"),\r
75                         'notified' => MAKE_DATETIME($notified, "2"),\r
76                 );\r
77 \r
78                 // Load row template\r
79                 $OUT .= LOAD_TEMPLATE("admin_list_autopurge_row", true, $content);\r
80                 $SW = 3 - $SW;\r
81         }\r
82 \r
83         // Free memory\r
84         SQL_FREERESULT($result);\r
85         define('__AUTOPURGE_ROWS', $OUT);\r
86 \r
87         // Load main template\r
88         LOAD_TEMPLATE("admin_list_autopurge");\r
89 }\r
90  else\r
91 {\r
92         // All members are active or you don't have any registered\r
93         LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_AUTOPURGE_ALL_ACTIVE);\r
94 }\r
95 //\r
96 ?>\r