r102680 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102679‎ | r102680 | r102681 >
Date:20:11, 10 November 2011
Author:petrb
Status:deferred
Tags:
Comment:
tagged next stable version of this: Added support for more skins, plus some fixes
Modified paths:
  • /tags/extensions/OnlineStatusBar/REL_1_0_2 (added) (history)

Diff [purge]

Index: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBar.body.php
@@ -0,0 +1,264 @@
 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+ * @return string
 34+ */
 35+ public static function GetImageHtml( $mode ) {
 36+ global $wgExtensionAssetsPath, $wgOnlineStatusBarIcon;
 37+ $icon = "$wgExtensionAssetsPath/OnlineStatusBar/{$wgOnlineStatusBarIcon[$mode]}";
 38+ return Html::element( 'img', array( 'src' => $icon ) );
 39+ }
 40+
 41+
 42+ /**
 43+ * Returns the status and User element
 44+ *
 45+ * @param Title $title
 46+ * @return array|bool Array containing the status and User object
 47+ */
 48+ public static function getAnonFromTitle( Title $title ) {
 49+ global $wgOnlineStatusBarTrackIpUsers;
 50+ // if user is anon and we don't track them stop
 51+ if ( $wgOnlineStatusBarTrackIpUsers == false ) {
 52+ return false;
 53+ }
 54+
 55+ // checks ns
 56+ if ( $title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK ) {
 57+ return false;
 58+ }
 59+
 60+ // we need to create temporary user object
 61+ $user = User::newFromId( 0 );
 62+ $user->setName( $title->getBaseText() );
 63+
 64+ // Check if something wrong didn't happen
 65+ if ( !($user instanceof User) ) {
 66+ return false;
 67+ }
 68+
 69+ $status = self::getStatus( $user, true );
 70+
 71+ return array( $status, $user );
 72+ }
 73+
 74+
 75+ /**
 76+ * Returns the status and User element
 77+ *
 78+ * @param Title $title
 79+ * @return array|bool Array containing the status and User object
 80+ */
 81+ public static function getUserInfoFromTitle( Title $title ) {
 82+ if ( $title->getNamespace() != NS_USER && $title->getNamespace() != NS_USER_TALK ) {
 83+ return false;
 84+ }
 85+
 86+ $user = User::newFromName( $title->getBaseText() );
 87+ // Invalid user
 88+ if ( !($user instanceof User) ) {
 89+ return false;
 90+ }
 91+ if ( !self::isValid( $user ) ) {
 92+ return false;
 93+ }
 94+
 95+ $status = self::getStatus( $user, true );
 96+
 97+ return array( $status, $user );
 98+ }
 99+
 100+ /**
 101+ * @param $user User
 102+ * @return String
 103+ */
 104+ public static function getStatus( $user, $update = false ) {
 105+ global $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline;
 106+ // remove old entries
 107+ if ( $update )
 108+ {
 109+ self::deleteOld();
 110+ }
 111+
 112+ // instead of delete every time just select the records which are not that old
 113+ $t_time = self::getTimeoutDate();
 114+ $dbr = wfGetDB( DB_SLAVE );
 115+ $result = $dbr->selectField( 'online_status', 'username', array( 'username' => $user->getName(),
 116+ "timestamp > " . $dbr->addQuotes( $dbr->timestamp( $t_time ) ) ),
 117+ __METHOD__, array( 'LIMIT 1', 'ORDER BY timestamp DESC' ) );
 118+
 119+ if ( $result === false ) {
 120+ $status = $wgOnlineStatusBarDefaultOffline;
 121+ } else {
 122+ // let's check if it isn't anon
 123+ if ( $user->isLoggedIn() ) {
 124+ $status = $user->getOption( 'OnlineStatusBar_status', $wgOnlineStatusBarDefaultOnline );
 125+ } else {
 126+ $status = $wgOnlineStatusBarDefaultOnline;
 127+ }
 128+ }
 129+
 130+ if ( $status == 'hidden' ) {
 131+ $status = $wgOnlineStatusBarDefaultOffline;
 132+ }
 133+
 134+ return $status;
 135+ }
 136+
 137+ /**
 138+ * Purge page
 139+ * @return bool
 140+ *
 141+ */
 142+ public static function purge( $user_type ) {
 143+ if ( $user_type instanceof User ) {
 144+ $user = $user_type;
 145+ } else if ( is_string( $user_type ) ){
 146+ $user = User::newFromName( $user_type );
 147+ } else {
 148+ return false;
 149+ }
 150+
 151+ // check if something weird didn't happen
 152+ if ( $user instanceof User ) {
 153+ // purge both pages now
 154+ if ( $user->getOption('OnlineStatusBar_active', false) ) {
 155+ if ( $user->getOption('OnlineStatusBar_autoupdate', false) == true ) {
 156+ WikiPage::factory( $user->getUserPage() )->doPurge();
 157+ WikiPage::factory( $user->getTalkPage() )->doPurge();
 158+ }
 159+ }
 160+ }
 161+ return true;
 162+ }
 163+
 164+ /**
 165+ * Insert to the database
 166+ * @return bool
 167+ */
 168+ public static function updateDb() {
 169+ global $wgUser;
 170+ // Skip users we don't track
 171+ if ( self::isValid ( $wgUser ) != true ) {
 172+ return false;
 173+ }
 174+ // If we track them, let's insert it to the table
 175+ $dbw = wfGetDB( DB_MASTER );
 176+ $row = array(
 177+ 'username' => $wgUser->getName(),
 178+ 'timestamp' => $dbw->timestamp(),
 179+ );
 180+ $dbw->insert( 'online_status', $row, __METHOD__, 'DELAYED' );
 181+ return false;
 182+ }
 183+
 184+ /**
 185+ * Update status of user
 186+ * @return bool
 187+ */
 188+ public static function updateStatus() {
 189+ global $wgUser, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarTrackIpUsers, $wgOnlineStatusBarDefaultEnabled;
 190+ // if anon users are not tracked and user is anon leave it
 191+ if ( !$wgOnlineStatusBarTrackIpUsers ) {
 192+ if ( !$wgUser->isLoggedIn() ) {
 193+ return false;
 194+ }
 195+ }
 196+ // if user doesn't want to be tracked leave it as well for privacy reasons
 197+ if ( $wgUser->isLoggedIn() && !$wgUser->getOption ( "OnlineStatusBar_active", $wgOnlineStatusBarDefaultEnabled ) ) {
 198+ return false;
 199+ }
 200+ if ( OnlineStatusBar::getStatus( $wgUser ) == $wgOnlineStatusBarDefaultOffline ) {
 201+ OnlineStatusBar::updateDb();
 202+ return true;
 203+ }
 204+
 205+ $dbw = wfGetDB( DB_MASTER );
 206+ $dbw->update(
 207+ 'online_status',
 208+ array( 'timestamp' => $dbw->timestamp() ),
 209+ array( 'username' => $wgUser->getName() ),
 210+ __METHOD__
 211+ );
 212+
 213+ return true;
 214+ }
 215+
 216+ /**
 217+ * @return timestamp
 218+ */
 219+ private static function getTimeoutDate() {
 220+ global $wgOnlineStatusBar_LogoutTime;
 221+ return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_LogoutTime;
 222+ }
 223+
 224+ /**
 225+ * Delete old records from the table, this function is called frequently too keep it as small as possible
 226+ * @return int
 227+ */
 228+ public static function deleteOld() {
 229+ $dbw = wfGetDB( DB_MASTER );
 230+ // calculate time and convert it back to mediawiki format
 231+ $time = self::getTimeoutDate();
 232+ $dbw->delete( 'online_status', array( "timestamp < " . $dbw->addQuotes( $dbw->timestamp( $time ) ) ), __METHOD__ );
 233+ return 0;
 234+ }
 235+
 236+
 237+ /**
 238+ * Checks to see if the user can be tracked
 239+ *
 240+ * @param User $user
 241+ * @return bool
 242+ */
 243+ public static function isValid( User $user ) {
 244+ global $wgOnlineStatusBarTrackIpUsers, $wgOnlineStatusBarDefaultEnabled;
 245+
 246+ // checks if anon
 247+ if ( $user->isAnon() ) {
 248+ return $wgOnlineStatusBarTrackIpUsers;
 249+ }
 250+
 251+ // do we track them
 252+ return $user->getOption( "OnlineStatusBar_active", $wgOnlineStatusBarDefaultEnabled );
 253+ }
 254+
 255+ /**
 256+ * Delete user who logged out
 257+ * @param $userName string
 258+ * @return bool
 259+ */
 260+ static function deleteStatus( $userName ) {
 261+ $dbw = wfGetDB( DB_MASTER );
 262+ $dbw->delete( 'online_status', array( 'username' => $userName ), __METHOD__ ); // delete user
 263+ return true;
 264+ }
 265+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBar.body.php
