replace rootFolderId with $dms->getHomeFolder()

This commit is contained in:
Uwe Steinmann 2020-12-17 21:31:03 +01:00
parent 309867ac48
commit 7746fb72db
7 changed files with 11 additions and 22 deletions

View File

@ -155,9 +155,10 @@ switch($command) {
case 'subtree': /* {{{ */ case 'subtree': /* {{{ */
if($user) { if($user) {
if(empty($_GET['node'])) if(empty($_GET['node']))
$nodeid = $settings->_rootFolderID; $folder = $dms->getHomeFolder();
else else
$nodeid = (int) $_GET['node']; $folder = $dms->getFolder((int) $_GET['node']);
if (!is_object($folder)) return '';
if(empty($_GET['showdocs'])) if(empty($_GET['showdocs']))
$showdocs = false; $showdocs = false;
else else
@ -167,9 +168,6 @@ switch($command) {
else else
$orderby = $_GET['orderby']; $orderby = $_GET['orderby'];
$folder = $dms->getFolder($nodeid);
if (!is_object($folder)) return '';
$subfolders = $folder->getSubFolders($orderby); $subfolders = $folder->getSubFolders($orderby);
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, M_READ); $subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, M_READ);
$tree = array(); $tree = array();

View File

@ -35,8 +35,6 @@ if (!$user->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
} }
$rootfolder = $dms->getFolder($settings->_rootFolderID);
$type = 'docsperuser'; $type = 'docsperuser';
if(!empty($_GET['type'])) { if(!empty($_GET['type'])) {
$type = $_GET['type']; $type = $_GET['type'];
@ -52,7 +50,6 @@ if($data = $dms->getStatisticalData($type)) {
} }
if($view) { if($view) {
$view->setParam('rootfolder', $rootfolder);
$view->setParam('type', $type); $view->setParam('type', $type);
$view->setParam('data', $data); $view->setParam('data', $data);
$view($_GET); $view($_GET);

View File

@ -31,12 +31,11 @@ require_once("inc/inc.Authentication.php");
if(isset($_GET['action']) && $_GET['action'] == 'subtree') { if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) { if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) {
$nodeid = $settings->_rootFolderID; $node = $dms->getRootFolder();
} else { } else {
$nodeid = intval($_GET["node"]); $node = $dms->getFolder(intval($_GET["node"]));
} }
$node = $dms->getFolder($nodeid);
if (!is_object($node)) { if (!is_object($node)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
} }

View File

@ -30,12 +30,11 @@ require_once("inc/inc.Authentication.php");
if(isset($_GET['action']) && $_GET['action'] == 'subtree') { if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) { if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) {
$nodeid = $settings->_rootFolderID; $node = $dms->getRootFolder();
} else { } else {
$nodeid = intval($_GET["node"]); $node = $dms->getFolder(intval($_GET["node"]));
} }
$node = $dms->getFolder($nodeid);
if (!is_object($node)) { if (!is_object($node)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
} }

View File

@ -34,7 +34,6 @@ $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if (!$user->isAdmin()) { if (!$user->isAdmin()) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
} }
$rootfolder = $dms->getFolder($settings->_rootFolderID);
if(isset($_GET['skip'])) if(isset($_GET['skip']))
$skip = $_GET['skip']; $skip = $_GET['skip'];

View File

@ -34,25 +34,23 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
$folderid = $settings->_rootFolderID; $folder = $dms->getRootFolder();
} }
else { else {
$folderid = intval($_GET["folderid"]); $folder = $dms->getFolder(intval($_GET["folderid"]));
} }
$folder = $dms->getFolder($folderid);
if (!is_object($folder)) { if (!is_object($folder)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
} }
if(isset($_GET['action']) && $_GET['action'] == 'subtree') { if(isset($_GET['action']) && $_GET['action'] == 'subtree') {
if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) { if (!isset($_GET["node"]) || !is_numeric($_GET["node"]) || intval($_GET["node"])<1) {
$nodeid = $settings->_rootFolderID; $node = $dms->getRootFolder();
} else { } else {
$nodeid = intval($_GET["node"]); $node = $dms->getFolder(intval($_GET["node"]));
} }
$node = $dms->getFolder($nodeid);
if (!is_object($node)) { if (!is_object($node)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))), getMLText("invalid_folder_id"));
} }

View File

@ -191,7 +191,6 @@ $(document).ready( function() {
function show() { /* {{{ */ function show() { /* {{{ */
$this->dms = $this->params['dms']; $this->dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
$rootfolder = $this->params['rootfolder'];
$data = $this->params['data']; $data = $this->params['data'];
$type = $this->params['type']; $type = $this->params['type'];