Copyright updated
[mailer.git] / 0.2.1 / inc / modules / admin / what-repair_cats.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 04/24/2004 *\r
4  * ================                             Last change: 04/24/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-repair_cats.php                             *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Repairs category selections                      *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Repariert Kategorieauswahlen                     *\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 $result = SQL_QUERY("SELECT userid FROM "._MYSQL_PREFIX."_user_cats ORDER BY userid", __FILE__, __LINE__);\r
44 if (SQL_NUMROWS($result) > 0)\r
45 {\r
46         // Check if found userid is also found in user_data table\r
47         $REMOVED = 0; // Nothing is removed for now... ;-)\r
48         while (list($uid) = SQL_FETCHROW($result))\r
49         {\r
50                 $result_user = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",\r
51                  array(bigintval($uid)), __FILE__, __LINE__);\r
52                 if (SQL_NUMROWS($result_user) == 0)\r
53                 {\r
54                         // Ok, we found something to remove\r
55                         $result_remove = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%d",\r
56                          array(bigintval($uid)), __FILE__, __LINE__);\r
57                         $REMOVED += SQL_AFFECTEDROWS();\r
58                 }\r
59                  else\r
60                 {\r
61                         // Free memory\r
62                         SQL_FREERESULT($result_user);\r
63                 }\r
64         }\r
65 \r
66         // Free memory\r
67         SQL_FREERESULT($result);\r
68 \r
69         if ($REMOVED > 0)\r
70         {\r
71                 // Entries repaired\r
72                 $content = "<FONT class=\"admin_done\">".ADMIN_REPAIR_ENTRIES_FIXED_1.$REMOVED.ADMIN_REPAIR_ENTRIES_FIXED_2."</FONT>";\r
73         }\r
74          else\r
75         {\r
76                 // Nothing repaired\r
77                 $content = "<FONT class=\"admin_failed\">".ADMIN_REPAIR_NOTHING_FIXED."</FONT>";\r
78         }\r
79 }\r
80  else\r
81 {\r
82         // No category selections found, no members registered?\r
83         $content = "<STRONG class=\'admin_failed\">".ADMIN_REPAIR_CATS_NOTHING."</STRONG>";\r
84 }\r
85 \r
86 // Load template\r
87 LOAD_TEMPLATE("admin_settings_saved", false, $content);\r
88 \r
89 //\r
90 ?>\r