dolibarr 19.0.3
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
26// This script is called with a POST method.
27// Directory to scan (full path) is inside POST['dir'].
28
29if (!defined('NOTOKENRENEWAL')) {
30 define('NOTOKENRENEWAL', 1); // Disables token renewal
31}
32if (!defined('NOREQUIREMENU')) {
33 define('NOREQUIREMENU', '1');
34}
35if (!defined('NOREQUIREHTML')) {
36 define('NOREQUIREHTML', '1');
37}
38
39
40// Load Dolibarr environment
41require '../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
43
44$id = GETPOST('id', 'int');
45$block = new BlockedLog($db);
46
47if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || empty($conf->blockedlog->enabled)) {
49}
50
51$langs->loadLangs(array("admin"));
52
53
54/*
55 * View
56 */
57
59
60print '<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>';
61print '<tbody>';
62
63if ($block->fetch($id) > 0) {
64 $objtoshow = $block->object_data;
65 print formatObject($objtoshow, '');
66} else {
67 print 'Error, failed to get unalterable log with id '.$id;
68}
69
70print '</tbody>';
71print '</table></div>';
72
73
74$db->close();
75
76
84function formatObject($objtoshow, $prefix)
85{
86 $s = '';
87
88 $newobjtoshow = $objtoshow;
89
90 if (is_object($newobjtoshow) || is_array($newobjtoshow)) {
91 //var_dump($newobjtoshow);
92 foreach ($newobjtoshow as $key => $val) {
93 if (!is_object($val) && !is_array($val)) {
94 // TODO $val can be '__PHP_Incomplete_Class', the is_object return false
95 $s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
96 $s .= '<td>';
97 if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
98 //var_dump(is_object($val));
99 //var_dump(is_array($val));
100 //var_dump(is_array($val));
101 //var_dump(@get_class($val));
102 //var_dump($val);
103 $s .= dol_print_date($val, 'dayhour');
104 } else {
105 $s .= $val;
106 }
107 $s .= '</td></tr>';
108 } elseif (is_array($val)) {
109 $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
110 } elseif (is_object($val)) {
111 $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
112 }
113 }
114 }
115
116 return $s;
117}
Class to manage Blocked Log.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.