Exemplo n.º 1
0
 function doSubmit()
 {
     global $wgOut, $wgRequest, $wgUser;
     // Link an author to a wiki user
     if (!$wgUser->matchEditToken($wgRequest->getVal('linktoken'), 'link')) {
         $wgOut->addWikiMsg('code-author-badtoken');
         return;
     }
     if (strlen($this->mTarget) && $wgRequest->getCheck('newname')) {
         $user = User::newFromName($this->mTarget, false);
         if (!$user || !$user->getId()) {
             $wgOut->addWikiMsg('nosuchusershort', $this->mTarget);
             return;
         }
         $this->mRepo->linkUser($this->mAuthor, $user);
         $userlink = $this->skin->userLink($user->getId(), $user->getName());
         $wgOut->addHTML('<div class="successbox">' . wfMsgHtml('code-author-success', $this->authorLink($this->mAuthor), $userlink) . '</div>');
         // Unlink an author to a wiki users
     } elseif ($wgRequest->getVal('unlink')) {
         if (!$this->mUser) {
             $wgOut->addHTML(wfMsg('code-author-orphan', $this->authorLink($this->mAuthor)));
             return;
         }
         $this->mRepo->unlinkUser($this->mAuthor);
         $wgOut->addHTML('<div class="successbox">' . wfMsgHtml('code-author-unlinksuccess', $this->authorLink($this->mAuthor)) . '</div>');
     }
 }
function wfIFI_uploadWarning($u, $warning)
{
    global $wgOut;
    global $wgUseCopyrightUpload;
    $u->mSessionKey = $u->stashSession();
    if (!$u->mSessionKey) {
        # Couldn't save file; an error has been displayed so let's go.
        return;
    }
    $wgOut->addHTML("<h2>" . wfMsgHtml('uploadwarning') . "</h2>\n");
    $wgOut->addHTML("<ul class='warning'>{$warning}</ul><br />\n");
    $save = wfMsgHtml('savefile');
    $reupload = wfMsgHtml('reupload');
    $iw = wfMsgWikiHtml('ignorewarning');
    $reup = wfMsgWikiHtml('reuploaddesc');
    $titleObj = Title::makeTitle(NS_SPECIAL, 'Upload');
    $action = $titleObj->escapeLocalURL('action=submit');
    if ($wgUseCopyrightUpload) {
        $copyright = "\n    <input type='hidden' name='wpUploadCopyStatus' value=\"" . htmlspecialchars($u->mUploadCopyStatus) . "\" />\n    <input type='hidden' name='wpUploadSource' value=\"" . htmlspecialchars($u->mUploadSource) . "\" />\n    ";
    } else {
        $copyright = "";
    }
    $wgOut->addHTML("\n    <form id='uploadwarning' method='post' enctype='multipart/form-data' action='{$action}'>\n        <input type='hidden' name='wpIgnoreWarning' value='1' />\n        <input type='hidden' name='wpSessionKey' value=\"" . htmlspecialchars($u->mSessionKey) . "\" />\n        <input type='hidden' name='wpUploadDescription' value=\"" . htmlspecialchars($u->mUploadDescription) . "\" />\n        <input type='hidden' name='wpLicense' value=\"" . htmlspecialchars($u->mLicense) . "\" />\n        <input type='hidden' name='wpDestFile' value=\"" . htmlspecialchars($u->mDestFile) . "\" />\n        <input type='hidden' name='wpWatchu' value=\"" . htmlspecialchars(intval($u->mWatchu)) . "\" />\n    {$copyright}\n    <table border='0'>\n        <tr>\n            <tr>\n                <td align='right'>\n                    <input tabindex='2' type='submit' name='wpUpload' value=\"{$save}\" />\n                </td>\n                <td align='left'>{$iw}</td>\n            </tr>\n        </tr>\n    </table></form>\n" . wfMsg('importfreeimages_returntoform', $_SERVER["HTTP_REFERER"]));
    //  $_SERVER["HTTP_REFERER"]; -- javascript.back wasn't working for some reason... hmph.
}
 function formatResult($skin, $result)
 {
     global $wgUser, $wgContLang;
     $fromObj = Title::makeTitle($result->namespace, $result->title);
     if (isset($result->rd_title)) {
         $toObj = Title::makeTitle($result->rd_namespace, $result->rd_title);
     } else {
         $blinks = $fromObj->getBrokenLinksFrom();
         # TODO: check for redirect, not for links
         if ($blinks) {
             $toObj = $blinks[0];
         } else {
             $toObj = false;
         }
     }
     // $toObj may very easily be false if the $result list is cached
     if (!is_object($toObj)) {
         return '<s>' . $skin->makeLinkObj($fromObj) . '</s>';
     }
     $from = $skin->makeKnownLinkObj($fromObj, '', 'redirect=no');
     $edit = $skin->makeKnownLinkObj($fromObj, wfMsgHtml('brokenredirects-edit'), 'action=edit');
     $to = $skin->makeBrokenLinkObj($toObj);
     $arr = $wgContLang->getArrow();
     $out = "{$from} {$edit}";
     if ($wgUser->isAllowed('delete')) {
         $delete = $skin->makeKnownLinkObj($fromObj, wfMsgHtml('brokenredirects-delete'), 'action=delete');
         $out .= " {$delete}";
     }
     $out .= " {$arr} {$to}";
     return $out;
 }
