-
Notifications
You must be signed in to change notification settings - Fork 99
/
page-approve.php
213 lines (172 loc) · 6.78 KB
/
page-approve.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
if (@$_POST['approvetxfilter'] || @$_POST['disapprovetxfilter']) {
if (no_displayed_error_result($approvetxid, multichain(
'approvefrom', $_POST['approvefrom'], $_GET['txfilter'], @$_POST['approvetxfilter'] ? true : false
)))
output_success_text('Approval successfully changed in transaction '.$approvetxid);
}
if (@$_POST['approvestreamfilter'] || @$_POST['disapprovestreamfilter']) {
if (no_displayed_error_result($approvetxid, multichain(
'approvefrom', $_POST['approvefrom'], $_GET['streamfilter'], array(
'for' => @$_POST['stream'],
'approve' => @$_POST['approvestreamfilter'] ? true : false
))))
output_success_text('Approval successfully changed in transaction '.$approvetxid);
}
if (@$_GET['txfilter']) {
if (no_displayed_error_result($listtxfilters, multichain(
'listtxfilters', $_GET['txfilter'], true
)))
$txfilter=$listtxfilters[0];
no_displayed_error_result($filtercode, multichain(
'getfiltercode', $_GET['txfilter']
));
}
if (@$_GET['streamfilter']) {
if (no_displayed_error_result($liststreamfilters, multichain(
'liststreamfilters', $_GET['streamfilter'], true
)))
$streamfilter=$liststreamfilters[0];
no_displayed_error_result($filtercode, multichain(
'getfiltercode', $_GET['streamfilter']
));
no_displayed_error_result($liststreams, multichain(
'liststreams', '*', true
));
}
$labels=multichain_labels();
if (no_displayed_error_result($getaddresses, multichain('getaddresses', true))) {
foreach ($getaddresses as $index => $address)
if (!$address['ismine'])
unset($getaddresses[$index]);
if (@$_GET['txfilter']) { // get global admin addresses
$adminaddresses=array();
if (no_displayed_error_result($listpermissions,
multichain('listpermissions', 'admin', implode(',', array_get_column($getaddresses, 'address')))
))
$adminaddresses=array_unique(array_get_column($listpermissions, 'address'));
}
if (@$_GET['streamfilter']) { // get global send addresses
$sendaddresses=array();
if (no_displayed_error_result($listpermissions,
multichain('listpermissions', 'send', implode(',', array_get_column($getaddresses, 'address')))
))
$sendaddresses=array_unique(array_get_column($listpermissions, 'address'));
}
}
?>
<div class="row">
<div class="col-sm-12">
<?php
if (@$_GET['txfilter']) {
require_once 'functions-filter.php';
?>
<h3>Approve transaction filter</h3>
<form class="form-horizontal" method="post" action="./?chain=<?php echo html($_GET['chain'])?>&page=<?php echo html($_GET['page'])?>&txfilter=<?php echo html($_GET['txfilter'])?>">
<div class="form-group">
<label class="col-sm-2 control-label">Filter name</label>
<div class="col-sm-9">
<p class="form-control-static"><?php echo html($txfilter['name'])?></p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Code</label>
<div class="col-sm-9">
<div class="form-control-static" style="height:16em; overflow:scroll; white-space:pre;"><code><?php echo html($filtercode)?></code></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Status</label>
<div class="col-sm-9">
<p class="form-control-static"><?php output_txfilter_status($txfilter); ?></p>
</div>
</div>
<div class="form-group">
<label for="approvefrom" class="col-sm-2 control-label">Admin address:</label>
<div class="col-sm-9">
<select class="form-control col-sm-6" name="approvefrom" id="approvefrom">
<?php
foreach ($adminaddresses as $address)
echo '<option value="'.html($address).'">'.format_address_html($address, true, $labels).'</option>';
?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<input class="btn btn-default" type="submit" name="approvetxfilter" value="Approve Transaction Filter">
<input class="btn btn-default" type="submit" name="disapprovetxfilter" value="Disapprove Transaction Filter">
</div>
</div>
</form>
<?php
}
if (@$_GET['streamfilter']) {
require_once 'functions-filter.php';
?>
<h3>Approve stream filter</h3>
<form class="form-horizontal" method="post" action="./?chain=<?php echo html($_GET['chain'])?>&page=<?php echo html($_GET['page'])?>&streamfilter=<?php echo html($_GET['streamfilter'])?>">
<div class="form-group">
<label class="col-sm-2 control-label">Filter name</label>
<div class="col-sm-9">
<p class="form-control-static"><?php echo html($streamfilter['name'])?></p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Code</label>
<div class="col-sm-9">
<div class="form-control-static" style="height:16em; overflow:scroll; white-space:pre;"><code><?php echo html($filtercode)?></code></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Active on</label>
<div class="col-sm-9">
<p class="form-control-static"><?php
$oneoutput=false;
foreach ($liststreams as $stream)
foreach ($stream['filters'] as $streamfilter)
if ($streamfilter['createtxid']==$_GET['streamfilter']) {
echo ($oneoutput ? '<br/>' : '').html($stream['name']);
$oneoutput=true;
}
if (!$oneoutput)
echo 'no streams';
?></p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">For stream</label>
<div class="col-sm-9">
<select class="form-control col-sm-6" name="stream" id="stream">
<?php
foreach ($liststreams as $stream)
echo '<option value="'.html($stream['createtxid']).'">'.html($stream['name']).' – created by '.format_address_html($stream['creators'][0], false, $labels).'</option>';
?>
</select>
</div>
</div>
<div class="form-group">
<label for="approvefrom" class="col-sm-2 control-label">Stream admin address:</label>
<div class="col-sm-9">
<select class="form-control col-sm-6" name="approvefrom" id="approvefrom">
<?php
foreach ($sendaddresses as $address)
echo '<option value="'.html($address).'">'.format_address_html($address, true, $labels).'</option>';
?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<input class="btn btn-default" type="submit" name="approvestreamfilter" value="Approve Filter for this Stream">
<input class="btn btn-default" type="submit" name="disapprovestreamfilter" value="Disapprove Filter for this Stream">
</div>
</div>
</form>
<?php
}
?>
</div>
</div>