本文整理汇总了PHP中LogPage::extractParams方法的典型用法代码示例。如果您正苦于以下问题:PHP LogPage::extractParams方法的具体用法?PHP LogPage::extractParams怎么用?PHP LogPage::extractParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogPage
的用法示例。
在下文中一共展示了LogPage::extractParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCheckUserData
/**
* Hook function for RecentChange_save
* Saves user data into the cu_changes table
*/
public static function updateCheckUserData(RecentChange $rc)
{
global $wgRequest;
// Extract params
extract($rc->mAttribs);
// Get IP
$ip = wfGetIP();
// Get XFF header
$xff = $wgRequest->getHeader('X-Forwarded-For');
list($xff_ip, $isSquidOnly) = self::getClientIPfromXFF($xff);
// Get agent
$agent = $wgRequest->getHeader('User-Agent');
// Store the log action text for log events
// $rc_comment should just be the log_comment
// BC: check if log_type and log_action exists
// If not, then $rc_comment is the actiontext and comment
if (isset($rc_log_type) && $rc_type == RC_LOG) {
$target = Title::makeTitle($rc_namespace, $rc_title);
$actionText = LogPage::actionText($rc_log_type, $rc_log_action, $target, null, LogPage::extractParams($rc_params));
} else {
$actionText = '';
}
$dbw = wfGetDB(DB_MASTER);
$cuc_id = $dbw->nextSequenceValue('cu_changes_cu_id_seq');
$rcRow = array('cuc_id' => $cuc_id, 'cuc_namespace' => $rc_namespace, 'cuc_title' => $rc_title, 'cuc_minor' => $rc_minor, 'cuc_user' => $rc_user, 'cuc_user_text' => $rc_user_text, 'cuc_actiontext' => $actionText, 'cuc_comment' => $rc_comment, 'cuc_this_oldid' => $rc_this_oldid, 'cuc_last_oldid' => $rc_last_oldid, 'cuc_type' => $rc_type, 'cuc_timestamp' => $rc_timestamp, 'cuc_ip' => IP::sanitizeIP($ip), 'cuc_ip_hex' => $ip ? IP::toHex($ip) : null, 'cuc_xff' => !$isSquidOnly ? $xff : '', 'cuc_xff_hex' => $xff_ip && !$isSquidOnly ? IP::toHex($xff_ip) : null, 'cuc_agent' => $agent);
# On PG, MW unsets cur_id due to schema incompatibilites. So it may not be set!
if (isset($rc_cur_id)) {
$rcRow['cuc_page_id'] = $rc_cur_id;
}
$dbw->insert('cu_changes', $rcRow, __METHOD__);
return true;
}
示例2: formatDiff
/**
* Format a diff for the newsfeed
*
* @param $row Object: row from the recentchanges table
* @return String
*/
public static function formatDiff($row)
{
global $wgUser;
$titleObj = Title::makeTitle($row->rc_namespace, $row->rc_title);
$timestamp = wfTimestamp(TS_MW, $row->rc_timestamp);
$actiontext = '';
if ($row->rc_type == RC_LOG) {
if ($row->rc_deleted & LogPage::DELETED_ACTION) {
$actiontext = wfMsgHtml('rev-deleted-event');
} else {
$actiontext = LogPage::actionText($row->rc_log_type, $row->rc_log_action, $titleObj, $wgUser->getSkin(), LogPage::extractParams($row->rc_params, true, true));
}
}
return self::formatDiffRow($titleObj, $row->rc_last_oldid, $row->rc_this_oldid, $timestamp, $row->rc_deleted & Revision::DELETED_COMMENT ? wfMsgHtml('rev-deleted-comment') : $row->rc_comment, $actiontext);
}
示例3: logLine
/**
* @param Array $row row
* @returns string
*/
private function logLine($row)
{
global $wgLang;
$date = $wgLang->timeanddate($row->log_timestamp);
$paramArray = LogPage::extractParams($row->log_params);
$title = Title::makeTitle($row->log_namespace, $row->log_title);
$logtitle = SpecialPage::getTitleFor('Log');
$loglink = $this->skin->makeKnownLinkObj($logtitle, wfMsgHtml('log'), wfArrayToCGI(array('page' => $title->getPrefixedUrl())));
// Action text
if (!LogEventsList::userCan($row, LogPage::DELETED_ACTION)) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$action = LogPage::actionText($row->log_type, $row->log_action, $title, $this->skin, $paramArray, true, true);
if ($row->log_deleted & LogPage::DELETED_ACTION) {
$action = '<span class="history-deleted">' . $action . '</span>';
}
}
// User links
$userLink = $this->skin->userLink($row->log_user, User::WhoIs($row->log_user));
if (LogEventsList::isDeleted($row, LogPage::DELETED_USER)) {
$userLink = '<span class="history-deleted">' . $userLink . '</span>';
}
// Comment
$comment = $wgLang->getDirMark() . $this->skin->commentBlock($row->log_comment);
if (LogEventsList::isDeleted($row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
return "<li>({$loglink}) {$date} {$userLink} {$action} {$comment}</li>";
}
示例4: logLine
/**
* @param $row Row: a single row from the result set
* @return String: Formatted HTML list item
*/
public function logLine($row)
{
$classes = array('mw-logline-' . $row->log_type);
$title = Title::makeTitle($row->log_namespace, $row->log_title);
// Log time
$time = $this->logTimestamp($row);
// User links
$userLink = $this->logUserLinks($row);
// Extract extra parameters
$paramArray = LogPage::extractParams($row->log_params);
// Event description
$action = $this->logAction($row, $title, $paramArray);
// Log comment
$comment = $this->logComment($row);
// Add review/revert links and such...
$revert = $this->logActionLinks($row, $title, $paramArray, $comment);
// Some user can hide log items and have review links
$del = $this->getShowHideLinks($row);
if ($del != '') {
$del .= ' ';
}
// Any tags...
list($tagDisplay, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'logevent');
$classes = array_merge($classes, $newClasses);
return Xml::tags('li', array("class" => implode(' ', $classes)), $del . "{$time} {$userLink} {$action} {$comment} {$revert} {$tagDisplay}") . "\n";
}
示例5: getParameters
public function getParameters()
{
if (!isset($this->params)) {
$blob = $this->getRawParameters();
MediaWiki\suppressWarnings();
$params = LogEntryBase::extractParams($blob);
MediaWiki\restoreWarnings();
if ($params !== false) {
$this->params = $params;
$this->legacy = false;
} else {
$this->params = LogPage::extractParams($blob);
$this->legacy = true;
}
}
return $this->params;
}
示例6: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgUser;
$skin = $wgUser->getSkin();
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinksRedContribs($s->log_user, $s->user_name);
$comment = $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
// show revertmove link
if ($s->log_type == 'move' && isset($paramArray[0])) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// show undelete link
} elseif ($s->log_action == 'delete' && $wgUser->isAllowed('delete', $s->log_namespace)) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), wfMsg('undeletebtn'), 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// show unblock link
} elseif ($s->log_action == 'block' && $wgUser->isAllowed('block')) {
$revert = '(' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Ipblocklist'), wfMsg('unblocklink'), 'action=unblock&ip=' . urlencode($s->log_title)) . ')';
// show change protection link
} elseif ($s->log_action == 'protect' && $wgUser->isAllowed('protect', $s->log_namespace)) {
$revert = '(' . $skin->makeKnownLink($title->getPrefixedDBkey(), wfMsg('protect_change'), 'action=unprotect') . ')';
// show user tool links for self created users
} elseif ($s->log_action == 'create2') {
$revert = $this->skin->userToolLinksRedContribs($s->log_user, $s->log_title);
// do not show $comment for self created accounts. It includes wrong user tool links:
// 'blockip' for users w/o block allowance and broken links for very long usernames (bug 4756)
$comment = '';
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例7: getHTML
public function getHTML()
{
$date = htmlspecialchars($this->list->getLang()->timeanddate($this->row->log_timestamp));
$paramArray = LogPage::extractParams($this->row->log_params);
$title = Title::makeTitle($this->row->log_namespace, $this->row->log_title);
// Log link for this page
$loglink = Linker::link(SpecialPage::getTitleFor('Log'), wfMsgHtml('log'), array(), array('page' => $title->getPrefixedText()));
// Action text
if (!$this->canView()) {
$action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$skin = $this->list->getUser()->getSkin();
$action = LogPage::actionText($this->row->log_type, $this->row->log_action, $title, $skin, $paramArray, true, true);
if ($this->row->log_deleted & LogPage::DELETED_ACTION) {
$action = '<span class="history-deleted">' . $action . '</span>';
}
}
// User links
$userLink = Linker::userLink($this->row->log_user, User::WhoIs($this->row->log_user));
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_USER)) {
$userLink = '<span class="history-deleted">' . $userLink . '</span>';
}
// Comment
$comment = $this->list->getLang()->getDirMark() . Linker::commentBlock($this->row->log_comment);
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
return "<li>({$loglink}) {$date} {$userLink} {$action} {$comment}</li>";
}
示例8: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgLinkCache;
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$user = Title::makeTitleSafe(NS_USER, $s->user_name);
$time = $wgLang->timeanddate($s->log_timestamp, true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
if ($s->page_id) {
$wgLinkCache->addGoodLinkObj($s->page_id, $title);
} else {
$wgLinkCache->addBadLinkObj($title);
}
$userLink = $this->skin->makeLinkObj($user, htmlspecialchars($s->user_name));
$comment = $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
if ($s->log_type == 'move' && isset($paramArray[0])) {
$specialTitle = Title::makeTitle(NS_SPECIAL, 'Movepage');
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj($specialTitle, wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例9: logLine
/**
* @param $row Row: a single row from the result set
* @return String: Formatted HTML list item
*/
public function logLine($row)
{
# start wikia change
$this->fixUserName($row);
# end wikia change
$entry = DatabaseLogEntry::newFromRow($row);
$formatter = LogFormatter::newFromEntry($entry);
$formatter->setShowUserToolLinks(!($this->flags & self::NO_EXTRA_USER_LINKS));
$action = $formatter->getActionText();
$comment = $formatter->getComment();
$classes = array('mw-logline-' . $entry->getType());
$title = $entry->getTarget();
$time = $this->logTimestamp($entry);
// Extract extra parameters
$paramArray = LogPage::extractParams($row->log_params);
// Add review/revert links and such...
$revert = $this->logActionLinks($row, $title, $paramArray, $comment);
// Some user can hide log items and have review links
$del = $this->getShowHideLinks($row);
if ($del != '') {
$del .= ' ';
}
// Any tags...
list($tagDisplay, $newClasses) = ChangeTags::formatSummaryRow($row->ts_tags, 'logevent');
$classes = array_merge($classes, $newClasses);
return Xml::tags('li', array("class" => implode(' ', $classes)), $del . "{$time} {$action} {$comment} {$revert} {$tagDisplay}") . "\n";
}
示例10: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgUser, $wgContLang;
$skin = $wgUser->getSkin();
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinksRedContribs($s->log_user, $s->user_name);
$comment = $wgContLang->getDirMark() . $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
// show revertmove link
if (!($this->flags & self::NO_ACTION_LINK)) {
if ($s->log_type == 'move' && isset($paramArray[0])) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// show undelete link
} elseif ($s->log_action == 'delete' && $wgUser->isAllowed('delete')) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), wfMsg('undeletebtn'), 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// show unblock link
} elseif ($s->log_action == 'block' && $wgUser->isAllowed('block')) {
$revert = '(' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Ipblocklist'), wfMsg('unblocklink'), 'action=unblock&ip=' . urlencode($s->log_title)) . ')';
// show change protection link
} elseif (($s->log_action == 'protect' || $s->log_action == 'modify') && $wgUser->isAllowed('protect')) {
$revert = '(' . $skin->makeKnownLinkObj($title, wfMsg('protect_change'), 'action=unprotect') . ')';
// show user tool links for self created users
// TODO: The extension should be handling this, get it out of core!
} elseif ($s->log_action == 'create2') {
if (isset($paramArray[0])) {
$revert = $this->skin->userToolLinks($paramArray[0], $s->log_title, true);
} else {
# Fall back to a blue contributions link
$revert = $this->skin->userToolLinks(1, $s->log_title);
}
# Suppress $comment from old entries, not needed and can contain incorrect links
$comment = '';
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例11: logLine
/**
* @param $row Row: a single row from the result set
* @return String: Formatted HTML list item
*/
public function logLine($row)
{
global $wgLang, $wgUser, $wgContLang;
$title = Title::makeTitle($row->log_namespace, $row->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $row->log_timestamp), true);
// User links
if (self::isDeleted($row, LogPage::DELETED_USER)) {
$userLink = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
} else {
$userLink = $this->skin->userLink($row->log_user, $row->user_name) . $this->skin->userToolLinks($row->log_user, $row->user_name, true, 0, $row->user_editcount);
}
// Comment
if (self::isDeleted($row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
} else {
$comment = $wgContLang->getDirMark() . $this->skin->commentBlock($row->log_comment);
}
// Extract extra parameters
$paramArray = LogPage::extractParams($row->log_params);
$revert = $del = '';
// Some user can hide log items and have review links
if ($wgUser->isAllowed('deleterevision')) {
$del = $this->getShowHideLinks($row) . ' ';
}
// Add review links and such...
if ($this->flags & self::NO_ACTION_LINK || $row->log_deleted & LogPage::DELETED_ACTION) {
// Action text is suppressed...
} else {
if (self::typeAction($row, 'move', 'move', 'move') && !empty($paramArray[0])) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), $this->message['revertmove'], 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// Show undelete link
} else {
if (self::typeAction($row, array('delete', 'suppress'), 'delete', 'delete')) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), $this->message['undeletelink'], 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// Show unblock/change block link
} else {
if (self::typeAction($row, array('block', 'suppress'), array('block', 'reblock'), 'block')) {
$revert = '(' . $this->skin->link(SpecialPage::getTitleFor('Ipblocklist'), $this->message['unblocklink'], array(), array('action' => 'unblock', 'ip' => $row->log_title), 'known') . ' ' . $this->message['pipe-separator'] . ' ' . $this->skin->link(SpecialPage::getTitleFor('Blockip', $row->log_title), $this->message['change-blocklink'], array(), array(), 'known') . ')';
// Show change protection link
} else {
if (self::typeAction($row, 'protect', array('modify', 'protect', 'unprotect'))) {
$revert .= ' (' . $this->skin->link($title, $this->message['hist'], array(), array('action' => 'history', 'offset' => $row->log_timestamp));
if ($wgUser->isAllowed('protect')) {
$revert .= ' ' . $this->message['pipe-separator'] . ' ' . $this->skin->link($title, $this->message['protect_change'], array(), array('action' => 'protect'), 'known');
}
$revert .= ')';
// Show unmerge link
} else {
if (self::typeAction($row, 'merge', 'merge', 'mergehistory')) {
$merge = SpecialPage::getTitleFor('Mergehistory');
$revert = '(' . $this->skin->makeKnownLinkObj($merge, $this->message['revertmerge'], wfArrayToCGI(array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(), 'mergepoint' => $paramArray[1]))) . ')';
// If an edit was hidden from a page give a review link to the history
} else {
if (self::typeAction($row, array('delete', 'suppress'), 'revision', 'deleterevision')) {
if (count($paramArray) == 2) {
$revdel = SpecialPage::getTitleFor('Revisiondelete');
// Different revision types use different URL params...
$key = $paramArray[0];
// Link to each hidden object ID, $paramArray[1] is the url param
$Ids = explode(',', $paramArray[1]);
$revParams = '';
foreach ($Ids as $n => $id) {
$revParams .= '&' . urlencode($key) . '[]=' . urlencode($id);
}
$revert = '(' . $this->skin->makeKnownLinkObj($revdel, $this->message['revdel-restore'], 'target=' . $title->getPrefixedUrl() . $revParams) . ')';
}
// Hidden log items, give review link
} else {
if (self::typeAction($row, array('delete', 'suppress'), 'event', 'deleterevision')) {
if (count($paramArray) == 1) {
$revdel = SpecialPage::getTitleFor('Revisiondelete');
$Ids = explode(',', $paramArray[0]);
// Link to each hidden object ID, $paramArray[1] is the url param
$logParams = '';
foreach ($Ids as $n => $id) {
$logParams .= '&logid[]=' . intval($id);
}
$revert = '(' . $this->skin->makeKnownLinkObj($revdel, $this->message['revdel-restore'], 'target=' . $title->getPrefixedUrl() . $logParams) . ')';
}
// Self-created users
} else {
if (self::typeAction($row, 'newusers', 'create2')) {
if (isset($paramArray[0])) {
$revert = $this->skin->userToolLinks($paramArray[0], $title->getDBkey(), true);
} else {
# Fall back to a blue contributions link
$revert = $this->skin->userToolLinks(1, $title->getDBkey());
}
if ($time < '20080129000000') {
# Suppress $comment from old entries (before 2008-01-29),
# not needed and can contain incorrect links
$comment = '';
}
//.........这里部分代码省略.........
示例12: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang;
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$user = Title::makeTitleSafe(NS_USER, $s->user_name);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinks($s->log_user, $s->user_name);
$comment = $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
if ($s->log_type == 'move' && isset($paramArray[0])) {
$specialTitle = Title::makeTitle(NS_SPECIAL, 'Movepage');
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj($specialTitle, wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
}
// WERELATE: newuser log
global $wgUser;
if ($s->log_type == 'newuser') {
if (!$wgUser->isAllowed('block')) {
// block normal users from seeing IP addresses
$comment = '';
} else {
if (isset($paramArray[0])) {
// add a block link
$specialTitle = Title::makeTitle(NS_SPECIAL, 'Blockip');
$revert = '(' . $this->skin->makeKnownLinkObj($specialTitle, wfMsgHtml('blocklink') . ' IP', 'ip=' . urlencode($paramArray[0])) . ')';
}
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例13: logLine
/**
* @param Object $s a single row from the result set
* @return string Formatted HTML list item
* @private
*/
function logLine($s)
{
global $wgLang, $wgUser, $wgContLang;
$skin = $wgUser->getSkin();
$title = Title::makeTitle($s->log_namespace, $s->log_title);
$time = $wgLang->timeanddate(wfTimestamp(TS_MW, $s->log_timestamp), true);
// Enter the existence or non-existence of this page into the link cache,
// for faster makeLinkObj() in LogPage::actionText()
$linkCache =& LinkCache::singleton();
if ($s->page_id) {
$linkCache->addGoodLinkObj($s->page_id, $title);
} else {
$linkCache->addBadLinkObj($title);
}
$userLink = $this->skin->userLink($s->log_user, $s->user_name) . $this->skin->userToolLinksRedContribs($s->log_user, $s->user_name);
$comment = $wgContLang->getDirMark() . $this->skin->commentBlock($s->log_comment);
$paramArray = LogPage::extractParams($s->log_params);
$revert = '';
// show revertmove link
if (!($this->flags & self::NO_ACTION_LINK)) {
if ($s->log_type == 'move' && isset($paramArray[0]) && $wgUser->isAllowed('move')) {
$destTitle = Title::newFromText($paramArray[0]);
if ($destTitle) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Movepage'), wfMsg('revertmove'), 'wpOldTitle=' . urlencode($destTitle->getPrefixedDBkey()) . '&wpNewTitle=' . urlencode($title->getPrefixedDBkey()) . '&wpReason=' . urlencode(wfMsgForContent('revertmove')) . '&wpMovetalk=0') . ')';
}
// show undelete link
} elseif ($s->log_action == 'delete' && $wgUser->isAllowed('delete')) {
$revert = '(' . $this->skin->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete'), wfMsg('undeletelink'), 'target=' . urlencode($title->getPrefixedDBkey())) . ')';
// show unblock link
} elseif ($s->log_action == 'block' && $wgUser->isAllowed('block')) {
$revert = '(' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Ipblocklist'), wfMsg('unblocklink'), 'action=unblock&ip=' . urlencode($s->log_title)) . ')';
// show change protection link
} elseif (($s->log_action == 'protect' || $s->log_action == 'modify') && $wgUser->isAllowed('protect')) {
$revert = '(' . $skin->makeKnownLinkObj($title, wfMsg('protect_change'), 'action=unprotect') . ')';
// Show unmerge link
} elseif ($s->log_action == 'merge') {
$merge = SpecialPage::getTitleFor('Mergehistory');
$revert = '(' . $this->skin->makeKnownLinkObj($merge, wfMsg('revertmerge'), wfArrayToCGI(array('target' => $paramArray[0], 'dest' => $title->getPrefixedText(), 'mergepoint' => $paramArray[1]))) . ')';
} elseif (wfRunHooks('LogLine', array($s->log_type, $s->log_action, $title, $paramArray, &$comment, &$revert, $s->log_timestamp))) {
// wfDebug( "Invoked LogLine hook for " $s->log_type . ", " . $s->log_action . "\n" );
// Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
}
}
$action = LogPage::actionText($s->log_type, $s->log_action, $title, $this->skin, $paramArray, true);
$out = "<li>{$time} {$userLink} {$action} {$comment} {$revert}</li>\n";
return $out;
}
示例14: recentChangesBlockLine
/**
* Enhanced RC ungrouped line.
*
* @param $rcObj RecentChange
* @return String: a HTML formated 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 = 'mw-enhanced-rc ' . Sanitizer::escapeClass('mw-changeslist-log-' . $logType . '-' . $rcObj->mAttribs['rc_title']);
} 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} . . ";
}
# User/talk
$r .= ' ' . $rcObj->userlink . $rcObj->usertalklink;
# Log action (if any)
if ($logType) {
if ($this->isDeleted($rcObj, LogPage::DELETED_ACTION)) {
$r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$r .= ' ' . LogPage::actionText($logType, $rcObj->mAttribs['rc_log_action'], $rcObj->getTitle(), $this->getSkin(), LogPage::extractParams($rcObj->mAttribs['rc_params']), true, true);
}
}
$this->insertComment($r, $rcObj);
$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;
}
示例15: 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;
}