/** * Edit topic * * @param mixed $data */ public function editTopic($data) { global $db, $BUCKYS_GLOBALS; $title = get_secure_string($data['title']); $category = get_secure_string($data['category']); $content = trim($data['content']); if (!$title || !$category || !$content || !isset($data['id'])) { return MSG_ALL_FIELDS_REQUIRED; } //Check Category ID is valid or not $query = $db->prepare("SELECT categoryID FROM " . TABLE_FORUM_CATEGORIES . " WHERE categoryID=%d", $category); $categoryID = $db->getVar($query); if (!$categoryID) { return MSG_INVALID_REQUEST; } $content = BuckysForumTopic::_convertHTMLToBBCode($content); $updateData = array('topicTitle' => $title, 'topicContent' => $content, 'categoryID' => $categoryID); $db->updateFromArray(TABLE_FORUM_TOPICS, $updateData, array('topicID' => $data['id'])); return true; }
/** * Edit topic * * @param mixed $data * @return bool|string */ public function editTopic($data) { global $db, $TNB_GLOBALS; $title = get_secure_string($data['title']); $category = get_secure_string($data['category']); $content = $data['content']; if (!$title || !$category || !$content || !isset($data['id'])) { return MSG_ALL_FIELDS_REQUIRED; } //Check Category ID is valid or not $query = $db->prepare("SELECT categoryID FROM " . TABLE_FORUM_CATEGORIES . " WHERE categoryID=%d", $category); $categoryID = $db->getVar($query); if (!$categoryID) { return MSG_INVALID_REQUEST; } $content = buckys_remove_tags_inside_code($content); //Remove Invalid Image URLs $content = buckys_remove_invalid_image_urls($content); $query = "UPDATE " . TABLE_FORUM_TOPICS . " SET \n `topicTitle`='" . $db->escapeInput($title) . "',\n `topicContent`='" . $db->escapeInput($content, false) . "',\n `categoryID`='" . $db->escapeInput($categoryID) . "'\n WHERE\n `topicID`='" . $db->escapeInput($data['id']) . "'"; $db->query($query); // $db->updateFromArray(TABLE_FORUM_TOPICS, $updateData, array('topicID'=>$data['id'])); return true; }
<?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";
/** * Save feedback; */ function saveFeedback() { $userID = buckys_is_logged_in(); if (!$userID) { //You should be logged in return; } else { $feedbackIns = new BuckysFeedback(); $tradeID = get_secure_integer($_REQUEST['tradeID']); $score = get_secure_string($_REQUEST['score']); $feedback = get_secure_string($_REQUEST['feedback']); $feedbackID = $feedbackIns->addFeedback($userID, $score, $feedback, $tradeID, BuckysFeedback::ACTIVITY_TYPE_TRADE); 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."]); } } }
/** * 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."]); } } }
<?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";
echo json_encode(['success' => 1, 'msg' => MSG_CONTENT_UPDATED_SUCCESS, 'content' => $paramContent, 'content_display' => render_enter_to_br($paramContent)]); } else { if (empty($pageData)) { //No such page exists echo json_encode(['success' => 0, 'msg' => MSG_NO_SUCH_PAGE]); } else { //You don't have permission to update content echo json_encode(['success' => 0, 'msg' => MSG_NO_PERMISSION_TO_EDIT_PAGE]); } } exit; //=============== Update Page Title by Ajax ===================// //=============== Update Page Title by Ajax ===================// case 'updatePageTitle': $paramPageID = get_secure_integer($_REQUEST['pageID']); $paramContent = get_secure_string($_REQUEST['content']); $pageData = $pageIns->getPageByID($paramPageID); if ($pageData && $pageData['userID'] == $userID) { $data['title'] = $paramContent; $pageIns->updateData($paramPageID, $data); echo json_encode(['success' => 1, 'msg' => MSG_CONTENT_UPDATED_SUCCESS, 'content' => strip_tags($paramContent)]); } else { if (empty($pageData)) { //No such page exists echo json_encode(['success' => 0, 'msg' => MSG_NO_SUCH_PAGE]); } else { //You don't have permission to update content echo json_encode(['success' => 0, 'msg' => MSG_NO_PERMISSION_TO_EDIT_PAGE]); } } exit;
<?php require dirname(__FILE__) . '/includes/bootstrap.php'; buckys_enqueue_stylesheet('search.css'); buckys_enqueue_javascript('search.js'); $searchIns = new BuckysSearch(); $BUCKYS_GLOBALS['content'] = 'search'; $BUCKYS_GLOBALS['headerType'] = ''; $paramQueryStr = get_secure_string($_REQUEST['q'], true); $paramType = get_secure_string($_REQUEST['type'], true); $paramSort = get_secure_string($_REQUEST['sort'], true); $view = array(); //Create Base URL for pagination of search page $view['page_base_url'] = buckys_pp_search_url($paramQueryStr, $paramType, $paramSort, true); $page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1; $totalCount = $searchIns->getNumberOfSearchResult($paramQueryStr, $paramType); $pagination = new Pagination($totalCount, BuckysSearch::SEARCH_RESULT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); //Get Friends $view['search_result'] = $searchIns->search($paramQueryStr, $paramType, $paramSort, $page); //Display $BUCKYS_GLOBALS['searchParamPP']['q'] = $paramQueryStr; $BUCKYS_GLOBALS['searchParamPP']['type'] = $paramType; $BUCKYS_GLOBALS['searchParamPP']['sort'] = $paramSort; if ($paramQueryStr != '') { $BUCKYS_GLOBALS['title'] = $paramQueryStr . ' - BuckysRoom Search'; } else { $BUCKYS_GLOBALS['title'] = 'BuckysRoom Search'; } require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
/** * Save feedback; * */ function saveFeedback() { $userID = buckys_is_logged_in(); if (!$userID) { //You should be logged in echo json_encode(array('success' => 0, 'msg' => "Please sign in to leave feedback.")); } else { $tradeFeedbackIns = new BuckysTradeFeedback(); $tradeID = get_secure_integer($_REQUEST['tradeID']); $score = get_secure_string($_REQUEST['score']); $feedback = get_secure_string($_REQUEST['feedback']); $feedbackData = $tradeFeedbackIns->getFeedbackByTradeID($tradeID); if (!$feedbackData) { //Add new $tradeFeedbackID = $tradeFeedbackIns->addFeedback($tradeID, $userID, $score, $feedback); if (empty($tradeFeedbackID)) { echo json_encode(array('success' => 0, 'msg' => "You do not have permission.")); } else { echo json_encode(array('success' => 1, 'msg' => "You have leaved feedback successfully.")); } } else { //Update existing $tradeFeedbackID = $tradeFeedbackIns->updateFeedback($feedbackData['feedbackID'], $userID, $score, $feedback); if (empty($tradeFeedbackID)) { echo json_encode(array('success' => 0, 'msg' => "You do not have permission.")); } else { echo json_encode(array('success' => 1, 'msg' => "You have leaved feedback successfully.")); } } } }