/** 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.
/**
* 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' ) {
$wgOut->showPermissionsErrorPage( $this->mPermErrors );
}
} else {
- $wgOut->addWikiMsg( 'protect-text', $this->mTitle->getPrefixedText() );
+ $wgOut->addWikiMsg( 'protect-text',
+ wfEscapeWikiText( $this->mTitle->getPrefixedText() ) );
}
$wgOut->addHTML( $this->buildForm() );
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;
}