dolibarr 22.0.5
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-2025 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';
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
30require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
34require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php';
35
45// Load translation files required by page
46$langs->loadLangs(array('ecm', 'companies', 'other'));
47
48$action = GETPOST('action', 'alpha');
49$cancel = GETPOST('cancel');
50$backtopage = GETPOST('backtopage', 'alpha');
51$confirm = GETPOST('confirm', 'alpha');
52
53$module = GETPOST('module', 'alpha');
54$website = GETPOST('website', 'alpha');
55$pageid = GETPOSTINT('pageid');
56if (empty($module)) {
57 $module = 'ecm';
58}
59
60// Get parameters
61$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
62$sortfield = GETPOST('sortfield', 'aZ09comma');
63$sortorder = GETPOST('sortorder', 'aZ09comma');
64$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
65if (empty($page) || $page == -1) {
66 $page = 0;
67} // If $page is not defined, or '' or -1
68$offset = $limit * $page;
69$pageprev = $page - 1;
70$pagenext = $page + 1;
71if (!$sortorder) {
72 $sortorder = "ASC";
73}
74if (!$sortfield) {
75 $sortfield = "name";
76}
77
78$section = GETPOST("section", 'alpha') ? GETPOST("section", 'alpha') : GETPOST("relativedir", 'alpha');
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("mailing", "lire") || $user->hasRight("website", "read"));
113 $permissiontoadd = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
114 $permissiontoupload = ($user->hasRight("mailing", "creer") || $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);
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' && $permissiontoupload) {
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 $newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
270
271 $result = @rename($olddir, $newdir);
272 if (!$result) {
273 $langs->load('errors');
274 setEventMessages($langs->trans('ErrorFailToRenameDir', $olddir, $newdir), null, 'errors');
275 $error++;
276 }
277
278 if (!$error) {
279 // Set new value after renaming
280 $relativepath = GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha');
281 $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath;
282 $section = $relativepath;
283 }
284 }
285}
286
287
288/*
289 * View
290 */
291
292$form = new Form($db);
293$formecm = new FormEcm($db);
294
295$object = new EcmDirectory($db); // Need to create a new one instance
296$extrafields = new ExtraFields($db);
297// fetch optionals attributes and labels
298$extrafields->fetch_name_optionals_label($object->table_element);
299
300if ($module == 'ecm' && $ecmdir->id > 0) {
301 $object->fetch($ecmdir->id);
302}
303
304llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-ecm page-dir_card');
305
306// Built the file List
307$filearrayall = dol_dir_list($upload_dir, "all", 0, '', '', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
308$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
309$totalsize = 0;
310foreach ($filearray as $key => $file) {
311 $totalsize += $file['size'];
312}
313
314
315$head = ecm_prepare_head($ecmdir, $module, $section);
316print dol_get_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), -1, 'dir');
317
318
319if ($action == 'edit') {
320 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
321 print '<input type="hidden" name="token" value="'.newToken().'">';
322 print '<input type="hidden" name="section" value="'.$section.'">';
323 print '<input type="hidden" name="module" value="'.$module.'">';
324 print '<input type="hidden" name="action" value="update">';
325}
326
327
328$morehtml = '';
329
330$morehtmlref = '/'.$module.'/'.$relativepath;
331
332if ($module == 'ecm') {
333 $s = '';
334 $result = 1;
335 $i = 0;
336 $tmpecmdir = new EcmDirectory($db); // Need to create a new one
337 if ($ecmdir->id > 0) {
338 $tmpecmdir->fetch($ecmdir->id);
339 while ($tmpecmdir && $result > 0) {
340 $tmpecmdir->ref = $tmpecmdir->label;
341 $s = $tmpecmdir->getNomUrl(1).$s;
342 if ($tmpecmdir->fk_parent) {
343 $s = ' -> '.$s;
344 $result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
345 } else {
346 $tmpecmdir = 0;
347 }
348 $i++;
349 }
350 } else {
351 $s .= implode(' -> ', explode('/', $section));
352 }
353 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s;
354}
355if ($module == 'medias') {
356 $s = 'medias -> ';
357 $result = 1;
358 $subdirs = explode('/', $section);
359 $i = 0;
360 foreach ($subdirs as $subdir) {
361 if ($i == (count($subdirs) - 1)) {
362 if ($action == 'edit') {
363 $s .= '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$subdir.'">';
364 $s .= '<input type="hidden" name="oldrelparentdir" value="'.dirname($section).'">';
365 $s .= '<input type="hidden" name="oldreldir" value="'.basename($section).'">';
366 } else {
367 $s .= $subdir;
368 }
369 }
370 if ($i < (count($subdirs) - 1)) {
371 $s .= $subdir.' -> ';
372 }
373 $i++;
374 }
375
376 $morehtmlref = $s;
377}
378
379
380dol_banner_tab($object, '', $morehtml, 0, '', '', $morehtmlref);
381
382print '<div class="fichecenter">';
383
384print '<div class="underbanner clearboth"></div>';
385print '<table class="border centpercent tableforfield">';
386/*print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
387print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
388print $s;
389print '</td></tr>';*/
390if ($module == 'ecm') {
391 if ($action == 'edit') {
392 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMDirName").'</td><td>';
393 print '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$ecmdir->label.'">';
394 print '</td></tr>';
395 print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMParentDirectory").'</td><td>';
396 print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id));
397 print '</td><td>';
398 print '</td></tr>';
399 }
400
401 print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
402 if ($action == 'edit') {
403 print '<textarea class="flat quatrevingtpercent" name="description">';
404 print $ecmdir->description;
405 print '</textarea>';
406 } else {
407 print dol_nl2br($ecmdir->description);
408 }
409 print '</td></tr>';
410
411 print '<tr><td class="titlefield">'.$langs->trans("ECMCreationUser").'</td><td>';
412 if ($ecmdir->fk_user_c > 0) {
413 $userecm = new User($db);
414 $userecm->fetch($ecmdir->fk_user_c);
415 print $userecm->getNomUrl(-1);
416 }
417 print '</td></tr>';
418}
419print '<tr><td class="titlefield">'.$langs->trans("ECMCreationDate").'</td><td>';
420if ($module == 'ecm') {
421 print dol_print_date($ecmdir->date_c, 'dayhour');
422} else {
423 //var_dump($upload_dir);
424 print dol_print_date(dol_filemtime($upload_dir), 'dayhour');
425}
426print '</td></tr>';
427print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
428if ($module == 'ecm') {
429 print '/ecm/'.$relativepath;
430} else {
431 print '/'.$module.'/'.$relativepath;
432}
433print '</td></tr>';
434print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
435$nbofiles = count($filearray);
436print $nbofiles;
437if ($ecmdir->id > 0) {
438 // Test if nb is same than in cache
439 if ($nbofiles != $ecmdir->cachenbofdoc) {
440 $ecmdir->changeNbOfFiles((string) $nbofiles);
441 }
442}
443print '</td></tr>';
444print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
445print dol_print_size($totalsize);
446print '</td></tr>';
447print $object->showOptionals($extrafields, ($action == 'edit' ? 'edit' : 'view'));
448print '</table>';
449
450if ($action == 'edit') {
451 print '<br>'.$form->buttonsSaveCancel();
452}
453
454print '</div>';
455if ($action == 'edit') {
456 print '</form>';
457}
458
459print dol_get_fiche_end();
460
461
462
463// Actions buttons
464if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') {
465 print '<div class="tabsAction">';
466
467 if ($permissiontoadd) {
468 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().($module ? '&module='.$module : '').'&section='.$section.'">'.$langs->trans('Edit').'</a>';
469 }
470
471 if ($permissiontoadd) {
472 print '<a class="butAction" href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&token='.newToken().($module ? '&module='.$module : '').'&catParent='.$section.'">'.$langs->trans('ECMAddSection').'</a>';
473 } else {
474 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
475 }
476
477 print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($module ? '&module='.urlencode($module) : '').'&section='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permissiontoadd);
478
479 print '</div>';
480}
481
482
483// Confirm remove file
484if ($action == 'deletefile') {
485 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');
486}
487
488// Confirm remove dir
489if ($action == 'delete' || $action == 'delete_dir') {
490 $relativepathwithoutslash = preg_replace('/[\/]$/', '', $relativepath);
491 $formquestion = [];
492 // Form to delete files
493 if (count($filearrayall) > 0) {
494 $langs->load("other");
495 $formquestion = array(
496 array('type' => 'checkbox', 'name' => 'deletedirrecursive', 'label' => $langs->trans("ContentOfDirectoryIsNotEmpty").'<br>'.$langs->trans("DeleteAlsoContentRecursively"), 'value' => '0') // Field to complete private note (not replace)
497 );
498 }
499
500 print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).($module ? '&module='.$module : '').($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1);
501}
502
503
504/*
505$formfile = new FormFile($db);
506
507// Display upload form
508if ($user->hasRight('ecm', 'upload')) {
509 $formfile->form_attach_new_file(DOL_URL_ROOT . '/ecm/dir_card.php', '', 0, $section);
510}
511
512// List of document
513if ($user->hasRight('ecm', 'read')) {
514 $param = '&amp;section=' . $section;
515 $formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->rights->ecm->upload);
516}
517*/
518
519// End of page
520llxFooter();
521$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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 standard extra fields.
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
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:63
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.