dolibarr  16.0.5
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 
29 if (!defined('NOTOKENRENEWAL')) {
30  define('NOTOKENRENEWAL', 1); // Disables token renewal
31 }
32 if (!defined('NOREQUIREMENU')) {
33  define('NOREQUIREMENU', '1');
34 }
35 if (!defined('NOREQUIREHTML')) {
36  define('NOREQUIREHTML', '1');
37 }
38 
39 
40 require '../../main.inc.php';
41 require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
42 
43 $id = GETPOST('id', 'int');
44 $block = new BlockedLog($db);
45 
46 if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
48 }
49 
50 $langs->loadLangs(array("admin"));
51 
52 
53 /*
54  * View
55  */
56 
57 print '<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
58 print '<tbody>';
59 
60 if ($block->fetch($id) > 0) {
61  $objtoshow = $block->object_data;
62  print formatObject($objtoshow, '');
63 } else {
64  print 'Error, failed to get unalterable log with id '.$id;
65 }
66 
67 print '</tbody>';
68 print '</table></div>';
69 
70 
71 $db->close();
72 
73 
81 function formatObject($objtoshow, $prefix)
82 {
83  $s = '';
84 
85  $newobjtoshow = $objtoshow;
86 
87  if (is_object($newobjtoshow) || is_array($newobjtoshow)) {
88  //var_dump($newobjtoshow);
89  foreach ($newobjtoshow as $key => $val) {
90  if (!is_object($val) && !is_array($val)) {
91  // TODO $val can be '__PHP_Incomplete_Class', the is_object return false
92  $s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
93  $s .= '<td>';
94  if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
95  //var_dump(is_object($val));
96  //var_dump(is_array($val));
97  //var_dump(is_array($val));
98  //var_dump(@get_class($val));
99  //var_dump($val);
100  $s .= dol_print_date($val, 'dayhour');
101  } else {
102  $s .= $val;
103  }
104  $s .= '</td></tr>';
105  } elseif (is_array($val)) {
106  $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
107  } elseif (is_object($val)) {
108  $s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
109  }
110  }
111  }
112 
113  return $s;
114 }
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
BlockedLog
Class to manage Blocked Log.
Definition: blockedlog.class.php:26
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25