/** * Apply For Moderator * * @param Int $userID * @param String $type * @param String $text */ public function applyCandidate($userID, $type, $text) { global $db, $BUCKYS_GLOBALS; if (!in_array($type, $BUCKYS_GLOBALS['moderatorTypes'])) { buckys_redirect('/account.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); return; } $typeID = array_search($type, $BUCKYS_GLOBALS['moderatorTypes']); //Check whether the user has already applied or not $query = $db->prepare("SELECT candidateID FROM " . TABLE_MODERATOR_CANDIDATES . " WHERE userID=%d AND candidateType=%d", $userID, $typeID); $candidateID = $db->getVar($query); if ($candidateID) { buckys_redirect('/moderator.php?type=' . $type, MSG_ALREADY_APPLIED_THE_MODERATOR, MSG_TYPE_ERROR); return; } $text = trim($text); if (!$text) { buckys_redirect('/moderator.php?type=' . $type, MSG_TELL_US_WHY_YOU_WOULD_MAKE_MODERATOR, MSG_TYPE_ERROR); return; } //Save Candidate $newID = $db->insertFromArray(TABLE_MODERATOR_CANDIDATES, array('candidateType' => $typeID, 'userID' => $userID, 'candidateText' => $text, 'votes' => 0, 'appliedDate' => date('Y-m-d H:i:s'))); if (!$newID) { buckys_redirect('/moderator.php?type=' . $type, $db->getLastError(), MSG_TYPE_ERROR); return; } return true; }
} if ($moderatorType == MODERATOR_FOR_TRADE && !BuckysModerator::isModerator($BUCKYS_GLOBALS['user']['userID'], MODERATOR_FOR_TRADE)) { buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == 'delete-objects') { BuckysReport::deleteObjects($_REQUEST['reportID'], $reportType, $moderatorType); buckys_redirect('/reported.php?type=' . $reportType, MSG_REPORTED_OBJECT_REMOVED); } else { if ($_REQUEST['action'] == 'approve-objects') { BuckysReport::approveObjects($_REQUEST['reportID'], $reportType, $moderatorType); buckys_redirect('/reported.php?type=' . $reportType, MSG_REPORTED_OBJECT_APPROVED); } else { if ($_REQUEST['action'] == 'ban-users') { BuckysReport::banUsers($_REQUEST['reportID'], $reportType, $moderatorType); buckys_redirect('/reported.php?type=' . $reportType, MSG_BAN_USERS); } } } exit; } $page = isset($_GET['page']) ? $_GET['page'] : 1; $totalCount = BuckysReport::getReportedObjectCount($reportType); //Init Pagination Class $pagination = new Pagination($totalCount, BuckysReport::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $objects = BuckysReport::getReportedObject($reportType, $page, BuckysReport::$COUNT_PER_PAGE); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('moderator.css'); buckys_enqueue_stylesheet('moderator.css'); buckys_enqueue_stylesheet('prettify.css');
<?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";
<?php require dirname(dirname(__FILE__)) . '/includes/bootstrap.php'; if (!buckys_check_user_acl(USER_ACL_REGISTERED)) { buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } if (isset($_POST['action'])) { if ($_POST['action'] == 'create-topic') { $result = BuckysForumTopic::createTopic($_POST); if ($result == 'publish' || $result == 'pending') { buckys_redirect("/forum", MSG_TOPIC_POSTED_SUCCESSFULLY . ($result == 'pending' ? ' ' . MSG_POST_IS_UNDER_PREVIEW : ''), MSG_TYPE_SUCCESS); } else { buckys_redirect("/forum/create_topic.php", $result, MSG_TYPE_ERROR); } } } $curCatID = isset($_GET['category']) ? $_GET['category'] : 0; $categories = BuckysForumCategory::getAllCategories(); buckys_enqueue_stylesheet('editor/jquery.cleditor.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_javascript('jquery-migrate-1.2.0.js'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); buckys_enqueue_javascript('editor/jquery.cleditor.js'); //buckys_enqueue_javascript('editor/jquery.cleditor.bbcode.js'); $view['action_type'] = 'create'; $BUCKYS_GLOBALS['headerType'] = 'forum'; $BUCKYS_GLOBALS['content'] = 'forum/create_topic'; $BUCKYS_GLOBALS['title'] = 'Create a New Topic - BuckysRoomForum'; require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
<?php require dirname(__FILE__) . '/includes/bootstrap.php'; //Getting Current User ID $userID = buckys_is_logged_in(); $pageIns = new BuckysPage(); $pageFollowerIns = new BuckysPageFollower(); $paramPageID = isset($_GET['pid']) ? intval($_GET['pid']) : null; $pageData = $pageIns->getPageByID($paramPageID); //If the parameter is null, goto homepage if (!buckys_not_null($pageData)) { buckys_redirect('/index.php'); } $page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1; $totalCount = $pageFollowerIns->getNumberOfFollowers($pageData['pageID']); $pagination = new Pagination($totalCount, BuckysPageFollower::COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); //Get Friends $view['followers'] = $pageFollowerIns->getFollowers($pageData['pageID'], $page, BuckysPageFollower::COUNT_PER_PAGE); $view['pageData'] = $pageData; buckys_enqueue_stylesheet('profile.css'); buckys_enqueue_stylesheet('friends.css'); 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_javascript('uploadify/jquery.uploadify.js'); buckys_enqueue_javascript('jquery.Jcrop.js'); buckys_enqueue_javascript('jquery.color.js');
} else { buckys_redirect('/forum/pending_topics.php', $result, MSG_TYPE_ERROR); } } else { if ($action == 'delete-topic') { // Delete Pending Topics //Getting Ids $topicIds = isset($_POST['tid']) ? $_POST['tid'] : null; if (!$topicIds) { buckys_redirect('/forum/pending_topcis.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $result = BuckysForumTopic::deletePendingTopics($topicIds); if ($result === true) { buckys_redirect('/forum/pending_topics.php', MSG_TOPIC_REMOVED_SUCCESSFULLY); } else { buckys_redirect('/forum/pending_topics.php', $result, MSG_TYPE_ERROR); } } } } //Getting Pending Topics $page = isset($_GET['page']) ? $_GET['page'] : 1; $total = BuckysForumTopic::getTotalNumOfTopics('pending'); $pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $topics = BuckysForumTopic::getTopics($page, 'pending', null, null, BuckysForumTopic::$COUNT_PER_PAGE); buckys_enqueue_javascript('jquery-migrate-1.2.0.js'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('publisher.css'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/pending_topics';
//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') { $photoID = $_POST['photoID']; $photo = BuckysPost::getPostById($photoID); //Check Photo Owner if ($photo['poster'] != $userID) { echo MSG_INVALID_REQUEST; exit; } if ($_POST['action'] == 'remove-from-album') { BuckysAlbum::removePhotoFromAlbum($albumID, $photoID); } else { BuckysAlbum::addPhotoToAlbum($albumID, $photoID); } //Add
<?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); } //Action Process if (isset($_POST['action']) && $_POST['action'] == 'submit-post') { //Save Post BuckysPost::savePost($userID, $_POST); if (isset($_POST['pageID']) && is_numeric($_POST['pageID'])) { buckys_redirect('/page.php?pid=' . $_POST['pageID']); } else { buckys_redirect('/account.php'); } } else { if (isset($_GET['action']) && $_GET['action'] == 'delete-post') { //Delete Post if ($userID != $_GET['userID'] || !BuckysPost::deletePost($userID, $_GET['postID'])) { echo 'Invalid Request'; } else { echo 'success'; } exit; } else { if (isset($_GET['action']) && ($_GET['action'] == 'unlikePost' || $_GET['action'] == 'likePost')) { $post = BuckysPost::getPostById($_GET['postID']); if ($post['post_status'] != 1) { render_result_xml(array('status' => 'error', 'message' => MSG_INVALID_REQUEST)); exit; }
} if (isset($_POST['action'])) { if ($_POST['action'] == 'create-topic') { $result = BuckysForumTopic::createTopic($_POST); if (!$result) { buckys_redirect("/forum/create_topic.php", $result, MSG_TYPE_ERROR); } else { $return = isset($_POST['return']) ? base64_decode($_POST['return']) : "/forum/topic.php?id=" . $result; buckys_redirect($return); } } } $curCatID = isset($_GET['category']) ? $_GET['category'] : 0; if (!$curCatID || !($category = BuckysForumCategory::getCategory($curCatID))) { buckys_redirect("/forum", MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } if (BuckysForumModerator::isBlocked($userID, $category['categoryID'])) { buckys_redirect("/forum/category.php?id=" . $category['categoryID'], MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } $categories = BuckysForumCategory::getAllCategories(); buckys_enqueue_stylesheet('sceditor/themes/default.css'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('publisher.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_javascript('sceditor/jquery.sceditor.bbcode.js'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); $view['action_type'] = 'create'; $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/create_topic'; $TNB_GLOBALS['title'] = 'Start a New Topic - thenewboston Forum'; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
$userData = BuckysUser::getUserBasicInfo($userID); if (isset($_GET['to'])) { $receiver = BuckysUser::getUserData($_GET['to']); } 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'] == 'delete_messages') { if (!BuckysMessage::deleteMessages($_POST['messageID'])) { buckys_redirect('/messages_sent.php', "Error: " . $db->getLastError(), MSG_TYPE_ERROR); } else { buckys_redirect('/messages_sent.php', MSG_MESSAGE_REMOVED, MSG_TYPE_SUCCESS); } exit; } } $page = isset($_GET['page']) ? $_GET['page'] : 1; $totalCount = BuckysMessage::getTotalNumOfMessages($userID, 'sent'); //Init Pagination Class $pagination = new Pagination($totalCount, BuckysMessage::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $messages = BuckysMessage::getSentMessages($userID, $page); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('info.css'); buckys_enqueue_stylesheet('messages.css'); buckys_enqueue_javascript('jquery-ui.min.js'); buckys_enqueue_javascript('messages.js');
require dirname(dirname(__FILE__)) . '/includes/bootstrap.php'; //Getting Current User ID if (!buckys_check_user_acl(USER_ACL_REGISTERED)) { buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } $userID = buckys_is_logged_in(); $classAds = new BuckysAds(); //Add Funds if (isset($_POST['action']) && $_POST['action'] == 'add-funds') { if (!buckys_check_form_token()) { buckys_redirect('/ads/advertiser.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $adID = buckys_escape_query_integer($_POST['id']); $adDetail = $classAds->getAdById($adID); if (!$adDetail || $adDetail['ownerID'] != $userID && buckys_check_user_acl(USER_ACL_MODERATOR)) { buckys_redirect('/ads/advertiser.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $result = $classAds->addFunds($userID, $adID, $_POST['amount']); buckys_add_message($classAds->last_message, $result ? MSG_TYPE_SUCCESS : MSG_TYPE_ERROR); } buckys_enqueue_stylesheet('publisher.css'); $adID = buckys_escape_query_integer($_GET['id']); $adDetail = $classAds->getAdById($adID); if (!$adDetail || $adDetail['ownerID'] != $userID && buckys_check_user_acl(USER_ACL_MODERATOR)) { buckys_redirect('/ads/advertiser.php'); } $TNB_GLOBALS['headerType'] = "ads"; $TNB_GLOBALS['content'] = "ads/view"; buckys_enqueue_javascript('jquery.number.js'); $TNB_GLOBALS['title'] = "View Ad - thenewboston Ads"; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
//Confirm that the user is administrator if (!buckys_check_user_acl(USER_ACL_ADMINISTRATOR)) { buckys_redirect('/moderator.php?type=' . $moderatorType, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } //Check the url parameters is correct if (!isset($_GET['id']) || !isset($_GET['idHash']) || !buckys_check_id_encrypted($_GET['id'], $_GET['idHash'])) { buckys_redirect('/moderator.php?type=' . $moderatorType, MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } BuckysModerator::chooseModerator($_GET['id']); buckys_redirect('/moderator.php?type=' . $moderatorType); } //Process Actions if (isset($_POST['action'])) { if ($_POST['action'] == 'apply_candidate') { $newID = BuckysModerator::applyCandidate($userID, $moderatorType, $_POST['moderator_text']); buckys_redirect('/moderator.php?type=' . $moderatorType, MSG_APPLY_JOB_SUCCESSFULLY); } if ($_POST['action'] == 'thumb-up' || $_POST['action'] == 'thumb-down') { if (!$_POST['candidateID'] || !$_POST['candidateIDHash'] || !buckys_check_id_encrypted($_POST['candidateID'], $_POST['candidateIDHash'])) { $data = array('status' => 'error', 'message' => MSG_INVALID_REQUEST); } else { $result = BuckysModerator::voteCandidate($userID, $_POST['candidateID'], $_POST['action'] == 'thumb-up' ? true : false); if (is_int($result)) { $data = array('status' => 'success', 'message' => MSG_THANKS_YOUR_VOTE, 'votes' => ($result > 0 ? "+" : "") . $result); } else { $data = array('status' => 'error', 'message' => $result); } } render_result_xml($data); exit; }
/** * Create new password and send it to user * * @param String $email */ public function resetPassword($email) { global $db; $email = trim($email); if (!$email) { buckys_redirect('/register.php?forgotpwd=1', MSG_EMPTY_EMAIL, MSG_TYPE_ERROR); return; } //Check Email Address if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", $email)) { buckys_redirect('/register.php?forgotpwd=1', MSG_INVALID_EMAIL, MSG_TYPE_ERROR); return false; } $query = $db->prepare("SELECT userID FROM " . TABLE_USERS . " WHERE email=%s", $email); $userID = $db->getVar($query); if (!$userID) { buckys_redirect('/register.php?forgotpwd=1', MSG_EMAIL_NOT_FOUND, MSG_TYPE_ERROR); return false; } $data = BuckysUser::getUserData($userID); //Remove Old Token BuckysUsersToken::removeUserToken($userID, 'password'); //Create New Token $token = BuckysUsersToken::createNewToken($userID, 'password'); $link = "http://" . $_SERVER['HTTP_HOST'] . "/reset_password.php?token=" . $token; //Send an email to user with the link $title = "Reset your password."; $body = "Dear " . $data['firstName'] . " " . $data['lastName'] . "\n\n" . "Please reset your password by using the below link:\n" . $link . "\n\nBuckysroom.com"; require_once DIR_FS_INCLUDES . "phpMailer/class.phpmailer.php"; buckys_sendmail($data['email'], $data['firstName'] . " " . $data['lastName'], $title, $body); buckys_redirect('/register.php', MSG_RESET_PASSWORD_EMAIL_SENT, MSG_TYPE_SUCCESS); return; }
$view['action_name'] = 'editTradeItem'; $paramItemID = get_secure_integer($_REQUEST['id']); $paramType = get_secure_string($_REQUEST['type']); $view['item'] = null; switch ($paramType) { case 'relist': /* $view['no_credits'] = false; if (!$tradeUserIns->hasCredits($userID)) { $view['no_credits'] = true; } */ // Relist trade items with bitcoin or credits - now matches Shop code $userInfo = BuckysUser::getUserBasicInfo($userID); $view['my_bitcoin_balance'] = BuckysBitcoin::getUserWalletBalance($userID); $view['my_credit_balance'] = $userInfo['credits']; $view['item'] = $tradeItemIns->getItemById($paramItemID, true); $view['type'] = 'relist'; $view['page_title'] = 'Relist an Item'; break; default: $view['item'] = $tradeItemIns->getItemById($paramItemID, false); $view['type'] = 'edit'; $view['page_title'] = 'Edit an Item'; break; } if ($view['item'] == null || $view['item']['userID'] != $userID || $view['item']['status'] != BuckysTradeItem::STATUS_ITEM_ACTIVE) { buckys_redirect('/trade/available.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } $TNB_GLOBALS['title'] = 'Edit an Item - BuckysRoomTrade'; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
if (!($userID = buckys_is_logged_in())) { buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR); } //Getting UserData from Id $userData = BuckysUser::getUserData($profileID); //Getting Albums $albums = BuckysAlbum::getAlbumsByUserId($userID); if (isset($_POST['action'])) { //Create New Album if ($_POST['action'] == 'create-album') { //If the album title is empty, throw error if (trim($_POST['new_album_name']) == '') { buckys_redirect('/photo_albums.php', MSG_ALBUM_TITLE_EMPTY, MSG_TYPE_ERROR); } $newId = BuckysAlbum::createAlbum($userID, trim($_POST['new_album_name']), $_POST['visibility']); buckys_redirect('/photo_albums.php'); } else { if ($_POST['action'] == 'delete-album') { if (BuckysAlbum::deleteAlbum($_POST['albumID'], $userID)) { echo 'success'; } else { echo 'error'; } exit; } } } buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('posting.css'); buckys_enqueue_javascript('album.js'); $BUCKYS_GLOBALS['content'] = 'photo_albums';
$password = trim($_POST['password']); $info = buckys_get_user_by_email($email); if (buckys_not_null($info)) { if (!buckys_validate_password($password, $info['password'])) { buckys_redirect('/register.php', MSG_INVALID_LOGIN_INFO, MSG_TYPE_ERROR); } else { if ($info['status'] == 0) { //Account Not Verified or Banned buckys_redirect('/index.php', !$info['token'] ? MSG_ACCOUNT_BANNED : MSG_ACCOUNT_NOT_VERIFIED, MSG_TYPE_ERROR); } else { //Login Success //Clear Login Attemps BuckysTracker::clearLoginAttemps(); $_SESSION['userID'] = $info['userID']; //Init Some Session Values $_SESSION['converation_list'] = array(); //If the keep me signed in is checked, save data to cookie if ($_POST['keep_sign_in'] == 1) { setcookie('bkuid0', base64_encode($info['userID']), time() + COOKIE_LIFETIME, "/", "buckysroom.com"); $uidEncrypted = buckys_encrypt_id($info['userID']); setcookie('bkuid1', base64_encode($uidEncrypted), time() + COOKIE_LIFETIME, "/", "buckysroom.com"); setcookie('bkuid2', base64_encode($_SESSION['user_encrypt_salt']), time() + COOKIE_LIFETIME, "/", "buckysroom.com"); } buckys_redirect('/account.php'); } } } else { //Email Incorrect buckys_redirect('/register.php', MSG_INVALID_LOGIN_INFO, MSG_TYPE_ERROR); } }
foreach ($_POST['link_title'] as $i => $link_title) { $link_url = $_POST['link_url'][$i]; if (!$link_url || !$link_title) { continue; } BuckysForumCategory::saveCategoryLink($categoryID, $link_title, $link_url); } } buckys_redirect("/forum/category.php?id=" . $categoryID, MSG_FORUM_SAVED, MSG_TYPE_SUCCESS); } $categoryID = isset($_GET['id']) ? $_GET['id'] : null; if ($categoryID != null) { $category = BuckysForumCategory::getCategory($categoryID); //Check Permission if (!$category || !buckys_is_admin() && !buckys_is_moderator() && !buckys_is_forum_admin($category['categoryID']) && !buckys_is_forum_moderator($category['categoryID'])) { buckys_redirect('/forum', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } } buckys_enqueue_stylesheet('sceditor/themes/default.css'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('posting.css'); buckys_enqueue_stylesheet('publisher.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_stylesheet('jquery.Jcrop.css'); buckys_enqueue_javascript('sceditor/jquery.sceditor.bbcode.js'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); buckys_enqueue_javascript('jquery.Jcrop.js'); buckys_enqueue_javascript('edit_forum.js'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/edit_category'; if (!$categoryID) {
$userData = BuckysUser::getUserData($userID); if (!buckys_validate_password($_REQUEST['pwd'], $userData['password'])) { buckys_redirect($return, MSG_CURRENT_PASSWORD_NOT_CORRECT, MSG_TYPE_ERROR); } BuckysForumCategory::deleteCategory($category['categoryID']); buckys_redirect("/forum", MSG_REMOVE_FORUM_SUCCESS); } } } } } } } } } } //Admin, Site Moderator, Category Admin and Category Moderator can't apply if (!(buckys_is_admin() || buckys_is_moderator() || buckys_is_forum_admin($category['categoryID']) || buckys_is_forum_moderator($category['categoryID']))) { buckys_redirect('/forum/category.php?id=' . $categoryID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } //Getting Reported Posts $reported_posts = BuckysForumModerator::getReportedArticles($categoryID); //Getting Applicants $applicants = BuckysForumModerator::getApplicants($categoryID); $blockedUsers = BuckysForumModerator::getBlockedUsers($categoryID); buckys_enqueue_stylesheet('sceditor/themes/default.css'); buckys_enqueue_stylesheet('forum.css'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/moderator'; $TNB_GLOBALS['title'] = $category['categoryName'] . ' Moderator Panel - thenewboston Forum'; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
$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); } $topicData = BuckysForumTopic::getTopic($replyData['replyID']); $category = BuckysForumCategory::getCategory($topicData['categoryID']); $categories = BuckysForumCategory::getAllCategories(); buckys_enqueue_stylesheet('sceditor/themes/default.css'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('publisher.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_javascript('sceditor/jquery.sceditor.bbcode.js'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/post_reply'; $TNB_GLOBALS['title'] = 'Post Reply - thenewboston Forum'; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
/** * Purchase product function * this function is POST */ function purchaseProduct() { $productIns = new BuckysShopProduct(); $orderIns = new BuckysShopOrder(); $buyerID = get_secure_integer($_REQUEST['buyerID']); $productID = get_secure_integer($_REQUEST['productID']); $userID = buckys_is_logged_in(); //Can you purchase this item? if ($buyerID != $userID) { buckys_redirect('/shop/view.php?id=' . $productID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } //Product is active? $prodData = $productIns->getProductById($productID, false); if (!$prodData || $prodData['status'] == BuckysShopProduct::STATUS_INACTIVE) { echo "here"; exit; buckys_redirect('/shop/index.php' . $productID, MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } //Is this your product? if ($prodData['userID'] == $buyerID) { buckys_redirect('/shop/view.php?id=' . $productID, MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } //Shipping price is set? if (!$prodData['isDownloadable']) { $shippingPrice = fn_buckys_get_available_shipping_price($buyerID, $productID); if ($shippingPrice === null) { buckys_redirect('/shop/view.php?id=' . $productID, 'This item can not be shipped to your address. Check your shipping address or contact the owner.', MSG_TYPE_ERROR); } } else { $shippingPrice = 0; } //Do you have money? $balance = BuckysBitcoin::getUserWalletBalance($buyerID); $balance = 100; $total = $prodData['price'] + $shippingPrice; if ($total > $balance) { buckys_redirect('/shop/view.php?id=' . $productID, 'You do not have bitcoin enough to purchase this item.', MSG_TYPE_ERROR); } //Purchase product $flag = $orderIns->makePayment($buyerID, $prodData['userID'], $total); if ($flag) { if (!$prodData['isDownloadable']) { $buyerShippingInfoID = $orderIns->createShippingInfo($buyerID); } else { $buyerShippingInfoID = 0; } $param = ['sellerID' => $prodData['userID'], 'buyerID' => $buyerID, 'productID' => $productID, 'unitPrice' => $prodData['price'], 'shippingPrice' => $shippingPrice, 'totalPrice' => $total, 'buyerShippingID' => $buyerShippingInfoID, 'trackingNo' => '', 'createdDate' => date('Y-m-d H:i:s'), 'status' => BuckysShopOrder::STATUS_SOLD]; if ($orderIns->createOrder($param)) { buckys_redirect('/shop/purchase.php', 'You have purchased an item successfully!', MSG_TYPE_SUCCESS); } else { buckys_redirect('/shop/view.php?id=' . $productID, 'Something goes wrong with your purchase. Please contact customer support!', MSG_TYPE_ERROR); } } else { buckys_redirect('/shop/view.php?id=' . $productID, 'Payment problem. Please contact customer support!', MSG_TYPE_ERROR); } }
$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); } if (!$is_error) { $bitcoinClass->sendBitcoin($userID, $toAddress, $amount); } buckys_redirect("/wallet.php"); } $page = isset($_GET['page']) ? $_GET['page'] : 1; list($totalCount, $bitcoinBalance, $transactions) = $bitcoinClass->getTransactions($userID, $page, $bitcoinClass->COUNT_PER_PAGE); if (!$bitcoinBalance) { $bitcoinBalance = 0; } //Init Pagination Class $pagination = new Pagination($totalCount, $bitcoinClass->COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); //Getting Balance //$bitcoinBalance = $bitcoinClass->getWalletBalance($bitcoinInfo['bitcoin_guid'], buckys_decrypt($bitcoinInfo['bitcoin_password'])); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('credits.css'); buckys_enqueue_javascript('wallet.js'); $TNB_GLOBALS['content'] = 'wallet';
<?php require dirname(dirname(__FILE__)) . '/includes/bootstrap.php'; //Getting Current User ID if (!buckys_check_user_acl(USER_ACL_REGISTERED)) { buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } $userID = buckys_is_logged_in(); $adClass = new BuckysAds(); if (isset($_POST['action']) && $_POST['action'] == 'create-ad') { if (!buckys_check_form_token()) { buckys_redirect('/ads/create_ad.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } else { if ($adClass->saveAd($userID, $_POST)) { buckys_redirect('/ads/advertiser.php?status=pending', $adClass->last_message); } else { buckys_redirect('/ads/create_ad.php?type=' . $_POST['type'], $adClass->last_message, MSG_TYPE_ERROR); } } } $adSizes = $adClass->getAdSizes(); $adType = isset($_GET['type']) && $_GET['type'] == 'Image' ? 'Image' : 'Text'; buckys_enqueue_stylesheet('publisher.css'); buckys_enqueue_stylesheet('uploadify.css'); buckys_enqueue_javascript('uploadify/jquery.uploadify.js'); buckys_enqueue_javascript('jquery.number.js'); buckys_enqueue_javascript('create_ad.js'); $TNB_GLOBALS['headerType'] = "ads"; $TNB_GLOBALS['content'] = "ads/create_ad"; $TNB_GLOBALS['title'] = "Create New Ad - thenewboston Ads"; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
/** * Apply For Moderator * * @param $candidateID * @param Int $userID * @param String $text * @return bool|void */ public static function updateCandidate($candidateID, $userID, $text) { global $db; //Check whether the user has already applied or not $query = $db->prepare("SELECT candidateID FROM " . TABLE_MODERATOR_CANDIDATES . " WHERE userID=%d AND candidateID=%d", $userID, $candidateID); $candidateID = $db->getVar($query); if (!$candidateID) { buckys_redirect('/moderator.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); return; } $text = trim($text); if (!$text) { buckys_redirect('/moderator.php', MSG_TELL_US_WHY_YOU_WOULD_MAKE_MODERATOR, MSG_TYPE_ERROR); return; } //Save Candidate $newID = $db->updateFromArray(TABLE_MODERATOR_CANDIDATES, ['candidateText' => $text], ['candidateID' => $candidateID]); if (!$newID) { buckys_redirect('/moderator.php', $db->getLastError(), MSG_TYPE_ERROR); return; } return true; }
<?php require_once dirname(dirname(__FILE__)) . '/includes/bootstrap.php'; if (!($userID = buckys_is_logged_in())) { buckys_redirect("/forum/home.php", MSG_INVALID_REQUEST); } //Getting Topics by category id $page = isset($_GET['page']) ? $_GET['page'] : 1; $total = BuckysForumTopic::getTotalNumOfUserTopics($userID); $pagination = new Pagination($total, BuckysForumTopic::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $topics = BuckysForumTopic::getUserTopics($userID, $page, 'lastReplyDate DESC, t.createdDate DESC', BuckysForumTopic::$COUNT_PER_PAGE); buckys_enqueue_javascript('jquery-migrate-1.2.0.js'); buckys_enqueue_stylesheet('forum.css'); buckys_enqueue_stylesheet('publisher.css'); $TNB_GLOBALS['headerType'] = 'forum'; $TNB_GLOBALS['content'] = 'forum/home'; $TNB_GLOBALS['title'] = 'My Forum Feed - thenewboston Forum'; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
} exit; } if (BuckysFriend::sendFriendRequest($userID, $friendID)) { if ($isAjax) { $resultXML = ['status' => 'success', 'message' => MSG_FRIEND_REQUEST_SENT, 'html' => 'Delete Friend Request', 'action' => 'send-friend-request', 'link' => '/myfriends.php?action=delete&friendID=' . $friendID . buckys_get_token_param()]; render_result_xml($resultXML); } else { buckys_redirect($return, MSG_FRIEND_REQUEST_SENT); } } else { 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 {
<?php require dirname(dirname(__FILE__)) . '/includes/bootstrap.php'; //Getting Current User ID if (!buckys_check_user_acl(USER_ACL_REGISTERED)) { buckys_redirect('/register.php'); } $classAds = new BuckysAds(); $userID = buckys_is_logged_in(); $page = isset($_GET['page']) ? buckys_escape_query_integer($_GET['page']) : 1; $status = isset($_GET['status']) ? buckys_escape_query_string($_GET['status']) : 'active'; $activeAdsCount = $classAds->getUserAdsCount($userID, 'active'); $pendingAdsCount = $classAds->getUserAdsCount($userID, 'pending'); $expiredAdsCount = $classAds->getUserAdsCount($userID, 'expired'); switch ($status) { case 'active': $totalCount = $activeAdsCount; break; case 'pending': $totalCount = $pendingAdsCount; break; case 'expired': $totalCount = $expiredAdsCount; break; } $pagination = new Pagination($totalCount, BuckysAds::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $userAds = $classAds->getUserAds($userID, $status, $page, BuckysAds::$COUNT_PER_PAGE); buckys_enqueue_stylesheet('publisher.css'); $TNB_GLOBALS['headerType'] = "ads"; $TNB_GLOBALS['content'] = "ads/advertiser";
<?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); } $view = []; //Save Shipping info $tradeUserIns = new BuckysTradeUser(); if (isset($_POST['action']) && $_POST['action'] == 'saveNotifyInfo') { $result = BuckysUser::saveUserNotificationSettings($userID, $_POST); if ($result === true) { buckys_redirect('/notify.php', MSG_NOTIFICATION_SETTINGS_SAVED); } else { buckys_redirect('/notify.php', $result, MSG_TYPE_ERROR); } } //Get offer_received info $view['trade_user_info'] = $tradeUserIns->getUserByID($userID); $userNotifyInfo = BuckysUser::getUserNotificationSettings($userID); if (empty($view['trade_user_info'])) { buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('info.css'); $TNB_GLOBALS['content'] = 'notify'; $TNB_GLOBALS['title'] = 'Notification Settings - ' . TNB_SITE_NAME; require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
//Change user profile image if ($_POST['photo_visibility'] == 2) { if (!$photo['is_profile']) { BuckysPost::createProfileImage($photo, $_POST); } //Update profile image with old one BuckysUser::updateUserFields($userID, array('thumbnail' => $photo['image'])); } else { if ($userData['thumbnail'] == $photo['image']) { //If it was a profile image and now it is not, remove it from the profile image BuckysUser::updateUserFields($userID, array('thumbnail' => '')); } } //Save Album if (isset($_POST['album']) && $_POST['album'] != '' && isset($albums[$_POST['album']])) { BuckysAlbum::addPhotoToAlbum($_POST['album'], $photo['postID']); } buckys_redirect('/photo_edit.php?photoID=' . $photo['postID'], MSG_PHOTO_UPDATED, MSG_TYPE_SUCCESS); exit; } } $set_profile = isset($_GET['set_profile']) ? $_GET['set_profile'] : null; buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('posting.css'); buckys_enqueue_stylesheet('jquery.Jcrop.css'); buckys_enqueue_javascript('jquery.Jcrop.js'); buckys_enqueue_javascript('jquery.color.js'); buckys_enqueue_javascript('edit_photo.js'); $BUCKYS_GLOBALS['content'] = 'photo_edit'; $BUCKYS_GLOBALS['title'] = "Edit Photo - BuckysRoom"; require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
//Getting Current User ID if (!buckys_check_user_acl(USER_ACL_MODERATOR)) { buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR); } $classAds = new BuckysAds(); if (isset($_REQUEST['action'])) { if (!buckys_check_form_token()) { buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR); } if ($_REQUEST['action'] == 'reject-ads') { $classAds->rejectAds($_REQUEST['adID']); buckys_redirect('/manage_ads.php', MSG_AD_ADS_REJECTED); } else { if ($_REQUEST['action'] == 'approve-ads') { $classAds->approveAds($_REQUEST['adID']); buckys_redirect('/manage_ads.php', MSG_AD_ADS_APPROVED); } } } $page = isset($_GET['page']) ? $_GET['page'] : 1; $totalCount = $classAds->getPendingAdsCount(); //Init Pagination Class $pagination = new Pagination($totalCount, BuckysAds::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $objects = $classAds->getPendingAds($page, BuckysAds::$COUNT_PER_PAGE); buckys_enqueue_javascript('manage_ads.js'); buckys_enqueue_stylesheet('account.css'); buckys_enqueue_stylesheet('moderator.css'); buckys_enqueue_stylesheet('publisher.css'); $TNB_GLOBALS['content'] = 'manage_ads'; $TNB_GLOBALS['title'] = "Moderator Panel";
} $forumTopicIns = new BuckysForumTopic(); $forumTopicIns->moveTopic($topicID, $catID); buckys_redirect('/forum/topic.php?id=' . $topicID, MSG_TOPIC_MOVED_SUCCESSFULLY); } } } $topicID = isset($_GET['id']) ? buckys_escape_query_integer($_GET['id']) : 0; $topic = BuckysForumTopic::getTopic($topicID); if (!$topic) { buckys_redirect('/forum'); } $category = BuckysForumCategory::getCategory($topic['categoryID']); //If the topic is not published(pending or suspended), only forum moderator and administrator can see this if ($topic['status'] != 'publish' && !buckys_is_moderator() && $TNB_GLOBALS['user']['userID'] != $topic['creatorID']) { buckys_redirect('/forum'); } $orderBy = isset($_GET['orderby']) ? buckys_escape_query_string($_GET['orderby']) : 'oldest'; //Getting Replies $page = isset($_GET['page']) ? buckys_escape_query_integer($_GET['page']) : 1; $total = BuckysForumReply::getTotalNumOfReplies($topic['topicID'], 'publish'); $pagination = new Pagination($total, BuckysForumReply::$COUNT_PER_PAGE, $page); $page = $pagination->getCurrentPage(); $replies = BuckysForumReply::getReplies($topic['topicID'], 'publish', $page, $orderBy); $hierarchical = BuckysForumCategory::getCategoryHierarchical($topic['categoryID']); //Mark Forum Notifications to read if (buckys_check_user_acl(USER_ACL_REGISTERED)) { BuckysForumNotification::makeNotificationsToRead($TNB_GLOBALS['user']['userID'], null, $topic['topicID']); } if (buckys_check_user_acl(USER_ACL_MODERATOR)) { $reportID = BuckysReport::isReported($topicID, 'topic');