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