___________________________________________________________________
Added: svn:eol-style
1266 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBar.i18n.php
@@ -0,0 +1,242 @@
 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+/** German (Deutsch)
 63+ * @author Kghbln
 64+ */
 65+$messages['de'] = array(
 66+ 'onlinestatusbar-desc' => 'Ermöglicht, abhängig von der Benutzereinstellung, die Anzeige des Onlinestatus eines Benutzers auf dessen Benutzerseite',
 67+ 'onlinestatusbar-line' => '$1 ist gerade $3 $2',
 68+ 'onlinestatusbar-used' => 'Möchtest du, dass andere Benutzer deinen Onlinestatus sehen?',
 69+ 'onlinestatusbar-status' => 'Welchen Status möchtest du standardmäßig nutzen:',
 70+ 'onlinestatusbar-purge' => 'Den Cache der Benutzerseite jedes Mal leeren, wenn du dich an- oder abmeldest',
 71+ 'prefs-onlinestatus' => 'Onlinestatus',
 72+ 'onlinestatusbar-hide' => "Möchtest du die Statusleiste ausblenden, um stattdessen lediglich das ''Magic Word'' zu nutzen? (Für Fortgeschrittene)",
 73+ 'onlinestatusbar-status-online' => 'Online',
 74+ 'onlinestatusbar-status-busy' => 'Beschäftigt',
 75+ 'onlinestatusbar-status-away' => 'Abwesend',
 76+ 'onlinestatusbar-status-offline' => 'Offline',
 77+ 'onlinestatusbar-status-hidden' => 'Versteckt',
 78+);
 79+
 80+/** German (formal address) (‪Deutsch (Sie-Form)‬)
 81+ * @author Kghbln
 82+ */
 83+$messages['de-formal'] = array(
 84+ 'onlinestatusbar-used' => 'Möchten Sie, dass andere Benutzer Ihren Onlinestatus sehen?',
 85+ 'onlinestatusbar-status' => 'Welchen Status möchten Sie standardmäßig nutzen:',
 86+ 'onlinestatusbar-purge' => 'Den Cache der Benutzerseite jedes Mal leeren, wenn Sie sich an- oder abmelden',
 87+ 'onlinestatusbar-hide' => "Möchten Sie die Statusleiste ausblenden, um stattdessen lediglich das ''Magic Word'' zu nutzen? (Für Fortgeschrittene)",
 88+);
 89+
 90+/** French (Français)
 91+ * @author DavidL
 92+ * @author Gomoko
 93+ */
 94+$messages['fr'] = array(
 95+ 'onlinestatusbar-desc' => "Barre d'état montrant si un utilisateur est en ligne, basé sur les préférences, sur leur page utilisateur",
 96+ 'onlinestatusbar-line' => '$1 est maintenant $2 $3',
 97+ 'onlinestatusbar-used' => 'Voulez-vous permettre que les autres voient si vous êtes en ligne ?',
 98+ 'onlinestatusbar-status' => 'Quel est le statut par défaut que vous souhaitez utiliser :',
 99+ 'onlinestatusbar-purge' => 'Vider la page utilisateur chaque vous que vous vous connectez ou vous déconnectez',
 100+ 'prefs-onlinestatus' => 'État en ligne',
 101+ 'onlinestatusbar-hide' => "Voulez-vous masquer la barre d'état afin d'utiliser le mot magique seulement ? (Pour les utilisateurs avancés)",
 102+ 'onlinestatusbar-status-online' => 'Présent',
 103+ 'onlinestatusbar-status-busy' => 'Occupé',
 104+ 'onlinestatusbar-status-away' => 'Parti',
 105+ 'onlinestatusbar-status-offline' => 'Absent',
 106+ 'onlinestatusbar-status-hidden' => 'Caché',
 107+);
 108+
 109+/** Franco-Provençal (Arpetan)
 110+ * @author ChrisPtDe
 111+ */
 112+$messages['frp'] = array(
 113+ 'onlinestatusbar-line' => '$1 est ora $2 $3',
 114+ 'prefs-onlinestatus' => 'Ètat en legne',
 115+ 'onlinestatusbar-status-online' => 'Present',
 116+ 'onlinestatusbar-status-busy' => 'Ocupo',
 117+ 'onlinestatusbar-status-away' => 'Viâ',
 118+ 'onlinestatusbar-status-offline' => 'Absent',
 119+ 'onlinestatusbar-status-hidden' => 'Cachiê',
 120+);
 121+
 122+/** Galician (Galego)
 123+ * @author Toliño
 124+ */
 125+$messages['gl'] = array(
 126+ 'onlinestatusbar-desc' => 'Barra de estado que mostra na páxina de usuario se un usuario está conectado',
 127+ 'onlinestatusbar-line' => '$1 está $2 $3 nestes intres',
 128+ 'onlinestatusbar-used' => 'Quere deixar que os outros poidan ver se está conectado?',
 129+ 'onlinestatusbar-status' => 'Cal é o estado por defecto que quere usar:',
 130+ 'onlinestatusbar-purge' => 'Purgar a páxina de usuario cada vez que se identifique ou saia do sistema',
 131+ 'prefs-onlinestatus' => 'Conectado',
 132+ 'onlinestatusbar-hide' => 'Quere agochar a barra de estado para usar unicamente a palabra máxica? (Para usuarios avanzados)',
 133+ 'onlinestatusbar-status-online' => 'Conectado',
 134+ 'onlinestatusbar-status-busy' => 'Ocupado',
 135+ 'onlinestatusbar-status-away' => 'Non dispoñible',
 136+ 'onlinestatusbar-status-offline' => 'Desconectado',
 137+ 'onlinestatusbar-status-hidden' => 'Agochado',
 138+);
 139+
 140+/** Hebrew (עברית)
 141+ * @author Amire80
 142+ */
 143+$messages['he'] = array(
 144+ 'onlinestatusbar-desc' => 'שורת מצב שמציגה בדף המשתמש אם המשתמש מקוון, בהתאם להעדפות',
 145+ 'onlinestatusbar-line' => '$1 $2 $3 עכשיו',
 146+ 'onlinestatusbar-used' => 'לאפשר לאחרים לראות שאתם מחוברים?',
 147+ 'onlinestatusbar-status' => 'מהו המצב שתרצו להיות פה לפי בררת המחדל:',
 148+ 'onlinestatusbar-purge' => 'לנקות את המטמון של דף המשתמש בכל פעם שאתם נכנסים או יוצאים',
 149+ 'prefs-onlinestatus' => 'מצב ההימצאות באתר',
 150+ 'onlinestatusbar-hide' => 'האם להסתיר את שורת המצב כדי להשתמש רק במילת הקסם? (למשתמשים מתקדמים)',
 151+ 'onlinestatusbar-status-online' => 'באתר',
 152+ 'onlinestatusbar-status-busy' => 'עסוק',
 153+ 'onlinestatusbar-status-away' => 'לא ליד מחשב',
 154+ 'onlinestatusbar-status-offline' => 'לא באתר',
 155+ 'onlinestatusbar-status-hidden' => 'מוסתר',
 156+);
 157+
 158+/** Upper Sorbian (Hornjoserbsce)
 159+ * @author Michawiki
 160+ */
 161+$messages['hsb'] = array(
 162+ 'onlinestatusbar-line' => '$1 je nětko $3 $2',
 163+ 'prefs-onlinestatus' => 'Onlinestatus',
 164+ 'onlinestatusbar-status-online' => 'Online',
 165+ 'onlinestatusbar-status-busy' => 'Ma dźěło',
 166+ 'onlinestatusbar-status-away' => 'Preč',
 167+ 'onlinestatusbar-status-offline' => 'Offline',
 168+ 'onlinestatusbar-status-hidden' => 'Schowany',
 169+);
 170+
 171+/** Interlingua (Interlingua)
 172+ * @author McDutchie
 173+ */
 174+$messages['ia'] = array(
 175+ 'onlinestatusbar-desc' => 'Barra de stato que monstra si un usator es in linea, dependente de su preferentias, in su pagina de usator',
 176+ 'onlinestatusbar-line' => '$1 es ora $2 $3',
 177+ 'onlinestatusbar-used' => 'Vole tu permitter que alteres vide si tu es in linea?',
 178+ 'onlinestatusbar-status' => 'Qual es le stato predefinite que tu vole usar:',
 179+ 'onlinestatusbar-purge' => 'Purgar le pagina de usator cata vice que tu aperi o claude session',
 180+ 'prefs-onlinestatus' => 'Stato in linea',
 181+ 'onlinestatusbar-hide' => 'Vole tu celar le barra de stato pro usar solmente le parola magic? (Pro usatores avantiate)',
 182+ 'onlinestatusbar-status-online' => 'In linea',
 183+ 'onlinestatusbar-status-busy' => 'Occupate',
 184+ 'onlinestatusbar-status-away' => 'Absente',
 185+ 'onlinestatusbar-status-offline' => 'Foras de linea',
 186+ 'onlinestatusbar-status-hidden' => 'Celate',
 187+);
 188+
 189+/** Luxembourgish (Lëtzebuergesch)
 190+ * @author Robby
 191+ */
 192+$messages['lb'] = array(
 193+ 'onlinestatusbar-line' => '$1 ass elo $2 $3',
 194+ 'onlinestatusbar-used' => 'Wëllt dir datt Anerer kënne gesinn op Dir online sidd?',
 195+ 'onlinestatusbar-status-busy' => 'Beschäftegt',
 196+ 'onlinestatusbar-status-away' => 'Net do',
 197+ 'onlinestatusbar-status-hidden' => 'Verstoppt',
 198+);
 199+
 200+/** Macedonian (Македонски)
 201+ * @author Bjankuloski06
 202+ */
 203+$messages['mk'] = array(
 204+ 'onlinestatusbar-desc' => 'Статусник што прикажува дали корисникот е на линија, зависно од нагодувањата на корисничката страница',
 205+ 'onlinestatusbar-line' => '$1 сега е $2 $3',
 206+ 'onlinestatusbar-used' => 'Дали сакате другите да знаат кога сте на линија?',
 207+ 'onlinestatusbar-status' => 'Вашиот статус по основно:',
 208+ 'onlinestatusbar-purge' => 'Пречисти го кешот на корисничката страница секојпат кога ќе се најавам или одјавам',
 209+ 'prefs-onlinestatus' => 'Вклученост',
 210+ 'onlinestatusbar-hide' => 'Дали би сакале да го скриете статусникот за да го користите само волшебниот збор (за напредни корисници)',
 211+ 'onlinestatusbar-status-online' => 'Вклучен',
 212+ 'onlinestatusbar-status-busy' => 'Зафатен',
 213+ 'onlinestatusbar-status-away' => 'Отсутен',
 214+ 'onlinestatusbar-status-offline' => 'Исклучен',
 215+ 'onlinestatusbar-status-hidden' => 'Скриен',
 216+);
 217+
 218+/** Dutch (Nederlands)
 219+ * @author SPQRobin
 220+ * @author Siebrand
 221+ */
 222+$messages['nl'] = array(
 223+ 'onlinestatusbar-desc' => 'Statusbalk die weergeeft of een gebruiker online is, op basis van voorkeuren, op zijn/haar gebruikerspagina',
 224+ 'onlinestatusbar-line' => '$1 is nu $2 $3',
 225+ 'onlinestatusbar-used' => 'Wilt u andere gebruikers laten zien dat u online bent?',
 226+ 'onlinestatusbar-status' => 'Welke standaard status wilt u gebruiken:',
 227+ 'onlinestatusbar-purge' => 'Uw gebruikerspagina bij aanmelden en afmelden uit de cache verwijderen',
 228+ 'prefs-onlinestatus' => 'Onlinestatus',
 229+ 'onlinestatusbar-hide' => 'Wilt u de statusbalk verbergen en alleen het magische woord gebruiken (voor gevorderde gebruikers)?',
 230+ 'onlinestatusbar-status-online' => 'Online',
 231+ 'onlinestatusbar-status-busy' => 'Druk',
 232+ 'onlinestatusbar-status-away' => 'Weg',
 233+ 'onlinestatusbar-status-offline' => 'Offline',
 234+ 'onlinestatusbar-status-hidden' => 'Verborgen',
 235+);
 236+
 237+/** Telugu (తెలుగు)
 238+ * @author Veeven
 239+ */
 240+$messages['te'] = array(
 241+ 'onlinestatusbar-used' => 'మీరు ఆన్‌లైనులో ఉన్నట్టు ఇతరులుకు చూపించాలా?',
 242+);
 243+
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBar.i18n.php
___________________________________________________________________
Added: svn:eol-style
1244 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/statusred.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/statusred.png
___________________________________________________________________
Added: svn:mime-type
2245 + image/png
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/statusorange.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/statusorange.png
___________________________________________________________________
Added: svn:mime-type
3246 + image/png
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBar.php
@@ -0,0 +1,104 @@
 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.2',
 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.chick'] = array (
 43+ 'styles' => 'OnlineStatusBarChick.css',
 44+ 'localBasePath' => dirname ( __FILE__ ),
 45+ 'remoteExtPath' => 'OnlineStatusBar',
 46+);
 47+
 48+$wgResourceModules['ext.OnlineStatusBar.monobook'] = array (
 49+ 'styles' => 'OnlineStatusBarMono.css',
 50+ 'localBasePath' => dirname ( __FILE__ ),
 51+ 'remoteExtPath' => 'OnlineStatusBar',
 52+);
 53+
 54+$wgResourceModules['ext.OnlineStatusBar.simple'] = array (
 55+ 'styles' => 'OnlineStatusBarSimple.css',
 56+ 'localBasePath' => dirname ( __FILE__ ),
 57+ 'remoteExtPath' => 'OnlineStatusBar',
 58+);
 59+
 60+$wgResourceModules['ext.OnlineStatusBar.cologne'] = array (
 61+ 'styles' => 'OnlineStatusBarCologne.css',
 62+ 'localBasePath' => dirname ( __FILE__ ),
 63+ 'remoteExtPath' => 'OnlineStatusBar',
 64+);
 65+
 66+$wgResourceModules['ext.OnlineStatusBar.nostalgia'] = array (
 67+ 'styles' => 'OnlineStatusBarNostalgia.css',
 68+ 'localBasePath' => dirname ( __FILE__ ),
 69+ 'remoteExtPath' => 'OnlineStatusBar',
 70+);
 71+
 72+$wgAutoloadClasses['OnlineStatusBar'] = "$dir/OnlineStatusBar.body.php";
 73+$wgAutoloadClasses['OnlineStatusBarHooks'] = "$dir/OnlineStatusBarHooks.php";
 74+
 75+// Configuration
 76+// Those values can be overriden in LocalSettings, do not change it here
 77+$wgOnlineStatusBarIcon = array(
 78+ 'online' => "statusgreen.png",
 79+ 'busy' => "statusorange.png",
 80+ 'away' => "statusorange.png",
 81+ 'hidden' => "statusred.png",
 82+ 'offline' => "statusred.png",
 83+);
 84+
 85+// default for anonymous and uknown users
 86+$wgOnlineStatusBarTrackIpUsers = false;
 87+// default for online
 88+$wgOnlineStatusBarDefaultOnline = "online";
 89+// default for offline
 90+$wgOnlineStatusBarDefaultOffline = "offline";
 91+// if users have this feature enabled by default
 92+$wgOnlineStatusBarDefaultEnabled = false;
 93+// how long to wait until user is considered as offline
 94+$wgOnlineStatusBar_LogoutTime = 3600;
 95+
 96+$wgHooks['LoadExtensionSchemaUpdates'][] = 'OnlineStatusBarHooks::ckSchema';
 97+$wgHooks['UserLogoutComplete'][] = 'OnlineStatusBarHooks::logout';
 98+$wgHooks['ArticleViewHeader'][] = 'OnlineStatusBarHooks::renderBar';
 99+$wgHooks['UserLoginComplete'][] = 'OnlineStatusBarHooks::updateStatus';
 100+$wgHooks['GetPreferences'][] = 'OnlineStatusBarHooks::preferencesHook';
 101+$wgHooks['UserGetDefaultOptions'][] = 'OnlineStatusBarHooks::setDefaultOptions';
 102+$wgHooks['LanguageGetMagic'][] = 'OnlineStatusBarHooks::magicWordVar';
 103+$wgHooks['BeforePageDisplay'][] = 'OnlineStatusBarHooks::stylePage';
 104+$wgHooks['MagicWordwgVariableIDs'][] = 'OnlineStatusBarHooks::magicWordSet';
 105+$wgHooks['ParserGetVariableValueSwitch'][] = 'OnlineStatusBarHooks::parserGetVariable';
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBar.php
___________________________________________________________________
Added: svn:eol-style
1106 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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_2/OnlineStatusBar.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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_2/OnlineStatusBarChick.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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: ;
 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:0px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBarNostalgia.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBarHooks.php
