Merge "Add new grammar forms for language names in Russian"
[lhc/web/wiklou.git] / includes / upload / UploadBase.php
index b06b91e..1568859 100644 (file)
@@ -1118,10 +1118,10 @@ abstract class UploadBase {
                        '<a href',
                        '<body',
                        '<head',
-                       '<html', #also in safari
+                       '<html', # also in safari
                        '<img',
                        '<pre',
-                       '<script', #also in safari
+                       '<script', # also in safari
                        '<table'
                );
 
@@ -1492,7 +1492,7 @@ abstract class UploadBase {
                        }
                }
 
-               return false; //No scripts detected
+               return false; // No scripts detected
        }
 
        /**
@@ -1655,7 +1655,7 @@ abstract class UploadBase {
                        $output = trim( $output );
 
                        if ( !$output ) {
-                               $output = true; #if there's no output, return true
+                               $output = true; # if there's no output, return true
                        } elseif ( $msgPattern ) {
                                $groups = array();
                                if ( preg_match( $msgPattern, $output, $groups ) ) {
@@ -1706,24 +1706,21 @@ abstract class UploadBase {
         * Check if a user is the last uploader
         *
         * @param User $user
-        * @param string $img Image name
+        * @param File $img
         * @return bool
         */
-       public static function userCanReUpload( User $user, $img ) {
+       public static function userCanReUpload( User $user, File $img ) {
                if ( $user->isAllowed( 'reupload' ) ) {
                        return true; // non-conditional
-               }
-               if ( !$user->isAllowed( 'reupload-own' ) ) {
+               } elseif ( !$user->isAllowed( 'reupload-own' ) ) {
                        return false;
                }
-               if ( is_string( $img ) ) {
-                       $img = wfLocalFile( $img );
-               }
+
                if ( !( $img instanceof LocalFile ) ) {
                        return false;
                }
 
-               $img->load( File::READ_LATEST );
+               $img->load();
 
                return $user->getId() == $img->getUser( 'id' );
        }