本文整理匯總了PHP中LogPage::logName方法的典型用法代碼示例。如果您正苦於以下問題:PHP LogPage::logName方法的具體用法?PHP LogPage::logName怎麽用?PHP LogPage::logName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類LogPage
的用法示例。
在下文中一共展示了LogPage::logName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wfSpecialRevisiondelete
/**
* Special page allowing users with the appropriate permissions to view
* and hide revisions. Log items can also be hidden.
*
* @file
* @ingroup SpecialPage
*/
function wfSpecialRevisiondelete($par = null)
{
global $wgOut, $wgRequest, $wgUser;
# Handle our many different possible input types
$target = $wgRequest->getText('target');
$oldid = $wgRequest->getArray('oldid');
$artimestamp = $wgRequest->getArray('artimestamp');
$logid = $wgRequest->getArray('logid');
$img = $wgRequest->getArray('oldimage');
$fileid = $wgRequest->getArray('fileid');
# For reviewing deleted files...
$file = $wgRequest->getVal('file');
# If this is a revision, then we need a target page
$page = Title::newFromUrl($target);
if (is_null($page)) {
$wgOut->addWikiMsg('undelete-header');
return;
}
# Only one target set at a time please!
$i = (bool) $file + (bool) $oldid + (bool) $logid + (bool) $artimestamp + (bool) $fileid + (bool) $img;
if ($i !== 1) {
$wgOut->showErrorPage('revdelete-nooldid-title', 'revdelete-nooldid-text');
return;
}
# Logs must have a type given
if ($logid && !strpos($page->getDBKey(), '/')) {
$wgOut->showErrorPage('revdelete-nooldid-title', 'revdelete-nooldid-text');
return;
}
# Either submit or create our form
$form = new RevisionDeleteForm($page, $oldid, $logid, $artimestamp, $fileid, $img, $file);
if ($wgRequest->wasPosted()) {
$form->submit($wgRequest);
} else {
if ($oldid || $artimestamp) {
$form->showRevs();
} else {
if ($fileid || $img) {
$form->showImages();
} else {
if ($logid) {
$form->showLogItems();
}
}
}
}
# Show relevant lines from the deletion log. This will show even if said ID
# does not exist...might be helpful
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
LogEventsList::showLogExtract($wgOut, 'delete', $page->getPrefixedText());
if ($wgUser->isAllowed('suppressionlog')) {
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('suppress')) . "</h2>\n");
LogEventsList::showLogExtract($wgOut, 'suppress', $page->getPrefixedText());
}
}
示例2: showHistory
function showHistory()
{
global $wgLang, $wgContLang, $wgUser, $wgOut;
$sk = $wgUser->getSkin();
if ($this->mAllowed) {
$wgOut->setPagetitle(wfMsg("undeletepage"));
} else {
$wgOut->setPagetitle(wfMsg('viewdeletedpage'));
}
$archive = new PageArchive($this->mTargetObj);
/*
$text = $archive->getLastRevisionText();
if( is_null( $text ) ) {
$wgOut->addWikiMsg( "nohistory" );
return;
}
*/
if ($this->mAllowed) {
$wgOut->addWikiMsg("undeletehistory");
} else {
$wgOut->addWikiMsg("undeletehistorynoadmin");
}
# List all stored revisions
$revisions = $archive->listRevisions();
$files = $archive->listFiles();
$haveRevisions = $revisions && $revisions->numRows() > 0;
$haveFiles = $files && $files->numRows() > 0;
# Batch existence check on user and talk pages
if ($haveRevisions) {
$batch = new LinkBatch();
while ($row = $revisions->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->ar_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->ar_user_text));
}
$batch->execute();
$revisions->seek(0);
}
if ($haveFiles) {
$batch = new LinkBatch();
while ($row = $files->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->fa_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->fa_user_text));
}
$batch->execute();
$files->seek(0);
}
if ($this->mAllowed) {
$titleObj = SpecialPage::getTitleFor("Undelete");
$action = $titleObj->getLocalURL("action=submit");
# Start the form here
$top = Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'undelete'));
$wgOut->addHtml($top);
}
# Show relevant lines from the deletion log:
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
$logViewer = new LogViewer(new LogReader(new FauxRequest(array('page' => $this->mTargetObj->getPrefixedText(), 'type' => 'delete'))), LogViewer::NO_ACTION_LINK);
$logViewer->showList($wgOut);
if ($this->mAllowed && ($haveRevisions || $haveFiles)) {
# Format the user-visible controls (comment field, submission button)
# in a nice little table
$align = $wgContLang->isRtl() ? 'left' : 'right';
$table = Xml::openElement('fieldset') . Xml::openElement('table') . "<tr>\n\t\t\t\t\t\t<td colspan='2'>" . wfMsgWikiHtml('undeleteextrahelp') . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='{$align}'>" . Xml::label(wfMsg('undeletecomment'), 'wpComment') . "</td>\n\t\t\t\t\t\t<td>" . Xml::input('wpComment', 50, $this->mComment) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td>" . Xml::submitButton(wfMsg('undeletebtn'), array('name' => 'restore', 'id' => 'mw-undelete-submit')) . Xml::element('input', array('type' => 'reset', 'value' => wfMsg('undeletereset'), 'id' => 'mw-undelete-reset')) . "</td>\n\t\t\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset');
$wgOut->addHtml($table);
}
$wgOut->addHTML("<h2>" . htmlspecialchars(wfMsg("history")) . "</h2>\n");
if ($haveRevisions) {
# The page's stored (deleted) history:
$wgOut->addHTML("<ul>");
$target = urlencode($this->mTarget);
$remaining = $revisions->numRows();
$earliestLiveTime = $this->getEarliestTime($this->mTargetObj);
while ($row = $revisions->fetchObject()) {
$remaining--;
$ts = wfTimestamp(TS_MW, $row->ar_timestamp);
if ($this->mAllowed) {
$checkBox = Xml::check("ts{$ts}");
$pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}×tamp={$ts}");
if ($remaining > 0 || $earliestLiveTime && $ts > $earliestLiveTime) {
$diffLink = '(' . $sk->makeKnownLinkObj($titleObj, wfMsgHtml('diff'), "target={$target}×tamp={$ts}&diff=prev") . ')';
} else {
// No older revision to diff against
$diffLink = '';
}
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate($ts, true);
$diffLink = '';
}
$userLink = $sk->userLink($row->ar_user, $row->ar_user_text) . $sk->userToolLinks($row->ar_user, $row->ar_user_text);
$stxt = '';
if (!is_null($size = $row->ar_len)) {
if ($size == 0) {
$stxt = wfMsgHtml('historyempty');
} else {
$stxt = wfMsgHtml('historysize', $wgLang->formatNum($size));
}
}
$comment = $sk->commentBlock($row->ar_comment);
$wgOut->addHTML("<li>{$checkBox} {$pageLink} {$diffLink} . . {$userLink} {$stxt} {$comment}</li>\n");
}
//.........這裏部分代碼省略.........
示例3: recentChangesBlockLine
/**
* Enhanced RC ungrouped line.
*
* @param $rcObj RecentChange
* @return String: a HTML formatted line (generated using $r)
*/
protected function recentChangesBlockLine($rcObj)
{
global $wgRCShowChangedSize;
wfProfileIn(__METHOD__);
$query['curid'] = $rcObj->mAttribs['rc_cur_id'];
$type = $rcObj->mAttribs['rc_type'];
$logType = $rcObj->mAttribs['rc_log_type'];
if ($logType) {
# Log entry
$classes = Sanitizer::escapeClass('mw-changeslist-log-' . $logType);
} else {
$classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title']);
}
$r = Html::openElement('table', array('class' => $classes)) . Html::openElement('tr');
$r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow();
# Flag and Timestamp
if ($type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT) {
$r .= '    ';
// 4 flags -> 4 spaces
} else {
$r .= $this->recentChangesFlags(array('newpage' => $type == RC_NEW, 'minor' => $rcObj->mAttribs['rc_minor'], 'unpatrolled' => $rcObj->unpatrolled, 'bot' => $rcObj->mAttribs['rc_bot']));
}
$r .= ' ' . $rcObj->timestamp . ' </td><td>';
# Article or log link
if ($logType) {
$logtitle = SpecialPage::getTitleFor('Log', $logType);
$logname = LogPage::logName($logType);
$r .= '(' . Linker::linkKnown($logtitle, htmlspecialchars($logname)) . ')';
} else {
$this->insertArticleLink($r, $rcObj, $rcObj->unpatrolled, $rcObj->watched);
}
# Diff and hist links
if ($type != RC_LOG) {
$r .= ' (' . $rcObj->difflink . $this->message['pipe-separator'];
$query['action'] = 'history';
$r .= Linker::linkKnown($rcObj->getTitle(), $this->message['hist'], array(), $query) . ')';
}
$r .= ' . . ';
# Character diff
if ($wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference())) {
$r .= "{$cd} . . ";
}
if ($type == RC_LOG) {
$r .= $this->insertLogEntry($rcObj);
} else {
$r .= ' ' . $rcObj->userlink . $rcObj->usertalklink;
$r .= $this->insertComment($rcObj);
$r .= $this->insertRollback($r, $rcObj);
}
# Tags
$classes = explode(' ', $classes);
$this->insertTags($r, $rcObj, $classes);
# Show how many people are watching this if enabled
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
$r .= "</td></tr></table>\n";
wfProfileOut(__METHOD__);
return $r;
}
示例4: showLogFragment
/**
* Show a rights log fragment for the specified user
*
* @param $user User to show log for
* @param $output OutputPage to use
*/
protected function showLogFragment($user, $output)
{
$output->addHTML(Xml::element('h2', null, LogPage::logName('rights') . "\n"));
LogEventsList::showLogExtract($output, 'rights', $user->getUserPage()->getPrefixedText());
}
示例5: recentChangesBlockLine
/**
* Enhanced RC ungrouped line.
* @return string a HTML formated line (generated using $r)
*/
protected function recentChangesBlockLine($rcObj)
{
global $wgContLang, $wgRCShowChangedSize;
wfProfileIn(__METHOD__);
# Extract fields from DB into the function scope (rc_xxxx variables)
// FIXME: Would be good to replace this extract() call with something
// that explicitly initializes variables.
$classes = array();
// TODO implement
extract($rcObj->mAttribs);
$curIdEq = "curid={$rc_cur_id}";
$r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
$r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . ' ';
# Flag and Timestamp
if ($rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
$r .= ' ';
// 4 flags -> 4 spaces
} else {
$r .= $this->recentChangesFlags($rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot);
}
$r .= ' ' . $rcObj->timestamp . ' </tt></td><td>';
# Article or log link
if ($rc_log_type) {
$logtitle = Title::newFromText("Log/{$rc_log_type}", NS_SPECIAL);
$logname = LogPage::logName($rc_log_type);
$r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname) . ')';
} else {
$this->insertArticleLink($r, $rcObj, $rcObj->unpatrolled, $rcObj->watched);
}
# Diff and hist links
if ($rc_type != RC_LOG) {
$r .= ' (' . $rcObj->difflink . $this->message['semicolon-separator'];
$r .= $this->skin->makeKnownLinkObj($rcObj->getTitle(), $this->message['hist'], $curIdEq . '&action=history') . ')';
}
$r .= ' . . ';
# Character diff
if ($wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference())) {
$r .= "{$cd} . . ";
}
# User/talk
$r .= ' ' . $rcObj->userlink . $rcObj->usertalklink;
# Log action (if any)
if ($rc_log_type) {
if ($this->isDeleted($rcObj, LogPage::DELETED_ACTION)) {
$r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$r .= ' ' . LogPage::actionText($rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true);
}
}
$this->insertComment($r, $rcObj);
$this->insertRollback($r, $rcObj);
# Tags
$this->insertTags($r, $rcObj, $classes);
# Show how many people are watching this if enabled
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
$r .= "</td></tr></table>\n";
wfProfileOut(__METHOD__);
return $r;
}
示例6: recentChangesLine
/**
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*/
function recentChangesLine(&$baseRC, $watched = false)
{
global $wgLang, $wgContLang;
# Create a specialised object
$rc = RCCacheEntry::newFromParent($baseRC);
# Extract fields from DB into the function scope (rc_xxxx variables)
// FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
extract($rc->mAttribs);
$curIdEq = 'curid=' . $rc_cur_id;
# If it's a new day, add the headline and flush the cache
$date = $wgLang->date($rc_timestamp, true);
$ret = '';
if ($date != $this->lastdate) {
# Process current cache
$ret = $this->recentChangesBlock();
$this->rc_cache = array();
$ret .= "<h4>{$date}</h4>\n";
$this->lastdate = $date;
}
// BizzWiki begin {{
$ns = $rc->getTitle()->getNamespace();
# Should patrol-related stuff be shown?
if ($this->usePatrol($ns)) {
$rc->unpatrolled = !$rc_patrolled;
} else {
$rc->unpatrolled = false;
}
// BizzWiki end }}
# Make article link
if ($rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
$msg = $rc_type == RC_MOVE ? "1movedto2" : "1movedto2_redir";
$clink = wfMsg($msg, $this->skin->makeKnownLinkObj($rc->getTitle(), '', 'redirect=no'), $this->skin->makeKnownLinkObj($rc->getMovedToTitle(), ''));
} elseif ($rc_namespace == NS_SPECIAL) {
list($specialName, $logtype) = SpecialPage::resolveAliasWithSubpage($rc_title);
if ($specialName == 'Log') {
# Log updates, etc
$logname = LogPage::logName($logtype);
$clink = '(' . $this->skin->makeKnownLinkObj($rc->getTitle(), $logname) . ')';
} else {
wfDebug("Unexpected special page in recentchanges\n");
$clink = '';
}
} elseif ($rc->unpatrolled && $rc_type == RC_NEW) {
# Unpatrolled new page, give rc_id in query
$clink = $this->skin->makeKnownLinkObj($rc->getTitle(), '', "rcid={$rc_id}");
} else {
$clink = $this->skin->makeKnownLinkObj($rc->getTitle(), '');
}
$time = $wgContLang->time($rc_timestamp, true, true);
$rc->watched = $watched;
$rc->link = $clink;
$rc->timestamp = $time;
$rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
# Make "cur" and "diff" links
if ($rc->unpatrolled) {
$rcIdQuery = "&rcid={$rc_id}";
} else {
$rcIdQuery = '';
}
$querycur = $curIdEq . "&diff=0&oldid={$rc_this_oldid}";
$querydiff = $curIdEq . "&diff={$rc_this_oldid}&oldid={$rc_last_oldid}{$rcIdQuery}";
$aprops = ' tabindex="' . $baseRC->counter . '"';
$curLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $this->message['cur'], $querycur, '', '', $aprops);
if ($rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
if ($rc_type != RC_NEW) {
$curLink = $this->message['cur'];
}
$diffLink = $this->message['diff'];
} else {
$diffLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $this->message['diff'], $querydiff, '', '', $aprops);
}
# Make "last" link
if ($rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
$lastLink = $this->message['last'];
} else {
$lastLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $this->message['last'], $curIdEq . '&diff=' . $rc_this_oldid . '&oldid=' . $rc_last_oldid . $rcIdQuery);
}
$rc->userlink = $this->skin->userLink($rc_user, $rc_user_text);
$rc->lastlink = $lastLink;
$rc->curlink = $curLink;
$rc->difflink = $diffLink;
$rc->usertalklink = $this->skin->userToolLinks($rc_user, $rc_user_text);
# Put accumulated information into the cache, for later display
# Page moves go on their own line
$title = $rc->getTitle();
$secureName = $title->getPrefixedDBkey();
if ($rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
# Use an @ character to prevent collision with page names
$this->rc_cache['@@' . $this->rcMoveIndex++] = array($rc);
} else {
if (!isset($this->rc_cache[$secureName])) {
$this->rc_cache[$secureName] = array();
}
array_push($this->rc_cache[$secureName], $rc);
}
return $ret;
}
示例7: showHistory
function showHistory()
{
global $wgLang, $wgUser, $wgOut;
$sk = $wgUser->getSkin();
if ($this->mAllowed) {
$wgOut->setPagetitle(wfMsg("undeletepage"));
} else {
$wgOut->setPagetitle(wfMsg('viewdeletedpage'));
}
$archive = new PageArchive($this->mTargetObj);
$text = $archive->getLastRevisionText();
/*
if( is_null( $text ) ) {
$wgOut->addWikiText( wfMsg( "nohistory" ) );
return;
}
*/
if ($this->mAllowed) {
$wgOut->addWikiText(wfMsg("undeletehistory"));
} else {
$wgOut->addWikiText(wfMsg("undeletehistorynoadmin"));
}
# List all stored revisions
$revisions = $archive->listRevisions();
$files = $archive->listFiles();
$haveRevisions = $revisions && $revisions->numRows() > 0;
$haveFiles = $files && $files->numRows() > 0;
# Batch existence check on user and talk pages
if ($haveRevisions) {
$batch = new LinkBatch();
while ($row = $revisions->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->ar_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->ar_user_text));
}
$batch->execute();
$revisions->seek(0);
}
if ($haveFiles) {
$batch = new LinkBatch();
while ($row = $files->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->fa_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->fa_user_text));
}
$batch->execute();
$files->seek(0);
}
if ($this->mAllowed) {
$titleObj = Title::makeTitle(NS_SPECIAL, "Undelete");
$action = $titleObj->getLocalURL("action=submit");
# Start the form here
$top = wfOpenElement('form', array('method' => 'post', 'action' => $action, 'id' => 'undelete'));
$wgOut->addHtml($top);
}
# Show relevant lines from the deletion log:
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
$logViewer = new LogViewer(new LogReader(new FauxRequest(array('page' => $this->mTargetObj->getPrefixedText(), 'type' => 'delete'))));
$logViewer->showList($wgOut);
if ($this->mAllowed && ($haveRevisions || $haveFiles)) {
# Format the user-visible controls (comment field, submission button)
# in a nice little table
$table = '<fieldset><table><tr>';
$table .= '<td colspan="2">' . wfMsgWikiHtml('undeleteextrahelp') . '</td></tr><tr>';
$table .= '<td align="right"><strong>' . wfMsgHtml('undeletecomment') . '</strong></td>';
$table .= '<td>' . wfInput('wpComment', 50, $this->mComment) . '</td>';
$table .= '</tr><tr><td> </td><td>';
$table .= wfSubmitButton(wfMsg('undeletebtn'), array('name' => 'restore'));
$table .= wfElement('input', array('type' => 'reset', 'value' => wfMsg('undeletereset')));
$table .= '</td></tr></table></fieldset>';
$wgOut->addHtml($table);
}
$wgOut->addHTML("<h2>" . htmlspecialchars(wfMsg("history")) . "</h2>\n");
if ($haveRevisions) {
# The page's stored (deleted) history:
$wgOut->addHTML("<ul>");
$target = urlencode($this->mTarget);
while ($row = $revisions->fetchObject()) {
$ts = wfTimestamp(TS_MW, $row->ar_timestamp);
if ($this->mAllowed) {
$checkBox = wfCheck("ts{$ts}");
$pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}×tamp={$ts}");
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate($ts, true);
}
$userLink = $sk->userLink($row->ar_user, $row->ar_user_text) . $sk->userToolLinks($row->ar_user, $row->ar_user_text);
$comment = $sk->commentBlock($row->ar_comment);
$wgOut->addHTML("<li>{$checkBox} {$pageLink} . . {$userLink} {$comment}</li>\n");
}
$revisions->free();
$wgOut->addHTML("</ul>");
} else {
$wgOut->addWikiText(wfMsg("nohistory"));
}
if ($haveFiles) {
$wgOut->addHtml("<h2>" . wfMsgHtml('imghistory') . "</h2>\n");
$wgOut->addHtml("<ul>");
while ($row = $files->fetchObject()) {
$ts = wfTimestamp(TS_MW, $row->fa_timestamp);
if ($this->mAllowed && $row->fa_storage_key) {
$checkBox = wfCheck("fileid" . $row->fa_id);
//.........這裏部分代碼省略.........
示例8: execute
//.........這裏部分代碼省略.........
return;
}
$this->skin =& $wgUser->getSkin();
# Set title and such
$this->setHeaders();
$this->outputHeader();
$this->wasPosted = $wgRequest->wasPosted();
# Handle our many different possible input types
$this->target = $wgRequest->getText('target');
$this->oldids = $wgRequest->getArray('oldid');
$this->artimestamps = $wgRequest->getArray('artimestamp');
$this->logids = $wgRequest->getArray('logid');
$this->oldimgs = $wgRequest->getArray('oldimage');
$this->fileids = $wgRequest->getArray('fileid');
# For reviewing deleted files...
$this->file = $wgRequest->getVal('file');
# Only one target set at a time please!
$i = (bool) $this->file + (bool) $this->oldids + (bool) $this->logids + (bool) $this->artimestamps + (bool) $this->fileids + (bool) $this->oldimgs;
# No targets?
if ($i == 0) {
$wgOut->showErrorPage('notargettitle', 'notargettext');
return;
}
# Too many targets?
if ($i !== 1) {
$wgOut->showErrorPage('revdelete-toomanytargets-title', 'revdelete-toomanytargets-text');
return;
}
$this->page = Title::newFromUrl($this->target);
# If we have revisions, get the title from the first one
# since they should all be from the same page. This allows
# for more flexibility with page moves...
if (count($this->oldids) > 0) {
$rev = Revision::newFromId($this->oldids[0]);
$this->page = $rev ? $rev->getTitle() : $this->page;
}
# We need a target page!
if (is_null($this->page)) {
$wgOut->addWikiMsg('undelete-header');
return;
}
# Logs must have a type given
if ($this->logids && !strpos($this->page->getDBKey(), '/')) {
$wgOut->showErrorPage('revdelete-nologtype-title', 'revdelete-nologtype-text');
return;
}
# For reviewing deleted files...show it now if allowed
if ($this->file) {
$oimage = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName($this->page, $this->file);
$oimage->load();
// Check if user is allowed to see this file
if (!$oimage->userCan(File::DELETED_FILE)) {
$wgOut->permissionRequired('suppressrevision');
} else {
$this->showFile($this->file);
}
return;
}
# Give a link to the logs/hist for this page
if (!is_null($this->page) && $this->page->getNamespace() > -1) {
$links = array();
$logtitle = SpecialPage::getTitleFor('Log');
$links[] = $this->skin->makeKnownLinkObj($logtitle, wfMsgHtml('viewpagelogs'), wfArrayToCGI(array('page' => $this->page->getPrefixedUrl())));
# Give a link to the page history
$links[] = $this->skin->makeKnownLinkObj($this->page, wfMsgHtml('pagehist'), wfArrayToCGI(array('action' => 'history')));
# Link to deleted edits
if ($wgUser->isAllowed('undelete')) {
$undelete = SpecialPage::getTitleFor('Undelete');
$links[] = $this->skin->makeKnownLinkObj($undelete, wfMsgHtml('deletedhist'), wfArrayToCGI(array('target' => $this->page->getPrefixedDBkey())));
}
# Logs themselves don't have histories or archived revisions
$wgOut->setSubtitle('<p>' . implode($links, ' / ') . '</p>');
}
# Lock the operation and the form context
$this->secureOperation();
# Either submit or create our form
if ($this->wasPosted) {
$this->submit($wgRequest);
} else {
if ($this->deleteKey == 'oldid' || $this->deleteKey == 'artimestamp') {
$this->showRevs();
} else {
if ($this->deleteKey == 'fileid' || $this->deleteKey == 'oldimage') {
$this->showImages();
} else {
if ($this->deleteKey == 'logid') {
$this->showLogItems();
}
}
}
}
# Show relevant lines from the deletion log. This will show even if said ID
# does not exist...might be helpful
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
LogEventsList::showLogExtract($wgOut, 'delete', $this->page->getPrefixedText());
if ($wgUser->isAllowed('suppressionlog')) {
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('suppress')) . "</h2>\n");
LogEventsList::showLogExtract($wgOut, 'suppress', $this->page->getPrefixedText());
}
}
示例9: recentChangesLineNew
function recentChangesLineNew(&$baseRC, $watched = false)
{
global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans;
static $message;
if (!isset($message)) {
foreach (explode(' ', 'cur diff hist minoreditletter newpageletter last blocklink undo diff-to-lvr ' . 'diff-to-lvr_tooltiptext cur_tooltiptext diff_tooltiptext last_tooltiptext updatedmarker updatedmarker_tooltiptext ') as $msg) {
$message[$msg] = wfMsg($msg);
}
}
# Create a specialised object
$rc = RCCacheEntry::newFromParent($baseRC);
# Extract fields from DB into the function scope (rc_xxxx variables)
extract($rc->mAttribs);
$curIdEq = 'curid=' . $rc_cur_id;
# If it's a new day, add the headline and flush the cache
$date = $wgLang->date($rc_timestamp, true);
$ret = '';
if ($date != $this->lastdate) {
# Process current cache
$ret = $this->recentChangesBlock();
$this->rc_cache = array();
$ret .= "<h4>{$date}</h4>\n";
$this->lastdate = $date;
}
# Should patrol-related stuff be shown?
if ($wgUseRCPatrol && $wgUser->isLoggedIn() && (!$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol'))) {
$rc->unpatrolled = !$rc_patrolled;
} else {
$rc->unpatrolled = false;
}
# Make article link
if ($rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
$msg = $rc_type == RC_MOVE ? "1movedto2" : "1movedto2_redir";
$clink = wfMsg($msg, $this->skin->makeKnownLinkObj($rc->getTitle(), '', 'redirect=no'), $this->skin->makeKnownLinkObj($rc->getMovedToTitle(), ''));
} elseif ($rc_namespace == NS_SPECIAL && preg_match('!^Log/(.*)$!', $rc_title, $matches)) {
# Log updates, etc
$logtype = $matches[1];
$logname = LogPage::logName($logtype);
$clink = '(' . $this->skin->makeKnownLinkObj($rc->getTitle(), $logname) . ')';
} elseif ($rc->unpatrolled && $rc_type == RC_NEW) {
# Unpatrolled new page, give rc_id in query
$clink = $this->skin->makeKnownLinkObj($rc->getTitle(), '', "rcid={$rc_id}");
} else {
$clink = $this->skin->makeKnownLinkObj($rc->getTitle(), '');
}
$time = $wgContLang->time($rc_timestamp, true, true);
$rc->watched = $watched;
$rc->link = $clink;
$rc->timestamp = $time;
$rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
$rc->lastvisitedrevision = $baseRC->lastvisitedrevision;
$rc->notificationtimestamp = $baseRC->notificationtimestamp;
# Make "cur" and "diff" links
$titleObj = $rc->getTitle();
if ($rc->unpatrolled) {
$rcIdQuery = "&rcid={$rc_id}";
} else {
$rcIdQuery = '';
}
$query = $curIdEq . "&diff={$rc_this_oldid}&oldid={$rc_last_oldid}";
$aprops = ' tabindex="' . $baseRC->counter . '"';
$curLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $message['cur'], $query, '', '', $aprops);
if ($rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
if ($rc_type != RC_NEW) {
$curLink = $message['cur'];
}
$diffLink = $message['diff'];
} else {
# $query = $curIdEq.'&diff=0&oldid='.$rc_this_oldid;
$query = $curIdEq . "&diff={$rc_this_oldid}&oldid={$rc_last_oldid}";
$aprops = ' tabindex="' . $baseRC->counter . '"';
$curLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $message['cur'], $query, '', '', $aprops, $message['cur_tooltiptext']);
$diffLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $message['diff'], $query . $rcIdQuery, '', '', $aprops, $message['diff_tooltiptext']);
}
# Make "last" link
if ($rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT) {
$lastLink = $message['last'];
} else {
$lastLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $message['last'], $curIdEq . '&diff=' . $rc_this_oldid . '&oldid=' . $rc_last_oldid . $rcIdQuery, '', '', '', $message['last_tooltiptext']);
}
# Make user link (or user contributions for unregistered users)
if ($rc_user == 0) {
$contribsPage =& Title::makeTitle(NS_SPECIAL, 'Contributions');
$userLink = $this->skin->makeKnownLinkObj($contribsPage, $rc_user_text, 'target=' . $rc_user_text);
} else {
$userPage =& Title::makeTitle(NS_USER, $rc_user_text);
$userLink = $this->skin->makeLinkObj($userPage, $rc_user_text);
}
if ($watched && $baseRC->lastvisitedrevision) {
$lvrLink = $this->skin->makeKnownLinkObj($rc->getTitle(), $message['diff-to-lvr'], "{$curIdEq}&diff=0&oldid={$baseRC->lastvisitedrevision}", '', '', '', $message['diff-to-lvr_tooltiptext']);
} else {
$lvrLink = '';
}
$rc->lvrlink = $lvrLink;
$rc->userlink = $userLink;
$rc->lastlink = $lastLink;
$rc->curlink = $curLink;
$rc->difflink = $diffLink;
# Make user talk link
$talkname = $wgContLang->getNsText(NS_TALK);
//.........這裏部分代碼省略.........
示例10: getTypeMenu
/**
* @return string Formatted HTML
* @private
*/
function getTypeMenu()
{
$out = "<select name='type'>\n";
$validTypes = LogPage::validTypes();
$m = array();
// Temporary array
// First pass to load the log names
foreach ($validTypes as $type) {
$text = LogPage::logName($type);
$m[$text] = $type;
}
// Second pass to sort by name
ksort($m);
// Third pass generates sorted XHTML content
foreach ($m as $text => $type) {
$selected = $type == $this->reader->queryType();
$out .= Xml::option($text, $type, $selected) . "\n";
}
$out .= '</select>';
return $out;
}
示例11: showLogFragment
function showLogFragment($title)
{
$out = $this->getOutput();
$out->addHTML(Xml::element('h2', null, LogPage::logName('move')));
LogEventsList::showLogExtract($out, 'move', $title);
}
示例12: showLogEntries
/**
* Show deletion log fragments pertaining to the current file
*/
private function showLogEntries()
{
global $wgOut;
$wgOut->addHTML('<h2>' . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
LogEventsList::showLogExtract($wgOut, 'delete', $this->title->getPrefixedText());
}
示例13: showHistory
private function showHistory()
{
global $wgUser, $wgOut;
$this->sk = $this->getSkin();
$wgOut->setPageTitle(wfMsg('mergehistory'));
$this->showMergeForm();
# List all stored revisions
$revisions = new MergeHistoryPager($this, array(), $this->mTargetObj, $this->mDestObj);
$haveRevisions = $revisions && $revisions->getNumRows() > 0;
$titleObj = $this->getTitle();
$action = $titleObj->getLocalURL(array('action' => 'submit'));
# Start the form here
$top = Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'merge'));
$wgOut->addHTML($top);
if ($haveRevisions) {
# Format the user-visible controls (comment field, submission button)
# in a nice little table
$table = Xml::openElement('fieldset') . wfMsgExt('mergehistory-merge', array('parseinline'), $this->mTargetObj->getPrefixedText(), $this->mDestObj->getPrefixedText()) . Xml::openElement('table', array('id' => 'mw-mergehistory-table')) . '<tr>
<td class="mw-label">' . Xml::label(wfMsg('mergehistory-reason'), 'wpComment') . '</td>
<td class="mw-input">' . Xml::input('wpComment', 50, $this->mComment, array('id' => 'wpComment')) . '</td>
</tr>
<tr>
<td> </td>
<td class="mw-submit">' . Xml::submitButton(wfMsg('mergehistory-submit'), array('name' => 'merge', 'id' => 'mw-merge-submit')) . '</td>
</tr>' . Xml::closeElement('table') . Xml::closeElement('fieldset');
$wgOut->addHTML($table);
}
$wgOut->addHTML('<h2 id="mw-mergehistory">' . wfMsgHtml('mergehistory-list') . "</h2>\n");
if ($haveRevisions) {
$wgOut->addHTML($revisions->getNavigationBar());
$wgOut->addHTML('<ul>');
$wgOut->addHTML($revisions->getBody());
$wgOut->addHTML('</ul>');
$wgOut->addHTML($revisions->getNavigationBar());
} else {
$wgOut->addWikiMsg('mergehistory-empty');
}
# Show relevant lines from the deletion log:
$wgOut->addHTML('<h2>' . htmlspecialchars(LogPage::logName('merge')) . "</h2>\n");
LogEventsList::showLogExtract($wgOut, 'merge', $this->mTargetObj->getPrefixedText());
# When we submit, go by page ID to avoid some nasty but unlikely collisions.
# Such would happen if a page was renamed after the form loaded, but before submit
$misc = Html::hidden('targetID', $this->mTargetObj->getArticleID());
$misc .= Html::hidden('destID', $this->mDestObj->getArticleID());
$misc .= Html::hidden('target', $this->mTarget);
$misc .= Html::hidden('dest', $this->mDest);
$misc .= Html::hidden('wpEditToken', $wgUser->editToken());
$misc .= Xml::closeElement('form');
$wgOut->addHTML($misc);
return true;
}
示例14: showLogExtract
/**
* @param OutputPage $out
* @access private
*/
function showLogExtract(&$out)
{
# Show relevant lines from the protection log:
$out->addHTML(Xml::element('h2', null, LogPage::logName('protect')));
LogEventsList::showLogExtract($out, 'protect', $this->mTitle->getPrefixedText());
}
示例15: doDelete
/**
* Perform a deletion and output success or failure messages
* @param $reason
* @param $suppress bool
*/
public function doDelete($reason, $suppress = false)
{
global $wgOut;
$error = '';
if ($this->mPage->doDeleteArticle($reason, $suppress, 0, true, $error)) {
$deleted = $this->getTitle()->getPrefixedText();
$wgOut->setPageTitle(wfMessage('actioncomplete'));
$wgOut->setRobotPolicy('noindex,nofollow');
$loglink = '[[Special:Log/delete|' . wfMsgNoTrans('deletionlog') . ']]';
$wgOut->addWikiMsg('deletedtext', wfEscapeWikiText($deleted), $loglink);
$wgOut->returnToMain(false);
} else {
$wgOut->setPageTitle(wfMessage('cannotdelete-title', $this->getTitle()->getPrefixedText()));
if ($error == '') {
$wgOut->wrapWikiMsg("<div class=\"error mw-error-cannotdelete\">\n\$1\n</div>", array('cannotdelete', wfEscapeWikiText($this->getTitle()->getPrefixedText())));
$wgOut->addHTML(Xml::element('h2', null, LogPage::logName('delete')));
LogEventsList::showLogExtract($wgOut, 'delete', $this->getTitle()->getPrefixedText());
} else {
$wgOut->addHTML($error);
}
}
}