Exemplo n.º 1
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
}
buckys_enqueue_stylesheet('trade.css');
buckys_enqueue_javascript('trade.js');
$BUCKYS_GLOBALS['content'] = 'trade/offer_received';
$BUCKYS_GLOBALS['headerType'] = 'trade';
$paramCurrentPage = get_secure_integer($_REQUEST['page']);
$paramTargetID = get_secure_integer($_REQUEST['targetID']);
$view = array();
//Get offer_received info
$tradeOfferIns = new BuckysTradeOffer();
$view['offers'] = $tradeOfferIns->getOfferReceived($userID, $paramTargetID);
$view['offers'] = buckys_trade_pagination($view['offers'], '/trade/offer_received.php', $paramCurrentPage, TRADE_ROWS_PER_PAGE);
$BUCKYS_GLOBALS['title'] = 'Offer Received - BuckysRoomTrade';
//Mark the activity (offer received) as read
$tradeNotificationIns = new BuckysTradeNotification();
$tradeNotificationIns->markAsRead($userID, BuckysTradeNotification::ACTION_TYPE_OFFER_RECEIVED);
$tradeOfferIns->markAsRead($userID, BuckysTradeOffer::STATUS_OFFER_ACTIVE);
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
Exemplo n.º 2
0
/**
 * Delete offer
 */
