summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialEditWatchlist.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
commit08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch)
tree577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/specials/SpecialEditWatchlist.php
parentcacc939b34e315b85e2d72997811eb6677996cc1 (diff)
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/specials/SpecialEditWatchlist.php')
-rw-r--r--includes/specials/SpecialEditWatchlist.php57
1 files changed, 29 insertions, 28 deletions
diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php
index 23cd9aa6..d2838e01 100644
--- a/includes/specials/SpecialEditWatchlist.php
+++ b/includes/specials/SpecialEditWatchlist.php
@@ -49,7 +49,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
private $badItems = array();
- public function __construct(){
+ public function __construct() {
parent::__construct( 'EditWatchlist' );
}
@@ -77,6 +77,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
}
$this->checkPermissions();
+ $this->checkReadOnly();
$this->outputHeader();
@@ -85,9 +86,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
# B/C: $mode used to be waaay down the parameter list, and the first parameter
# was $wgUser
- if( $mode instanceof User ){
+ if( $mode instanceof User ) {
$args = func_get_args();
- if( count( $args >= 4 ) ){
+ if( count( $args >= 4 ) ) {
$mode = $args[3];
}
}
@@ -101,7 +102,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
case self::EDIT_RAW:
$out->setPageTitle( $this->msg( 'watchlistedit-raw-title' ) );
$form = $this->getRawForm();
- if( $form->show() ){
+ if( $form->show() ) {
$out->addHTML( $this->successMessage );
$out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
}
@@ -111,7 +112,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
default:
$out->setPageTitle( $this->msg( 'watchlistedit-normal-title' ) );
$form = $this->getNormalForm();
- if( $form->show() ){
+ if( $form->show() ) {
$out->addHTML( $this->successMessage );
$out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
} elseif ( $this->toc !== false ) {
@@ -153,7 +154,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
return array_unique( $list );
}
- public function submitRaw( $data ){
+ public function submitRaw( $data ) {
$wanted = $this->extractTitles( $data['Titles'] );
$current = $this->getWatchlist();
@@ -164,7 +165,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
$this->unwatchTitles( $toUnwatch );
$this->getUser()->invalidateCache();
- if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ){
+ if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) {
$this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
} else {
return false;
@@ -185,7 +186,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
$this->clearWatchlist();
$this->getUser()->invalidateCache();
- if( count( $current ) > 0 ){
+ if( count( $current ) > 0 ) {
$this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
} else {
return false;
@@ -204,7 +205,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
* $titles can be an array of strings or Title objects; the former
* is preferred, since Titles are very memory-heavy
*
- * @param $titles array of strings, or Title objects
+ * @param array $titles of strings, or Title objects
* @param $output String
*/
private function showTitles( $titles, &$output ) {
@@ -289,7 +290,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
$res = $dbr->select(
array( 'watchlist' ),
- array( 'wl_namespace', 'wl_title' ),
+ array( 'wl_namespace', 'wl_title' ),
array( 'wl_user' => $this->getUser()->getId() ),
__METHOD__,
array( 'ORDER BY' => array( 'wl_namespace', 'wl_title' ) )
@@ -312,7 +313,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
*
* @param Title $title
* @param int $namespace
- * @param String $dbKey
+ * @param string $dbKey
* @return bool: Whether this item is valid
*/
private function checkTitle( $title, $namespace, $dbKey ) {
@@ -381,7 +382,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
* $titles can be an array of strings or Title objects; the former
* is preferred, since Titles are very memory-heavy
*
- * @param $titles Array of strings, or Title objects
+ * @param array $titles of strings, or Title objects
*/
private function watchTitles( $titles ) {
$dbw = wfGetDB( DB_MASTER );
@@ -393,13 +394,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
if( $title instanceof Title ) {
$rows[] = array(
'wl_user' => $this->getUser()->getId(),
- 'wl_namespace' => ( $title->getNamespace() & ~1 ),
+ 'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
'wl_title' => $title->getDBkey(),
'wl_notificationtimestamp' => null,
);
$rows[] = array(
'wl_user' => $this->getUser()->getId(),
- 'wl_namespace' => ( $title->getNamespace() | 1 ),
+ 'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ),
'wl_title' => $title->getDBkey(),
'wl_notificationtimestamp' => null,
);
@@ -414,7 +415,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
* $titles can be an array of strings or Title objects; the former
* is preferred, since Titles are very memory-heavy
*
- * @param $titles Array of strings, or Title objects
+ * @param array $titles of strings, or Title objects
*/
private function unwatchTitles( $titles ) {
$dbw = wfGetDB( DB_MASTER );
@@ -427,7 +428,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
'watchlist',
array(
'wl_user' => $this->getUser()->getId(),
- 'wl_namespace' => ( $title->getNamespace() & ~1 ),
+ 'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
'wl_title' => $title->getDBkey(),
),
__METHOD__
@@ -436,7 +437,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
'watchlist',
array(
'wl_user' => $this->getUser()->getId(),
- 'wl_namespace' => ( $title->getNamespace() | 1 ),
+ 'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ),
'wl_title' => $title->getDBkey(),
),
__METHOD__
@@ -470,26 +471,26 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
*
* @return HTMLForm
*/
- protected function getNormalForm(){
+ protected function getNormalForm() {
global $wgContLang;
$fields = array();
$count = 0;
- foreach( $this->getWatchlistInfo() as $namespace => $pages ){
+ foreach( $this->getWatchlistInfo() as $namespace => $pages ) {
if ( $namespace >= 0 ) {
- $fields['TitlesNs'.$namespace] = array(
+ $fields['TitlesNs' . $namespace] = array(
'class' => 'EditWatchlistCheckboxSeriesField',
'options' => array(),
'section' => "ns$namespace",
);
}
- foreach( array_keys( $pages ) as $dbkey ){
+ foreach( array_keys( $pages ) as $dbkey ) {
$title = Title::makeTitleSafe( $namespace, $dbkey );
if ( $this->checkTitle( $title, $namespace, $dbkey ) ) {
$text = $this->buildRemoveLine( $title );
- $fields['TitlesNs'.$namespace]['options'][$text] = htmlspecialchars( $title->getPrefixedText() );
+ $fields['TitlesNs' . $namespace]['options'][$text] = $title->getPrefixedText();
$count++;
}
}
@@ -519,7 +520,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
$form->setTitle( $this->getTitle() );
$form->setSubmitTextMsg( 'watchlistedit-normal-submit' );
# Used message keys: 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit'
- $form->setSubmitTooltip('watchlistedit-normal-submit');
+ $form->setSubmitTooltip( 'watchlistedit-normal-submit' );
$form->setWrapperLegendMsg( 'watchlistedit-normal-legend' );
$form->addHeaderText( $this->msg( 'watchlistedit-normal-explain' )->parse() );
$form->setSubmitCallback( array( $this, 'submitNormal' ) );
@@ -564,7 +565,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
*
* @return HTMLForm
*/
- protected function getRawForm(){
+ protected function getRawForm() {
$titles = implode( $this->getWatchlist(), "\n" );
$fields = array(
'Titles' => array(
@@ -577,7 +578,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
$form->setTitle( $this->getTitle( 'raw' ) );
$form->setSubmitTextMsg( 'watchlistedit-raw-submit' );
# Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
- $form->setSubmitTooltip('watchlistedit-raw-submit');
+ $form->setSubmitTooltip( 'watchlistedit-raw-submit' );
$form->setWrapperLegendMsg( 'watchlistedit-raw-legend' );
$form->addHeaderText( $this->msg( 'watchlistedit-raw-explain' )->parse() );
$form->setSubmitCallback( array( $this, 'submitRaw' ) );
@@ -648,7 +649,7 @@ class WatchlistEditor extends SpecialEditWatchlist {}
* Extend HTMLForm purely so we can have a more sane way of getting the section headers
*/
class EditWatchlistNormalHTMLForm extends HTMLForm {
- public function getLegend( $namespace ){
+ public function getLegend( $namespace ) {
$namespace = substr( $namespace, 2 );
return $namespace == NS_MAIN
? $this->msg( 'blanknamespace' )->escaped()
@@ -667,8 +668,8 @@ class EditWatchlistCheckboxSeriesField extends HTMLMultiSelectField {
* form is open (bug 32126), but we know that invalid items will
* be harmless so we can override it here.
*
- * @param $value String the value the field was submitted with
- * @param $alldata Array the data collected from the form
+ * @param string $value the value the field was submitted with
+ * @param array $alldata the data collected from the form
* @return Mixed Bool true on success, or String error to display.
*/
function validate( $value, $alldata ) {