return $this->deletedSinceEdit;
}
+ /**
+ * Checks whether the user entered a skin name in uppercase,
+ * e.g. "User:Example/Monobook.css" instead of "monobook.css"
+ */
+ protected function isWrongCaseCssJsPage() {
+ if( $this->mTitle->isCssJsSubpage() ) {
+ $name = $this->mTitle->getSkinFromCssJsSubpage();
+ $skins = array_merge(
+ array_keys( Skin::getSkinNames() ),
+ array( 'common' )
+ );
+ return !in_array( $name, $skins )
+ && in_array( strtolower( $name ), $skins );
+ } else {
+ return false;
+ }
+ }
+
function submit() {
$this->edit();
}
$this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
$this->isCssSubpage = $this->mTitle->isCssSubpage();
$this->isJsSubpage = $this->mTitle->isJsSubpage();
- $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
+ $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage();
# Show applicable editing introductions
if ( $this->formtype == 'initial' || $this->firsttime )
} else {
if ( $this->isCssJsSubpage ) {
# Check the skin exists
- if ( !$this->isValidCssJsSubpage ) {
+ if ( $this->isWrongCaseCssJsPage ) {
$wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ) );
}
if ( $this->formtype !== 'preview' ) {
* Produce the stock "your edit contains spam" page
*
* @param $match Text which triggered one or more filters
+ * @deprecated Use method spamPageWithContent() instead
*/
static function spamPage( $match = false ) {
global $wgOut, $wgTitle;
$wgOut->returnToMain( false, $wgTitle );
}
+ /**
+ * Show "your edit contains spam" page with your diff and text
+ *
+ * @param $match Text which triggered one or more filters
+ */
+ public function spamPageWithContent( $match = false ) {
+ global $wgOut, $wgTitle;
+ $this->textbox2 = $this->textbox1;
+
+ $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
+ $wgOut->setArticleRelated( false );
+
+ $wgOut->addHTML( '<div id="spamprotected">' );
+ $wgOut->addWikiMsg( 'spamprotectiontext' );
+ if ( $match ) {
+ $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
+ }
+ $wgOut->addHTML( '</div>' );
+
+ $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourdiff" );
+ $de = new DifferenceEngine( $this->mTitle );
+ $de->setText( $this->getContent(), $this->textbox2 );
+ $de->showDiff( wfMsg( "storedversion" ), wfMsg( "yourtext" ) );
+
+ $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourtext" );
+ $this->showTextbox2();
+
+ $wgOut->addReturnTo( $wgTitle, array( 'action' => 'edit' ) );
+ }
+
+
/**
* @private
* @todo document
$script = '';
foreach ( $toolarray as $tool ) {
- if ( !$tool ) continue;
+ if ( !$tool ) {
+ continue;
+ }
$params = array(
$image = $wgStylePath . '/common/images/' . $tool['image'],
return false;
case self::AS_SPAM_ERROR:
- self::spamPage( $resultDetails['spam'] );
+ $this->spamPageWithContent( $resultDetails['spam'] );
return false;
case self::AS_BLOCKED_PAGE_FOR_USER: