dolibarr 24.0.3
dir_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20
27// Load Dolibarr environment
28require '../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
42require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php';
43
44// Load translation files required by page
45$langs->loadLangs(array('ecm', 'companies', 'other'));
46
47$action = GETPOST('action', 'alpha');
48$cancel = GETPOST('cancel');
49$backtopage = GETPOST('backtopage', 'alpha');
50$confirm = GETPOST('confirm', 'alpha');
51
52$module = GETPOST('module', 'aZ09arobase');
53$website = GETPOST('website', 'alpha');
54$pageid = GETPOSTINT('pageid');
55if (empty($module)) {
56 $module = 'ecm';
57}
58
59// Get parameters
60$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
61$sortfield = GETPOST('sortfield', 'aZ09comma');
62$sortorder = GETPOST('sortorder', 'aZ09comma');
63$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
64if (empty($page) || $page == -1) {
65 $page = 0;
66} // If $page is not defined, or '' or -1
67$offset = $limit * $page;
68$pageprev = $page - 1;
69$pagenext = $page + 1;
70if (!$sortorder) {
71 $sortorder = "ASC";
72}
73if (!$sortfield) {
74 $sortfield = "name";
75}
76
77$section = GETPOST("section", 'alpha') ? GETPOST("section", 'alpha') : GETPOST("relativedir", 'alpha');
78$section = dol_sanitizePathName($section); // Protect against path traversal ('..' is not removed by 'alpha' filter)
79if (!$section) {
80 dol_print_error(null, "ErrorSectionParamNotDefined");
81 exit;
82}
83
84// Load ecm object
85$ecmdir = new EcmDirectory($db);
86
87if ($module == 'ecm') {
88 // $section should be an int except if it is dir not yet created into EcmDirectory
89 $result = preg_match('/^\d+$/', $section) ? $ecmdir->fetch((int) $section) : 0;
90 if ($result > 0) {
91 $relativepath = $ecmdir->getRelativePath();
92 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
93 } else {
94 $relativepath = $section;
95 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
96 }
97} else { // For example $module == 'medias'
98 $relativepath = $section;
99 $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
100}
101
102// Permissions
103$permissiontoread = 0;
104$permissiontoadd = 0;
105$permissiontoupload = 0;
106if ($module == 'ecm') {
107 $permissiontoread = $user->hasRight("ecm", "read");
108 $permissiontoadd = $user->hasRight("ecm", "setup");
109 $permissiontoupload = $user->hasRight("ecm", "upload");
110}
111if ($module == 'medias') {
112 $permissiontoread = $user->hasRight("website", "read");
113 $permissiontoadd = $user->hasRight("website", "write");
114 $permissiontoupload = $user->hasRight("website", "write");
115}
116
117if (!$permissiontoread) {
119}
120
121
122/*
123 * Actions
124 */
125
126// Upload file
127if (GETPOST("sendit") && getDolGlobalString('MAIN_UPLOAD_DOC') && $permissiontoupload) {
128 if (dol_mkdir($upload_dir) >= 0) {
129 $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir."/".dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']);
130 if (is_numeric($resupload) && $resupload > 0) {
131 $result = $ecmdir->changeNbOfFiles('+');
132 } else {
133 $langs->load("errors");
134 if ($resupload < 0) { // Unknown error
135 setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
136 } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
137 // Files infected by a virus
138 setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
139 } else { // Known error
140 setEventMessages($langs->trans($resupload), null, 'errors');
141 }
142 }
143 } else {
144 // Failed transfer (exceeding the limit file?)
145 $langs->load("errors");
146 setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors');
147 }
148}
149
150// Remove file
151if ($action == 'confirm_deletefile' && $confirm == 'yes' && $permissiontoupload) {
152 $langs->load("other");
153 $file = $upload_dir."/".GETPOST('urlfile'); // Do not use urldecode here
154 $ret = dol_delete_file($file, 1);
155 if ($ret) {
156 setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
157 } else {
158 setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
159 }
160
161 $result = $ecmdir->changeNbOfFiles('-');
162}
163
164// Remove dir
165if ($action == 'confirm_deletedir' && $confirm == 'yes' && $permissiontoadd) { // Same permission than the Delete button and than ecm/index.php
166 $backtourl = DOL_URL_ROOT."/ecm/index.php";
167 if ($module == 'medias') {
168 $backtourl = DOL_URL_ROOT."/website/index.php?file_manager=1";
169 }
170
171 $deletedirrecursive = (GETPOST('deletedirrecursive', 'alpha') == 'on' ? 1 : 0);
172
173 if ($module == 'ecm' && $ecmdir->id > 0) { // If manual ECM and directory is indexed into database
174 // Fetch was already done
175 $result = $ecmdir->delete($user, 'all', $deletedirrecursive);
176 if ($result <= 0) {
177 $langs->load('errors');
178 setEventMessages($langs->trans($ecmdir->error, $ecmdir->label), null, 'errors');
179 }
180 } else {
181 if ($deletedirrecursive) {
182 $resbool = dol_delete_dir_recursive($upload_dir, 0, 1);
183 } else {
184 $resbool = dol_delete_dir($upload_dir, 1);
185 }
186 if ($resbool) {
187 $result = 1;
188 } else {
189 $langs->load('errors');
190 setEventMessages($langs->trans("ErrorFailToDeleteDir", $upload_dir), null, 'errors');
191 $result = 0;
192 }
193 }
194 if ($result > 0) {
195 header("Location: ".$backtourl);
196 exit;
197 }
198}
199
200// Update dirname or description
201if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permissiontoadd) {
202 $error = 0;
203 $oldlabel = '';
204
205 if ($module == 'ecm') {
206 $oldlabel = $ecmdir->label;
207 $olddir = $ecmdir->getRelativePath(0);
208 $olddir = $conf->ecm->dir_output.'/'.$olddir;
209 } else {
210 $olddir = GETPOST('section', 'alpha');
211 $olddir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
212 }
213
214 if ($module == 'ecm') {
215 $db->begin();
216
217 // Fetch was already done
218 $ecmdir->label = dol_sanitizeFileName(GETPOST("label"));
219 $fk_parent = GETPOSTINT("catParent");
220 if ($fk_parent == -1) {
221 $ecmdir->fk_parent = 0;
222 } else {
223 $ecmdir->fk_parent = $fk_parent;
224 }
225 $ecmdir->description = GETPOST("description");
226 $ret = $extrafields->setOptionalsFromPost(null, $ecmdir);
227 if ($ret < 0) {
228 $error++;
229 }
230 if (!$error) {
231 // Actions on extra fields
232 $result = $ecmdir->insertExtraFields();
233 if ($result < 0) {
234 setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
235 $error++;
236 }
237 }
238 $result = $ecmdir->update($user);
239 if ($result > 0) {
240 $newdir = $ecmdir->getRelativePath(1);
241 $newdir = $conf->ecm->dir_output.'/'.$newdir;
242 // Try to rename file if changed
243 if (($oldlabel != $ecmdir->label && file_exists($olddir)) || ($olddir != $newdir && file_exists($olddir))) {
244 $newdir = $ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory
245 $newdir = $conf->ecm->dir_output.'/'.$newdir;
246 //print $olddir.'-'.$newdir;
247 $result = @rename($olddir, $newdir);
248 if (!$result) {
249 $langs->load('errors');
250 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
251 $error++;
252 }
253 }
254
255 if (!$error) {
256 $db->commit();
257
258 // Set new value after renaming
259 $relativepath = $ecmdir->getRelativePath();
260 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
261 } else {
262 $db->rollback();
263 }
264 } else {
265 $db->rollback();
266 setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
267 }
268 } else {
269 $oldrelparentdir = dol_sanitizePathName(GETPOST('oldrelparentdir', 'alpha'));
270 $newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'));
271 $newdir = $conf->medias->multidir_output[$conf->entity].'/'.$oldrelparentdir.'/'.$newlabel;
272 if ($newlabel === '') {
273 $error++;
274 }
275
276 $result = ($error ? false : @rename($olddir, $newdir));
277 if (!$result) {
278 $langs->load('errors');
279 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
280 $error++;
281 }
282
283 if (!$error) {
284 // Set new value after renaming
285 $relativepath = $oldrelparentdir.'/'.$newlabel;
286 $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
287 $section = $relativepath;
288 }
289 }
290}
291
292
293/*
294 * View
295 */
296
297$form = new Form($db);
298$formecm = new FormEcm($db);
299
300$object = new EcmDirectory($db); // Need to create a new one instance
301// fetch optionals attributes and labels
302$extrafields->fetch_name_optionals_label($object->table_element);
303
304if ($module == 'ecm' && $ecmdir->id > 0) {
305 $object->fetch($ecmdir->id);
306}
307
308llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-ecm page-dir_card');
309
310// Built the file List
311$filearrayall = dol_dir_list($upload_dir, "all", 0, '', '', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
312$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
313$totalsize = 0;
314foreach ($filearray as $key => $file) {
315 $totalsize += $file['size'];
316}
317
318
319$head = ecm_prepare_head($ecmdir, $module, $section);
320print dol_get_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), -1, 'dir');
321
322
323if ($action == 'edit') {
324 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
325 print '<input type="hidden" name="token" value="'.newToken().'">';
326 print '<input type="hidden" name="section" value="'.$section.'">';
327 print '<input type="hidden" name="module" value="'.$module.'">';
328 print '<input type="hidden" name="action" value="update">';
329}
330
331
332$morehtml = '';
333
334$morehtmlref = '/'.$module.'/'.$relativepath;
335
336if ($module == 'ecm') {
337 $s = '';
338 $result = 1;
339 $i = 0;
340 $tmpecmdir = new EcmDirectory($db); // Need to create a new one
341 if ($ecmdir->id > 0) {
342 $tmpecmdir->fetch($ecmdir->id);
343 while ($tmpecmdir && $result > 0) {
344 $tmpecmdir->ref = $tmpecmdir->label;
345 $s = $tmpecmdir->getNomUrl(1).$s;
346 if ($tmpecmdir->fk_parent) {
347 $s = ' -> '.$s;
348 $result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
349 } else {
350 $tmpecmdir = 0;
351 }
352 $i++;
353 }
354 } else {
355 $s .= implode(' -> ', explode('/', $section));
356 }
357 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s;
358}
359if ($module == 'medias') {
360 $s = 'medias -> ';
361 $result = 1;
362 $subdirs = explode('/', $section);
363 $i = 0;
364 foreach ($subdirs as $subdir) {
365 if ($i == (count($subdirs) - 1)) {
366 if ($action == 'edit') {
367 $s .= '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$subdir.'">';
368 $s .= '<input type="hidden" name="oldrelparentdir" value="'.dirname($section).'">';
369 $s .= '<input type="hidden" name="oldreldir" value="'.basename($section).'">';
370 } else {
371 $s .= $subdir;
372 }
373 }
374 if ($i < (count($subdirs) - 1)) {
375 $s .= $subdir.' -> ';
376 }
377 $i++;
378 }
379
380 $morehtmlref = $s;
381}
382
383
384dol_banner_tab($object, '', $morehtml, 0, '', '', $morehtmlref);
385
386print '<div class="fichecenter">';
387
388print '<div class="underbanner clearboth"></div>';
389print '<table class="border centpercent tableforfield">';
390/*print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
391print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
392print $s;
393print '</td></tr>';*/
394if ($module == 'ecm') {
395 if ($action == 'edit') {
396 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMDirName").'</td><td>';
397 print '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$ecmdir->label.'">';
398 print '</td></tr>';
399 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMParentDirectory").'</td><td>';
400 print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id));
401 print '</td><td>';
402 print '</td></tr>';
403 }
404
405 print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
406 if ($action == 'edit') {
407 print '<textarea class="flat quatrevingtpercent" name="description">';
408 print $ecmdir->description;
409 print '</textarea>';
410 } else {
411 print dol_nl2br($ecmdir->description);
412 }
413 print '</td></tr>';
414
415 print '<tr><td class="titlefield">'.$langs->trans("ECMCreationUser").'</td><td>';
416 if ($ecmdir->fk_user_c > 0) {
417 $userecm = new User($db);
418 $userecm->fetch($ecmdir->fk_user_c);
419 print $userecm->getNomUrl(-1);
420 }
421 print '</td></tr>';
422}
423print '<tr><td class="titlefield">'.$langs->trans("ECMCreationDate").'</td><td>';
424if ($module == 'ecm') {
425 print dol_print_date($ecmdir->date_c, 'dayhour');
426} else {
427 //var_dump($upload_dir);
428 print dol_print_date(dol_filemtime($upload_dir), 'dayhour');
429}
430print '</td></tr>';
431print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
432if ($module == 'ecm') {
433 print '/ecm/'.$relativepath;
434} else {
435 print '/'.$module.'/'.$relativepath;
436}
437print '</td></tr>';
438print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
439$nbofiles = count($filearray);
440print $nbofiles;
441if ($ecmdir->id > 0) {
442 // Test if nb is same than in cache
443 if ($nbofiles != $ecmdir->cachenbofdoc) {
444 $ecmdir->changeNbOfFiles((string) $nbofiles);
445 }
446}
447print '</td></tr>';
448print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
449print dol_print_size($totalsize);
450print '</td></tr>';
451print $object->showOptionals($extrafields, ($action == 'edit' ? 'edit' : 'view'));
452print '</table>';
453
454if ($action == 'edit') {
455 print '<br>'.$form->buttonsSaveCancel();
456}
457
458print '</div>';
459if ($action == 'edit') {
460 print '</form>';
461}
462
463print dol_get_fiche_end();
464
465
466
467// Actions buttons
468if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') {
469 print '<div class="tabsAction">';
470
471 if ($permissiontoadd) {
472 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&module='.$module.'&section='.$section.'">'.$langs->trans('Edit').'</a>';
473 }
474
475 if ($permissiontoadd) {
476 print '<a class="butAction" href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&token='.newToken().'&module='.$module.'&catParent='.$section.'">'.$langs->trans('ECMAddSection').'</a>';
477 } else {
478 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
479 }
480
481 print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&module='.urlencode($module).'&section='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permissiontoadd);
482
483 print '</div>';
484}
485
486
487// Confirm remove file
488if ($action == 'deletefile') {
489 print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST("section", 'alpha')).'&urlfile='.urlencode(GETPOST("urlfile")).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
490}
491
492// Confirm remove dir
493if ($action == 'delete' || $action == 'delete_dir') {
494 $relativepathwithoutslash = preg_replace('/[\/]$/', '', $relativepath);
495 $formquestion = [];
496 // Form to delete files
497 if (count($filearrayall) > 0) {
498 $langs->load("other");
499 $formquestion = array(
500 array('type' => 'checkbox', 'name' => 'deletedirrecursive', 'label' => $langs->trans("ContentOfDirectoryIsNotEmpty").'<br>'.$langs->trans("DeleteAlsoContentRecursively"), 'value' => '0') // Field to complete private note (not replace)
501 );
502 }
503
504 print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).'&module='.$module.($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1);
505}
506
507
508/*
509$formfile = new FormFile($db);
510
511// Display upload form
512if ($user->hasRight('ecm', 'upload')) {
513 $formfile->form_attach_new_file(DOL_URL_ROOT . '/ecm/dir_card.php', '', 0, $section);
514}
515
516// List of document
517if ($user->hasRight('ecm', 'read')) {
518 $param = '&amp;section=' . $section;
519 $formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->hasRight("ecm", "upload"));
520}
521*/
522
523// End of page
524llxFooter();
525$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage ECM directories.
Class to manage HTML component for ECM and generic filemanager.
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
ecm_prepare_head($object, $module='ecm', $section='')
Prepare array with list of tabs.
Definition ecm.lib.php:91
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_filemtime($pathoffile)
Return time of a file.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_unescapefile($filename)
Unescape a file submitted by upload.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:64
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formatted size.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.