r100540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100539‎ | r100540 | r100541 >
Date:13:49, 23 October 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Indendation fixes, use $wgExtensionAssetsPath
Modified paths:
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php (modified) (history)
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.i18n.php (modified) (history)
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php
@@ -1,7 +1,7 @@
22 <?
33 if ( !defined( 'MEDIAWIKI' ) ) {
44 echo "This is a part of mediawiki and can't be started separately";
5 - die();
 5+ die();
66 }
77
88 /**
@@ -23,24 +23,25 @@
2424 public static function Get_Html( $text, $mode)
2525 {
2626 global $wgOnlineStatusBarModes, $wgOnlineStatusBarIcon, $wgOnlineStatusBarColor, $wgOnlineStatusBarY;
27 - $color= $wgOnlineStatusBarColor[$mode];
28 - return '<div style="right:0px; margin-top:-10px;" class="metadata topicon" id="status-top"><div style="border: 0px solid black; background: transparent; float: right; position: relative; top:' . $wgOnlineStatusBarY . 'px; padding: 5px"><p><b>' . $text . ': <span style="color: ' . $color . '; font:bold;"><img alt=' . $text . " - " . $mode .' src="' . $wgOnlineStatusBarIcon[$mode] . '" width="20" height="20" />' . $wgOnlineStatusBarModes[$mode] . '</span></b></p></div></div>';
 27+ $icon = "$wgExtensionAssetsPath/OnlineStatusBar/{$wgOnlineStatusBarModes[$mode]}";
 28+ $color = $wgOnlineStatusBarColor[$mode];
 29+ return '<div style="right:0px; margin-top:-10px;" class="metadata topicon" id="status-top"><div style="border: 0px solid black; background: transparent; float: right; position: relative; top:' . $wgOnlineStatusBarY . 'px; padding: 5px"><p><b>' . $text . ': <span style="color: ' . $color . '; font:bold;"><img alt=' . $text . " - " . $mode .' src="' . $wgOnlineStatusBarIcon[$mode] . '" width="20" height="20" />' . $icon . '</span></b></p></div></div>';
2930 }
3031
3132 static function UpdateDb()
3233 {
33 - global $wgUser, $wgDBname, $wgOnlineStatusBarTable;
34 - if ( OnlineStatusBar::GetStatus($wgUser->getID()) != $OnlineStatusBar->DefaultOnline )
35 - {
36 - $dbw = wfGetDB( DB_MASTER );
37 - $now = OnlineStatusBar::GetNow();
38 - $row = array(
39 - 'userid' => $wgUser->getID(),
40 - 'username' => $wgUser->getName(),
41 - 'timestamp' => $now,
42 - );
43 - $dbw->insert( $wgOnlineStatusBarTable, $row, __METHOD__, 'DELAYED' );
44 - }
 34+ global $wgUser, $wgDBname, $wgOnlineStatusBarTable;
 35+ if ( OnlineStatusBar::GetStatus($wgUser->getID()) != $OnlineStatusBar->DefaultOnline )
 36+ {
 37+ $dbw = wfGetDB( DB_MASTER );
 38+ $now = OnlineStatusBar::GetNow();
 39+ $row = array(
 40+ 'userid' => $wgUser->getID(),
 41+ 'username' => $wgUser->getName(),
 42+ 'timestamp' => $now,
 43+ );
 44+ $dbw->insert( $wgOnlineStatusBarTable, $row, __METHOD__, 'DELAYED' );
 45+ }
4546
4647 return false;
4748 }
@@ -55,29 +56,21 @@
5657 return true;
5758 }
5859 $dbw = wfGetDB ( DB_MASTER );
59 - $dbw->update($wgOnlineStatusBarTable, array ('timestamp' => $now), array ('username' => $wgUser->getName()), __METHOD__ );
 60+ $dbw->update($wgOnlineStatusBarTable, array ('timestamp' => $now), array ('username' => $wgUser->getName()), __METHOD__ );
6061
61 - return false;
 62+ return false;
6263
6364 }
6465
6566 public static function DeleteOld()
6667 {
6768 global $wgOnlineStatusBarTable, $wgOnlineStatusBar_LogoutTime, $wgDBname;
68 - $dbw= wfGetDB ( DB_MASTER );
69 - $time = OnlineStatusBar::GetNow() - $wgOnlineStatusBar_LogoutTime;
70 - $dbw->delete( $wgOnlineStatusBarTable, array( 'timestamp < "' . $time . '"' ) ,__METHOD__ );
 69+ $dbw= wfGetDB ( DB_MASTER );
 70+ $time = OnlineStatusBar::GetNow() - $wgOnlineStatusBar_LogoutTime;
 71+ $dbw->delete( $wgOnlineStatusBarTable, array( 'timestamp < "' . $time . '"' ) ,__METHOD__ );
7172 return 0;
7273 }
7374
74 - static function GetFileUrl($name)
75 - {
76 - // fix me
77 - global $wgScriptPath;
78 - $url = $wgScriptPath . "/extensions/OnlineStatusBar" . "$name";
79 - return $url;
80 - }
81 -
8275 static function GetStatus( $userID ) {
8376 global $wgOnlineStatusBarTable, $wgOnlineStatusBarModes, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline, $wgDBname;
8477 $dbw= wfGetDB ( DB_MASTER );
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.i18n.php
@@ -8,11 +8,11 @@
99
1010 $messages = array();
1111
12 -/** English
 12+/**
 13+ * English
1314 * @author Petr Bena
1415 */
1516 $messages['en'] = array(
16 -'onlinestatusbar-desc' => "Status bar which shows whether a user is online, based on preferences, on their user page",
17 -'onlinestatusbar-line' => " is now",
 17+ 'onlinestatusbar-desc' => "Status bar which shows whether a user is online, based on preferences, on their user page",
 18+ 'onlinestatusbar-line' => " is now",
1819 );
19 -?>
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php
@@ -31,18 +31,18 @@
3232 // Configuration
3333 // Those values can be overriden in LocalSettings, do not change it here
3434 $wgOnlineStatusBarModes = array (
35 - 'online' => "On-line",
36 - 'busy' => "Busy",
37 - 'away' => "Away",
38 - 'hidden' => "Offline",
39 - 'offline' => "Offline",
 35+ 'online' => "On-line",
 36+ 'busy' => "Busy",
 37+ 'away' => "Away",
 38+ 'hidden' => "Offline",
 39+ 'offline' => "Offline",
4040 );
4141 $wgOnlineStatusBarIcon = array (
42 - 'online' => OnlineStatusBar::GetFileUrl( "/20px-Ledgreen.svg.png" ),
43 - 'busy' => OnlineStatusBar::GetFileUrl( "/20px-Ledorange.svg.png" ),
44 - 'away' => OnlineStatusBar::GetFileUrl( "/20px-Ledorange.svg.png" ),
45 - 'hidden' => OnlineStatusBar::GetFileUrl( "/20px-Nuvola_apps_krec.svg.png"),
46 - 'offline' => OnlineStatusBar::GetFileUrl( "/20px-Nuvola_apps_krec.svg.png"),
 42+ 'online' => "20px-Ledgreen.svg.png",
 43+ 'busy' => "20px-Ledorange.svg.png",
 44+ 'away' => "20px-Ledorange.svg.png",
 45+ 'hidden' => "20px-Nuvola_apps_krec.svg.png",
 46+ 'offline' => "20px-Nuvola_apps_krec.svg.png",
4747 );
4848 $wgOnlineStatusBarColor = array (
4949 'online' => "green",

Status & tagging log