add syslog page for customer; pagination needs to be fixed
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
115
customer_logger.php
Normal file
115
customer_logger.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
if ($page == 'log'
|
||||
) {
|
||||
if ($action == '') {
|
||||
$fields = array(
|
||||
'date' => $lng['logger']['date'],
|
||||
'type' => $lng['logger']['type'],
|
||||
'user' => $lng['logger']['user'],
|
||||
'text' => $lng['logger']['action']
|
||||
);
|
||||
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc');
|
||||
$result_stmt = Database::prepare('
|
||||
SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit()
|
||||
);
|
||||
Database::pexecute($result_stmt, array("loginname" => $userinfo['loginname']));
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$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();
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (!isset($clog[$row['action']])
|
||||
|| !is_array($clog[$row['action']])
|
||||
) {
|
||||
$clog[$row['action']] = array();
|
||||
}
|
||||
$clog[$row['action']][$row['logid']] = $row;
|
||||
}
|
||||
|
||||
if ($paging->sortfield == 'date'
|
||||
&& $paging->sortorder == 'desc'
|
||||
) {
|
||||
krsort($clog);
|
||||
} else {
|
||||
ksort($clog);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$log_count = 0;
|
||||
$log = '';
|
||||
foreach ($clog as $action => $logrows) {
|
||||
$_action = 0;
|
||||
foreach ($logrows as $row) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
|
||||
if ($_action != $action) {
|
||||
switch ($action) {
|
||||
case USR_ACTION:
|
||||
$_action = $lng['admin']['customer'];
|
||||
break;
|
||||
case RES_ACTION:
|
||||
$_action = $lng['logger']['reseller'];
|
||||
break;
|
||||
case ADM_ACTION:
|
||||
$_action = $lng['logger']['admin'];
|
||||
break;
|
||||
case CRON_ACTION:
|
||||
$_action = $lng['logger']['cron'];
|
||||
break;
|
||||
case LOGIN_ACTION:
|
||||
$_action = $lng['logger']['login'];
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
$_action = $lng['logger']['intern'];
|
||||
break;
|
||||
default:
|
||||
$_action = $lng['logger']['unknown'];
|
||||
break;
|
||||
}
|
||||
|
||||
$row['action'] = $_action;
|
||||
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
|
||||
}
|
||||
|
||||
$log_count++;
|
||||
$row['type'] = getLogLevelDesc($row['type']);
|
||||
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
|
||||
$count++;
|
||||
$_action = $action;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate('logger/logger') . "\";");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -106,32 +106,7 @@ class FileLogger extends AbstractLogger {
|
||||
break;
|
||||
}
|
||||
|
||||
$_type = 'unknown';
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case LOG_INFO:
|
||||
$_type = 'information';
|
||||
break;
|
||||
case LOG_NOTICE:
|
||||
$_type = 'notice';
|
||||
break;
|
||||
case LOG_WARNING:
|
||||
$_type = 'warning';
|
||||
break;
|
||||
case LOG_ERR:
|
||||
$_type = 'error';
|
||||
break;
|
||||
case LOG_CRIT:
|
||||
$_type = 'critical';
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
$_type = 'debug';
|
||||
break;
|
||||
default:
|
||||
$_type = 'unknown';
|
||||
break;
|
||||
}
|
||||
$_type = getLogLevelDesc($type);
|
||||
|
||||
if(!isset($this->userinfo['loginname'])
|
||||
|| $this->userinfo['loginname'] == '')
|
||||
|
||||
@@ -124,6 +124,11 @@ return array (
|
||||
'url' => 'customer_extras.php?page=htaccess',
|
||||
'label' => $lng['menue']['extras']['pathoptions'],
|
||||
),
|
||||
array (
|
||||
'url' => 'customer_logger.php?page=log',
|
||||
'label' => $lng['menue']['logger']['logger'],
|
||||
'show_element' => ( Settings::Get('logger.enabled') == true )
|
||||
),
|
||||
),
|
||||
),
|
||||
'traffic' => array (
|
||||
@@ -220,6 +225,12 @@ return array (
|
||||
'label' => $lng['admin']['cron']['cronsettings'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
),
|
||||
array (
|
||||
'url' => 'admin_logger.php?page=log',
|
||||
'label' => $lng['menue']['logger']['logger'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
'show_element' => ( Settings::Get('logger.enabled') == true ),
|
||||
),
|
||||
array (
|
||||
'url' => 'admin_settings.php?page=rebuildconfigs',
|
||||
'label' => $lng['admin']['rebuildconf'],
|
||||
@@ -284,12 +295,6 @@ return array (
|
||||
'url' => 'admin_templates.php?page=email',
|
||||
'label' => $lng['admin']['templates']['email'],
|
||||
),
|
||||
array (
|
||||
'url' => 'admin_logger.php?page=log',
|
||||
'label' => $lng['menue']['logger']['logger'],
|
||||
'required_resources' => 'change_serversettings',
|
||||
'show_element' => ( Settings::Get('logger.enabled') == true ),
|
||||
),
|
||||
array (
|
||||
'url' => 'admin_message.php?page=message',
|
||||
'label' => $lng['admin']['message'],
|
||||
|
||||
48
templates/Sparkle/customer/logger/logger.tpl
vendored
Normal file
48
templates/Sparkle/customer/logger/logger.tpl
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
$header
|
||||
<article>
|
||||
<header>
|
||||
<h2>
|
||||
<img src="templates/{$theme}/assets/img/icons/syslog_big.png" alt="" />
|
||||
{$lng['menue']['logger']['logger']}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
|
||||
<form action="{$linker->getLink(array('section' => 'logger'))}" method="post" enctype="application/x-www-form-urlencoded">
|
||||
<input type="hidden" name="s" value="$s"/>
|
||||
<input type="hidden" name="page" value="$page"/>
|
||||
<input type="hidden" name="send" value="send" />
|
||||
|
||||
<div class="overviewsearch">
|
||||
{$searchcode}
|
||||
</div>
|
||||
|
||||
<div class="overviewadd">
|
||||
{$pagingcode}
|
||||
</div>
|
||||
|
||||
<table class="full hl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{$lng['logger']['date']} {$arrowcode['date']}</th>
|
||||
<th>{$lng['logger']['type']} {$arrowcode['type']}</th>
|
||||
<th>{$lng['logger']['action']}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
$log
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<if 15 < $log_count >
|
||||
<div class="overviewadd">
|
||||
{$pagingcode}
|
||||
</div>
|
||||
</if>
|
||||
|
||||
</section>
|
||||
|
||||
</article>
|
||||
$footer
|
||||
3
templates/Sparkle/customer/logger/logger_action.tpl
vendored
Normal file
3
templates/Sparkle/customer/logger/logger_action.tpl
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<tr>
|
||||
<td colspan="3"><strong>{$row['action']}</strong></td>
|
||||
</tr>
|
||||
5
templates/Sparkle/customer/logger/logger_log.tpl
vendored
Normal file
5
templates/Sparkle/customer/logger/logger_log.tpl
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<tr>
|
||||
<td>{$row['date']}</td>
|
||||
<td>{$row['type']}</td>
|
||||
<td>{$row['text']}</td>
|
||||
</tr>
|
||||
Reference in New Issue
Block a user