Exemplo n.º 4
0
 /**
  * GetPreferences hook
  *
  * Add module-releated items to the preferences
  */
 public static function addPreferences($user, $defaultPreferences)
 {
     $defaultPreferences['jsbreadcrumbs-showcrumbs'] = array('type' => 'toggle', 'label-message' => 'prefs-jsbreadcrumbs-showcrumbs', 'section' => 'rendering/jsbreadcrumbs');
     $defaultPreferences['jsbreadcrumbs-showsite'] = array('type' => 'toggle', 'label-message' => 'prefs-jsbreadcrumbs-showsite', 'section' => 'rendering/jsbreadcrumbs');
     $defaultPreferences['jsbreadcrumbs-numberofcrumbs'] = array('type' => 'int', 'min' => 1, 'max' => 20, 'section' => 'rendering/jsbreadcrumbs', 'help' => wfMsgHtml('prefs-jsbreadcrumbs-numberofcrumbs-max'), 'label-message' => 'prefs-jsbreadcrumbs-numberofcrumbs');
     return true;
 }
Exemplo n.º 5
0
 /**
  * (non-PHPdoc)
  * @see EPPager::getFormattedValue()
  */
 protected function getFormattedValue($name, $value)
 {
     switch ($name) {
         case 'id':
             $value = Linker::linkKnown(SpecialPage::getTitleFor('Student', $value), htmlspecialchars($this->getLanguage()->formatNum($value, true)));
             break;
         case 'user_id':
             $user = User::newFromId($value);
             $name = $user->getRealName() === '' ? $user->getName() : $user->getRealName();
             $value = Linker::userLink($value, $name) . Linker::userToolLinks($value, $name);
             break;
         case 'first_enroll':
         case 'last_active':
             $value = htmlspecialchars($this->getLanguage()->date($value));
             break;
         case 'active_enroll':
             $value = wfMsgHtml($value === '1' ? 'epstudentpager-yes' : 'epstudentpager-no');
             break;
         case '_courses_current':
             $value = $this->getLanguage()->pipeList(array_map(function (EPCourse $course) {
                 return $course->getLink();
             }, $this->currentObject->getCoursesWithState('current', 'name')));
             break;
     }
     return $value;
 }
 /**
  * Show a drop down list to select a group as well as a user name
  * search box.
  * @todo localize
  */
 function getPageHeader()
 {
     global $wgScript;
     // Various variables used for the form
     $action = htmlspecialchars($wgScript);
     $title = Title::makeTitle(NS_SPECIAL, 'Listusers');
     $special = htmlspecialchars($title->getPrefixedDBkey());
     // form header
     $out = '<form method="get" action="' . $action . '">' . '<input type="hidden" name="title" value="' . $special . '" />' . wfMsgHtml('groups-editgroup-name') . '<select name="group">';
     // get all group names and IDs
     $groups = User::getAllGroups();
     // we want a default empty group
     $out .= '<option value=""></option>';
     // build the dropdown list menu using datas from the database
     foreach ($groups as $group) {
         $selected = $group == $this->requestedGroup;
         $out .= wfElement('option', array_merge(array('value' => $group), $selected ? array('selected' => 'selected') : array()), User::getGroupName($group));
     }
     $out .= '</select> ';
     $out .= wfMsgHtml('specialloguserlabel') . '<input type="text" name="username" /> ';
     // OK button, end of form.
     $out .= '<input type="submit" /></form>';
     // congratulations the form is now build
     return $out;
 }
 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->addWikiMsg('confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $self = SpecialPage::getTitleFor('Confirmemail');
         $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
         $form .= wfHidden('token', $wgUser->editToken());
         $form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
         $form .= wfCloseElement('form');
         $wgOut->addHtml($form);
     }
 }
