dolibarr  17.0.4
boxes.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
30 include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('admin', 'boxes', 'accountancy'));
34 
35 if (!$user->admin) {
37 }
38 
39 $rowid = GETPOST('rowid', 'int');
40 $action = GETPOST('action', 'aZ09');
41 
42 
43 // Define possible position of boxes
44 $arrayofhomepages = InfoBox::getListOfPagesForBoxes();
45 $boxes = array();
46 
47 
48 /*
49  * Actions
50  */
51 
52 if ($action == 'addconst') {
53  dolibarr_set_const($db, "MAIN_BOXES_MAXLINES", GETPOST("MAIN_BOXES_MAXLINES", 'int'), '', 0, '', $conf->entity);
54  dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", GETPOST("MAIN_ACTIVATE_FILECACHE", 'alpha'), 'chaine', 0, '', $conf->entity);
55 }
56 
57 if ($action == 'add') {
58  $error = 0;
59  $boxids = GETPOST('boxid', 'array');
60 
61  $db->begin();
62  if (is_array($boxids)) {
63  foreach ($boxids as $boxid) {
64  if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) { // 0=Home, 1=...
65  $pos = $boxid['pos'];
66 
67  // Initialize distinct fk_user with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
68  $distinctfkuser = array();
69  if (!$error) {
70  $sql = "SELECT fk_user";
71  $sql .= " FROM ".MAIN_DB_PREFIX."user_param";
72  $sql .= " WHERE param = 'MAIN_BOXES_".$db->escape($pos)."' AND value = '1'";
73  $sql .= " AND entity = ".$conf->entity;
74  dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
75  $resql = $db->query($sql);
76  if ($resql) {
77  $num = $db->num_rows($resql);
78  $i = 0;
79  while ($i < $num) {
80  $obj = $db->fetch_object($resql);
81  $distinctfkuser[$obj->fk_user] = $obj->fk_user;
82  $i++;
83  }
84  } else {
85  setEventMessages($db->lasterror(), null, 'errors');
86  $error++;
87  }
88  }
89 
90  $distinctfkuser['0'] = '0'; // Add entry for fk_user = 0. We must use string as key and val
91 
92  foreach ($distinctfkuser as $fk_user) {
93  if (!$error && $fk_user != '') {
94  $arrayofexistingboxid = array();
95  $nbboxonleft = $nbboxonright = 0;
96  $sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes";
97  $sql .= " WHERE position = ".((int) $pos)." AND fk_user = ".((int) $fk_user)." AND entity = ".((int) $conf->entity);
98  dol_syslog("boxes.php activate box", LOG_DEBUG);
99  $resql = $db->query($sql);
100  if ($resql) {
101  while ($obj = $db->fetch_object($resql)) {
102  $boxorder = $obj->box_order;
103  if (preg_match('/A/', $boxorder)) {
104  $nbboxonleft++;
105  }
106  if (preg_match('/B/', $boxorder)) {
107  $nbboxonright++;
108  }
109  $arrayofexistingboxid[$obj->box_id] = 1;
110  }
111  } else {
112  dol_print_error($db);
113  }
114 
115  if (empty($arrayofexistingboxid[$boxid['value']])) {
116  $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
117  $sql .= "box_id, position, box_order, fk_user, entity";
118  $sql .= ") VALUES (";
119  $sql .= ((int) $boxid['value']).", ".((int) $pos).", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".((int) $fk_user).", ".$conf->entity;
120  $sql .= ")";
121 
122  dol_syslog("boxes.php activate box", LOG_DEBUG);
123  $resql = $db->query($sql);
124  if (!$resql) {
125  setEventMessages($db->lasterror(), null, 'errors');
126  $error++;
127  }
128  } else {
129  dol_syslog("boxes.php activate box - already exists in database", LOG_DEBUG);
130  }
131  }
132  }
133  }
134  }
135  }
136  if (!$error) {
137  $db->commit();
138  $action = '';
139  } else {
140  $db->rollback();
141  }
142 }
143 
144 if ($action == 'delete') {
145  $sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes";
146  $sql .= " WHERE rowid=".((int) $rowid);
147 
148  $resql = $db->query($sql);
149  $obj = $db->fetch_object($resql);
150  if (!empty($obj->box_id)) {
151  $db->begin();
152 
153  $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
154  $sql .= " WHERE entity = ".$conf->entity;
155  $sql .= " AND box_id=".((int) $obj->box_id);
156 
157  $resql = $db->query($sql);
158 
159  $db->commit();
160  }
161 }
162 
163 if ($action == 'switch') {
164  // We switch values of field box_order for the 2 lines of table boxes
165  $db->begin();
166 
167  $objfrom = new ModeleBoxes($db);
168  $objfrom->fetch(GETPOST("switchfrom", 'int'));
169 
170  $objto = new ModeleBoxes($db);
171  $objto->fetch(GETPOST('switchto', 'int'));
172 
173  $resultupdatefrom = 0;
174  $resultupdateto = 0;
175  if (is_object($objfrom) && is_object($objto)) {
176  $newfirst = $objto->box_order;
177  $newsecond = $objfrom->box_order;
178  if ($newfirst == $newsecond) {
179  $newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
180  $newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
181  $newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
182  }
183 
184  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
185  dol_syslog($sql);
186  $resultupdatefrom = $db->query($sql);
187  if (!$resultupdatefrom) {
188  dol_print_error($db);
189  }
190 
191  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newsecond)."' WHERE rowid=".((int) $objto->rowid);
192  dol_syslog($sql);
193  $resultupdateto = $db->query($sql);
194  if (!$resultupdateto) {
195  dol_print_error($db);
196  }
197  }
198 
199  if ($resultupdatefrom && $resultupdateto) {
200  $db->commit();
201  } else {
202  $db->rollback();
203  }
204 }
205 
206 
207 /*
208  * View
209  */
210 
211 $form = new Form($db);
212 
213 llxHeader('', $langs->trans("Boxes"));
214 
215 print load_fiche_titre($langs->trans("Boxes"), '', 'title_setup');
216 
217 print '<span class="opacitymedium">'.$langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."</span><br>\n";
218 
219 /*
220  * Search for the default active boxes for each possible position
221  * We store the active boxes by default in $boxes[position][id_boite]=1
222  */
223 
224 $actives = array();
225 
226 $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,";
227 $sql .= " bd.rowid as boxid";
228 $sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd";
229 $sql .= " WHERE b.box_id = bd.rowid";
230 $sql .= " AND b.entity IN (0,".$conf->entity.")";
231 $sql .= " AND b.fk_user=0";
232 $sql .= " ORDER by b.position, b.box_order";
233 //print $sql;
234 
235 dol_syslog("Search available boxes", LOG_DEBUG);
236 $resql = $db->query($sql);
237 if ($resql) {
238  $num = $db->num_rows($resql);
239 
240  // Check record to know if we must recalculate sort order
241  $i = 0;
242  $decalage = 0;
243  while ($i < $num) {
244  $obj = $db->fetch_object($resql);
245  $boxes[$obj->position][$obj->box_id] = 1;
246  $i++;
247 
248  array_push($actives, $obj->box_id);
249 
250  if ($obj->box_order == '' || $obj->box_order == '0' || $decalage) {
251  $decalage++;
252  }
253  // We renumber the order of the boxes if one of them is in ''
254  // This occurs just after an insert.
255  if ($decalage) {
256  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($decalage)."' WHERE rowid=".((int) $obj->rowid);
257  $db->query($sql);
258  }
259  }
260 
261  if ($decalage) {
262  // If we have renumbered, we correct the field box_order
263  // This occurs just after an insert.
264  $sql = "SELECT box_order";
265  $sql .= " FROM ".MAIN_DB_PREFIX."boxes";
266  $sql .= " WHERE entity = ".$conf->entity;
267  $sql .= " AND LENGTH(box_order) <= 2";
268 
269  dol_syslog("Execute requests to renumber box order", LOG_DEBUG);
270  $result = $db->query($sql);
271  if ($result) {
272  while ($record = $db->fetch_array($result)) {
273  if (dol_strlen($record['box_order']) == 1) {
274  if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) {
275  $box_order = "A0".$record['box_order'];
276  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
277  $resql = $db->query($sql);
278  } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) {
279  $box_order = "B0".$record['box_order'];
280  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
281  $resql = $db->query($sql);
282  }
283  } elseif (dol_strlen($record['box_order']) == 2) {
284  if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) {
285  $box_order = "A".$record['box_order'];
286  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
287  $resql = $db->query($sql);
288  } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) {
289  $box_order = "B".$record['box_order'];
290  $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
291  $resql = $db->query($sql);
292  }
293  }
294  }
295  }
296  }
297  $db->free($resql);
298 }
299 
300 // Available boxes to activate
301 $boxtoadd = InfoBox::listBoxes($db, 'available', -1, null, $actives);
302 // Activated boxes
303 $boxactivated = InfoBox::listBoxes($db, 'activated', -1, null);
304 
305 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
306 print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
307 print '<input type="hidden" name="action" value="add">'."\n";
308 
309 
310 print '<br>';
311 
312 print '<div class="div-table-responsive-no-min">';
313 print '<table class="tagtable liste centpercent">'."\n";
314 
315 print '<tr class="liste_titre">';
316 print '<td>'.$langs->trans("Box").'</td>';
317 print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
318 print '<td></td>';
319 print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
320 print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
321 print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
322 print '</tr>'."\n";
323 
324 print "\n\n".'<!-- Boxes Available -->'."\n";
325 foreach ($boxtoadd as $box) {
326  if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
327  $logo = $box->boximg;
328  } else {
329  $logo = preg_replace("/^object_/i", "", $box->boximg);
330  }
331 
332  print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
333  print '<tr class="oddeven" style="height:3em !important;">'."\n";
334  print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv($box->boxlabel)).'">'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
335  if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
336  print img_picto('', 'graph', 'class="paddingleft"');
337  }
338  if (!empty($box->version)) {
339  if ($box->version == 'experimental') {
340  print ' <span class="opacitymedium">('.$langs->trans("Experimental").')</span>';
341  } elseif ($box->version == 'development') {
342  print ' <span class="opacitymedium">('.$langs->trans("Development").')</span>';
343  }
344  }
345  print '</td>'."\n";
346  print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note).'">';
347  if ($box->note == '(WarningUsingThisBoxSlowDown)') {
348  $langs->load("errors");
349  print $langs->trans("WarningUsingThisBoxSlowDown");
350  } else {
351  print ($box->note ? $box->note : '&nbsp;');
352  }
353  print '</td>'."\n";
354  print '<td>';
355  print $form->textwithpicto('', $langs->trans("SourceFile").' : '.$box->sourcefile);
356  print '</td>'."\n";
357 
358  // For each possible position, an activation link is displayed if the box is not already active for that position
359  print '<td class="center">';
360  print $form->selectarray("boxid[".$box->box_id."][pos]", $arrayofhomepages, -1, 1, 0, 0, '', 1, 0, 0, '', 'minwidth75', 1)."\n";
361  print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
362  print '</td>';
363 
364  print '<td>';
365  print '</td>';
366 
367  print '<td>';
368  print '</td>';
369 
370  print '<td>';
371  print '<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans("Activate").'">';
372  print '</td>';
373 
374  print '</tr>'."\n";
375 }
376 print "\n".'<!-- End Boxes Available -->'."\n";
377 
378 
379 $box_order = 1;
380 $foundrupture = 1;
381 foreach ($boxactivated as $key => $box) {
382  if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
383  $logo = $box->boximg;
384  } else {
385  $logo = preg_replace("/^object_/i", "", $box->boximg);
386  }
387 
388  print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
389  print '<tr class="oddeven" style="height:3em !important;">';
390  print '<td>'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
391  if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
392  print img_picto('', 'graph', 'class="paddingleft"');
393  }
394  if (!empty($box->version)) {
395  if ($box->version == 'experimental') {
396  print ' <span class="opacitymedium">('.$langs->trans("Experimental").')</span>';
397  } elseif ($box->version == 'development') {
398  print ' <span class="opacitymedium">('.$langs->trans("Development").')</span>';
399  }
400  }
401  print '</td>';
402  $langs->load("errors");
403  print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note == '(WarningUsingThisBoxSlowDown)' ? $langs->trans("WarningUsingThisBoxSlowDown") : $box->note).'">';
404  if ($box->note == '(WarningUsingThisBoxSlowDown)') {
405  print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
406  } else {
407  print ($box->note ? $box->note : '&nbsp;');
408  }
409  print '</td>';
410  print '<td>';
411  print $form->textwithpicto('', $langs->trans("SourceFile").' : '.$box->sourcefile);
412  print '</td>'."\n";
413  print '<td class="center">'.(empty($arrayofhomepages[$box->position]) ? '' : $langs->trans($arrayofhomepages[$box->position])).'</td>';
414  $hasnext = ($key < (count($boxactivated) - 1));
415  $hasprevious = ($key != 0);
416  print '<td class="center">'.($key + 1).'</td>';
417  print '<td class="center nowraponall">';
418  print ($hasnext ? '<a class="reposition" href="boxes.php?action=switch&token='.newToken().'&switchfrom='.$box->rowid.'&switchto='.$boxactivated[$key + 1]->rowid.'">'.img_down().'</a>&nbsp;' : '');
419  print ($hasprevious ? '<a class="reposition" href="boxes.php?action=switch&token='.newToken().'&switchfrom='.$box->rowid.'&switchto='.$boxactivated[$key - 1]->rowid.'">'.img_up().'</a>' : '');
420  print '</td>';
421  print '<td class="center">';
422  print '<a class="reposition" href="boxes.php?rowid='.$box->rowid.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
423  print '</td>';
424 
425  print '</tr>'."\n";
426 }
427 
428 print '</table>';
429 print '</div>';
430 print '<br>';
431 
432 print '</form>';
433 
434 
435 // Other parameters
436 
437 print "\n\n".'<!-- Other Const -->'."\n";
438 print load_fiche_titre($langs->trans("Other"), '', '');
439 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
440 print '<input type="hidden" name="token" value="'.newToken().'">';
441 print '<input type="hidden" name="action" value="addconst">';
442 print '<div class="div-table-responsive-no-min">';
443 print '<table class="noborder centpercent">';
444 
445 print '<tr class="liste_titre">';
446 print '<td class="liste_titre">'.$langs->trans("Parameter").'</td>';
447 print '<td class="liste_titre">'.$langs->trans("Value").'</td>';
448 print '</tr>';
449 
450 print '<tr class="oddeven">';
451 print '<td>';
452 print $langs->trans("MaxNbOfLinesForBoxes");
453 print '</td>'."\n";
454 print '<td>';
455 print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.(!empty($conf->global->MAIN_BOXES_MAXLINES) ? $conf->global->MAIN_BOXES_MAXLINES : '').'">';
456 print '</td>';
457 print '</tr>';
458 
459 // Activate FileCache - Developement
460 if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
461  print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
462  print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', (!empty($conf->global->MAIN_ACTIVATE_FILECACHE) ? $conf->global->MAIN_ACTIVATE_FILECACHE : 0), 1);
463  print '</td>';
464  print '</tr>';
465 }
466 
467 print '</table>';
468 print '</div>';
469 
470 print $form->buttonsSaveCancel("Save", '');
471 
472 print '</form>';
473 print "\n".'<!-- End Other Const -->'."\n";
474 
475 // End of page
476 llxFooter();
477 $db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:632
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 generation of HTML components Only common components must be here.
static listBoxes($dbs, $mode, $zone, $user=null, $excludelist=array(), $includehidden=1)
Return array of boxes qualified for area and user.
static getListOfPagesForBoxes()
Name of positions (See below)
Class ModeleBoxes.
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.