2016-02-17 07:43:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the Froxlor project.
|
|
|
|
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
|
|
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the COPYING
|
|
|
|
* file that was distributed with this source code. You can also view the
|
|
|
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
*
|
|
|
|
* @copyright (c) the authors
|
|
|
|
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
|
|
|
* @author Froxlor team <team@froxlor.org> (2010-)
|
|
|
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
* @package Panel
|
|
|
|
*
|
|
|
|
*/
|
2022-02-20 17:00:44 +00:00
|
|
|
const AREA = 'customer';
|
|
|
|
require __DIR__ . '/lib/init.php';
|
2016-02-17 07:43:00 +00:00
|
|
|
|
2019-11-10 17:35:32 +00:00
|
|
|
use Froxlor\Api\Commands\SysLog;
|
2018-12-19 15:57:03 +00:00
|
|
|
use Froxlor\Database\Database;
|
|
|
|
use Froxlor\Settings;
|
2022-02-21 16:42:04 +00:00
|
|
|
use Froxlor\UI\Panel\UI;
|
2018-12-18 12:45:05 +00:00
|
|
|
|
2016-07-27 11:45:54 +00:00
|
|
|
// redirect if this customer page is hidden via settings
|
2017-03-08 13:04:40 +00:00
|
|
|
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo('customer_index.php');
|
2016-07-27 11:45:54 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 13:04:40 +00:00
|
|
|
if ($page == 'log') {
|
2016-02-17 07:43:00 +00:00
|
|
|
if ($action == '') {
|
|
|
|
$fields = array(
|
2018-12-22 07:15:31 +00:00
|
|
|
'date' => $lng['logger']['date'],
|
|
|
|
'type' => $lng['logger']['type'],
|
|
|
|
'user' => $lng['logger']['user'],
|
|
|
|
'text' => $lng['logger']['action']
|
2016-02-17 07:43:00 +00:00
|
|
|
);
|
2019-11-10 17:35:32 +00:00
|
|
|
try {
|
|
|
|
// get total count
|
|
|
|
$json_result = SysLog::getLocal($userinfo)->listingCount();
|
|
|
|
$result = json_decode($json_result, true)['data'];
|
|
|
|
// initialize pagination and filtering
|
|
|
|
$paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
|
|
|
|
// get list
|
|
|
|
$json_result = SysLog::getLocal($userinfo, $paging->getApiCommandParams())->listing();
|
|
|
|
} catch (Exception $e) {
|
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
|
|
|
}
|
|
|
|
$result = json_decode($json_result, true)['data'];
|
2016-02-17 07:43:00 +00:00
|
|
|
$sortcode = $paging->getHtmlSortCode($lng);
|
|
|
|
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
|
|
|
$searchcode = $paging->getHtmlSearchCode($lng);
|
|
|
|
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
|
|
|
$clog = array();
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2019-11-10 17:35:32 +00:00
|
|
|
foreach ($result['list'] as $row) {
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2017-03-08 13:04:40 +00:00
|
|
|
if (! isset($clog[$row['action']]) || ! is_array($clog[$row['action']])) {
|
2016-02-17 07:43:00 +00:00
|
|
|
$clog[$row['action']] = array();
|
|
|
|
}
|
|
|
|
$clog[$row['action']][$row['logid']] = $row;
|
|
|
|
}
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2017-03-08 13:04:40 +00:00
|
|
|
if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
|
2016-02-17 07:43:00 +00:00
|
|
|
krsort($clog);
|
|
|
|
} else {
|
|
|
|
ksort($clog);
|
|
|
|
}
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2016-02-17 07:43:00 +00:00
|
|
|
$count = 0;
|
|
|
|
$log_count = 0;
|
|
|
|
$log = '';
|
|
|
|
foreach ($clog as $action => $logrows) {
|
2017-04-15 08:58:50 +00:00
|
|
|
$_action = 0;
|
2016-02-17 07:43:00 +00:00
|
|
|
foreach ($logrows as $row) {
|
2017-03-08 13:04:40 +00:00
|
|
|
// if ($paging->checkDisplay($i)) {
|
2018-12-24 12:50:45 +00:00
|
|
|
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
2017-03-08 13:04:40 +00:00
|
|
|
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2017-03-08 13:04:40 +00:00
|
|
|
if ($_action != $action) {
|
|
|
|
switch ($action) {
|
2018-12-26 14:51:26 +00:00
|
|
|
case \Froxlor\FroxlorLogger::USR_ACTION:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['admin']['customer'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
2018-12-26 14:51:26 +00:00
|
|
|
case \Froxlor\FroxlorLogger::RES_ACTION:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['logger']['reseller'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
2018-12-26 14:51:26 +00:00
|
|
|
case \Froxlor\FroxlorLogger::ADM_ACTION:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['logger']['admin'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
2018-12-26 14:51:26 +00:00
|
|
|
case \Froxlor\FroxlorLogger::CRON_ACTION:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['logger']['cron'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
2018-12-26 14:51:26 +00:00
|
|
|
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['logger']['login'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
2019-07-26 05:49:17 +00:00
|
|
|
case \Froxlor\FroxlorLogger::LOG_ERROR:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['logger']['intern'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
2018-12-22 07:15:31 +00:00
|
|
|
$_action = $lng['logger']['unknown'];
|
2017-03-08 13:04:40 +00:00
|
|
|
break;
|
2016-02-17 07:43:00 +00:00
|
|
|
}
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2017-03-08 13:04:40 +00:00
|
|
|
$row['action'] = $_action;
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
|
2016-02-17 07:43:00 +00:00
|
|
|
}
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2017-03-08 13:04:40 +00:00
|
|
|
$log_count ++;
|
2018-12-21 18:16:49 +00:00
|
|
|
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
|
2017-03-08 13:04:40 +00:00
|
|
|
$count ++;
|
|
|
|
$_action = $action;
|
2016-02-17 07:43:00 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-21 11:24:07 +00:00
|
|
|
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
|
2016-02-17 07:43:00 +00:00
|
|
|
}
|
|
|
|
}
|