dolibarr 21.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-2024 Frédéric France <frederic.france@free.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
29require '../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_20_all_Logevents.class.php';
33
42$action = GETPOST('action', 'aZ09');
43$confirm = GETPOST('confirm', 'alpha');
44$optioncss = GETPOST("optioncss", "aZ"); // Option for the css output (always '' except when 'print')
45$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
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");
55if (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;
61if (!$sortfield) {
62 $sortfield = "e.rowid";
63}
64if (!$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$search_entity = ($user->entity > 0 ? $user->entity : GETPOSTINT('search_entity'));
76
77$now = dol_now();
78$nowarray = dol_getdate($now);
79
80if (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}
85if (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
92if ($date_start !== '' && $date_end !== '' && $date_start > $date_end) {
93 $date_end = $date_start + 86400;
94}
95
96if (!GETPOSTISSET('pageplusoneold') && !GETPOSTISSET('page') && $date_start === '') { // We define date_start and date_end
97 $date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
98}
99if (!GETPOSTISSET('pageplusoneold') && !GETPOSTISSET('page') && $date_end === '') {
100 $date_end = dol_get_last_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
101}
102
103// Set $date_startmonth...
104$date_startday = '';
105$date_startmonth = '';
106$date_startyear = '';
107$date_endday = '';
108$date_endmonth = '';
109$date_endyear = '';
110if ($date_start !== '') {
111 $tmp = dol_getdate($date_start);
112 $date_startday = $tmp['mday'];
113 $date_startmonth = $tmp['mon'];
114 $date_startyear = $tmp['year'];
115}
116if ($date_end !== '') {
117 $tmp = dol_getdate($date_end);
118 $date_endday = $tmp['mday'];
119 $date_endmonth = $tmp['mon'];
120 $date_endyear = $tmp['year'];
121}
122
123// Add prefix session
124$arrayfields = array(
125 'e.prefix_session' => array(
126 'label' => 'UserAgent',
127 'checked' => (!getDolGlobalString('AUDIT_ENABLE_PREFIX_SESSION') ? 0 : 1),
128 'enabled' => (!getDolGlobalString('AUDIT_ENABLE_PREFIX_SESSION') ? 0 : 1),
129 'position' => 110
130 )
131);
132
133// Security check
134/*
135$socid = 0;
136if ($user->socid > 0) {
137 $action = '';
138 $socid = $user->socid;
139}
140*/
141
142if (!$user->admin) {
144}
145
146
147/*
148 * Actions
149 */
150
151$now = dol_now();
152
153// Purge search criteria
154if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
155 $date_start = '';
156 $date_end = '';
157 $date_startday = '';
158 $date_endday = '';
159 $date_startmonth = '';
160 $date_endmonth = '';
161 $date_startyear = '';
162 $date_endyear = '';
163 $search_rowid = '';
164 $search_code = '';
165 $search_ip = '';
166 $search_user = '';
167 $search_desc = '';
168 $search_ua = '';
169 $search_prefix_session = '';
170 $search_entity = '';
171}
172
173// Purge audit events
174if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) {
175 $error = 0;
176
177 $db->begin();
178 $securityevents = new Events($db);
179
180 // Delete events
181 $sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
182 $sql .= " WHERE entity = ".$conf->entity;
183
184 dol_syslog("listevents purge", LOG_DEBUG);
185 $resql = $db->query($sql);
186 if (!$resql) {
187 $error++;
188 setEventMessages($db->lasterror(), null, 'errors');
189 }
190
191 // Add event purge
192 $text = $langs->trans("SecurityEventsPurged");
193 $securityevent = new Events($db);
194 $securityevent->type = 'SECURITY_EVENTS_PURGE';
195 $securityevent->dateevent = $now;
196 $securityevent->description = $text;
197
198 $result = $securityevent->create($user);
199 if ($result > 0) {
200 $db->commit();
201 dol_syslog($text, LOG_WARNING);
202 } else {
203 $error++;
204 dol_syslog($securityevent->error, LOG_ERR);
205 $db->rollback();
206 }
207}
208
209
210/*
211 * View
212 */
213
214$title = $langs->trans("Audit");
215llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-admin page-tools_listevents');
216
217$form = new Form($db);
218
219$userstatic = new User($db);
220$usefilter = 0;
221
222$sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,";
223$sql .= " e.fk_user, e.description, e.prefix_session,";
224$sql .= " u.login, u.admin, u.email, u.entity, u.firstname, u.lastname, u.gender, u.photo, u.statut as status";
225$sql .= " FROM ".MAIN_DB_PREFIX."events as e";
226$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
227if ($search_entity > 0) {
228 $sql .= " WHERE e.entity = ".((int) $search_entity).")";
229} else {
230 $sql .= " WHERE e.entity IN (".getEntity('event', (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
231}
232if ($date_start !== '') {
233 $sql .= " AND e.dateevent >= '".$db->idate($date_start)."'";
234}
235if ($date_end !== '') {
236 $sql .= " AND e.dateevent <= '".$db->idate($date_end)."'";
237}
238if ($search_rowid) {
239 $usefilter++;
240 $sql .= natural_search("e.rowid", $search_rowid, 1);
241}
242if ($search_code) {
243 $usefilter++;
244 $sql .= natural_search("e.type", $search_code, 0);
245}
246if ($search_ip) {
247 $usefilter++;
248 $sql .= natural_search("e.ip", $search_ip, 0);
249}
250if ($search_user) {
251 $usefilter++;
252 $sql .= natural_search("u.login", $search_user, 0);
253}
254if ($search_desc) {
255 $usefilter++;
256 $sql .= natural_search("e.description", $search_desc, 0);
257}
258if ($search_ua) {
259 $usefilter++;
260 $sql .= natural_search("e.user_agent", $search_ua, 0);
261}
262if ($search_prefix_session) {
263 $usefilter++;
264 $sql .= natural_search("e.prefix_session", $search_prefix_session, 0);
265}
266$sql .= $db->order($sortfield, $sortorder);
267
268// Count total nb of records
269$nbtotalofrecords = '';
270/*if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
271{
272 $result = $db->query($sql);
273 $nbtotalofrecords = $db->num_rows($result);
274 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
275 {
276 $page = 0;
277 $offset = 0;
278 }
279}*/
280
281$sql .= $db->plimit($limit + 1, $offset);
282
283$result = $db->query($sql);
284if ($result) {
285 $num = $db->num_rows($result);
286 $i = 0;
287
288 $param = '';
289 if ($contextpage && $contextpage != $_SERVER["PHP_SELF"]) {
290 $param .= '&contextpage='.urlencode($contextpage);
291 }
292 if ($limit > 0 && $limit != $conf->liste_limit) {
293 $param .= '&limit='.((int) $limit);
294 }
295 if ($optioncss != '') {
296 $param .= '&optioncss='.urlencode($optioncss);
297 }
298 if ($search_entity != '') {
299 $param .= '&search_entity='.((int) $search_entity);
300 }
301 if ($search_rowid) {
302 $param .= '&search_rowid='.urlencode((string) ($search_rowid));
303 }
304 if ($search_code) {
305 $param .= '&search_code='.urlencode($search_code);
306 }
307 if ($search_ip) {
308 $param .= '&search_ip='.urlencode($search_ip);
309 }
310 if ($search_user) {
311 $param .= '&search_user='.urlencode($search_user);
312 }
313 if ($search_desc) {
314 $param .= '&search_desc='.urlencode($search_desc);
315 }
316 if ($search_ua) {
317 $param .= '&search_ua='.urlencode($search_ua);
318 }
319 if ($search_prefix_session) {
320 $param .= '&search_prefix_session='.urlencode($search_prefix_session);
321 }
322 if ($date_startmonth) {
323 $param .= "&date_startmonth=".((int) $date_startmonth);
324 }
325 if ($date_startday) {
326 $param .= "&date_startday=".((int) $date_startday);
327 }
328 if ($date_startyear) {
329 $param .= "&date_startyear=".((int) $date_startyear);
330 }
331 if ($date_endmonth) {
332 $param .= "&date_endmonth=".((int) $date_endmonth);
333 }
334 if ($date_endday) {
335 $param .= "&date_endday=".((int) $date_endday);
336 }
337 if ($date_endyear) {
338 $param .= "&date_endyear=".((int) $date_endyear);
339 }
340
341 $center = '';
342 if ($num) {
343 $center = '<a class="butActionDelete small" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
344 }
345
346 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
347 print '<input type="hidden" name="token" value="'.newToken().'">';
348
349 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
350 print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit);
351
352 if ($action == 'purge') {
353 $formquestion = array();
354 print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge', $formquestion, 'no', 1);
355 }
356
357 // Check some parameters
358 // TODO Add a tab with this and other information
359 /*
360 global $dolibarr_main_prod, $dolibarr_nocsrfcheck;
361 if (empty($dolibarr_main_prod)) {
362 print $langs->trans("Warning").' dolibarr_main_prod = '.$dolibarr_main_prod;
363 print ' '.img_warning($langs->trans('SwitchThisForABetterSecurity', 1)).'<br>';
364 }
365 if (!empty($dolibarr_nocsrfcheck)) {
366 print $langs->trans("Warning").' dolibarr_nocsrfcheck = '.$dolibarr_nocsrfcheck;
367 print ' '.img_warning($langs->trans('SwitchThisForABetterSecurity', 0)).'<br>';
368 }
369 */
370
371 print '<div class="div-table-responsive">';
372 print '<table class="liste noborder centpercent">';
373
374 // Fields title search
375 print '<tr class="liste_titre">';
376
377 // Action column
378 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
379 print '<td class="liste_titre maxwidthsearch center">';
380 $searchpicto = $form->showFilterAndCheckAddButtons(0);
381 print $searchpicto;
382 print '</td>';
383 }
384
385 // ID
386 print '<td class="liste_titre">';
387 print '<input class="flat maxwidth50" type="text" name="search_rowid" value="'.dol_escape_htmltag($search_rowid).'">';
388 print '</td>';
389
390 // Date
391 print '<td class="liste_titre" width="15%">';
392 print $form->selectDate($date_start === '' ? -1 : $date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
393 print $form->selectDate($date_end === '' ? -1 : $date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
394 print '</td>';
395
396 print '<td class="liste_titre">';
397 print '<input class="flat maxwidth75" type="text" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
398 print '</td>';
399
400 // IP
401 print '<td class="liste_titre">';
402 print '<input class="flat maxwidth75" type="text" name="search_ip" value="'.dol_escape_htmltag($search_ip).'">';
403 print '</td>';
404
405 print '<td class="liste_titre">';
406 print '<input class="flat maxwidth100" type="text" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
407 print '</td>';
408
409 print '<td class="liste_titre">';
410 //print '<input class="flat maxwidth100" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
411 print '</td>';
412
413 print '<td class="liste_titre left">';
414 print '<input class="flat maxwidth100" type="text" name="search_ua" value="'.dol_escape_htmltag($search_ua).'">';
415 print '</td>';
416
417 if (!empty($arrayfields['e.prefix_session']['checked'])) {
418 print '<td class="liste_titre left">';
419 print '<input class="flat maxwidth100" type="text" name="search_prefix_session" value="'.dol_escape_htmltag($search_prefix_session).'">';
420 print '</td>';
421 }
422
423 // Action column
424 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
425 print '<td class="liste_titre maxwidthsearch">';
426 $searchpicto = $form->showFilterAndCheckAddButtons(0);
427 print $searchpicto;
428 print '</td>';
429 }
430
431 print "</tr>\n";
432
433
434 print '<tr class="liste_titre">';
435 // Action column
436 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
438 }
439 print_liste_field_titre("ID", $_SERVER["PHP_SELF"], "e.rowid", "", $param, '', $sortfield, $sortorder);
440 print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, '', $sortfield, $sortorder);
441 print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, '', $sortfield, $sortorder);
442 print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder);
443 print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder);
444 print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, '', $sortfield, $sortorder);
445 print_liste_field_titre("UserAgent", $_SERVER["PHP_SELF"], "e.user_agent", "", $param, '', $sortfield, $sortorder);
446 if (!empty($arrayfields['e.prefix_session']['checked'])) {
447 print_liste_field_titre("SuffixSessionName", $_SERVER["PHP_SELF"], "e.prefix_session", "", $param, '', $sortfield, $sortorder);
448 }
449 // Action column
450 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
452 }
453 print "</tr>\n";
454
455 while ($i < min($num, $limit)) {
456 $obj = $db->fetch_object($result);
457
458 print '<tr class="oddeven">';
459
460 // Action column
461 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
462 print '<td class="center">';
463 $htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
464 $htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
465 print $form->textwithpicto('', $htmltext);
466 print '</td>';
467 }
468
469 // ID
470 print '<td class="nowrap left">'.dol_escape_htmltag($obj->rowid).'</td>';
471
472 // Date
473 print '<td class="nowrap left">'.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S', 'tzuserrel').'</td>';
474
475 // Code
476 print '<td>'.dol_escape_htmltag($obj->type).'</td>';
477
478 // IP
479 print '<td class="nowraponall">';
480 print dol_print_ip($obj->ip);
481 print '</td>';
482
483 // Login
484 print '<td class="tdoverflowmax125">';
485 if ($obj->fk_user > 0) {
486 $userstatic->id = $obj->fk_user;
487 $userstatic->login = $obj->login;
488 $userstatic->admin = $obj->admin;
489 $userstatic->entity = $obj->entity;
490 $userstatic->status = $obj->status;
491 $userstatic->gender = $obj->gender;
492 $userstatic->photo = $obj->photo;
493 $userstatic->firstname = $obj->firstname;
494 $userstatic->lastname = $obj->lastname;
495 $userstatic->email = $obj->email;
496
497 if (isModEnabled('multicompany') && $userstatic->admin && !$userstatic->entity) {
498 print img_picto($langs->trans("SuperAdministratorDesc"), 'redstar', 'class="valignmiddle paddingright"');
499 } elseif ($userstatic->admin) {
500 print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="valignmiddle paddingright"');
501 }
502
503 //print $userstatic->getLoginUrl(-1);
504 print $userstatic->getNomUrl(-1);
505 } else {
506 print '&nbsp;';
507 }
508 print '</td>';
509
510 // Description
511 $text = $langs->trans($obj->description);
512 $reg = array();
513 if (InterfaceLogevents::isEventActionTextKey($obj->description)) {
514 $val = explode(' : ', $obj->description);
515 $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] : '');
516 }
517 if (preg_match('/\‍((.*)\‍)(.*)/i', $obj->description, $reg)) {
518 $val = explode(',', $reg[1]);
519 $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] : '');
520 if (!empty($reg[2])) {
521 $text .= $reg[2];
522 }
523 }
524 print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($text).'">';
525 print dol_escape_htmltag($text);
526 print '</td>';
527
528 // User agent
529 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->user_agent).'">';
530 print dol_escape_htmltag($obj->user_agent);
531 print '</td>';
532
533 // Prefix
534 if (!empty($arrayfields['e.prefix_session']['checked'])) {
535 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->prefix_session).'">';
536 print dol_escape_htmltag($obj->prefix_session);
537 print '</td>';
538 }
539
540 // Action column
541 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
542 print '<td class="right">';
543 $htmltext = '<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
544 $htmltext .= '<br><b>'.$langs->trans("SuffixSessionName").' (DOLSESSID_...)</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
545 print $form->textwithpicto('', $htmltext);
546 print '</td>';
547 }
548
549 print "</tr>\n";
550 $i++;
551 }
552
553 if ($num == 0) {
554 $colspan = 8;
555 if (!empty($arrayfields['e.prefix_session']['checked'])) {
556 $colspan++;
557 }
558 if ($usefilter) {
559 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoEventFoundWithCriteria").'</span></td></tr>';
560 } else {
561 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoEventOrNoAuditSetup").'</span></td></tr>';
562 }
563 }
564 print "</table>";
565 print "</div>";
566
567 print "</form>";
568 $db->free($result);
569} else {
570 dol_print_error($db);
571}
572
573// End of page
574llxFooter();
575$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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:71
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.
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:646
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition date.lib.php:600
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition date.lib.php:619
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
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.