Skip to content

Commit b953804

Browse files
committed
Fix syntax error
1 parent 920848c commit b953804

File tree

2 files changed

+54
-46
lines changed

2 files changed

+54
-46
lines changed

api.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,14 +593,15 @@ function sendRawTransaction($rawtx,$gethRPC){
593593
// We have a pledge:
594594
$trans_type = 'Pledge';
595595
$from_add = 'Admin';
596-
$to_add = $dest;
596+
$to_add = $dest;
597597

598-
$acctype = getAccType($sender, $contract);
598+
$acctype = getAccType($sender, $contract);
599599
$status = getAccountStatus(array($sender), $contract);
600600
$curr_stat= $status[$sender];
601-
601+
602602
$need_pending = $acctype==2 && $curr_stat==1;
603603
}
604+
604605
}
605606

606607

checkAdmin.php

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -107,31 +107,36 @@ function isActive($address, $contract){
107107

108108
return substr($data,-1);
109109
}
110-
110+
111+
111112
function getVersion( $contract){
112-
$url = getServerAddress()."/api.php";
113-
$ch = curl_init();
114-
$ethCall = ['to' =>$contract,
115-
'data' => '0x54fd4d50'
116-
];
117-
$fields = ['ethCall'=>$ethCall];
118-
$fields_string = http_build_query($fields);
119-
120-
curl_setopt($ch, CURLOPT_URL, $url);
121-
// Set so curl_exec returns the result instead of outputting it.
122-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
123-
curl_setopt($ch, CURLOPT_POST, count($fields));
124-
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
125-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
126-
127-
// Get the response and close the channel.
128-
$response = curl_exec($ch);
129-
curl_close($ch);
130-
131-
$json = json_decode($response);
132-
$data= $json->{'data'};
133-
134-
return $data;
113+
$url = getServerAddress()."/api.php";
114+
$ch = curl_init();
115+
$ethCall = ['to' =>$contract,
116+
'data' => '0x54fd4d50'
117+
];
118+
$fields = ['ethCall'=>$ethCall];
119+
$fields_string = http_build_query($fields);
120+
121+
curl_setopt($ch, CURLOPT_URL, $url);
122+
// Set so curl_exec returns the result instead of outputting it.
123+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
124+
curl_setopt($ch, CURLOPT_POST, count($fields));
125+
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
126+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
127+
128+
// Get the response and close the channel.
129+
$response = curl_exec($ch);
130+
curl_close($ch);
131+
132+
$json = json_decode($response);
133+
$data= $json->{'data'};
134+
135+
return $data; //hex2bin($data);
136+
}
137+
138+
139+
135140

136141
function getNumber($address, $contract, $function){
137142
$url = getServerAddress()."/api.php";
@@ -189,7 +194,7 @@ function getNumberInMap($address1, $addresse2, $contract, $function){
189194
$json = json_decode($response);
190195
$data= $json->{'data'};
191196

192-
return hexdec($data);
197+
return hexdec($data);
193198
}
194199

195200
function getBalance($address, $contract){
@@ -220,25 +225,27 @@ function checkSign($dat, $signature, $caller){
220225
return $caller==personal_ecRecover($dat, $signature);
221226
}
222227

228+
223229
function getAccountStatus($addresses, $contract) {
224-
$version = getVersion($contract);
225-
$result= array();
226-
foreach ( $addresses as $add) {
227-
$result[$add] = 0;
228-
}
229-
if (strlen(strval($version))>2) {
230-
// New Contract use isActive
231-
foreach ( $addresses as $add) {
232-
$result[$add] = isActive($add, $contract);
233-
}
234-
} else {
235-
// Old contract fallback on getAccStatus
236-
foreach ( $addresses as $add) {
237-
$result[$add] = getAccStatus($add, $contract);
238-
}
239-
}
240-
241-
return $result;
230+
231+
$version = getVersion($contract);
232+
$result= array();
233+
foreach ( $addresses as $add) {
234+
$result[$add] = 0;
235+
}
236+
if (strlen(strval($version))>2) {
237+
// New Contract use isActive
238+
foreach ( $addresses as $add) {
239+
$result[$add] = isActive($add, $contract);
240+
}
241+
} else {
242+
// Old contract fallback on getAccStatus
243+
foreach ( $addresses as $add) {
244+
$result[$add] = getAccStatus($add, $contract);
245+
}
246+
}
247+
248+
return $result;
242249
}
243250

244251

0 commit comments

Comments
 (0)