Skip to content

Commit

Permalink
Interfase port to twitter bootstrap 3.
Browse files Browse the repository at this point in the history
small fixes in code.
  • Loading branch information
X-NicON committed Sep 28, 2014
1 parent 7c092ca commit e7884f7
Show file tree
Hide file tree
Showing 23 changed files with 599 additions and 7,042 deletions.
110 changes: 60 additions & 50 deletions address.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* @package +Coin - Bitcoin & forks Web Interface
*/

//ini_set("display_errors", false);

include ("header.php");
?>

Expand Down Expand Up @@ -52,16 +50,16 @@

if (isset($_POST['AddrName']) && isset($_POST['myAddress']))
{
$myaddress_arr[$_POST['myAddress']] = $_POST['AddrName'];
$myaddress_arr[$_POST['myAddress']] = $_POST['AddrName'];

$f = fopen("myaddresses.csv", "w");
$f = fopen("myaddresses.csv", "w");

foreach ($myaddress_arr as $address => $name)
{
$line = $address.";".$name."\n";
fputs($f, $line);
}
fclose($f);
foreach ($myaddress_arr as $address => $name)
{
$line = $address.";".$name."\n";
fputs($f, $line);
}
fclose($f);
}


Expand All @@ -70,12 +68,20 @@
echo "<div class='content'>
<h2>Select an account to get a list of an addresses</h2>";
echo "<form action='address.php' method='POST'>
<input name='account'>
<input class='btn' name='addacc' type='submit' value='Add Account' />
</form>";
<div class=\"row\">
<div class=\"col-sm-10\">
<input type=\"text\" name='account' class=\"form-control\">
</div>
<div class=\"col-sm-2\">
<input class='btn btn-default form-control' name='addacc' type='submit' value='Add Account' />
</div>
</div>
</form><br>";

echo "<form action='address.php' method='POST'>
<select name='account'>";
<div class=\"row\">
<div class=\"col-sm-8\">
<select class=\"form-control\" name='account'>";
foreach ($addr as $account => $balance)
{
$selected = "";
Expand All @@ -88,47 +94,51 @@
echo "<option value='{$account}' $selected>{$account} ({$balance})</option>";
}
echo "</select>
<input class='btn' type='submit' value='View addresses' />
<input class='btn' name='addaddr' type='submit' value='Add address' />
</form>";

if (isset($_POST['account']))
$account = $_POST['account'];
else
$account = "";

echo "<table class='table-striped table-bordered table-condensed table'>
<thead><tr><th colspan='2'>Addresses for Account '".$account."'</th></tr></thead>";
foreach ($nmc->getaddressesbyaccount($account) as $address)
{
$address_label = $myaddress_arr[$address];
echo "<tr><td>" . $address . "</td>
<td>" . $address_label . "</td>
<td><a data-id='".$address."' data-name='".$address_label."' data-toggle='modal' href='#EditAddrDialog' class='open-EditAddrDialog btn btn-mini'>Edit</a></td></tr>";
}
echo "</table>";
</div>
<div class=\"col-sm-2\">
<input class='btn btn-default form-control' type='submit' value='View addresses' />
</div>
<div class=\"col-sm-2\">
<input class='btn btn-default form-control' name='addaddr' type='submit' value='Add address' />
</div>
</div>
</form><br>";

$account = isset($_POST['account'])?$_POST['account']:'';

if(!empty($account)){
echo "<table class='table-striped table-bordered table-condensed table'>
<thead><tr><th >Addresses for Account '".$account."'</th><th>Label</th></tr></thead>";
foreach ($nmc->getaddressesbyaccount($account) as $address)
{
$address_label = $myaddress_arr[$address];
echo "<tr><td>" . $address . "</td>
<td>" . $address_label . "</td>
<td><a data-id='".$address."' data-name='".$address_label."' data-toggle='modal' href='#EditAddrDialog' class='open-EditAddrDialog btn btn-mini'>Edit</a></td></tr>";
}
echo "</table>";
}
?>


