From 070c4e581f6ae26e4ad857ec0df58de00c81ed93 Mon Sep 17 00:00:00 2001 From: jonathan_byrne Date: Thu, 28 Feb 2008 08:38:42 +0000 Subject: [PATCH] KTS-3088 "Linking a document to itself does not create a link." --- plugins/ktstandard/KTDocumentLinks.php | 12 ++++++++++++ 1 file changed, 12 insertions(+), 0 deletions(-) diff --git a/plugins/ktstandard/KTDocumentLinks.php b/plugins/ktstandard/KTDocumentLinks.php index b92f7c6..6486475 100644 --- a/plugins/ktstandard/KTDocumentLinks.php +++ b/plugins/ktstandard/KTDocumentLinks.php @@ -288,6 +288,18 @@ class KTDocumentLinkAction extends KTDocumentAction { // select a type for the link function do_type_select() { + + //Checking to see if the document is being linked to itself and returning an error if it is. + $iTempParentDocId = $_REQUEST['fDocumentId']; + $aTempDocuments = $_REQUEST['linkselection']; + foreach ($aTempDocuments as $iTempDocId) + { + if($iTempParentDocId == $iTempDocId) + { + $this->errorRedirectToMain(_kt('A document cannot be linked to itself.')); + } + } + $this->oPage->setBreadcrumbDetails(_kt("link")); $sType = (isset($_REQUEST['linktype'])) ? $_REQUEST['linktype'] : 'internal'; -- libgit2 0.21.4