Use link() instead of make*Link*()
[lhc/web/wiklou.git] / includes / RecentChange.php
index 17f06cc..8e3f110 100644 (file)
@@ -197,6 +197,14 @@ class RecentChange
                                $this->mAttribs['rc_last_oldid'] );
                }
        }
+       
+       public function notifyRC2UDP() {
+               global $wgRC2UDPAddress, $wgRC2UDPOmitBots;
+               # Notify external application via UDP
+               if( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) {
+                       self::sendToUDP( $this->getIRCLine() );
+               }
+       }
 
        /**
         * Send some text to UDP
@@ -227,12 +235,12 @@ class RecentChange
        }
        
        /**
-        * Remove newlines and carriage returns
+        * Remove newlines, carriage returns and decode html entites
         * @param string $line
         * @return string
         */
        public static function cleanupForIRC( $text ) {
-               return str_replace(array("\n", "\r"), array("", ""), $text);
+               return Sanitizer::decodeCharReferences( str_replace( array( "\n", "\r" ), array( "", "" ), $text ) );
        }
 
        /**
@@ -318,9 +326,7 @@ class RecentChange
        {
                if( !$ip ) {
                        $ip = wfGetIP();
-                       if( !$ip ) {
-                               $ip = '';
-                       }
+                       if( !$ip ) $ip = '';
                }
 
                $rc = new RecentChange;
@@ -372,9 +378,7 @@ class RecentChange
        {
                if( !$ip ) {
                        $ip = wfGetIP();
-                       if( !$ip ) {
-                               $ip = '';
-                       }
+                       if( !$ip ) $ip = '';
                }
 
                $rc = new RecentChange;
@@ -420,12 +424,9 @@ class RecentChange
        public static function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
        {
                global $wgRequest;
-
                if( !$ip ) {
                        $ip = wfGetIP();
-                       if( !$ip ) {
-                               $ip = '';
-                       }
+                       if( !$ip ) $ip = '';
                }
 
                $rc = new RecentChange;
@@ -478,7 +479,7 @@ class RecentChange
        {
                global $wgLogRestrictions;
                # Don't add private logs to RC!
-               if( isset($wgLogRestrictions[$type]) && !$wgLogRestrictions[$type] == '*' ) {
+               if( isset($wgLogRestrictions[$type]) && $wgLogRestrictions[$type] != '*' ) {
                        return false;
                }
                $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action,
@@ -491,12 +492,9 @@ class RecentChange
                $type, $action, $target, $logComment, $params, $newId=0 )
        {
                global $wgRequest;
-
                if( !$ip ) {
                        $ip = wfGetIP();
-                       if( !$ip ) {
-                               $ip = '';
-                       }
+                       if( !$ip ) $ip = '';
                }
 
                $rc = new RecentChange;
@@ -603,7 +601,7 @@ class RecentChange
                return $trail;
        }
 
-       protected function getIRCLine() {
+       public function getIRCLine() {
                global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki;
 
                // FIXME: Would be good to replace these 2 extract() calls with something more explicit