本文整理汇总了PHP中BuckysUser::getUserBitcoinInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP BuckysUser::getUserBitcoinInfo方法的具体用法?PHP BuckysUser::getUserBitcoinInfo怎么用?PHP BuckysUser::getUserBitcoinInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuckysUser
的用法示例。
在下文中一共展示了BuckysUser::getUserBitcoinInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makePayment
/**
* make payment
*
* @param mixed $buyerID
* @param mixed $sellerID
* @param mixed $amount
*/
public function makePayment($buyerID, $sellerID, $amount)
{
$sellerBitcoinInfo = BuckysUser::getUserBitcoinInfo($sellerID);
if ($amount <= 0 || !$sellerBitcoinInfo) {
return false;
//no payment
}
$flag = BuckysBitcoin::sendBitcoin($buyerID, $sellerBitcoinInfo['bitcoin_address'], $amount);
buckys_get_messages();
// this will flash the messages
return $flag;
}
示例2: dirname
<?php
require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
if (!buckys_check_user_acl(USER_ACL_REGISTERED)) {
buckys_redirect('/register.php');
}
$bitcoinClass = new BuckysBitcoin();
//Create Wallet if it is not created
$bitcoinInfo = BuckysUser::getUserBitcoinInfo($userID);
if (!$bitcoinInfo) {
$bitcoinInfo = $bitcoinClass->createWallet($TNB_GLOBALS['user']['userID'], $TNB_GLOBALS['user']['email']);
}
if (isset($_POST['action']) && $_POST['action'] == 'send-bitcoins') {
//Check Token
if (!buckys_check_form_token()) {
buckys_redirect("/wallet.php", MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
$toAddress = $_POST['receiver'];
$amount = doubleval($_POST['amount']);
$password = $_POST['password'];
$user = BuckysUser::getUserData($TNB_GLOBALS['user']['userID']);
$is_error = false;
if (!$password || !buckys_validate_password($password, $user['password'])) {
buckys_redirect("/wallet.php", MSG_CURRENT_PASSWORD_NOT_CORRECT, MSG_TYPE_ERROR);
}
if (!$toAddress) {
buckys_redirect("/wallet.php", MSG_ENTER_BITCOINS_ADDRESS_OF_RECIPIENT, MSG_TYPE_ERROR);
}
if (!$amount || $amount <= 0) {
buckys_redirect("/wallet.php", MSG_INVALID_BITCOIN_AMOUNT, MSG_TYPE_ERROR);
示例3: dirname
<?php
require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
$userID = buckys_is_logged_in();
//Getting User ID from Parameter
$profileID = isset($_GET['user']) ? $_GET['user'] : 0;
//If the parameter is null, goto homepage
if (!$profileID) {
buckys_redirect('/index.php');
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($profileID);
$userBitcoinInfo = BuckysUser::getUserBitcoinInfo($profileID);
//Goto Homepage if the userID is not correct
if (!buckys_not_null($userData) || !BuckysUser::checkUserID($profileID, true)) {
buckys_redirect('/index.php');
}
//Display
$TNB_GLOBALS['title'] = trim($userData['firstName'] . ' ' . $userData['lastName']) . "'s Bitcoin Address - " . TNB_SITE_NAME;
buckys_enqueue_stylesheet('profile.css');
buckys_enqueue_stylesheet('posting.css');
buckys_enqueue_stylesheet('publisher.css');
$TNB_GLOBALS['content'] = 'bitcoin';
$TNB_GLOBALS['meta'] = '<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
示例4: deleteUserAccount
//.........这里部分代码省略.........
}
//Block Replies
$query = $db->prepare("SELECT count(r.replyID), r.topicID, t.categoryID FROM " . TABLE_FORUM_REPLIES . " AS r LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.topicID WHERE r.status='publish' AND r.creatorID=%d GROUP BY r.topicID", $userID);
$rRows = $db->getResultsArray($query);
$db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `status`='suspended' WHERE creatorID=" . $userID . " AND `status`='publish'");
foreach ($rRows as $row) {
$db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `replies` = `replies` - " . $row['c'] . " WHERE topicID=" . $row['topicID']);
$db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` - " . $row['c'] . " WHERE categoryID=" . $row['categoryID']);
BuckysForumTopic::updateTopicLastReplyID($row['topicID']);
}
//Block Topics
$query = $db->prepare("SELECT count(topicID) AS tc, SUM(replies) AS rc, categoryID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=%d AND `status`='publish' GROUP BY categoryID", $userID);
$tRows = $db->getResultsArray($query);
$db->query("UPDATE " . TABLE_FORUM_TOPICS . " SET `status`='suspended' WHERE creatorID=" . $userID . " AND `status`='publish'");
foreach ($tRows as $row) {
$db->query("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies` = `replies` - " . $row['rc'] . ", `topics` = `topics` - " . $row['tc'] . " WHERE categoryID=" . $row['categoryID']);
BuckysForumCategory::updateCategoryLastTopicID($row['categoryID']);
}
//Block Reply Votes
$query = $db->prepare("SELECT count(voteID) AS c, objectID FROM " . TABLE_FORUM_VOTES . " WHERE voterID=%d AND voteStatus=1 GROUP BY objectID", $userID);
$vRows = $db->getResultsArray($query);
foreach ($vRows as $row) {
$db->query("UPDATE " . TABLE_FORUM_REPLIES . " SET `votes` = `votes` - " . $row['c'] . " WHERE replyID=" . $row['objectID']);
}
//Delete Reported Objects
$db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT postID FROM " . TABLE_POSTS . " WHERE poster=" . $userID . ")");
$db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID . ")");
$db->query("DELETE FROM " . TABLE_REPORTS . " WHERE objectID IN (SELECT replyID FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . ")");
//Delete From banned Users
$db->query("DELETE FROM " . TABLE_BANNED_USERS . " WHERE bannedUserID=" . $userID);
//Delete Activities
$db->query("DELETE FROM " . TABLE_MAIN_ACTIVITIES . " WHERE userID=" . $userID);
//Delete Album Photos
$db->query("DELETE FROM " . TABLE_ALBUMS_PHOTOS . " WHERE album_id IN (SELECT albumID FROM " . TABLE_ALBUMS . " WHERE OWNER=" . $userID . ")");
//Delete ALbums
$db->query("DELETE FROM " . TABLE_ALBUMS . " WHERE OWNER=" . $userID);
//Delete Friends
$db->query("DELETE FROM " . TABLE_FRIENDS . " WHERE userID=" . $userID . " OR userFriendID=" . $userID);
//Delete Messages
$db->query("DELETE FROM " . TABLE_MESSAGES . " WHERE userID=" . $userID . " OR sender=" . $userID);
//Delete Private Messengers
$db->query("DELETE FROM " . TABLE_MESSENGER_BLOCKLIST . " WHERE userID=" . $userID . " OR blockedID=" . $userID);
$db->query("DELETE FROM " . TABLE_MESSENGER_BUDDYLIST . " WHERE userID=" . $userID . " OR buddyID=" . $userID);
$db->query("DELETE FROM " . TABLE_MESSENGER_MESSAGES . " WHERE userID=" . $userID . " OR buddyID=" . $userID);
//Delete Posts
$posts = $db->getResultsArray("SELECT * FROM " . TABLE_POSTS . " WHERE poster=" . $userID);
foreach ($posts as $post) {
//Delete Comments
$db->query("DELETE FROM " . TABLE_POSTS_COMMENTS . " WHERE postID=" . $post['postID']);
//Delete Likes
$db->query("DELETE FROM " . TABLE_POSTS_LIKES . " WHERE postID=" . $post['postID']);
//Delete hits
$db->query("DELETE FROM " . TABLE_POSTS_HITS . " WHERE postID=" . $post['postID']);
}
$db->query("DELETE FROM " . TABLE_POSTS . " WHERE poster=" . $userID);
//Delete Pages
$pageIns = new BuckysPage();
$pageIns->deletePageByUserID($userID);
//Delete Trade Section which are related to this user.
$tradeIns = new BuckysTradeItem();
$tradeIns->deleteItemsByUserID($userID);
//Delete Shop Section which are related to this user
$shopIns = new BuckysShopProduct();
$shopIns->deleteProductsByUserID($userID);
//Delete Comments
$db->query("DELETE FROM " . TABLE_POSTS_COMMENTS . " WHERE commenter=" . $userID);
//Delete Likes
$db->query("DELETE FROM " . TABLE_POSTS_LIKES . " WHERE userID=" . $userID);
//Delete Page Followers
$db->query("DELETE FROM " . TABLE_PAGE_FOLLOWERS . " WHERE userID=" . $userID);
//Getting Removed Topics
$topicIDs = $db->getResultsArray("SELECT topicID FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID);
if (!$topicIDs) {
$topicIDs = [0];
}
//Delete Reply Votes
$db->query("DELETE FROM " . TABLE_FORUM_VOTES . " WHERE voterID=" . $userID);
$db->query("DELETE FROM " . TABLE_FORUM_VOTES . " WHERE objectID IN ( SELECT replyID FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . " OR topicID IN (" . implode(", ", $topicIDs) . ") )");
//Delete Replies
$db->query("DELETE FROM " . TABLE_FORUM_REPLIES . " WHERE creatorID=" . $userID . " OR topicID IN (" . implode(", ", $topicIDs) . ")");
//Delete Topics
$db->query("DELETE FROM " . TABLE_FORUM_TOPICS . " WHERE creatorID=" . $userID);
//Delete Users
/*$db->query("DELETE FROM " . TABLE_USERS . " WHERE userID=" . $userID);
$db->query("DELETE FROM " . TABLE_USERS_CONTACT . " WHERE userID=" . $userID);
$db->query("DELETE FROM " . TABLE_USERS_EDUCATIONS . " WHERE userID=" . $userID);
$db->query("DELETE FROM " . TABLE_USERS_EMPLOYMENTS . " WHERE userID=" . $userID);
$db->query("DELETE FROM " . TABLE_USERS_LINKS . " WHERE userID=" . $userID);
$db->query("DELETE FROM " . TABLE_USERS_TOKEN . " WHERE userID=" . $userID);*/
//Don't delete user from the database, just update the user's status
$db->query("UPDATE " . TABLE_USERS . " SET `status`=" . BuckysUser::STATUS_USER_DELETED . " WHERE userID=" . $userID);
//Send
$bitCoinInfo = BuckysUser::getUserBitcoinInfo($userID);
if ($bitCoinInfo) {
$userInfo = BuckysUser::getUserBasicInfo($userID);
$content = "Your " . TNB_SITE_NAME . " account has been deleted. However, you may still access your Bitcoin wallet at:\n" . "https://blockchain.info/wallet/login\n" . "Identifier: " . $bitCoinInfo['bitcoin_guid'] . "\n" . "Password: " . buckys_decrypt($bitCoinInfo['bitcoin_password']) . "\n";
//Send Email to User
buckys_sendmail($userInfo['email'], $userInfo['firstName'] . ' ' . $userInfo['lastName'], TNB_SITE_NAME . ' Account has been Deleted', $content);
}
}
示例5: _getTransactions
/**
* @param $userID
* @return bool
*/
private function _getTransactions($userID)
{
global $db;
$bitcoinInfo = BuckysUser::getUserBitcoinInfo($userID);
//Getting User Last Transaction
$query = $db->prepare("SELECT * FROM " . TABLE_USERS_BITCOIN_TRANSACTIONS_HISTORY . " WHERE userID=%d ORDER BY `date` DESC", $userID);
$lastTrans = $db->getRow($query);
$limit = 20;
$offset = 0;
do {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, 'https://blockchain.info/address/' . $bitcoinInfo['bitcoin_address'] . '?format=json&limit=' . $limit . '&offset=' . $offset);
$return = curl_exec($ch);
curl_close($ch);
$returnData = json_decode($return);
if (!$returnData) {
buckys_add_message("There was an error to get transactions: " . $return, MSG_TYPE_ERROR);
return false;
}
if (isset($returnData->error)) {
buckys_add_message('There was an error to get transactions: ' . $returnData->error, MSG_TYPE_ERROR);
return false;
} else {
$transactions = $returnData->txs;
if (!$transactions) {
$this->fixBalances($userID, !$lastTrans ? 0.0 : $lastTrans['balance']);
return true;
}
foreach ($transactions as $trx) {
if ($lastTrans && $lastTrans['hash'] == $trx->hash) {
$this->fixBalances($userID, !$lastTrans ? 0.0 : $lastTrans['balance']);
return true;
}
$row = [];
$row['userID'] = $userID;
$row['hash'] = $trx->hash;
$row['date'] = $trx->time;
$row['balance'] = -1.0;
$row['addr'] = [];
$row['amount'] = [];
$row['totalAmount'] = 0;
if ($trx->inputs[0]->prev_out->addr != $bitcoinInfo['bitcoin_address']) {
$row['addr'][] = $trx->inputs[0]->prev_out->addr;
foreach ($trx->out as $out) {
if ($out->addr == $bitcoinInfo['bitcoin_address']) {
$row['amount'][] = intval($out->value);
$row['totalAmount'] += intval($out->value);
}
}
$row['type'] = 'received';
} else {
//Send Bitcoin
foreach ($trx->out as $out) {
if ($out->addr != $bitcoinInfo['bitcoin_address']) {
$row['addr'][] = $out->addr;
$row['amount'][] = -1 * intval($out->value);
$row['totalAmount'] += intval($out->value);
}
}
if (!$row['addr']) {
$row['addr'][] = $trx->out[0]->addr;
$row['amount'][] = -1 * intval($trx->out[0]->value);
$row['totalAmount'] += 0;
}
$row['type'] = 'sent';
$row['totalAmount'] += ceil($trx->size / 1000) * 10000;
}
$row['addr'] = implode("\n", $row['addr']);
$row['amount'] = implode("\n", $row['amount']);
$db->insertFromArray(TABLE_USERS_BITCOIN_TRANSACTIONS_HISTORY, $row);
}
if (count($transactions) < $limit) {
$this->fixBalances($userID, !$lastTrans ? 0.0 : $lastTrans['balance']);
return true;
}
}
$offset += $limit;
} while (1);
return true;
}