Exemplo n.º 8
0
 function execute()
 {
     global $wgOut, $wgLang;
     $authors = $this->mRepo->getAuthorList();
     $repo = $this->mRepo->getName();
     $text = wfMsg('code-authors-text') . "\n\n";
     $text .= '<strong>' . wfMsg('code-author-total', $wgLang->formatNum($this->mRepo->getAuthorCount())) . "</strong>\n";
     $wgOut->addWikiText($text);
     $wgOut->addHTML('<table class="wikitable">' . '<tr><th>' . wfMsgHtml('code-field-author') . '</th><th>' . wfMsgHtml('code-author-lastcommit') . '</th></tr>');
     foreach ($authors as $committer) {
         if ($committer) {
             $wgOut->addHTML("<tr><td>");
             $author = $committer["author"];
             $text = "[[Special:Code/{$repo}/author/{$author}|{$author}]]";
             $user = $this->mRepo->authorWikiUser($author);
             if ($user) {
                 $title = htmlspecialchars($user->getUserPage()->getPrefixedText());
                 $name = htmlspecialchars($user->getName());
                 $text .= " ([[{$title}|{$name}]])";
             }
             $wgOut->addWikiText($text);
             $wgOut->addHTML("</td><td>{$wgLang->timeanddate($committer['lastcommit'], true)}</td></tr>");
         }
     }
     $wgOut->addHTML('</table>');
 }
Exemplo n.º 9
0
 /**
  * @static
  * @param  $repo CodeRepository
  * @return string
  */
 public static function getNavItem($repo)
 {
     global $wgLang, $wgUser;
     $name = $repo->getName();
     $code = SpecialPage::getTitleFor('Code', $name);
     $links[] = "[[{$code}/comments|" . wfMsgHtml('code-notes') . "]]";
     $links[] = "[[{$code}/statuschanges|" . wfMsgHtml('code-statuschanges') . "]]";
     if ($wgUser->getId()) {
         $author = $repo->wikiUserAuthor($wgUser->getName());
         if ($author !== false) {
             $links[] = "[[{$code}/author/{$author}|" . wfMsgHtml('code-mycommits') . "]]";
         }
     }
     if ($wgUser->isAllowed('codereview-post-comment')) {
         $userName = $wgUser->getName();
         $links[] = "[[{$code}/comments/author/{$userName}|" . wfMsgHtml('code-mycomments') . "]]";
     }
     $links[] = "[[{$code}/tag|" . wfMsgHtml('code-tags') . "]]";
     $links[] = "[[{$code}/author|" . wfMsgHtml('code-authors') . "]]";
     $links[] = "[[{$code}/status|" . wfMsgHtml('code-status') . "]]";
     $links[] = "[[{$code}/releasenotes|" . wfMsgHtml('code-releasenotes') . "]]";
     $links[] = "[[{$code}/stats|" . wfMsgHtml('code-stats') . "]]";
     if ($wgUser->isAllowed('repoadmin')) {
         $links[] = "[[Special:RepoAdmin/{$name}|" . wfMsgHtml('repoadmin-nav') . "]]";
     }
     $text = "'''[[{$code}|{$name}]]''' " . wfMsg('parentheses', $wgLang->pipeList($links));
     return $text;
 }
 public function getContributorsText($title)
 {
     global $wgUser, $wgLang;
     $this->target = $title;
     $contribText = '';
     if ($this->target->exists()) {
         $total = 0;
         $skin = $wgUser->getSkin();
         $link = $skin->makeKnownLinkObj($this->target);
         $contribText .= '<h2>' . wfMsgHtml('contributors-subtitle', $link) . '</h2>';
         list($contributors, $others) = $this->getMainContributors($title);
         $contribText .= '<ul>';
         foreach ($contributors as $username => $info) {
             list($id, $count) = $info;
             $line = $skin->userLink($id, $username) . $skin->userToolLinks($id, $username);
             $line .= ' [' . $wgLang->formatNum($count) . ']';
             $contribText .= '<li>' . $line . '</li>';
         }
         $contribText .= '</ul>';
         if ($others > 0) {
             $others = $wgLang->formatNum($others);
             $contribText .= wfMsgNoTrans('contributors-others-long', $others);
         }
     } else {
         $contribText .= '<p>' . htmlspecialchars(wfMsg('contributors-nosuchpage', $this->target->getPrefixedText())) . '</p>';
     }
     return preg_replace('/"/', '\\"', $contribText);
 }
Exemplo n.º 11
0
 /**
  * Generate the log action text corresponding to a patrol log item
  *
  * @param Title $title Title of the page that was patrolled
  * @param array $params Log parameters (from logging.log_params)
  * @param Skin $skin Skin to use for building links, etc.
  * @return string
  */
 public static function makeActionText($title, $params, $skin)
 {
     list($cur, , $auto) = $params;
     if (is_object($skin)) {
         # Standard link to the page in question
         $link = $skin->makeLinkObj($title);
         if ($title->exists()) {
             # Generate a diff link
             $bits[] = 'oldid=' . urlencode($cur);
             $bits[] = 'diff=prev';
             $bits = implode('&', $bits);
             $diff = $skin->makeKnownLinkObj($title, htmlspecialchars(wfMsg('patrol-log-diff', $cur)), $bits);
         } else {
             # Don't bother with a diff link, it's useless
             $diff = htmlspecialchars(wfMsg('patrol-log-diff', $cur));
         }
         # Indicate whether or not the patrolling was automatic
         $auto = $auto ? wfMsgHtml('patrol-log-auto') : '';
         # Put it all together
         return wfMsgHtml('patrol-log-line', $diff, $link, $auto);
     } else {
         $text = $title->getPrefixedText();
         return wfMsgForContent('patrol-log-line', wfMsgHtml('patrol-log-diff', $cur), "[[{$text}]]", '');
     }
 }
