r104227 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104226‎ | r104227 | r104228 >
Date:08:28, 25 November 2011
Author:petrb
Status:deferred
Tags:
Comment:
tagged version
Modified paths:
  • /tags/extensions/OnlineStatusBar/REL_1_0_3 (added) (history)

Diff [purge]

Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.i18n.php
@@ -0,0 +1,278 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for Online status bar extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/**
 13+ * English
 14+ * @author Petr Bena
 15+ * @author John Du Hart
 16+ */
 17+$messages['en'] = array(
 18+ // Description
 19+ 'onlinestatusbar-desc' => 'Status bar which shows whether a user is online, based on preferences, on their user page',
 20+ // Status bar text line (User is now Offline) etc.
 21+ 'onlinestatusbar-line' => '$1 is now $2 $3',
 22+ // Message in config asking user if they want to enable it
 23+ 'onlinestatusbar-used' => 'Do you want to let others see if you are online?',
 24+ // Message in config asking what status they want to use
 25+ 'onlinestatusbar-status' => 'What is the default status you wish to use:',
 26+ // Message in config asking if user wants to purge the user page
 27+ 'onlinestatusbar-purge' => 'Purge user page everytime when you login or logout',
 28+ // Section for config
 29+ 'prefs-onlinestatus' => 'Online status',
 30+ // Message in config
 31+ 'onlinestatusbar-hide' => 'Do you want to hide the status bar in order to use just the magic word? (For advanced users)',
 32+
 33+ 'onlinestatusbar-status-online' => 'On-line',
 34+ 'onlinestatusbar-status-busy' => 'Busy',
 35+ 'onlinestatusbar-status-away' => 'Away',
 36+ 'onlinestatusbar-status-offline' => 'Offline',
 37+ 'onlinestatusbar-status-hidden' => 'Hidden',
 38+);
 39+
 40+/** Message documentation (Message documentation)
 41+ * @author John Du Hart
 42+ * @author Petr Bena
 43+ */
 44+$messages['qqq'] = array(
 45+ 'onlinestatusbar-desc' => '{{desc}}',
 46+ 'onlinestatusbar-line' => 'Status bar text line (User is now Offline), parameters:
 47+* $1 is user
 48+* $2 is a picture of status (small icon in color of status)
 49+* $3 a status, it will appear in title bar of their user space pages',
 50+ 'onlinestatusbar-used' => 'Message in config asking user if they want to enable it, checkbox',
 51+ 'onlinestatusbar-status' => 'Message in config asking what status they want to use, option box',
 52+ 'onlinestatusbar-purge' => 'Option to purge user page everytime they login so that magic word is updated',
 53+ 'prefs-onlinestatus' => 'Section for config, located in preferences - misc',
 54+ 'onlinestatusbar-hide' => 'Ask user if they want to hide status bar this is useful when they are using custom template but need to check if they are online',
 55+ 'onlinestatusbar-status-online' => 'Status for users who mark themselves as active',
 56+ 'onlinestatusbar-status-busy' => 'Status for users who mark themselves as busy',
 57+ 'onlinestatusbar-status-away' => 'Status for users who mark themselves as away',
 58+ 'onlinestatusbar-status-offline' => 'Status for users who are offline',
 59+ 'onlinestatusbar-status-hidden' => 'Status for users who mark themselves as hidden (used on preferences only)',
 60+);
 61+
 62+/** Breton (Brezhoneg)
 63+ * @author Fulup
 64+ */
 65+$messages['br'] = array(
 66+ 'onlinestatusbar-line' => '$1 zo bremañ $2 $3',
 67+ 'prefs-onlinestatus' => 'Statud enlinenn',
 68+ 'onlinestatusbar-status-online' => 'Kevreet',
 69+ 'onlinestatusbar-status-busy' => 'Soulgarget',
 70+ 'onlinestatusbar-status-away' => 'Er-maez',
 71+ 'onlinestatusbar-status-offline' => 'Ezvezant',
 72+ 'onlinestatusbar-status-hidden' => 'Kuzhet',
 73+);
 74+
 75+/** German (Deutsch)
 76+ * @author Kghbln
 77+ */
 78+$messages['de'] = array(
 79+ 'onlinestatusbar-desc' => 'Ermöglicht, abhängig von der Benutzereinstellung, die Anzeige des Onlinestatus eines Benutzers auf dessen Benutzerseite',
 80+ 'onlinestatusbar-line' => '$1 ist gerade $3 $2',
 81+ 'onlinestatusbar-used' => 'Möchtest du, dass andere Benutzer deinen Onlinestatus sehen?',
 82+ 'onlinestatusbar-status' => 'Welchen Status möchtest du standardmäßig nutzen:',
 83+ 'onlinestatusbar-purge' => 'Den Cache der Benutzerseite jedes Mal leeren, wenn du dich an- oder abmeldest',
 84+ 'prefs-onlinestatus' => 'Onlinestatus',
 85+ 'onlinestatusbar-hide' => "Möchtest du die Statusleiste ausblenden, um stattdessen lediglich das ''Magic Word'' zu nutzen? (Für Fortgeschrittene)",
 86+ 'onlinestatusbar-status-online' => 'Online',
 87+ 'onlinestatusbar-status-busy' => 'Beschäftigt',
 88+ 'onlinestatusbar-status-away' => 'Abwesend',
 89+ 'onlinestatusbar-status-offline' => 'Offline',
 90+ 'onlinestatusbar-status-hidden' => 'Versteckt',
 91+);
 92+
 93+/** German (formal address) (‪Deutsch (Sie-Form)‬)
 94+ * @author Kghbln
 95+ */
 96+$messages['de-formal'] = array(
 97+ 'onlinestatusbar-used' => 'Möchten Sie, dass andere Benutzer Ihren Onlinestatus sehen?',
 98+ 'onlinestatusbar-status' => 'Welchen Status möchten Sie standardmäßig nutzen:',
 99+ 'onlinestatusbar-purge' => 'Den Cache der Benutzerseite jedes Mal leeren, wenn Sie sich an- oder abmelden',
 100+ 'onlinestatusbar-hide' => "Möchten Sie die Statusleiste ausblenden, um stattdessen lediglich das ''Magic Word'' zu nutzen? (Für Fortgeschrittene)",
 101+);
 102+
 103+/** French (Français)
 104+ * @author DavidL
 105+ * @author Gomoko
 106+ */
 107+$messages['fr'] = array(
 108+ 'onlinestatusbar-desc' => "Barre d'état montrant si un utilisateur est en ligne, basé sur les préférences, sur leur page utilisateur",
 109+ 'onlinestatusbar-line' => '$1 est maintenant $2 $3',
 110+ 'onlinestatusbar-used' => 'Voulez-vous permettre que les autres voient si vous êtes en ligne ?',
 111+ 'onlinestatusbar-status' => 'Quel est le statut par défaut que vous souhaitez utiliser :',
 112+ 'onlinestatusbar-purge' => 'Vider la page utilisateur chaque vous que vous vous connectez ou vous déconnectez',
 113+ 'prefs-onlinestatus' => 'État en ligne',
 114+ 'onlinestatusbar-hide' => "Voulez-vous masquer la barre d'état afin d'utiliser le mot magique seulement ? (Pour les utilisateurs avancés)",
 115+ 'onlinestatusbar-status-online' => 'Présent',
 116+ 'onlinestatusbar-status-busy' => 'Occupé',
 117+ 'onlinestatusbar-status-away' => 'Parti',
 118+ 'onlinestatusbar-status-offline' => 'Absent',
 119+ 'onlinestatusbar-status-hidden' => 'Caché',
 120+);
 121+
 122+/** Franco-Provençal (Arpetan)
 123+ * @author ChrisPtDe
 124+ */
 125+$messages['frp'] = array(
 126+ 'onlinestatusbar-line' => '$1 est ora $2 $3',
 127+ 'prefs-onlinestatus' => 'Ètat en legne',
 128+ 'onlinestatusbar-status-online' => 'Present',
 129+ 'onlinestatusbar-status-busy' => 'Ocupo',
 130+ 'onlinestatusbar-status-away' => 'Viâ',
 131+ 'onlinestatusbar-status-offline' => 'Absent',
 132+ 'onlinestatusbar-status-hidden' => 'Cachiê',
 133+);
 134+
 135+/** Galician (Galego)
 136+ * @author Toliño
 137+ */
 138+$messages['gl'] = array(
 139+ 'onlinestatusbar-desc' => 'Barra de estado que mostra na páxina de usuario se un usuario está conectado',
 140+ 'onlinestatusbar-line' => '$1 está $2 $3 nestes intres',
 141+ 'onlinestatusbar-used' => 'Quere deixar que os outros poidan ver se está conectado?',
 142+ 'onlinestatusbar-status' => 'Cal é o estado por defecto que quere usar:',
 143+ 'onlinestatusbar-purge' => 'Purgar a páxina de usuario cada vez que se identifique ou saia do sistema',
 144+ 'prefs-onlinestatus' => 'Conectado',
 145+ 'onlinestatusbar-hide' => 'Quere agochar a barra de estado para usar unicamente a palabra máxica? (Para usuarios avanzados)',
 146+ 'onlinestatusbar-status-online' => 'Conectado',
 147+ 'onlinestatusbar-status-busy' => 'Ocupado',
 148+ 'onlinestatusbar-status-away' => 'Non dispoñible',
 149+ 'onlinestatusbar-status-offline' => 'Desconectado',
 150+ 'onlinestatusbar-status-hidden' => 'Agochado',
 151+);
 152+
 153+/** Hebrew (עברית)
 154+ * @author Amire80
 155+ */
 156+$messages['he'] = array(
 157+ 'onlinestatusbar-desc' => 'שורת מצב שמציגה בדף המשתמש אם המשתמש מקוון, בהתאם להעדפות',
 158+ 'onlinestatusbar-line' => '$1 $2 $3 עכשיו',
 159+ 'onlinestatusbar-used' => 'לאפשר לאחרים לראות שאתם מחוברים?',
 160+ 'onlinestatusbar-status' => 'מהו המצב שתרצו להיות פה לפי בררת המחדל:',
 161+ 'onlinestatusbar-purge' => 'לנקות את המטמון של דף המשתמש בכל פעם שאתם נכנסים או יוצאים',
 162+ 'prefs-onlinestatus' => 'מצב ההימצאות באתר',
 163+ 'onlinestatusbar-hide' => 'האם להסתיר את שורת המצב כדי להשתמש רק במילת הקסם? (למשתמשים מתקדמים)',
 164+ 'onlinestatusbar-status-online' => 'באתר',
 165+ 'onlinestatusbar-status-busy' => 'עסוק',
 166+ 'onlinestatusbar-status-away' => 'לא ליד מחשב',
 167+ 'onlinestatusbar-status-offline' => 'לא באתר',
 168+ 'onlinestatusbar-status-hidden' => 'מוסתר',
 169+);
 170+
 171+/** Upper Sorbian (Hornjoserbsce)
 172+ * @author Michawiki
 173+ */
 174+$messages['hsb'] = array(
 175+ 'onlinestatusbar-desc' => 'Statusowa lajsta, kotraž na zakładźe nastajenjow pokazuje, hač wužiwar je na swojej wužiwarskej stronje online',
 176+ 'onlinestatusbar-line' => '$1 je nětko $3 $2',
 177+ 'onlinestatusbar-used' => 'Chceće druhich widźeć dać, zo wy sće online?',
 178+ 'onlinestatusbar-status' => 'Što je standardny status, kotryž chceće wužiwać:',
 179+ 'onlinestatusbar-purge' => 'Pufrowak wužiwarskeje strony kóždy raz wuprózdnić, hdyž so přizjewjeće abo wotzjewjeće',
 180+ 'prefs-onlinestatus' => 'Onlinestatus',
 181+ 'onlinestatusbar-hide' => 'Chceće statusowu lajstu schować, zo byšće jenož magiske słowo wužiwał? (Za pokročenych wužiwarjow)',
 182+ 'onlinestatusbar-status-online' => 'Online',
 183+ 'onlinestatusbar-status-busy' => 'Ma dźěło',
 184+ 'onlinestatusbar-status-away' => 'Preč',
 185+ 'onlinestatusbar-status-offline' => 'Offline',
 186+ 'onlinestatusbar-status-hidden' => 'Schowany',
 187+);
 188+
 189+/** Interlingua (Interlingua)
 190+ * @author McDutchie
 191+ */
 192+$messages['ia'] = array(
 193+ 'onlinestatusbar-desc' => 'Barra de stato que monstra si un usator es in linea, dependente de su preferentias, in su pagina de usator',
 194+ 'onlinestatusbar-line' => '$1 es ora $2 $3',
 195+ 'onlinestatusbar-used' => 'Vole tu permitter que alteres vide si tu es in linea?',
 196+ 'onlinestatusbar-status' => 'Qual es le stato predefinite que tu vole usar:',
 197+ 'onlinestatusbar-purge' => 'Purgar le pagina de usator cata vice que tu aperi o claude session',
 198+ 'prefs-onlinestatus' => 'Stato in linea',
 199+ 'onlinestatusbar-hide' => 'Vole tu celar le barra de stato pro usar solmente le parola magic? (Pro usatores avantiate)',
 200+ 'onlinestatusbar-status-online' => 'In linea',
 201+ 'onlinestatusbar-status-busy' => 'Occupate',
 202+ 'onlinestatusbar-status-away' => 'Absente',
 203+ 'onlinestatusbar-status-offline' => 'Foras de linea',
 204+ 'onlinestatusbar-status-hidden' => 'Celate',
 205+);
 206+
 207+/** Luxembourgish (Lëtzebuergesch)
 208+ * @author Robby
 209+ */
 210+$messages['lb'] = array(
 211+ 'onlinestatusbar-line' => '$1 ass elo $2 $3',
 212+ 'onlinestatusbar-used' => 'Wëllt dir datt Anerer kënne gesinn op Dir online sidd?',
 213+ 'onlinestatusbar-status-busy' => 'Beschäftegt',
 214+ 'onlinestatusbar-status-away' => 'Net do',
 215+ 'onlinestatusbar-status-hidden' => 'Verstoppt',
 216+);
 217+
 218+/** Macedonian (Македонски)
 219+ * @author Bjankuloski06
 220+ */
 221+$messages['mk'] = array(
 222+ 'onlinestatusbar-desc' => 'Статусник што прикажува дали корисникот е на линија, зависно од нагодувањата на корисничката страница',
 223+ 'onlinestatusbar-line' => '$1 сега е $2 $3',
 224+ 'onlinestatusbar-used' => 'Дали сакате другите да знаат кога сте на линија?',
 225+ 'onlinestatusbar-status' => 'Вашиот статус по основно:',
 226+ 'onlinestatusbar-purge' => 'Пречисти го кешот на корисничката страница секојпат кога ќе се најавам или одјавам',
 227+ 'prefs-onlinestatus' => 'Вклученост',
 228+ 'onlinestatusbar-hide' => 'Дали би сакале да го скриете статусникот за да го користите само волшебниот збор (за напредни корисници)',
 229+ 'onlinestatusbar-status-online' => 'Вклучен',
 230+ 'onlinestatusbar-status-busy' => 'Зафатен',
 231+ 'onlinestatusbar-status-away' => 'Отсутен',
 232+ 'onlinestatusbar-status-offline' => 'Исклучен',
 233+ 'onlinestatusbar-status-hidden' => 'Скриен',
 234+);
 235+
 236+/** Malay (Bahasa Melayu)
 237+ * @author Anakmalaysia
 238+ */
 239+$messages['ms'] = array(
 240+ 'onlinestatusbar-desc' => 'Palang status yang menunjukkan sama pengguna berada dalam talian atau tidak, berasaskan keutamaan pada laman penggunanya',
 241+ 'onlinestatusbar-line' => '$1 kini $2 $3',
 242+ 'onlinestatusbar-used' => 'Adakah anda ingin orang lain tahu sama ada anda berada dalam talian atau tidak?',
 243+ 'onlinestatusbar-status' => 'Yang manakah status asali yang ingin anda gunakan:',
 244+ 'onlinestatusbar-purge' => 'Singkirkan isi laman pengguna setiap kali ketika log masuk/keluar',
 245+ 'prefs-onlinestatus' => 'Status dalam talian',
 246+ 'onlinestatusbar-hide' => 'Adakah anda ingin menyorokkan palang status demi menggunakan kata sakti sahaja? (Untuk pengguna lebih berpengalaman)',
 247+ 'onlinestatusbar-status-online' => 'Dalam talian',
 248+ 'onlinestatusbar-status-busy' => 'Sibuk',
 249+ 'onlinestatusbar-status-away' => 'Tiada',
 250+ 'onlinestatusbar-status-offline' => 'Luar talian',
 251+ 'onlinestatusbar-status-hidden' => 'Tersorok',
 252+);
 253+
 254+/** Dutch (Nederlands)
 255+ * @author SPQRobin
 256+ * @author Siebrand
 257+ */
 258+$messages['nl'] = array(
 259+ 'onlinestatusbar-desc' => 'Statusbalk die weergeeft of een gebruiker online is, op basis van voorkeuren, op zijn/haar gebruikerspagina',
 260+ 'onlinestatusbar-line' => '$1 is nu $2 $3',
 261+ 'onlinestatusbar-used' => 'Wilt u andere gebruikers laten zien dat u online bent?',
 262+ 'onlinestatusbar-status' => 'Welke standaard status wilt u gebruiken:',
 263+ 'onlinestatusbar-purge' => 'Uw gebruikerspagina bij aanmelden en afmelden uit de cache verwijderen',
 264+ 'prefs-onlinestatus' => 'Onlinestatus',
 265+ 'onlinestatusbar-hide' => 'Wilt u de statusbalk verbergen en alleen het magische woord gebruiken (voor gevorderde gebruikers)?',
 266+ 'onlinestatusbar-status-online' => 'Online',
 267+ 'onlinestatusbar-status-busy' => 'Druk',
 268+ 'onlinestatusbar-status-away' => 'Weg',
 269+ 'onlinestatusbar-status-offline' => 'Offline',
 270+ 'onlinestatusbar-status-hidden' => 'Verborgen',
 271+);
 272+
 273+/** Telugu (తెలుగు)
 274+ * @author Veeven
 275+ */
 276+$messages['te'] = array(
 277+ 'onlinestatusbar-used' => 'మీరు ఆన్‌లైనులో ఉన్నట్టు ఇతరులుకు చూపించాలా?',
 278+);
 279+
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.i18n.php
___________________________________________________________________
Added: svn:eol-style
1280 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.status.php
@@ -0,0 +1,205 @@
 2+<?
 3+if ( !defined( 'MEDIAWIKI' ) ) {
 4+ echo "This is a part of mediawiki and can't be started separately";
 5+ die();
 6+}
 7+
 8+/**
 9+ * File which contains status check for Online status bar extension.
 10+ *
 11+ * @file
 12+ * @ingroup Extensions
 13+ * @author Petr Bena <benapetr@gmail.com>
 14+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 15+ * @link http://www.mediawiki.org/wiki/Extension:OnlineStatusBar Documentation
 16+ */
 17+
 18+class OnlineStatusBar_StatusCheck {
 19+ /**
 20+ * Return cache key
 21+ * @param $user String
 22+ * @param $type String
 23+ */
 24+ private static function getCacheKey( $user, $type ) {
 25+ // get a key for cache
 26+ return wfMemcKey( 'onlinestatusbar_cache', $type, $user );
 27+ }
 28+
 29+ /**
 30+ * Create a cache
 31+ * @param $user
 32+ * @param $values
 33+ * @return true
 34+ */
 35+ public static function setCache( $user, $values, $type ) {
 36+ global $wgOnlineStatusBarWriteTime, $wgMemc;
 37+ // get a key
 38+ $cache_key = self::getCacheKey( $user, $type );
 39+ $wgMemc->set( $cache_key, $values, $wgOnlineStatusBarWriteTime );
 40+ return true;
 41+ }
 42+
 43+ /**
 44+ * Return cache value
 45+ */
 46+ public static function getCache( $user, $type ) {
 47+ global $wgMemc;
 48+ // get a key
 49+ $cache_key = self::getCacheKey( $user, $type );
 50+ // get a value
 51+ return $wgMemc->get( $cache_key );
 52+ }
 53+
 54+
 55+ /**
 56+ * @param $user User
 57+ * @return String
 58+ */
 59+ public static function getStatus( $user, $delayed_check = false ) {
 60+ global $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline;
 61+
 62+ // instead of delete every time just select the records which are not that old
 63+ if ( !$delayed_check ) {
 64+ $t_time = OnlineStatusBar::getTimeoutDate();
 65+ // first try to use cache
 66+ $result = self::getCache( $user->getName(), "n" );
 67+
 68+ if ( $result == '' ) {
 69+ $dbr = wfGetDB( DB_SLAVE );
 70+ $result = $dbr->selectField( 'online_status', 'timestamp', array( 'username' => $user->getName(),
 71+ "timestamp > " . $dbr->addQuotes( $dbr->timestamp( $t_time ) ) ),
 72+ __METHOD__, array( 'LIMIT 1', 'ORDER BY timestamp DESC' ) );
 73+ // cache it
 74+ self::setCache( $user->getName(), $result, "n" );
 75+ }
 76+ }
 77+ else {
 78+ $result = self::getCache( $user->getName(), "d" );
 79+
 80+ if ( $result == '' ) {
 81+ $dbr = wfGetDB( DB_SLAVE );
 82+ $result = $dbr->selectField( 'online_status', 'timestamp', array( 'username' => $user->getName() ),
 83+ __METHOD__, array( 'LIMIT 1', 'ORDER BY timestamp DESC' ) );
 84+ $w_time = OnlineStatusBar::getTimeoutDate( true );
 85+ // cache it
 86+ self::setCache( $user->getName(), $result, "d" );
 87+ }
 88+ }
 89+
 90+ if ( $result === false ) {
 91+ $status = $wgOnlineStatusBarDefaultOffline;
 92+ } else {
 93+ // let's check if it isn't anon
 94+ if ( $user->isLoggedIn() ) {
 95+ $status = $user->getOption( 'OnlineStatusBar_status', $wgOnlineStatusBarDefaultOnline );
 96+ if ( $delayed_check ) {
 97+ if ( $result < wfTimestamp( TS_MW, $w_time ) ) {
 98+ $status = 'write';
 99+ }
 100+ }
 101+ } else {
 102+ $status = $wgOnlineStatusBarDefaultOnline;
 103+ }
 104+ }
 105+
 106+ if ( $status == 'hidden' && !($delayed_check) ) {
 107+ $status = $wgOnlineStatusBarDefaultOffline;
 108+ }
 109+
 110+ return $status;
 111+ }
 112+
 113+ /**
 114+ * Insert to the database
 115+ * @return bool
 116+ */
 117+ public static function updateDb() {
 118+ global $wgUser;
 119+ // Skip users we don't track
 120+ if ( OnlineStatusBar::isValid ( $wgUser ) != true ) {
 121+ return false;
 122+ }
 123+ // If we track them, let's insert it to the table
 124+ $dbw = wfGetDB( DB_MASTER );
 125+ $row = array(
 126+ 'username' => $wgUser->getName(),
 127+ 'timestamp' => $dbw->timestamp(),
 128+ );
 129+ $dbw->insert( 'online_status', $row, __METHOD__ );
 130+ return false;
 131+ }
 132+
 133+ /**
 134+ * Delete user who logged out
 135+ * @param $userName string
 136+ * @return bool
 137+ */
 138+ static function deleteStatus( $userName ) {
 139+ $dbw = wfGetDB( DB_MASTER );
 140+ $dbw->delete( 'online_status', array( 'username' => $userName ), __METHOD__ ); // delete user
 141+ // remove from cache
 142+ self::setCache( $userName, '', 'd' );
 143+ self::setCache( $userName, '', 'n' );
 144+ return true;
 145+ }
 146+
 147+ /**
 148+ * Update status of user
 149+ * @return bool
 150+ */
 151+ public static function updateStatus() {
 152+ global $wgUser, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarTrackIpUsers, $wgOnlineStatusBarDefaultEnabled;
 153+ // if anon users are not tracked and user is anon leave it
 154+ if ( !$wgOnlineStatusBarTrackIpUsers ) {
 155+ if ( !$wgUser->isLoggedIn() ) {
 156+ return false;
 157+ }
 158+ }
 159+ // if user doesn't want to be tracked leave it as well for privacy reasons
 160+ if ( $wgUser->isLoggedIn() && !$wgUser->getOption ( "OnlineStatusBar_active", $wgOnlineStatusBarDefaultEnabled ) ) {
 161+ return false;
 162+ }
 163+ $user_status = self::getStatus( $wgUser, true );
 164+ if ( $user_status == $wgOnlineStatusBarDefaultOffline ) {
 165+ self::updateDb();
 166+ return true;
 167+ }
 168+
 169+ if ( $user_status == 'write' ) {
 170+ $dbw = wfGetDB( DB_MASTER );
 171+ $dbw->update(
 172+ 'online_status',
 173+ array( 'timestamp' => $dbw->timestamp() ),
 174+ array( 'username' => $wgUser->getName() ),
 175+ __METHOD__
 176+ );
 177+ self::deleteOld();
 178+ }
 179+
 180+ return true;
 181+ }
 182+
 183+ /**
 184+ * Delete old records from the table, this function is called frequently too keep it as small as possible
 185+ * @return int
 186+ */
 187+ public static function deleteOld() {
 188+ global $wgOnlineStatusBarAutoDelete;
 189+ if ( !$wgOnlineStatusBarAutoDelete ) {
 190+ return 0;
 191+ }
 192+ $dbw = wfGetDB( DB_MASTER );
 193+ $t_time = OnlineStatusBar::getTimeoutDate();
 194+ $result = $dbw->selectField( 'online_status', 'timestamp', array( "timestamp < " . $dbw->addQuotes( $dbw->timestamp( $t_time ) ) ),
 195+ __METHOD__, array( 'LIMIT 1' ) );
 196+ if ( $result === false ) {
 197+ // no need for delete
 198+ return 0;
 199+ }
 200+
 201+ // calculate time and convert it back to mediawiki format
 202+ $time = OnlineStatusBar::getTimeoutDate();
 203+ $dbw->delete( 'online_status', array( "timestamp < " . $dbw->addQuotes( $dbw->timestamp( $time ) ) ), __METHOD__ );
 204+ return 0;
 205+ }
 206+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.status.php
___________________________________________________________________
Added: svn:eol-style
1207 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarVector.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: -2em;
 9+ margin-right: -10px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:-10px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarVector.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/statusgreen.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/statusgreen.png
___________________________________________________________________
Added: svn:mime-type
227 + image/png
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarMono.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ z-index: 10;
 9+ top: 10px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:-2px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarMono.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.body.php
@@ -0,0 +1,161 @@
 2+<?
 3+if ( !defined( 'MEDIAWIKI' ) ) {
 4+ echo "This is a part of mediawiki and can't be started separately";
 5+ die();
 6+}
 7+
 8+/**
 9+ * Main file of Online status bar extension.
 10+ *
 11+ * @file
 12+ * @ingroup Extensions
 13+ * @author Petr Bena <benapetr@gmail.com>
 14+ * @author of magic word Alexandre Emsenhuber
 15+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 16+ * @link http://www.mediawiki.org/wiki/Extension:OnlineStatusBar Documentation
 17+ */
 18+
 19+class OnlineStatusBar {
 20+
 21+ public static function getStatusBarHtml( $text ) {
 22+ return <<<HTML
 23+<div class="onlinestatusbarbody metadata onlinestatusbartop" id="status-top">
 24+<div class="onlinestatusbaricon">
 25+$text</div></div>
 26+HTML;
 27+ }
 28+
 29+ /**
 30+ * Returns image element
 31+ *
 32+ * @param $mode String
 33+ * @param $mode_text String
 34+ * @return string
 35+ */
 36+ public static function GetImageHtml( $mode, $mode_text ) {
 37+ global $wgExtensionAssetsPath, $wgOnlineStatusBarIcon;
 38+ $icon = "$wgExtensionAssetsPath/OnlineStatusBar/{$wgOnlineStatusBarIcon[$mode]}";
 39+ return Html::element( 'img', array( 'src' => $icon, 'alt' => $mode_text ) );
 40+ }
 41+
 42+
 43+ /**
 44+ * Returns the status and User element
 45+ *
 46+ * @param Title $title a title of page
 47+ * @return array|bool Array containing the status and User object
 48+ */
 49+ public static function getAnonFromTitle( Title $title ) {
 50+ global $wgOnlineStatusBarTrackIpUsers;
 51+ // if user is anon and we don't track them stop
 52+ if ( $wgOnlineStatusBarTrackIpUsers == false ) {
 53+ return false;
 54+ }
 55+
 56+ // checks ns
 57+ if ( $title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK ) {
 58+ return false;
 59+ }
 60+
 61+ // we need to create temporary user object
 62+ $user = User::newFromId( 0 );
 63+ $user->setName( $title->getBaseText() );
 64+
 65+ // Check if something wrong didn't happen
 66+ if ( !($user instanceof User) ) {
 67+ return false;
 68+ }
 69+
 70+ $status = OnlineStatusBar_StatusCheck::getStatus( $user );
 71+
 72+ return array( $status, $user );
 73+ }
 74+
 75+
 76+ /**
 77+ * Returns the status and User element
 78+ *
 79+ * @param Title $title a title of page
 80+ * @return array|bool Array containing the status and User object
 81+ */
 82+ public static function getUserInfoFromTitle( Title $title ) {
 83+ if ( $title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK ) {
 84+ return false;
 85+ }
 86+
 87+ // We create an user object using name of user parsed from title
 88+ $user = User::newFromName( $title->getBaseText() );
 89+ // Invalid user
 90+ if ( !($user instanceof User) ) {
 91+ return false;
 92+ }
 93+ if ( !self::isValid( $user ) ) {
 94+ return false;
 95+ }
 96+
 97+ $status = OnlineStatusBar_StatusCheck::getStatus( $user );
 98+
 99+ return array( $status, $user );
 100+ }
 101+
 102+ /**
 103+ * Purge page
 104+ * @return bool
 105+ *
 106+ */
 107+ public static function purge( $user_type ) {
 108+ // First of all we need to know if we already have user object or just a name
 109+ // if so let's create new object
 110+ if ( $user_type instanceof User ) {
 111+ $user = $user_type;
 112+ } elseif ( is_string( $user_type ) ){
 113+ $user = User::newFromName( $user_type );
 114+ } else {
 115+ return false;
 116+ }
 117+
 118+ // check if something weird didn't happen
 119+ if ( $user instanceof User ) {
 120+ // purge both pages now
 121+ if ( $user->getOption('OnlineStatusBar_active', false) ) {
 122+ if ( $user->getOption('OnlineStatusBar_autoupdate', false) == true ) {
 123+ WikiPage::factory( $user->getUserPage() )->doPurge();
 124+ WikiPage::factory( $user->getTalkPage() )->doPurge();
 125+ }
 126+ }
 127+ }
 128+ return true;
 129+ }
 130+
 131+
 132+ /**
 133+ * @return timestamp
 134+ */
 135+ public static function getTimeoutDate( $delayed = false ) {
 136+ global $wgOnlineStatusBar_WriteTime, $wgOnlineStatusBar_LogoutTime;
 137+
 138+ if ($delayed) {
 139+ return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_WriteTime;
 140+ }
 141+
 142+ return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_LogoutTime;
 143+ }
 144+
 145+ /**
 146+ * Checks to see if the user can be tracked
 147+ *
 148+ * @param User $user
 149+ * @return bool
 150+ */
 151+ public static function isValid( User $user ) {
 152+ global $wgOnlineStatusBarTrackIpUsers, $wgOnlineStatusBarDefaultEnabled;
 153+
 154+ // checks if anon
 155+ if ( $user->isAnon() ) {
 156+ return $wgOnlineStatusBarTrackIpUsers;
 157+ }
 158+
 159+ // do we track them
 160+ return $user->getOption( "OnlineStatusBar_active", $wgOnlineStatusBarDefaultEnabled );
 161+ }
 162+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.body.php
___________________________________________________________________
Added: svn:eol-style
1163 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/statusred.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/statusred.png
___________________________________________________________________
Added: svn:mime-type
2164 + image/png
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/statusorange.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/statusorange.png
___________________________________________________________________
Added: svn:mime-type
3165 + image/png
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.php
@@ -0,0 +1,122 @@
 2+<?php
 3+/**
 4+ * Insert a special box on user page showing their status.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ * @author Petr Bena <benapetr@gmail.com>
 9+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 10+ * @link http://www.mediawiki.org/wiki/Extension:OnlineStatusBar Documentation
 11+ */
 12+
 13+if ( !defined( 'MEDIAWIKI' ) ) {
 14+ echo "This is a part of mediawiki and can't be started separately";
 15+ die();
 16+}
 17+
 18+$wgExtensionCredits[version_compare( $wgVersion, '1.17', '>=' ) ? 'userpage tools' : 'other'][] = array(
 19+ 'path' => __FILE__,
 20+ 'name' => 'Online status bar',
 21+ 'version' => '1.0.3',
 22+ 'author' => array( 'Petr Bena' ),
 23+ 'descriptionmsg' => 'onlinestatusbar-desc',
 24+ 'url' => 'http://www.mediawiki.org/wiki/Extension:OnlineStatusBar',
 25+);
 26+
 27+$dir = dirname( __FILE__ );
 28+$wgExtensionMessagesFiles['OnlineStatusBar'] = "$dir/OnlineStatusBar.i18n.php";
 29+
 30+$wgResourceModules['ext.OnlineStatusBar'] = array (
 31+ 'styles' => 'OnlineStatusBar.css',
 32+ 'localBasePath' => dirname ( __FILE__ ),
 33+ 'remoteExtPath' => 'OnlineStatusBar',
 34+);
 35+
 36+$wgResourceModules['ext.OnlineStatusBar.vector'] = array (
 37+ 'styles' => 'OnlineStatusBarVector.css',
 38+ 'localBasePath' => dirname ( __FILE__ ),
 39+ 'remoteExtPath' => 'OnlineStatusBar',
 40+);
 41+
 42+$wgResourceModules['ext.OnlineStatusBar.modern'] = array (
 43+ 'styles' => 'OnlineStatusBarModern.css',
 44+ 'localBasePath' => dirname ( __FILE__ ),
 45+ 'remoteExtPath' => 'OnlineStatusBar',
 46+);
 47+
 48+$wgResourceModules['ext.OnlineStatusBar.chick'] = array (
 49+ 'styles' => 'OnlineStatusBarChick.css',
 50+ 'localBasePath' => dirname ( __FILE__ ),
 51+ 'remoteExtPath' => 'OnlineStatusBar',
 52+);
 53+
 54+$wgResourceModules['ext.OnlineStatusBar.standard'] = array (
 55+ 'styles' => 'OnlineStatusBarClassic.css',
 56+ 'localBasePath' => dirname ( __FILE__ ),
 57+ 'remoteExtPath' => 'OnlineStatusBar',
 58+);
 59+
 60+$wgResourceModules['ext.OnlineStatusBar.monobook'] = array (
 61+ 'styles' => 'OnlineStatusBarMono.css',
 62+ 'localBasePath' => dirname ( __FILE__ ),
 63+ 'remoteExtPath' => 'OnlineStatusBar',
 64+);
 65+
 66+$wgResourceModules['ext.OnlineStatusBar.simple'] = array (
 67+ 'styles' => 'OnlineStatusBarSimple.css',
 68+ 'localBasePath' => dirname ( __FILE__ ),
 69+ 'remoteExtPath' => 'OnlineStatusBar',
 70+);
 71+
 72+$wgResourceModules['ext.OnlineStatusBar.cologne'] = array (
 73+ 'styles' => 'OnlineStatusBarCologne.css',
 74+ 'localBasePath' => dirname ( __FILE__ ),
 75+ 'remoteExtPath' => 'OnlineStatusBar',
 76+);
 77+
 78+$wgResourceModules['ext.OnlineStatusBar.nostalgia'] = array (
 79+ 'styles' => 'OnlineStatusBarNostalgia.css',
 80+ 'localBasePath' => dirname ( __FILE__ ),
 81+ 'remoteExtPath' => 'OnlineStatusBar',
 82+);
 83+
 84+// Load other files of extension
 85+$wgAutoloadClasses['OnlineStatusBar'] = "$dir/OnlineStatusBar.body.php";
 86+$wgAutoloadClasses['OnlineStatusBar_StatusCheck'] = "$dir/OnlineStatusBar.status.php";
 87+$wgAutoloadClasses['OnlineStatusBarHooks'] = "$dir/OnlineStatusBarHooks.php";
 88+
 89+// Configuration
 90+// Those values can be overriden in LocalSettings, do not change it here
 91+$wgOnlineStatusBarIcon = array(
 92+ 'online' => "statusgreen.png",
 93+ 'busy' => "statusorange.png",
 94+ 'away' => "statusorange.png",
 95+ 'hidden' => "statusred.png",
 96+ 'offline' => "statusred.png",
 97+);
 98+
 99+// default for anonymous and uknown users
 100+$wgOnlineStatusBarTrackIpUsers = false;
 101+// it's better to cron this for performance reasons
 102+$wgOnlineStatusBarAutoDelete = true;
 103+// delay between db updates
 104+$wgOnlineStatusBar_WriteTime = 300;
 105+// default for online
 106+$wgOnlineStatusBarDefaultOnline = "online";
 107+// default for offline
 108+$wgOnlineStatusBarDefaultOffline = "offline";
 109+// if users have this feature enabled by default
 110+$wgOnlineStatusBarDefaultEnabled = false;
 111+// how long to wait until user is considered as offline
 112+$wgOnlineStatusBar_LogoutTime = 3600;
 113+
 114+$wgHooks['LoadExtensionSchemaUpdates'][] = 'OnlineStatusBarHooks::ckSchema';
 115+$wgHooks['UserLogoutComplete'][] = 'OnlineStatusBarHooks::logout';
 116+$wgHooks['ArticleViewHeader'][] = 'OnlineStatusBarHooks::renderBar';
 117+$wgHooks['UserLoginComplete'][] = 'OnlineStatusBarHooks::updateStatus';
 118+$wgHooks['GetPreferences'][] = 'OnlineStatusBarHooks::preferencesHook';
 119+$wgHooks['UserGetDefaultOptions'][] = 'OnlineStatusBarHooks::setDefaultOptions';
 120+$wgHooks['LanguageGetMagic'][] = 'OnlineStatusBarHooks::magicWordVar';
 121+$wgHooks['BeforePageDisplay'][] = 'OnlineStatusBarHooks::stylePage';
 122+$wgHooks['MagicWordwgVariableIDs'][] = 'OnlineStatusBarHooks::magicWordSet';
 123+$wgHooks['ParserGetVariableValueSwitch'][] = 'OnlineStatusBarHooks::parserGetVariable';
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.php
___________________________________________________________________
Added: svn:eol-style
1124 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 2em;
 9+ margin-right: 0px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:0px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarChick.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 1em;
 9+ margin-right: 4px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:0px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarChick.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarClassic.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 4em;
 9+ margin-right: 4px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:6px;
 25+}
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarNostalgia.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 0px;
 9+ margin-right: 261px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:0px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarNostalgia.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarHooks.php
@@ -0,0 +1,203 @@
 2+<?php
 3+
 4+/**
 5+ * Hooks for OnlineStatusBar
 6+ *
 7+ * @group Extensions
 8+ */
 9+class OnlineStatusBarHooks {
 10+ /**
 11+ * @param DatabaseUpdater|null $updater
 12+ * @return bool
 13+ */
 14+ public static function ckSchema( $updater = null ) {
 15+ if ( $updater !== null ) {
 16+ $updater->addExtensionUpdate( array( 'addtable', 'online_status', dirname( __FILE__ ) . '/OnlineStatusBar.sql', true ) );
 17+ } else {
 18+ global $wgExtNewTables;
 19+ $wgExtNewTables[] = array(
 20+ 'online_status', dirname( __FILE__ ) . '/OnlineStatusBar.sql' );
 21+ }
 22+ return true;
 23+ }
 24+
 25+ /**
 26+ * @param $user User
 27+ * @param $inject_html string
 28+ * @param $old_name string
 29+ * @return bool
 30+ */
 31+ public static function logout( &$user, &$inject_html, $old_name ) {
 32+ OnlineStatusBar::purge( $old_name );
 33+ OnlineStatusBar_StatusCheck::deleteStatus( $old_name );
 34+ return true;
 35+ }
 36+
 37+ /**
 38+ * Called everytime on login
 39+ * @return bool
 40+ */
 41+ public static function updateStatus() {
 42+ global $wgUser;
 43+ // Purge user page (optional)
 44+ OnlineStatusBar::purge( $wgUser );
 45+ // Update status
 46+ OnlineStatusBar_StatusCheck::updateStatus();
 47+ return true;
 48+ }
 49+
 50+ /**
 51+ * Creates a bar
 52+ * @param $article Article
 53+ * @param $outputDone bool
 54+ * @param $pcache string
 55+ * @return bool
 56+ */
 57+ public static function renderBar( &$article, &$outputDone, &$pcache ) {
 58+ $context = $article->getContext();
 59+
 60+ // Update status of each user who wants to be tracked
 61+ OnlineStatusBar_StatusCheck::updateStatus();
 62+
 63+ // Performace fix
 64+ $title = $article->getTitle();
 65+ if ( $title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK ) {
 66+ return true;
 67+ }
 68+
 69+ // Retrieve status of user parsed from title
 70+ $result = OnlineStatusBar::getUserInfoFromTitle( $title );
 71+ // In case that status can't be parsed we check if it isn't anon
 72+ if ( $result === false && User::isIP ( $title->getBaseText() ) ) {
 73+ $result = OnlineStatusBar::getAnonFromTitle( $title );
 74+ }
 75+
 76+ // In case we were unable to get a status let's quit
 77+ if ( $result === false ) {
 78+ return true;
 79+ }
 80+
 81+ /** @var $user User */
 82+ list( $status, $user ) = $result;
 83+
 84+ // Don't display status of those who don't want to show bar but only use magic
 85+ if ( $user->getOption( 'OnlineStatusBar_hide' ) == true ) {
 86+ return true;
 87+ }
 88+
 89+ $modetext = wfMessage( 'onlinestatusbar-status-' . $status )->toString();
 90+ $image = OnlineStatusBar::getImageHtml( $status, $modetext );
 91+ $text = wfMessage( 'onlinestatusbar-line', $user->getName() )
 92+ ->rawParams( $image )->params( $modetext )->escaped();
 93+ $context->getOutput()->addHtml( OnlineStatusBar::getStatusBarHtml( $text ) );
 94+
 95+ return true;
 96+ }
 97+
 98+ /**
 99+ * Insert user options
 100+ * @param $user User
 101+ * @param $preferences array
 102+ * @return bool
 103+ */
 104+ public static function preferencesHook( User $user, array &$preferences ) {
 105+ global $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarDefaultEnabled, $wgOnlineStatusBarModes;
 106+ $preferences['OnlineStatusBar_active'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-used', 'section' => 'misc/onlinestatus' );
 107+ $preferences['OnlineStatusBar_hide'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-hide', 'section' => 'misc/onlinestatus' );
 108+ $preferences['OnlineStatusBar_autoupdate'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-purge', 'section' => 'misc/onlinestatus' );
 109+ $preferences['OnlineStatusBar_status'] = array( 'type' => 'radio', 'label-message' => 'onlinestatusbar-status', 'section' => 'misc/onlinestatus',
 110+ 'options' => array(
 111+ wfMessage( 'onlinestatusbar-status-online' )->escaped() => 'online',
 112+ wfMessage( 'onlinestatusbar-status-busy' )->escaped() => 'busy',
 113+ wfMessage( 'onlinestatusbar-status-away' )->escaped() => 'away',
 114+ wfMessage( 'onlinestatusbar-status-hidden' )->escaped() => 'hidden'
 115+ ),
 116+ );
 117+ return true;
 118+ }
 119+
 120+ /**
 121+ * @param $defaultOptions array
 122+ * @return bool
 123+ */
 124+ public static function setDefaultOptions( &$defaultOptions ) {
 125+ global $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarDefaultEnabled;
 126+ // set defaults
 127+ $defaultOptions['OnlineStatusBar_autoupdate'] = false;
 128+ $defaultOptions['OnlineStatusBar_status'] = $wgOnlineStatusBarDefaultOnline;
 129+ $defaultOptions['OnlineStatusBar_active'] = $wgOnlineStatusBarDefaultEnabled;
 130+ $defaultOptions['OnlineStatusBar_hide'] = false;
 131+ // quit
 132+ return true;
 133+ }
 134+
 135+ /**
 136+ * @param $magicWords array
 137+ * @param $ln string (language)
 138+ * @return bool
 139+ */
 140+ public static function magicWordVar( array &$magicWords, $ln ) {
 141+ $magicWords['ISONLINE'] = array( 1, 'ISONLINE' );
 142+ return true;
 143+ }
 144+
 145+ /**
 146+ * @param $out OutputPage
 147+ * @param $skin Skin
 148+ * @return bool
 149+ */
 150+ public static function stylePage( &$out, &$skin ) {
 151+ switch ($skin->getSkinName()) {
 152+ case 'monobook':
 153+ case 'vector':
 154+ case 'simple':
 155+ case 'modern':
 156+ case 'standard':
 157+ case 'nostalgia':
 158+ case 'chick':
 159+ case 'cologneblue':
 160+ $out->addModules( 'ext.OnlineStatusBar.' . $skin->getSkinName() );
 161+ break;
 162+ default:
 163+ $out->addModules( 'ext.OnlineStatusBar' );
 164+ }
 165+ return true;
 166+ }
 167+
 168+ /**
 169+ * @param $vars array
 170+ * @return bool
 171+ */
 172+ public static function magicWordSet( &$vars ) {
 173+ $vars[] = 'ISONLINE';
 174+ return true;
 175+ }
 176+
 177+ /**
 178+ * @param $parser Parser
 179+ * @param $varCache ??
 180+ * @param $index ??
 181+ * @param $ret string?
 182+ * @return bool
 183+ */
 184+ public static function parserGetVariable( &$parser, &$varCache, &$index, &$ret ) {
 185+ if ( $index != 'ISONLINE' ) {
 186+ return true;
 187+ }
 188+
 189+ // get a status of user parsed from title
 190+ $result = OnlineStatusBar::getUserInfoFromTitle( $parser->getTitle() );
 191+ // if user is IP and we track them
 192+ if ( User::isIP( $parser->getTitle()->getBaseText() ) && $result === false ) {
 193+ $result = OnlineStatusBar::getAnonFromTitle( $parser->getTitle() );
 194+ }
 195+
 196+ if ( $result === false ) {
 197+ $ret = 'unknown';
 198+ return true;
 199+ }
 200+
 201+ $ret = $result[0];
 202+ return true;
 203+ }
 204+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarHooks.php
___________________________________________________________________
Added: svn:eol-style
1205 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarModern.css
@@ -0,0 +1,25 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 0px;
 9+ margin-right: 2px;
 10+ color: white;
 11+ display: block !important;
 12+}
 13+
 14+div.onlinestatusbaricon {
 15+ border: 0px solid black;
 16+ background: transparent;
 17+ float: right;
 18+ position: relative;
 19+ top: 0px;
 20+ padding: 5px;
 21+}
 22+
 23+div.onlinestatusbarbody {
 24+ right:0px;
 25+ margin-top:-3px;
 26+}
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarCologne.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 2em;
 9+ margin-right: 0px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:76px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarCologne.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.sql
@@ -0,0 +1,6 @@
 2+CREATE TABLE /*$wgDBprefix*/online_status (
 3+ `username` varchar(255) NOT NULL default '',
 4+ `timestamp` char(14) NOT NULL default '',
 5+ PRIMARY KEY USING HASH (`username`)
 6+) ENGINE=MEMORY;
 7+
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBar.sql
___________________________________________________________________
Added: svn:eol-style
18 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarSimple.css
@@ -0,0 +1,24 @@
 2+/*
 3+This is a part of css used on english wp, it's needed for wikis
 4+where topicon isn't defined
 5+*/
 6+div.onlinestatusbartop {
 7+ position: absolute;
 8+ top: 0em;
 9+ margin-right: 2px;
 10+ display: block !important;
 11+}
 12+
 13+div.onlinestatusbaricon {
 14+ border: 0px solid black;
 15+ background: transparent;
 16+ float: right;
 17+ position: relative;
 18+ top: 0px;
 19+ padding: 5px;
 20+}
 21+
 22+div.onlinestatusbarbody {
 23+ right:0px;
 24+ margin-top:2px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_3/OnlineStatusBarSimple.css
___________________________________________________________________
Added: svn:eol-style
126 + native

Status & tagging log