/**
 * 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 offsets to add.
 */
require_login();
require __DIR__ . "/../graphs/util.php";
require __DIR__ . "/../layout/templates.php";
page_header(t("Add Offsets"), "page_wizard_accounts_offsets", array('js' => array('accounts', 'wizard'), 'class' => 'page_accounts wizard_page'));
global $user;
$user = get_user(user_id());
require_user($user);
$messages = array();
global $account_type;
$account_type = get_wizard_account_type('offsets');
require_template("wizard_accounts_offsets");
?>

<div class="wizard">

<?php 
require __DIR__ . "/_wizard_accounts.php";
?>

<div class="wizard-buttons">
<a class="button" href="<?php 
echo htmlspecialchars(url_for('wizard_accounts'));
?>
"><?php 
echo ht("< Previous");
Ejemplo n.º 2
0
<?php

/**
 * Goes through a users' accounts and identifies which accounts might need automatic transaction
 * generation deleted.
 */
// create a map of all the current user exchanges
$accounts = account_data_grouped();
$current_accounts = array();
foreach ($accounts as $label => $accounts_data) {
    foreach ($accounts_data as $exchange => $account) {
        if (!isset($account['wizard'])) {
            continue;
        }
        $wizard = get_wizard_account_type($account['wizard']);
        if (!$wizard['transaction_creation']) {
            continue;
        }
        $q = db()->prepare("SELECT * FROM " . $account['table'] . " WHERE user_id=?" . (isset($account['query']) ? $account['query'] : false));
        $q->execute(array($job['user_id']));
        while ($a = $q->fetch()) {
            $a['exchange'] = $exchange;
            $current_accounts[$exchange . " " . $a['id']] = $a;
        }
    }
}
crypto_log("User " . $job['user_id'] . " has " . count($current_accounts) . " accounts to parse.");
// are there any creators that need to be deleted for this user?
$q = db()->prepare("SELECT * FROM transaction_creators WHERE user_id=?");
$q->execute(array($job['user_id']));
$to_delete = array();
 * Callback for Ajax to update wizard table for manual testing.
 */
