Index: trunk/phase3/includes/User.php |
— | — | @@ -814,8 +814,14 @@ |
815 | 815 | $this->loadDefaults(); |
816 | 816 | return false; |
817 | 817 | } |
818 | | - if ( isset( $_SESSION['wsUserName'] ) ) { |
819 | | - $sName = $_SESSION['wsUserName']; |
| 818 | + if ( isset( $_SESSION['wsUserName'] ) && isset( $_COOKIE["{$wgCookiePrefix}UserName"] ) ) { |
| 819 | + // Cookie and session username should match |
| 820 | + if( $_SESSION['wsUserName'] == $_COOKIE["{$wgCookiePrefix}UserName"] ) { |
| 821 | + $sName = $_SESSION['wsUserName']; |
| 822 | + } else { |
| 823 | + $this->loadDefaults(); |
| 824 | + return false; |
| 825 | + } |
820 | 826 | } else if ( isset( $_COOKIE["{$wgCookiePrefix}UserName"] ) ) { |
821 | 827 | $sName = $_COOKIE["{$wgCookiePrefix}UserName"]; |
822 | 828 | $_SESSION['wsUserName'] = $sName; |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | # Writes the data in this object to the database |
142 | 142 | function save() |
143 | 143 | { |
144 | | - global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPOmitBots; |
| 144 | + global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPOmitBots; |
145 | 145 | $fname = 'RecentChange::save'; |
146 | 146 | |
147 | 147 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | |
178 | 178 | # Notify external application via UDP |
179 | 179 | if ( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) { |
180 | | - self::sendToUDP( $wgRC2UDPPrefix, $this->getIRCLine() ); |
| 180 | + self::sendToUDP( $this->getIRCLine() ); |
181 | 181 | } |
182 | 182 | |
183 | 183 | # E-mail notifications |
— | — | @@ -208,16 +208,21 @@ |
209 | 209 | /** |
210 | 210 | * Send some text to UDP |
211 | 211 | * @param string $line |
| 212 | + * @param string $prefix |
| 213 | + * @param string $address |
212 | 214 | * @return bool success |
213 | 215 | */ |
214 | | - public static function sendToUDP( $prefix, $line ) { |
215 | | - global $wgRC2UDPAddress, $wgRC2UDPPort; |
| 216 | + public static function sendToUDP( $line, $address = '', $prefix = '' ) { |
| 217 | + global $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPPort; |
| 218 | + # Assume default for standard RC case |
| 219 | + $address = $address ? $address : $wgRC2UDPAddress; |
| 220 | + $prefix = $prefix ? $prefix : $wgRC2UDPPrefix; |
216 | 221 | # Notify external application via UDP |
217 | | - if( $wgRC2UDPAddress ) { |
| 222 | + if( $address && $prefix ) { |
218 | 223 | $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); |
219 | 224 | if( $conn ) { |
220 | 225 | $line = $prefix . $line; |
221 | | - socket_sendto( $conn, $line, strlen($line), 0, $wgRC2UDPAddress, $wgRC2UDPPort ); |
| 226 | + socket_sendto( $conn, $line, strlen($line), 0, $address, $wgRC2UDPPort ); |
222 | 227 | socket_close( $conn ); |
223 | 228 | return true; |
224 | 229 | } |
Index: trunk/extensions/CentralAuth/CentralAuthUser.php |
— | — | @@ -1015,10 +1015,11 @@ |
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | $this->invalidateCache(); |
1019 | | - global $wgCentralAuthNew2UDPPrefix; |
1020 | | - if( $wgCentralAuthNew2UDPPrefix ) { |
| 1019 | + global $wgCentralAuthUDPAddress, $wgCentralAuthNew2UDPPrefix; |
| 1020 | + if( $wgCentralAuthUDPAddress ) { |
1021 | 1021 | $userpage = Title::makeTitleSafe( NS_USER, $this->mName ); |
1022 | | - RecentChange::sendToUDP( $wgCentralAuthNew2UDPPrefix, self::getIRCLine( $userpage, $wikiID ) ); |
| 1022 | + RecentChange::sendToUDP( self::getIRCLine( $userpage, $wikiID ), |
| 1023 | + $wgCentralAuthUDPAddress, $wgCentralAuthNew2UDPPrefix ); |
1023 | 1024 | } |
1024 | 1025 | } |
1025 | 1026 | |
Index: trunk/extensions/CentralAuth/CentralAuth.php |
— | — | @@ -124,6 +124,8 @@ |
125 | 125 | */ |
126 | 126 | $wgCentralAuthCreateOnView = false; |
127 | 127 | |
| 128 | +// UDP logging stuff |
| 129 | +$wgCentralAuthUDPAddress = false; |
128 | 130 | $wgCentralAuthNew2UDPPrefix = ''; |
129 | 131 | |
130 | 132 | /** |