Index: trunk/phase3/includes/UDP.php |
— | — | @@ -1,37 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -class UDP { |
5 | | - /** |
6 | | - * Send some text to UDP |
7 | | - * @param string $line |
8 | | - * @param string $prefix |
9 | | - * @param string $address |
10 | | - * @return bool success |
11 | | - */ |
12 | | - public static function sendToUDP( $line, $address = '', $prefix = '' ) { |
13 | | - global $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPPort; |
14 | | - # Assume default for standard RC case |
15 | | - $address = $address ? $address : $wgRC2UDPAddress; |
16 | | - $prefix = $prefix ? $prefix : $wgRC2UDPPrefix; |
17 | | - # Notify external application via UDP |
18 | | - if( $address ) { |
19 | | - $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); |
20 | | - if( $conn ) { |
21 | | - $line = $prefix . $line; |
22 | | - socket_sendto( $conn, $line, strlen($line), 0, $address, $wgRC2UDPPort ); |
23 | | - socket_close( $conn ); |
24 | | - return true; |
25 | | - } |
26 | | - } |
27 | | - return false; |
28 | | - } |
29 | | - |
30 | | - /** |
31 | | - * Remove newlines and carriage returns |
32 | | - * @param string $line |
33 | | - * @return string |
34 | | - */ |
35 | | - public static function cleanupForIRC( $text ) { |
36 | | - return str_replace(array("\n", "\r"), array("", ""), $text); |
37 | | - } |
38 | | -} |
\ No newline at end of file |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | |
171 | 171 | # Notify external application via UDP |
172 | 172 | if( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) { |
173 | | - UDP::sendToUDP( $this->getIRCLine() ); |
| 173 | + self::sendToUDP( $this->getIRCLine() ); |
174 | 174 | } |
175 | 175 | |
176 | 176 | # E-mail notifications |
— | — | @@ -199,6 +199,40 @@ |
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
| 203 | + * Send some text to UDP |
| 204 | + * @param string $line |
| 205 | + * @param string $prefix |
| 206 | + * @param string $address |
| 207 | + * @return bool success |
| 208 | + */ |
| 209 | + public static function sendToUDP( $line, $address = '', $prefix = '' ) { |
| 210 | + global $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPPort; |
| 211 | + # Assume default for standard RC case |
| 212 | + $address = $address ? $address : $wgRC2UDPAddress; |
| 213 | + $prefix = $prefix ? $prefix : $wgRC2UDPPrefix; |
| 214 | + # Notify external application via UDP |
| 215 | + if( $address ) { |
| 216 | + $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); |
| 217 | + if( $conn ) { |
| 218 | + $line = $prefix . $line; |
| 219 | + socket_sendto( $conn, $line, strlen($line), 0, $address, $wgRC2UDPPort ); |
| 220 | + socket_close( $conn ); |
| 221 | + return true; |
| 222 | + } |
| 223 | + } |
| 224 | + return false; |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | + * Remove newlines and carriage returns |
| 229 | + * @param string $line |
| 230 | + * @return string |
| 231 | + */ |
| 232 | + public static function cleanupForIRC( $text ) { |
| 233 | + return str_replace(array("\n", "\r"), array("", ""), $text); |
| 234 | + } |
| 235 | + |
| 236 | + /** |
203 | 237 | * Mark a given change as patrolled |
204 | 238 | * |
205 | 239 | * @param mixed $change RecentChange or corresponding rc_id |
— | — | @@ -568,7 +602,7 @@ |
569 | 603 | $titleObj =& $this->getTitle(); |
570 | 604 | } |
571 | 605 | $title = $titleObj->getPrefixedText(); |
572 | | - $title = UDP::cleanupForIRC( $title ); |
| 606 | + $title = self::cleanupForIRC( $title ); |
573 | 607 | |
574 | 608 | // FIXME: *HACK* these should be getFullURL(), hacked for SSL madness --brion 2005-12-26 |
575 | 609 | if( $rc_type == RC_LOG ) { |
— | — | @@ -595,14 +629,14 @@ |
596 | 630 | $szdiff = ''; |
597 | 631 | } |
598 | 632 | |
599 | | - $user = UDP::cleanupForIRC( $rc_user_text ); |
| 633 | + $user = self::cleanupForIRC( $rc_user_text ); |
600 | 634 | |
601 | 635 | if( $rc_type == RC_LOG ) { |
602 | 636 | $targetText = $this->getTitle()->getPrefixedText(); |
603 | | - $comment = UDP::cleanupForIRC( str_replace("[[$targetText]]","[[\00302$targetText\00310]]",$actionComment) ); |
| 637 | + $comment = self::cleanupForIRC( str_replace("[[$targetText]]","[[\00302$targetText\00310]]",$actionComment) ); |
604 | 638 | $flag = $rc_log_action; |
605 | 639 | } else { |
606 | | - $comment = UDP::cleanupForIRC( $rc_comment ); |
| 640 | + $comment = self::cleanupForIRC( $rc_comment ); |
607 | 641 | $flag = ($rc_new ? "N" : "") . ($rc_minor ? "M" : "") . ($rc_bot ? "B" : ""); |
608 | 642 | } |
609 | 643 | # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003, |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -507,9 +507,6 @@ |
508 | 508 | 'WikiRevision' => 'includes/Import.php', |
509 | 509 | 'WithoutInterwikiPage' => 'includes/specials/SpecialWithoutinterwiki.php', |
510 | 510 | |
511 | | - # UDP logging |
512 | | - 'UDP' => 'includes/UDP.php', |
513 | | - |
514 | 511 | # includes/templates |
515 | 512 | 'UsercreateTemplate' => 'includes/templates/Userlogin.php', |
516 | 513 | 'UserloginTemplate' => 'includes/templates/Userlogin.php', |