Fix for inserted codes while registering of extensions, many rewrites/cleanups:
[mailer.git] / inc / modules / guest / what-active.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 11/26/2004 *
4  * ===================                          Last change: 11/26/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-active.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Today active members list                        *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Liste heutiger aktiver Mitglieder                *
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 - 2009 by Roland Haeder                           *
21  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
22  * For more information visit: http://www.mxchange.org                  *
23  *                                                                      *
24  * This program is free software; you can redistribute it and/or modify *
25  * it under the terms of the GNU General Public License as published by *
26  * the Free Software Foundation; either version 2 of the License, or    *
27  * (at your option) any later version.                                  *
28  *                                                                      *
29  * This program is distributed in the hope that it will be useful,      *
30  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
31  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
32  * GNU General Public License for more details.                         *
33  *                                                                      *
34  * You should have received a copy of the GNU General Public License    *
35  * along with this program; if not, write to the Free Software          *
36  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // Some security stuff...
41 if (!defined('__SECURITY')) {
42         die();
43 } // END - if
44
45 // Add description as navigation point
46 addMenuDescription('guest', __FILE__);
47
48 if ((!isExtensionActive('active')) && (!isAdmin())) {
49         loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('active'));
50         return;
51 } // END - if
52
53 // Extra field to include is by default userid
54 $add = 'userid';
55
56 // If nickname is installed the extra field is the nickname of the user
57 if (isExtensionActive('nickname')) $add = 'nickname';
58
59 // Check for members who were active only this day
60 $result = SQL_QUERY("SELECT
61         `userid`, `".$add."`, `last_online`
62 FROM
63         `{?_MYSQL_PREFIX?}_user_data`
64 WHERE
65         `last_online` >= {?START_TDAY?} AND
66         `status`='CONFIRMED'
67 ORDER BY
68         `last_online` DESC
69 LIMIT {?active_limit?}", __FILE__, __LINE__);
70
71 // Entries found?
72 if (!SQL_HASZERONUMS($result)) {
73         // At least one member was online so let's load them all
74         $OUT = '';
75         while (list($userid, $nick, $last) = SQL_FETCHROW($result)) {
76                 $nick2 = '---';
77                 if (($nick != $userid) && (!empty($nick))) $nick2 = $nick;
78
79                 // Transfer data to array
80                 $content = array(
81                         'userid'      => $userid,
82                         'nickname'    => $nick2,
83                         'points'      => getTotalPoints($userid),
84                         'last_online' => generateDateTime($last, 2),
85                 );
86
87                 // Load template
88                 $OUT .= loadTemplate('guest_active_row', true, $content);
89         } // END - while
90 } else {
91         // No member was online today! :-(
92         $OUT = loadTemplate('guest_active_none_row', true);
93 }
94
95 // Load template
96 loadTemplate('guest_active_table', false, $OUT);
97
98 // [EOF]
99 ?>