forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI_admin_logs.php
121 lines (95 loc) · 4.27 KB
/
GUI_admin_logs.php
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
<?
/************************************************************************/
/* Leonardo: Gliding XC Server */
/* ============================================ */
/* */
/* Copyright (c) 2004-5 by Andreadakis Manolis */
/* http://sourceforge.net/projects/leonardoserver */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
//************************************************************************/
if ( !is_leo_admin($userID) ) { echo "go away"; return; }
$sortOrder=makeSane($_REQUEST["sortOrder"]);
if ( $sortOrder=="") $sortOrder="actionTime";
//$page_num=$_REQUEST["page_num"]+0;
//if ($page_num==0) $page_num=1;
//-----------------------------------------------------------------------------------------------------------
$query="SELECT * FROM ".$logTable." ORDER BY $sortOrder DESC ";
// echo $query;
$res= $db->sql_query($query);
if($res <= 0){
echo "no log entries found<br>";
return ;
}
$legend="Log entries";
$legendRight="";
echo "<div class='tableTitle shadowBox'>
<div class='titleDiv'>$legend</div>
<div class='pagesDiv'>$legendRight</div>
</div>" ;
function printHeaderTakeoffs($width,$sortOrder,$fieldName,$fieldDesc,$query_str) {
global $moduleRelPath;
global $Theme,$module_name;
if ($width==0) $widthStr="";
else $widthStr="width='".$width."'";
if ($fieldName=="intName") $alignClass="alLeft";
else $alignClass="";
if ($sortOrder==$fieldName) {
echo "<td $widthStr class='SortHeader activeSortHeader $alignClass'>
<a href='?name=$module_name&op=admin_logs&sortOrder=$fieldName$query_str'>$fieldDesc<img src='$moduleRelPath/img/icon_arrow_down.png' border=0 width=10 height=10></div>
</td>";
} else {
echo "<td $widthStr class='SortHeader $alignClass'><a href='?name=$module_name&op=admin_logs&sortOrder=$fieldName$query_str'>$fieldDesc</td>";
}
}
$headerSelectedBgColor="#F2BC66";
?>
<table class='simpleTable' width="100%" border=0 cellpadding="2" cellspacing="0">
<tr>
<td width="25" class='SortHeader'>#</td>
<?
printHeaderTakeoffs(100,$sortOrder,"actionTime","DATE",$query_str) ;
printHeaderTakeoffs(0,$sortOrder,"ServerItemID","Server",$query_str) ;
printHeaderTakeoffs(80,$sortOrder,"userID","userID",$query_str) ;
printHeaderTakeoffs(100,$sortOrder,"ItemType","Type",$query_str) ;
printHeaderTakeoffs(100,$sortOrder,"ItemID","ID",$query_str) ;
printHeaderTakeoffs(100,$sortOrder,"ActionID","Action",$query_str) ;
echo '<td width="100" class="SortHeader">Details</td>';
printHeaderTakeoffs(100,$sortOrder,"Result","Result",$query_str) ;
echo '<td width="100" class="SortHeader">ACTIONS</td>';
?>
</tr>
<?
$currCountry="";
$i=1;
while ($row = $db->sql_fetchrow($res)) {
if ( is_leo_admin($row['userID']) ) $admStr="*ADMIN*";
else $admStr="";
if ($row['ServerItemID']==0) $serverStr="Local";
else $serverStr=$row['ServerItemID'];
$i++;
echo "<TR class='$sortRowClass'>";
echo "<TD>".($i-1+$startNum)."</TD>";
echo "<td>".date("d/m/y H:i:s",$row['actionTime'])."</td>\n";
echo "<td>".$serverStr."</td>\n";
echo "<td>".$row['userID']."$admStr<br>(".$row['effectiveUserID'].")</td>\n";
echo "<td>".Logger::getItemDescription($row['ItemType'])."</td>\n";
echo "<td>".$row['ItemID']."</td>\n";
echo "<td>".Logger::getActionDescription($row['ActionID'])."</td>\n";
echo "<td>";
echo "<div id='sh_details$i'><STRONG><a href='javascript:toggleVisibility(\"details$i\");'>Show details</a></STRONG></div>";
echo "<div id='details$i' style='display:none'><pre>".$row['ActionXML']."</pre></div>";
echo "</td>\n";
echo "<td>".$row['Result']."</td>\n";
echo "<td>";
if ($row['ItemType']==4) { // waypoint
echo "<a href='?name=$module_name&op=show_waypoint&waypointIDview=".$row['ItemID']."'>Display</a>";
}
echo "</td>\n";
echo "</TR>";
}
echo "</table>";
$db->sql_freeresult($res);
?>