public function onCheckUserInsertForRecentChange($rc, &$fields)
 {
     $fields['cuc_ip'] = IP::sanitizeIP($this->ip);
     $fields['cuc_ip_hex'] = $this->ip ? IP::toHex($this->ip) : null;
     $fields['cuc_agent'] = $this->ua;
     if (method_exists('CheckUserHooks', 'getClientIPfromXFF')) {
         list($xff_ip, $isSquidOnly) = CheckUserHooks::getClientIPfromXFF($this->xff);
         $fields['cuc_xff'] = !$isSquidOnly ? $this->xff : '';
         $fields['cuc_xff_hex'] = $xff_ip && !$isSquidOnly ? IP::toHex($xff_ip) : null;
     } else {
         $fields['cuc_xff'] = '';
         $fields['cuc_xff_hex'] = null;
     }
 }
 /**
  * @param Row $row
  * @param string $reason
  * @return a streamlined recent changes line with IP data
  */
 protected function CUChangesLine($row, $reason)
 {
     global $wgLang;
     static $cuTitle, $flagCache;
     $cuTitle = SpecialPage::getTitleFor('CheckUser');
     # Add date headers as needed
     $date = $wgLang->date(wfTimestamp(TS_MW, $row->cuc_timestamp), true, true);
     if (!isset($this->lastdate)) {
         $this->lastdate = $date;
         $line = "\n<h4>{$date}</h4>\n<ul class=\"special\">";
     } elseif ($date != $this->lastdate) {
         $line = "</ul>\n<h4>{$date}</h4>\n<ul class=\"special\">";
         $this->lastdate = $date;
     } else {
         $line = '';
     }
     $line .= '<li>';
     # Create diff/hist/page links
     $line .= $this->getLinksFromRow($row);
     # Show date
     $line .= ' . . ' . $wgLang->time(wfTimestamp(TS_MW, $row->cuc_timestamp), true, true) . ' . . ';
     # Userlinks
     $line .= $this->sk->userLink($row->cuc_user, $row->cuc_user_text);
     $line .= $this->sk->userToolLinks($row->cuc_user, $row->cuc_user_text);
     # Get block info
     if (isset($flagCache[$row->cuc_user_text])) {
         $flags = $flagCache[$row->cuc_user_text];
     } else {
         $user = User::newFromName($row->cuc_user_text, false);
         $ip = IP::isIPAddress($row->cuc_user_text) ? $row->cuc_user_text : '';
         $flags = $this->userBlockFlags($ip, $row->cuc_user, $user);
         $flagCache[$row->cuc_user_text] = $flags;
     }
     # Add any block information
     if (count($flags)) {
         $line .= ' ' . implode(' ', $flags);
     }
     # Action text, hackish ...
     if ($row->cuc_actiontext) {
         $line .= ' ' . $this->sk->formatComment($row->cuc_actiontext) . ' ';
     }
     # Comment
     $line .= $this->sk->commentBlock($row->cuc_comment);
     $line .= '<br />&#160; &#160; &#160; &#160; <small>';
     # IP
     $line .= ' <strong>IP</strong>: ' . $this->sk->makeKnownLinkObj($cuTitle, htmlspecialchars($row->cuc_ip), 'user='******'&reason=' . urlencode($reason));
     # XFF
     if ($row->cuc_xff != null) {
         # Flag our trusted proxies
         list($client, $trusted) = CheckUserHooks::getClientIPfromXFF($row->cuc_xff, $row->cuc_ip);
         $c = $trusted ? '#F0FFF0' : '#FFFFCC';
         $line .= '&#160;&#160;&#160;<span class="mw-checkuser-xff" style="background-color: ' . $c . '">' . '<strong>XFF</strong>: ';
         $line .= $this->sk->makeKnownLinkObj($cuTitle, htmlspecialchars($row->cuc_xff), 'user='******'/xff&reason=' . urlencode($reason)) . '</span>';
     }
     # User agent
     $line .= '&#160;&#160;&#160;<span class="mw-checkuser-agent" style="color:#888;">' . htmlspecialchars($row->cuc_agent) . '</span>';
     $line .= "</small></li>\n";
     return $line;
 }