Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -1425,24 +1425,8 @@ |
1426 | 1426 | $templateIDs = $wgOut->mTemplateIds; |
1427 | 1427 | $imageSHA1Keys = $wgOut->fr_ImageSHA1Keys; |
1428 | 1428 | } |
1429 | | - # NS -> title -> rev ID mapping |
1430 | | - foreach( $templateIDs as $namespace => $title ) { |
1431 | | - foreach( $title as $dbKey => $revId ) { |
1432 | | - $title = Title::makeTitle( $namespace, $dbKey ); |
1433 | | - $templateParams .= $title->getPrefixedDBKey() . "|" . $revId . "#"; |
1434 | | - } |
1435 | | - } |
1436 | | - # Image -> timestamp -> sha1 mapping |
1437 | | - foreach( $imageSHA1Keys as $dbKey => $timeAndSHA1 ) { |
1438 | | - foreach( $timeAndSHA1 as $time => $sha1 ) { |
1439 | | - $imageParams .= $dbKey . "|" . $time . "|" . $sha1 . "#"; |
1440 | | - } |
1441 | | - } |
1442 | | - # For image pages, note the displayed image version |
1443 | | - if( $this->parent instanceof ImagePage ) { |
1444 | | - $file = $this->parent->getDisplayedFile(); |
1445 | | - $fileVersion = $file->getTimestamp() . "#" . $file->getSha1(); |
1446 | | - } |
| 1429 | + list($templateParams,$imageParams,$fileVersion) = |
| 1430 | + FlaggedRevs::getIncludeParams( $this->parent, $templateIDs, $imageSHA1Keys ); |
1447 | 1431 | |
1448 | 1432 | $form .= Xml::openElement( 'span', array('style' => 'white-space: nowrap;') ); |
1449 | 1433 | # Hide comment if needed |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1151,4 +1151,34 @@ |
1152 | 1152 | $params = array( 'tags' => (object)$wgFlaggedRevsFeedbackTags ); |
1153 | 1153 | return Xml::encodeJsVar( (object)$params ); |
1154 | 1154 | } |
| 1155 | + |
| 1156 | + /** |
| 1157 | + * Get template and image parameters from parser output |
| 1158 | + * @param Article $article |
| 1159 | + * @param array $templateIDs (from ParserOutput/OutputPage->mTemplateIds) |
| 1160 | + * @param array $imageSHA1Keys (from ParserOutput/OutputPage->fr_ImageSHA1Keys) |
| 1161 | + * @returns array( templateParams, imageParams, fileVersion ) |
| 1162 | + */ |
| 1163 | + public static function getIncludeParams( $article, $templateIDs, $imageSHA1Keys ) { |
| 1164 | + $templateParams = $imageParams = $fileVersion = ''; |
| 1165 | + # NS -> title -> rev ID mapping |
| 1166 | + foreach( $templateIDs as $namespace => $t ) { |
| 1167 | + foreach( $t as $dbKey => $revId ) { |
| 1168 | + $temptitle = Title::makeTitle( $namespace, $dbKey ); |
| 1169 | + $templateParams .= $temptitle->getPrefixedDBKey() . "|" . $revId . "#"; |
| 1170 | + } |
| 1171 | + } |
| 1172 | + # Image -> timestamp -> sha1 mapping |
| 1173 | + foreach( $imageSHA1Keys as $dbKey => $timeAndSHA1 ) { |
| 1174 | + foreach( $timeAndSHA1 as $time => $sha1 ) { |
| 1175 | + $imageParams .= $dbKey . "|" . $time . "|" . $sha1 . "#"; |
| 1176 | + } |
| 1177 | + } |
| 1178 | + # For image pages, note the displayed image version |
| 1179 | + if( $article instanceof ImagePage ) { |
| 1180 | + $file = $article->getDisplayedFile(); |
| 1181 | + $fileVersion = $file->getTimestamp() . "#" . $file->getSha1(); |
| 1182 | + } |
| 1183 | + return array( $templateParams, $imageParams, $fileVersion ); |
| 1184 | + } |
1155 | 1185 | } |
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php |
— | — | @@ -366,7 +366,7 @@ |
367 | 367 | return "<li> $difflink $revlink " . $this->skin->revUserLink($rev) . " " . $this->skin->revComment($rev) . "</li>"; |
368 | 368 | } |
369 | 369 | |
370 | | - private function submit() { |
| 370 | + public function submit() { |
371 | 371 | global $wgUser; |
372 | 372 | # If all values are set to zero, this has been unapproved |
373 | 373 | $approved = !count( FlaggedRevs::getDimensions() ) && $this->approve; |