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