Commit 7f9fafb2323df6fc13196757dc89754b791c0d2b
1 parent
ce7d3210
Give an error message if a non-existent folderId is given.
Submitted by: Nicolas Quienot (nquienot) SF Tracker: 1119196 git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3309 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
17 additions
and
1 deletions
lib/browse/FolderBrowser.inc
| ... | ... | @@ -108,6 +108,10 @@ class FolderBrowser extends Browser { |
| 108 | 108 | |
| 109 | 109 | $default->log->debug("FolderBrowser::browseByFolder: folderID=" . $iFolderID); |
| 110 | 110 | |
| 111 | + if (!Folder::folderExistsID($iFolderID)) { | |
| 112 | + return new PEAR_Error(_("This folder does not exist")); | |
| 113 | + } | |
| 114 | + | |
| 111 | 115 | // get the folder |
| 112 | 116 | $rootFolder = Folder::get($iFolderID); |
| 113 | 117 | // FIXME: check permissions for the current folder before getting children | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/browseBL.php
| ... | ... | @@ -101,6 +101,19 @@ $sectionName = $oBrowser->getSectionName(); |
| 101 | 101 | // instantiate my content pattern |
| 102 | 102 | $oContent = new PatternCustom(); |
| 103 | 103 | $aResults = $oBrowser->browse(); |
| 104 | + | |
| 105 | +require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 106 | + | |
| 107 | +if (PEAR::isError($aResults)) { | |
| 108 | + $oContent->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a>\n"); | |
| 109 | + $main->setErrorMessage($aResults->getMessage()); | |
| 110 | + $main->setCentralPayload($oContent); | |
| 111 | + $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 112 | + $main->setSubmitMethod("GET"); | |
| 113 | + $main->render(); | |
| 114 | + exit(0); | |
| 115 | +} | |
| 116 | + | |
| 104 | 117 | if (($fBrowseType == "folder") && (!isset($fFolderID))) { |
| 105 | 118 | // FIXME: check that the first folder in the array exists, no permission otherwise |
| 106 | 119 | if ($default->browseToRoot) { |
| ... | ... | @@ -110,7 +123,6 @@ if (($fBrowseType == "folder") && (!isset($fFolderID))) { |
| 110 | 123 | } |
| 111 | 124 | } |
| 112 | 125 | |
| 113 | -require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 114 | 126 | // display the browse results |
| 115 | 127 | $oContent->addHtml(renderPage($aResults, $fBrowseType, $fSortBy, $fSortDirection)); |
| 116 | 128 | $main->setCentralPayload($oContent); | ... | ... |