-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathstats_tree.php
119 lines (107 loc) · 2.41 KB
/
stats_tree.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>amule preferences page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragmas" content="no-cache">
<?php
if ( $_SESSION["auto_refresh"] > 0 ) {
echo "<meta http-equiv=\"refresh\" content=\"", $_SESSION["auto_refresh"], '">';
}
?>
<style type="text/css">
.trigger{
cursor: pointer;
cursor: hand;
/*font-family: Tahoma;*/
font-family: inherit;
font-size: small;
}
.branch{
display: block;
margin-left: 16px;
/*font-family: Tahoma;*/
font-family: inherit;
font-size: small;
}
<!--
body {
margin: 0px;
padding: 5px;
background-color: #39425f;
color:#fff;
font-family: sans-serif;
font-size:12px;
}
-->
</style>
</head>
<script language="JavaScript" type="text/JavaScript">
var openImg = new Image();
openImg.src = "tree-open.gif";
var closedImg = new Image();
closedImg.src = "tree-closed.gif";
function showBranch(branch){
var objBranch = document.getElementById(branch).style;
if(objBranch.display!="none")
objBranch.display="none";
else
objBranch.display="block";
}
function swapFolder(img){
objImg = document.getElementById(img);
if(objImg.src.indexOf('tree-closed.gif')>-1)
objImg.src = openImg.src;
else
objImg.src = closedImg.src;
}
</script>
<body onLoad="showBranch('br_Stats');swapFolder('fl_Stats')">
<?php
function print_ident($i)
{
while($i != 0) {
echo "\t";
$i--;
}
}
function print_item($it, $ident)
{
print_ident($ident);
echo "<img src=\"tree-leaf.gif\">", $it, "<br>\n";
}
function print_folder($key, &$arr, $ident)
{
print_ident($ident);
echo "<span class=\"trigger\" onClick=\"showBranch('br_",
$key, "');swapFolder('fl_", $key, "')\">\n";
print_ident($ident+1);
echo "<img src=\"tree-open.gif\" border=\"0\" id=\"fl_", $key, "\">\n";
print_ident($ident+1);
echo $key, "<br>\n";
print_ident($ident);
echo "</span>\n";
print_ident($ident);
echo "<span class=\"branch\" id=\"br_", $key, "\">\n";
foreach ($arr as $k => $v) {
if ( count(&$v) ) {
print_folder($k, $v, $ident+1);
} else {
print_item($k, $ident+1);
}
}
print_ident($ident);
echo "</span>\n";
}
$stattree = amule_load_vars("stats_tree");
foreach ($stattree as $k => $v) {
if ( count(&$v) ) {
print_folder($k, $v, $ident+1);
} else {
print_item($k, $ident+1);
}
}
?>
</body>
</html>