dolibarr 25.0.0-alpha
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 } else { // Known error, $resupload is a translation key
137 setEventMessages($langs->trans($resupload), null, 'errors');
138 }
139 }
140 } else {
141 // Failed transfer (exceeding the limit file?)
142 $langs->load("errors");
143 setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors');
144 }
145}
146
147// Remove file
148if ($action == 'confirm_deletefile' && $confirm == 'yes' && $permissiontoupload) {
149 $langs->load("other");
150 $file = $upload_dir."/".GETPOST('urlfile'); // Do not use urldecode here
151 $ret = dol_delete_file($file, 1);
152 if ($ret) {
153 setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
154 } else {
155 setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
156 }
157
158 $result = $ecmdir->changeNbOfFiles('-');
159}
160
161// Remove dir
162if ($action == 'confirm_deletedir' && $confirm == 'yes' && $permissiontoadd) { // Same permission than the Delete button and than ecm/index.php
163 $backtourl = DOL_URL_ROOT."/ecm/index.php";
164 if ($module == 'medias') {
165 $backtourl = DOL_URL_ROOT."/website/index.php?file_manager=1";
166 }
167
168 $deletedirrecursive = (GETPOST('deletedirrecursive', 'alpha') == 'on' ? 1 : 0);
169
170 if ($module == 'ecm' && $ecmdir->id > 0) { // If manual ECM and directory is indexed into database
171 // Fetch was already done
172 $result = $ecmdir->delete($user, 'all', $deletedirrecursive);
173 if ($result <= 0) {
174 $langs->load('errors');
175 setEventMessages($langs->trans($ecmdir->error, $ecmdir->label), null, 'errors');
176 }
177 } else {
178 if ($deletedirrecursive) {
179 $resbool = dol_delete_dir_recursive($upload_dir, 0, 1);
180 } else {
181 $resbool = dol_delete_dir($upload_dir, 1);
182 }
183 if ($resbool) {
184 $result = 1;
185 } else {
186 $langs->load('errors');
187 setEventMessages($langs->trans("ErrorFailToDeleteDir", $upload_dir), null, 'errors');
188 $result = 0;
189 }
190 }
191 if ($result > 0) {
192 header("Location: ".$backtourl);
193 exit;
194 }
195}
196
197// Update dirname or description
198if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permissiontoadd) {
199 $error = 0;
200 $oldlabel = '';
201
202 if ($module == 'ecm') {
203 $oldlabel = $ecmdir->label;
204 $olddir = $ecmdir->getRelativePath(0);
205 $olddir = $conf->ecm->dir_output.'/'.$olddir;
206 } else {
207 $olddir = GETPOST('section', 'alpha');
208 $olddir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
209 }
210
211 if ($module == 'ecm') {
212 $db->begin();
213
214 // Fetch was already done
215 $ecmdir->label = dol_sanitizeFileName(GETPOST("label"));
216 $fk_parent = GETPOSTINT("catParent");
217 if ($fk_parent == -1) {
218 $ecmdir->fk_parent = 0;
219 } else {
220 $ecmdir->fk_parent = $fk_parent;
221 }
222 $ecmdir->description = GETPOST("description");
223 $ret = $extrafields->setOptionalsFromPost(null, $ecmdir);
224 if ($ret < 0) {
225 $error++;
226 }
227 if (!$error) {
228 // Actions on extra fields
229 $result = $ecmdir->insertExtraFields();
230 if ($result < 0) {
231 setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
232 $error++;
233 }
234 }
235 $result = $ecmdir->update($user);
236 if ($result > 0) {
237 $newdir = $ecmdir->getRelativePath(1);
238 $newdir = $conf->ecm->dir_output.'/'.$newdir;
239 // Try to rename file if changed
240 if (($oldlabel != $ecmdir->label && file_exists($olddir)) || ($olddir != $newdir && file_exists($olddir))) {
241 $newdir = $ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory
242 $newdir = $conf->ecm->dir_output.'/'.$newdir;
243 //print $olddir.'-'.$newdir;
244 $result = @rename($olddir, $newdir);
245 if (!$result) {
246 $langs->load('errors');
247 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
248 $error++;
249 }
250 }
251
252 if (!$error) {
253 $db->commit();
254
255 // Set new value after renaming
256 $relativepath = $ecmdir->getRelativePath();
257 $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
258 } else {
259 $db->rollback();
260 }
261 } else {
262 $db->rollback();
263 setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
264 }
265 } else {
266 $oldrelparentdir = dol_sanitizePathName(GETPOST('oldrelparentdir', 'alpha'));
267 $newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'));
268 $newdir = $conf->medias->multidir_output[$conf->entity].'/'.$oldrelparentdir.'/'.$newlabel;
269 if ($newlabel === '') {
270 $error++;
271 }
272
273 $result = ($error ? false : @rename($olddir, $newdir));
274 if (!$result) {
275 $langs->load('errors');
276 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
277 $error++;
278 }
279
280 if (!$error) {
281 // Set new value after renaming
282 $relativepath = $oldrelparentdir.'/'.$newlabel;
283 $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
284 $section = $relativepath;
285 }
286 }
287}
288
289
290/*
291 * View
292 */
293
294$form = new Form($db);
295$formecm = new FormEcm($db);
296
297$object = new EcmDirectory($db); // Need to create a new one instance
298// fetch optionals attributes and labels
299$extrafields->fetch_name_optionals_label($object->table_element);
300
301if ($module == 'ecm' && $ecmdir->id > 0) {
302 $object->fetch($ecmdir->id);
303}
304
305llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-ecm page-dir_card');
306
307// Built the file List
308$filearrayall = dol_dir_list($upload_dir, "all", 0, '', '', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
309$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
310$totalsize = 0;
311foreach ($filearray as $key => $file) {
312 $totalsize += $file['size'];
313}
314
315
316$head = ecm_prepare_head($ecmdir, $module, $section);
317print dol_get_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), -1, 'dir');
318
319
320if ($action == 'edit') {
321 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
322 print '<input type="hidden" name="token" value="'.newToken().'">';
323 print '<input type="hidden" name="section" value="'.$section.'">';
324 print '<input type="hidden" name="module" value="'.$module.'">';
325 print '<input type="hidden" name="action" value="update">';
326}
327
328
329$morehtml = '';
330
331$morehtmlref = '/'.$module.'/'.$relativepath;
332
333if ($module == 'ecm') {
334 $s = '';
335 $result = 1;
336 $i = 0;
337 $tmpecmdir = new EcmDirectory($db); // Need to create a new one
338 if ($ecmdir->id > 0) {
339 $tmpecmdir->fetch($ecmdir->id);
340 while ($tmpecmdir && $result > 0) {
341 $tmpecmdir->ref = $tmpecmdir->label;
342 $s = $tmpecmdir->getNomUrl(1).$s;
343 if ($tmpecmdir->fk_parent) {
344 $s = ' -> '.$s;
345 $result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
346 } else {
347 $tmpecmdir = 0;
348 }
349 $i++;
350 }
351 } else {
352 $s .= implode(' -> ', explode('/', $section));
353 }
354 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s;
355}
356if ($module == 'medias') {
357 $s = 'medias -> ';
358 $result = 1;
359 $subdirs = explode('/', $section);
360 $i = 0;
361 foreach ($subdirs as $subdir) {
362 if ($i == (count($subdirs) - 1)) {
363 if ($action == 'edit') {
364 $s .= '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$subdir.'">';
365 $s .= '<input type="hidden" name="oldrelparentdir" value="'.dirname($section).'">';
366 $s .= '<input type="hidden" name="oldreldir" value="'.basename($section).'">';
367 } else {
368 $s .= $subdir;
369 }
370 }
371 if ($i < (count($subdirs) - 1)) {
372 $s .= $subdir.' -> ';
373 }
374 $i++;
375 }
376
377 $morehtmlref = $s;
378}
379
380
381dol_banner_tab($object, '', $morehtml, 0, '', '', $morehtmlref);
382
383print '<div class="fichecenter">';
384
385print '<div class="underbanner clearboth"></div>';
386print '<table class="border centpercent tableforfield">';
387/*print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
388print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
389print $s;
390print '</td></tr>';*/
391if ($module == 'ecm') {
392 if ($action == 'edit') {
393 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMDirName").'</td><td>';
394 print '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$ecmdir->label.'">';
395 print '</td></tr>';
396 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMParentDirectory").'</td><td>';
397 print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id));
398 print '</td><td>';
399 print '</td></tr>';
400 }
401
402 print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
403 if ($action == 'edit') {
404 print '<textarea class="flat quatrevingtpercent" name="description">';
405 print $ecmdir->description;
406 print '</textarea>';
407 } else {
408 print dol_nl2br($ecmdir->description);
409 }
410 print '</td></tr>';
411
412 print '<tr><td class="titlefield">'.$langs->trans("ECMCreationUser").'</td><td>';
413 if ($ecmdir->fk_user_c > 0) {
414 $userecm = new User($db);
415 $userecm->fetch($ecmdir->fk_user_c);
416 print $userecm->getNomUrl(-1);
417 }
418 print '</td></tr>';
419}
420print '<tr><td class="titlefield">'.$langs->trans("ECMCreationDate").'</td><td>';
421if ($module == 'ecm') {
422 print dol_print_date($ecmdir->date_c, 'dayhour');
423} else {
424 //var_dump($upload_dir);
425 print dol_print_date(dol_filemtime($upload_dir), 'dayhour');
426}
427print '</td></tr>';
428print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
429if ($module == 'ecm') {
430 print '/ecm/'.$relativepath;
431} else {
432 print '/'.$module.'/'.$relativepath;
433}
434print '</td></tr>';
435print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
436$nbofiles = count($filearray);
437print $nbofiles;
438if ($ecmdir->id > 0) {
439 // Test if nb is same than in cache
440 if ($nbofiles != $ecmdir->cachenbofdoc) {
441 $ecmdir->changeNbOfFiles((string) $nbofiles);
442 }
443}
444print '</td></tr>';
445print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
446print dol_print_size($totalsize);
447print '</td></tr>';
448print $object->showOptionals($extrafields, ($action == 'edit' ? 'edit' : 'view'));
449print '</table>';
450
451if ($action == 'edit') {
452 print '<br>'.$form->buttonsSaveCancel();
453}
454
455print '</div>';
456if ($action == 'edit') {
457 print '</form>';
458}
459
460print dol_get_fiche_end();
461
462
463
464// Actions buttons
465if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') {
466 print '<div class="tabsAction">';
467
468 if ($permissiontoadd) {
469 print '<a class="butAction" href="'.dolBuildUrl($_SERVER['PHP_SELF'], array('action' => 'edit', 'module' => $module, 'section' => $section), true).'">'.$langs->trans('Edit').'</a>';
470 }
471
472 if ($permissiontoadd) {
473 print '<a class="butAction" href="'.dolBuildUrl(DOL_URL_ROOT.'/ecm/dir_add_card.php', array('action' => 'create', 'module' => $module, 'catParent' => $section), true).'">'.$langs->trans('ECMAddSection').'</a>';
474 } else {
475 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
476 }
477
478 $paramsdelete = array(
479 'id' => $object->id,
480 'action' => 'delete',
481 'module' => $module,
482 'section' => $section,
483 );
484 if ($backtopage) {
485 $paramsdelete['backtopage'] = $backtopage;
486 }
487 print dolGetButtonAction($langs->trans('Delete'), $langs->trans('Delete'), 'delete', dolBuildUrl($_SERVER["PHP_SELF"], $paramsdelete, true), '', $permissiontoadd, array('attr' => array('class' => 'reposition')))."\n";
488
489 print '</div>';
490}
491
492
493// Confirm remove file
494if ($action == 'deletefile') {
495 $paramsdeletefile = array(
496 'section' => GETPOST("section", 'alpha'),
497 'urlfile' => GETPOST("urlfile"),
498 );
499 if ($backtopage) {
500 $paramsdeletefile['backtopage'] = $backtopage;
501 }
502 print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], $paramsdeletefile), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
503}
504
505// Confirm remove dir
506if ($action == 'delete' || $action == 'delete_dir') {
507 $relativepathwithoutslash = preg_replace('/[\/]$/', '', $relativepath);
508 $formquestion = [];
509 // Form to delete files
510 if (count($filearrayall) > 0) {
511 $langs->load("other");
512 $formquestion = array(
513 array('type' => 'checkbox', 'name' => 'deletedirrecursive', 'label' => $langs->trans("ContentOfDirectoryIsNotEmpty").'<br>'.$langs->trans("DeleteAlsoContentRecursively"), 'value' => '0') // Field to complete private note (not replace)
514 );
515 }
516
517 $paramsdeletedir = array(
518 'section' => GETPOST('section', 'alpha'),
519 'module' => $module,
520 );
521 if ($backtopage) {
522 $paramsdeletedir['backtopage'] = $backtopage;
523 }
524 print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], $paramsdeletedir), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1);
525}
526
527
528/*
529$formfile = new FormFile($db);
530
531// Display upload form
532if ($user->hasRight('ecm', 'upload')) {
533 $formfile->form_attach_new_file(DOL_URL_ROOT . '/ecm/dir_card.php', '', 0, $section);
534}
535
536// List of document
537if ($user->hasRight('ecm', 'read')) {
538 $param = '&section=' . urlencode($section);
539 $formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->hasRight("ecm", "upload"));
540}
541*/
542
543// End of page
544llxFooter();
545$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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
if(! $sortfield) if(! $sortorder) $module
Definition list.php:193
ecm_prepare_head($object, $module='ecm', $section='')
Prepare array with list of tabs.
Definition ecm.lib.php:91
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:66
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.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
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).
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)
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.
Definition html.lib.php:542
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:740
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.