function deleteOffer()
{
    $userID = buckys_is_logged_in();
    if (!$userID) {
        //You should be logged in
        return;
    } else {
        $tradeOfferIns = new BuckysTradeOffer();
        $offerID = get_secure_integer($_REQUEST['offerID']);
        $result = $tradeOfferIns->deleteOfferMade($offerID, $userID);
        if ($result) {
            echo json_encode(['success' => 1, 'msg' => "You have deleted an offer successfully."]);
        } else {
            echo json_encode(['success' => 0, 'msg' => "You do not have permission."]);
        }
    }
}
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
}
buckys_enqueue_stylesheet('trade.css');
buckys_enqueue_javascript('trade.js');
$TNB_GLOBALS['content'] = 'trade/offer_declined';
$TNB_GLOBALS['headerType'] = 'trade';
$paramCurrentPage = get_secure_integer($_REQUEST['page']);
$paramType = get_secure_string($_REQUEST['type']);
// default 'bythem' or empty, another possible value is 'byme'
$view = [];
//Get offer_received info
$tradeOfferIns = new BuckysTradeOffer();
$baseURL = '/trade/offer_declined.php';
if ($paramType == 'byme') {
    $view['offers'] = $tradeOfferIns->getOfferDeclined($userID, false);
    $baseURL .= "?type=byme";
} else {
    $paramType = '';
    $view['offers'] = $tradeOfferIns->getOfferDeclined($userID, true);
}
$view['offers'] = fn_buckys_pagination($view['offers'], $baseURL, $paramCurrentPage, COMMON_ROWS_PER_PAGE);
$view['type'] = $paramType;
$TNB_GLOBALS['title'] = 'Offers Declined - BuckysRoomTrade';
//Mark the activity (offer received) as read
$tradeNotificationIns = new BuckysTradeNotification();
$tradeNotificationIns->markAsRead($userID, BuckysTradeNotification::ACTION_TYPE_OFFER_DECLINED);
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Exemplo n.º 4
0
                }
                if (is_int($result)) {
                    $data = ['status' => 'success', 'message' => MSG_THANKS_YOUR_VOTE, 'votes' => ($result > 0 ? "+" : "") . $result];
                } else {
                    $data = ['status' => 'error', 'message' => $result];
                }
            }
        }
        render_result_xml($data);
        exit;
    }
} else {
    if (isset($_GET['action']) && $_GET['action'] == 'delete') {
        //Delete this topic
        $userID = buckys_is_logged_in();
        $topicID = isset($_GET['id']) ? get_secure_integer($_GET['id']) : null;
        if (isset($topicID)) {
            $forumTopicIns = new BuckysForumTopic();
            $forumData = $forumTopicIns->getTopic($topicID);
            if (isset($forumData) && $forumData['creatorID'] == $userID) {
                //then you can delete this one.
                $forumTopicIns->deleteTopic($topicID);
                buckys_redirect('/forum', MSG_TOPIC_REMOVED_SUCCESSFULLY, MSG_TYPE_SUCCESS);
            } else {
                //You don't have permission
                buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
            }
        }
    } else {
        if (isset($_GET['action']) && $_GET['action'] == 'move-topic') {
            //Delete this topic
        $replyID = isset($_GET['replyID']) ? get_secure_integer($_GET['replyID']) : null;
        $replyData = $forumReplyIns->getReplyByID($replyID);
        if ($replyData && $replyData['creatorID'] == $userID && $replyData['topicID'] == $topicID) {
            //then you can delete this one
            $forumReplyIns->deleteReply($replyID);
            buckys_redirect("/forum/topic.php?id=" . $topicID, MSG_REPLY_REMOVED_SUCCESSFULLY, MSG_TYPE_SUCCESS);
        } else {
            echo MSG_PERMISSION_DENIED;
        }
        exit;
    } else {
        if (isset($_GET['action']) && $_GET['action'] == 'edit') {
            //edit post_reply
            $forumReplyIns = new BuckysForumReply();
            $userID = buckys_is_logged_in();
            $replyID = isset($_GET['replyID']) ? get_secure_integer($_GET['replyID']) : null;
            $replyData = $forumReplyIns->getReplyByID($replyID);
            if ($replyData && $replyData['creatorID'] == $userID && $replyData['topicID'] == $topicID) {
                //then you can edit this one
                $view['replyData'] = $replyData;
                $view['action_type'] = 'edit';
                $view['replyID'] = $replyID;
            } else {
                //permission error
                buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
            }
        }
    }
}
if (!isset($replyData) || !$replyData) {
    buckys_redirect("/forum", MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
buckys_enqueue_stylesheet('trade.css');
buckys_enqueue_javascript('trade.js');
$TNB_GLOBALS['content'] = 'feedback';
//$TNB_GLOBALS['headerType'] = 'trade';
$paramCurrentPage = get_secure_integer($_REQUEST['page']);
$paramType = get_secure_string($_REQUEST['type']);
$userID = get_secure_integer($_REQUEST['user']);
$userIns = new BuckysUser();
if ($userID == '') {
    if (!($userID = buckys_is_logged_in())) {
        buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
    }
} else {
    if (!is_numeric($userID)) {
        buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
    } else {
        $userData = $userIns->getUserData($userID);
        if ($userData['status'] != BuckysUser::STATUS_USER_ACTIVE) {
            buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
        }
    }
}
//Calc base URL
$baseURLParts = [];
if ($paramType == 'given') {
    $baseURLParts[] = "type=" . $paramType;
} else {
    $paramType = 'received';
Exemplo n.º 7
0
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
$userID = buckys_is_logged_in();
//Getting User ID from Parameter
$profileID = get_secure_integer($_GET['user']);
$postID = buckys_escape_query_integer(isset($_GET['post']) ? $_GET['post'] : null);
//If the parameter is null, goto homepage
if (!$profileID) {
    buckys_redirect('/index.php');
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($profileID);
//Goto Homepage if the userID is not correct
if (!buckys_not_null($userData) || !BuckysUser::checkUserID($profileID, true)) {
    buckys_redirect('/index.php');
}
$postType = isset($_GET['type']) ? $_GET['type'] : 'all';
if (!in_array($postType, ['all', 'user', 'friends'])) {
    $postType = 'all';
}
//if logged user can see all resources of the current user
$canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
$posts = BuckysPost::getPostsByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, $postID, null, $postType);
/*if( !buckys_not_null($posts) )
{
    //Goto Index Page
    buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}*/
//Mark the notifications to read
<?php

require dirname(__FILE__) . '/includes/bootstrap.php';
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
}
buckys_enqueue_stylesheet('trade.css');
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_javascript('trade.js');
$TNB_GLOBALS['content'] = 'shipping_info';
//$TNB_GLOBALS['headerType'] = 'trade';
$view = [];
$paramFillShippingInfoFromShop = get_secure_integer($_REQUEST['fill']);
if ($paramFillShippingInfoFromShop == 'shop') {
    buckys_add_message('Before buying an item, you must fill out your shipping information in order to determine shipping fees.', MSG_TYPE_ERROR);
}
//Save Shipping info
$tradeUserIns = new BuckysTradeUser();
$countryIns = new BuckysCountry();
if ($_POST['action'] == 'saveShippingInfo') {
    $paramData = ['shippingAddress' => $_POST['shippingAddress'], 'shippingAddress2' => $_POST['shippingAddress2'], 'shippingCity' => $_POST['shippingCity'], 'shippingState' => $_POST['shippingState'], 'shippingZip' => $_POST['shippingZip'], 'shippingCountryID' => $_POST['shippingCountryID']];
    $retVal = $tradeUserIns->updateShippingInfo($userID, $paramData);
    if ($retVal == false) {
        $view['status'] = ['success' => false, 'message' => 'Something goes wrong! Please contact customer support.'];
    } else {
        $view['status'] = ['success' => true, 'message' => 'Your shipping info has been updated successfully.'];
    }
}
//Get offer_received info
$view['trade_user_info'] = $tradeUserIns->getUserByID($userID);
$view['country_list'] = $countryIns->getCountryList();
Exemplo n.º 9
0
/**
 * Save feedback;
 */
function saveFeedback()
{
    $userID = buckys_is_logged_in();
    if (!$userID) {
        //You should be logged in
        return;
    } else {
        $feedbackIns = new BuckysFeedback();
        $orderIns = new BuckysShopOrder();
        $orderID = get_secure_integer($_REQUEST['orderID']);
        $score = get_secure_string($_REQUEST['score']);
        $feedback = get_secure_string($_REQUEST['feedback']);
        $orderData = $orderIns->getOrderByID($orderID);
        $feedbackID = null;
        if ($orderData['buyerID'] == $userID) {
            $feedbackID = $feedbackIns->addFeedback($userID, $score, $feedback, $orderID, BuckysFeedback::ACTIVITY_TYPE_SHOP);
        }
        if (!$feedbackID) {
            echo json_encode(['success' => 0, 'msg' => "You do not have permission."]);
        } else {
            echo json_encode(['success' => 1, 'msg' => "You have left feedback successfully."]);
        }
    }
}
Exemplo n.º 10
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
}
buckys_enqueue_stylesheet('shop.css');
buckys_enqueue_javascript('shop.js');
$TNB_GLOBALS['content'] = 'shop/sold';
$TNB_GLOBALS['headerType'] = 'shop';
//Update sold notification as read
$notificationIns = new BuckysShopNotification();
$notificationIns->markAsRead($userID, BuckysShopNotification::ACTION_TYPE_PRODUCT_SOLD);
$paramCurrentPage = get_secure_integer(isset($_REQUEST['page']) ? $_REQUEST['page'] : null);
$paramType = get_secure_string(isset($_REQUEST['type']) ? $_REQUEST['type'] : "");
$view = [];
$orderIns = new BuckysShopOrder();
$view['sold'] = $orderIns->getSold($userID);
//Update Sold product as read
$orderIns->updateSoldAsRead($userID);
$view['sold'] = fn_buckys_pagination($view['sold'], '/shop/sold.php', $paramCurrentPage, COMMON_ROWS_PER_PAGE);
$TNB_GLOBALS['title'] = 'My Sold Items - BuckysRoomShop';
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
Exemplo n.º 11
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
$userID = buckys_is_logged_in();
buckys_enqueue_stylesheet('trade.css');
buckys_enqueue_javascript('trade.js');
$BUCKYS_GLOBALS['content'] = 'trade/view';
$BUCKYS_GLOBALS['headerType'] = 'trade';
$paramItemID = get_secure_integer($_REQUEST['id']);
$view = array();
$tradeItemIns = new BuckysTradeItem();
$tradeCatIns = new BuckysTradeCategory();
$countryIns = new BuckysCountry();
$userIns = new BuckysUser();
$tradeOfferIns = new BuckysTradeOffer();
$view['item'] = $tradeItemIns->getItemById($paramItemID);
$view['myID'] = $userID;
if (!isset($view['item']) || $view['item']['status'] == BuckysTradeItem::STATUS_ITEM_INACTIVE) {
    buckys_redirect('/trade/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Check if the items owner is active one
$userData = $userIns->getUserData($view['item']['userID']);
if ($userData['status'] == BuckysUser::STATUS_USER_BANNED) {
    buckys_redirect('/trade/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Read more info from DB
$catData = $tradeCatIns->getCategoryByID($view['item']['catID']);
$view['item']['categoryName'] = isset($catData) ? $catData['name'] : '';
$countryData = $countryIns->getCountryById($view['item']['locationID']);
$view['item']['locationName'] = isset($countryData) ? $countryData['country_title'] : '';
$view['item']['userInfo'] = $userIns->getUserBasicInfo($view['item']['userID']);
Exemplo n.º 12
0
<?php

require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
$userID = buckys_is_logged_in();
buckys_enqueue_stylesheet('shop.css');
buckys_enqueue_javascript('shop.js');
$TNB_GLOBALS['content'] = 'shop/view';
$TNB_GLOBALS['headerType'] = 'shop';
$paramShopID = get_secure_integer($_REQUEST['id']);
$view = [];
$shopProductIns = new BuckysShopProduct();
$catIns = new BuckysShopCategory();
$countryIns = new BuckysCountry();
$userIns = new BuckysUser();
$shippingInfoIns = new BuckysTradeUser();
$view['product'] = $shopProductIns->getProductById($paramShopID);
$view['myID'] = $userID;
if (!isset($view['product']) || $view['product']['status'] == BuckysShopProduct::STATUS_INACTIVE) {
    buckys_redirect('/shop/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Check if the items owner is active one
$userData = $userIns->getUserData($view['product']['userID']);
if ($userData['status'] == BuckysUser::STATUS_USER_BANNED) {
    buckys_redirect('/shop/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Read more info from DB
$catData = $catIns->getCategoryByID($view['product']['catID']);
$view['product']['categoryName'] = isset($catData) ? $catData['name'] : '';
$countryData = $countryIns->getCountryById($view['product']['locationID']);
$view['product']['locationName'] = isset($countryData) ? $countryData['country_title'] : '';
$view['product']['userInfo'] = $userIns->getUserBasicInfo($view['product']['userID']);
Exemplo n.º 13
0
                $resultXML = ['status' => 'error', 'message' => MSG_INVALID_REQUEST];
                render_result_xml($resultXML);
                exit;
            }
            break;
            //==================== Add New Page ====================//
        //==================== Add New Page ====================//
        case '':
            break;
    }
}
if (isset($_REQUEST['pid']) && is_numeric($_REQUEST['pid'])) {
    //Display page info
    $paramPageID = get_secure_integer($_REQUEST['pid']);
    $paramPostID = isset($_REQUEST['post']) ? get_secure_integer($_REQUEST['post']) : null;
    $paramPostsOnly = isset($_REQUEST['postsonly']) ? get_secure_integer($_REQUEST['postsonly']) : null;
    $view['show_all_post'] = false;
    if ($paramPostsOnly) {
        $view['show_all_post'] = true;
    }
    //View page by ID
    buckys_enqueue_stylesheet('account.css');
    buckys_enqueue_stylesheet('stream.css');
    buckys_enqueue_stylesheet('posting.css');
    buckys_enqueue_stylesheet('uploadify.css');
    buckys_enqueue_stylesheet('jquery.Jcrop.css');
    buckys_enqueue_stylesheet('page.css');
    buckys_enqueue_stylesheet('publisher.css');
    buckys_enqueue_javascript('uploadify/jquery.uploadify.js');
    buckys_enqueue_javascript('jquery.Jcrop.js');
    buckys_enqueue_javascript('jquery.color.js');
Exemplo n.º 14
0
buckys_enqueue_stylesheet('shop.css');
buckys_enqueue_javascript('uploadify/jquery.uploadify.js');
buckys_enqueue_javascript('jquery.Jcrop.js');
buckys_enqueue_javascript('jquery.color.js');
buckys_enqueue_javascript('shop.js');
buckys_enqueue_javascript('shop-edit.js');
buckys_enqueue_javascript('uploadify/flash_install.js');
$TNB_GLOBALS['content'] = 'shop/additem';
$TNB_GLOBALS['headerType'] = 'shop';
$view = [];
$countryIns = new BuckysCountry();
$shopProductIns = new BuckysShopProduct();
$view['category_list'] = BuckysShopCategory::getCategoryList(0);
$view['country_list'] = $countryIns->getCountryList();
$view['action_name'] = 'editProduct';
$paramProdID = get_secure_integer($_REQUEST['id']);
$paramType = get_secure_string($_REQUEST['type']);
$view['product'] = null;
switch ($paramType) {
    case 'relist':
        $userInfo = BuckysUser::getUserBasicInfo($userID);
        $view['my_bitcoin_balance'] = BuckysBitcoin::getUserWalletBalance($userID);
        $view['my_credit_balance'] = $userInfo['credits'];
        $view['product'] = $shopProductIns->getProductById($paramProdID, true);
        $view['type'] = 'relist';
        $view['page_title'] = 'Relist an Item';
        break;
    default:
        $view['product'] = $shopProductIns->getProductById($paramProdID, false);
        $view['type'] = 'edit';
        $view['page_title'] = 'Edit an Item';