Better report this instead of silent logging
[mailer.git] / inc / extensions / ext-online.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 01/14/2005 *
4  * ===================                          Last change: 01/14/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : ext-online.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Who is where online?                             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Wer befindet sich wo gerade Online?              *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Version number
44 setThisExtensionVersion('0.0.6');
45
46 // Version history array (add more with , '0.0.1' and so on)
47 setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6'));
48
49 switch (getExtensionMode()) {
50         case 'register': // Do stuff when installation is running
51                 // "Who-is-where" table
52                 addDropTableSql('online');
53                 addCreateTableSql('online', "
54 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
55 `sid` VARCHAR(32) NOT NULL DEFAULT '',
56 `ip` VARCHAR(15) NOT NULL DEFAULT '',
57 `userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
58 `refid` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
59 `module` VARCHAR(255) NOT NULL DEFAULT '',
60 `action` VARCHAR(255) NOT NULL DEFAULT '',
61 `what` VARCHAR(255) NOT NULL DEFAULT '',
62 `is_admin` ENUM('Y','N') NOT NULL DEFAULT 'N',
63 `is_member` ENUM('Y','N') NOT NULL DEFAULT 'N',
64 `timestamp` VARCHAR(10) NOT NULL DEFAULT 0,
65 PRIMARY KEY (`id`),
66 INDEX (`userid`),
67 INDEX (`refid`),
68 INDEX `admin_member` (`is_admin`, `is_member`)",
69                         'Who-is-where data');
70
71                 // Admin menu
72                 addAdminMenuSql('misc','usr_online','Online-Statistik','Eine Liste von derzeit &quot;Online&quot; Usern. Doppelte Eintr&auml;ge k&ouml;nnte auf mangelnden Cookie-Support des Browsers oder auf einen Spider hindeuten.', 1);
73                 break;
74
75         case 'remove': // Do stuff when removing extension
76                 // SQL commands to run
77                 addDropTableSql('online');
78                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='usr_online'");
79                 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='online'");
80
81                 // Unregister filter
82                 unregisterFilter(__FILE__, __LINE__, 'init', 'UPDATE_ONLINE_LIST', TRUE, isExtensionDryRun());
83                 break;
84
85         case 'activate': // Do stuff when admin activates this extension
86                 // SQL commands to run
87                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y',`locked`='N' WHERE `action`='online' LIMIT 1");
88                 break;
89
90         case 'deactivate': // Do stuff when admin deactivates this extension
91                 // SQL commands to run
92                 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N',`locked`='Y' WHERE `action`='online' LIMIT 1");
93                 break;
94
95         case 'update': // Update an extension
96                 switch (getCurrentExtensionVersion()) {
97                         case '0.0.1': // SQL queries for v0.0.1
98                                 // Update notes (these will be set as task text!)
99                                 setExtensionUpdateNotes("Fehler <u>Unknown column 'visibled' in 'field list'</u> behoben.");
100                                 break;
101
102                         case '0.0.2': // SQL queries for v0.0.2
103                                 // Update notes (these will be set as task text!)
104                                 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> &uuml;berfl&uuml;ssige HTML-Tags entfernt.");
105                                 break;
106
107                         case '0.0.3': // SQL queries for v0.0.3
108                                 // Update notes (these will be set as task text!)
109                                 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
110                                 break;
111
112                         case '0.0.4': // SQL queries for v0.0.4
113                                 // Update notes (these will be set as task text!)
114                                 setExtensionUpdateNotes("Erstellung der Datenbanktabelle `{?_MYSQL_PREFIX?}_online` in diese Erweiterung ausgelagert.");
115                                 break;
116
117                         case '0.0.5': // SQL queries for v0.0.5
118                                 // Add guest menu
119                                 addGuestMenuSql('online', NULL, 'Jetzt Online', 2);
120
121                                 // Register filter
122                                 registerFilter(__FILE__, __LINE__, 'init', 'UPDATE_ONLINE_LIST', FALSE, TRUE, isExtensionDryRun());
123
124                                 // Update notes (these will be set as task text!)
125                                 setExtensionUpdateNotes("Hinzuf&uuml;gen des Men&uuml;punktes &quot;Jetzt Online&quot; wird nun von dieser Erweiterung erledigt. Filter hinzugef&uuml;gt.");
126                                 break;
127
128                         case '0.0.6': // SQL queries for v0.0.6
129                                 addExtensionChangeTableColumnSql('online', 'userid', 'userid', 'BIGINT(20) UNSIGNED NULL DEFAULT NULL');
130                                 addExtensionChangeTableColumnSql('online', 'refid', 'refid', 'BIGINT(20) UNSIGNED NULL DEFAULT NULL');
131
132                                 // Update notes (these will be set as task text!)
133                                 setExtensionUpdateNotes("Spalten userid und refid erlauben nun <stron>null</strong>.");
134                                 break;
135                 } // END - switch
136                 break;
137
138         case 'modify': // When the extension got modified
139                 break;
140
141         case 'test': // For testing purposes
142                 break;
143
144         case 'init': // Do stuff when extension is initialized
145                 break;
146
147         default: // Unknown extension mode
148                 reportBug(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));
149                 break;
150 } // END - switch
151
152 // [EOF]
153 ?>