return;
}
$nt = Title::newFromText( $basename );
+ $nt->setNamespace( Namespace::getImage() );
$this->mUploadSaveName = $nt->getDBkey();
/* Don't allow users to override the blacklist */
( $this->mUploadSize > $wgUploadSizeWarning ) ) {
return $this->uploadWarning( wfMsg( "largefile" ) );
}
+ if ( !$nt->userCanEdit() ) {
+ return $this->uploadError( wfMsg( "protectedpage" ) );
+ }
+ if($nt->getArticleID()) {
+ $sk = $wgUser->getSkin();
+ $dname = $wgLang->getNsText( Namespace::getImage() ) . ":{$this->mUploadSaveName}";
+ $dlink = $sk->makeKnownLink( $dname, $dname );
+ return $this->uploadWarning( wfMsg( "fileexists", $dlink ) );
+ }
}
if ( !is_null( $this->mUploadOldVersion ) ) {
$wgUploadOldVersion = $this->mUploadOldVersion;
'badfilename' => "Image name has been changed to \"$1\".",
'badfiletype' => "\".$1\" is not a recommended image file format.",
'largefile' => 'It is recommended that images not exceed 100k in size.',
+'fileexists' => 'A file with this name exists already, please check $1 if you are not sure if you want to change it.',
'successfulupload' => 'Successful upload',
'fileuploaded' => "File \"$1\" uploaded successfully.
Please follow this link: $2 to the description page and fill