Drop some useless parameters to silly methods on the pretty much broken MediaWiki...
[lhc/web/wiklou.git] / includes / FileRevertForm.php
index 6945a18..f335d02 100644 (file)
@@ -11,6 +11,7 @@ class FileRevertForm {
        private $title = null;
        private $file = null;
        private $oldimage = '';
+       private $timestamp = false;
        
        /**
         * Constructor
@@ -27,7 +28,7 @@ class FileRevertForm {
         * pending authentication, confirmation, etc.
         */
        public function execute() {
-               global $wgOut, $wgRequest, $wgUser, $wgLang, $wgServer;
+               global $wgOut, $wgRequest, $wgUser, $wgLang;
                $this->setHeaders();
 
                if( wfReadOnly() ) {
@@ -70,7 +71,7 @@ class FileRevertForm {
                                $wgOut->addHtml( wfMsgExt( 'filerevert-success', 'parse', $this->title->getText(),
                                        $wgLang->date( $this->getTimestamp(), true ),
                                        $wgLang->time( $this->getTimestamp(), true ),
-                                       $wgServer . $this->file->getArchiveUrl( $this->oldimage ) ) );
+                                       wfExpandUrl( $this->file->getArchiveUrl( $this->oldimage ) ) ) );
                                $wgOut->returnToMain( false, $this->title );
                        } else {
                                $wgOut->addWikiText( $status->getWikiText() );
@@ -86,14 +87,15 @@ class FileRevertForm {
         * Show the confirmation form
         */
        private function showForm() {
-               global $wgOut, $wgUser, $wgRequest, $wgLang, $wgContLang, $wgServer;
+               global $wgOut, $wgUser, $wgRequest, $wgLang, $wgContLang;
                $timestamp = $this->getTimestamp();
 
                $form  = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) );
                $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->oldimage ) );
                $form .= '<fieldset><legend>' . wfMsgHtml( 'filerevert-legend' ) . '</legend>';
                $form .= wfMsgExt( 'filerevert-intro', 'parse', $this->title->getText(),
-                       $wgLang->date( $timestamp, true ), $wgLang->time( $timestamp, true ), $wgServer . $this->file->getArchiveUrl( $this->oldimage ) );
+                       $wgLang->date( $timestamp, true ), $wgLang->time( $timestamp, true ),
+                       wfExpandUrl( $this->file->getArchiveUrl( $this->oldimage ) ) );
                $form .= '<p>' . Xml::inputLabel( wfMsg( 'filerevert-comment' ), 'wpComment', 'wpComment',
                        60, wfMsgForContent( 'filerevert-defaultcomment',
                        $wgContLang->date( $timestamp, false, false ), $wgContLang->time( $timestamp, false, false ) ) ) . '</p>';
@@ -108,9 +110,10 @@ class FileRevertForm {
         * Set headers, titles and other bits
         */
        private function setHeaders() {
-               global $wgOut;
+               global $wgOut, $wgUser;
                $wgOut->setPageTitle( wfMsg( 'filerevert', $this->title->getText() ) );
                $wgOut->setRobotPolicy( 'noindex,nofollow' );
+               $wgOut->setSubtitle( wfMsg( 'filerevert-backlink', $wgUser->getSkin()->makeKnownLinkObj( $this->title ) ) );
        }
        
        /**
@@ -153,12 +156,11 @@ class FileRevertForm {
         * @return string
         */
        private function getTimestamp() {
-               static $timestamp = false;
-               if( $timestamp === false ) {
+               if( $this->timestamp === false ) {
                        $file = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage );
-                       $timestamp = $file->getTimestamp();
+                       $this->timestamp = $file->getTimestamp();
                }
-               return $timestamp;
+               return $this->timestamp;
        }
        
 }
\ No newline at end of file