r5330 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5329‎ | r5330 | r5331 >
Date:16:23, 20 September 2004
Author:hashar
Status:old
Tags:
Comment:
Fix http://bugzilla.wikipedia.org/show_bug.cgi?id=538
Return an 'emptyfile' error page if filename is empty.
Modified paths:
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUpload.php
@@ -112,6 +112,8 @@
113113 global $wgCheckFileExtensions, $wgStrictFileExtensions;
114114 global $wgFileExtensions, $wgFileBlacklist, $wgUploadSizeWarning;
115115
 116+ /** When using detailed copyright, if user filled field, assume he
 117+ * confirmed the upload */
116118 if ( $wgUseCopyrightUpload ) {
117119 $this->mUploadAffirm = 1;
118120 if ($wgCheckCopyrightUpload &&
@@ -120,12 +122,13 @@
121123 }
122124 }
123125
 126+ /** User need to confirm his upload */
124127 if ( $this->mUploadAffirm != 1) {
125128 $this->mainUploadForm( WfMsg( 'noaffirmation' ) );
126129 return;
127130 }
128131
129 - if ( '' != $this->mOname ) {
 132+ if ( $this->mOname != '' ) {
130133 $basename = strrchr( $this->mOname, '/' );
131134
132135 if ( false === $basename ) { $basename = $this->mOname; }
@@ -152,7 +155,6 @@
153156 $basename = $bn;
154157 }
155158
156 -
157159 $nt = Title::newFromText( $basename );
158160 if( !$nt ) {
159161 return $this->uploadError( wfMsg( 'illegalfilename', htmlspecialchars( $basename ) ) );
@@ -196,6 +198,9 @@
197199 }
198200 if($warning != '') return $this->uploadWarning($warning);
199201 }
 202+ } else {
 203+ return $this->uploadError('<li>'.wfMsg( 'emptyfile' ).'</li>');
 204+
200205 }
201206 if ( !is_null( $this->mUploadOldVersion ) ) {
202207 $wgUploadOldVersion = $this->mUploadOldVersion;

Status & tagging log