Switch some HTMLForms in special pages to OOUI
[lhc/web/wiklou.git] / includes / specials / SpecialListfiles.php
index c68341c..2d79aaf 100644 (file)
@@ -84,14 +84,26 @@ class ImageListPager extends TablePager {
        function __construct( IContextSource $context, $userName = null, $search = '',
                $including = false, $showAll = false
        ) {
+               $this->setContext( $context );
                $this->mIncluding = $including;
                $this->mShowAll = $showAll;
 
                if ( $userName !== null && $userName !== '' ) {
                        $nt = Title::newFromText( $userName, NS_USER );
+                       $user = User::newFromName( $userName, false );
                        if ( !is_null( $nt ) ) {
                                $this->mUserName = $nt->getText();
                        }
+                       if ( !$user || ( $user->isAnon() && !User::isIP( $user->getName() ) ) ) {
+                               $this->getOutput()->wrapWikiMsg(
+                                       "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
+                                       array(
+                                               'listfiles-userdoesnotexist',
+                                               wfEscapeWikiText( $userName ),
+                                       )
+                               );
+                       }
+
                }
 
                if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) {
@@ -107,7 +119,7 @@ class ImageListPager extends TablePager {
                }
 
                if ( !$including ) {
-                       if ( $context->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) {
+                       if ( $this->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) {
                                $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
                        } else {
                                $this->mDefaultDirection = IndexPager::DIR_ASCENDING;
@@ -302,6 +314,7 @@ class ImageListPager extends TablePager {
         * @param int $limit
         * @param bool $asc
         * @return array
+        * @throws MWException
         */
        function reallyDoQuery( $offset, $limit, $asc ) {
                $prevTableName = $this->mTableName;
@@ -424,7 +437,7 @@ class ImageListPager extends TablePager {
        function formatValue( $field, $value ) {
                switch ( $field ) {
                        case 'thumb':
-                               $opt = array( 'time' => $this->mCurrentRow->img_timestamp );
+                               $opt = array( 'time' => wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) );
                                $file = RepoGroup::singleton()->getLocalRepo()->findFile( $value, $opt );
                                // If statement for paranoia
                                if ( $file ) {