}
function importFormData( &$request ) {
+ global $wgIsMySQL, $wgIsPg;
# These fields need to be checked for encoding.
# Also remove trailing whitespace, but don't remove _initial_
# whitespace from the text boxes. This may be significant formatting.
$this->summary = trim( $request->getText( "wpSummary" ) );
$this->edittime = $request->getVal( 'wpEdittime' );
- if( !preg_match( '/^\d{14}$/', $this->edittime ) ) $this->edittime = "";
+ if ($wgIsMySQL)
+ if( !preg_match( '/^\d{14}$/', $this->edittime )) $this->edittime = "";
+ if ($wgIsPg)
+ if ( !preg_match( '/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/',
+ $this->edittime ))
+ $this->edittime = "";
$this->preview = $request->getCheck( 'wpPreview' );
$this->save = $request->wasPosted() && !$this->preview;
$hasmatch = preg_match( "/^ *([=]{1,6})(.*?)(\\1) *\\n/i", $this->textbox1, $matches );
# we can't deal with anchors, includes, html etc in the header for now,
# headline would need to be parsed to improve this
- if($hasmatch and strlen($matches[2]) > 0 and !preg_match( "/[\\['{<>]/", $matches[2])) {
+ #if($hasmatch and strlen($matches[2]) > 0 and !preg_match( "/[\\['{<>]/", $matches[2])) {
+ if($hasmatch and strlen($matches[2]) > 0) {
global $wgInputEncoding;
$headline = do_html_entity_decode( $matches[2], ENT_COMPAT, $wgInputEncoding );
- # strip out HTML, will be useful when
- # $headline = preg_replace( "/<.*?" . ">/","",$headline );
+ # strip out HTML
+ $headline = preg_replace( "/<.*?" . ">/","",$headline );
$headline = trim( $headline );
- $sectionanchor = '#'.preg_replace("/[ \\?&\\/<>\\(\\)\\[\\]=,+']+/", '_', urlencode( $headline ) );
+ $sectionanchor = '#'.urlencode( str_replace(' ', '_', $headline ) );
+ $replacearray = array(
+ '%3A' => ':',
+ '%' => '.'
+ );
+ $sectionanchor = str_replace(array_keys($replacearray),array_values($replacearray),$sectionanchor);
}
}
$save = wfMsg( "savearticle" );
$prev = wfMsg( "showpreview" );
- $cancel = $sk->makeKnownLink( $this->mTitle->getPrefixedURL(),
+ $cancel = $sk->makeKnownLink( $this->mTitle->getPrefixedText(),
wfMsg( "cancel" ) );
- $edithelpurl = $sk->makeUrl( wfMsg( "edithelppage" ));
- $edithelp = '<a onclick="window.open('.
- "'$edithelpurl', 'helpwindow', 'width=610,height=400,left=10,top=10'".'); return false;" href="'.$edithelpurl.'">'.
- wfMsg( "edithelp" ).'</a>';
+ $edithelpurl = $sk->makeUrl( wfMsg( 'edithelppage' ));
+ $edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
+ htmlspecialchars( wfMsg( 'edithelp' ) ).'</a> '.
+ htmlspecialchars( wfMsg( 'newwindow' ) );
$copywarn = wfMsg( "copyrightwarning", $sk->makeKnownLink(
wfMsg( "copyrightpage" ) ) );
$wgOut->addHTML($previewhead);
$wgOut->addHTML($previewHTML);
}
+ $wgOut->addCategoryLinks($parserOutput->getCategoryLinks());
+ $wgOut->addLanguageLinks($parserOutput->getLanguageLinks());
$wgOut->addHTML( "<br style=\"clear:both;\" />\n" );
}
}
</textarea>
<br />{$editsummary}
{$checkboxhtml}
-<input tabindex='5' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"".wfMsg('accesskey-save')."\"".
+<input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"".wfMsg('accesskey-save')."\"".
" title=\"".wfMsg('tooltip-save')."\"/>
-<input tabindex='6' type='submit' value=\"{$prev}\" name=\"wpPreview\" accesskey=\"".wfMsg('accesskey-preview')."\"".
+<input tabindex='6' id='wpSave' type='submit' value=\"{$prev}\" name=\"wpPreview\" accesskey=\"".wfMsg('accesskey-preview')."\"".
" title=\"".wfMsg('tooltip-preview')."\"/>
<em>{$cancel}</em> | <em>{$edithelp}</em>
-<br /><br />{$copywarn}
+<br /><div id=\"editpage-copywarn\">{$copywarn}</div>
<input type='hidden' value=\"" . htmlspecialchars( $this->section ) . "\" name=\"wpSection\" />
<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n" );
wfMsg( "yourtext" ), wfMsg( "storedversion" ) );
$wgOut->addHTML( "<h2>" . wfMsg( "yourtext" ) . "</h2>
-<textarea tabindex=6 name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}' wrap='virtual'>"
+<textarea tabindex=6 id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}' wrap='virtual'>"
. htmlspecialchars( $wgLang->recodeForEdit( $this->textbox2 ) ) .
"
</textarea>" );
}
/* private */ function mergeChangesInto( &$text ){
+ global $wgIsPg;
$oldDate = $this->edittime;
$res = wfQuery("SELECT cur_text FROM cur WHERE cur_id=" .
$this->mTitle->getArticleID() . " FOR UPDATE", DB_WRITE);
$yourtext = $obj->cur_text;
$ns = $this->mTitle->getNamespace();
$title = wfStrencode( $this->mTitle->getDBkey() );
- $res = wfQuery("SELECT old_text,old_flags FROM old WHERE old_namespace = $ns AND ".
+ $oldtable=$wgIsPg?'"old"':'old';
+ $res = wfQuery("SELECT old_text,old_flags FROM $oldtable WHERE old_namespace = $ns AND ".
"old_title = '{$title}' AND old_timestamp = '{$oldDate}'", DB_WRITE);
$obj = wfFetchObject($res);
$oldText = Article::getRevisionText( $obj );