/** * @return array */ protected function getMessageParameters() { $entry = $this->entry->getParameters(); $params = parent::getMessageParameters(); $filter_title = SpecialPage::getTitleFor('AbuseFilter', $entry['filter']); $filter_caption = $this->msg('abusefilter-log-detailedentry-local')->params($entry['filter']); $log_title = SpecialPage::getTitleFor('AbuseLog', $entry['log']); $log_caption = $this->msg('abusefilter-log-detailslink'); $params[4] = $entry['action']; if ($this->plaintext) { $params[3] = '[[' . $filter_title->getPrefixedText() . '|' . $filter_caption . ']]'; $params[8] = '[[' . $log_title->getPrefixedText() . '|' . $log_caption . ']]'; } else { $params[3] = Message::rawParam(Linker::link($filter_title, htmlspecialchars($filter_caption))); $params[8] = Message::rawParam(Linker::link($log_title, htmlspecialchars($log_caption))); } $actions_taken = $entry['actions']; if (!strlen(trim($actions_taken))) { $actions_taken = $this->msg('abusefilter-log-noactions'); } else { $actions = explode(',', $actions_taken); $displayActions = array(); foreach ($actions as $action) { $displayActions[] = AbuseFilter::getActionDisplay($action); } $actions_taken = $this->context->getLanguage()->commaList($displayActions); } $params[5] = $actions_taken; // Bad things happen if the numbers are not in correct order ksort($params); return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); // Really old entries if (!isset($params[3]) && !isset($params[4])) { return $params; } $oldGroups = $this->makeGroupArray($params[3]); $newGroups = $this->makeGroupArray($params[4]); $userName = $this->entry->getTarget()->getText(); if (!$this->plaintext && count($oldGroups)) { foreach ($oldGroups as &$group) { $group = User::getGroupMember($group, $userName); } } if (!$this->plaintext && count($newGroups)) { foreach ($newGroups as &$group) { $group = User::getGroupMember($group, $userName); } } $lang = $this->context->getLanguage(); if (count($oldGroups)) { $params[3] = $lang->listToText($oldGroups); } else { $params[3] = $this->msg('rightsnone')->text(); } if (count($newGroups)) { // Array_values is used here because of bug 42211 // see use of array_unique in UserrightsPage::doSaveUserGroups on $newGroups. $params[4] = $lang->listToText(array_values($newGroups)); } else { $params[4] = $this->msg('rightsnone')->text(); } return $params; }
public function getMessageParameters() { $params = parent::getMessageParameters(); $type = $this->entry->getFullType(); if ($type === 'translationreview/message') { $targetPage = $this->makePageLink($this->entry->getTarget(), array('oldid' => $params[3])); $params[2] = Message::rawParam($targetPage); } elseif ($type === 'translationreview/group') { /* * - 3: language code * - 4: label of the message group * - 5: old state * - 6: new state */ $uiLanguage = $this->context->getLanguage(); $language = $params[3]; $targetPage = $this->makePageLinkWithText($this->entry->getTarget(), $params[4], array('language' => $language)); $params[2] = Message::rawParam($targetPage); $params[3] = TranslateUtils::getLanguageName($language, $uiLanguage->getCode()); $params[5] = $this->formatStateMessage($params[5]); $params[6] = $this->formatStateMessage($params[6]); } elseif ($type === 'translatorsandbox/rejected') { // No point linking to the user page which cannot have existed $params[2] = $this->entry->getTarget()->getText(); } elseif ($type === 'translatorsandbox/promoted') { // Gender for the target $params[3] = User::newFromId($params[3])->getName(); } return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); /* Current format: * 1,2,3: normal logformatter params * 4: old username * (legaciest doesn't have this at all, all in comment) * (legacier uses this as new name and stores old name in target) * 5: new username * 6: number of edits the user had at the time * (not available except in newest log entries) * Note that the arrays are zero-indexed, while message parameters * start from 1, so substract one to get array entries below. */ if (!isset($params[3])) { // The oldest format return $params; } elseif (!isset($params[4])) { // See comments above $params[4] = $params[3]; $params[3] = $this->entry->getTarget()->getText(); } // Nice link to old user page $title = Title::makeTitleSafe(NS_USER, $params[3]); $link = $this->myPageLink($title, $params[3]); $params[3] = Message::rawParam($link); // Nice link to new user page $title = Title::makeTitleSafe(NS_USER, $params[4]); $link = $this->myPageLink($title, $params[4]); $params[4] = Message::rawParam($link); return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $title = $this->entry->getTarget(); if (substr($title->getText(), 0, 1) === '#') { // autoblock - no user link possible $params[2] = $title->getText(); $params[3] = ''; // no user name for gender use } else { // Create a user link for the blocked $username = $title->getText(); // @todo Store the user identifier in the parameters // to make this faster for future log entries $targetUser = User::newFromName($username, false); $params[2] = Message::rawParam($this->makeUserLink($targetUser, Linker::TOOL_LINKS_NOBLOCK)); $params[3] = $username; // plain user name for gender use } $subtype = $this->entry->getSubtype(); if ($subtype === 'block' || $subtype === 'reblock') { if (!isset($params[4])) { // Very old log entry without duration: means infinite $params[4] = 'infinite'; } // Localize the duration, and add a tooltip // in English to help visitors from other wikis. // The lrm is needed to make sure that the number // is shown on the correct side of the tooltip text. $durationTooltip = '‎' . htmlspecialchars($params[4]); $params[4] = Message::rawParam("<span class='blockExpiry' title='{$durationTooltip}'>" . $this->context->getLanguage()->translateBlockExpiry($params[4]) . '</span>'); $params[5] = isset($params[5]) ? self::formatBlockFlags($params[5], $this->context->getLanguage()) : ''; } return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $subtype = $this->entry->getSubtype(); if ($subtype === 'protect' || $subtype === 'modify') { $rawParams = $this->entry->getParameters(); if (isset($rawParams['details'])) { $params[3] = $this->createProtectDescription($rawParams['details']); } elseif (isset($params[3])) { // Old way of Restrictions and expiries $params[3] = $this->context->getLanguage()->getDirMark() . $params[3]; } else { // Very old way (nothing set) $params[3] = ''; } // Cascading flag if (isset($params[4])) { // handled in getMessageKey unset($params[4]); } } elseif ($subtype === 'move_prot') { $oldname = $this->makePageLink(Title::newFromText($params[3]), array('redirect' => 'no')); $params[3] = Message::rawParam($oldname); } return $params; }
public function getMessageParameters() { $params = parent::getMessageParameters(); $type = $this->entry->getSubtype(); $entry_params = $this->entry->getParameters(); if ($type === 'approve') { $revid = $entry_params['revid']; $link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid)); $params[4] = Message::rawParam($link); } elseif ($type === 'reject') { $modid = $entry_params['modid']; $link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid)); $params[4] = Message::rawParam($link); $userlink = Linker::userLink($entry_params['user'], $entry_params['user_text']); $params[5] = Message::rawParam($userlink); } elseif ($type === 'merge') { $revid = $entry_params['revid']; $modid = $entry_params['modid']; $link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid)); $params[4] = Message::rawParam($link); $link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid)); $params[5] = Message::rawParam($link); } elseif ($type === 'approveall' || $type === 'rejectall' || $type === 'block' || $type === 'unblock') { $title = $this->entry->getTarget(); $user_id = User::idFromName($title->getText()); $link = Linker::userLink($user_id, $title->getText()); $params[2] = Message::rawParam($link); } return $params; }
protected function getMessageParameters() { $lang = $this->context->getLanguage(); $params = parent::getMessageParameters(); $params[3] = ContentHandler::getLocalizedName($params[3], $lang); $params[4] = ContentHandler::getLocalizedName($params[4], $lang); return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $oldname = $this->makePageLink( $this->entry->getTarget(), array( 'redirect' => 'no' ) ); $newname = $this->makePageLink( Title::newFromText( $params[3] ) ); $params[2] = Message::rawParam( $oldname ); $params[3] = Message::rawParam( $newname ); return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $subtype = $this->entry->getSubtype(); if ($subtype === 'requestwiki') { $params[6] = str_replace('#', '', $params[6]); $params[6] = Message::rawParam(Linker::linkKnown(Title::newFromText(SpecialPage::getTitleFor('RequestWikiQueue') . '/' . $params[6]), '#' . $params[6])); return $params; } }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $subtype = $this->entry->getSubtype(); if ($subtype === 'move_prot') { $oldname = $this->makePageLink(Title::newFromText($params[3]), array('redirect' => 'no')); $params[3] = Message::rawParam($oldname); } return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $oldname = $this->makePageLink($this->entry->getTarget(), array('redirect' => 'no')); $newname = $this->makePageLink(Title::newFromText($params[3])); $params[2] = Message::rawParam($oldname); $params[3] = Message::rawParam($newname); $params[4] = $this->context->getLanguage()->userTimeAndDate($params[4], $this->context->getUser()); return $params; }
protected function getMessageParameters() { parent::getMessageParameters(); $params = $this->extractParameters(); $lang = $this->context->getLanguage(); $this->parsedParameters[3] = Message::rawParam($lang->commaList(array_map(array($this, 'getCentralAuthLink'), explode('|', $params[3])))); $this->parsedParameters[4] = Message::rawParam($this->getCentralAuthLink($params[4])); ksort($this->parsedParameters); return $this->parsedParameters; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $subtype = $this->entry->getSubtype(); if ( $subtype === 'create2' || $subtype === 'byemail' ) { if ( isset( $params[3] ) ) { $target = User::newFromId( $params[3] ); } else { $target = User::newFromName( $this->entry->getTarget()->getText(), false ); } $params[2] = Message::rawParam( $this->makeUserLink( $target ) ); $params[3] = $target->getName(); } return $params; }
protected function getMessageParameters() { parent::getMessageParameters(); $params = $this->extractParameters(); if ($this->entry->getSubtype() === 'promote') { $this->parsedParameters[3] = $this->getLocalWikiLink($params[3], $params[5]); } else { // rename $this->parsedParameters[3] = $this->getCentralAuthLink($params[3]); } $this->parsedParameters[4] = $this->getCentralAuthLink($params[4]); ksort($this->parsedParameters); return $this->parsedParameters; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); $target = $this->entry->getTarget(); $oldid = $params[3]; $revision = $this->context->getLanguage()->formatNum($oldid, true); if ($this->plaintext) { $revlink = $revision; } elseif ($target->exists()) { $query = array('oldid' => $oldid, 'diff' => 'prev'); $revlink = Linker::link($target, htmlspecialchars($revision), array(), $query); } else { $revlink = htmlspecialchars($revision); } $params[3] = Message::rawParam($revlink); return $params; }
protected function getMessageParameters() { if (isset($this->parsedParametersDeleteLog)) { return $this->parsedParametersDeleteLog; } $params = parent::getMessageParameters(); $subtype = $this->entry->getSubtype(); if (in_array($subtype, ['event', 'revision'])) { // $params[3] here is 'revision' or 'archive' for page revisions, 'oldimage' or // 'filearchive' for file versions, or a comma-separated list of log_ids for log // entries. $subtype here is 'revision' for page revisions and file // versions, or 'event' for log entries. if ($subtype === 'event' && count($params) === 6 || $subtype === 'revision' && isset($params[3]) && in_array($params[3], ['revision', 'archive', 'oldimage', 'filearchive'])) { // See RevDelList::getLogParams()/RevDelLogList::getLogParams() $paramStart = $subtype === 'revision' ? 4 : 3; $old = $this->parseBitField($params[$paramStart + 1]); $new = $this->parseBitField($params[$paramStart + 2]); list($hid, $unhid, $extra) = RevisionDeleter::getChanges($new, $old); $changes = []; // messages used: revdelete-content-hid, revdelete-summary-hid, revdelete-uname-hid foreach ($hid as $v) { $changes[] = $this->msg("{$v}-hid")->plain(); } // messages used: revdelete-content-unhid, revdelete-summary-unhid, // revdelete-uname-unhid foreach ($unhid as $v) { $changes[] = $this->msg("{$v}-unhid")->plain(); } foreach ($extra as $v) { $changes[] = $this->msg($v)->plain(); } $changeText = $this->context->getLanguage()->listToText($changes); $newParams = array_slice($params, 0, 3); $newParams[3] = $changeText; $ids = is_array($params[$paramStart]) ? $params[$paramStart] : explode(',', $params[$paramStart]); $newParams[4] = $this->context->getLanguage()->formatNum(count($ids)); $this->parsedParametersDeleteLog = $newParams; return $this->parsedParametersDeleteLog; } else { $this->parsedParametersDeleteLog = array_slice($params, 0, 3); return $this->parsedParametersDeleteLog; } } $this->parsedParametersDeleteLog = $params; return $this->parsedParametersDeleteLog; }
protected function getMessageParameters() { if ( isset( $this->parsedParametersDeleteLog ) ) { return $this->parsedParametersDeleteLog; } $params = parent::getMessageParameters(); $subtype = $this->entry->getSubtype(); if ( in_array( $subtype, array( 'event', 'revision' ) ) ) { // $params[3] here is 'revision' for page revisions, 'oldimage' for file versions, or a comma-separated list of log_ids for log entries. // $subtype here is 'revision' for page revisions and file versions, or 'event' for log entries. if ( ( $subtype === 'event' && count( $params ) === 6 ) || ( $subtype === 'revision' && isset( $params[3] ) && ( $params[3] === 'revision' || $params[3] === 'oldimage' ) ) ) { $paramStart = $subtype === 'revision' ? 4 : 3; $old = $this->parseBitField( $params[$paramStart + 1] ); $new = $this->parseBitField( $params[$paramStart + 2] ); list( $hid, $unhid, $extra ) = RevisionDeleter::getChanges( $new, $old ); $changes = array(); foreach ( $hid as $v ) { $changes[] = $this->msg( "$v-hid" )->plain(); } foreach ( $unhid as $v ) { $changes[] = $this->msg( "$v-unhid" )->plain(); } foreach ( $extra as $v ) { $changes[] = $this->msg( $v )->plain(); } $changeText = $this->context->getLanguage()->listToText( $changes ); $newParams = array_slice( $params, 0, 3 ); $newParams[3] = $changeText; $count = count( explode( ',', $params[$paramStart] ) ); $newParams[4] = $this->context->getLanguage()->formatNum( $count ); return $this->parsedParametersDeleteLog = $newParams; } else { return $this->parsedParametersDeleteLog = array_slice( $params, 0, 3 ); } } return $this->parsedParametersDeleteLog = $params; }
protected function getMessageParameters() { // First call the main function to load the other values parent::getMessageParameters(); $params = $this->extractParameters(); // Backwards compat for older log entries if (!isset($params[3])) { return $this->parsedParameters; } // This will be localized with Linker::link // @todo Somehow localize for plaintext messages $title = Title::newFromText('Special:Permalink/' . $params[3]); // Our simple version of LogFormatter::makeLink if ($this->plaintext) { $this->parsedParameters[2] = '[[' . $title->getPrefixedText() . ']]'; } else { $this->parsedParameters[2] = Message::rawParam(Linker::link($title, htmlspecialchars($this->entry->getTarget()))); } ksort($this->parsedParameters); return $this->parsedParameters; }
public function getMessageParameters() { $params = parent::getMessageParameters(); $legacy = $this->entry->getParameters(); $type = $this->entry->getFullType(); switch ($type) { case 'pagetranslation/mark': $revision = $legacy['revision']; $targetPage = $this->makePageLink($this->entry->getTarget(), array('oldid' => $revision)); $params[2] = Message::rawParam($targetPage); break; case 'pagetranslation/moveok': case 'pagetranslation/movenok': case 'pagetranslation/deletefnok': case 'pagetranslation/deletelnok': $target = $legacy['target']; $moveTarget = $this->makePageLink(Title::newFromText($target)); $params[3] = Message::rawParam($moveTarget); break; case 'pagetranslation/prioritylanguages': $params[3] = $legacy['force']; $languages = $legacy['languages']; if ($languages !== false) { $lang = $this->context->getLanguage(); $languages = array_map('trim', preg_split('/,/', $languages, -1, PREG_SPLIT_NO_EMPTY)); $languages = array_map(function ($code) use($lang) { return TranslateUtils::getLanguageName($code, $lang->getCode()); }, $languages); $params[4] = $lang->listToText($languages); } break; case 'pagetranslation/associate': case 'pagetranslation/dissociate': $params[3] = $legacy['aggregategroup']; break; } return $params; }
protected function getMessageParameters() { // Get the user language for displaying language names $userLang = $this->context->getLanguage()->getCode(); $params = parent::getMessageParameters(); // Get the language codes from log $oldLang = $params[3]; $kOld = strrpos($oldLang, '['); if ($kOld) { $oldLang = substr($oldLang, 0, $kOld); } $newLang = $params[4]; $kNew = strrpos($newLang, '['); if ($kNew) { $newLang = substr($newLang, 0, $kNew); } // Convert language codes to names in user language $logOld = Language::fetchLanguageName($oldLang, $userLang) . ' (' . $oldLang . ')'; $logNew = Language::fetchLanguageName($newLang, $userLang) . ' (' . $newLang . ')'; // Add the default message to languages if required $params[3] = !$kOld ? $logOld : $logOld . ' [' . $this->msg('default') . ']'; $params[4] = !$kNew ? $logNew : $logNew . ' [' . $this->msg('default') . ']'; return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); if (isset($params[4])) { $params[4] = Message::rawParam($params[4]); } return $params; }
protected function getMessageParameters() { $params = parent::getMessageParameters(); // Really old entries if (!isset($params[3]) && !isset($params[4])) { return $params; } $oldGroups = $params[3]; $newGroups = $params[4]; // Less old entries if ($oldGroups === '') { $oldGroups = array(); } elseif (is_string($oldGroups)) { $oldGroups = array_map('trim', explode(',', $oldGroups)); } if ($newGroups === '') { $newGroups = array(); } elseif (is_string($newGroups)) { $newGroups = array_map('trim', explode(',', $newGroups)); } $userName = $this->entry->getTarget()->getText(); if (!$this->plaintext && count($oldGroups)) { foreach ($oldGroups as &$group) { $group = User::getGroupMember($group, $userName); } } if (!$this->plaintext && count($newGroups)) { foreach ($newGroups as &$group) { $group = User::getGroupMember($group, $userName); } } $lang = $this->context->getLanguage(); if (count($oldGroups)) { $params[3] = $lang->listToText($oldGroups); } else { $params[3] = $this->msg('rightsnone')->text(); } if (count($newGroups)) { $params[4] = $lang->listToText($newGroups); } else { $params[4] = $this->msg('rightsnone')->text(); } return $params; }