/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
$cur = time();

$interval = $_REQUEST['interval'];
$filter = json_decode(stripslashes($_REQUEST['filter']), true);

if (isset($_REQUEST['priority'])) {
    $priority = $_REQUEST['priority'];
} else {
    $priority = false;//LOG_WARNING;
}


if (preg_match("/^(\d+)-(\d+)$/", $interval, $m)) {
    $from = $m[1];
    $to = $m[2];
    
    if ($to > $cur) $to = $cur;
    
    if ($to < $from) {
	$from = false;
	$to = false;
    }
}

if ((!$from)||(!$to)) {
    $to = $cur;
    $from = $to - $to%86400;
} 


function getLogURL() {
    global $priority;
    global $filter;
    $res = "index.php?page=logview.php";
    if ($priority) $res .= "&priority=$priority";
    if ($filter) $res .= "&filter=" . $_REQUEST['filter'];
    return $res;
}

?>
<script type="text/javascript" src="../includes/datetimepicker.js"></script>
<script type="text/javascript" src="../js/datetime.js"></script>
<script type="text/javascript" src="../js/tools.js"></script>

<script type="text/javascript">
//<![CDATA[

    function selectDate(sel) {
        var istart, iend;
	if (sel) {
    	    istart = adeiDateParse(sel);
/*	    var new_date = new Date();
	    new_date.setTime(Date.parse(sel));
	    var istart = new_date.getTime()/1000;*/
	    iend = istart + 86400;
	}
	window.location = "<?echo getLogURL();?>&interval=" + istart + "-" + iend;
    }
//]]>
</script>

<br/><a href="javascript:NewCal(null,'mmmddyyyy',false,24, selectDate)">
    <img src="../images/cal.png"/>
</a>
<?

function ShowTime($tm) {
    return $tm->format("Y-m-d\Th:i:s.uP");
}

function Filter(&$log, $add, $value=false) {
    global $interval;
    global $filter;

    $nfilter = $filter;    
    if ($value !== false) $nfilter[$add] = $value;
    else $nfilter[$add] = $log[$add];
    return "index.php?page=logview.php&interval=" . $interval . "&filter=" . urlencode(json_encode($nfilter));
}


echo translate("ADEI Logs for: ") . date("c", $from) . " - " . date("c", $to) . "<br/><br/>";

$logs = adeiGetLogs($from, $to, $priority, $filter?$filter:false);

?><table class="logtable"><tr>
    <th><?echo translate("Time");?></th>
    <th><?echo translate("Setup");?></th>
    <th><?echo translate("Server");?></th>
    <th><?echo translate("Source");?></th>
    <th><?echo translate("Session");?></th>
    <th><?echo translate("Request");?></th>
    <th><?echo translate("Target");?></th>
    <th><?echo translate("PID");?></th>
    <th><?echo translate("Client");?></th>
    <th><?echo translate("Priority");?></th>
</tr></th><?
foreach($logs as $log) {
/*    $info = adeiGetLogInfo($log['logfile'], $log['filepos']);
    if ($filter) {
	if (($filter["server"])&&($log['server'] != $filter["server"])) continue;
    }*/
    echo "<tr>";
    echo "<td>" . ShowTime($log['time']) . "</td>";
    echo "<td><a href=\"" . Filter($log, 'setup') . "\">" . $log['setup'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'server') . "\">" . $log['server'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'source') . "\">" . $log['source'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'session') . "\">" . $log['session'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'request') . "\">" . $log['request'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'target') . "\">" . $log['target'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'pid') . "\">" . $log['pid'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'client') . "\">" . $log['client'] . "</a></td>";
    echo "<td>" . $log['priority'] . "</td>";
    echo "<tr><td colspan=\"9\"><a href=\"index.php?page=loginfo.php&logfile=" . $log['logfile'] . "&logpos=" . $log['filepos']  . "\">" . $log['message'] . "</a></td></tr>";
    
    echo "</tr>";
//    print_r($log);
}
?></table><?



?>