<form action='address.php' method='POST'>
<!-- Modal --->
<div id="EditAddrDialog" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="myModalLabel">Change Address Name</h3>
</div>
<div class="modal-body">
<table><tr>
<td><div id="myAddress">Address to change</div></td>
<td>&nbsp; &nbsp;<input type="text" name="AddrName" id="AddrName" value="Name"/></td>
</tr></table>
<input type="hidden" name="myAddress" id="myAddress" value="Nothing"/>
<input type="hidden" name="account" id="account" value="<?php echo $account ?>"/>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">Close</button>
<button class="btn btn-primary">Save Changes</button>
</div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3 id="myModalLabel">Change Address Name</h3>
</div>
<div class="modal-body">
<table><tr>
<td><div id="myAddress">Address to change</div></td>
<td><input class="form-control" type="text" name="AddrName" id="AddrName" value="Name"/></td>
</tr></table>
<input type="hidden" name="myAddress" id="myAddress" value="Nothing"/>
<input type="hidden" name="account" id="account" value="<?php echo $account ?>"/>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Close</button>
<button class="btn btn-primary">Save Changes</button>
</div>
</div>
</form>
<?php
Expand Down
6 changes: 3 additions & 3 deletions addressbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
</thead>
<tbody>
<tr>
<td><input type="text" name="name" /></td>
<td><input type="text" name="address" /></td>
<td><input type="submit" value="Add new address" /></td>
<td><input class="form-control" type="text" name="name" /></td>
<td><input class="form-control" type="text" name="address" /></td>
<td><input class="btn btn-default" type="submit" value="Add new address" /></td>
</tr>
<?php

Expand Down
32 changes: 21 additions & 11 deletions btc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,28 @@
* @license PUBLIC DOMAIN http://unlicense.org
* @package +Coin - Bitcoin & forks Web Interface
*/
ini_set("display_errors", false);
include ("header.php");
$trans = $nmc->listtransactions('*', 100);
$x = array_reverse($trans);
$bal = $nmc->getbalance("*", 6);
$bal3 = $nmc->getbalance("*", 0);
$bal2 = $bal - $bal3;

include ("header.php");
$trans = $nmc->listtransactions('*', 100);
$x = array_reverse($trans);
$bal = $nmc->getbalance("*", 6);
$bal3 = $nmc->getbalance("*", 0);
$bal2 = $bal - $bal3;
echo "<div class='content'>
<div class='span5'>
<h1>Current Balance: <font color='green'>{$bal}</font></h1>
<h2>Unconfirmed Balance: <font color='red'>{$bal2}</font></h2>
</div><div class='span5'><a href='?orphan=1'>View Orphans</a><br /><a href='btc.php'>Go back</a></div>
<div class=\"row\">
<div class='col-sm-6'>
<h1>Current Balance: <font color='green'>{$bal}</font></h1>
<h2>Unconfirmed Balance: <font color='red'>{$bal2}</font></h2>
</div>
<div class='col-sm-6'>";

if(isset($_GET['orphan']))
echo '<a class="btn btn-link" href="btc.php">Go back</a>';
else
echo '<a class="btn btn-link" href="?orphan=1">View Orphans</a>';

echo"</div>
</div>
<table class='table-striped table-bordered table'>
<thead><tr><th>Method</th><th>Address</th><th>Name</th><th>Account</th><th>Amount</th><th>Confirmations</th><th>Time</th></tr></thead>";

Expand Down
46 changes: 17 additions & 29 deletions config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* @author Chris S - AKA Someguy123
* @version 0.01 (ALPHA!)
Expand All @@ -11,34 +10,23 @@
*
*/

session_start();
$wallets = array();

$wallets['wallet 1'] = array("user" => "bitcoinrpc",
"pass" => "password",
"host" => "hostname",
"port" => 8332,
"protocol" => "https");
/*
$wallets['wallet 2'] = array("user" => "username",
"pass" => "password",
"host" => "localhost",
"port" => 5000,
"protocol" => "https");
*/

if (isset($_POST['currentWallet']))
$_SESSION['currentWallet'] = $_POST['currentWallet'];

if (isset($_SESSION['currentWallet']))
$currentWallet = $_SESSION['currentWallet'];
else
{
$keys = array_keys($wallets);
$currentWallet = $keys[0];
$_SESSION['currentWallet'] = $currentWallet;
}
$wallets = array();

$nmcu = $wallets[$currentWallet];
$wallets['wallet 1'] = array(
"user" => "bitcoinrpc",
"pass" => "password",
"host" => "hostname",
"port" => 8332,
"protocol" => "https"
);

/*
$wallets['wallet 2'] = array(
"user" => "username",
"pass" => "password",
"host" => "localhost",
"port" => 5000,
"protocol" => "https"
);
*/
?>
Loading

0 comments on commit e7884f7

Please sign in to comment.