* Validate function
*/
function validate() {
- global $wgOut, $wgUser;
+ global $wgOut, $wgUser, $wgRequest, $wgUseValidation;
+
+ if ( !$wgUseValidation ) # Are we using article validation at all?
+ {
+ $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
+ return ;
+ }
+
$wgOut->setRobotpolicy( 'noindex,follow' );
+ $revision = $wgRequest->getVal( 'revision' );
+
+ include_once ( "SpecialValidate.php" ) ; # The "Validation" class
+
+ $v = new Validation ;
+ $t = $v->validatePageForm ( $this , $revision ) ;
+/* $a = $v->getTopicList () ;
+ $t = "" ;
+ foreach ( $a AS $x => $y ) {
+ $t .= $x . " : " . $y->val_comment . " (1-" . $y->val_value . ")<br>" ;
+ }
+ $t .= "Revision {$revision}" ;*/
- $wgOut->addWikiText ( "Not implemented yet" ) ;
+ $wgOut->addHTML ( $t ) ;
}
/**
# Validate tab. TODO: add validation to logged-in user rights
if($wgUseValidation){ # && $wgUser->isAllowed('validate')){
- $content_actions['validate'] = array(
- 'class' => ($action == 'validate') ? 'selected' : false,
- 'text' => wfMsg('val_tab'),
- 'href' => $this->mTitle->getLocalUrl( 'action=validate' )
- );
+ #$oid = $oldid ? '&revision='.IntVal( $oldid ) : "" ;
+ if ( $oldid ) $oid = IntVal( $oldid ) ; # Use the oldid
+ else
+ {# Trying to get the current article revision through this weird stunt
+ $tid = $this->mTitle->getArticleID();
+ $tns = $this->mTitle->getNamespace();
+ $sql = "SELECT page_latest FROM page WHERE page_id={$tid} AND page_namespace={$tns}" ;
+ $res = wfQuery( $sql, DB_READ );
+ if( $s = wfFetchObject( $res ) )
+ $oid = $s->page_latest ;
+ else $oid = "" ; # Something's wrong, like the article has been deleted in the last 10 ns
+ }
+ if ( $oid != "" ) {
+ $oid = "&revision={$oid}" ;
+ $content_actions['validate'] = array(
+ 'class' => ($action == 'validate') ? 'selected' : false,
+ 'text' => wfMsg('val_tab'),
+ 'href' => $this->mTitle->getLocalUrl( "action=validate{$oid}" )
+ );
+ }
}
}
} else {
-- For article validation
-CREATE TABLE /*$wgDBprefix*/validate (
+DROP TABLE IF EXISTS `validate`;
+CREATE TABLE `validate` (
`val_user` int(11) NOT NULL default '0',
- `val_title` varchar(255) binary NOT NULL default '',
- `val_timestamp` varchar(14) binary NOT NULL default '',
- `val_type` int(10) unsigned NOT NULL default '0',
+ `val_page` int(11) unsigned NOT NULL default '0',
+ `val_revision` int(11) unsigned NOT NULL default '0',
+ `val_type` int(11) unsigned NOT NULL default '0',
`val_value` int(11) default '0',
`val_comment` varchar(255) NOT NULL default '',
- KEY `val_user` (`val_user`,`val_title`,`val_timestamp`)
+ KEY `val_user` (`val_user`,`val_revision`)
) TYPE=MyISAM;
-