Merge "Allow third party code to hook-up MIME type detection"
[lhc/web/wiklou.git] / includes / specials / SpecialListfiles.php
index 6b54fe8..1faa013 100644 (file)
@@ -170,9 +170,14 @@ class ImageListPager extends TablePager {
                                'img_name' => $this->msg( 'listfiles_name' )->text(),
                                'thumb' => $this->msg( 'listfiles_thumb' )->text(),
                                'img_size' => $this->msg( 'listfiles_size' )->text(),
-                               'img_user_text' => $this->msg( 'listfiles_user' )->text(),
-                               'img_description' => $this->msg( 'listfiles_description' )->text(),
                        );
+                       if ( is_null( $this->mUserName ) ) {
+                               // Do not show username if filtering by username
+                               $this->mFieldNames['img_user_text'] = $this->msg( 'listfiles_user' )->text();
+                       }
+                       // img_description down here, in order so that its still after the username field.
+                       $this->mFieldNames['img_description'] = $this->msg( 'listfiles_description' )->text();
+
                        if ( !$wgMiserMode && !$this->mShowAll ) {
                                $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
                        }
@@ -455,6 +460,19 @@ class ImageListPager extends TablePager {
                                        );
                                        $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
 
+                                       // Add delete links if allowed
+                                       // From https://github.com/Wikia/app/pull/3859
+                                       if ( $filePage->userCan( 'delete', $this->getUser() ) ) {
+                                               $deleteMsg = $this->msg( 'listfiles-delete' )->escaped();
+
+                                               $delete = Linker::linkKnown(
+                                                       $filePage, $deleteMsg, array(), array( 'action' => 'delete' )
+                                               );
+                                               $delete = $this->msg( 'parentheses' )->rawParams( $delete )->escaped();
+
+                                               return "$link $download $delete";
+                                       }
+
                                        return "$link $download";
                                } else {
                                        return htmlspecialchars( $value );