DB::insert('coin_wallets_keys', array('wallet_id' => $wallet_id, 'public_key' => $enc_client->encrypt($public_key))); } // User message if ($_POST['autogen_keys'] == 1) { $template = new template('admin/setup/bip32_keys'); $template->assign('keys', $keys); $template->parse(); exit(0); } else { $template->add_message("Successfully added new wallet, {$_POST['wallet_name']}"); } } // Delete checked wallets } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Delete Checked Wallets')) { // Go through wallets $ids = get_chk('wallet_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } // Check for unspent inputs $count = DB::queryFirstField("SELECT count(*) FROM coin_inputs WHERE wallet_id = %d AND is_spent = 0", $id); if ($count > 0) { $template->add_message("Unable to delete wallet ID# {$id}, as it has unspent inputs. Please transfer the wallet first via the Financial->Transfer Wallet menu.", 'error'); } else { DB::query("DELETE FROM coin_wallets WHERE id = %d", $id); } } // User message if ($template->has_errors != 1) { $template->add_message("Successfully deleted all checked wallets.");
// Send headers header("Content-disposition: attachment; filename=\"{$filename}\""); header("Content-type: application/x-www-form-urlencoded"); // Download file echo file_get_contents(SITH_PATH . '/data/backups/' . $filename); exit(0); // Add profile field } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Add Profile Field')) { // Add to db DB::insert('users_custom_fields', array('form_field' => $_POST['profile_field_form_field'], 'display_name' => $_POST['profile_field_name'], 'options' => $_POST['profile_field_options'])); // User message $template->add_message("Successfully added new profile field, {$_POST['profile_field_name']}"); // Delete profile fields } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Delete Checked Fields')) { // Delete $ids = get_chk('custom_field_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("DELETE FROM users_custom_fields WHERE id = %d", $id); } // User message $template->add_message("Successfully deleted checked profile fields."); } // Define currencies $currencies = array('USD' => 'United States Dollar', 'EUR' => 'Euro', 'CNY' => 'Chinese Yuan', 'CAD' => 'Canadian Dollar', 'RUB' => 'Russian Ruble'); // Currency options $currency_options = ''; foreach ($currencies as $abbr => $name) { $chk = $abbr == $config['currency'] ? 'selected="selected"' : '';
// Perform checks if ($_POST['amount'] == '') { $template->add_message("You did not specify a product amount.", 'error'); } elseif (!is_numeric($_POST['amount'])) { $template->add_message("Invalid product amount specified.", 'error'); } elseif ($_POST['amount'] < 0) { $template->add_message("Invalid product amount specified.", 'error'); } if ($_POST['product_name'] == '') { $template->add_message("You did not specify a product name", 'error'); } // Add product, if needed if ($template->has_errors != 1) { $client = new product(); $client->add_product($_POST['amount'], $_POST['currency'], $_POST['product_name'], $_POST['description']); $template->add_message("Successfully created new product, {$_POST['product_name']}."); } // Delete checked products } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Delete Checked Products')) { // Get IDs $ids = get_chk('product_id'); // Disable foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("UPDATE products SET is_enabled = 0 WHERE id = %d", $id); } // User message $template->add_message("Successfully deleted checked products."); }
} // Generate payment address $address = $bip32->generate_address($_POST['wallet_id'], $user_row['id']); DB::query("UPDATE coin_addresses SET is_used = 1 WHERE address = %s", $address); // Add new invoice DB::insert('invoices', array('wallet_id' => $_POST['wallet_id'], 'userid' => $user_row['id'], 'currency' => $_POST['currency'], 'amount' => $amount, 'amount_btc' => $amount_btc, 'payment_address' => $address, 'note' => $_POST['note'], 'process_note' => '')); $invoice_id = DB::insertId(); // Send notifications send_notifications('invoice_created', $invoice_id); // User message $template->add_message("Successfully generated a new pending invoice for user, {$_POST['username']}"); } // Process invoices } elseif (isset($_POST['submit']) && $_POST['submit'] == 'Process Checked Invoices') { // Process $ids = get_chk('invoice_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::update('invoices', array('status' => $_POST['status'], 'date_paid' => DB::sqleval('now()'), 'process_note' => $_POST['note']), "id = %d", $id); } // User message $template->add_message("Successfully processed all checked invoices, and marked them as <b>{$_POST['status']}</b>."); // Update invoice details } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Update Invoice Details')) { // Get userid if (!($user_row = DB::queryFirstRow("SELECT * FROM users WHERE username = %s", $_POST['username']))) { $template->add_message("Username does not exist, {$_POST['username']}", 'error'); } // Perform checks
<?php // Initialize global $template; // Clear all if (isset($_GET['clearall']) && $_GET['clearall'] == 1) { DB::query("DELETE FROM alerts WHERE userid = %d", $GLOBALS['userid']); $template->add_message('Successfully cleared all alerts'); // Clear checked } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear Checked Alerts')) { $ids = get_chk('alert_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("DELETE FROM alerts WHERE id = %d", $id); } $template->add_message('Successfully deleted all checked alerts.'); // Clear all deposit } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear All Deposit Alerts')) { DB::query("DELETE FROM alerts WHERE type = 'new_deposit' AND userid = %d", $GLOBALS['userid']); // Clear all user } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear All User Alerts')) { DB::query("DELETE FROM alerts WHERE type = 'new_user' AND userid = %d", $GLOBALS['userid']); // Clear all product } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear All Product Alerts')) { DB::query("DELETE FROM alerts WHERE type = 'product_purchase' AND userid = %d", $GLOBALS['userid']); // Clear all invoice } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear All Invoice Alerts')) { DB::query("DELETE FROM alerts WHERE type = 'invoice_paid' AND userid = %d", $GLOBALS['userid']); }
// Clear checked overpayments } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear Checked Overpayments')) { // Clear overpayments $ids = get_chk('overpayment_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("DELETE FROM coin_overpayments WHERE id = %d", $id); } $template->add_message('Successfully cleared all checked overpayments.'); // Clear all overpayments } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear All Overpayments')) { DB::query("DELETE FROM coin_overpayments"); $template->add_message('Successfully cleared all overpayments.'); // Clear checked unauthorized sends } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear Checked Unauthorized Sends')) { // Clear overpayments $ids = get_chk('unauthroized_send_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("DELETE FROM coin_unauthorized_sends WHERE id = %d", $id); } $template->add_message('Successfully cleared all checked unauthorized sends.'); // Clear all unauthorized sends } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Clear All Unauthorized Sends')) { DB::query("DELETE FROM coin_unauthorized_sends"); $template->add_message('Successfully cleared all unauthorized sends.'); }
<?php // Initialize global $template; // Change status if (isset($_POST['submit']) && $_POST['submit'] == tr('Change Status of Checked Notifications')) { // Change $ids = get_chk('notification_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("UPDATE notifications SET is_enabled = {$_POST['is_enabled']} WHERE id = %d", $id); } // User message $template->add_message('Successfully updated status of selected notifications.'); // Update notification } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Update Notification')) { // Update db DB::update('notifications', array('is_enabled' => $_POST['is_enabled'], 'content_type' => $_POST['content_type'], 'subject' => $_POST['subject'], 'contents' => base64_encode($_POST['contents'])), "id = %d", $_POST['notification_id']); // User message $template->add_message('Successfully updated notification.'); }
foreach ($addr_rows as $addr_row) { $change_keyindexes[] = '1/' . $addr_row['address_num']; } // Set vars $vars = array('output_id' => $arow['id'], 'recipients' => $recipients, 'change_keyindex' => $change_keyindexes, 'change_sigscript' => $change_sigscript); array_push($json['outputs'], $vars); } // Send file header("Content-disposition: attachment; filename=\"tx.json\""); header("Content-type: text/json"); echo json_encode($json); exit(0); // Delete checked sends } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Delete Checked Sends')) { // Delete $ids = get_chk('send_id'); foreach ($ids as $id) { if (!$id > 0) { continue; } DB::query("DELETE FROM coin_sends WHERE id = %d", $id); } // User message $template->add_message("Successfully deleted checked pending sends."); // Upload signed sends } elseif (isset($_POST['submit']) && $_POST['submit'] == tr('Upload Signed Sends')) { // Load JSON file try { $json = json_decode(file_get_contents($_FILES['signed_json']['tmp_name']), true); } catch (Exception $e) { trigger_error("You did not upload a properly formatted JSON file. Please check the file you uploaded, and try again.");