Skip to content

Commit

Permalink
Adding BTS Steem GRC
Browse files Browse the repository at this point in the history
  • Loading branch information
grctest committed Aug 9, 2016
1 parent 0fbfb62 commit b9228a6
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 7 deletions.
24 changes: 24 additions & 0 deletions html/inc/account.inc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,30 @@ function create_account_form($teamid, $next_url) {
);
}

//Bitshares account
if (0) {
row2(
tra("Bitshares account")."<br><p class=\"text-info\">".tra("Optional")."</p>",
"<input type=\"text\" name=\"bitshares_account\" size=\"20\">"
);
}

//STEEM account
if (0) {
row2(
tra("STEEM account")."<br><p class=\"text-info\">".tra("Optional")."</p>",
"<input type=\"text\" name=\"steem_account\" size=\"20\">"
);
}

//Gridcoin address
if (0) {
row2(
tra("Gridcoin Address")."<br><p class=\"text-info\">".tra("Optional")."</p>",
"<input type=\"text\" name=\"gridcoin_address\" size=\"20\">"
);
}

// Check if we're reCaptcha to prevent spam accounts
//
$publickey = parse_config(get_config(), "<recaptcha_public_key>");
Expand Down
3 changes: 3 additions & 0 deletions html/inc/db_ops.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,9 @@ function show_user($user) {
row("OK to send Email?", $user->send_email);
row("Country", $user->country);
row("Postal code", $user->postal_code);
row("Bitshares account", $user->bitshares_account);
row("Steem account", $user->steem_account);
row("Gridcoin address", $user->gridcoin_address);
row("Total credit", $user->total_credit);
row("Average credit", $user->expavg_credit);
row("Last average time", time_str($user->expavg_time));
Expand Down
12 changes: 9 additions & 3 deletions html/inc/user.inc
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ function show_user_info_private($user) {
}
row2(tra("Country"), $user->country);
row2(tra("Postal code"), $user->postal_code);
row2(tra("Bitshares account"), $user->bitshares_account);
row2(tra("Steem account"), $user->steem_account);
row2(tra("Gridcoin address"), $user->gridcoin_address);
row2(tra("%1 member since", PROJECT), date_str($user->create_time));
$url_tokens = url_tokens($user->authenticator);
if (LDAP_HOST && is_ldap_email($user->email_addr)) {
Expand Down Expand Up @@ -552,7 +555,7 @@ function is_valid_user_name($name, &$reason) {
//
function make_user(
$email_addr, $name, $passwd_hash,
$country=null, $postal_code=null, $project_prefs=null, $teamid=0
$country=null, $postal_code=null, $bitshares_account=null, $steem_account=null, $gridcoin_address=null, $project_prefs=null, $teamid=0
) {
if (!is_valid_email_addr($email_addr)) return null;
if (is_banned_email_addr($email_addr)) return null;
Expand All @@ -569,8 +572,11 @@ function make_user(

$country = BoincDb::escape_string($country);
$postal_code = sanitize_tags(BoincDb::escape_string($postal_code));
$bitshares_account = sanitize_tags(BoincDb::escape_string($bitshares_account));
$steem_account = sanitize_tags(BoincDb::escape_string($steem_account));
$gridcoin_address = sanitize_tags(BoincDb::escape_string($gridcoin_address));

$uid = BoincUser::insert("(create_time, email_addr, name, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, project_prefs, teamid, venue, send_email, show_hosts, posts, seti_id, seti_nresults, seti_last_result_time, seti_total_cpu, has_profile, cross_project_id, passwd_hash, email_validated, donated) values($now, '$email_addr', '$name', '$authenticator', '$country', '$postal_code', 0, 0, unix_timestamp(), '$project_prefs', $teamid, '', 1, 1, 0, 0, 0, 0, 0, 0, '$cross_project_id', '$passwd_hash', 0, 0)");
$uid = BoincUser::insert("(create_time, email_addr, name, authenticator, country, postal_code, bitshares_account, steem_account, gridcoin_address, total_credit, expavg_credit, expavg_time, project_prefs, teamid, venue, send_email, show_hosts, posts, seti_id, seti_nresults, seti_last_result_time, seti_total_cpu, has_profile, cross_project_id, passwd_hash, email_validated, donated) values($now, '$email_addr', '$name', '$authenticator', '$country', '$postal_code', 0, 0, unix_timestamp(), '$project_prefs', $teamid, '', 1, 1, 0, 0, 0, 0, 0, 0, '$cross_project_id', '$passwd_hash', 0, 0)");

if (!$uid) {
return null;
Expand All @@ -592,7 +598,7 @@ function make_user_ldap($email_addr, $name) {
$cross_project_id = random_string();
$passwd_hash = random_string();
$now = time();
$uid = BoincUser::insert("(create_time, email_addr, name, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, project_prefs, teamid, send_email, show_hosts, cross_project_id, passwd_hash) values($now, '$email_addr', '$name', '$authenticator', '', '', 0, 0, unix_timestamp(), '', 0, 1, 1, '$cross_project_id', '$passwd_hash')");
$uid = BoincUser::insert("(create_time, email_addr, name, authenticator, country, postal_code, bitshares_account, steem_account, gridcoin_address, total_credit, expavg_credit, expavg_time, project_prefs, teamid, send_email, show_hosts, cross_project_id, passwd_hash) values($now, '$email_addr', '$name', '$authenticator', '', '', 0, 0, unix_timestamp(), '', 0, 1, 1, '$cross_project_id', '$passwd_hash')");

if ($uid) {
return BoincUser::lookup_id($uid);
Expand Down
6 changes: 6 additions & 0 deletions html/inc/xml.inc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ function show_user_xml($user, $show_hosts) {
<create_time>$user->create_time</create_time>
<name>".htmlspecialchars($user->name)."</name>
<country>$user->country</country>
<bitshares_account>$user->bitshares_account</bitshares_account>
<steem_account>$user->steem_account</steem_account>
<gridcoin_address>$user->gridcoin_address</gridcoin_address>
<total_credit>$user->total_credit</total_credit>
<expavg_credit>$user->expavg_credit</expavg_credit>
<expavg_time>$user->expavg_time</expavg_time>
Expand Down Expand Up @@ -135,6 +138,9 @@ function show_team_member($user, $show_email, $creditonly = false) {
echo " <create_time>$user->create_time</create_time>
<name>".htmlspecialchars($user->name)."</name>
<country>$user->country</country>
<bitshares_account>$user->bitshares_account</bitshares_account>
<steem_account>$user->steem_account</steem_account>
<gridcoin_address>$user->gridcoin_address</gridcoin_address>
<expavg_credit>$user->expavg_credit</expavg_credit>
<expavg_time>$user->expavg_time</expavg_time>
<url>".htmlspecialchars($user->url)."</url>
Expand Down
3 changes: 3 additions & 0 deletions html/ops/team_export.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ function handle_team($team, $f) {
<user_name>".escape($user->name)."</user_name>
<user_country>".escape($user->country)."</user_country>
<user_postal_code>".escape($user->postal_code)."</user_postal_code>
<user_bitshares_account>".escape($user->bitshares_account)."</user_bitshares_account>
<user_steem_account>".escape($user->steem_account)."</user_steem_account>
<user_gridcoin_adress>".escape($user->gridcoin_address)."</user_gridcoin_adress>
<user_url>".escape($user->url)."</user_url>
</team>
"
Expand Down
12 changes: 12 additions & 0 deletions html/user/account_finish.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@
tra("Postal or ZIP Code")."<br><p class=\"text-info\">".tra("Optional")."</span>",
"<input name=\"postal_code\" size=\"20\">"
);
row2(
tra("Bitshares account")."<br><p class=\"text-info\">".tra("Optional")."</span>",
"<input name=\"bitshares_account\" size=\"20\">"
);
row2(
tra("Steem account")."<br><p class=\"text-info\">".tra("Optional")."</span>",
"<input name=\"steem_account\" size=\"20\">"
);
row2(
tra("Gridcoin address")."<br><p class=\"text-info\">".tra("Optional")."</span>",
"<input name=\"gridcoin_address\" size=\"20\">"
);
row2("",
"<input class=\"btn btn-primary\" type=\"submit\" value=\"OK\">"
);
Expand Down
8 changes: 7 additions & 1 deletion html/user/account_finish_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@
}
$country = BoincDb::escape_string($country);
$postal_code = BoincDb::escape_string(sanitize_tags(post_str("postal_code", true)));
$bitshares_account = BoincDb::escape_string(sanitize_tags(post_str("bitshares_account", true)));
$steem_account = BoincDb::escape_string(sanitize_tags(post_str("steem_account", true)));
$gridcoin_address = BoincDb::escape_string(sanitize_tags(post_str("gridcoin_address", true)));
$auth = BoincDb::escape_string($auth);

$name = BoincDb::escape_string($name);
$postal_code = BoincDb::escape_string($postal_code);
$bitshares_account = BoincDb::escape_string($bitshares_account);
$steem_account = BoincDb::escape_string($steem_account);
$gridcoin_address = BoincDb::escape_string($gridcoin_address);

$user = BoincUser::lookup("authenticator='$auth'");
if (!$user) {
error_page("no such user");
}
$retval = $user->update("name='$name', country='$country', postal_code='$postal_code'");
$retval = $user->update("name='$name', country='$country', postal_code='$postal_code', bitshares_account='$bitshares_account', steem_account='$steem_account', gridcoin_address='$gridcoin_address'");
if (!$retval) {
error_page("database error");
}
Expand Down
6 changes: 6 additions & 0 deletions html/user/am_get_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
$name = urlencode($user->name);
$country = urlencode($user->country);
$postal_code = urlencode($user->postal_code);
$bitshares_account = urlencode($user->bitshares_account);
$steem_account = urlencode($user->steem_account);
$gridcoin_address = urlencode($user->gridcoin_address);
$url = urlencode($user->url);
$weak_auth = weak_auth($user);
$cpid = md5($user->cross_project_id.$user->email_addr);
Expand All @@ -45,6 +48,9 @@
<country>$country</country>
<weak_auth>$weak_auth</weak_auth>
<postal_code>$postal_code</postal_code>
<bitshares_account>$bitshares_account</bitshares_account>
<steem_account>$steem_account</steem_account>
<gridcoin_address>$gridcoin_address</gridcoin_address>
<cpid>$cpid</cpid>
<has_profile>$user->has_profile</has_profile>
<create_time>$user->create_time</create_time>
Expand Down
19 changes: 19 additions & 0 deletions html/user/am_set_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ function success($x) {
$name = post_str("name", true);
$country = post_str("country", true);
$postal_code = post_str("postal_code", true);
$bitshares_account = post_str("bitshares_account", true);
$steem_account = post_str("steem_account", true);
$gridcoin_address = post_str("gridcoin_address", true);
$global_prefs = post_str("global_prefs", true);
$project_prefs = post_str("project_prefs", true);
$url = post_str("url", true);
Expand All @@ -71,6 +74,9 @@ function success($x) {
$name = get_str("name", true);
$country = get_str("country", true);
$postal_code = get_str("postal_code", true);
$bitshares_account = get_str("bitshares_account", true);
$steem_account = get_str("steem_account", true);
$gridcoin_address = get_str("gridcoin_address", true);
$global_prefs = get_str("global_prefs", true);
$project_prefs = get_str("project_prefs", true);
$url = get_str("url", true);
Expand All @@ -93,6 +99,9 @@ function success($x) {
}
$country = BoincDb::escape_string($country);
$postal_code = BoincDb::escape_string($postal_code);
$bitshares_account = BoincDb::escape_string($bitshares_account);
$steem_account = BoincDb::escape_string($steem_account);
$gridcoin_address = BoincDb::escape_string($gridcoin_address);
$global_prefs = BoincDb::escape_string($global_prefs);
$project_prefs = BoincDb::escape_string($project_prefs);

Expand Down Expand Up @@ -131,6 +140,16 @@ function success($x) {
if ($postal_code) {
$query .= " postal_code='$postal_code', ";
}
if ($bitshares_account) {
$query .= " bitshares_account='$bitshares_account', ";
}
if ($steem_account) {
$query .= " steem_account='$steem_account', ";
}
if ($gridcoin_address) {
$query .= " gridcoin_address='$gridcoin_address', ";
}

if ($global_prefs) {
$global_prefs = str_replace("\\r\\n", "\n", $global_prefs);
$x = bad_xml($global_prefs, "<global_preferences>", "</global_preferences>");
Expand Down
5 changes: 4 additions & 1 deletion html/user/create_account_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ function show_error($str) {
}

$postal_code = sanitize_tags(post_str("postal_code", true));
$bitshares_account = sanitize_tags(post_str("bitshares_account", true));
$steem_account = sanitize_tags(post_str("steem_account", true));
$gridcoin_address = sanitize_tags(post_str("gridcoin_address", true));

$user = make_user(
$new_email_addr, $new_name, $passwd_hash,
$country, $postal_code, $project_prefs, $teamid
$country, $postal_code, $bitshares_account, $steem_account, $gridcoin_address, $project_prefs, $teamid
);
if (!$user) {
show_error(tra("Couldn't create account"));
Expand Down
2 changes: 1 addition & 1 deletion html/user/delete_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

function delete_account($user) {
$x = "deleted_".time()."_".random_string();
$retval = $user->update("email_addr='$x', authenticator='$x', name='', country='', postal_code='', has_profile=0");
$retval = $user->update("email_addr='$x', authenticator='$x', name='', country='', postal_code='', bitshares_account='', steem_account='', gridcoin_address='', has_profile=0");
if (!$retval) return false;
user_quit_team($user);
forum_delete_user($user);
Expand Down
8 changes: 7 additions & 1 deletion html/user/edit_user_info_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@
}
$country = BoincDb::escape_string($country);
$postal_code = sanitize_tags(post_str("postal_code", true));
$bitshares_account = sanitize_tags(post_str("bitshares_account", true));
$steem_account = sanitize_tags(post_str("steem_account", true));
$gridcoin_address = sanitize_tags(post_str("gridcoin_address", true));

$name = BoincDb::escape_string($name);
$url = BoincDb::escape_string($url);
$postal_code = BoincDb::escape_string($postal_code);
$bitshares_account = BoincDb::escape_string($bitshares_account);
$steem_account = BoincDb::escape_string($steem_account);
$gridcoin_address = BoincDb::escape_string($gridcoin_address);

$result = $user->update(
"name='$name', url='$url', country='$country', postal_code='$postal_code'"
"name='$name', url='$url', country='$country', postal_code='$postal_code', bitshares_account='$bitshares_account', steem_account='$steem_account', gridcoin_address='$gridcoin_address'"
);
if ($result) {
Header("Location: home.php");
Expand Down
9 changes: 9 additions & 0 deletions html/user/edit_user_info_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
row2(tra("Postal (ZIP) code %1 Optional%2", "<br><p class=\"text-muted\">", "</p>"),
"<input name=postal_code type=text size=20 value='$user->postal_code'>"
);
row2(tra("Bitshares account %1 Optional%2", "<br><p class=\"text-muted\">", "</p>"),
"<input name=bitshares_account type=text size=20 value='$user->bitshares_account'>"
);
row2(tra("Steem account %1 Optional%2", "<br><p class=\"text-muted\">", "</p>"),
"<input name=steem_account type=text size=20 value='$user->steem_account'>"
);
row2(tra("Gridcoin address %1 Optional%2", "<br><p class=\"text-muted\">", "</p>"),
"<input name=gridcoin_address type=text size=20 value='$user->gridcoin_address'>"
);

row2("", "<input class=\"btn btn-default\" type=submit value='".tra("Update info")."'>");
end_table();
Expand Down

0 comments on commit b9228a6

Please sign in to comment.