ajaxdirtree.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. <?php
  2. /* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/core/ajax/ajaxdirtree.php
  20. * \ingroup ecm
  21. * \brief This script returns content of a directory for filetree
  22. */
  23. // This script is called with a POST method.
  24. // Directory to scan (full path) is inside POST['dir'] and encode by js escape() if ajax is used or encoded by urlencode if mode=noajax
  25. if (!defined('NOTOKENRENEWAL')) {
  26. define('NOTOKENRENEWAL', 1); // Disables token renewal
  27. }
  28. if (!defined('NOREQUIREMENU')) {
  29. define('NOREQUIREMENU', '1');
  30. }
  31. if (!defined('NOREQUIREHTML')) {
  32. define('NOREQUIREHTML', '1');
  33. }
  34. if (!defined('NOREQUIREAJAX')) {
  35. define('NOREQUIREAJAX', '1');
  36. }
  37. if (!isset($mode) || $mode != 'noajax') { // For ajax call
  38. $res = @include '../../main.inc.php';
  39. include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  40. include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  41. include_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
  42. include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
  43. include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
  44. $openeddir = GETPOST('openeddir');
  45. $modulepart = GETPOST('modulepart');
  46. $selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape()
  47. $preopened = GETPOST('preopened');
  48. if ($selecteddir != '/') {
  49. $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/'
  50. }
  51. } else {
  52. // For no ajax call
  53. $openeddir = GETPOST('openeddir');
  54. $modulepart = GETPOST('modulepart');
  55. $selecteddir = GETPOST('dir');
  56. $preopened = GETPOST('preopened');
  57. if ($selecteddir != '/') {
  58. $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/'
  59. }
  60. if (empty($url)) {
  61. $url = DOL_URL_ROOT.'/ecm/index.php';
  62. }
  63. }
  64. $websitekey = GETPOST('websitekey', 'alpha');
  65. $pageid = GETPOST('pageid', 'int');
  66. // Load translation files required by the page
  67. $langs->load("ecm");
  68. // Define fullpathselecteddir.
  69. $fullpathselecteddir = '<none>';
  70. if ($modulepart == 'ecm') {
  71. $fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
  72. $fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : '');
  73. } elseif ($modulepart == 'medias') {
  74. $fullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
  75. $fullpathpreopened = $dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : '');
  76. }
  77. // Security:
  78. // On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
  79. if (preg_match('/\.\./', $fullpathselecteddir) || preg_match('/[<>|]/', $fullpathselecteddir)) {
  80. dol_syslog("Refused to deliver file ".$original_file);
  81. // Do no show plain path in shown error message
  82. dol_print_error(0, $langs->trans("ErrorFileNameInvalid", GETPOST("file")));
  83. exit;
  84. }
  85. // Check permissions
  86. if ($modulepart == 'ecm') {
  87. if (!$user->rights->ecm->read) {
  88. accessforbidden();
  89. }
  90. } elseif ($modulepart == 'medias') {
  91. // Always allowed
  92. }
  93. /*
  94. * View
  95. */
  96. if (!isset($mode) || $mode != 'noajax') { // if ajax mode
  97. top_httphead();
  98. }
  99. //print '<!-- selecteddir (relative dir we click on) = '.$selecteddir.', openeddir = '.$openeddir.', modulepart='.$modulepart.', preopened='.$preopened.' -->'."\n";
  100. $userstatic = new User($db);
  101. $form = new Form($db);
  102. $ecmdirstatic = new EcmDirectory($db);
  103. // Load full manual tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
  104. if (empty($sqltree)) {
  105. $sqltree = $ecmdirstatic->get_full_arbo(0);
  106. }
  107. // Try to find selected dir id into $sqltree and save it into $current_ecmdir_id
  108. $current_ecmdir_id = -1;
  109. foreach ($sqltree as $keycursor => $val) {
  110. //print $val['fullrelativename']." == ".$selecteddir;
  111. if ($val['fullrelativename'] == $selecteddir) {
  112. $current_ecmdir_id = $keycursor;
  113. }
  114. }
  115. if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
  116. treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened);
  117. // TODO Find a solution to not output this code for each leaf we open
  118. // Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
  119. // Because the content is reloaded by ajax call, we must also reenable some jquery hooks
  120. print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip (reload into ajaxdirtree) -->\n";
  121. print '<script type="text/javascript">
  122. jQuery(document).ready(function () {
  123. jQuery(".classfortooltip").tooltip({
  124. show: { collision: "flipfit", effect:\'toggle\', delay:50 },
  125. hide: { delay: 50 }, /* If I enable effect:\'toggle\' here, a bug appears: the tooltip is shown when collpasing a new dir if it was shown before */
  126. tooltipClass: "mytooltip",
  127. content: function () {
  128. return $(this).prop(\'title\'); /* To force to get title as is */
  129. }
  130. });
  131. });
  132. </script>';
  133. // This ajax service is called only when a directory $selecteddir is opened but not when closed.
  134. //print '<script type="text/javascript">';
  135. //print "loadandshowpreview('".dol_escape_js($selecteddir)."');";
  136. //print '</script>';
  137. }
  138. if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_JS)) {
  139. print '<ul class="ecmjqft">';
  140. // Load full manual tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
  141. if (empty($sqltree)) {
  142. $sqltree = $ecmdirstatic->get_full_arbo(0); // Slow
  143. }
  144. // ----- This section will show a tree from a fulltree array -----
  145. // $section must also be defined
  146. // ----------------------------------------------------------------
  147. // Define fullpathselected ( _x_y_z ) of $section parameter (!! not into ajaxdirtree)
  148. $fullpathselected = '';
  149. foreach ($sqltree as $key => $val) {
  150. //print $val['id']."-".$section."<br>";
  151. if ($val['id'] == $section) {
  152. $fullpathselected = $val['fullpath'];
  153. break;
  154. }
  155. }
  156. //print "fullpathselected=".$fullpathselected."<br>";
  157. // Update expandedsectionarray in session
  158. $expandedsectionarray = array();
  159. if (isset($_SESSION['dol_ecmexpandedsectionarray'])) {
  160. $expandedsectionarray = explode(',', $_SESSION['dol_ecmexpandedsectionarray']);
  161. }
  162. if ($section && GETPOST('sectionexpand') == 'true') {
  163. // We add all sections that are parent of opened section
  164. $pathtosection = explode('_', $fullpathselected);
  165. foreach ($pathtosection as $idcursor) {
  166. if ($idcursor && !in_array($idcursor, $expandedsectionarray)) { // Not already in array
  167. $expandedsectionarray[] = $idcursor;
  168. }
  169. }
  170. $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray);
  171. }
  172. if ($section && GETPOST('sectionexpand') == 'false') {
  173. // We removed all expanded sections that are child of the closed section
  174. $oldexpandedsectionarray = $expandedsectionarray;
  175. $expandedsectionarray = array(); // Reset
  176. foreach ($oldexpandedsectionarray as $sectioncursor) {
  177. // TODO is_in_subtree(fulltree,sectionparent,sectionchild) does nox exists. Enable or remove this...
  178. //if ($sectioncursor && ! is_in_subtree($sqltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor;
  179. }
  180. $_SESSION['dol_ecmexpandedsectionarray'] = join(',', $expandedsectionarray);
  181. }
  182. //print $_SESSION['dol_ecmexpandedsectionarray'].'<br>';
  183. $nbofentries = 0;
  184. $oldvallevel = 0;
  185. foreach ($sqltree as $key => $val) {
  186. $ecmdirstatic->id = $val['id'];
  187. $ecmdirstatic->ref = $val['label'];
  188. // Refresh cache
  189. if (preg_match('/refresh/i', $action)) {
  190. $result = $ecmdirstatic->fetch($val['id']);
  191. $ecmdirstatic->ref = $ecmdirstatic->label;
  192. $result = $ecmdirstatic->refreshcachenboffile(0);
  193. $val['cachenbofdoc'] = $result;
  194. }
  195. //$fullpathparent=preg_replace('/(_[^_]+)$/i','',$val['fullpath']);
  196. // Define showline
  197. $showline = 0;
  198. // If directory is son of expanded directory, we show line
  199. if (in_array($val['id_mere'], $expandedsectionarray)) {
  200. $showline = 4;
  201. } elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) {
  202. // If directory is brother of selected directory, we show line
  203. $showline = 3;
  204. } elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) {
  205. // If directory is parent of selected directory or is selected directory, we show line
  206. $showline = 2;
  207. } elseif ($val['level'] < 2) {
  208. // If we are level one we show line
  209. $showline = 1;
  210. }
  211. if ($showline) {
  212. if (in_array($val['id'], $expandedsectionarray)) {
  213. $option = 'indexexpanded';
  214. } else {
  215. $option = 'indexnotexpanded';
  216. }
  217. //print $option;
  218. print '<li class="directory collapsed">';
  219. // Show tree graph pictos
  220. $cpt = 1;
  221. while ($cpt < $sqltree[$key]['level']) {
  222. print ' &nbsp; &nbsp;';
  223. $cpt++;
  224. }
  225. $resarray = tree_showpad($sqltree, $key, 1);
  226. $a = $resarray[0];
  227. $nbofsubdir = $resarray[1];
  228. $nboffilesinsubdir = $resarray[2];
  229. // Show link
  230. print $ecmdirstatic->getNomUrl(0, $option, 32, 'class="fmdirlia jqft ecmjqft"');
  231. print '<div class="ecmjqft">';
  232. // Nb of docs
  233. print '<table class="nobordernopadding"><tr><td>';
  234. print $val['cachenbofdoc'];
  235. print '</td>';
  236. print '<td class="left">';
  237. if ($nbofsubdir && $nboffilesinsubdir) {
  238. print '<span style="color: #AAAAAA">+'.$nboffilesinsubdir.'</span> ';
  239. }
  240. print '</td>';
  241. // Info
  242. print '<td class="center">';
  243. $userstatic->id = $val['fk_user_c'];
  244. $userstatic->lastname = $val['login_c'];
  245. $userstatic->statut = $val['statut_c'];
  246. $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
  247. $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
  248. $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
  249. $htmltooltip .= '<b>'.$langs->trans("ECMCreationDate").'</b>: '.dol_print_date($val['date_c'], "dayhour").'<br>';
  250. $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
  251. $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>';
  252. if ($nbofsubdir) {
  253. $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
  254. } else {
  255. $htmltooltip .= '<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>';
  256. }
  257. print $form->textwithpicto('', $htmltooltip, 1, 'info');
  258. print "</td>";
  259. print '</tr></table>';
  260. print '</div>';
  261. print "</li>\n";
  262. }
  263. $oldvallevel = $val['level'];
  264. $nbofentries++;
  265. }
  266. // If nothing to show
  267. if ($nbofentries == 0) {
  268. print '<li class="directory collapsed">';
  269. print '<div class="ecmjqft">';
  270. print $langs->trans("ECMNoDirectoryYet");
  271. print '</div>';
  272. print "</li>\n";
  273. }
  274. print '</ul>';
  275. }
  276. // Close db if mode is not noajax
  277. if ((!isset($mode) || $mode != 'noajax') && is_object($db)) {
  278. $db->close();
  279. }
  280. /**
  281. * treeOutputForAbsoluteDir
  282. *
  283. * @param array $sqltree Sqltree
  284. * @param string $selecteddir Selected dir
  285. * @param string $fullpathselecteddir Full path of selected dir
  286. * @param string $modulepart Modulepart
  287. * @param string $websitekey Website key
  288. * @param int $pageid Page id
  289. * @param string $preopened Current open dir
  290. * @param string $fullpathpreopened Full path of current open dir
  291. * @param int $depth Depth
  292. * @return void
  293. */
  294. function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth = 0)
  295. {
  296. global $conf, $db, $langs, $form;
  297. global $dolibarr_main_data_root;
  298. $ecmdirstatic = new EcmDirectory($db);
  299. $userstatic = new User($db);
  300. if (file_exists($fullpathselecteddir)) {
  301. $files = @scandir($fullpathselecteddir);
  302. if (!empty($files)) {
  303. natcasesort($files);
  304. if (count($files) > 2) { /* The 2 accounts for . and .. */
  305. echo '<ul class="ecmjqft" style="display: none;">'."\n";
  306. // All dirs
  307. foreach ($files as $file) { // $file can be '.', '..', or 'My dir' or 'My file'
  308. if ($file == 'temp') {
  309. continue;
  310. }
  311. $nbofsubdir = 0;
  312. $nboffilesinsubdir = 0;
  313. $val = array();
  314. // Loop on all database entries (sqltree) to find the one matching the subdir found into dir to scan
  315. foreach ($sqltree as $key => $tmpval) {
  316. //print "-- key=".$key." - ".$tmpval['fullrelativename']." vs ".(($selecteddir != '/'?$selecteddir.'/':'').$file)."<br>\n";
  317. if ($tmpval['fullrelativename'] == (($selecteddir != '/' ? $selecteddir.'/' : '').$file)) { // We found equivalent record into database
  318. $val = $tmpval;
  319. $resarray = tree_showpad($sqltree, $key, 1);
  320. // Refresh cache for this subdir
  321. if (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] < 0) { // Cache is not up to date, so we update it for this directory t
  322. $result = $ecmdirstatic->fetch($val['id']);
  323. $ecmdirstatic->ref = $ecmdirstatic->label;
  324. $result = $ecmdirstatic->refreshcachenboffile(0);
  325. $val['cachenbofdoc'] = $result;
  326. }
  327. $a = $resarray[0];
  328. $nbofsubdir = $resarray[1];
  329. $nboffilesinsubdir = $resarray[2];
  330. break;
  331. }
  332. }
  333. //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
  334. if ($file != '.' && $file != '..' && ((!empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir.(preg_match('/\/$/', $fullpathselecteddir) ? '' : '/').$file))) {
  335. if (empty($val['fullrelativename'])) { // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
  336. $val['fullrelativename'] = (($selecteddir && $selecteddir != '/') ? $selecteddir.'/' : '').$file;
  337. $val['id'] = 0;
  338. $val['label'] = $file;
  339. $val['description'] = '';
  340. $nboffilesinsubdir = $langs->trans("Unknown");
  341. }
  342. $collapsedorexpanded = 'collapsed';
  343. if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) {
  344. $collapsedorexpanded = 'expanded';
  345. }
  346. print '<li class="directory '.$collapsedorexpanded.'">'; // collapsed is opposite if expanded
  347. print "<a class=\"fmdirlia jqft ecmjqft\" href=\"";
  348. print "#";
  349. print "\" rel=\"".dol_escape_htmltag($val['fullrelativename'].'/')."\" id=\"fmdirlia_id_".$val['id']."\"";
  350. print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")";
  351. print "\">";
  352. print dol_escape_htmltag($file);
  353. print "</a>";
  354. print '<div class="ecmjqft">';
  355. print '<table class="nobordernopadding"><tr>';
  356. /*print '<td class="left">';
  357. print dol_escape_htmltag($file);
  358. print '</td>';*/
  359. // Nb of docs
  360. print '<td class="right">';
  361. print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0) ? $val['cachenbofdoc'] : '&nbsp;';
  362. print '</td>';
  363. print '<td class="left">';
  364. if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) {
  365. print '<span class="opacitymedium">+'.$nboffilesinsubdir.'</span> ';
  366. }
  367. print '</td>';
  368. // Edit link
  369. print '<td class="right" width="18"><a class="editfielda" href="';
  370. print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'&section='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
  371. print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
  372. print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
  373. // Add link
  374. //print '<td class="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
  375. //print '<td class="right" width="14">&nbsp;</td>';
  376. // Info
  377. if ($modulepart == 'ecm') {
  378. print '<td class="right" width="18">';
  379. $userstatic->id = isset($val['fk_user_c']) ? $val['fk_user_c'] : 0;
  380. $userstatic->lastname = isset($val['login_c']) ? $val['login_c'] : 0;
  381. $userstatic->statut = isset($val['statut_c']) ? $val['statut_c'] : 0;
  382. $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
  383. $htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
  384. $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
  385. $htmltooltip .= '<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c']) ?dol_print_date($val['date_c'], "dayhour") : $langs->trans("NeedRefresh")).'<br>';
  386. $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
  387. $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0) ? $val['cachenbofdoc'] : $langs->trans("NeedRefresh")).'<br>';
  388. if ($nboffilesinsubdir > 0) {
  389. $htmltooltip .= '<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
  390. } else {
  391. $htmltooltip .= '<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).'<br>';
  392. }
  393. print $form->textwithpicto('', $htmltooltip, 1, "info");
  394. print "</td>";
  395. }
  396. print "</tr></table>\n";
  397. print '</div>';
  398. //print 'selecteddir='.$selecteddir.' preopened='.$preopened.' $val[\'fullrelativename\']='.$val['fullrelativename']."<br>\n";
  399. if (preg_match('/^'.preg_quote($val['fullrelativename'].'/', '/').'/', $preopened)) {
  400. //print 'modulepart='.$modulepart.' fullpathselecteddir='.$fullpathselecteddir.' - val[fullrelativename] (in database)='.$val['fullrelativename'].' - val[id]='.$val['id'].' - is_dir='.dol_is_dir($fullpathselecteddir . $file).' - file='.$file."\n";
  401. $newselecteddir = $val['fullrelativename'];
  402. $newfullpathselecteddir = '';
  403. if ($modulepart == 'ecm') {
  404. $newfullpathselecteddir = $conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
  405. } elseif ($modulepart == 'medias') {
  406. $newfullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : '');
  407. }
  408. if ($newfullpathselecteddir) {
  409. treeOutputForAbsoluteDir($sqltree, $newselecteddir, $newfullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth + 1);
  410. }
  411. }
  412. print "</li>\n";
  413. }
  414. }
  415. echo "</ul>\n";
  416. }
  417. } else {
  418. print "PermissionDenied";
  419. }
  420. }
  421. }