/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk
24 by Suren A. Chilingaryan
Logger subsystem
1
<?php
2
3
    function ShowTime($tm) {
225 by Suren A. Chilingaryan
Use 24h format in admin panel
4
	return $tm->format("F j, Y H:i:s.uP");
24 by Suren A. Chilingaryan
Logger subsystem
5
    }
6
7
8
    $logfile = $_REQUEST['logfile'];
9
    $logpos = $_REQUEST['logpos'];
10
11
    $info = adeiGetLogInfo($logfile, $logpos);
12
    
25 by Suren A. Chilingaryan
Various LOGGER and ZEUSReader fixes
13
    ?><br/><table class="loginfo">
24 by Suren A. Chilingaryan
Logger subsystem
14
	<tr>
15
	    <th><?echo translate("Time");?></th>
16
	    <td><?echo ShowTime($info['time']);?></td>
17
	</tr>
18
	<tr>
440 by Suren A. Chilingaryan
Extend logging format for better performance
19
	    <th><?echo translate("Latency");?></th>
20
	    <td><?echo (1. * $info['latency'] / 1000000) . " s";?></td>
21
	</tr>
22
	<tr>
23
	    <th><?echo translate("Server");?></th>
24
	    <td><?echo $info['setup'] . " / " . $info['server'];?></td>
24 by Suren A. Chilingaryan
Logger subsystem
25
	</tr>
26
	<tr>
27
	    <th><?echo translate("Source");?></th>
440 by Suren A. Chilingaryan
Extend logging format for better performance
28
	    <td><?echo $info['source'] . " " . $info['target'];?></td>
24 by Suren A. Chilingaryan
Logger subsystem
29
	</tr>
30
	<tr>
440 by Suren A. Chilingaryan
Extend logging format for better performance
31
	    <th><?echo translate("Request");?></th>
32
	    <td><?echo $info['session'] . " / " . $info['request'];?></td>
24 by Suren A. Chilingaryan
Logger subsystem
33
	</tr>
34
	<tr>
35
	    <th><?echo translate("Priority");?></th>    
36
	    <td><?echo $info['priority'];?></td>
37
	</tr>
38
	<tr>
39
	    <th><?echo translate("Request");?></th>    
40
	    <td><?
41
		if ($info['request']) echo $info['request'];
42
		else echo "-";
43
	    ?></td>
44
	</tr>
25 by Suren A. Chilingaryan
Various LOGGER and ZEUSReader fixes
45
	<tr>
24 by Suren A. Chilingaryan
Logger subsystem
46
	    <th><?echo translate("Message");?></th>    
47
	    <td><?
48
		if ($info['message']) echo $info['message'];
49
		else echo "-";
50
	    ?></td>
51
	</tr>
52
    </table><br/><?
53
    
54
    if ($info['exception']) {
55
	echo "<h4>" . translate("Exception: ") . "</h4>";
56
	
288 by Suren A. Chilingaryan
Fixes logger complaining on UTF encoding
57
	$ae = LOGGER::DecodeObject($info['exception']);
24 by Suren A. Chilingaryan
Logger subsystem
58
	echo translate("Code: %d", $ae->getCode()) . "<br/>";
59
	echo translate("Message: %s", $ae->getMessage()) . "<br/>";
60
	echo translate("Location: %s:%d", $ae->getFile(), $ae->getLine()) . "<br/>";
61
    }
62
    
63
    if ($info['GET']) {
64
	echo "<h4>" . translate("GET options: ") . "</h4>";
65
	echo "<pre>";
66
	print_r($info['GET']);
67
	echo "</pre>";
68
    }
69
70
    if ($info['POST']) {
71
	echo "<h4>" . translate("POST options: ") . "</h4>";
72
	echo "<pre>";
73
	print_r($info['POST']);
74
	echo "</pre>";
75
    }
76
77
    if ($info['RAW_DATA']) {
78
	echo "<h4>" . translate("POST data: ") . "</h4>";
79
	echo "<pre>";
80
	print_r($info['RAW_DATA']);
81
	echo "</pre>";
82
    }
83
25 by Suren A. Chilingaryan
Various LOGGER and ZEUSReader fixes
84
    if ($info['REQUEST_DETAILS']) {
85
	echo "<h4>" . translate("Request details: ") . "</h4>";
86
	
87
	echo "<table>
88
	    <tr><td>" . translate("Client") . ":</td><td>" . $info['REQUEST_DETAILS']['REMOTE_ADDR'] . "</td></tr>
89
	    <tr><td>" . translate("User Agent") . ":</td><td>" . $info['REQUEST_DETAILS']['HTTP_USER_AGENT'] . "</td></tr>
90
	</table>";
91
92
	echo "<pre>";
93
	print_r($info['REQUEST_DETAILS']);
94
	echo "</pre>";
95
    }
96
24 by Suren A. Chilingaryan
Logger subsystem
97
    if ($info['object']) {
98
	echo "<h4>" . translate("Affected Object: ") . "</h4>";
99
100
	echo "<pre>";
288 by Suren A. Chilingaryan
Fixes logger complaining on UTF encoding
101
	print_r(LOGGER::DecodeObject($info['object']));
24 by Suren A. Chilingaryan
Logger subsystem
102
	echo "</pre>";
103
    }
104
105
    if ($info['result']) {
106
	echo "<h4>" . translate("Result: ") . "</h4>";
107
	if (preg_match("/(getimage|getlogo)/", $info['source'])) {
108
	    $data = pack("H*", $info['result']);
109
	    $image = new Imagick();
110
	    if ($image) {
111
	        $image->readImageBlob($data);
112
		$format = $image->getImageFormat();
113
		$geometry = $image->getImageGeometry();
114
		$size = $image->getImageSize();
115
		echo translate("Image Information: %s, %dx%d, %s", $format, $geometry['width'], $geometry['height'], dsPrintSize($size)) . "<br/>";
116
#		print_r($image->identifyImage());
117
	    }    
118
	    //PNG print_r($image->getImageFormat());
119
	    
120
	    echo "<img src=\"logimage.php?logfile=$logfile&logpos=$logpos\"/>";
121
	} else {
122
	    $data = pack("H*", $info['result']);
123
	    echo "<pre>";
124
	    echo htmlentities($data);
125
	    echo "</pre>";
126
	}
127
    }
128
116 by Suren A. Chilingaryan
Admin insterface debugview minor enhancement
129
    if ($info['exception']) {
130
	echo "<h4>" . translate("Backtrace: ") . "</h4>";
131
	echo "<pre>";
132
	print_r($ae->getTrace());
133
	echo "</pre>";
134
    }
135
24 by Suren A. Chilingaryan
Logger subsystem
136
//    print_r($info);
137
?>