Skip to content

Commit

Permalink
Merge pull request #36 from NAVCoin/v1.0.8
Browse files Browse the repository at this point in the history
V1.0.8
  • Loading branch information
matt-auckland committed Feb 15, 2018
2 parents adb6b50 + bd388ae commit 140685b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
53 changes: 50 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,43 @@
$bal2 = $coin->getbalance("*", 0);
$bal3 = abs($bal1 - $bal2);
$bal4 = abs("{$y['stake']}");
if($primary!=""){
$address = $primary;

$showMainAddressChangedMessage = false;
$oldAddress = $primary;
$newAddress;
// Fixes bug when the main address is set to an address not in the wallet -----------------------------------------------------
if($primary != ""){
$hasPrimary = false;
$addresses = $coin->getaddressesbyaccount("");

foreach($addresses as $add){
if($add == $primary){
$hasPrimary = true;
}
}
if ($hasPrimary) {
$address = $primary;
} else {

$address = $coin->getaddressesbyaccount("")[0];

// Duplicated code from setPrimary, as we can't access the function ----------------
$primaryLocation = "/home/stakebox/UI/primary".$currentWallet."address.php";
// Open the file and erase the contents if any
$fp = fopen($primaryLocation, "w");
// Write the data to the file
// CODE INJECTION WARNING!
fwrite($fp, "<?php\n\$primary='';\n?>");
// Close the file
fclose($fp);
$showMainAddressChangedMessage = true;
$newAddress = $address;
}
}
else{
$address = $coin->getaddressesbyaccount("")[0];
$address = $coin->getaddressesbyaccount("")[0];
}
//-------------------------------------------------------------

if ($currentWallet == NavCoin){
$stakinginfo = $coin->getstakinginfo();
Expand All @@ -48,6 +79,22 @@
$fiatValue = number_format($fiatValue);
?>
<div class="row">
<?php
if ($showMainAddressChangedMessage == true)
echo "
<div class='col-lg-12'>
<div class='alert alert-info'>
<strong>Primary Address Updated:</strong>We detected your saved primary address was not owned by your wallet. It has been replaced with a valid address.
<p><small>This can occur when you restore your wallet after manually setting the primary address.</small></p>
<small>
New Address: \"{$address}\"
<br>Old Address: \"{$oldAddress}\"
</small>
</div>
</div>";

?>

<div class="col-lg-6">
<h3>Available Balance: <font color='green'><?php echo number_format($bal1); ?></font> <?php echo $currentWallet; ?></h3>
<h4>Unavailable Due To Staking: <font color='red'><?php echo $bal4; ?></font> <?php echo $currentWallet; ?></h4>
Expand Down
2 changes: 1 addition & 1 deletion libs/release_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

LOG_FILE="/home/pi/release_log.txt"
BOOTSTRAP_URL="https://build.nav.community/bootstrap/bootstrap-navcoin.tar"
VERSION="1.0.7"
VERSION="1.0.8"

echo "WARNING THIS SCRIPT WILL DELETE YOUR WALLET.DAT. THERE IS NO WAY TO RECOVER YOUR COINS WITHOUT A BACK UP. THIS SCRIPT IS ONLY FOR USE WHEN CREATING NEW NAVPI IMAGES"
echo "TO CONTINUE ENTER 'DELETE' OR ENTER ANYTHING ELSE TO EXIT"
Expand Down

0 comments on commit 140685b

Please sign in to comment.