Exemplo n.º 12
0
 function linkStatus()
 {
     if (!$this->mUser) {
         return wfMsg('code-author-orphan', $this->authorLink($this->mAuthor));
     }
     return wfMsgHtml('code-author-haslink', $this->skin->userLink($this->mUser->getId(), $this->mUser->getName()) . $this->skin->userToolLinks($this->mUser->getId(), $this->mUser->getName(), false, Linker::TOOL_LINKS_EMAIL));
 }
Exemplo n.º 13
0
	/**
	 * Returns HTML5 output of the form
	 * GLOBALS: $wgLang, $wgScript
	 * @return string
	 */
	protected function getForm() {
		global $wgLang, $wgScript;

		$form = Xml::tags( 'form',
			array(
				'action' => $wgScript,
				'method' => 'get'
			),

			'<table><tr><td>' .
				wfMsgHtml( 'translate-page-language' ) .
			'</td><td>' .
				TranslateUtils::languageSelector( $wgLang->getCode(), $this->options['language'] ) .
			'</td></tr><tr><td>' .
				wfMsgHtml( 'translate-magic-module' ) .
			'</td><td>' .
				$this->moduleSelector( $this->options['module'] ) .
			'</td></tr><tr><td colspan="2">' .
				Xml::submitButton( wfMsg( 'translate-magic-submit' ) ) . ' ' .
				Xml::submitButton( wfMsg( 'translate-magic-cm-export' ), array( 'name' => 'export' ) ) .
			'</td></tr></table>' .
			Html::hidden( 'title', $this->getTitle()->getPrefixedText() )
		);
		return $form;
	}
Exemplo n.º 14
0
function wfSpamDiffToolOnDiffView( $diffEngine, $oldRev, $newRev ) {
	global $wgOut, $wgUser, $wgSpamBlacklistArticle;

	$sb = Title::newFromDBKey( $wgSpamBlacklistArticle );
	if ( !$sb->userCan( 'edit' ) ) {
		return true;
	}

	if ( !$oldRev || !$newRev ) {
		return true;
	}

	$wgOut->addHTML(
		'<table style="width:100%"><tr><td style="width:50%"></td><td style="width:50%">
		<div style="text-align:center">[' . $wgUser->getSkin()->link(
			SpecialPage::getTitleFor( 'SpamDiffTool' ),
			wfMsgHtml( 'spamdifftool_spam_link_text' ),
			array(),
			array(
				'target' => $diffEngine->getTitle()->getPrefixedDBkey(),
				'oldid2' => $oldRev->getId(),
				'diff2' => $newRev->getId(),
				'returnto' => $_SERVER['QUERY_STRING']
			) ) .
		']</div></td></tr></table>' );

	return true;
}
Exemplo n.º 15
0
 /**
  * @param WebRequest $request
  */
 function show($request)
 {
     global $wgOut, $wgUser;
     $first = $this->revisions[0];
     $wgOut->addWikiText(wfMsg('revdelete-selected', $this->page->getPrefixedText()));
     $wgOut->addHtml("<ul>");
     foreach ($this->revisions as $revid) {
         $rev = Revision::newFromTitle($this->page, $revid);
         $wgOut->addHtml($this->historyLine($rev));
         $bitfields[] = $rev->mDeleted;
         // FIXME
     }
     $wgOut->addHtml("</ul>");
     $wgOut->addWikiText(wfMsg('revdelete-text'));
     $items = array(wfInputLabel(wfMsg('revdelete-log'), 'wpReason', 'wpReason', 60), wfSubmitButton(wfMsg('revdelete-submit')));
     $hidden = array(wfHidden('wpEditToken', $wgUser->editToken()), wfHidden('target', $this->page->getPrefixedText()));
     foreach ($this->revisions as $revid) {
         $hidden[] = wfHidden('oldid[]', $revid);
     }
     $special = Title::makeTitle(NS_SPECIAL, 'Revisiondelete');
     $wgOut->addHtml(wfElement('form', array('method' => 'post', 'action' => $special->getLocalUrl('action=submit'))));
     $wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('revdelete-legend') . '</legend>');
     foreach ($this->checks as $item) {
         list($message, $name, $field) = $item;
         $wgOut->addHtml('<div>' . wfCheckLabel(wfMsg($message), $name, $name, $rev->isDeleted($field)) . '</div>');
     }
     $wgOut->addHtml('</fieldset>');
     foreach ($items as $item) {
         $wgOut->addHtml('<p>' . $item . '</p>');
     }
     foreach ($hidden as $item) {
         $wgOut->addHtml($item);
     }
     $wgOut->addHtml('</form>');
 }
