本文整理汇总了PHP中BuckysUser类的典型用法代码示例。如果您正苦于以下问题:PHP BuckysUser类的具体用法?PHP BuckysUser怎么用?PHP BuckysUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BuckysUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]];
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:30,代码来源:notificationApi.php
示例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;
}
开发者ID:kishoreks,项目名称:BuckysRoom,代码行数:63,代码来源:class.BuckysMessage.php
示例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;
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:16,代码来源:class.BuckysUsersToken.php
示例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]];
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:54,代码来源:streamApi.php
示例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;
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:19,代码来源:class.BuckysShopOrder.php
示例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;
}
开发者ID:kishoreks,项目名称:BuckysRoom,代码行数:21,代码来源:class.BuckysForumNotification.php
示例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]];
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:38,代码来源:searchApi.php
示例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]];
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:23,代码来源:friendApi.php
示例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;
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:36,代码来源:config.php
示例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;
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:24,代码来源:class.BuckysPageFollower.php
示例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";
开发者ID:kishoreks,项目名称:BuckysRoom,代码行数:31,代码来源:info_links.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'];
?>
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:31,代码来源:index.php
示例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'];
开发者ID:ravi50041,项目名称:Social-Network-Website,代码行数:29,代码来源:traded.php
示例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';
}
}
?>
开发者ID:ravi50041,项目名称:Social-Network-Website,代码行数:31,代码来源:feedback.php
示例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'>
开发者ID:ravi50041,项目名称:Social-Network-Website,代码行数:31,代码来源:profile.php
示例16: deleteComment
/**
* @param $userID
* @param $commentID
* @return bool
*/
public static function deleteComment($userID, $commentID)
{
global $db;
$query = $db->prepare("SELECT c.commentID, c.postID FROM " . TABLE_COMMENTS . " AS c LEFT JOIN " . TABLE_POSTS . " AS p ON p.postID=c.postID WHERE c.commentID=%s AND (c.commenter=%s OR p.poster=%s)", $commentID, $userID, $userID);
$row = $db->getRow($query);
if (!$row) {
return false;
} else {
$cID = $row['commentID'];
$postID = $row['postID'];
$db->query('DELETE FROM ' . TABLE_COMMENTS . " WHERE commentID=" . $cID);
//Remove Activity
$db->query('DELETE FROM ' . TABLE_MAIN_ACTIVITIES . " WHERE actionID=" . $cID);
//Remove From Report
$db->query('DELETE FROM ' . TABLE_REPORTS . " WHERE objectType='comment' AND objectID=" . $cID);
//Update comments on the posts table
$query = $db->prepare('UPDATE ' . TABLE_POSTS . ' SET `comments`=`comments` - 1 WHERE postID=%d', $postID);
$db->query($query);
$postData = BuckysPost::getPostById($postID);
//Update User Stats
BuckysUser::updateStats($postData['poster'], 'comments', -1);
return true;
}
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:29,代码来源:class.BuckysComment.php
示例17: deleteReply
/**
* Delete Reply
*
* @param Int $replyID
* @return bool
*/
public static function deleteReply($replyID)
{
global $db;
$query = $db->prepare("SELECT * FROM " . TABLE_FORUM_REPLIES . " WHERE replyID=%d", $replyID);
$reply = $db->getRow($query);
if ($reply) {
if ($reply['status'] == 'publish') {
//Getting Topic
$query = $db->prepare("SELECT * FROM " . TABLE_FORUM_TOPICS . " WHERE topicID=%d", $reply['topicID']);
$topic = $db->getRow($query);
//Update Replies Count For Topic
$query = "UPDATE " . TABLE_FORUM_TOPICS . " SET `replies`=`replies` - 1 WHERE topicID=" . $reply['topicID'];
$db->query($query);
//Update Replies Count For Category
$query = "UPDATE " . TABLE_FORUM_CATEGORIES . " SET `replies`=`replies` - 1 WHERE categoryID=" . $topic['categoryID'];
$db->query($query);
$db->query("UPDATE " . TABLE_USERS . " SET `posts_count`=`posts_count` - 1 WHERE userID=" . $reply['creatorID']);
$db->query("UPDATE " . TABLE_USERS . " SET `posts_rating`=`posts_rating`" . ($reply['votes'] > 0 ? '-' : '+') . abs($reply['votes']) . " WHERE userID=" . $reply['creatorID']);
//Update Stats
BuckysUser::updateStats($topic['creatorID'], 'replies', -1);
BuckysUser::updateStats($reply['creatorID'], 'voteUps', -1 * $reply['votes']);
}
//Remove Reply Votes
$query = "DELETE FROM " . TABLE_FORUM_VOTES . " WHERE objectID=" . $reply['replyID'];
$db->query($query);
//Delete Frome Reports Table
$query = "DELETE FROM " . TABLE_REPORTS . " WHERE objectType='reply' AND objectID=" . $reply['replyID'];
$db->query($query);
//Remove Reply
$query = "DELETE FROM " . TABLE_FORUM_REPLIES . " WHERE replyID=" . $reply['replyID'];
$db->query($query);
BuckysForumTopic::updateTopicLastReplyID($reply['topicID']);
BuckysForumCategory::updateCategoryLastTopicID($topic['categoryID']);
return true;
}
return false;
}
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:43,代码来源:class.BuckysForumReply.php
示例18: dirname
<?php
require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
if (!($userID = buckys_is_logged_in())) {
buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
}
$albumID = isset($_REQUEST['albumID']) ? $_REQUEST['albumID'] : '';
if (!$albumID || !BuckysAlbum::checkAlbumOwner($albumID, $userID)) {
buckys_redirect("/photo_albums.php", MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($profileID);
//Getting Album
$album = BuckysAlbum::getAlbum($albumID);
//Getting Photos
$myphotos = BuckysPost::getPhotosByUserID($userID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, true);
$albumPhotos = BuckysAlbum::getPhotos($albumID);
//Getting Album Photos
if (isset($_POST['action'])) {
//Create New Album
if ($_POST['action'] == 'save-album') {
//If the album title is empty, throw error
//If the album title is empty, throw error
if (trim($_POST['album_name']) == '') {
buckys_redirect('/photo_album_edit.php?albumID=' . $_POST['albumID'], MSG_ALBUM_TITLE_EMPTY, MSG_TYPE_ERROR);
}
BuckysAlbum::updateAlbum($_POST['albumID'], trim($_POST['album_name']), $_POST['visibility'], $_POST['photos']);
buckys_redirect("/photo_album_edit.php?albumID=" . $_POST['albumID'], MSG_ALBUM_UPDATED);
} else {
if ($_POST['action'] == 'remove-from-album' || $_POST['action'] == 'add-to-album') {
开发者ID:kishoreks,项目名称:BuckysRoom,代码行数:31,代码来源:photo_album_edit.php
示例19: render_result_xml
if ($isAjax) {
$resultXML = ['status' => 'error', 'message' => $db->getLastError()];
render_result_xml($resultXML);
} else {
buckys_redirect($return, $db->getLastError(), MSG_TYPE_ERROR);
}
}
}
}
}
}
}
exit;
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($userID);
$page = isset($_GET['page']) ? $_GET['page'] : 1;
if ($type == 'all') {
$totalCount = BuckysFriend::getNumberOfFriends($userID);
} else {
if ($type == 'pending') {
$totalCount = BuckysFriend::getNumberOfPendingRequests($userID);
} else {
if ($type == 'requested') {
$totalCount = BuckysFriend::getNumberOfReceivedRequests($userID);
}
}
}
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysFriend::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
开发者ID:HAPwebsite,项目名称:Social-Network-Website,代码行数:31,代码来源:myfriends.php
示例20: loadMessenger
/**
* Load Private Messenger
*
*/
function loadMessenger()
{
global $db, $userID;
//Getting Friends from the Buddy List
$messengerSettings = BuckysUser::getUserBasicInfo($userID);
$uIDs = array();
//Return HTML
ob_start();
?>
<div id="private_messenger_main_wrap">
<div class="box_nav_row">
<a href="#" class="close_box_link"> </a>
<!-- <a href="#" class="minimize_box_link"> </a>-->
</div>
<h2>Private Messenger</h2>
<div class="chat_user_list" id="private_messenger_buddies_list">
<?php
echo BuckysPrivateMessenger::getUserListHTML($userID, $uIDs);
?>
</div>
<div class="below_chat_user_list <?php
if ($messengerSettings['messenger_privacy'] == 'all') {
?>
add-user-to-buddylist-hidden<?php
}
?>
" id="add-user-to-buddylist">
<form name="adduserform" id="adduserform">
<h2>Add Friends</h2>
<span id="add-user-to-buddylist-inputholder">
<input type="text" class="input below_chat_user_list_input" id="add-user-to-buddylist-input" />
<input type="submit" value="Add" class="redButton" />
</span>
<!-- <div id="selected-users-list"></div>-->
<div class="clear"></div>
<?php
echo render_loading_wrapper();
?>
</form>
</div>
<div class="below_chat_user_list" id="messenger_btn_box">
<span><input type="button" id="settings_messenger_btn" class="redButton" value="Settings"></span>
</div>
</div>
<?php
BuckysPrivateMessenger::updateConversationList($userID, $uIDs);
$convList = isset($_SESSION['converation_list']) ? $_SESSION['converation_list'] : array();
?>
<div id="private_messenger_conversation_wrap" <?php
if (!buckys_not_null($convList)) {
?>
style="display: none;"<?php
}
?>
>
<div class="box_nav_row">
<a href="#" class="close_box_link"> </a>
<a href="#" class="minimize_box_link"> </a>
<div href="#" class="options_link" id="private-messenger-options-link">
Options
<ul>
<li><a href="#" id="pm-box-clear-history-link">Clear history</a></li>
<li><a href="#" id="pm-box-block-user-link">Block User</a></li>
</ul>
</div>
</div>
<div id="private_messenger_conversation_lft">
<div id="private_messenger_opened_chats">
<?php
foreach ($convList as $i => $uID) {
$tUInfo = BuckysUser::getUserBasicInfo($uID);
?>
<a href="#" data-id="<?php
echo $uID;
?>
" <?php
if ($i == 0) {
?>
class="actived"<?php
}
?>
data-encrypted="<?php
echo buckys_encrypt_id($uID);
?>
"><?php
echo $tUInfo['firstName'] . " " . $tUInfo['lastName'];
?>
<span title="close" class="close-conversation">X</span></a><?php
}
?>
</div>
</div>
<div id="private_messenger_conversation_rgt">
<?php
foreach ($convList as $i => $uID) {
//.........这里部分代码省略.........
开发者ID:kishoreks,项目名称:BuckysRoom,代码行数:101,代码来源:private_messenger.php
注:本文中的BuckysUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论