From: Magnus Manske Date: Thu, 22 Jul 2004 21:04:33 +0000 (+0000) Subject: Article validation code X-Git-Tag: 1.5.0alpha1~2619 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=bfef9d4f81eb0388a72b51087cb307cd5dba7b85;p=lhc%2Fweb%2Fwiklou.git Article validation code --- diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index fd7616dde0..98b7a1714b 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -436,9 +436,13 @@ } if ( $wgUser->getID() != 0 && $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) { + global $wgArticle ; + extract( $wgRequest->getValues( 'oldid' ) ); + if ( isset ( $oldid ) ) $article_time = "×tamp=" . $wgArticle->mTimestamp ; + else $article_time = ""; $content_actions['validate'] = array('class' => ($action == 'validate') ? 'selected' : false , 'text' => wfMsg('val_tab'), - 'href' => $this->makeUrl($this->thispage, 'action=validate')); + 'href' => $this->makeUrl($this->thispage, "action=validate{$article_time}")); } } else { diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index 392183d87c..60c7b7dc97 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -70,11 +70,23 @@ class Validation } else $heading = "" ; $article_time = "" ; - if ( isset ( $_GET['timestamp'] ) ) $article_time = $_GET['timestamp'] ; + if ( isset ( $_GET['timestamp'] ) ) $article_time = $_GET['timestamp'] ; + else $article_time = "" ; $article = Title::newFromText ( $article_title ) ; # Now we get all the "votes" for the different versions of this article for this user - $val = $this->get_prev_data ( $wgUser->getID() , $article_title ) ; + $val = $this->get_prev_data ( $wgUser->getID() , $article_title , $article_time ) ; + + # No votes for this version, initial data + if ( count ( $val ) == 0 ) + { + if ( $article_time == "" ) + { + $res = wfQuery( "select cur_timestamp FROM cur WHERE cur_title=\"{$article_title}\" AND cur_namespace=0", DB_READ ); + if ( $s = wfFetchObject( $res ) ) $article_time = $s->cur_timestamp ; + } + $val[$article_time] = array () ; + } # User has clicked "Doit" before, so evaluate form if ( isset ( $_POST['doit'] ) ) @@ -120,7 +132,7 @@ class Validation $topstyle = "style='border-top:2px solid black'" ; foreach ( $val AS $time => $stuff ) { - if ( $time == $article_time ) $html .= wfMsg("val_this_version") ; + if ( $time != $article_time ) $html .= wfMsg("val_this_version") ; else $html .= str_replace ( "$1" , gmdate("F d, Y H:i:s",wfTimestamp2Unix($time)) , wfMsg("val_version_of") ) ; $html .= "
\n" ; $html .= "" ;