forked from baumann-at/MultiChain-GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage-default.php
More file actions
178 lines (161 loc) · 4.86 KB
/
page-default.php
File metadata and controls
178 lines (161 loc) · 4.86 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
if (@$_POST['getnewaddress'])
no_displayed_error_result($getnewaddress, multichain('getnewaddress'));
?>
<div class="row">
<div class="col-sm-6">
<h3>This Node</h3>
<?php
$getinfo=multichain_getinfo();
if (is_array($getinfo)) {
?>
<table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<td><?php echo html($getinfo['chainname'])?></td>
</tr>
<tr>
<th>Version</th>
<td><?php echo html($getinfo['version'])?></td>
</tr>
<tr>
<th>Protocol</th>
<td><?php echo html($getinfo['protocolversion'])?></td>
</tr>
<tr>
<th>Node address</th>
<td><?php echo html($getinfo['nodeaddress'])?></td>
</tr>
<tr>
<th>Blocks</th>
<td><?php echo html($getinfo['blocks'])?></td>
</tr>
<tr>
<th>Peers</th>
<td><?php echo html($getinfo['connections'])?></td>
</tr>
</table>
<?php
}
?>
<h3>Connected Nodes</h3>
<?php
if (no_displayed_error_result($peerinfo, multichain('getpeerinfo'))) {
?>
<?php
foreach ($peerinfo as $peer) {
?>
<table class="table table-bordered table-striped">
<tr>
<th>Node IP address</th>
<td><?php echo html(strtok($peer['addr'], ':'))?></td>
</tr>
<tr>
<th>Version/Subver</th>
<td><?php echo html($peer['version'] . ' ' . $peer['subver'])?></td>
</tr>
<tr>
<th>Handshake address</th>
<td class="td-break-words small"><?php echo html($peer['handshake'])?></td>
</tr>
<tr>
<th>Latency</th>
<td><?php echo html(number_format($peer['pingtime'], 3))?> sec</td>
</tr>
<tr>
<th>Connection Time</th>
<td><?php echo (format_time($peer['conntime']))?></td>
</tr>
<tr>
<th>Send: Last / Size</th>
<td><?php echo (format_time($peer['lastsend']) . ' / ' . number_format($peer['bytessent']/(1024*1024), 2) . " MB")?></td>
</tr>
<tr>
<th>Recv: Last / Size</th>
<td><?php echo (format_time($peer['lastrecv']) . ' / ' . number_format($peer['bytesrecv']/(1024*1024), 2) . " MB")?></td>
</tr>
</table>
<?php
}
?>
<?php
}
?>
</div>
<div class="col-sm-6">
<h3>Addresses</h3>
<?php
if (no_displayed_error_result($getaddresses, multichain('getaddresses', true))) {
$addressmine=array();
foreach ($getaddresses as $getaddress)
$addressmine[$getaddress['address']]=$getaddress['ismine'];
$addresspermissions=array();
if (no_displayed_error_result($listpermissions,
multichain('listpermissions', 'all', implode(',', array_keys($addressmine)))
))
foreach ($listpermissions as $listpermission)
$addresspermissions[$listpermission['address']][$listpermission['type']]=true;
no_displayed_error_result($getmultibalances, multichain('getmultibalances', array(), array(), 0, true));
$labels=multichain_labels();
foreach ($addressmine as $address => $ismine) {
if (count(@$addresspermissions[$address]))
$permissions=implode(', ', @array_keys($addresspermissions[$address]));
else
$permissions='none';
$label=@$labels[$address];
$cansetlabel=$ismine && @$addresspermissions[$address]['send'];
if ($ismine && !$cansetlabel)
$permissions.=' (cannot set label)';
?>
<table class="table table-bordered table-condensed table-break-words <?php echo ($address==@$getnewaddress) ? 'bg-success' : 'table-striped'?>">
<?php
if (isset($label) || $cansetlabel) {
?>
<tr>
<th style="width:30%;">Label</th>
<td><?php echo html(@$label)?><?php
if ($cansetlabel)
echo (isset($label) ? ' – ' : '').
'<a href="'.chain_page_url_html($chain, 'label', array('address' => $address)).'">'.
(isset($label) ? 'change label' : 'Set label').
'</a>';
?></td>
</tr>
<?php
}
?>
<tr>
<th style="width:30%;">Address</th>
<td class="td-break-words small"><?php echo html($address)?><?php echo $ismine ? '' : ' (watch-only)'?></td>
</tr>
<tr>
<th>Permissions</th>
<td><?php echo html($permissions)?><?php
echo ' – <a href="'.chain_page_url_html($chain, 'permissions', array('address' => $address)).'">change</a>';
?></td></tr>
<?php
if (isset($getmultibalances[$address])) {
foreach ($getmultibalances[$address] as $addressbalance) {
?>
<tr>
<th><?php echo html($addressbalance['name'])?></th>
<td><?php echo html($addressbalance['qty'])?></td>
</tr>
<?php
}
}
?>
</table>
<?php
}
}
?>
<form class="form-horizontal" method="post" action="<?php echo chain_page_url_html($chain)?>">
<div class="form-group">
<div class="col-xs-12">
<input class="btn btn-default" name="getnewaddress" type="submit" value="Get new address">
</div>
</div>
</form>
</div>
</div>