154 lines
5.7 KiB
PHP
154 lines
5.7 KiB
PHP
|
|
<?php
|
||
|
|
if(!defined('OSTSCPINC') || !@$thisuser->isStaff()) die('Zugriff verweigert');
|
||
|
|
|
||
|
|
$qstr='&t=syslog'; //Query string collector
|
||
|
|
if($_REQUEST['type']) {
|
||
|
|
$qstr.='&type='.urlencode($_REQUEST['type']);
|
||
|
|
}
|
||
|
|
|
||
|
|
$type=null;
|
||
|
|
|
||
|
|
switch(strtolower($_REQUEST['type'])){
|
||
|
|
case 'error':
|
||
|
|
$title='Fehler';
|
||
|
|
$type=$_REQUEST['type'];
|
||
|
|
break;
|
||
|
|
case 'warning':
|
||
|
|
$title='Warnungen';
|
||
|
|
$type=$_REQUEST['type'];
|
||
|
|
break;
|
||
|
|
case 'debug':
|
||
|
|
$title='Debug Logs';
|
||
|
|
$type=$_REQUEST['type'];
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
$type=null;
|
||
|
|
$title='Alle Logs';
|
||
|
|
}
|
||
|
|
|
||
|
|
$qwhere =' WHERE 1';
|
||
|
|
|
||
|
|
//Type
|
||
|
|
if($type){
|
||
|
|
$qwhere.=' AND log_type='.db_input($type);
|
||
|
|
}
|
||
|
|
|
||
|
|
//dates
|
||
|
|
$startTime =($_REQUEST['startDate'] && (strlen($_REQUEST['startDate'])>=8))?strtotime($_REQUEST['startDate']):0;
|
||
|
|
$endTime =($_REQUEST['endDate'] && (strlen($_REQUEST['endDate'])>=8))?strtotime($_REQUEST['endDate']):0;
|
||
|
|
if( ($startTime && $startTime>time()) or ($startTime>$endTime && $endTime>0)){
|
||
|
|
$errors['err']='Eingegebene Datumspanne ist ungültig. Auswahl wird ignoriert.';
|
||
|
|
$startTime=$endTime=0;
|
||
|
|
}else{
|
||
|
|
|
||
|
|
//Have fun with dates.
|
||
|
|
|
||
|
|
if($startTime){
|
||
|
|
|
||
|
|
$qwhere.=' AND created>=FROM_UNIXTIME('.$startTime.')';
|
||
|
|
|
||
|
|
|
||
|
|
$qstr.='&startDate='.urlencode($_REQUEST['startDate']);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if($endTime){
|
||
|
|
|
||
|
|
$qwhere.=' AND created<=FROM_UNIXTIME('.$endTime.')';
|
||
|
|
|
||
|
|
$qstr.='&endDate='.urlencode($_REQUEST['endDate']);
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$qselect = 'SELECT log.* ';
|
||
|
|
$qfrom=' FROM '.SYSLOG_TABLE.' log ';
|
||
|
|
//get log count based on the query so far..
|
||
|
|
$total=db_count("SELECT count(*) $qfrom $qwhere");
|
||
|
|
$pagelimit=30;
|
||
|
|
$page = ($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;
|
||
|
|
//pagenate
|
||
|
|
$pageNav=new Pagenate($total,$page,$pagelimit);
|
||
|
|
$pageNav->setURL('admin.php',$qstr);
|
||
|
|
$query="$qselect $qfrom $qwhere ORDER BY log.created DESC LIMIT ".$pageNav->getStart().",".$pageNav->getLimit();
|
||
|
|
//echo $query;
|
||
|
|
$result = db_query($query);
|
||
|
|
$showing=db_num_rows($resp)?$pageNav->showing():"";
|
||
|
|
?>
|
||
|
|
<div class="msg">System Logs</div>
|
||
|
|
<div id='filter' >
|
||
|
|
<form action="admin.php?t=syslog" method="get">
|
||
|
|
<input type="hidden" name="t" value="syslog" />
|
||
|
|
<div style="padding-left:15px;">
|
||
|
|
Datumspanne:
|
||
|
|
Von <input id="sd" size=15 name="startDate" value="<?=Format::htmlchars($_REQUEST['startDate'])?>"
|
||
|
|
onclick="event.cancelBubble=true;calendar(this);" autocomplete=OFF>
|
||
|
|
<a href="#" onclick="event.cancelBubble=true;calendar(getObj('sd')); return false;"><img src='images/cal.png'border=0 alt=""></a>
|
||
|
|
bis
|
||
|
|
<input id="ed" size=15 name="endDate" value="<?=Format::htmlchars($_REQUEST['endDate'])?>"
|
||
|
|
onclick="event.cancelBubble=true;calendar(this);" autocomplete=OFF >
|
||
|
|
<a href="#" onclick="event.cancelBubble=true;calendar(getObj('ed')); return false;"><img src='images/cal.png'border=0 alt=""></a>
|
||
|
|
|
||
|
|
Typ:
|
||
|
|
<select name='type'>
|
||
|
|
<option value="" selected>Alle</option>
|
||
|
|
<option value="Error" <?=($type=='Error')?'selected="selected"':''?>>Fehler</option>
|
||
|
|
<option value="Warning" <?=($type=='Warning')?'selected="selected"':''?>>Warnungen</option>
|
||
|
|
<option value="Debug" <?=($type=='Debug')?'selected="selected"':''?>>Debug</option>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<input type="submit" Value="Los!" />
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
<div style="margin-bottom:20px; padding-top:0px;">
|
||
|
|
<table width="100%" border="0" cellspacing=1 cellpadding=2>
|
||
|
|
<form action="tickets.php" method="POST" name='tickets' onSubmit="return checkbox_checker(this,1,0);">
|
||
|
|
<input type="hidden" name="a" value="mass_process" >
|
||
|
|
<input type="hidden" name="status" value="<?=$statusss?>" >
|
||
|
|
<tr><td>
|
||
|
|
<table width="100%" border="0" cellspacing=0 cellpadding=2 class="logs" align="center">
|
||
|
|
<tr><th><?=$title?></th></tr>
|
||
|
|
<?
|
||
|
|
$class = "row1";
|
||
|
|
$total=0;
|
||
|
|
if($result && ($num=db_num_rows($result))):
|
||
|
|
$icons=array('Debug'=>'debugLog','Warning'=>'alertLog','Error'=>'errorLog');
|
||
|
|
while ($row = db_fetch_array($result)) {
|
||
|
|
$icon=isset($icons[$row['log_type']])?$icons[$row['log_type']]:'debugLog';
|
||
|
|
?>
|
||
|
|
<tr class="<?=$class?> " id="<?=$row['log_id']?>">
|
||
|
|
<td>
|
||
|
|
<a href="javascript:toggleMessage('<?=$row['log_id']?>');">
|
||
|
|
<img border="0" align="left" id="img_<?=$row['log_id']?>" src="images/plus.gif">
|
||
|
|
<span style="color:000; float: left; width:190px;"><?=Format::db_daydatetime($row['created'])?></span>
|
||
|
|
|
||
|
|
<span class="Icon <?=$icon?>"><?=Format::htmlchars($row['title'])?></span></a>
|
||
|
|
<div id="msg_<?=$row['log_id']?>" class="hide">
|
||
|
|
<hr>
|
||
|
|
<?=Format::display($row['log'])?>
|
||
|
|
<span style="text-align:right;float:right;"><i><?=Format::htmlchars($row['ip_address'])?> </i></span>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
<?
|
||
|
|
$class = ($class =='row2') ?'row1':'row2';
|
||
|
|
} //end of while.
|
||
|
|
else: //not tickets found!! ?>
|
||
|
|
<tr class="<?=$class?>"><td><b>Abfrage ergab 0 Ergebnisse.</b></td></tr>
|
||
|
|
<?
|
||
|
|
endif; ?>
|
||
|
|
</table>
|
||
|
|
</td></tr>
|
||
|
|
<?
|
||
|
|
if($num>0){
|
||
|
|
?>
|
||
|
|
<tr><td style="padding-left:20px">Seite:<?=$pageNav->getPageLinks()?></td></tr>
|
||
|
|
<?} ?>
|
||
|
|
</form>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
<?
|