From: Raimond Spekking Date: Tue, 15 Apr 2008 10:26:53 +0000 (+0000) Subject: * Add a link to the change protection form for allowed users otherwise a link to... X-Git-Tag: 1.31.0-rc.0~48320 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=fbb6b721643228225ee275a46495364577abecf6;p=lhc%2Fweb%2Fwiklou.git * Add a link to the change protection form for allowed users otherwise a link to the protection log * Fix double escaping of the hidden field * Use more XML functions * Fix a typo in LogEventsList --- diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index f81abec8b3..61f4108b4f 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -47,7 +47,7 @@ class LogEventsList { /** * Set page title and show header for this log type - * @param strin $type + * @param string $type */ public function showHeader( $type ) { if( LogPage::isLogType( $type ) ) { diff --git a/includes/SpecialProtectedpages.php b/includes/SpecialProtectedpages.php index 366b56585a..3d7d6303c4 100644 --- a/includes/SpecialProtectedpages.php +++ b/includes/SpecialProtectedpages.php @@ -51,6 +51,8 @@ class ProtectedPagesForm { /** * Callback function to output a restriction + * @param $row object Protected title + * @return string Formatted
  • element */ public function formatRow( $row ) { global $wgUser, $wgLang, $wgContLang; @@ -75,7 +77,8 @@ class ProtectedPagesForm { $description_items[] = wfMsg( 'protect-summary-cascade' ); } - $expiry_description = ''; $stxt = ''; + $expiry_description = ''; + $stxt = ''; if ( $row->pr_expiry != 'infinity' && strlen($row->pr_expiry) ) { $expiry = Block::decodeExpiry( $row->pr_expiry ); @@ -92,9 +95,18 @@ class ProtectedPagesForm { $stxt = ' ' . wfMsgHtml('historysize', $wgLang->formatNum( $size ) ) . ''; $stxt = $wgContLang->getDirMark() . $stxt; } + + # Show a link to the change protection form for allowed users otherwise a link to the protection log + if( $wgUser->isAllowed( 'protect' ) ) { + $changeProtection = ' (' . $skin->makeKnownLinkObj( $title, wfMsgHtml( 'protect_change' ), 'action=unprotect' ) . ')'; + } else { + $ltitle = SpecialPage::getTitleFor( 'Log' ); + $changeProtection = ' (' . $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'protectlogpage' ), 'type=protect&page=' . $title->getPrefixedUrl() ) . ')'; + } + wfProfileOut( __METHOD__ ); - return '
  • ' . wfSpecialList( $link . $stxt, implode( $description_items, ', ' ) ) . "
  • \n"; + return '
  • ' . wfSpecialList( $link . $stxt, implode( $description_items, ', ' ) ) . $changeProtection . "
  • \n"; } /** @@ -103,17 +115,16 @@ class ProtectedPagesForm { * @param $level string * @param $minsize int * @param $indefOnly bool + * @return string Input form * @private */ protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly ) { global $wgScript; - $action = htmlspecialchars( $wgScript ); $title = SpecialPage::getTitleFor( 'ProtectedPages' ); - $special = htmlspecialchars( $title->getPrefixedDBkey() ); - return "
    \n" . - '
    ' . + return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . + Xml::openElement( 'fieldset' ) . Xml::element( 'legend', array(), wfMsg( 'protectedpages' ) ) . - Xml::hidden( 'title', $special ) . " \n" . + Xml::hidden( 'title', $title->getPrefixedDBkey() ) . " \n" . $this->getNamespaceMenu( $namespace ) . " \n" . $this->getTypeMenu( $type ) . " \n" . $this->getLevelMenu( $level ) . " \n" . @@ -122,7 +133,8 @@ class ProtectedPagesForm { $this->getSizeLimit( $sizetype, $size ) . " \n" . "" . " " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" . - "
    "; + Xml::closeElement( 'fieldset' ) . + Xml::closeElement( 'form' ); } /**