Example #1
0
 /**
  * @param string $msg
  */
 function buildMainView($msg = '')
 {
     $msgPostfix = $this->mCanEdit ? 'rw' : 'ro';
     $legend = wfMsg("centralauth-editset-legend-{$msgPostfix}");
     $this->getOutput()->addHTML("<fieldset><legend>{$legend}</legend>");
     if ($msg) {
         $this->getOutput()->addHTML($msg);
     }
     $this->getOutput()->addWikiMsg("centralauth-editset-intro-{$msgPostfix}");
     $this->getOutput()->addHTML('<ul>');
     $sets = WikiSet::getAllWikiSets();
     foreach ($sets as $set) {
         $text = wfMsgExt("centralauth-editset-item-{$msgPostfix}", array('parseinline'), $set->getName(), $set->getID());
         $this->getOutput()->addHTML("<li>{$text}</li>");
     }
     if ($this->mCanEdit) {
         $target = SpecialPage::getTitleFor('WikiSets', '0');
         $newlink = Linker::makeLinkObj($target, wfMsgHtml('centralauth-editset-new'));
         $this->getOutput()->addHTML("<li>{$newlink}</li>");
     }
     $this->getOutput()->addHTML('</ul></fieldset>');
 }
 function makeLinkObj($nt, $text = '', $query = '', $trail = '', $prefix = '')
 {
     wfProfileIn(__METHOD__);
     if ($nt->isExternal()) {
         $args = '';
         $u = $nt->getFullURL();
         $link = $nt->getPrefixedURL();
         if ('' == $text) {
             $text = $nt->getPrefixedText();
         }
         $style = $this->getInterwikiLinkAttributes($link, $text, 'extiw');
         $inside = '';
         if ('' != $trail) {
             $m = array();
             if (preg_match('/^([a-z]+)(.*)$$/sD', $trail, $m)) {
                 $inside = $m[1];
                 $trail = $m[2];
             }
         }
         if ($text == 'RTENOTITLE') {
             // 2223
             $text = $u = $link;
             $args .= '_fcknotitle="true" ';
         }
         $t = "<a {$args}href=\"{$u}\"{$style}>{$text}{$inside}</a>";
         wfProfileOut(__METHOD__);
         return $t;
     }
     return Linker::makeLinkObj($nt, $text, $query, $trail, $prefix);
 }
	/**
	 * @param $row
	 * @return string
	 */
	function listRow( $row ) {
		global $wgLang;
		$self = $this->getTitle();
		$userPage = Title::makeTitle( NS_USER, $row->user_name );
		$victim = Title::makeTitle( $row->page_namespace, $row->page_title );
		return "<li>(" .
				Linker::makeKnownLinkObj( $self, wfMsgHTML( 'oversight-view' ),
				'revision=' . $row->rev_id ) .
			") " .
			"(" .
			Linker::makeKnownLinkObj( $self, wfMsgHTML( 'diff' ),
				'revision=' . $row->rev_id . '&diff=1') .
			") " .
			$wgLang->timeanddate( wfTimestamp( TS_MW, $row->hidden_on_timestamp ) ) .
			" " .
			Linker::makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ) .
			" " .
			wfMsgHTML( 'oversight-log-hiderev', Linker::makeLinkObj( $victim ) ) .
			" " .
			Linker::commentBlock( $row->hidden_reason ) .
			"</li>\n";
	}
Example #4
0
/**
 * @param $type
 * @param $action
 * @param $title
 * @param $skin Skin
 * @param $params
 * @param $filterWikilinks bool
 * @return String
 */
