Example #1
0
function wfSajaxSearch($term)
{
    global $wgContLang, $wgOut;
    $limit = 16;
    $l = new Linker();
    $term = str_replace(' ', '_', $wgContLang->ucfirst($wgContLang->checkTitleEncoding($wgContLang->recodeInput(js_unescape($term)))));
    if (strlen(str_replace('_', '', $term)) < 3) {
        return;
    }
    $db =& wfGetDB(DB_SLAVE);
    $res = $db->select('page', 'page_title', array('page_namespace' => 0, "page_title LIKE '" . $db->strencode($term) . "%'"), "wfSajaxSearch", array('LIMIT' => $limit + 1));
    $r = "";
    $i = 0;
    while (($row = $db->fetchObject($res)) && ++$i <= $limit) {
        $nt = Title::newFromDBkey($row->page_title);
        $r .= '<li>' . $l->makeKnownLinkObj($nt) . "</li>\n";
    }
    if ($i > $limit) {
        $more = '<i>' . $l->makeKnownLink($wgContLang->specialPage("Allpages"), wfMsg('moredotdotdot'), "namespace=0&from=" . wfUrlEncode($term)) . '</i>';
    } else {
        $more = '';
    }
    $subtitlemsg = Title::newFromText($term) ? 'searchsubtitle' : 'searchsubtitleinvalid';
    $subtitle = $wgOut->parse(wfMsg($subtitlemsg, wfEscapeWikiText($term)));
    #FIXME: parser is missing mTitle !
    $term = htmlspecialchars($term);
    $html = '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">' . wfMsg('hideresults') . '</a></div>' . '<h1 class="firstHeading">' . wfMsg('search') . '</h1><div id="contentSub">' . $subtitle . '</div><ul><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchcontaining', $term), "search={$term}&fulltext=Search") . '</li><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchnamed', $term), "search={$term}&go=Go") . "</li></ul><h2>" . wfMsg('articletitles', $term) . "</h2>" . '<ul>' . $r . '</ul>' . $more;
    $response = new AjaxResponse($html);
    $response->setCacheDuration(30 * 60);
    return $response;
}
 function deleteForm($query, $reason)
 {
     $title = $this->getTitle();
     $output = $this->getOutput();
     $pages = $this->getPages($query);
     $count = count($pages);
     if ($count == 0) {
         $output->addWikiText($this->msg('nukedpl-nopages', $query)->text());
         return $this->queryForm();
     }
     $output->addWikiText($this->msg('nukedpl-list', $count, $query)->text());
     $output->addHTML(Xml::element('form', array('action' => $title->getLocalURL('action=delete'), 'method' => 'post'), null));
     $output->addHTML(Xml::element('input', array('type' => 'submit', 'value' => $this->msg('nukedpl-nuke')->text())));
     $output->addHTML('<div>' . $this->msg('deletecomment')->escaped() . '</div>');
     $output->addHTML(Xml::element('input', array('name' => 'reason', 'value' => $reason, 'size' => 60)));
     $output->addHTML('<ol>');
     foreach ($pages as $page) {
         $page = Title::newFromText($page);
         if ($page and $page->isKnown()) {
             $output->addHTML('<li>');
             $output->addHTML(Xml::element('input', array('type' => 'checkbox', 'name' => 'ids[]', 'value' => $page->getArticleID(), 'checked' => 'checked')));
             $output->addHTML(Linker::makeKnownLinkObj($page));
             $output->addHTML('</li>');
         }
     }
     $output->addHTML('</ol>');
     $output->addHTML(Xml::element('input', array('type' => 'submit', 'value' => $this->msg('nukedpl-nuke')->text())));
     $output->addHTML('</form>');
 }
Example #3
0
 /**
  * @param $id
  * @param $nt Title
  * @param $tools
  * @return bool
  */
 public static function onContributionsToolLinks($id, $nt, &$tools)
 {
     global $wgUser;
     if ($wgUser->isAllowed('oversight')) {
         $title = SpecialPage::getTitleFor('Oversight');
         $tools[] = Linker::makeKnownLinkObj($title, wfMsgHtml('hiderevision-link'), 'author=' . $nt->getPartialUrl());
     }
     return true;
 }
