From 888f42f4abac71fe999d75f8f342f77e25fa7f3e Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Fri, 11 Jun 2004 14:45:39 +0000 Subject: [PATCH] * use different timestamp parsing regexps for PG/MySQL * use old->"old" for PG --- includes/EditPage.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 2c98ed6206..b168b6c29a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -62,6 +62,7 @@ class EditPage { } 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. @@ -70,7 +71,12 @@ class EditPage { $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; @@ -538,6 +544,7 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . } /* 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); @@ -546,7 +553,8 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $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 ); -- 2.20.1