require __DIR__ . "/../layout/templates.php";
$user = get_user(user_id());
require_user($user);
$exchange = require_get('exchange');
$id = require_get('id');
// make sure that we actually have a valid account
$account_data = false;
$accounts = array();
foreach (account_data_grouped() as $label => $data) {
    foreach ($data as $key => $value) {
        if ($key == $exchange) {
            // we've found a valid account type
            $account_data = get_accounts_wizard_config($key);
            $account_type = get_wizard_account_type($value['wizard']);
            $add_types[] = $key;
            $add_type_names[$key] = get_exchange_name($key) . (isset($value['suffix']) ? $value['suffix'] : "");
            $q = db()->prepare("SELECT * FROM " . $account_data['table'] . "\n        WHERE user_id=? AND id=? ORDER BY title ASC");
            $q->execute(array(user_id(), $id));
            while ($r = $q->fetch()) {
                $r['exchange'] = $key;
                $r['khash'] = $account_data['khash'];
                $accounts[] = $r;
            }
        }
    }
}
if (!$account_data) {
    throw new Exception("No account data found for exchange '" . htmlspecialchars($exchange) . "'");
}
Ejemplo n.º 4
0
        // redirect to GET
        set_temporary_messages($messages);
        redirect(url_for(require_post("callback")));
    }
}
// process extra field inline edit
if (require_post("key", false) !== false && require_post("id", false)) {
    $id = require_post("id");
    $key = require_post("key");
    $value = require_post("value");
    $exchange = require_post("type");
    // check that this is a valid property to change for this wizard
    if (!isset($account_data['wizard'])) {
        throw new Exception("No wizard data found");
    }
    $wizard_type = get_wizard_account_type($account_data['wizard']);
    if (!isset($wizard_type['display_editable'][$key])) {
        throw new Exception("Key '" . htmlspecialchars($key) . "' is not a valid editable key");
    }
    // check that this is a valid input for this key
    $config = get_accounts_wizard_config($exchange);
    if (!isset($config['inputs'][$key])) {
        throw new Exception("A '" . htmlspecialchars($exchange) . "' does not have an input '" . htmlspecialchars($key) . "'");
    }
    if (isset($config['inputs'][$key]['number']) && $config['inputs'][$key]['number']) {
        // remove any commas
        $value = number_unformat($value);
    }
    $callback = $config['inputs'][$key]['callback'];
    if (!$callback($value)) {
        $errors[] = t("':value' is not a valid :title :label.", array(':value' => htmlspecialchars($value), ':title' => htmlspecialchars($account_data['title']), ':label' => htmlspecialchars($config['inputs'][$key]['title'])));
/**
 * 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__ . "/../graphs/util.php";
require __DIR__ . "/../layout/templates.php";
page_header(t("Add Exchanges"), "page_wizard_accounts_exchanges", array('js' => array('accounts', 'wizard'), 'class' => 'page_accounts wizard_page'));
global $user;
$user = get_user(user_id());
require_user($user);
$messages = array();
global $account_type;
$account_type = get_wizard_account_type('exchanges');
require_template("wizard_accounts_exchanges");
?>

<div class="wizard">

<?php 
require __DIR__ . "/_wizard_accounts.php";
?>

<div class="wizard-buttons">
<a class="button" href="<?php 
echo htmlspecialchars(url_for('wizard_accounts'));
?>
"><?php 
echo ht("< Previous");
 * 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__ . "/../graphs/util.php";
require __DIR__ . "/../layout/templates.php";
page_header(t("Add Securities Exchanges"), "page_wizard_accounts_securities", array('js' => array('accounts', 'wizard'), 'class' => 'page_accounts wizard_page'));
global $user;
$user = get_user(user_id());
require_user($user);
$messages = array();
// get all of our accounts
global $accounts;
$accounts = user_limits_summary(user_id());
global $account_type;
$account_type = get_wizard_account_type('securities');
require_template("wizard_accounts_securities");
?>

<div class="wizard">

<?php 
require __DIR__ . "/_wizard_accounts.php";
?>

<div class="wizard-buttons">
<a class="button" href="<?php 
echo htmlspecialchars(url_for('wizard_accounts'));
?>
"><?php 
echo ht("< Previous");
Ejemplo n.º 7
0
/**
 * 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__ . "/../graphs/util.php";
require __DIR__ . "/../layout/templates.php";
page_header(t("Add Mining Pools"), "page_wizard_accounts_pools", array('js' => array('accounts', 'wizard'), 'class' => 'page_accounts wizard_page'));
global $user;
$user = get_user(user_id());
require_user($user);
$messages = array();
global $account_type;
$account_type = get_wizard_account_type('pools');
require_template("wizard_accounts_pools");
?>

<div class="wizard">

<?php 
require __DIR__ . "/_wizard_accounts.php";
?>

<div class="wizard-buttons">
<a class="button" href="<?php 
echo htmlspecialchars(url_for('wizard_accounts'));
?>
"><?php 
echo ht("< Previous");
Ejemplo n.º 8
0
/**
 * 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__ . "/../graphs/util.php";
require __DIR__ . "/../layout/templates.php";
page_header(t("Add Other Account"), "page_wizard_accounts_other", array('js' => array('accounts', 'wizard'), 'class' => 'page_accounts wizard_page'));
global $user;
$user = get_user(user_id());
require_user($user);
$messages = array();
global $account_type;
$account_type = get_wizard_account_type('other');
require_template("wizard_accounts_other");
?>

<div class="wizard">

<?php 
require __DIR__ . "/_wizard_accounts.php";
?>

<div class="wizard-buttons">
<a class="button" href="<?php 
echo htmlspecialchars(url_for('wizard_accounts'));
?>
"><?php 
echo ht("< Previous");
 * 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__ . "/../graphs/util.php";
require __DIR__ . "/../layout/templates.php";
page_header(t("Add Individual Securities"), "page_wizard_accounts_individual_securities", array('js' => array('accounts', 'wizard'), 'class' => 'page_accounts wizard_page'));
global $user;
$user = get_user(user_id());
require_user($user);
$messages = array();
// get all of our accounts
global $accounts;
$accounts = user_limits_summary(user_id());
global $account_type;
$account_type = get_wizard_account_type('individual');
require_template("wizard_accounts_individual_securities");
?>

<div class="wizard">

<?php 
require __DIR__ . "/_wizard_accounts.php";
?>

<div class="wizard-buttons">
<a class="button" href="<?php 
echo htmlspecialchars(url_for('wizard_accounts'));
?>
"><?php 
echo ht("< Previous");