dolibarr 21.0.0-beta
block-info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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
28// This script is called with a POST method.
29// Directory to scan (full path) is inside POST['dir'].
30
31if (!defined('NOTOKENRENEWAL')) {
32 define('NOTOKENRENEWAL', 1); // Disables token renewal
33}
34if (!defined('NOREQUIREMENU')) {
35 define('NOREQUIREMENU', '1');
36}
37if (!defined('NOREQUIREHTML')) {
38 define('NOREQUIREHTML', '1');
39}
40
41
42// Load Dolibarr environment
43require '../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
53$id = GETPOSTINT('id');
54$block = new BlockedLog($db);
55
56if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || empty($conf->blockedlog->enabled)) {
58}
59
60$langs->loadLangs(array("admin"));
61
62
63/*
64 * View
65 */
66
68
69print '<div id="pop-info"><table height="80%" class="border centpercent"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
70print '<tbody>';
71
72if ($block->fetch($id) > 0) {
73 $objtoshow = $block->object_data;
74 print formatObject($objtoshow, '');
75} else {
76 print 'Error, failed to get unalterable log with id '.$id;
77}
78
79print '</tbody>';
80print '</table></div>';
81
82
83$db->close();
84
85
93function formatObject($objtoshow, $prefix)
94{
95 $s = '';
96
97 $newobjtoshow = $objtoshow;
98
99 if (is_object($newobjtoshow) || is_array($newobjtoshow)) {
100 //var_dump($newobjtoshow);
101 foreach ($newobjtoshow as $key => $val) {
102 if (!is_object($val) && !is_array($val)) {
103 // TODO $val can be '__PHP_Incomplete_Class', the is_object return false
104 $s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
105 $s .= '<td>';
106 if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
107 //var_dump(is_object($val));
108 //var_dump(is_array($val));
109 //var_dump(is_array($val));
110 //var_dump(@get_class($val));
111 //var_dump($val);
112 $s .= dol_print_date($val, 'dayhour');
113 } else {
114 $s .= $val;
115 }
116 $s .= '</td></tr>';
117 } elseif (is_array($val)) {
118 $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
119 } elseif (is_object($val)) {
120 $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
121 }
122 }
123 }
124
125 return $s;
126}
$id
Definition account.php:48
Class to manage Blocked Log.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
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.