Exemplo n.º 16
0
function wfSpecialRestrictUser($par = null)
{
    global $wgOut, $wgRequest;
    $user = $userOrig = null;
    if ($par) {
        $userOrig = $par;
    } elseif ($wgRequest->getVal('user')) {
        $userOrig = $wgRequest->getVal('user');
    } else {
        $wgOut->addHTML(RestrictUserForm::selectUserForm());
        return;
    }
    $isIP = User::isIP($userOrig);
    $user = $isIP ? $userOrig : User::getCanonicalName($userOrig);
    $uid = User::idFromName($user);
    if (!$uid && !$isIP) {
        $err = '<strong class="error">' . wfMsgHtml('restrictuser-notfound') . '</strong>';
        $wgOut->addHTML(RestrictUserForm::selectUserForm($userOrig, $err));
        return;
    }
    $wgOut->addHTML(RestrictUserForm::selectUserForm($user));
    UserRestriction::purgeExpired();
    $old = UserRestriction::fetchForUser($user, true);
    RestrictUserForm::pageRestrictionForm($uid, $user, $old);
    RestrictUserForm::namespaceRestrictionForm($uid, $user, $old);
    // Renew it after possible changes in previous two functions
    $old = UserRestriction::fetchForUser($user, true);
    if ($old) {
        $wgOut->addHTML(RestrictUserForm::existingRestrictions($old));
    }
}
Exemplo n.º 17
0
 /**
  * Format a row, providing the timestamp, links to the page/history, size, user links, and a comment
  *
  * @param $skin Skin to use
  * @param $result Result row
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $dm = $wgContLang->getDirMark();
     $statusMsg = @FamilyTreeUtil::$STATUS_MESSAGES[$result->fg_status];
     if (!$statusMsg) {
         $statusMsg = "Error {$result->fg_status}";
     }
     $statusDate = $wgLang->timeAndDate($result->fg_status_date, true);
     $statusReason = $result->fg_status_reason ? htmlspecialchars(': ' . $result->fg_status_reason) : '';
     $userid = User::idFromName($result->ft_user);
     $ulink = $skin->userLink($userid, $result->ft_user) . $skin->userToolLinks($userid, $result->ft_user);
     if ($result->fg_status >= FG_STATUS_READY && $result->fg_status <= FG_STATUS_ADMIN_REVIEW || $result->fg_status == FG_STATUS_HOLD) {
         $filename = '<a href="/gedcom/index.php?gedcomId=' . $result->fg_id . '" rel="nofollow">' . htmlspecialchars($result->fg_gedcom_filename) . '</a>';
     } else {
         $filename = htmlspecialchars($result->fg_gedcom_filename);
     }
     $filesize = wfMsgHtml('nbytes', $wgLang->formatNum(htmlspecialchars($result->fg_file_size)));
     $reviewerid = User::idFromName($result->fg_reviewer);
     if ($result->fg_reviewer) {
         $rlink = " reviewer: " . $skin->userLink($reviewerid, $result->fg_reviewer) . $skin->userToolLinks($reviewerid, $result->fg_reviewer);
     } else {
         if ($result->fg_status == FG_STATUS_ADMIN_REVIEW) {
             $rlink = ' <b>needs admin review</b>';
         } else {
             $rlink = '';
         }
     }
     return "{$statusDate} <i>{$statusMsg}{$statusReason}</i> {$dm}{$filename} [{$filesize}] {$ulink} {$dm}{$rlink}";
 }
Exemplo n.º 18
0
 function formatResult($skin, $result)
 {
     global $wgUser, $wgContLang, $wgLang;
     $fromObj = Title::makeTitle($result->namespace, $result->title);
     if (isset($result->rd_title)) {
         $toObj = Title::makeTitle($result->rd_namespace, $result->rd_title);
     } else {
         $blinks = $fromObj->getBrokenLinksFrom();
         # TODO: check for redirect, not for links
         if ($blinks) {
             $toObj = $blinks[0];
         } else {
             $toObj = false;
         }
     }
     // $toObj may very easily be false if the $result list is cached
     if (!is_object($toObj)) {
         return '<s>' . $skin->link($fromObj) . '</s>';
     }
     $from = $skin->linkKnown($fromObj, null, array(), array('redirect' => 'no'));
     $links = array();
     $links[] = $skin->linkKnown($fromObj, wfMsgHtml('brokenredirects-edit'), array(), array('action' => 'edit'));
     $to = $skin->link($toObj, null, array(), array(), array('broken'));
     $arr = $wgContLang->getArrow();
     $out = $from . wfMsg('word-separator');
     if ($wgUser->isAllowed('delete')) {
         $links[] = $skin->linkKnown($fromObj, wfMsgHtml('brokenredirects-delete'), array(), array('action' => 'delete'));
     }
     $out .= wfMsg('parentheses', $wgLang->pipeList($links));
     $out .= " {$arr} {$to}";
     return $out;
 }
 function formatResult($skin, $result)
 {
     $title = Title::makeTitle(NS_TEMPLATE, $result->title);
     $pageLink = $skin->makeKnownLinkObj($title, '', 'redirect=no');
     $wlhLink = $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Whatlinkshere'), wfMsgHtml('unusedtemplateswlh'), 'target=' . $title->getPrefixedUrl());
     return wfSpecialList($pageLink, $wlhLink);
 }
 public function formatRow($row)
 {
     $title = Title::newFromRow($row);
     # Link to page
     $link = Linker::link($title);
     # Link to page configuration
     $config = Linker::linkKnown(SpecialPage::getTitleFor('Stabilization'), wfMsgHtml('configuredpages-config'), array(), 'page=' . $title->getPrefixedUrl());
     # Show which version is the default (stable or draft)
     if (intval($row->fpc_override)) {
         $default = wfMsgHtml('configuredpages-def-stable');
     } else {
         $default = wfMsgHtml('configuredpages-def-draft');
     }
     # Autoreview/review restriction level
     $restr = '';
     if ($row->fpc_level != '') {
         $restr = 'autoreview=' . htmlspecialchars($row->fpc_level);
         $restr = "[{$restr}]";
     }
     # When these configuration settings expire
     if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) {
         $expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")";
     } else {
         $expiry_description = "";
     }
     return "<li>{$link} ({$config}) <b>[{$default}]</b> " . "{$restr}<i>{$expiry_description}</i></li>";
 }
Exemplo n.º 21
0
 /**
  * Main execution point
  *
  * @param $code Confirmation code passed to the page
  */
 function execute($code)
 {
     global $wgUser, $wgOut;
     $this->setHeaders();
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (empty($code)) {
         if ($wgUser->isLoggedIn()) {
             if (User::isValidEmailAddr($wgUser->getEmail())) {
                 $this->showRequestForm();
             } else {
                 $wgOut->addWikiMsg('confirmemail_noemail');
             }
         } else {
             $title = SpecialPage::getTitleFor('Userlogin');
             $skin = $wgUser->getSkin();
             $llink = $skin->linkKnown($title, wfMsgHtml('loginreqlink'), array(), array('returnto' => $this->getTitle()->getPrefixedText()));
             $wgOut->addHTML(wfMsgWikiHtml('confirmemail_needlogin', $llink));
         }
     } else {
         $this->attemptConfirm($code);
     }
 }
