Commit 4f5c7866df796d2c9cfe5caa711cf7e2ddd025ba
1 parent
02b7dbf5
KTS-3088
"Linking a document to itself does not create a link." Fixed. Added a check to return an error if the document is trying to link to itself. Committed By: Jonathan Byrne Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8174 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
12 additions
and
0 deletions
plugins/ktstandard/KTDocumentLinks.php
| ... | ... | @@ -288,6 +288,18 @@ class KTDocumentLinkAction extends KTDocumentAction { |
| 288 | 288 | |
| 289 | 289 | // select a type for the link |
| 290 | 290 | function do_type_select() { |
| 291 | + | |
| 292 | + //Checking to see if the document is being linked to itself and returning an error if it is. | |
| 293 | + $iTempParentDocId = $_REQUEST['fDocumentId']; | |
| 294 | + $aTempDocuments = $_REQUEST['linkselection']; | |
| 295 | + foreach ($aTempDocuments as $iTempDocId) | |
| 296 | + { | |
| 297 | + if($iTempParentDocId == $iTempDocId) | |
| 298 | + { | |
| 299 | + $this->errorRedirectToMain(_kt('A document cannot be linked to itself.')); | |
| 300 | + } | |
| 301 | + } | |
| 302 | + | |
| 291 | 303 | $this->oPage->setBreadcrumbDetails(_kt("link")); |
| 292 | 304 | |
| 293 | 305 | $sType = (isset($_REQUEST['linktype'])) ? $_REQUEST['linktype'] : 'internal'; | ... | ... |