dolibarr 24.0.0-beta
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', 'alpha');
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');
78if (!$section) {
79 dol_print_error(null, "ErrorSectionParamNotDefined");
80 exit;
81}
82
83// Load ecm object
84$ecmdir = new EcmDirectory($db);
85
86if ($module == 'ecm') {
87 // $section should be an int except if it is dir not yet created into EcmDirectory
88 $result = preg_match('/^\d+$/', $section) ? $ecmdir->fetch((int) $section) : 0;
89 if ($result > 0) {
90 $relativepath = $ecmdir->getRelativePath();
91 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
92 } else {
93 $relativepath = $section;
94 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
95 }
96} else { // For example $module == 'medias'
97 $relativepath = $section;
98 $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
99}
100
101// Permissions
102$permissiontoread = 0;
103$permissiontoadd = 0;
104$permissiontoupload = 0;
105if ($module == 'ecm') {
106 $permissiontoread = $user->hasRight("ecm", "read");
107 $permissiontoadd = $user->hasRight("ecm", "setup");
108 $permissiontoupload = $user->hasRight("ecm", "upload");
109}
110if ($module == 'medias') {
111 $permissiontoread = $user->hasRight("website", "read");
112 $permissiontoadd = $user->hasRight("website", "write");
113 $permissiontoupload = $user->hasRight("website", "write");
114}
115
116if (!$permissiontoread) {
118}
119
120
121/*
122 * Actions
123 */
124
125// Upload file
126if (GETPOST("sendit") && getDolGlobalString('MAIN_UPLOAD_DOC') && $permissiontoupload) {
127 if (dol_mkdir($upload_dir) >= 0) {
128 $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir."/".dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']);
129 if (is_numeric($resupload) && $resupload > 0) {
130 $result = $ecmdir->changeNbOfFiles('+');
131 } else {
132 $langs->load("errors");
133 if ($resupload < 0) { // Unknown error
134 setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
135 } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
136 // Files infected by a virus
137 setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
138 } else { // Known error
139 setEventMessages($langs->trans($resupload), null, 'errors');
140 }
141 }
142 } else {
143 // Failed transfer (exceeding the limit file?)
144 $langs->load("errors");
145 setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors');
146 }
147}
148
149// Remove file
150if ($action == 'confirm_deletefile' && $confirm == 'yes' && $permissiontoupload) {
151 $langs->load("other");
152 $file = $upload_dir."/".GETPOST('urlfile'); // Do not use urldecode here
153 $ret = dol_delete_file($file);
154 if ($ret) {
155 setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
156 } else {
157 setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
158 }
159
160 $result = $ecmdir->changeNbOfFiles('-');
161}
162
163// Remove dir
164if ($action == 'confirm_deletedir' && $confirm == 'yes' && $permissiontoupload) {
165 $backtourl = DOL_URL_ROOT."/ecm/index.php";
166 if ($module == 'medias') {
167 $backtourl = DOL_URL_ROOT."/website/index.php?file_manager=1";
168 }
169
170 $deletedirrecursive = (GETPOST('deletedirrecursive', 'alpha') == 'on' ? 1 : 0);
171
172 if ($module == 'ecm' && $ecmdir->id > 0) { // If manual ECM and directory is indexed into database
173 // Fetch was already done
174 $result = $ecmdir->delete($user, 'all', $deletedirrecursive);
175 if ($result <= 0) {
176 $langs->load('errors');
177 setEventMessages($langs->trans($ecmdir->error, $ecmdir->label), null, 'errors');
178 }
179 } else {
180 if ($deletedirrecursive) {
181 $resbool = dol_delete_dir_recursive($upload_dir, 0, 1);
182 } else {
183 $resbool = dol_delete_dir($upload_dir, 1);
184 }
185 if ($resbool) {
186 $result = 1;
187 } else {
188 $langs->load('errors');
189 setEventMessages($langs->trans("ErrorFailToDeleteDir", $upload_dir), null, 'errors');
190 $result = 0;
191 }
192 }
193 if ($result > 0) {
194 header("Location: ".$backtourl);
195 exit;
196 }
197}
198
199// Update dirname or description
200if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permissiontoadd) {
201 $error = 0;
202 $oldlabel = '';
203
204 if ($module == 'ecm') {
205 $oldlabel = $ecmdir->label;
206 $olddir = $ecmdir->getRelativePath(0);
207 $olddir = $conf->ecm->dir_output.'/'.$olddir;
208 } else {
209 $olddir = GETPOST('section', 'alpha');
210 $olddir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
211 }
212
213 if ($module == 'ecm') {
214 $db->begin();
215
216 // Fetch was already done
217 $ecmdir->label = dol_sanitizeFileName(GETPOST("label"));
218 $fk_parent = GETPOSTINT("catParent");
219 if ($fk_parent == -1) {
220 $ecmdir->fk_parent = 0;
221 } else {
222 $ecmdir->fk_parent = $fk_parent;
223 }
224 $ecmdir->description = GETPOST("description");
225 $ret = $extrafields->setOptionalsFromPost(null, $ecmdir);
226 if ($ret < 0) {
227 $error++;
228 }
229 if (!$error) {
230 // Actions on extra fields
231 $result = $ecmdir->insertExtraFields();
232 if ($result < 0) {
233 setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
234 $error++;
235 }
236 }
237 $result = $ecmdir->update($user);
238 if ($result > 0) {
239 $newdir = $ecmdir->getRelativePath(1);
240 $newdir = $conf->ecm->dir_output.'/'.$newdir;
241 // Try to rename file if changed
242 if (($oldlabel != $ecmdir->label && file_exists($olddir)) || ($olddir != $newdir && file_exists($olddir))) {
243 $newdir = $ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory
244 $newdir = $conf->ecm->dir_output.'/'.$newdir;
245 //print $olddir.'-'.$newdir;
246 $result = @rename($olddir, $newdir);
247 if (!$result) {
248 $langs->load('errors');
249 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
250 $error++;
251 }
252 }
253
254 if (!$error) {
255 $db->commit();
256
257 // Set new value after renaming
258 $relativepath = $ecmdir->getRelativePath();
259 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
260 } else {
261 $db->rollback();
262 }
263 } else {
264 $db->rollback();
265 setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
266 }
267 } else {
268 $newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
269
270 $result = @rename($olddir, $newdir);
271 if (!$result) {
272 $langs->load('errors');
273 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
274 $error++;
275 }
276
277 if (!$error) {
278 // Set new value after renaming
279 $relativepath = GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
280 $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
281 $section = $relativepath;
282 }
283 }
284}
285
286
287/*
288 * View
289 */
290
291$form = new Form($db);
292$formecm = new FormEcm($db);
293
294$object = new EcmDirectory($db); // Need to create a new one instance
295// fetch optionals attributes and labels
296$extrafields->fetch_name_optionals_label($object->table_element);
297
298if ($module == 'ecm' && $ecmdir->id > 0) {
299 $object->fetch($ecmdir->id);
300}
301
302llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-ecm page-dir_card');
303
304// Built the file List
305$filearrayall = dol_dir_list($upload_dir, "all", 0, '', '', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
306$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
307$totalsize = 0;
308foreach ($filearray as $key => $file) {
309 $totalsize += $file['size'];
310}
311
312
313$head = ecm_prepare_head($ecmdir, $module, $section);
314print dol_get_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), -1, 'dir');
315
316
317if ($action == 'edit') {
318 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
319 print '<input type="hidden" name="token" value="'.newToken().'">';
320 print '<input type="hidden" name="section" value="'.$section.'">';
321 print '<input type="hidden" name="module" value="'.$module.'">';
322 print '<input type="hidden" name="action" value="update">';
323}
324
325
326$morehtml = '';
327
328$morehtmlref = '/'.$module.'/'.$relativepath;
329
330if ($module == 'ecm') {
331 $s = '';
332 $result = 1;
333 $i = 0;
334 $tmpecmdir = new EcmDirectory($db); // Need to create a new one
335 if ($ecmdir->id > 0) {
336 $tmpecmdir->fetch($ecmdir->id);
337 while ($tmpecmdir && $result > 0) {
338 $tmpecmdir->ref = $tmpecmdir->label;
339 $s = $tmpecmdir->getNomUrl(1).$s;
340 if ($tmpecmdir->fk_parent) {
341 $s = ' -> '.$s;
342 $result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
343 } else {
344 $tmpecmdir = 0;
345 }
346 $i++;
347 }
348 } else {
349 $s .= implode(' -> ', explode('/', $section));
350 }
351 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s;
352}
353if ($module == 'medias') {
354 $s = 'medias -> ';
355 $result = 1;
356 $subdirs = explode('/', $section);
357 $i = 0;
358 foreach ($subdirs as $subdir) {
359 if ($i == (count($subdirs) - 1)) {
360 if ($action == 'edit') {
361 $s .= '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$subdir.'">';
362 $s .= '<input type="hidden" name="oldrelparentdir" value="'.dirname($section).'">';
363 $s .= '<input type="hidden" name="oldreldir" value="'.basename($section).'">';
364 } else {
365 $s .= $subdir;
366 }
367 }
368 if ($i < (count($subdirs) - 1)) {
369 $s .= $subdir.' -> ';
370 }
371 $i++;
372 }
373
374 $morehtmlref = $s;
375}
376
377
378dol_banner_tab($object, '', $morehtml, 0, '', '', $morehtmlref);
379
380print '<div class="fichecenter">';
381
382print '<div class="underbanner clearboth"></div>';
383print '<table class="border centpercent tableforfield">';
384/*print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
385print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
386print $s;
387print '</td></tr>';*/
388if ($module == 'ecm') {
389 if ($action == 'edit') {
390 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMDirName").'</td><td>';
391 print '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$ecmdir->label.'">';
392 print '</td></tr>';
393 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMParentDirectory").'</td><td>';
394 print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id));
395 print '</td><td>';
396 print '</td></tr>';
397 }
398
399 print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
400 if ($action == 'edit') {
401 print '<textarea class="flat quatrevingtpercent" name="description">';
402 print $ecmdir->description;
403 print '</textarea>';
404 } else {
405 print dol_nl2br($ecmdir->description);
406 }
407 print '</td></tr>';
408
409 print '<tr><td class="titlefield">'.$langs->trans("ECMCreationUser").'</td><td>';
410 if ($ecmdir->fk_user_c > 0) {
411 $userecm = new User($db);
412 $userecm->fetch($ecmdir->fk_user_c);
413 print $userecm->getNomUrl(-1);
414 }
415 print '</td></tr>';
416}
417print '<tr><td class="titlefield">'.$langs->trans("ECMCreationDate").'</td><td>';
418if ($module == 'ecm') {
419 print dol_print_date($ecmdir->date_c, 'dayhour');
420} else {
421 //var_dump($upload_dir);
422 print dol_print_date(dol_filemtime($upload_dir), 'dayhour');
423}
424print '</td></tr>';
425print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
426if ($module == 'ecm') {
427 print '/ecm/'.$relativepath;
428} else {
429 print '/'.$module.'/'.$relativepath;
430}
431print '</td></tr>';
432print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
433$nbofiles = count($filearray);
434print $nbofiles;
435if ($ecmdir->id > 0) {
436 // Test if nb is same than in cache
437 if ($nbofiles != $ecmdir->cachenbofdoc) {
438 $ecmdir->changeNbOfFiles((string) $nbofiles);
439 }
440}
441print '</td></tr>';
442print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
443print dol_print_size($totalsize);
444print '</td></tr>';
445print $object->showOptionals($extrafields, ($action == 'edit' ? 'edit' : 'view'));
446print '</table>';
447
448if ($action == 'edit') {
449 print '<br>'.$form->buttonsSaveCancel();
450}
451
452print '</div>';
453if ($action == 'edit') {
454 print '</form>';
455}
456
457print dol_get_fiche_end();
458
459
460
461// Actions buttons
462if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') {
463 print '<div class="tabsAction">';
464
465 if ($permissiontoadd) {
466 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&module='.$module.'&section='.$section.'">'.$langs->trans('Edit').'</a>';
467 }
468
469 if ($permissiontoadd) {
470 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>';
471 } else {
472 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
473 }
474
475 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);
476
477 print '</div>';
478}
479
480
481// Confirm remove file
482if ($action == 'deletefile') {
483 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');
484}
485
486// Confirm remove dir
487if ($action == 'delete' || $action == 'delete_dir') {
488 $relativepathwithoutslash = preg_replace('/[\/]$/', '', $relativepath);
489 $formquestion = [];
490 // Form to delete files
491 if (count($filearrayall) > 0) {
492 $langs->load("other");
493 $formquestion = array(
494 array('type' => 'checkbox', 'name' => 'deletedirrecursive', 'label' => $langs->trans("ContentOfDirectoryIsNotEmpty").'<br>'.$langs->trans("DeleteAlsoContentRecursively"), 'value' => '0') // Field to complete private note (not replace)
495 );
496 }
497
498 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);
499}
500
501
502/*
503$formfile = new FormFile($db);
504
505// Display upload form
506if ($user->hasRight('ecm', 'upload')) {
507 $formfile->form_attach_new_file(DOL_URL_ROOT . '/ecm/dir_card.php', '', 0, $section);
508}
509
510// List of document
511if ($user->hasRight('ecm', 'read')) {
512 $param = '&amp;section=' . $section;
513 $formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->hasRight("ecm", "upload"));
514}
515*/
516
517// End of page
518llxFooter();
519$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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
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.