dolibarr  18.0.6
listevents.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
5  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 // Load Dolibarr environment
28 require '../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
31 
32 if (!$user->admin) {
34 }
35 
36 $action = GETPOST('action', 'aZ09');
37 $confirm = GETPOST('confirm', 'alpha');
38 
39 // Security check
40 if ($user->socid > 0) {
41  $action = '';
42  $socid = $user->socid;
43 }
44 
45 // Load translation files required by the page
46 $langs->loadLangs(array("companies", "admin", "users", "other","withdrawals"));
47 
48 // Load variable for pagination
49 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
50 $sortfield = GETPOST('sortfield', 'aZ09comma');
51 $sortorder = GETPOST('sortorder', 'aZ09comma');
52 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
53 if (empty($page) || $page == -1) {
54  $page = 0;
55 } // If $page is not defined, or '' or -1
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
59 if (!$sortfield) {
60  $sortfield = "e.rowid";
61 }
62 if (!$sortorder) {
63  $sortorder = "DESC";
64 }
65 
66 $search_rowid = GETPOST("search_rowid", "int");
67 $search_code = GETPOST("search_code", "alpha");
68 $search_ip = GETPOST("search_ip", "alpha");
69 $search_user = GETPOST("search_user", "alpha");
70 $search_desc = GETPOST("search_desc", "alpha");
71 $search_ua = GETPOST("search_ua", "restricthtml");
72 $search_prefix_session = GETPOST("search_prefix_session", "restricthtml");
73 $optioncss = GETPOST("optioncss", "aZ"); // Option for the css output (always '' except when 'print')
74 
75 $now = dol_now();
76 $nowarray = dol_getdate($now);
77 
78 if (GETPOST("date_startmonth", 'int') > 0) {
79  $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth", 'int'), GETPOST("date_startday", 'int'), GETPOST("date_startyear", 'int'), 'tzuserrel');
80 } else {
81  $date_start = '';
82 }
83 if (GETPOST("date_endmonth", 'int') > 0) {
84  $date_end = dol_get_last_hour(dol_mktime(23, 59, 59, GETPOST("date_endmonth", 'int'), GETPOST("date_endday", 'int'), GETPOST("date_endyear", 'int'), 'tzuserrel'), 'tzuserrel');
85 } else {
86  $date_end = '';
87 }
88 
89 // checks:if date_start>date_end then date_end=date_start + 24 hours
90 if ($date_start !== '' && $date_end !== '' && $date_start > $date_end) {
91  $date_end = $date_start + 86400;
92 }
93 
94 
95 if (!GETPOSTISSET('pageplusoneold') && !GETPOSTISSET('page') && $date_start === '') { // We define date_start and date_end
96  $date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
97 }
98 if (!GETPOSTISSET('pageplusoneold') && !GETPOSTISSET('page') && $date_end === '') {
99  $date_end = dol_get_last_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
100 }
101 
102 // Set $date_startmonth...
103 $date_startday = '';
104 $date_startmonth = '';
105 $date_startyear = '';
106 $date_endday = '';
107 $date_endmonth = '';
108 $date_endyear = '';
109 if ($date_start !== '') {
110  $tmp = dol_getdate($date_start);
111  $date_startday = $tmp['mday'];
112  $date_startmonth = $tmp['mon'];
113  $date_startyear = $tmp['year'];
114 }
115 if ($date_end !== '') {
116  $tmp = dol_getdate($date_end);
117  $date_endday = $tmp['mday'];
118  $date_endmonth = $tmp['mon'];
119  $date_endyear = $tmp['year'];
120 }
121 
122 // Add prefix session
123 $arrayfields = array(
124  'e.prefix_session' => array(
125  'label'=>'UserAgent',
126  'checked'=>(empty($conf->global->AUDIT_ENABLE_PREFIX_SESSION) ? 0 : 1),
127  'enabled'=>(empty($conf->global->AUDIT_ENABLE_PREFIX_SESSION) ? 0 : 1),
128  'position'=>110
129  )
130 );
131 
132 
133 /*
134  * Actions
135  */
136 
137 $now = dol_now();
138 
139 // Purge search criteria
140 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
141  $date_start = '';
142  $date_end = '';
143  $date_startday = '';
144  $date_endday = '';
145  $date_startmonth = '';
146  $date_endmonth = '';
147  $date_startyear = '';
148  $date_endyear = '';
149  $search_rowid = '';
150  $search_code = '';
151  $search_ip = '';
152  $search_user = '';
153  $search_desc = '';
154  $search_ua = '';
155  $search_prefix_session = '';
156 }
157 
158 // Purge audit events
159 if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) {
160  $error = 0;
161 
162  $db->begin();
163  $securityevents = new Events($db);
164 
165  // Delete events
166  $sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
167  $sql .= " WHERE entity = ".$conf->entity;
168 
169  dol_syslog("listevents purge", LOG_DEBUG);
170  $resql = $db->query($sql);
171  if (!$resql) {
172  $error++;
173  setEventMessages($db->lasterror(), null, 'errors');
174  }
175 
176  // Add event purge
177  $text = $langs->trans("SecurityEventsPurged");
178  $securityevent = new Events($db);
179  $securityevent->type = 'SECURITY_EVENTS_PURGE';
180  $securityevent->dateevent = $now;
181  $securityevent->description = $text;
182 
183  $result = $securityevent->create($user);
184  if ($result > 0) {
185  $db->commit();
186  dol_syslog($text, LOG_WARNING);
187  } else {
188  $error++;
189  dol_syslog($securityevent->error, LOG_ERR);
190  $db->rollback();
191  }
192 }
193 
194 
195 /*
196  * View
197  */
198 
199 $title = $langs->trans("Audit");
200 llxHeader('', $title);
201 
202 $form = new Form($db);
203 
204 $userstatic = new User($db);
205 $usefilter = 0;
206 
207 $sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,";
208 $sql .= " e.fk_user, e.description, e.prefix_session,";
209 $sql .= " u.login, u.admin, u.entity, u.firstname, u.lastname, u.statut as status";
210 $sql .= " FROM ".MAIN_DB_PREFIX."events as e";
211 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
212 $sql .= " WHERE e.entity IN (".getEntity('event').")";
213 if ($date_start !== '') {
214  $sql .= " AND e.dateevent >= '".$db->idate($date_start)."'";
215 }
216 if ($date_end !== '' ) {
217  $sql .= " AND e.dateevent <= '".$db->idate($date_end)."'";
218 }
219 if ($search_rowid) {
220  $usefilter++; $sql .= natural_search("e.rowid", $search_rowid, 1);
221 }
222 if ($search_code) {
223  $usefilter++; $sql .= natural_search("e.type", $search_code, 0);
224 }
225 if ($search_ip) {
226  $usefilter++; $sql .= natural_search("e.ip", $search_ip, 0);
227 }
228 if ($search_user) {
229  $usefilter++; $sql .= natural_search("u.login", $search_user, 0);
230 }
231 if ($search_desc) {
232  $usefilter++; $sql .= natural_search("e.description", $search_desc, 0);
233 }
234 if ($search_ua) {
235  $usefilter++; $sql .= natural_search("e.user_agent", $search_ua, 0);
236 }
237 if ($search_prefix_session) {
238  $usefilter++; $sql .= natural_search("e.prefix_session", $search_prefix_session, 0);
239 }
240 $sql .= $db->order($sortfield, $sortorder);
241 
242 // Count total nb of records
243 $nbtotalofrecords = '';
244 /*if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
245 {
246  $result = $db->query($sql);
247  $nbtotalofrecords = $db->num_rows($result);
248  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
249  {
250  $page = 0;
251  $offset = 0;
252  }
253 }*/
254 
255 $sql .= $db->plimit($limit + 1, $offset);
256 
257 $result = $db->query($sql);
258 if ($result) {
259  $num = $db->num_rows($result);
260  $i = 0;
261 
262  $param = '';
263  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
264  $param .= '&contextpage='.urlencode($contextpage);
265  }
266  if ($limit > 0 && $limit != $conf->liste_limit) {
267  $param .= '&limit='.((int) $limit);
268  }
269  if ($optioncss != '') {
270  $param .= '&optioncss='.urlencode($optioncss);
271  }
272  if ($search_rowid) {
273  $param .= '&search_rowid='.urlencode($search_rowid);
274  }
275  if ($search_code) {
276  $param .= '&search_code='.urlencode($search_code);
277  }
278  if ($search_ip) {
279  $param .= '&search_ip='.urlencode($search_ip);
280  }
281  if ($search_user) {
282  $param .= '&search_user='.urlencode($search_user);
283  }
284  if ($search_desc) {
285  $param .= '&search_desc='.urlencode($search_desc);
286  }
287  if ($search_ua) {
288  $param .= '&search_ua='.urlencode($search_ua);
289  }
290  if ($search_prefix_session) {
291  $param .= '&search_prefix_session='.urlencode($search_prefix_session);
292  }
293  if ($date_startmonth) {
294  $param .= "&date_startmonth=".urlencode($date_startmonth);
295  }
296  if ($date_startday) {
297  $param .= "&date_startday=".urlencode($date_startday);
298  }
299  if ($date_startyear) {
300  $param .= "&date_startyear=".urlencode($date_startyear);
301  }
302  if ($date_endmonth) {
303  $param .= "&date_endmonth=".urlencode($date_endmonth);
304  }
305  if ($date_endday) {
306  $param .= "&date_endday=".urlencode($date_endday);
307  }
308  if ($date_endyear) {
309  $param .= "&date_endyear=".urlencode($date_endyear);
310  }
311 
312  $center = '';
313  if ($num) {
314  $center = '<a class="butActionDelete small" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
315  }
316 
317  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
318  print '<input type="hidden" name="token" value="'.newToken().'">';
319 
320  print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit);
321 
322  if ($action == 'purge') {
323  $formquestion = array();
324  print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge', $formquestion, 'no', 1);
325  }
326 
327  // Check some parameters
328  // TODO Add a tab with this and other information
329  /*
330  global $dolibarr_main_prod, $dolibarr_nocsrfcheck;
331  if (empty($dolibarr_main_prod)) {
332  print $langs->trans("Warning").' dolibarr_main_prod = '.$dolibarr_main_prod;
333  print ' '.img_warning($langs->trans('SwitchThisForABetterSecurity', 1)).'<br>';
334  }
335  if (!empty($dolibarr_nocsrfcheck)) {
336  print $langs->trans("Warning").' dolibarr_nocsrfcheck = '.$dolibarr_nocsrfcheck;
337  print ' '.img_warning($langs->trans('SwitchThisForABetterSecurity', 0)).'<br>';
338  }
339  */
340 
341  print '<div class="div-table-responsive">';
342  print '<table class="liste centpercent">';
343 
344  // Fields title search
345  print '<tr class="liste_titre">';
346 
347  // Action column
348  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
349  print '<td class="liste_titre maxwidthsearch center">';
350  $searchpicto = $form->showFilterAndCheckAddButtons(0);
351  print $searchpicto;
352  print '</td>';
353  }
354 
355  // ID
356  print '<td class="liste_titre">';
357  print '<input class="flat maxwidth50" type="text" name="search_rowid" value="'.dol_escape_htmltag($search_rowid).'">';
358  print '</td>';
359 
360  // Date
361  print '<td class="liste_titre" width="15%">';
362  print $form->selectDate($date_start === '' ? -1 : $date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
363  print $form->selectDate($date_end === '' ? -1 : $date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
364  print '</td>';
365 
366  print '<td class="liste_titre">';
367  print '<input class="flat maxwidth75" type="text" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
368  print '</td>';
369 
370  // IP
371  print '<td class="liste_titre">';
372  print '<input class="flat maxwidth75" type="text" name="search_ip" value="'.dol_escape_htmltag($search_ip).'">';
373  print '</td>';
374 
375  print '<td class="liste_titre">';
376  print '<input class="flat maxwidth100" type="text" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
377  print '</td>';
378 
379  print '<td class="liste_titre">';
380  //print '<input class="flat maxwidth100" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
381  print '</td>';
382 
383  if (!empty($arrayfields['e.user_agent']['checked'])) {
384  print '<td class="liste_titre left">';
385  print '<input class="flat maxwidth100" type="text" name="search_ua" value="'.dol_escape_htmltag($search_ua).'">';
386  print '</td>';
387  }
388 
389  if (!empty($arrayfields['e.prefix_session']['checked'])) {
390  print '<td class="liste_titre left">';
391  print '<input class="flat maxwidth100" type="text" name="search_prefix_session" value="'.dol_escape_htmltag($search_prefix_session).'">';
392  print '</td>';
393  }
394 
395  // Action column
396  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
397  print '<td class="liste_titre maxwidthsearch">';
398  $searchpicto = $form->showFilterAndCheckAddButtons(0);
399  print $searchpicto;
400  print '</td>';
401  }
402 
403  print "</tr>\n";
404 
405 
406  print '<tr class="liste_titre">';
407  // Action column
408  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
410  }
411  print_liste_field_titre("ID", $_SERVER["PHP_SELF"], "e.rowid", "", $param, '', $sortfield, $sortorder);
412  print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, '', $sortfield, $sortorder);
413  print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, '', $sortfield, $sortorder);
414  print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder);
415  print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder);
416  print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, '', $sortfield, $sortorder);
417  if (!empty($arrayfields['e.user_agent']['checked'])) {
418  print_liste_field_titre("UserAgent", $_SERVER["PHP_SELF"], "e.user_agent", "", $param, '', $sortfield, $sortorder);
419  }
420  if (!empty($arrayfields['e.prefix_session']['checked'])) {
421  print_liste_field_titre("SuffixSessionName", $_SERVER["PHP_SELF"], "e.prefix_session", "", $param, '', $sortfield, $sortorder);
422  }
423  // Action column
424  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
426  }
427  print "</tr>\n";
428 
429  while ($i < min($num, $limit)) {
430  $obj = $db->fetch_object($result);
431 
432  print '<tr class="oddeven">';
433 
434  // Action column
435  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
436  print '<td class="center">';
437  $htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
438  $htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
439  print $form->textwithpicto('', $htmltext);
440  print '</td>';
441  }
442 
443  // ID
444  print '<td class="nowrap left">'.dol_escape_htmltag($obj->rowid).'</td>';
445 
446  // Date
447  print '<td class="nowrap left">'.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S', 'tzuserrel').'</td>';
448 
449  // Code
450  print '<td>'.dol_escape_htmltag($obj->type).'</td>';
451 
452  // IP
453  print '<td class="nowraponall">';
454  print dol_print_ip($obj->ip);
455  print '</td>';
456 
457  // Login
458  print '<td class="tdoverflowmax125">';
459  if ($obj->fk_user > 0) {
460  $userstatic->id = $obj->fk_user;
461  $userstatic->login = $obj->login;
462  $userstatic->admin = $obj->admin;
463  $userstatic->entity = $obj->entity;
464  $userstatic->status = $obj->status;
465 
466  print $userstatic->getLoginUrl(1);
467  if (isModEnabled('multicompany') && $userstatic->admin && !$userstatic->entity) {
468  print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
469  } elseif ($userstatic->admin) {
470  print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
471  }
472  } else {
473  print '&nbsp;';
474  }
475  print '</td>';
476 
477  // Description
478  $text = $langs->trans($obj->description);
479  $reg = array();
480  if (preg_match('/\‍((.*)\‍)(.*)/i', $obj->description, $reg)) {
481  $val = explode(',', $reg[1]);
482  $text = $langs->trans($val[0], isset($val[1]) ? $val[1] : '', isset($val[2]) ? $val[2] : '', isset($val[3]) ? $val[3] : '', isset($val[4]) ? $val[4] : '');
483  if (!empty($reg[2])) {
484  $text .= $reg[2];
485  }
486  }
487  print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($text).'">';
488  print dol_escape_htmltag($text);
489  print '</td>';
490 
491  if (!empty($arrayfields['e.user_agent']['checked'])) {
492  // User agent
493  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->user_agent).'">';
494  print dol_escape_htmltag($obj->user_agent);
495  print '</td>';
496  }
497 
498  if (!empty($arrayfields['e.prefix_session']['checked'])) {
499  // User agent
500  print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->prefix_session).'">';
501  print dol_escape_htmltag($obj->prefix_session);
502  print '</td>';
503  }
504 
505  // Action column
506  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
507  print '<td class="right">';
508  $htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
509  $htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
510  print $form->textwithpicto('', $htmltext);
511  print '</td>';
512  }
513 
514  print "</tr>\n";
515  $i++;
516  }
517 
518  if ($num == 0) {
519  $colspan = 8;
520  if ($usefilter) {
521  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoEventFoundWithCriteria").'</span></td></tr>';
522  } else {
523  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoEventOrNoAuditSetup").'</span></td></tr>';
524  }
525  }
526  print "</table>";
527  print "</div>";
528 
529  print "</form>";
530  $db->free($result);
531 } else {
532  dol_print_error($db);
533 }
534 
535 // End of page
536 llxFooter();
537 $db->close();
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
Events class.
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
Definition: user.class.php:48
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_get_last_hour($date, $gm='tzserver')
Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59...
Definition: date.lib.php:623
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:577
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:596
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_ip($ip, $mode=0)
Return an IP formated to be shown on screen.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.