';
+ }
$pg .= makeForm('settings');
$pg .= '';
@@ -101,11 +104,14 @@ function dosettings($data, $user)
$check = true;
break;
case 'Address':
- $addr = getparam('baddr', false);
- $addrarr = array(array('addr' => $addr));
- $pass = getparam('pass', false);
- $ans = userSettings($user, null, $addrarr, $pass);
- $check = true;
+ if (!isset($data['info']['u_multiaddr']))
+ {
+ $addr = getparam('baddr', false);
+ $addrarr = array(array('addr' => $addr));
+ $pass = getparam('pass', false);
+ $ans = userSettings($user, null, $addrarr, $pass);
+ $check = true;
+ }
break;
case 'Password':
$oldpass = getparam('oldpass', false);
@@ -149,9 +155,9 @@ function dosettings($data, $user)
return $pg;
}
#
-function show_settings($page, $menu, $name, $user)
+function show_settings($info, $page, $menu, $name, $user)
{
- gopage(NULL, 'dosettings', $page, $menu, $name, $user);
+ gopage($info, NULL, 'dosettings', $page, $menu, $name, $user);
}
#
?>
diff --git a/pool/page_stats.php b/pool/page_stats.php
index 203de795..90768813 100644
--- a/pool/page_stats.php
+++ b/pool/page_stats.php
@@ -99,9 +99,9 @@ function dostats($data, $user)
return $pg;
}
#
-function show_stats($page, $menu, $name, $user)
+function show_stats($info, $page, $menu, $name, $user)
{
- gopage(NULL, 'dostats', $page, $menu, $name, $user);
+ gopage($info, NULL, 'dostats', $page, $menu, $name, $user);
}
#
?>
diff --git a/pool/page_userset.php b/pool/page_userset.php
index 9764fa5f..ae4b382c 100644
--- a/pool/page_userset.php
+++ b/pool/page_userset.php
@@ -92,9 +92,9 @@ function douserset($data, $user)
return $pg;
}
#
-function show_userset($page, $menu, $name, $user)
+function show_userset($info, $page, $menu, $name, $user)
{
- gopage(NULL, 'douserset', $page, $menu, $name, $user);
+ gopage($info, NULL, 'douserset', $page, $menu, $name, $user);
}
#
?>
diff --git a/pool/page_workers.php b/pool/page_workers.php
index 938aee9a..dcbfa46c 100644
--- a/pool/page_workers.php
+++ b/pool/page_workers.php
@@ -188,9 +188,9 @@ function doworkers($data, $user)
return $pg;
}
#
-function show_workers($page, $menu, $name, $user)
+function show_workers($info, $page, $menu, $name, $user)
{
- gopage(NULL, 'doworkers', $page, $menu, $name, $user);
+ gopage($info, NULL, 'doworkers', $page, $menu, $name, $user);
}
#
?>
diff --git a/pool/page_workmgt.php b/pool/page_workmgt.php
index 4cea1569..e7ad249a 100644
--- a/pool/page_workmgt.php
+++ b/pool/page_workmgt.php
@@ -86,9 +86,9 @@ function doworkmgt($data, $user)
return $pg;
}
#
-function show_workmgt($page, $menu, $name, $user)
+function show_workmgt($info, $page, $menu, $name, $user)
{
- gopage(NULL, 'doworkmgt', $page, $menu, $name, $user);
+ gopage($info, NULL, 'doworkmgt', $page, $menu, $name, $user);
}
#
?>
diff --git a/pool/prime.php b/pool/prime.php
index c50c69f7..af2bf796 100644
--- a/pool/prime.php
+++ b/pool/prime.php
@@ -8,6 +8,12 @@ include_once('base.php');
#
function process($p, $user, $menu)
{
+ $info = homeInfo($user);
+ if (is_array($info) && isset($info['u_multiaddr']))
+ {
+ if (isset($menu['Account']))
+ $menu['Account']['Addresses'] = 'addrmgt';
+ }
if ($user == 'Kano' || $user == 'ckolivas' || $user == 'wvr2' || $user == 'aphorise')
{
$menu['Admin']['ckp'] = 'ckp';
@@ -26,9 +32,9 @@ function process($p, $user, $menu)
}
if ($page === '')
- showPage('index', $menu, '', $user);
+ showPage($info, 'index', $menu, '', $user);
else
- showPage($page, $menu, $n, $user);
+ showPage($info, $page, $menu, $n, $user);
}
#
function def_menu()
@@ -80,11 +86,11 @@ function check()
{
$p = getparam('k', true);
if ($p == 'reset')
- showPage('reset', $dmenu, '', $who);
+ showPage(NULL, 'reset', $dmenu, '', $who);
else
{
if (requestRegister() == true)
- showPage('reg', $dmenu, '', $who);
+ showPage(NULL, 'reg', $dmenu, '', $who);
else
{
$p = getparam('k', true);
diff --git a/src/ckdb.h b/src/ckdb.h
index f656b522..3f28e06d 100644
--- a/src/ckdb.h
+++ b/src/ckdb.h
@@ -52,7 +52,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.9.6"
-#define CKDB_VERSION DB_VERSION"-0.741"
+#define CKDB_VERSION DB_VERSION"-0.742"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c
index 4b591683..9d1b1ee4 100644
--- a/src/ckdb_cmd.c
+++ b/src/ckdb_cmd.c
@@ -163,11 +163,11 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id,
{
K_ITEM *i_username, *i_passwordhash, *i_rows, *i_address, *i_ratio;
K_ITEM *i_email, *u_item, *pa_item;
- char *email;
+ char *email, *address;
char reply[1024] = "";
size_t siz = sizeof(reply);
char tmp[1024];
- PAYMENTADDRESSES *paymentaddresses;
+ PAYMENTADDRESSES *row;
K_STORE *pa_store = NULL;
K_TREE_CTX ctx[1];
USERS *users;
@@ -212,26 +212,24 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id,
K_RLOCK(paymentaddresses_free);
pa_item = find_paymentaddresses(users->userid, ctx);
+ rows = 0;
if (pa_item) {
- DATA_PAYMENTADDRESSES(paymentaddresses, pa_item);
- while (pa_item && CURRENT(&(paymentaddresses->expirydate)) &&
- paymentaddresses->userid == users->userid) {
+ DATA_PAYMENTADDRESSES(row, pa_item);
+ while (pa_item && CURRENT(&(row->expirydate)) &&
+ row->userid == users->userid) {
snprintf(tmp, sizeof(tmp), "addr:%d=%s%c",
- rows, paymentaddresses->payaddress, FLDSEP);
+ rows, row->payaddress, FLDSEP);
APPEND_REALLOC(answer, off, len, tmp);
snprintf(tmp, sizeof(tmp), "ratio:%d=%d%c",
- rows, paymentaddresses->payratio, FLDSEP);
+ rows, row->payratio, FLDSEP);
APPEND_REALLOC(answer, off, len, tmp);
rows++;
pa_item = prev_in_ktree(ctx);
- DATA_PAYMENTADDRESSES_NULL(paymentaddresses, pa_item);
+ DATA_PAYMENTADDRESSES_NULL(row, pa_item);
}
- K_RUNLOCK(paymentaddresses_free);
- } else {
- K_RUNLOCK(paymentaddresses_free);
- rows = 0;
}
+ K_RUNLOCK(paymentaddresses_free);
snprintf(tmp, sizeof(tmp), "rows=%d%cflds=%s%c",
rows, FLDSEP,
@@ -306,12 +304,22 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id,
reason = "Invalid address";
goto struckout;
}
+ address = transfer_data(i_address);
+ pa_item = pa_store->head;
+ while (pa_item) {
+ DATA_PAYMENTADDRESSES(row, pa_item);
+ if (strcmp(row->payaddress, address) == 0) {
+ K_WUNLOCK(paymentaddresses_free);
+ reason = "Duplicate address";
+ goto struckout;
+ }
+ pa_item = pa_item->next;
+ }
pa_item = k_unlink_head(paymentaddresses_free);
- DATA_PAYMENTADDRESSES(paymentaddresses, pa_item);
- bzero(paymentaddresses, sizeof(*paymentaddresses));
- STRNCPY(paymentaddresses->payaddress,
- transfer_data(i_address));
- paymentaddresses->payratio = ratio;
+ DATA_PAYMENTADDRESSES(row, pa_item);
+ bzero(row, sizeof(*row));
+ STRNCPY(row->payaddress, address);
+ row->payratio = ratio;
k_add_head(pa_store, pa_item);
}
K_WUNLOCK(paymentaddresses_free);
@@ -328,8 +336,8 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id,
if (pa_store && pa_store->count > 0) {
pa_item = pa_store->head;
while (pa_item) {
- DATA_PAYMENTADDRESSES(paymentaddresses, pa_item);
- if (!btc_valid_address(paymentaddresses->payaddress)) {
+ DATA_PAYMENTADDRESSES(row, pa_item);
+ if (!btc_valid_address(row->payaddress)) {
reason = "Invalid BTC address";
goto struckout;
}
|