+
+ # Record upload and update metadata cache
+ $img = Image::newFromName( $name );
+ $img->recordUpload( $oldver, wfMsg( "reverted" ) );
+
+ $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
+ $wgOut->addHTML( wfMsg( 'imagereverted' ) );
+
+ $descTitle = $img->getTitle();
+ $wgOut->returnToMain( false, $descTitle->getPrefixedText() );
+ }
+
+ function blockedIPpage() {
+ require_once( 'EditPage.php' );
+ $edit = new EditPage( $this );
+ return $edit->blockedIPpage();
+ }
+
+}
+
+/**
+ * @todo document
+ * @package MediaWiki
+ */
+class ImageHistoryList {
+ function ImageHistoryList( &$skin ) {
+ $this->skin =& $skin;
+ }
+
+ function beginImageHistoryList() {
+ $s = "\n<h2 id=\"filehistory\">" . wfMsg( 'imghistory' ) . "</h2>\n" .
+ "<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">';
+ return $s;
+ }
+
+ function endImageHistoryList() {
+ $s = "</ul>\n";
+ return $s;
+ }
+
+ function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description ) {
+ global $wgUser, $wgLang, $wgContLang, $wgTitle;
+
+ $datetime = $wgLang->timeanddate( $timestamp, true );
+ $del = wfMsg( 'deleteimg' );
+ $delall = wfMsg( 'deleteimgcompletely' );
+ $cur = wfMsg( 'cur' );
+
+ if ( $iscur ) {
+ $url = Image::imageUrl( $img );
+ $rlink = $cur;
+ if ( $wgUser->isAllowed('delete') ) {
+ $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
+ '&action=delete' );
+ $style = $this->skin->getInternalLinkAttributes( $link, $delall );
+
+ $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
+ } else {
+ $dlink = $del;
+ }
+ } else {
+ $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
+ if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) {
+ $token = urlencode( $wgUser->editToken( $img ) );
+ $rlink = $this->skin->makeKnownLinkObj( $wgTitle,
+ wfMsg( 'revertimg' ), 'action=revert&oldimage=' .
+ urlencode( $img ) . "&wpEditToken=$token" );
+ $dlink = $this->skin->makeKnownLinkObj( $wgTitle,
+ $del, 'action=delete&oldimage=' . urlencode( $img ) .
+ "&wpEditToken=$token" );
+ } else {
+ # Having live active links for non-logged in users
+ # means that bots and spiders crawling our site can
+ # inadvertently change content. Baaaad idea.
+ $rlink = wfMsg( 'revertimg' );
+ $dlink = $del;
+ }
+ }
+ if ( 0 == $user ) {
+ $userlink = $usertext;
+ } else {
+ $userlink = $this->skin->makeLinkObj(
+ Title::makeTitle( NS_USER, $usertext ),
+ $usertext );