From b49ce256543fa6647a17757eec1a098a5bda8f1f Mon Sep 17 00:00:00 2001 From: bshuttle Date: Mon, 20 Feb 2006 13:31:13 +0000 Subject: [PATCH] adding last stage of the existance checking. --- plugins/ktcore/folder/addDocument.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/ktcore/folder/addDocument.php b/plugins/ktcore/folder/addDocument.php index 6987123..ebb9753 100644 --- a/plugins/ktcore/folder/addDocument.php +++ b/plugins/ktcore/folder/addDocument.php @@ -90,7 +90,18 @@ class KTFolderAddDocumentAction extends KTFolderAction { $aFile = $this->oValidator->validateFile($_FILES['file'], $aErrorOptions); $sTitle = $this->oValidator->validateString($_REQUEST['title'], $aErrorOptions); - + + $iFolderId = $this->oFolder->getId(); + if (Document::fileExists(basename($aFile['name']), $iFolderId)) { + $this->errorRedirectToMain(_('There is already a file with that filename in this folder.'), sprintf('fFolderId=%d', $this->oFolder->getId())); + exit(0); + } + + if (Document::nameExists($sTitle, $iFolderId)) { + $this->errorRedirectToMain(_('There is already a file with that title in this folder.'), sprintf('fFolderId=%d', $this->oFolder->getId())); + exit(0); + } + $matches = array(); $aFields = array(); foreach ($_REQUEST as $k => $v) { -- libgit2 0.21.4