Exemplo n.º 1
0
                DB::update('coin_sends', array('status' => 'sent', 'txid' => $txid), "id = %d", $_POST['send_id']);
                $send_id = $_POST['send_id'];
            } else {
                $client = new transaction();
                $send_id = $client->add_send($_POST['wallet_id'], 'sent', $_POST['note'], $txid, $outputs);
            }
            // Send notifications
            send_notifications('funds_sent', $send_id);
            // Execute hooks
            execute_hooks('funds_sent', $send_id);
            // User message
            $this->add_message("Successfully processed send and broadcast transaction, TxID {$txid}");
            // Offline send
        } else {
            $client = new transaction();
            $client->add_send($_POST['wallet_id'], 'pending', $_POST['note'], '', $outputs);
            $template->add_message("Successfully queued new send.  You may download the appropriate JSON for offline signing via the Pending Sends tab.");
        }
    }
    // Download JSON file
} elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Download JSON File')) {
    // Initialize
    $bip32 = new bip32();
    $encrypt = new encrypt();
    // Set variables
    $testnet = TESTNET == 1 ? true : false;
    $json = array('testnet' => $testnet, 'inputs' => array(), 'outputs' => array());
    $send_amount = DB::queryFirstField("SELECT sum(amount) FROM coin_sends WHERE status = 'pending'");
    // Get wallet row
    if (!($wrow = DB::queryFirstRow("SELECT * FROM coin_wallets WHERE id = %d", $_POST['pending_wallet_id']))) {
        trigger_error("Wallet does not exist, ID# {$_POST['pending_wallet_id']}", E_USER_ERROR);