X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FProtectionForm.php;h=2adedb774c276891daa8718494f9086a40f83323;hb=7f0b8463c8e1834c2dd5bef7d0dd34d7d1064d9b;hp=7daab1506aa400edd92a3feb9a06a247e56d01fc;hpb=75c6696aa84712669d2cf82856e2af838ed877e0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 7daab1506a..2adedb774c 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -57,11 +57,11 @@ class ProtectionForm { /** Map of action to the expiry time of the existing protection */ var $mExistingExpiry = array(); - function __construct( Article $article ) { + function __construct( Page $article ) { global $wgUser; // Set instance variables. $this->mArticle = $article; - $this->mTitle = $article->mTitle; + $this->mTitle = $article->getTitle(); $this->mApplicableTypes = $this->mTitle->getRestrictionTypes(); // Check if the form should be disabled. @@ -147,7 +147,9 @@ class ProtectionForm { /** * Get the expiry time for a given action, by combining the relevant inputs. * - * @return 14-char timestamp or "infinity", or false if the input was invalid + * @param $action string + * + * @return string 14-char timestamp or "infinity", or false if the input was invalid */ function getExpiry( $action ) { if ( $this->mExpirySelection[$action] == 'existing' ) { @@ -235,7 +237,8 @@ class ProtectionForm { $wgOut->showPermissionsErrorPage( $this->mPermErrors ); } } else { - $wgOut->addWikiMsg( 'protect-text', $this->mTitle->getPrefixedText() ); + $wgOut->addWikiMsg( 'protect-text', + wfEscapeWikiText( $this->mTitle->getPrefixedText() ) ); } $wgOut->addHTML( $this->buildForm() ); @@ -316,10 +319,10 @@ class ProtectionForm { return false; } - if( $wgRequest->getCheck( 'mwProtectWatch' ) && $wgUser->isLoggedIn() ) { - Action::factory( 'watch', $this->mArticle )->execute(); - } elseif( $this->mTitle->userIsWatching() ) { - Action::factory( 'unwatch', $this->mArticle )->execute(); + if ( $wgRequest->getCheck( 'mwProtectWatch' ) && $wgUser->isLoggedIn() ) { + WatchAction::doWatch( $this->mTitle, $wgUser ); + } elseif ( $this->mTitle->userIsWatching() ) { + WatchAction::doUnwatch( $this->mTitle, $wgUser ); } return $ok; }