public function showList( $msg = '' ) {
global $wgOut, $wgRequest;
- if ( "" != $msg ) {
+ if( $msg != "" ) {
$wgOut->setSubtitle( $msg );
}
// Purge expired entries on one in every 10 queries
- if ( !mt_rand( 0, 10 ) ) {
+ if( !mt_rand( 0, 10 ) ) {
Title::purgeExpiredRestrictions();
}
$wgOut->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
- if ( $pager->getNumRows() ) {
+ if( $pager->getNumRows() ) {
$s = $pager->getNavigationBar();
$s .= "<ul>" .
$pager->getBody() .
$skin = $wgUser->getSkin();
$title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
- $link = $skin->makeLinkObj( $title );
+ $link = $skin->link( $title );
$description_items = array ();
$description_items[] = $protType;
- if ( $row->pr_cascade ) {
+ if( $row->pr_cascade ) {
$description_items[] = wfMsg( 'protect-summary-cascade' );
}
$expiry_description = '';
$stxt = '';
- if ( $row->pr_expiry != 'infinity' && strlen($row->pr_expiry) ) {
+ if( $row->pr_expiry != 'infinity' && strlen($row->pr_expiry) ) {
$expiry = Block::decodeExpiry( $row->pr_expiry );
- $expiry_description = wfMsg( 'protect-expiring' , $wgLang->timeanddate( $expiry ) , $wgLang->date( $expiry ) , $wgLang->time( $expiry ) );
+ $expiry_description = wfMsg( 'protect-expiring' , $wgLang->timeanddate( $expiry ) ,
+ $wgLang->date( $expiry ) , $wgLang->time( $expiry ) );
- $description_items[] = $expiry_description;
+ $description_items[] = htmlspecialchars($expiry_description);
}
- if (!is_null($size = $row->page_len)) {
+ if(!is_null($size = $row->page_len)) {
$stxt = $wgContLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
}
# 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' ) . ')';
+ $changeProtection = ' (' . $skin->linkKnown(
+ $title,
+ wfMsgHtml( 'protect_change' ),
+ array(),
+ array( 'action' => 'unprotect' )
+ ) . ')';
} else {
$ltitle = SpecialPage::getTitleFor( 'Log' );
- $changeProtection = ' (' . $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'protectlogpage' ), 'type=protect&page=' . $title->getPrefixedUrl() ) . ')';
+ $changeProtection = ' (' . $skin->linkKnown(
+ $ltitle,
+ wfMsgHtml( 'protectlogpage' ),
+ array(),
+ array(
+ 'type' => 'protect',
+ 'page' => $title->getPrefixedText()
+ )
+ ) . ')';
}
wfProfileOut( __METHOD__ );
- return '<li>' . wfSpecialList( $link . $stxt, implode( $description_items, ', ' ) ) . $changeProtection . "</li>\n";
+ return Html::rawElement(
+ 'li',
+ array(),
+ wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ) ) . $changeProtection ) . "\n";
}
/**
*/
protected function showOptions( $namespace, $type='edit', $level, $sizetype, $size, $indefOnly, $cascadeOnly ) {
global $wgScript;
- $title = SpecialPage::getTitleFor( 'ProtectedPages' );
+ $title = SpecialPage::getTitleFor( 'Protectedpages' );
return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', array(), wfMsg( 'protectedpages' ) ) .
$this->getNamespaceMenu( $namespace ) . " \n" .
$this->getTypeMenu( $type ) . " \n" .
$this->getLevelMenu( $level ) . " \n" .
- "<br/><span style='white-space: nowrap'>" .
+ "<br /><span style='white-space: nowrap'>" .
$this->getExpiryCheck( $indefOnly ) . " \n" .
$this->getCascadeCheck( $cascadeOnly ) . " \n" .
- "</span><br/><span style='white-space: nowrap'>" .
+ "</span><br /><span style='white-space: nowrap'>" .
$this->getSizeLimit( $sizetype, $size ) . " \n" .
"</span>" .
" " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
}
/**
+ * Creates the input label of the restriction type
+ * @param $pr_type string Protection type
* @return string Formatted HTML
*/
protected function getTypeMenu( $pr_type ) {
}
/**
+ * Creates the input label of the restriction level
+ * @param $pr_level string Protection level
* @return string Formatted HTML
*/
protected function getLevelMenu( $pr_level ) {
// First pass to load the log names
foreach( $wgRestrictionLevels as $type ) {
- if ( $type !='' && $type !='*') {
+ // Messages used can be 'restriction-level-sysop' and 'restriction-level-autoconfirmed'
+ if( $type !='' && $type !='*') {
$text = wfMsg("restriction-level-$type");
$m[$text] = $type;
}
$options[] = Xml::option( $text, $type, $selected );
}
- return
- Xml::label( wfMsg('restriction-level') , $this->IdLevel ) . ' ' .
+ return "<span style='white-space: nowrap'>" .
+ Xml::label( wfMsg( 'restriction-level' ) , $this->IdLevel ) . ' ' .
Xml::tags( 'select',
array( 'id' => $this->IdLevel, 'name' => $this->IdLevel ),
- implode( "\n", $options ) );
+ implode( "\n", $options ) ) . "</span>";
}
}
public $mForm, $mConds;
private $type, $level, $namespace, $sizetype, $size, $indefonly;
- function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='',
- $size=0, $indefonly = false, $cascadeonly = false ) {
+ function __construct( $form, $conds = array(), $type, $level, $namespace, $sizetype='', $size=0,
+ $indefonly = false, $cascadeonly = false )
+ {
$this->mForm = $form;
$this->mConds = $conds;
$this->type = ( $type ) ? $type : 'edit';
}
function getStartBody() {
- wfProfileIn( __METHOD__ );
# Do a link batch query
$lb = new LinkBatch;
while( $row = $this->mResult->fetchObject() ) {
$lb->add( $row->page_namespace, $row->page_title );
}
$lb->execute();
-
- wfProfileOut( __METHOD__ );
return '';
}
function getQueryInfo() {
$conds = $this->mConds;
- $conds[] = 'pr_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() );
+ $conds[] = '(pr_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
+ 'OR pr_expiry IS NULL)';
$conds[] = 'page_id=pr_page';
$conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type );
-
+
if( $this->sizetype=='min' ) {
$conds[] = 'page_len>=' . $this->size;
} else if( $this->sizetype=='max' ) {
if( $this->indefonly ) {
$conds[] = "pr_expiry = 'infinity' OR pr_expiry IS NULL";
}
- if ( $this->cascadeonly ) {
+ if( $this->cascadeonly ) {
$conds[] = "pr_cascade = '1'";
}
* Constructor
*/
function wfSpecialProtectedpages() {
-
$ppForm = new ProtectedPagesForm();
-
$ppForm->showList();
}