List active/inactive extensions
[mailer.git] / 0.2.1 / inc / modules / admin / what-usr_online.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 01/14/2005 *\r
4  * ================                             Last change: 01/14/2005 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-usr_online.php                              *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Who is where? (DO NOT add sub menus!)            *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Wer ist wo? (KEINE Untermenues anhaengen!)       *\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 \r
41 // Add description as navigation point\r
42 ADD_DESCR("admin", basename(__FILE__));\r
43 \r
44 if (EXT_IS_ACTIVE("online", true))\r
45 {\r
46         // Count guests, members and admins\r
47         $result_guests  = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='N' AND is_member='N'", __FILE__, __LINE__);\r
48         $result_members = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='N' AND is_member='Y'", __FILE__, __LINE__);\r
49         $result_admins  = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_admin='Y'", __FILE__, __LINE__);\r
50 \r
51         // Remember values for the template\r
52         define('_GUESTS_ONLINE' , SQL_NUMROWS($result_guests));\r
53         define('_ADMINS_ONLINE' , SQL_NUMROWS($result_admins));\r
54         define('_MEMBERS_ONLINE', SQL_NUMROWS($result_members));\r
55 \r
56         // Free memory\r
57         SQL_FREERESULT($result_guests);\r
58         SQL_FREERESULT($result_admins);\r
59         SQL_FREERESULT($result_members);\r
60 \r
61         // Load template\r
62         LOAD_TEMPLATE("admin_mini_online");\r
63 \r
64         // Check for online users\r
65         $result = SQL_QUERY("SELECT id, ip, userid, refid, module, action, what, is_member, is_admin, timestamp FROM "._MYSQL_PREFIX."_online ORDER by timestamp DESC", __FILE__, __LINE__);\r
66         if (SQL_NUMROWS($result) > 0)\r
67         {\r
68                 // Load header template\r
69                 LOAD_TEMPLATE("admin_online_header");\r
70 \r
71                 // List all online users\r
72                 $SW = 2;\r
73                 while (list($id, $ip, $uid, $ref, $mod, $act, $wht, $mem, $admin, $time) = SQL_FETCHROW($result))\r
74                 {\r
75                         if (empty($act)) $act = "---";\r
76                         if (empty($wht))   $wht = "---";\r
77 \r
78                         if ($admin == "Y")\r
79                         {\r
80                                 // Is an administrator\r
81                                 $uid = _IS_ADMIN;\r
82                         }\r
83                          elseif (($mem == "N") && ($admin == "N"))\r
84                         {\r
85                                 // Is a guest\r
86                                 $uid = _IS_GUEST;\r
87                         }\r
88                         OUTPUT_HTML ("<TR>\r
89   <TD align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$id."</TD>\r
90   <TD align=\"center\" width=\"15%\" class=\"switch_sw".$SW." bottom right\">");\r
91                         if ($uid > 0)\r
92                         {\r
93                                 OUTPUT_HTML (ADMIN_USER_PROFILE_LINK($uid));\r
94                         }\r
95                          else\r
96                         {\r
97                                 OUTPUT_HTML ($uid);\r
98                         }\r
99                         if ($ref > 0)\r
100                         {\r
101                                 $ref = ADMIN_USER_PROFILE_LINK($ref);\r
102                         }\r
103                         OUTPUT_HTML ("</TD>\r
104   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$ip."</TD>\r
105   <TD align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$ref."</TD>\r
106   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$mod."</TD>\r
107   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom right\">".$act."</TD>\r
108   <TD align=\"center\" width=\"5%\" class=\"switch_sw".$SW." bottom right\">".$wht."</TD>\r
109   <TD align=\"center\" width=\"10%\" class=\"switch_sw".$SW." bottom\">".MAKE_DATETIME($time, "2")."</TD>\r
110 </TR>");\r
111                         $SW = 3 - $SW;\r
112                 }\r
113 \r
114                 // Free memory\r
115                 SQL_FREERESULT($result);\r
116 \r
117                 // Load footer template\r
118                 define('__FANCY_ONLINE_TIMEOUT', CREATE_FANCY_TIME($CONFIG['online_timeout']));\r
119                 LOAD_TEMPLATE("admin_online_footer");\r
120         }\r
121 }\r
122  else\r
123 {\r
124         // Online statistics deactivated!\r
125         LOAD_TEMPLATE("admin_settings_saved", false, ONLINE_STATISTICS_DEACTIVATED);\r
126 }\r
127 //\r
128 ?>\r