Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | // cache it |
92 | 92 | self::setCache( $user->getName(), $result, ONLINESTATUSBAR_DELAYED_CACHE ); |
93 | 93 | } |
94 | | - $w_time = OnlineStatusBar::getTimeoutDate( true ); |
| 94 | + $w_time = OnlineStatusBar::getTimeoutDate( ONLINESTATUSBAR_CK_DELAYED ); |
95 | 95 | } |
96 | 96 | |
97 | 97 | if ( $result === false ) { |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | $status = 'write'; |
107 | 107 | } |
108 | 108 | } else if ( $user->getOption( 'OnlineStatusBar_away', true ) == true ) { |
109 | | - if ( $result < wfTimestamp( TS_MW, OnlineStatusBar::getTimeoutDate( false, true, $user ) ) ) { |
| 109 | + if ( $result < wfTimestamp( TS_MW, OnlineStatusBar::getTimeoutDate( ONLINESTATUSBAR_CK_AWAY, $user ) ) ) { |
110 | 110 | $status = 'away'; |
111 | 111 | } |
112 | 112 | } |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php |
— | — | @@ -133,22 +133,22 @@ |
134 | 134 | * @param $user |
135 | 135 | * @return timestamp |
136 | 136 | */ |
137 | | - public static function getTimeoutDate( $delayed = false, $away = false, $user = false ) { |
| 137 | + public static function getTimeoutDate( $checkType = false, $user = false ) { |
138 | 138 | global $wgOnlineStatusBar_AwayTime, $wgOnlineStatusBar_WriteTime, $wgOnlineStatusBar_LogoutTime; |
139 | 139 | |
140 | | - if ($away) { |
141 | | - if ( $user === false ) { |
142 | | - $time = $wgOnlineStatusBar_AwayTime; |
143 | | - }else{ |
144 | | - $time = $user->getOption( 'OnlineStatusBar_awaytime', $wgOnlineStatusBar_AwayTime ); |
145 | | - } |
146 | | - return wfTimestamp( TS_UNIX ) - ( $time * 60 ); |
| 140 | + if ($checkType != false) { |
| 141 | + switch($checkType) { |
| 142 | + case ONLINESTATUSBAR_CK_DELAYED: |
| 143 | + return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_WriteTime; |
| 144 | + case ONLINESTATUSBAR_CK_AWAY: |
| 145 | + if ( $user === false ) { |
| 146 | + $time = $wgOnlineStatusBar_AwayTime; |
| 147 | + } else { |
| 148 | + $time = $user->getOption( 'OnlineStatusBar_awaytime', $wgOnlineStatusBar_AwayTime ); |
| 149 | + } |
| 150 | + return wfTimestamp( TS_UNIX ) - ( $time * 60 ); |
| 151 | + } |
147 | 152 | } |
148 | | - |
149 | | - if ($delayed) { |
150 | | - return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_WriteTime; |
151 | | - } |
152 | | - |
153 | 153 | return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_LogoutTime; |
154 | 154 | } |
155 | 155 | |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php |
— | — | @@ -98,6 +98,9 @@ |
99 | 99 | // For memcached |
100 | 100 | define( 'ONLINESTATUSBAR_DELAYED_CACHE', 'd' ); |
101 | 101 | define( 'ONLINESTATUSBAR_NORMAL_CACHE', 'n' ); |
| 102 | +// Timeout |
| 103 | +define( 'ONLINESTATUSBAR_CK_DELAYED', 1 ); |
| 104 | +define( 'ONLINESTATUSBAR_CK_AWAY', 2 ); |
102 | 105 | |
103 | 106 | // default for anonymous and uknown users |
104 | 107 | $wgOnlineStatusBarTrackIpUsers = false; |