Example #4
0
 /**
  * Add a link to central:Special:Phalanx from Special:Contributions/USERNAME
  * if the user has 'phalanx' permission
  *
  * @param $id Integer: user ID
  * @param $nt Title: user page title
  * @param $links Array: tool links
  * @return boolean true
  */
 public static function loadLinks($id, $nt, &$links)
 {
     wfProfileIn(__METHOD__);
     $user = RequestContext::getMain()->getUser();
     if ($user->isAllowed('phalanx')) {
         $links[] = Linker::makeKnownLinkObj(GlobalTitle::newFromText('Phalanx', NS_SPECIAL, WikiFactory::COMMUNITY_CENTRAL), 'PhalanxBlock', wfArrayToCGI(['type' => Phalanx::TYPE_USER, 'wpPhalanxCheckBlocker' => $nt->getText(), 'target' => $nt->getText()]));
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 function displayEditStreams()
 {
     global $wgRequest, $wgOut, $mvgScriptPath;
     $this->sit = new MV_Sitting(array('name' => $this->name));
     $this->sit->db_load_sitting();
     $this->sit->db_load_streams();
     $tit = Title::makeTitle(MV_NS_SITTING, $this->name);
     $html = '';
     $html .= '<h1>' . $tit . '</h1>';
     $html .= '<form action="' . $tit->getEditURL() . '" method="POST">';
     $html .= '<input type="hidden" name="mv_action" value="edit_streams">';
     $html .= '<fieldset><legend>' . wfMsg('mv_remove_streams') . '</legend>' . "\n";
     $html .= '<table width="600" border="0">';
     $html .= '</tr><tr>';
     if (count($this->sit->sitting_streams) != 0) {
         foreach ($this->sit->sitting_streams as $obj) {
             $html .= '<td width="10">';
             $h = '<a title="' . wfMsg('mv_streams') . '"' . ' href="' . $tit->getEditURL() . '&mv_action=rm_stream&stream_id=' . $obj->id . '"><img src="' . $mvgScriptPath . '/skins/images/delete.png"></td>';
             $html .= $h . '<td><b>' . $obj->name;
             $html .= '</b></td></tr>';
         }
     } else {
         $html .= "<tr><td>Sitting has no streams</td></tr>";
     }
     $html .= '</table></fieldset>';
     $html .= '</form>';
     //add new stream:
     $html .= '<fieldset><legend>' . wfMsg('mv_add_stream') . '</legend>' . "\n";
     $html .= '<table width="600" border="0">';
     $html .= '<tr><td>';
     $spec_list = Title::makeTitle(MV_NS_SPECIAL, "Special:Mv_Add_Stream");
     $skin = new Linker();
     $html .= $skin->makeKnownLinkObj($spec_list, 'Add New Stream to this Sitting', 'sitting_id=' . $this->id);
     $html .= '</td></tr>';
     $html .= '<tr><td>';
     $spec_list = Title::makeTitle(MV_NS_SPECIAL, "Special:Mv_List_Streams");
     $html .= $skin->makeKnownLinkObj($spec_list, 'Add Existing Stream to this Sitting', 'sitting_id=' . $this->id . '&existing=true');
     $html .= '</td></tr>';
     $html .= '</table></fieldset>';
     $wgOut->addHTML($html);
     return true;
 }
 public function formatRow($row)
 {
     $rdatim = $this->getLang()->timeanddate(wfTimestamp(TS_MW, $row->rev_timestamp), true);
     $fdatim = $this->getLang()->timeanddate(wfTimestamp(TS_MW, $row->fr_timestamp), true);
     $fdate = $this->getLang()->date(wfTimestamp(TS_MW, $row->fr_timestamp), true);
     $ftime = $this->getLang()->time(wfTimestamp(TS_MW, $row->fr_timestamp), true);
     $review = wfMsgExt('reviewedversions-review', array('parseinline', 'replaceafter'), $fdatim, Linker::userLink($row->fr_user, $row->user_name) . ' ' . Linker::userToolLinks($row->fr_user, $row->user_name), $fdate, $ftime, $row->user_name);
     $lev = $row->fr_quality >= 1 ? wfMsgHtml('revreview-hist-quality') : wfMsgHtml('revreview-hist-basic');
     $link = Linker::makeKnownLinkObj($this->page, $rdatim, 'stableid=' . $row->fr_rev_id);
     return '<li>' . $link . ' (' . $review . ') <strong>[' . $lev . ']</strong></li>';
 }
Example #7
0
 /**
  * @param $id
  * @return mixed
  */
 function doSubmit($id)
 {
     global $wgContLang;
     $name = $wgContLang->ucfirst($this->getRequest()->getVal('wpName'));
     $type = $this->getRequest()->getVal('wpType');
     $wikis = array_unique(preg_split('/(\\s+|\\s*\\W\\s*)/', $this->getRequest()->getVal('wpWikis'), -1, PREG_SPLIT_NO_EMPTY));
     $reason = $this->getRequest()->getVal('wpReason');
     $set = WikiSet::newFromId($id);
     if (!Title::newFromText($name)) {
         $this->buildSetView($id, wfMsgHtml('centralauth-editset-badname'), $name, $type, $wikis, $reason);
         return;
     }
     if ((!$id || $set->getName() != $name) && WikiSet::newFromName($name)) {
         $this->buildSetView($id, wfMsgHtml('centralauth-editset-setexists'), $name, $type, $wikis, $reason);
         return;
     }
     if (!in_array($type, array(WikiSet::OPTIN, WikiSet::OPTOUT))) {
         $this->buildSetView($id, wfMsgHtml('centralauth-editset-badtype'), $name, $type, $wikis, $reason);
         return;
     }
     if (!$wikis) {
         $this->buildSetView($id, wfMsgHtml('centralauth-editset-nowikis'), $name, $type, $wikis, $reason);
         return;
     }
     $badwikis = array();
     $allwikis = CentralAuthUser::getWikiList();
     foreach ($wikis as $wiki) {
         if (!in_array($wiki, $allwikis)) {
             $badwikis[] = $wiki;
         }
     }
     if ($badwikis) {
         $this->buildSetView($id, wfMsgExt('centralauth-editset-badwikis', array('escapenoentities', 'parsemag'), implode(', ', $badwikis), count($badwikis)), $name, $type, $wikis, $reason);
         return;
     }
     if ($set) {
         $oldname = $set->getName();
         $oldtype = $set->getType();
         $oldwikis = $set->getWikisRaw();
     } else {
         $set = new WikiSet();
         $oldname = $oldtype = null;
         $oldwikis = array();
     }
     $set->setName($name);
     $set->setType($type);
     $set->setWikisRaw($wikis);
     $set->commit();
     // Now logging
     $log = new LogPage('gblrights');
     $title = SpecialPage::getTitleFor('WikiSets', $set->getID());
     if (!$oldname) {
         // New set
         $log->addEntry('newset', $title, $reason, array($name, $type, implode(', ', $wikis)));
     } else {
         if ($oldname != $name) {
             $log->addEntry('setrename', $title, $reason, array($name, $oldname));
         }
         if ($oldtype != $type) {
             $log->addEntry('setnewtype', $title, $reason, array($name, $oldtype, $type));
         }
         $added = implode(', ', array_diff($wikis, $oldwikis));
         $removed = implode(', ', array_diff($oldwikis, $wikis));
         if ($added || $removed) {
             $log->addEntry('setchange', $title, $reason, array($name, $added, $removed));
         }
     }
     $returnLink = Linker::makeKnownLinkObj($this->getTitle(), wfMsg('centralauth-editset-return'));
     $this->getOutput()->addHTML('<strong class="success">' . wfMsgHtml('centralauth-editset-success') . '</strong> <p>' . $returnLink . '</p>');
 }
Example #8
0
 public static function onLogLine($logType, $logaction, $title, $paramArray, &$comment, &$revert, $logTimestamp)
 {
     global $wgUser, $wgCityId;
     if (strpos($logaction, 'chatban') === 0) {
         $user = User::newFromId($paramArray[1]);
         if (!empty($user) && Chat::getBanInformation($wgCityId, $user) !== false && $wgUser->isAllowed('chatmoderator')) {
             $revert = "(" . "<a class='chat-change-ban' data-user-id='{$paramArray[1]}' href='#'>" . wfMsg('chat-ban-log-change-ban-link') . "</a>" . ")";
         }
     } elseif ($logaction === 'chatconnect' && !empty($paramArray)) {
         $ipLinks = array();
         if ($wgUser->isAllowed('multilookup')) {
             $mlTitle = GlobalTitle::newFromText('MultiLookup', NS_SPECIAL, 177);
             // Need to make the link manually for this as Linker's normaliseSpecialPage
             // makes the link local if the special page exists locally, rather than
             // keeping the global title
             $ipLinks[] = Xml::tags('a', array('href' => $mlTitle->getFullURL('target=' . urlencode($paramArray[0]))), wfMessage('multilookup')->escaped());
             $ipLinks[] = Linker::makeKnownLinkObj(GlobalTitle::newFromText('Phalanx', NS_SPECIAL, 177), wfMessage('phalanx')->escaped(), wfArrayToCGI(array('type' => '8', 'target' => $paramArray[0], 'wpPhalanxCheckBlocker' => $paramArray[0])));
             $ipLinks[] = Linker::blockLink(0, $paramArray[0]);
             $revert = '(' . implode(wfMessage('pipe-separator')->plain(), $ipLinks) . ')';
         }
     }
     return true;
 }
 /**
  * @param $row
  * @return string
  */
 public function formatRow($row)
 {
     global $wgMemc;
     if ($this->showRejects || $this->showStale) {
         $link = Linker::makeKnownLinkObj($this->getFullTitle(), $this->msg('confirmaccount-review')->escaped(), 'acrid=' . (int) $row->acr_id . '&wpShowRejects=1');
     } else {
         $link = Linker::makeKnownLinkObj($this->getFullTitle(), $this->msg('confirmaccount-review')->escaped(), 'acrid=' . (int) $row->acr_id);
     }
     $time = $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->acr_registration), true);
     $r = "<li class='mw-confirmaccount-type-{$this->queueType}'>";
     $r .= $time . " (<strong>{$link}</strong>)";
     # Auto-rejected accounts have a user ID of zero
     if ($row->acr_rejected && $row->acr_user) {
         $datim = $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->acr_rejected), true);
         $date = $this->getLanguage()->date(wfTimestamp(TS_MW, $row->acr_rejected), true);
         $time = $this->getLanguage()->time(wfTimestamp(TS_MW, $row->acr_rejected), true);
         $r .= ' <b>' . $this->msg('confirmaccount-reject', $row->user_name, $datim, $date, $time)->parse() . '</b>';
     } elseif ($row->acr_held && !$row->acr_rejected) {
         $datim = $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->acr_held), true);
         $date = $this->getLanguage()->date(wfTimestamp(TS_MW, $row->acr_held), true);
         $time = $this->getLanguage()->time(wfTimestamp(TS_MW, $row->acr_held), true);
         $r .= ' <b>' . $this->msg('confirmaccount-held', User::whoIs($row->acr_user), $datim, $date, $time)->parse() . '</b>';
     }
     # Check if someone is viewing this request
     $key = wfMemcKey('acctrequest', 'view', $row->acr_id);
     $value = $wgMemc->get($key);
     if ($value) {
         $r .= ' <b>' . $this->msg('confirmaccount-viewing', User::whoIs($value))->parse() . '</b>';
     }
     $r .= "<br /><table class='mw-confirmaccount-body-{$this->queueType}' cellspacing='1' cellpadding='3' border='1' width='100%'>";
     if ($this->hasItem('UserName')) {
         $r .= '<tr><td><strong>' . $this->msg('confirmaccount-name')->escaped() . '</strong></td><td width=\'100%\'>' . htmlspecialchars($row->acr_name) . '</td></tr>';
     }
     if ($this->hasItem('RealName')) {
         $hasCV = $row->acr_filename ? ' <strong>' . $this->msg('confirmaccount-withcv')->escaped() . '</strong>' : '';
         $r .= '<tr><td><strong>' . $this->msg('confirmaccount-real-q')->escaped() . '</strong></td><td width=\'100%\'>' . htmlspecialchars($row->acr_real_name) . $hasCV . '</td></tr>';
     }
     $econf = $row->acr_email_authenticated ? ' <strong>' . $this->msg('confirmaccount-econf')->escaped() . '</strong>' : '';
     $r .= '<tr><td><strong>' . $this->msg('confirmaccount-email-q')->escaped() . '</strong></td><td width=\'100%\'>' . htmlspecialchars($row->acr_email) . $econf . '</td></tr>';
     # Truncate this, blah blah...
     $bio = htmlspecialchars($row->acr_bio);
     $preview = $this->getLanguage()->truncate($bio, 400, '');
     if (strlen($preview) < strlen($bio)) {
         $preview = substr($preview, 0, strrpos($preview, ' '));
         $preview .= " . . .";
     }
     $r .= '<tr><td><strong>' . $this->msg('confirmaccount-bio-q')->escaped() . '</strong></td><td width=\'100%\'><i>' . $preview . '</i></td></tr>';
     $r .= '</table>';
     $r .= '</li>';
     return $r;
 }
 function execute()
 {
     global $wgRequest, $wgOut, $wgUser, $mvStream_name, $mvgIP;
     #init html output var:
     $html = '';
     # Get request data from, e.g.
     $title_str = $wgRequest->getVal('title');
     //get Mv_Title to normalize the stream name:
     $this->stream_name = $wgRequest->getVal('stream_name') == '' ? '' : MV_Title::normalizeTitle($wgRequest->getVal('stream_name'));
     $this->stream_type = $wgRequest->getVal('stream_type');
     $this->wpEditToken = $wgRequest->getVal('wpEditToken');
     $this->stream_desc = $wgRequest->getVal('stream_desc');
     $this->sitting_id = $wgRequest->getVal('sitting_id');
     $sit = new MV_Sitting(array('id' => $this->sitting_id));
     $sit->db_load_sitting();
     //grab the desc from the wiki page if not in the POST req
     if ($this->stream_desc == '') {
         $desTitle = Title::makeTitle(MV_NS_STREAM, $this->stream_name);
         //grab the article text:
         $curRevision = Revision::newFromTitle($desTitle);
         if ($curRevision) {
             $this->stream_desc = $curRevision->getText();
         }
     }
     if ($this->stream_name == '') {
         //default page request
         $parts = split('/', $title_str);
         if (count($parts) >= 2) {
             //means we can use part 1 as a stream name:
             $this->stream_name = $parts[1];
         }
     } else {
         if ($this->mode == 'add') {
             //output add_ status to html
             //$html.=
             if ($this->add_stream()) {
                 $streamTitle = Title::newFromText($this->stream_name, MV_NS_STREAM);
                 $wgOut->redirect($streamTitle->getLocalURL("action=edit"));
                 return;
             } else {
                 $html = "Error adding stream. Please Nofity Administrator";
                 $wgOut->addHTML($html);
                 return;
             }
         } else {
             //possible edit
         }
     }
     //if edit check for stream name:
     if ($this->mode == 'edit' && $this->stream_name == '') {
         $html .= wfMsg('edit_stream_missing');
         $wgOut->addHTML($html);
         return;
     }
     $this->check_permissions();
     if (count($this->_allowedStreamTypeArray) == 0) {
         //break out user lacks permissions to add anything
         $html .= wfMsg('add_stream_permission');
         $wgOut->addHTML($html);
         return;
     }
     //output the stream form
     //output the add stream form
     $spectitle = Title::makeTitle(NS_SPECIAL, 'Mv_Add_stream');
     $docutitle = Title::newFromText(wfMsg('mv_add_stream'), NS_HELP);
     if ($this->mode == 'edit') {
         $mvStreamTitle = Title::makeTitle(MV_NS_STREAM, $this->stream_name);
         if ($mvStreamTitle->exists()) {
             $sk = $wgUser->getSkin();
             $streamLink = $sk->makeLinkObj($mvStreamTitle, $this->stream_name);
             $html .= wfMsg('mv_edit_strea_docu', $streamLink);
         }
     } else {
         //$html.= wfMsg('mv_add_stream_docu', $docutitle->getFullURL()) ."\n";
         $title2 = Title::makeTitle(MV_NS_SITTING, $sit->name);
         $skin2 = new Linker();
         $sittingLink = $skin2->makeKnownLinkObj($title2, $sit->name);
         $html .= 'Add a stream to Sitting ' . $sittingLink;
     }
     $html .= '<form name="add_stream" action="' . $spectitle->escapeLocalURL() . '" method="post" enctype="multipart/form-data">';
     $html .= '<fieldset><legend>' . wfMsg('mv_add_stream') . '</legend>' . "\n" . '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>' . '<input type="hidden" name="sitting_id" value="' . $wgRequest->getVal('sitting_id') . '"/>';
     $html .= '<table width="600" border="0">';
     $html .= '<tr><td width="140">Sitting Id</td><td>' . $wgRequest->getVal('sitting_id') . '</tr><tr>';
     $html .= '<td>';
     //output the stream type pulldown
     $html .= '<i>' . wfMsg('mv_label_stream_name') . "</i>:";
     $html .= '</td><td>';
     $html .= '<input type="text" name="stream_name" value="' . htmlspecialchars(MV_Title::getStreamNameText($this->stream_name)) . '" size="30" maxlength="1024"><br />' . "\n";
     $html .= '</td>';
     $html .= '<td><tr><td><i>' . wfMsg('mv_label_stream_type') . '</i></td><td>';
     $html .= '<select name="stream_type">' . '<option value="">Select Stream Type</option>' . "\n";
     foreach ($this->_allowedStreamTypeArray as $type => $na) {
         $sel = $type == $this->stream_type ? 'selected' : '';
         $html .= '<option value="' . $type . '" ' . $sel . '>' . wfMsg('mv_' . $type) . '</option>' . "\n";
     }
     $html .= '</select></tr>' . "\n";
     $html .= '<tr><td valign="top"><i>' . wfMsg('mv_label_stream_desc') . '</i>:</td><td>';
     //add an edit token (for the stream description)
     if ($wgUser->isLoggedIn()) {
         $token = htmlspecialchars($wgUser->editToken());
     } else {
         $token = EDIT_TOKEN_SUFFIX;
     }
     $html .= "\n<input type='hidden' value=\"{$token}\"{$docutitle} name=\"wpEditToken\" />\n";
     //output the text area:
     $html .= '<textarea tabindex="1" accesskey="," name="stream_desc" id="stream_desc" rows=6 cols=5>' . $this->stream_desc . '</textarea>' . "\n";
     $html .= '<br /><input type="submit" value="' . wfMsg('mv_add_stream_submit') . "\"/>\n</form>";
     $html .= '</td></tr></table>';
     $html .= '</fieldset>';
     # Output menu items
     # @@todo link with language file
     $wgOut->addHTML($html);
     //output the stream files list (if in edit mode)
     if ($this->mode == 'edit') {
         $this->list_stream_files();
     }
 }
	/**
	 * @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";
	}
 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);
 }
Example #13
0
 function formatValue($name, $value)
 {
     $lang = $this->getLanguage();
     $row = $this->mCurrentRow;
     switch ($name) {
         case 'af_id':
             return Linker::link(SpecialPage::getTitleFor('AbuseFilter', intval($value)), $lang->formatNum(intval($value)));
         case 'af_public_comments':
             return Linker::link(SpecialPage::getTitleFor('AbuseFilter', intval($row->af_id)), $this->getOutput()->parseInline($value));
         case 'af_actions':
             $actions = explode(',', $value);
             $displayActions = array();
             foreach ($actions as $action) {
                 $displayActions[] = AbuseFilter::getActionDisplay($action);
             }
             return htmlspecialchars($lang->commaList($displayActions));
         case 'af_enabled':
             $statuses = array();
             if ($row->af_deleted) {
                 $statuses[] = wfMsgExt('abusefilter-deleted', 'parseinline');
             } elseif ($row->af_enabled) {
                 $statuses[] = wfMsgExt('abusefilter-enabled', 'parseinline');
             } else {
                 $statuses[] = wfMsgExt('abusefilter-disabled', 'parseinline');
             }
             global $wgAbuseFilterIsCentral;
             if ($row->af_global && $wgAbuseFilterIsCentral) {
                 $statuses[] = wfMsgExt('abusefilter-status-global', 'parseinline');
             }
             return $lang->commaList($statuses);
         case 'af_hidden':
             $msg = $value ? 'abusefilter-hidden' : 'abusefilter-unhidden';
             return wfMsgExt($msg, 'parseinline');
         case 'af_hit_count':
             $count_display = wfMsgExt('abusefilter-hitcount', array('parseinline'), $lang->formatNum($value));
             // @todo FIXME: makeKnownLinkObj() is deprecated.
             if (SpecialAbuseLog::canSeeDetails($row->af_id, $row->af_hidden)) {
                 $link = Linker::makeKnownLinkObj(SpecialPage::getTitleFor('AbuseLog'), $count_display, 'wpSearchFilter=' . $row->af_id);
             } else {
                 $link = "";
             }
             return $link;
         case 'af_timestamp':
             $userLink = Linker::userLink($row->af_user, $row->af_user_text) . Linker::userToolLinks($row->af_user, $row->af_user_text);
             $user = $row->af_user_text;
             return wfMsgExt('abusefilter-edit-lastmod-text', array('replaceafter', 'parseinline'), array($lang->timeanddate($value, true), $userLink, $lang->date($value, true), $lang->time($value, true), $user));
         default:
             throw new MWException("Unknown row type {$name}!");
     }
 }
Example #14
0
 /**
  * Compute the sidebar
  * @access private
  */
 private function quickBar()
 {
     global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
     $tns = $wgTitle->getNamespace();
     $s = '<div id="toolbar">';
     $s .= '<div class="toolbartitle">Page editing toolbox</div>';
     $s .= '<table border="0" cellpadding="0" cellspacing="4" width="100%"><tr valign="top">';
     $sep = "<br/>";
     // browse section
     $section = "";
     $browseLinks = reset($this->data['sidebar']);
     foreach ($browseLinks as $link) {
         if ($link['text'] != '-') {
             $section .= "<a href=\"{$link['href']}\">" . htmlspecialchars($link['text']) . '</a>' . $sep;
         }
     }
     $s .= $this->AddToolbarSection("qbbrowse", $section);
     // page related sections
     if ($wgOut->isArticle()) {
         $section = "";
         $section .= "<strong>" . $this->editThisPage() . "</strong>";
         $section .= $sep . Linker::makeKnownLinkObj(Title::newFromText(wfMsgForContent("edithelppage")), wfMsg("edithelp"));
         if ($wgUser->isLoggedIn()) {
             $section .= $sep . $this->moveThisPage();
         }
         if ($wgUser->isAllowed('delete')) {
             $dtp = $this->deleteThisPage();
             if ("" != $dtp) {
                 $section .= $sep . $dtp;
             }
         }
         if ($wgUser->isAllowed('protect')) {
             $ptp = $this->protectThisPage();
             if ("" != $ptp) {
                 $section .= $sep . $ptp;
             }
         }
         $section .= $sep;
         $s .= $this->AddToolbarSection("qbedit", $section);
         $section = "";
         $section .= $this->talkLink() . $sep . $this->commentLink() . $sep . $this->printableLink();
         if ($wgUser->isLoggedIn()) {
             $section .= $sep . $this->watchThisPage();
         }
         $section .= $sep;
         $s .= $this->AddToolbarSection("qbpageoptions", $section);
         $section = "";
         $section .= $this->historyLink() . $sep . $this->whatLinksHere() . $sep . $this->watchPageLinksLink();
         if ($tns == NS_USER || $tns == NS_USER_TALK) {
             $id = User::idFromName($wgTitle->getText());
             if ($id != 0) {
                 $section .= $sep . $this->userContribsLink();
                 if ($this->getSkin()->showEmailUser($id)) {
                     $section .= $sep . $this->emailUserLink();
                 }
             }
         }
         $section .= $sep;
         $s .= $this->AddToolbarSection("qbpageinfo", $section);
     }
     // login/user section
     $section = "";
     if ($wgUser->isLoggedIn()) {
         $name = $wgUser->getName();
         $tl = Linker::makeKnownLinkObj($wgUser->getTalkPage(), wfMsg('mytalk'));
         if ($wgUser->getNewtalk()) {
             $tl .= " *";
         }
         $section .= Linker::makeKnownLinkObj($wgUser->getUserPage(), wfMsg("mypage")) . $sep . $tl . $sep . Linker::specialLink("watchlist") . $sep . Linker::makeKnownLinkObj(SpecialPage::getSafeTitleFor("Contributions", $wgUser->getName()), wfMsg("mycontris")) . $sep . Linker::specialLink("preferences") . $sep . Linker::specialLink("userlogout");
     } else {
         $section .= Linker::specialLink("userlogin");
     }
     $s .= $this->AddToolbarSection("qbmyoptions", $section);
     // special spages section
     $section = "";
     $section .= Linker::specialLink("newpages") . $sep . Linker::specialLink("imagelist") . $sep . Linker::specialLink("statistics");
     if ($wgUser->isLoggedIn() && $wgEnableUploads) {
         $section .= $sep . Linker::specialLink("upload");
     }
     global $wgSiteSupportPage;
     if ($wgSiteSupportPage) {
         $section .= $sep . "<a href=\"" . htmlspecialchars($wgSiteSupportPage) . "\" class =\"internal\">" . wfMsg("sitesupport") . "</a>";
     }
     $section .= $sep . Linker::makeKnownLinkObj(SpecialPage::getTitleFor('Specialpages'), wfMsg('moredotdotdot'));
     $s .= $this->AddToolbarSection("qbspecialpages", $section);
     $s .= '</tr></table>';
     $s .= '</div>';
     return $s;
 }