2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 01/14/2005 *
4 * =================== Last change: 01/14/2005 *
6 * -------------------------------------------------------------------- *
7 * File : ext-online.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Who is where online? *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Wer befindet sich wo gerade Online? *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
44 setThisExtensionVersion('0.0.6');
46 // Version history array (add more with , '0.1.0' and so on)
47 setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6'));
49 switch (getExtensionMode()) {
50 case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
51 // SQL commands to run
52 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_online`');
53 addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_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,
68 INDEX `admin_member` (`is_admin`, `is_member`)
69 ) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci");
70 addAdminMenuSql('misc','usr_online','Online-Statistik','Eine Liste von derzeit "Online" Usern. Doppelte Einträge könnte auf mangelnden Cookie-Support des Browsers oder auf einen Spider hindeuten.', 1);
73 case 'remove': // Do stuff when removing extension
74 // SQL commands to run
75 addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_online`');
76 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='usr_online'");
77 addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='online'");
80 unregisterFilter(__FUNCTION__, __LINE__, 'init', 'UPDATE_ONLINE_LIST', true, isExtensionDryRun());
83 case 'activate': // Do stuff when admin activates this extension
84 // SQL commands to run
85 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='Y', `locked`='N' WHERE `action`='online' LIMIT 1");
88 case 'deactivate': // Do stuff when admin deactivates this extension
89 // SQL commands to run
90 addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `visible`='N', `locked`='Y' WHERE `action`='online' LIMIT 1");
93 case 'update': // Update an extension
94 switch (getCurrentExtensionVersion()) {
95 case '0.0.1': // SQL queries for v0.0.1
96 // Update notes (these will be set as task text!)
97 setExtensionUpdateNotes("Fehler <u>Unknown column 'visibled' in 'field list'</u> behoben.");
100 case '0.0.2': // SQL queries for v0.0.2
101 // Update notes (these will be set as task text!)
102 setExtensionUpdateNotes("Seit <strong>Patch 340</strong> überflüssige HTML-Tags entfernt.");
105 case '0.0.3': // SQL queries for v0.0.3
106 // Update notes (these will be set as task text!)
107 setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.");
110 case '0.0.4': // SQL queries for v0.0.4
111 // Update notes (these will be set as task text!)
112 setExtensionUpdateNotes("Erstellung der Datenbanktabelle `{?_MYSQL_PREFIX?}_online` in diese Erweiterung ausgelagert.");
115 case '0.0.5': // SQL queries for v0.0.5
117 addGuestMenuSql('online', NULL, 'Jetzt Online', 'Y', 'N', 2);
120 registerFilter('init', 'UPDATE_ONLINE_LIST', false, true, isExtensionDryRun());
122 // Update notes (these will be set as task text!)
123 setExtensionUpdateNotes("Hinzufügen des Menüpunktes "Jetzt Online" wird nun von dieser Erweiterung erledigt. Filter hinzugefügt.");
126 case '0.0.6': // SQL queries for v0.0.6
127 addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_online` CHANGE `userid` `userid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL,
128 CHANGE `refid` `refid` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL');
130 // Update notes (these will be set as task text!)
131 setExtensionUpdateNotes("Spalten userid und refid erlauben nun <stron>null</strong>.");
136 case 'modify': // When the extension got modified
139 case 'test': // For testing purposes
142 case 'init': // Do stuff when extension is initialized
145 default: // Unknown extension mode
146 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName()));