Exemplo n.º 22
0
 /**
  * Generate the log action text corresponding to a patrol log item
  *
  * @param Title $title Title of the page that was patrolled
  * @param array $params Log parameters (from logging.log_params)
  * @param Skin $skin Skin to use for building links, etc.
  * @return string
  */
 public static function makeActionText($title, $params, $skin)
 {
     # This is a bit of a hack, but...if $skin is not a Skin, then *do nothing*
     # -- this is fine, because the action text we would be queried for under
     # these conditions would have gone into recentchanges, which we aren't
     # supposed to be updating
     if (is_object($skin)) {
         list($cur, , $auto) = $params;
         # Standard link to the page in question
         $link = $skin->makeLinkObj($title);
         if ($title->exists()) {
             # Generate a diff link
             $bits[] = 'oldid=' . urlencode($cur);
             $bits[] = 'diff=prev';
             $bits = implode('&', $bits);
             $diff = $skin->makeKnownLinkObj($title, htmlspecialchars(wfMsg('patrol-log-diff', $cur)), $bits);
         } else {
             # Don't bother with a diff link, it's useless
             $diff = htmlspecialchars(wfMsg('patrol-log-diff', $cur));
         }
         # Indicate whether or not the patrolling was automatic
         $auto = $auto ? wfMsgHtml('patrol-log-auto') : '';
         # Put it all together
         return wfMsgHtml('patrol-log-line', $diff, $link, $auto);
     } else {
         return '';
     }
 }
Exemplo n.º 23
0
/**
 * sub function generating the list of pages
 * @param $pages the list of pages
 * @param $heading header to be used
 * @param $sk skin object ???
 */