function efHandleWikiSetLogEntry($type, $action, $title, $skin, $params, $filterWikilinks = false)
{
    $link = Linker::makeLinkObj($title, htmlspecialchars($params[0]));
    switch ($action) {
        case 'newset':
            $args = array(WikiSet::formatType($params[1]), $params[2]);
            break;
        case 'setrename':
            $args = array($params[1]);
            break;
        case 'setnewtype':
            $args = array(WikiSet::formatType($params[1]), WikiSet::formatType($params[2]));
            break;
        case 'setchange':
            $args = array($params[1] ? $params[1] : wfMsg('rightsnone'), $params[2] ? $params[2] : wfMsg('rightsnone'));
            break;
        default:
            //'deleteset'
            $args = array();
    }
    return wfMsgReal("centralauth-rightslog-entry-{$action}", array_merge(array($link), $args), true, !$skin);
}
 function showCredentials()
 {
     $reqUser = $this->getUser();
     $out = $this->getOutput();
     $titleObj = SpecialPage::getTitleFor('UserCredentials');
     $row = $this->getAccountData();
     if (!$row) {
         $out->addHTML(wfMsgHtml('usercredentials-badid'));
         return;
     }
     $out->addWikiText(wfMsg("usercredentials-text"));
     $user = User::newFromName($this->target);
     $list = array();
     foreach ($user->getGroups() as $group) {
         $list[] = self::buildGroupLink($group);
     }
     $grouplist = '';
     if (count($list) > 0) {
         $grouplist = '<tr><td>' . wfMsgHtml('usercredentials-member') . '</td><td>' . implode(', ', $list) . '</td></tr>';
     }
     $form = "<fieldset>";
     $form .= '<legend>' . wfMsgHtml('usercredentials-leg-user') . '</legend>';
     $form .= '<table cellpadding=\'4\'>';
     $form .= "<tr><td>" . wfMsgHtml('username') . "</td>";
     $form .= "<td>" . Linker::makeLinkObj($user->getUserPage(), htmlspecialchars($user->getUserPage()->getText())) . "</td></tr>\n";
     $econf = $row->acd_email_authenticated ? ' <strong>' . wfMsgHtml('confirmaccount-econf') . '</strong>' : '';
     $form .= "<tr><td>" . wfMsgHtml('usercredentials-email') . "</td>";
     $form .= "<td>" . htmlspecialchars($row->acd_email) . $econf . "</td></tr>\n";
     $form .= $grouplist;
     $form .= '</table></fieldset>';
     $areaSet = UserAccountRequest::expandAreas($row->acd_areas);
     $userAreas = ConfirmAccount::getUserAreaConfig();
     if (count($userAreas) > 0) {
         $form .= '<fieldset>';
         $form .= '<legend>' . wfMsgHtml('confirmaccount-leg-areas') . '</legend>';
         $form .= "<div style='height:150px; overflow:scroll; background-color:#f9f9f9;'>";
         $form .= "<table cellspacing='5' cellpadding='0' style='background-color:#f9f9f9;'><tr valign='top'>";
         $count = 0;
         $att = array('disabled' => 'disabled');
         foreach ($userAreas as $name => $conf) {
             $count++;
             if ($count > 5) {
                 $form .= "</tr><tr valign='top'>";
                 $count = 1;
             }
             $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name));
             if ($conf['project'] != '') {
                 $pg = Linker::link(Title::newFromText($name), wfMsgHtml('requestaccount-info'), array(), array(), "known");
             } else {
                 $pg = '';
             }
             $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, in_array($formName, $areaSet), $att) . " {$pg}</td>\n";
         }
         $form .= "</tr></table></div>";
         $form .= '</fieldset>';
     }
     $form .= '<fieldset>';
     $form .= '<legend>' . wfMsgHtml('usercredentials-leg-person') . '</legend>';
     $form .= '<table cellpadding=\'4\'>';
     $form .= "<tr><td>" . wfMsgHtml('usercredentials-real') . "</td>";
     $form .= "<td>" . htmlspecialchars($row->acd_real_name) . "</td></tr>\n";
     $form .= '</table>';
     $form .= "<p>" . wfMsgHtml('usercredentials-bio') . "</p>";
     $form .= "<p><textarea tabindex='1' readonly='readonly' name='wpBio' id='wpNewBio' rows='10' cols='80' style='width:100%'>" . htmlspecialchars($row->acd_bio) . "</textarea></p>\n";
     $form .= '</fieldset>';
     $form .= '<fieldset>';
     $form .= '<legend>' . wfMsgHtml('usercredentials-leg-other') . '</legend>';
     global $wgAccountRequestExtraInfo;
     if ($wgAccountRequestExtraInfo) {
         $form .= '<p>' . wfMsgHtml('usercredentials-attach') . ' ';
         if ($row->acd_filename) {
             $form .= Linker::makeKnownLinkObj($titleObj, htmlspecialchars($row->acd_filename), 'file=' . $row->acd_storage_key);
         } else {
             $form .= wfMsgHtml('confirmaccount-none-p');
         }
         $form .= "</p><p>" . wfMsgHtml('usercredentials-notes') . "</p>\n";
         $form .= "<p><textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . htmlspecialchars($row->acd_notes) . "</textarea></p>\n";
         $form .= "<p>" . wfMsgHtml('usercredentials-urls') . "</p>\n";
         $form .= ConfirmAccountsPage::parseLinks($row->acd_urls);
     }
     if ($reqUser->isAllowed('requestips')) {
         $form .= "<p>" . wfMsgHtml('usercredentials-ip') . " " . htmlspecialchars($row->acd_ip) . "</p>\n";
     }
     $form .= '</fieldset>';
     $out->addHTML($form);
 }
 function view()
 {
     global $wgShowEXIF, $wgRequest, $wgUser;
     $out = $this->getContext()->getOutput();
     $sk = $this->getContext()->getSkin();
     $diff = $wgRequest->getVal('diff');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
     if ($this->mTitle->getNamespace() != NS_IMAGE || isset($diff) && $diffOnly) {
         return Article::view();
     }
     if ($wgShowEXIF && $this->getDisplayedFile()->exists()) {
         // FIXME: bad interface, see note on MediaHandler::formatMetadata().
         $formattedMetadata = $this->getDisplayedFile()->formatMetadata();
         $showmeta = $formattedMetadata !== false;
     } else {
         $showmeta = false;
     }
     $this->openShowImage();
     ImageHelper::showDescription($this->mTitle);
     $lastUser = $this->getDisplayedFile()->getUser();
     $userLink = Linker::makeLinkObj(Title::makeTitle(NS_USER, $lastUser), $lastUser);
     $out->addHTML("<div style='margin-bottom:20px'></div>");
     # Show shared description, if needed
     if ($this->mExtraDescription) {
         $fol = wfMsgNoTrans('shareddescriptionfollows');
         if ($fol != '-' && !wfEmptyMsg('shareddescriptionfollows', $fol)) {
             $out->addWikiText($fol);
         }
         $out->addHTML('<div id="shared-image-desc">' . $this->mExtraDescription . '</div>');
     }
     $this->closeShowImage();
     $currentHTML = $out->getHTML();
     $out->clearHTML();
     Article::view();
     $articleContent = $out->getHTML();
     $out->clearHTML();
     $out->addHTML($currentHTML);
     $diffSeparator = "<h2>" . wfMessage('currentrev')->text() . "</h2>";
     $articleParts = explode($diffSeparator, $articleContent);
     if (count($articleParts) > 1) {
         $out->addHTML($articleParts[0]);
     }
     $ih = new ImageHelper();
     $articles = $ih->getLinkedArticles($this->mTitle);
     if (ImageHelper::IMAGES_ON) {
         $ih->getConnectedImages($articles, $this->mTitle);
         $ih->getRelatedWikiHows($this->mTitle, $sk);
     }
     $ih->addSideWidgets($this, $this->mTitle, $this->getDisplayedFile());
     # No need to display noarticletext, we use our own message, output in openShowImage()
     if ($this->getID()) {
     } else {
         # Just need to set the right headers
         $out->setArticleFlag(true);
         $out->setRobotpolicy('noindex,nofollow');
         $out->setPageTitle($this->mTitle->getPrefixedText());
         //$this->viewUpdates();
     }
     if ($wgUser && !$wgUser->isAnon()) {
         $this->imageHistory();
     }
     ImageHelper::displayBottomAds();
     if ($showmeta) {
         $out->addHTML(Xml::element('h2', array('id' => 'metadata'), wfMessage('metadata')->text()) . "\n");
         $out->addWikiText($this->makeMetadataTable($formattedMetadata));
         $out->addModules(array('mediawiki.action.view.metadata'));
     }
 }