/**
  * Special page "deleted user contributions".
  * Shows a list of the deleted contributions of a user.
  *
  * @param string $par (optional) user name of the user for which to show the contributions
  */
 function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $user = $this->getUser();
     if (!$this->userCanExecute($user)) {
         $this->displayRestrictionError();
         return;
     }
     $request = $this->getRequest();
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('deletedcontributions-title'));
     $options = [];
     if ($par !== null) {
         $target = $par;
     } else {
         $target = $request->getVal('target');
     }
     if (!strlen($target)) {
         $out->addHTML($this->getForm(''));
         return;
     }
     $options['limit'] = $request->getInt('limit', $this->getConfig()->get('QueryPageDefaultLimit'));
     $options['target'] = $target;
     $userObj = User::newFromName($target, false);
     if (!$userObj) {
         $out->addHTML($this->getForm(''));
         return;
     }
     $this->getSkin()->setRelevantUser($userObj);
     $target = $userObj->getName();
     $out->addSubtitle($this->getSubTitle($userObj));
     $ns = $request->getVal('namespace', null);
     if ($ns !== null && $ns !== '') {
         $options['namespace'] = intval($ns);
     } else {
         $options['namespace'] = '';
     }
     $out->addHTML($this->getForm($options));
     $pager = new DeletedContribsPager($this->getContext(), $target, $options['namespace']);
     if (!$pager->getNumRows()) {
         $out->addWikiMsg('nocontribs');
         return;
     }
     # Show a message about replica DB lag, if applicable
     $lag = wfGetLB()->safeGetLag($pager->getDatabase());
     if ($lag > 0) {
         $out->showLagWarning($lag);
     }
     $out->addHTML('<p>' . $pager->getNavigationBar() . '</p>' . $pager->getBody() . '<p>' . $pager->getNavigationBar() . '</p>');
     # If there were contributions, and it was a valid user or IP, show
     # the appropriate "footer" message - WHOIS tools, etc.
     if ($target != 'newbies') {
         $message = IP::isIPAddress($target) ? 'sp-contributions-footer-anon' : 'sp-contributions-footer';
         if (!$this->msg($message)->isDisabled()) {
             $out->wrapWikiMsg("<div class='mw-contributions-footer'>\n\$1\n</div>", [$message, $target]);
         }
     }
 }
 /**
  * Special page "deleted user contributions".
  * Shows a list of the deleted contributions of a user.
  *
  * @return	none
  * @param	$par	String: (optional) user name of the user for which to show the contributions
  */
 function execute($par)
 {
     global $wgUser;
     $this->setHeaders();
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     global $wgOut, $wgRequest;
     $wgOut->setPageTitle(wfMsgExt('deletedcontributions-title', array('parsemag')));
     $options = array();
     if (isset($par)) {
         $target = $par;
     } else {
         $target = $wgRequest->getVal('target');
     }
     if (!strlen($target)) {
         $wgOut->addHTML($this->getForm(''));
         return;
     }
     $options['limit'] = $wgRequest->getInt('limit', 50);
     $options['target'] = $target;
     $nt = Title::makeTitleSafe(NS_USER, $target);
     if (!$nt) {
         $wgOut->addHTML($this->getForm(''));
         return;
     }
     $id = User::idFromName($nt->getText());
     $target = $nt->getText();
     $wgOut->setSubtitle($this->getSubTitle($nt, $id));
     if (($ns = $wgRequest->getVal('namespace', null)) !== null && $ns !== '') {
         $options['namespace'] = intval($ns);
     } else {
         $options['namespace'] = '';
     }
     $wgOut->addHTML($this->getForm($options));
     $pager = new DeletedContribsPager($target, $options['namespace']);
     if (!$pager->getNumRows()) {
         $wgOut->addWikiMsg('nocontribs');
         return;
     }
     # Show a message about slave lag, if applicable
     $lag = wfGetLB()->safeGetLag($pager->getDatabase());
     if ($lag > 0) {
         $wgOut->showLagWarning($lag);
     }
     $wgOut->addHTML('<p>' . $pager->getNavigationBar() . '</p>' . $pager->getBody() . '<p>' . $pager->getNavigationBar() . '</p>');
     # If there were contributions, and it was a valid user or IP, show
     # the appropriate "footer" message - WHOIS tools, etc.
     if ($target != 'newbies') {
         $message = IP::isIPAddress($target) ? 'sp-contributions-footer-anon' : 'sp-contributions-footer';
         if (!wfMessage($message)->isDisabled()) {
             $wgOut->wrapWikiMsg("<div class='mw-contributions-footer'>\n\$1\n</div>", array($message, $target));
         }
     }
 }
/**
 * Special page "deleted user contributions".
 * Shows a list of the deleted contributions of a user.
 *
 * @return	none
 * @param	$par	String: (optional) user name of the user for which to show the contributions
 */
function wfSpecialDeletedContributions($par = null)
{
    global $wgUser, $wgOut, $wgLang, $wgRequest;
    $options = array();
    if (isset($par)) {
        $target = $par;
    } else {
        $target = $wgRequest->getVal('target');
    }
    if (!strlen($target)) {
        $wgOut->addHTML(deletedContributionsForm(''));
        return;
    }
    $options['limit'] = $wgRequest->getInt('limit', 50);
    $options['target'] = $target;
    $nt = Title::makeTitleSafe(NS_USER, $target);
    if (!$nt) {
        $wgOut->addHTML(deletedContributionsForm(''));
        return;
    }
    $id = User::idFromName($nt->getText());
    $target = $nt->getText();
    $wgOut->setSubtitle(deletedContributionsSub($nt, $id));
    if (($ns = $wgRequest->getVal('namespace', null)) !== null && $ns !== '') {
        $options['namespace'] = intval($ns);
    } else {
        $options['namespace'] = '';
    }
    $wgOut->addHTML(deletedContributionsForm($options));
    $pager = new DeletedContribsPager($target, $options['namespace']);
    if (!$pager->getNumRows()) {
        $wgOut->addWikiText(wfMsg('nocontribs'));
        return;
    }
    # Show a message about slave lag, if applicable
    if (($lag = $pager->getDatabase()->getLag()) > 0) {
        $wgOut->showLagWarning($lag);
    }
    $wgOut->addHTML('<p>' . $pager->getNavigationBar() . '</p>' . $pager->getBody() . '<p>' . $pager->getNavigationBar() . '</p>');
    # If there were contributions, and it was a valid user or IP, show
    # the appropriate "footer" message - WHOIS tools, etc.
    if ($target != 'newbies') {
        $message = IP::isIPAddress($target) ? 'sp-contributions-footer-anon' : 'sp-contributions-footer';
        $text = wfMsg($message, $target);
        if (!wfEmptyMsg($message, $text) && $text != '-') {
            $wgOut->addHtml('<div class="mw-contributions-footer">');
            $wgOut->addWikiText($text);
            $wgOut->addHtml('</div>');
        }
    }
}