function wfSpecialSpecialpages_gen($pages, $heading, $sk)
{
    global $wgOut, $wgSortSpecialPages;
    if (count($pages) == 0) {
        # Yeah, that was pointless. Thanks for coming.
        return;
    }
    /** Put them into a sortable array */
    $sortedPages = array();
    foreach ($pages as $page) {
        if ($page->isListed()) {
            $sortedPages[$page->getDescription()] = $page->getTitle();
        }
    }
    /** Sort */
    if ($wgSortSpecialPages) {
        ksort($sortedPages);
    }
    /** Now output the HTML */
    $wgOut->addHTML('<h2>' . wfMsgHtml($heading) . "</h2>\n<ul>");
    foreach ($sortedPages as $desc => $title) {
        $link = $sk->makeKnownLinkObj($title, $desc);
        $wgOut->addHTML("<li>{$link}</li>\n");
    }
    $wgOut->addHTML("</ul>\n");
}
 public function formatRow($row)
 {
     $title = Title::makeTitle($row->page_namespace, $row->page_title);
     // Link to page
     $link = Linker::link($title);
     // Helpful utility links
     $utilLinks = array();
     $utilLinks[] = Linker::link($title, wfMsgHtml('stablepages-config'), array(), array('action' => 'protect'), 'known');
     $utilLinks[] = Linker::link($title, wfMsgHtml('history'), array(), array('action' => 'history'), 'known');
     $utilLinks[] = Linker::link(SpecialPage::getTitleFor('Log', 'stable'), wfMsgHtml('stable-logpage'), array(), array('page' => $title->getPrefixedText()), 'known');
     // Autoreview/review restriction level
     $restr = '';
     if ($row->fpc_level != '') {
         $restr = 'autoreview=' . htmlspecialchars($row->fpc_level);
         $restr = "[{$restr}]";
     }
     // When these configuration settings expire
     if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) {
         $expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")";
     } else {
         $expiry_description = "";
     }
     $utilLinks = $this->getLang()->pipeList($utilLinks);
     return "<li>{$link} ({$utilLinks}) {$restr}<i>{$expiry_description}</i></li>";
 }
Exemplo n.º 25
0
 function showForm($err = '')
 {
     global $wgOut, $wgUser, $wgRequest;
     $token = htmlspecialchars($wgUser->getEditToken());
     $titleObj = Title::makeTitle(NS_SPECIAL, 'deletebatch');
     $action = $titleObj->escapeLocalURL("action=submit");
     if ("" != $err) {
         $wgOut->setSubtitle(wfMsgHtml('formerror'));
         $wgOut->addHTML("<p class='error'>{$err}</p>\n");
     }
     $wgOut->addWikiMsg('deletebatch_help');
     /* don't bother writing up former parameters if not error */
     if ('submit' == $wgRequest->getVal('action') && '' != $err) {
         $scPage = htmlspecialchars($this->mPage);
         $scReason = htmlspecialchars($this->mReason);
         $scFile = htmlspecialchars($this->mFile);
     } else {
         $scPage = '';
         $scReason = '';
         $scFile = '';
     }
     $wgOut->addHtml("\n<form name=\"deletebatch\" enctype=\"multipart/form-data\" method=\"post\" action=\"{$action}\">\n\t<table border=\"0\">\n\t\t<tr>\n                        <td align=\"right\">" . wfMsg('deletebatch_as') . " :</td>\n                        <td align=\"left\">");
     $this->makeSelect('wpMode', array(wfMsg('deletebatch_select_script') => 'script', wfMsg('deletebatch_select_yourself') => 'you'), $this->mMode, 1);
     $wgOut->addHtml("</td>\n                </tr>\n\t\t<tr>\n\t\t\t<td align=\"right\" style=\"vertical-align:top\">" . wfMsg('deletebatch_page') . " :</td>\n\t\t\t<td align=\"left\">\n\t\t\t\t<textarea tabindex=\"3\" name=\"wpPage\" id=\"wpPage\" cols=\"40\" rows=\"10\"></textarea>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align=\"right\">" . wfMsg('deletebatch_or') . "&#160;</td>\n\t\t\t<td align=\"left\">\n\t\t\t\t&#160;\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align=\"right\">" . wfMsg('deletebatch_caption') . " :</td>\n\t\t\t<td align=\"left\">\n\t\t\t\t<input type=\"file\" tabindex=\"4\" name=\"wpFile\" id=\"wpFile\" value=\"{$scFile}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align=\"right\">&#160;</td>\n\t\t\t<td align=\"left\">\n\t\t\t\t<input tabindex=\"5\" name=\"wpdeletebatchSubmit\" type=\"submit\" value=\"" . wfMsg('deletebatch_button') . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<input type='hidden' name='wpEditToken' value=\"{$token}\" />\n</form>");
 }
