New hook getOtherBlockLogLink, called in Special:IPBlockList to show links to block...
[lhc/web/wiklou.git] / includes / RecentChange.php
index 885ff45..386ae72 100644 (file)
@@ -119,6 +119,8 @@ class RecentChange
        public function &getTitle() {
                if( $this->mTitle === false ) {
                        $this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
+                       # Make sure the correct page ID is process cached
+                       $this->mTitle->resetArticleID( $this->mAttribs['rc_cur_id'] );
                }
                return $this->mTitle;
        }
@@ -158,7 +160,7 @@ class RecentChange
 
                ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
                if( $dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id']==0 ) {
-                       unset ( $this->mAttribs['rc_cur_id'] );
+                       unset( $this->mAttribs['rc_cur_id'] );
                }
 
                # Insert new row
@@ -197,6 +199,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 +237,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 ) );
        }
 
        /**
@@ -471,7 +481,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,
@@ -574,6 +584,10 @@ class RecentChange
                return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL;
        }
 
+       public function getAttributes() {
+               return $this->mAttribs;
+       }
+
        /**
         * Gets the end part of the diff URL associated with this object
         * Blank if no diff link should be displayed
@@ -593,7 +607,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