From: Gabriel Wicke Date: Thu, 24 Jun 2004 22:02:59 +0000 (+0000) Subject: * Image protection: if the image page is protected, uploading a new file is protected... X-Git-Tag: 1.5.0alpha1~2780 X-Git-Url: http://git.cyclocoop.org/geomaker.php?a=commitdiff_plain;h=18631648be860dfd163e1d4c3c7cf93fb8d3b000;p=lhc%2Fweb%2Fwiklou.git * Image protection: if the image page is protected, uploading a new file is protected as well * Filename already exists warning: new key 'fileexists' with param $1 = link to the existing image page. Please translate. --- diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 3b37ba5270..41b8c443dc 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -107,6 +107,7 @@ class UploadForm { return; } $nt = Title::newFromText( $basename ); + $nt->setNamespace( Namespace::getImage() ); $this->mUploadSaveName = $nt->getDBkey(); /* Don't allow users to override the blacklist */ @@ -131,6 +132,15 @@ class UploadForm { ( $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; diff --git a/languages/Language.php b/languages/Language.php index 670060cee4..dfff3d190c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -804,6 +804,7 @@ agrees to license it under the terms of the $1.", '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