Exemplo n.º 26
0
 function showForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     $self = SpecialPage::getTitleFor('Resetpass');
     $form = '<div id="userloginForm">' . wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl())) . '<h2>' . wfMsgHtml('resetpass_header') . '</h2>' . '<div id="userloginprompt">' . wfMsgExt('resetpass_text', array('parse')) . '</div>' . '<table>' . wfHidden('token', $wgUser->editToken()) . wfHidden('wpName', $this->mName) . wfHidden('wpPassword', $this->mTemporaryPassword) . wfHidden('returnto', $wgRequest->getVal('returnto')) . $this->pretty(array(array('wpName', 'username', 'text', $this->mName), array('wpNewPassword', 'newpassword', 'password', ''), array('wpRetype', 'yourpasswordagain', 'password', ''))) . '<tr>' . '<td></td>' . '<td>' . Xml::checkLabel(wfMsg('remembermypassword'), 'wpRemember', 'wpRemember', $wgRequest->getCheck('wpRemember')) . '</td>' . '</tr>' . '<tr>' . '<td></td>' . '<td>' . wfSubmitButton(wfMsgHtml('resetpass_submit')) . '</td>' . '</tr>' . '</table>' . wfCloseElement('form') . '</div>';
     $wgOut->addHtml($form);
 }
Exemplo n.º 27
0
 function formatResult($skin, $result)
 {
     $title = Title::makeTitle(NS_TEMPLATE, $result->title);
     $pageLink = $skin->linkKnown($title, null, array(), array('redirect' => 'no'));
     $wlhLink = $skin->linkKnown(SpecialPage::getTitleFor('Whatlinkshere'), wfMsgHtml('unusedtemplateswlh'), array(), array('target' => $title->getPrefixedText()));
     return wfSpecialList($pageLink, $wlhLink);
 }
Exemplo n.º 28
0
function wfLinkOpenIDRenderPrefs($prefs, $out)
{
    $out->addHTML("<fieldset><legend>" . wfMsgHtml('linkopenid-prefs') . "</legend>");
    $out->addWikiMsg('linkopenid-prefstext-pre');
    $out->addHTML("<table>" . "<tr><td>" . wfMsgHtml('linkopenid-prefstext-openid') . "</td><td>" . "<input type='text' name='wflinkopenid_openid' size='60' value='" . htmlentities($prefs->wfLinkOpenID['openid']) . "'></td></tr>" . "<tr><td>" . wfMsgHtml('linkopenid-prefstext-v1url') . "</td><td>" . "<input type='text' name='wflinkopenid_v1url' size='60' value='" . htmlentities($prefs->wfLinkOpenID['v1url']) . "'></td></tr>" . "<tr><td>" . wfMsgHtml('linkopenid-prefstext-v2url') . "</td><td>" . "<input type='text' name='wflinkopenid_v2url' size='60' value='" . htmlentities($prefs->wfLinkOpenID['v2url']) . "'></td></tr>" . "<tr><td>" . wfMsgHtml('linkopenid-prefstext-xrdsurl') . "</td><td>" . "<input type='text' name='wflinkopenid_xrdsurl' size='60' value='" . htmlentities($prefs->wfLinkOpenID['xrdsurl']) . "'></td></tr>" . "</table></fieldset>");
    return TRUE;
}
Exemplo n.º 29
0
 function doTagRow($tag, $hitcount)
 {
     static $sk = null, $doneTags = array();
     if (!$sk) {
         $sk = $this->getSkin();
     }
     if (in_array($tag, $doneTags)) {
         return '';
     }
     global $wgLang;
     $newRow = '';
     $newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
     $disp = ChangeTags::tagDescription($tag);
     $disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsgHtml('tags-edit')) . ')';
     $newRow .= Xml::tags('td', null, $disp);
     $msg = wfMessage("tag-{$tag}-description");
     $desc = !$msg->exists() ? '' : $msg->parse();
     $desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsgHtml('tags-edit')) . ')';
     $newRow .= Xml::tags('td', null, $desc);
     $hitcount = wfMsgExt('tags-hitcount', array('parsemag'), $wgLang->formatNum($hitcount));
     $hitcount = $sk->link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
     $newRow .= Xml::tags('td', null, $hitcount);
     $doneTags[] = $tag;
     return Xml::tags('tr', null, $newRow) . "\n";
 }
Exemplo n.º 30
0
 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             // date and time are separate parameters to facilitate localisation.
             // $time is kept for backward compat reasons.
             // 'emailauthenticated' is also used in SpecialPreferences.php
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $d = $wgLang->date($wgUser->mEmailAuthenticated, true);
             $t = $wgLang->time($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time, $d, $t);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->addWikiMsg('confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $self = SpecialPage::getTitleFor('Confirmemail');
         $form = Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
         $form .= Xml::hidden('token', $wgUser->editToken());
         $form .= Xml::submitButton(wfMsgHtml('confirmemail_send'));
         $form .= Xml::closeElement('form');
         $wgOut->addHTML($form);
     }
 }