Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php |
— | — | @@ -66,59 +66,56 @@ |
67 | 67 | $wgOnlineStatusBarY = "-35"; |
68 | 68 | |
69 | 69 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'wfOnlineStatusBar_CkSchema'; |
70 | | - |
71 | | - function wfOnlineStatusBar_CkSchema($updater = null) |
72 | | - { |
| 70 | +function wfOnlineStatusBar_CkSchema($updater = null) |
| 71 | +{ |
73 | 72 | global $wgOnlineStatusBarTable; |
74 | | - if ($updater != null) |
75 | | - { |
76 | | - $updater->addExtensionUpdate( array ( 'addtable', $wgOnlineStatusBarTable, dirname( __FILE__) . '/OnlineStatusBar.sql', true)); |
77 | | - } |
78 | | - else |
79 | | - { |
80 | | - global $wgExtNewTables; |
81 | | - $wgExtNewTables[] = array( |
82 | | - $wgOnlineStatusBarTable, dirname( __FILE__ ) . '/OnlineStatusBar.sql' ); |
83 | | - } |
84 | | - return true; |
85 | | - } |
86 | | - |
87 | | -$wgHooks['UserLogoutComplete'][] = 'wfOnlineStatusBar_Logout'; |
88 | | - |
89 | | - function wfOnlineStatusBar_Logout(&$user, &$inject_html, $old_name) |
| 73 | + if ($updater != null) |
90 | 74 | { |
91 | | - global $wgUser; |
92 | | - OnlineStatusBar::DeleteStatus($old_name); |
93 | | - return true; |
| 75 | + $updater->addExtensionUpdate( array ( 'addtable', $wgOnlineStatusBarTable, dirname( __FILE__) . '/OnlineStatusBar.sql', true)); |
94 | 76 | } |
| 77 | + else |
| 78 | + { |
| 79 | + global $wgExtNewTables; |
| 80 | + $wgExtNewTables[] = array( |
| 81 | + $wgOnlineStatusBarTable, dirname( __FILE__ ) . '/OnlineStatusBar.sql' ); |
| 82 | + } |
| 83 | + return true; |
| 84 | +} |
95 | 85 | |
| 86 | +$wgHooks['UserLogoutComplete'][] = 'wfOnlineStatusBar_Logout'; |
| 87 | +function wfOnlineStatusBar_Logout(&$user, &$inject_html, $old_name) |
| 88 | +{ |
| 89 | + global $wgUser; |
| 90 | + OnlineStatusBar::DeleteStatus($old_name); |
| 91 | + return true; |
| 92 | +} |
| 93 | + |
96 | 94 | $wgHooks['ArticleViewHeader'][] = 'wfOnlineStatusBar_RenderBar'; |
97 | | - function wfOnlineStatusBar_RenderBar(&$article, &$outputDone, &$pcache) |
| 95 | +function wfOnlineStatusBar_RenderBar(&$article, &$outputDone, &$pcache) |
| 96 | +{ |
| 97 | + global $wgOnlineStatusBar_Template, $messages, $wgOnlineStatusBarModes, $wgOut; |
| 98 | + OnlineStatusBar::UpdateStatus(); |
| 99 | + $ns=$article->getTitle()->getNamespace(); |
| 100 | + if(($ns == NS_USER_TALK) || ($ns == NS_USER)) |
98 | 101 | { |
99 | | - global $wgOnlineStatusBar_Template, $messages, $wgOnlineStatusBarModes, $wgOut; |
100 | | - OnlineStatusBar::UpdateStatus(); |
101 | | - $ns=$article->getTitle()->getNamespace(); |
102 | | - if(($ns == NS_USER_TALK) || ($ns == NS_USER)) |
103 | | - { |
104 | | - // better way to get a username would be great :) |
105 | | - $user = preg_replace('/\/.*/', '', preg_replace('/^.*\:/', "", $article->getTitle())); |
106 | | - $OnlineStatus_Text = $user . language::getMessageFromDB("onlinestatusbar-line"); |
107 | | - $OnlineStatus_Mode = OnlineStatusBar::GetStatus($user); |
108 | | - $wgOut->addHtml(OnlineStatusBar::Get_Html($OnlineStatus_Text, $OnlineStatus_Mode)); |
109 | | - } |
110 | | - return true; |
| 102 | + // better way to get a username would be great :) |
| 103 | + $user = preg_replace('/\/.*/', '', preg_replace('/^.*\:/', "", $article->getTitle())); |
| 104 | + $OnlineStatus_Text = $user . language::getMessageFromDB("onlinestatusbar-line"); |
| 105 | + $OnlineStatus_Mode = OnlineStatusBar::GetStatus($user); |
| 106 | + $wgOut->addHtml(OnlineStatusBar::Get_Html($OnlineStatus_Text, $OnlineStatus_Mode)); |
111 | 107 | } |
| 108 | + return true; |
| 109 | +} |
112 | 110 | |
113 | 111 | $wgHooks['UserLoginComplete'][] = 'wfOnlineStatusBar_UpdateStatus'; |
| 112 | +function wfOnlineStatusBar_UpdateStatus() |
| 113 | +{ |
| 114 | + OnlineStatusBar::UpdateDb(); |
| 115 | + return true; |
| 116 | +} |
114 | 117 | |
115 | | - function wfOnlineStatusBar_UpdateStatus() |
116 | | - { |
117 | | - OnlineStatusBar::UpdateDb(); |
118 | | - return true; |
119 | | - } |
120 | | - |
121 | | - |
| 118 | +// Unused? |
122 | 119 | $commonModuleInfo = array( |
123 | 120 | 'localBasePath' => dirname( __FILE__ ) . '/modules', |
124 | 121 | 'remoteExtPath' => 'OnlineStatusBar/modules', |
125 | | - ); |
| 122 | +); |