Browse Source

ckdb/php - display account messages at the top of the page

master
kanoi 10 years ago
parent
commit
9b1f76e5c4
  1. 11
      pool/page.php
  2. 5
      src/ckdb.h
  3. 28
      src/ckdb_cmd.c

11
pool/page.php

@ -88,6 +88,8 @@ function pghead($script_marker, $name)
$head .= "<html><head><title>$page_title$name</title>";
$head .= "<meta content='text/html; charset=iso-8859-1' http-equiv='Content-Type'>";
$head .= "<meta content='IE=edge' http-equiv='X-UA-Compatible'>";
$head .= "<meta content='width=device-width, initial-scale=1' name='viewport'>";
$head .= "<script type='text/javascript'>\n";
$head .= "function jst(){document.getElementById('jst').style.visibility='hidden';}\n";
@ -95,9 +97,10 @@ function pghead($script_marker, $name)
$head .= "<style type='text/css'>
form {display: inline-block;}
html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eff; text-align: center; background-repeat: no-repeat; background-position: center; }
html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eeffff; text-align: center; background-repeat: no-repeat; background-position: center;}
.page {min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -50px; position: relative;}
div.jst {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;}
div.accwarn {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;}
div.topd {background-color:#cff; border-color: #cff; border-style: solid; border-width: 9px;}
.topdes {color:blue; text-align: right;}
.topwho {color:black; font-weight: bold; margin-right: 8px;}
@ -271,6 +274,12 @@ function pgtop($info, $dotop, $user, $douser)
$top = "<div class=jst id=jst>&nbsp;Javascript isn't enabled.";
$top .= " You need to enable javascript to use";
$top .= " the $site_title web site.</div>";
if (isset($info['u_nopayaddr']))
$top .= '<div class=accwarn>Please set a payout address on your account!</div>';
if (isset($info['u_noemail']))
$top .= '<div class=accwarn>Please set an email address on your account!</div>';
$top .= '<div class=topd>';
if ($dotop === true)
{

5
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.9.6"
#define CKDB_VERSION DB_VERSION"-0.740"
#define CKDB_VERSION DB_VERSION"-0.741"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -709,6 +709,9 @@ extern K_TREE *useratts_root;
extern K_LIST *useratts_free;
extern K_STORE *useratts_store;
// This att means the user uses multiple % based payout addresses
#define USER_MULTI_PAYOUT "PayAddresses"
// WORKERS
typedef struct workers {
int64_t workerid;

28
src/ckdb_cmd.c

@ -2134,6 +2134,7 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
__maybe_unused tv_t *notcd, K_TREE *trf_root)
{
K_ITEM *i_username, *u_item, *b_item, *p_item, *us_item, look;
K_ITEM *ua_item, *pa_item;
double u_hashrate5m, u_hashrate1hr;
char reply[1024], tmp[1024], *buf;
size_t siz = sizeof(reply);
@ -2274,9 +2275,34 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
K_RUNLOCK(users_free);
}
// User info to add to or affect the web site display
if (u_item) {
DATA_USERS(users, u_item);
K_RLOCK(useratts_free);
ua_item = find_useratts(users->userid, USER_MULTI_PAYOUT);
K_RUNLOCK(useratts_free);
if (ua_item) {
snprintf(tmp, sizeof(tmp),
"u_multiaddr=1%c", FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
if (!(*(users->emailaddress))) {
snprintf(tmp, sizeof(tmp),
"u_noemail=1%c", FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
K_RLOCK(paymentaddresses_free);
pa_item = find_paymentaddresses(users->userid, ctx);
K_RUNLOCK(paymentaddresses_free);
if (!pa_item) {
snprintf(tmp, sizeof(tmp),
"u_nopayaddr=1%c", FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
}
has_uhr = false;
if (p_item && u_item) {
DATA_USERS(users, u_item);
K_TREE *userstats_workername_root = new_ktree();
u_hashrate5m = u_hashrate1hr = 0.0;
u_elapsed = -1;

Loading…
Cancel
Save