本文整理汇总了PHP中BuckysUser类的典型用法代码示例。如果您正苦于以下问题:PHP BuckysUser类的具体用法?PHP BuckysUser怎么用?PHP BuckysUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BuckysUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNewNotificationAction
public function getNewNotificationAction()
{
global $TNB_GLOBALS, $db;
$data = $_POST;
$token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null;
if (!$token) {
return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
}
if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
}
$notifications = BuckysActivity::getAppNotifications($userID, $data['page']);
$results = [];
foreach ($notifications as $row) {
$item = [];
$item['postID'] = $row['postID'];
$item['userID'] = $row['userID'];
$query = $db->prepare("SELECT\n u.firstName, \n u.lastName, \n u.userID, \n u.thumbnail, \n u.current_city, \n u.current_city_visibility,\n f.friendID \n FROM \n " . TABLE_USERS . " AS u\n LEFT JOIN " . TABLE_FRIENDS . " AS f ON f.userID=%d AND f.userFriendID=u.userID AND f.status='1'\n WHERE u.userID=%d", $userID, $item['userID']);
$data = $db->getRow($query);
$item['userName'] = $data['firstName'] . " " . $data['lastName'];
$item['comment_content'] = $row['comment_content'];
$item['userThumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($data);
$item['type'] = $row['type'];
$item['activityType'] = $row['activityType'];
$item['post_date'] = buckys_api_format_date($userID, $row['post_date']);
$item['isNew'] = $row['isNew'];
$results[] = $item;
}
return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "RESULT" => $results]];
}
示例2: composeMessage
/**
* Create New Message
*
* @param mixed $data
*/
public function composeMessage($data)
{
global $db;
$receivers = $data['to'];
if (!buckys_not_null($receivers)) {
buckys_add_message(MSG_SENDER_EMPTY_ERROR, MSG_TYPE_ERROR);
return false;
}
if (trim($data['subject']) == '') {
buckys_add_message(MSG_MESSAGE_SUBJECT_EMPTY_ERROR, MSG_TYPE_ERROR);
return false;
}
if (trim($data['body']) == '') {
buckys_add_message(MSG_MESSAGE_BODY_EMPTY_ERROR, MSG_TYPE_ERROR);
return false;
}
$createdDate = date("Y-m-d H:i:s");
if (!is_array($receivers)) {
$receivers = array($receivers);
}
//Remove Duplicated Messages
$receivers = array_unique($receivers);
$nonFriend = array();
$sents = array();
$errors = array();
$isError = false;
foreach ($receivers as $receiver) {
//Create A message row for Sender
$sender = $data['userID'];
$receiverInfo = BuckysUser::getUserBasicInfo($receiver);
//confirm that current user and receiver is friend
/*if(!BuckysFriend::isFriend($receiver, $sender))
{
$nonFriend[] = $receiverInfo['firstName'] . " " . $receiverInfo['lastName'];
$isError = true;
continue;
}*/
$insertData = array('userID' => $sender, 'sender' => $sender, 'receiver' => $receiver, 'subject' => $data['subject'], 'body' => $data['body'], 'status' => 'read', 'created_date' => $createdDate);
$newId1 = $db->insertFromArray(TABLE_MESSAGES, $insertData);
//Create A message row for receiver
$sender = $data['userID'];
$insertData = array('userID' => $receiver, 'sender' => $sender, 'receiver' => $receiver, 'subject' => $data['subject'], 'body' => $data['body'], 'status' => 'unread', 'created_date' => $createdDate);
$newId2 = $db->insertFromArray(TABLE_MESSAGES, $insertData);
$sents[] = $receiverInfo['firstName'] . ' ' . $receiverInfo['lastName'];
}
if (count($sents) > 0) {
buckys_add_message(MSG_NEW_MESSAGE_SENT, MSG_TYPE_SUCCESS);
}
if (count($nonFriend) > 0) {
if (count($nonFriend) > 1) {
$msg = sprintf(MSG_COMPOSE_MESSAGE_ERROR_TO_NON_FRIENDS, implode(", ", $nonFriend));
} else {
$msg = sprintf(MSG_COMPOSE_MESSAGE_ERROR_TO_NON_FRIEND, $nonFriend[0]);
}
buckys_add_message($msg, MSG_TYPE_ERROR);
}
return !$isError;
}
示例3: createNewToken
/**
* @param $userID
* @param $tokenType
* @param null $token
* @return null|string
*/
public static function createNewToken($userID, $tokenType, $token = null)
{
global $db;
$info = BuckysUser::getUserData($userID);
if (!$token) {
$token = md5(mt_rand(0, 99999) . time() . mt_rand(0, 99999) . $info['email'] . mt_rand(0, 99999));
}
$newID = $db->insertFromArray(TABLE_USERS_TOKEN, ['userID' => $userID, 'userToken' => $token, 'tokenDate' => time(), 'tokenType' => $tokenType]);
return $token;
}
示例4: getListAction
public function getListAction()
{
$request = $_GET;
$token = isset($request['TOKEN']) ? trim($request['TOKEN']) : null;
$lastDate = isset($request['lastDate']) ? $request['lastDate'] : null;
if (!$token) {
return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
}
if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
}
$stream = BuckysPost::getUserPostsStream($userID, $lastDate);
//Format Result Data
$result = [];
foreach ($stream as $post) {
if ($post['pageID'] != BuckysPost::INDEPENDENT_POST_PAGE_ID) {
$pageIns = new BuckysPage();
$pageData = $pageIns->getPageByID($post['pageID']);
}
$pagePostFlag = false;
if (isset($pageData)) {
$pagePostFlag = true;
}
$item = [];
$item['articleId'] = $post['postID'];
$item['posterId'] = $post['poster'];
$item['articleImage'] = "";
$item['articleVideo'] = "";
$item['articleVideoId'] = "";
if ($pagePostFlag) {
$item['posterName'] = $pageData['title'];
$item['posterThumbnail'] = buckys_not_null($pageData['logo']) ? THENEWBOSTON_SITE_URL . DIR_WS_PHOTO . "users/" . $pageData['userID'] . "/resized/" . $pageData['logo'] : THENEWBOSTON_SITE_URL . DIR_WS_IMAGE . "newPagePlaceholder.jpg";
} else {
$item['posterName'] = $post['posterFullName'];
$item['posterThumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($post['poster']);
}
$item['postedDate'] = buckys_api_format_date($userID, $post['post_date']);
$item['purePostedDate'] = $post['post_date'];
$item['articleContent'] = $post['content'];
if ($post['type'] == 'video') {
$item['articleVideo'] = $post['youtube_url'];
$item['articleVideoId'] = buckys_get_youtube_video_id($post['youtube_url']);
} else {
if ($post['type'] == 'image') {
$item['articleImage'] = THENEWBOSTON_SITE_URL . DIR_WS_PHOTO . 'users/' . $post['poster'] . '/resized/' . $post['image'];
}
}
$item['articleLikes'] = $post['likes'];
$item['articleComments'] = $post['comments'];
$item['isLiked'] = !$post['likeID'] ? "no" : "yes";
$result[] = $item;
}
return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "RESULT" => $result]];
}
示例5: 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;
}
示例6: addNotificationsForPendingPost
/**
* Add notification for the users whose 'My post approved' set 1.
*
* @param Int $ownerID
* @param Int $topicID
* @param Int $replyID
*/
public function addNotificationsForPendingPost($ownerID, $topicID, $replyID = null)
{
global $db, $BUCKYS_GLOBALS;
$forumSettings = BuckysUser::getUserForumSettings($ownerID);
$activity = new BuckysActivity();
if ($forumSettings['notifyRepliedToMyTopic']) {
if ($replyID == null) {
$activity->addActivity($ownerID, $topicID, 'forum', BuckysForumNotification::ACTION_TYPE_TOPIC_APPROVED, 0);
} else {
$activity->addActivity($ownerID, $topicID, 'forum', BuckysForumNotification::ACTION_TYPE_REPLY_APPROVED, $replyID);
}
}
return true;
}
示例7: getFriendListAction
public function getFriendListAction()
{
global $TNB_GLOBALS, $db;
$data = $_POST;
$keyword = isset($data['keyword']) ? $data['keyword'] : null;
$token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null;
$sort = "pop";
$page = isset($data['page']) ? $data['page'] : null;
if (!$token) {
return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
}
if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
}
//Search Results
$searchIns = new BuckysSearch();
$pageIns = new BuckysPage();
$pageFollowerIns = new BuckysPageFollower();
$db_results = $searchIns->search($keyword, BuckysSearch::SEARCH_TYPE_USER_AND_PAGE, $sort, $page);
$results = [];
foreach ($db_results as $item) {
if ($item['type'] == "user") {
//Getting Detail Information
$query = $db->prepare("SELECT \n u.firstName, \n u.lastName, \n u.userID, \n u.thumbnail, \n u.current_city, \n u.current_city_visibility,\n f.friendID \n FROM \n " . TABLE_USERS . " AS u\n LEFT JOIN " . TABLE_FRIENDS . " AS f ON f.userID=%d AND f.userFriendID=u.userID AND f.status='1'\n WHERE u.userID=%d", $userID, $item['userID']);
$data = $db->getRow($query);
if ($data['friendID']) {
$row = [];
$row['id'] = $item['userID'];
$row['name'] = $data['firstName'] . " " . $data['lastName'];
$row['description'] = $data['current_city_visibility'] ? $data['current_city'] : "";
$row['friendType'] = "user";
$row['thumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($data);
$results[] = $row;
}
}
}
return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "RESULT" => $results]];
}
示例8: getPendingAction
public function getPendingAction()
{
$request = $_GET;
$token = isset($request['TOKEN']) ? trim($request['TOKEN']) : null;
if (!$token) {
return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
}
if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
}
$friends = BuckysFriend::getPendingRequests($userID);
$results = [];
foreach ($friends as $row) {
$item = [];
$item['id'] = $row['userID'];
$item['name'] = $row['fullName'];
$item['thumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($row['userID']);
$item['description'] = $row['city'];
$item['friendType'] = $row['status'];
$results[] = $item;
}
return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "RESULT" => $results]];
}
示例9: buckys_api_format_date
function buckys_api_format_date($userID, $date, $format = 'F j, Y')
{
global $TNB_GLOBALS;
$timeOffset = 0;
$userInfo = BuckysUser::getUserBasicInfo($userID);
$timeOffset = $TNB_GLOBALS['timezone'][$userInfo['timezone']];
$strDate = "";
$now = time();
$today = date("Y-m-d");
$cToday = date("Y-m-d", strtotime($date));
if ($cToday == $today) {
$h = floor(($now - strtotime($date)) / 3600);
$m = floor(($now - strtotime($date)) % 3600 / 60);
$s = floor(($now - strtotime($date)) % 3600 % 60);
if ($s > 40) {
$m++;
}
if ($h > 0) {
$strDate = $h . " hour" . ($h > 1 ? "s " : " ");
}
if ($m > 0) {
$strDate .= $m . " minute" . ($m > 1 ? "s " : " ");
}
if ($strDate == "") {
if ($s == 0) {
$s = 1;
}
$strDate .= $s . " second" . ($s > 1 ? "s " : " ");
}
$strDate .= "ago";
} else {
$strDate = date($format, strtotime($date) + $timeOffset * 60 * 60);
// $strDate = date("F j, Y h:i A", strtotime($date));
}
return $strDate;
}
示例10: removeAllFollowersByPageID
/**
* Remove page followers when removing page
*
* @param mixed $pageID
*/
public function removeAllFollowersByPageID($pageID)
{
global $db;
if (!is_numeric($pageID)) {
return;
}
//Getting Followers
$query = $db->prepare("SELECT userID FROM " . TABLE_PAGES . " WHERE pageID=%d", $pageID);
$pageCreatorId = $db->getVar($query);
//Getting Followers
$query = $db->prepare("SELECT count(*) FROM " . TABLE_PAGE_FOLLOWERS . " WHERE pageID=%d", $pageID);
$followers = $db->getVar($query);
if ($followers > 0) {
BuckysUser::updateStats($pageCreatorId, 'pageFollowers', -1 * $followers);
}
$query = sprintf("DELETE FROM %s WHERE pageID=%d", TABLE_PAGE_FOLLOWERS, $pageID);
$db->query($query);
return;
}
示例11: buckys_redirect
buckys_redirect('/index.php');
}
//Getting UserData from Id
$userData = BuckysUser::getUserLinks($userID);
if (isset($_POST['action'])) {
//Check the user id is same with the current logged user id
if ($_POST['userID'] != $userID) {
echo 'Invalid Request!';
exit;
}
//Save Address
if ($_POST['action'] == 'save_links') {
$data = array();
for ($i = 0; $i < count($_POST['title']); $i++) {
$data[] = array('title' => $_POST['title'][$i], 'url' => $_POST['url'][$i], 'visibility' => $_POST['visibility'][$i]);
}
//Update User Phone numbers
if (BuckysUser::updateUserLinks($userID, $data)) {
echo 'Success';
} else {
echo $db->getLastError();
}
exit;
}
}
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('info.css');
buckys_enqueue_javascript('info.js');
$BUCKYS_GLOBALS['content'] = 'info_links';
$BUCKYS_GLOBALS['title'] = "Info Links - BuckysRoom";
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
示例12: substr
echo $subCat['categoryID'];
?>
"
style="font-weight:bold;"><?php
echo $subCat['categoryName'];
?>
</a> <br/> <span
style="color:#999999;font-size:11px;"><?php
echo $categoryDescription;
?>
</span>
</td>
<td>
<?php
if ($subCat['lastTopicID'] > 0) {
echo '<a href="/profile.php?user=' . $subCat['lastPosterID'] . '"><img src="' . BuckysUser::getProfileIcon($subCat['lastPosterID']) . '" class="poster-icon" /></a>';
echo "<a href='/forum/topic.php?id=" . $subCat['lastTopicID'] . "'>";
if (strlen($subCat['lastPostTitle']) > 200) {
echo substr($subCat['lastPostTitle'], 0, 195) . "...";
} else {
echo $subCat['lastPostTitle'];
}
echo "</a><br />";
?>
<a style="font-weight:bold;"
href="/profile.php?user=<?php
echo $subCat['lastPosterID'];
?>
"><?php
echo $subCat['lastPosterName'];
?>
示例13: foreach
<?php
foreach ($tradeList as $tradeData) {
$myPrefix = '';
$theirPrefix = '';
if ($tradeData['sellerID'] == $view['myID']) {
//I'm seller for this tradeData
$myPrefix = 'seller';
$theirPrefix = 'buyer';
} else {
//I'm buyer for this tradeData
$myPrefix = 'buyer';
$theirPrefix = 'seller';
}
$userIns = new BuckysUser();
$tradeData['theirBasicInfo'] = $userIns->getUserBasicInfo($tradeData[$theirPrefix . 'ID']);
$myTrackingNumber = $tradeData[$myPrefix . 'TrackingNo'];
$theirTrackingNumber = $tradeData[$theirPrefix . 'TrackingNo'];
// $myItemImage = fn_buckys_get_item_first_image_thumb($tradeData[$myPrefix . 'ItemImages']);
// $theirItemImage = fn_buckys_get_item_first_image_thumb($tradeData[$theirPrefix . 'ItemImages']);
$myItemImage = fn_buckys_get_item_first_image_normal($tradeData[$myPrefix . 'ItemImages']);
$theirItemImage = fn_buckys_get_item_first_image_normal($tradeData[$theirPrefix . 'ItemImages']);
$sendMessageLink = '/messages_compose.php?to=' . $tradeData[$theirPrefix . 'ID'];
$dateCreated = date('n/j/y', strtotime($tradeData['tradeCreatedDate']));
$myItemLink = '/trade/view.php?id=' . $tradeData[$myPrefix . 'ItemID'];
$theirItemLink = '/trade/view.php?id=' . $tradeData[$theirPrefix . 'ItemID'];
$totalRating = 'No';
$positiveRating = '';
if (isset($tradeData[$theirPrefix . 'TotalRating']) && $tradeData[$theirPrefix . 'TotalRating'] > 0) {
$totalRating = $tradeData[$theirPrefix . 'TotalRating'];
示例14: die
<?php
if (!isset($TNB_GLOBALS)) {
die("Invalid Request!");
}
$feedbackList = $view['feedback'];
$userIns = new BuckysUser();
if (!$view['myRatingInfo']) {
$view['myRatingInfo'] = [];
}
?>
<section id="main_section">
<?php
buckys_get_panel('trade_top_search');
?>
<section id="feedback-left-panel">
<?php
$myInfo = $userIns->getUserBasicInfo($view['myID']);
$myData = BuckysUser::getUserData($view['myID']);
$totalRating = 'No';
$positiveRating = '';
if ($view['myRatingInfo']['totalRating'] != '' && $view['myRatingInfo']['totalRating'] > 0) {
$totalRating = $view['myRatingInfo']['totalRating'];
if (is_numeric($view['myRatingInfo']['positiveRating'])) {
$positiveRating = number_format($view['myRatingInfo']['positiveRating'] / $totalRating * 100, 2, '.', '') . '% Positive';
}
}
?>
示例15:
?>
Posts on <?php
echo $userData['firstName'];
?>
's Profile
<?php
}
?>
</h3>
<a href="/profile.php?user=<?php
echo $userID;
?>
"><img
src="<?php
echo BuckysUser::getProfileIcon($userID);
?>
" class="postIcons"/></a>
<div class="new-post-row">
<form method="post" id="newpostform" action="/manage_post.php">
<div id="new-post-nav">
<a href="#" class="post-text selected">Text</a> <span>|</span> <a href="#"
class="post-image">Photo</a> <span>|</span> <a href="#" class="post-video">Video</a>
</div>
<textarea name="content" class="newPost" placeholder="Create a new post..."></textarea>
<div id="new-video-url">
<label style="font-weight:bold;font-size:11px;" for="video-url">YouTube URL:</label> <input
type="text" name="youtube_url" id="youtube_url" class="input" value=""/></div>
<div class='privacy-row'>