var $mTokenOk = true;
var $tooBig = false;
var $kblength = false;
+ var $missingComment = false;
# Form values
var $save = false, $preview = false, $diff = false;
* the newly-edited page.
*/
function edit() {
- global $wgOut, $wgUser, $wgRequest, $wgTitle,
- $wgEmailConfirmToEdit;
+ global $wgOut, $wgUser, $wgRequest, $wgTitle;
+ global $wgEmailConfirmToEdit;
if ( ! wfRunHooks( 'AlternateEdit', array( &$this ) ) )
return;
$this->isConflict = false;
// css / js subpages of user pages get a special treatment
- $this->isCssJsSubpage = $wgTitle->isCssJsSubpage();
+ $this->isCssJsSubpage = $wgTitle->isCssJsSubpage();
+ $this->isValidCssJsSubpage = $wgTitle->isValidCssJsSubpage();
/* Notice that we can't use isDeleted, because it returns true if article is ever deleted
* no matter it's current state
wfProfileIn( "$fname-sectionanchor" );
$sectionanchor = '';
if( $this->section == 'new' ) {
+ if ( $this->textbox1 == '' ) {
+ $this->missingComment = true;
+ return true;
+ }
if( $this->summary != '' ) {
$sectionanchor = $this->sectionAnchor( $this->summary );
}
$s = wfMsg( 'editing', $this->mTitle->getPrefixedText() );
}
$wgOut->setPageTitle( $s );
+
+ if ( $this->missingComment ) {
+ $wgOut->addWikiText( wfMsg( 'missingcommenttext' ) );
+ }
+
if ( !$this->checkUnicodeCompliantBrowser() ) {
$wgOut->addWikiText( wfMsg( 'nonunicodebrowser') );
}
if( wfReadOnly() ) {
$wgOut->addWikiText( wfMsg( 'readonlywarning' ) );
- } else if ( $this->isCssJsSubpage and 'preview' != $this->formtype) {
- $wgOut->addWikiText( wfMsg( 'usercssjsyoucanpreview' ));
- } else if( $wgUser->isAnon() && $this->formtype != 'preview' ) {
+ } elseif( $wgUser->isAnon() && $this->formtype != 'preview' ) {
$wgOut->addWikiText( wfMsg( 'anoneditwarning' ) );
+ } else {
+ if( $this->isCssJsSubpage && $this->formtype != 'preview' ) {
+ # Check the skin exists
+ if( $this->isValidCssJsSubpage ) {
+ $wgOut->addWikiText( wfMsg( 'usercssjsyoucanpreview' ) );
+ } else {
+ $wgOut->addWikiText( wfMsg( 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ) );
+ }
+ }
}
-
+
if( $this->mTitle->isProtected( 'edit' ) ) {
if( $this->mTitle->isSemiProtected() ) {
$notice = wfMsg( 'semiprotectedpagewarning' );
$buttons['diff'] = wfElement('input', $temp, '');
global $wgLivePreview;
- if ( $wgLivePreview ) {
+ if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) {
$temp = array(
'id' => 'wpPreview',
'name' => 'wpPreview',
} else if(preg_match("/\\.js$/", $wgTitle->getText() ) ) {
$previewtext = wfMsg('userjspreview');
}
- $parserOptions->setTidy(true);
+ $parserOptions->setTidy(true);
$parserOutput = $wgParser->parse( $previewtext , $wgTitle, $parserOptions );
$wgOut->addHTML( $parserOutput->mText );
wfProfileOut( $fname );
}
if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData ;
- $parserOptions->setTidy(true);
+ $parserOptions->setTidy(true);
$parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ) ."\n\n",
$wgTitle, $parserOptions );
* @return string HTML
*/
function getDiff() {
- global $wgUser;
-
require_once( 'DifferenceEngine.php' );
$oldtext = $this->mArticle->fetchContent();
$newtext = $this->mArticle->replaceSection(