@@ -0,0 +1,186 @@
 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::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+ OnlineStatusBar::purge( $wgUser );
 44+ OnlineStatusBar::updateStatus();
 45+ return true;
 46+ }
 47+
 48+ /**
 49+ * Creates a bar
 50+ * @param $article Article
 51+ * @param $outputDone bool
 52+ * @param $pcache string
 53+ * @return bool
 54+ */
 55+ public static function renderBar( &$article, &$outputDone, &$pcache ) {
 56+ $context = $article->getContext();
 57+
 58+ OnlineStatusBar::updateStatus();
 59+ $result = OnlineStatusBar::getUserInfoFromTitle( $article->getTitle() );
 60+ if ( $result === false && User::isIP ( $article->getTitle()->getBaseText() ) ) {
 61+ $result = OnlineStatusBar::getAnonFromTitle( $article->getTitle() );
 62+ }
 63+
 64+ if ( $result === false ) {
 65+ return true;
 66+ }
 67+
 68+ /** @var $user User */
 69+ list( $status, $user ) = $result;
 70+
 71+ // Don't display status of those who have opted out
 72+ if ( $user->getOption( 'OnlineStatusBar_hide' ) == true ) {
 73+ return true;
 74+ }
 75+
 76+ $modetext = wfMessage( 'onlinestatusbar-status-' . $status )->toString();
 77+ $image = OnlineStatusBar::getImageHtml( $status );
 78+ $text = wfMessage( 'onlinestatusbar-line', $user->getName() )
 79+ ->rawParams( $image )->params( $modetext )->escaped();
 80+ $context->getOutput()->addHtml( OnlineStatusBar::getStatusBarHtml( $text ) );
 81+
 82+ return true;
 83+ }
 84+
 85+ /**
 86+ * Insert user options
 87+ * @param $user User
 88+ * @param $preferences array
 89+ * @return bool
 90+ */
 91+ public static function preferencesHook( User $user, array &$preferences ) {
 92+ global $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarDefaultEnabled, $wgOnlineStatusBarModes;
 93+ $preferences['OnlineStatusBar_active'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-used', 'section' => 'misc/onlinestatus' );
 94+ $preferences['OnlineStatusBar_hide'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-hide', 'section' => 'misc/onlinestatus' );
 95+ $preferences['OnlineStatusBar_autoupdate'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-purge', 'section' => 'misc/onlinestatus' );
 96+ $preferences['OnlineStatusBar_status'] = array( 'type' => 'radio', 'label-message' => 'onlinestatusbar-status', 'section' => 'misc/onlinestatus',
 97+ 'options' => array(
 98+ wfMessage( 'onlinestatusbar-status-online' )->escaped() => 'online',
 99+ wfMessage( 'onlinestatusbar-status-busy' )->escaped() => 'busy',
 100+ wfMessage( 'onlinestatusbar-status-away' )->escaped() => 'away',
 101+ wfMessage( 'onlinestatusbar-status-hidden' )->escaped() => 'hidden'
 102+ ),
 103+ );
 104+ return true;
 105+ }
 106+
 107+ /**
 108+ * @param $defaultOptions array
 109+ * @return bool
 110+ */
 111+ public static function setDefaultOptions( &$defaultOptions ) {
 112+ global $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarDefaultEnabled;
 113+ // set defaults
 114+ $defaultOptions['OnlineStatusBar_autoupdate'] = false;
 115+ $defaultOptions['OnlineStatusBar_status'] = $wgOnlineStatusBarDefaultOnline;
 116+ $defaultOptions['OnlineStatusBar_active'] = $wgOnlineStatusBarDefaultEnabled;
 117+ $defaultOptions['OnlineStatusBar_hide'] = false;
 118+ // quit
 119+ return true;
 120+ }
 121+
 122+ /**
 123+ * @param $magicWords array
 124+ * @param $ln string (language)
 125+ * @return bool
 126+ */
 127+ public static function magicWordVar( array &$magicWords, $ln ) {
 128+ $magicWords['isonline'] = array( 0, 'isonline' );
 129+ return true;
 130+ }
 131+
 132+ /**
 133+ * @param $out OutputPage
 134+ * @param $skin Skin
 135+ * @return bool
 136+ */
 137+ public static function stylePage( &$out, &$skin ) {
 138+ switch ($skin->getSkinName()) {
 139+ case 'monobook':
 140+ case 'vector':
 141+ case 'simple':
 142+ case 'nostalgia':
 143+ case 'chick':
 144+ case 'cologneblue':
 145+ $out->addModules( 'ext.OnlineStatusBar.' . $skin->getSkinName() );
 146+ break;
 147+ default:
 148+ $out->addModules( 'ext.OnlineStatusBar' );
 149+ }
 150+ return true;
 151+ }
 152+
 153+ /**
 154+ * @param $vars array
 155+ * @return bool
 156+ */
 157+ public static function magicWordSet( &$vars ) {
 158+ $vars[] = 'isonline';
 159+ return true;
 160+ }
 161+
 162+ /**
 163+ * @param $parser Parser
 164+ * @param $varCache ??
 165+ * @param $index ??
 166+ * @param $ret string?
 167+ * @return bool
 168+ */
 169+ public static function parserGetVariable( &$parser, &$varCache, &$index, &$ret ) {
 170+ if ( $index != 'isonline' ) {
 171+ return true;
 172+ }
 173+
 174+ $result = OnlineStatusBar::getUserInfoFromTitle( $parser->getTitle() );
 175+ if ( User::isIP( $parser->getTitle()->getBaseText() ) && $result == null ) {
 176+ $result = OnlineStatusBar::getAnonFromTitle( $parser->getTitle() );
 177+ }
 178+
 179+ if ( $result == false ) {
 180+ $ret = "unknown";
 181+ return true;
 182+ }
 183+
 184+ $ret = $result[0];
 185+ return true;
 186+ }
 187+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBarHooks.php
___________________________________________________________________
Added: svn:eol-style
1188 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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_2/OnlineStatusBarVector.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/statusgreen.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/statusgreen.png
___________________________________________________________________
Added: svn:mime-type
227 + image/png
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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_2/OnlineStatusBar.sql
___________________________________________________________________
Added: svn:eol-style
18 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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_2/OnlineStatusBarCologne.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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:-10px;
 25+}
Property changes on: tags/extensions/OnlineStatusBar/REL_1_0_2/OnlineStatusBarMono.css
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: tags/extensions/OnlineStatusBar/REL_1_0_2/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_2/OnlineStatusBarSimple.css
___________________________________________________________________
Added: svn:eol-style
126 + native

Status & tagging log