Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions web/apps/apps.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ function explorer_address_link2($address, $short= false) {
}
return '<a href="/apps/explorer/address.php?address='.$address.'">'.$text.'</a>';
}

function safeDisplay($string) {
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
2 changes: 1 addition & 1 deletion web/apps/explorer/accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<form class="app-search d-block pt-0" method="get" action="">
<div class="position-relative">
<input type="text" class="form-control" placeholder="Search: Address" name="search" value="<?php echo $_GET['search'] ?>">
<input type="text" class="form-control" placeholder="Search: Address" name="search" value="<?php echo safeDisplay($_GET['search'] ?? '') ?>">
<button class="btn btn-primary" type="submit"><i class="bx bx-search-alt align-middle"></i></button>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion web/apps/explorer/address.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<td><?php echo $transaction['type_label'] ?></td>
<td><?php echo num($transaction['val']) ?></td>
<td><?php echo num($transaction['fee']) ?></td>
<td style="word-break: break-all"><?php echo $transaction['message'] ?></td>
<td style="word-break: break-all"><?php echo safeDisplay($transaction['message']) ?></td>
</tr>
<?php } ?>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion web/apps/explorer/mempool.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<td><?php echo $transaction['val'] ?></td>
<td><?php echo $transaction['fee'] ?></td>
<td><?php echo Transaction::typeLabel($transaction['type']) ?></td>
<td style="word-break: break-all"><?php echo $transaction['message'] ?></td>
<td style="word-break: break-all"><?php echo safeDisplay($transaction['message']) ?></td>
</tr>
<?php } ?>
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions web/apps/explorer/smart_contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
<?php if(@$property['type']=="map") { ?>
<input class="form-control w-auto d-inline form-control-sm" type="text"
name="sc_property_key[<?php echo $property['name'] ?>]"
value="<?php echo $_REQUEST['sc_property_key'][$property['name']] ?>" placeholder="Key">
value="<?php echo safeDisplay($_REQUEST['sc_property_key'][$property['name']] ?? '') ?>" placeholder="Key">
<?php } ?>
<button type="button" onclick="runAction('sc_get_property_read',['<?php echo $property['name'] ?>'])"
name="sc_get_property_read" value="<?php echo $property['name'] ?>" class="btn btn-sm btn-soft-primary">Read</button>
Expand Down Expand Up @@ -444,7 +444,7 @@
?>
<input type="text" class="form-control form-control-sm d-inline w-auto"
name="sc_view_params[<?php echo $view['name'] ?>][<?php echo $name ?>]"
value="<?php echo $_REQUEST['sc_view_params'][$view['name']][$name] ?>" placeholder="<?php echo $name ?>">
value="<?php echo safeDisplay($_REQUEST['sc_view_params'][$view['name']][$name] ?? '') ?>" placeholder="<?php echo $name ?>">
<?php } ?>
<button type="button" onclick="runAction('sc_view', ['<?php echo $view['name'] ?>'])" class="btn btn-sm btn-soft-primary"
name="sc_view" value="<?php echo $view['name'] ?>">Call</button>
Expand Down
4 changes: 2 additions & 2 deletions web/apps/explorer/tx.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</tr>
<tr>
<td>Message</td>
<td><?php echo $tx['message'] ?></td>
<td><?php echo safeDisplay($tx['message']) ?></td>
</tr>
<tr>
<td>Public key</td>
Expand Down Expand Up @@ -195,7 +195,7 @@
</tr>
<tr>
<td>Params</td>
<td><?php echo implode("<br/>", $sc_data['params']) ?></td>
<td><?php echo implode("<br/>", array_map('safeDisplay', $sc_data['params'])) ?></td>
</tr>
</table>
</div>
Expand Down