/** * @param $keytype e.g. 'blockchain', 'mtgox', 'notification', ... */ function can_user_add($user, $keytype, $amount = 1) { $summary = user_limits_summary($user['id']); $data = get_account_data($keytype); $current_total = $summary['total_' . $data['group']]; $limit = get_premium_value($user, $data['group']); return $current_total + $amount <= $limit; throw new Exception("Could not find user limit type '{$keytype}'"); }
<?php /** * This page is the second page in a series of wizards to configure a user account. * A user may revisit this page at any time to reconfigure their account. * This page allows the user to select which kind of accounts to add. */ require_login(); require __DIR__ . "/../layout/templates.php"; page_header(t("Add Accounts and Addresses"), "page_wizard_accounts", array('js' => 'wizard', 'class' => 'page_accounts')); $user = get_user(user_id()); require_user($user); $messages = array(); // get all of our accounts $accounts = user_limits_summary(user_id()); // get our offset values require __DIR__ . "/../graphs/util.php"; $summaries = get_all_summary_currencies(); $currencies = get_all_currencies(); require_template("wizard_accounts"); ?> <div class="wizard"> <ul class="account-type"> <li><a href="<?php echo htmlspecialchars(url_for('wizard_accounts_addresses')); ?> "><?php echo t("Address");