logHelper = $this->loadHelper('loglog_logging'); $this->mainHelper = $this->loadHelper('loglog_main'); global $INPUT; $this->filter = $INPUT->str('filter'); } /** @inheritDoc */ public function html() { global $ID, $INPUT, $conf, $lang; $now = time(); $go = isset($_REQUEST['time']) ? intval($_REQUEST['time']) : $now; $min = $go - (7 * 24 * 60 * 60); $max = $go; $past = $now - $go > 60 * 60 * 5; if ($past) { $next = $max + (7 * 24 * 60 * 60); if ($now - $next < 60 * 60 * 5) { $next = $now; } } $time = $INPUT->str('time') ?: $now; // alternative date format? $dateFormat = $this->getConf('admin_date_format') ?: $conf['dformat']; echo $this->locale_xhtml('intro'); $form = new dokuwiki\Form\Form(['method'=>'GET']); $form->setHiddenField('do', 'admin'); $form->setHiddenField('page', 'loglog'); $form->setHiddenField('time', $time); $form->addDropdown( 'filter', [ '' => '', 'auth_ok' => $this->getLang('filter_auth_ok'), 'auth_error' => $this->getLang('filter_auth_error'), 'admin' => $this->getLang('filter_admin'), 'other' => $this->getLang('filter_other') ] ); $form->addButton('submit', $this->getLang('submit'))->attr('type','submit'); echo $form->toHTML(); echo '
' . $this->getLang('range') . ' ' . strftime($dateFormat, $min) . ' - ' . strftime($dateFormat, $max) . '
'; echo '' . $this->getLang('date') . ' | '; echo '' . $this->getLang('ip') . ' | '; echo '' . $lang['user'] . ' | '; echo '' . $this->getLang('action') . ' | '; echo ''. $this->getLang('data') . ' | '; echo '
---|---|---|---|---|
' . strftime($dateFormat, $line['dt']) . ' | '; echo '' . hsc($line['ip']) . ' | '; echo '' . hsc($line['user']) . ' | '; echo '' . $line['msg'] . ' | '; echo '';
if ($line['data']) {
// logs contain single-line JSON data, so we have to decode and encode it again for pretty print
echo '' . json_encode(json_decode($line['data']), JSON_PRETTY_PRINT) . ''; } echo ' | ';
echo '