本文整理汇总了PHP中buckys_is_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP buckys_is_logged_in函数的具体用法?PHP buckys_is_logged_in怎么用?PHP buckys_is_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buckys_is_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTrack
public function addTrack($action = 'login')
{
global $db;
$userID = buckys_is_logged_in();
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
$db->insertFromArray(TABLE_TRACKER, array('userID' => !$userID ? 0 : $userID, 'ipAddr' => $ip, 'trackedTime' => $time, 'action' => $action));
}
示例2: isFollow
/**
* @param $categoryID
* @param null $userID
* @return one
*/
public static function isFollow($categoryID, $userID = null)
{
global $db;
if (!$userID) {
$userID = buckys_is_logged_in();
}
$query = $db->prepare("SELECT id FROM " . TABLE_FORUM_FOLLOWERS . " WHERE categoryID=%d AND userID=%d", $categoryID, $userID);
$id = $db->getVar($query);
return $id;
}
示例3: getPostComments
public function getPostComments($postID, $last_date = null)
{
global $db;
$userID = buckys_is_logged_in();
if (!$last_date) {
$last_date = date('Y-m-d H:i:s');
}
$query = $db->prepare("SELECT c.*, CONCAT(u.firstName, ' ', u.lastName) as fullName, p.poster, r.reportID FROM " . TABLE_POSTS_COMMENTS . " as c " . "LEFT JOIN " . TABLE_USERS . " as u on u.userID=c.commenter " . "LEFT JOIN " . TABLE_POSTS . " as p on p.postID=c.postID " . "LEFT JOIN " . TABLE_REPORTS . " as r on r.objectID=c.commentID AND r.objectType='comment' AND r.reporterID=%d " . "WHERE c.commentStatus=1 AND c.postID=%s AND c.posted_date < %s Order By c.posted_date DESC LIMIT 5 ", !$userID ? 0 : $userID, $postID, $last_date);
$rows = $db->getResultsArray($query);
return $rows;
}
示例4: addTrack
/**
* @param string $action
*/
public static function addTrack($action = 'login')
{
global $db;
$userID = buckys_is_logged_in();
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if ($ip != '127.0.0.1') {
$db->insertFromArray(TABLE_TRACKER, ['userID' => !$userID ? 0 : $userID, 'ipAddr' => $ip, 'trackedTime' => $time, 'action' => $action]);
}
return;
}
示例5: getReportedItemsCount
/**
* @return array
*/
public static function getReportedItemsCount()
{
global $db;
$userID = buckys_is_logged_in();
if (!$userID) {
return [];
}
if (buckys_is_admin() || buckys_is_moderator()) {
$categoryWhere = '';
} else {
//Getting the categories that user can moderate
$query = $db->prepare("SELECT categoryID FROM " . TABLE_FORUM_MODERATORS . " WHERE userID=%d", $userID);
$categories = $db->getResultsArray($query);
if (!$categories) {
return [];
}
$categoryWhere = [];
foreach ($categories as $c) {
$categoryWhere[] = $c['categoryID'];
}
$categoryWhere = ' AND t.categoryID IN (' . implode(',', $categories) . ')';
}
$query = "SELECT count(DISTINCT(r.reportID)) AS c, t.categoryID\n FROM " . TABLE_REPORTS . " AS r " . "LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=r.objectID " . "WHERE r.objectType='topic' AND r.reportStatus=1 " . $categoryWhere . " GROUP BY categoryID ";
$topics = $db->getResultsArray($query);
$query = "SELECT count(DISTINCT(r.reportID)) AS c, t.categoryID\n FROM " . TABLE_REPORTS . " AS r " . "LEFT JOIN " . TABLE_FORUM_REPLIES . " AS fr ON fr.replyID=r.objectID " . "LEFT JOIN " . TABLE_FORUM_TOPICS . " AS t ON t.topicID=fr.topicID " . "WHERE r.objectType='reply' AND r.reportStatus=1 " . $categoryWhere . " GROUP BY categoryID ";
$replies = $db->getResultsArray($query);
$results = [];
foreach ($topics as $row) {
if (!isset($results[$row['categoryID']])) {
$results[$row['categoryID']] = 0;
}
$results[$row['categoryID']] += $row['c'];
}
foreach ($replies as $row) {
if (!isset($results[$row['categoryID']])) {
$results[$row['categoryID']] = 0;
}
$results[$row['categoryID']] += $row['c'];
}
return $results;
}
示例6: dirname
<?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');
示例7: getNumberOfPhotosByUserID
/**
* Get Number of photos
*
* @param integer $profileID
* @param integer $pageID
* @param integer $albumID
* @return one
*/
public static function getNumberOfPhotosByUserID($profileID, $pageID = BuckysPost::INDEPENDENT_POST_PAGE_ID, $albumID = null)
{
global $db;
$userID = buckys_is_logged_in();
if (buckys_not_null($userID) && ($userID == $profileID || BuckysFriend::isFriend($profileID, $userID))) {
$query = $db->prepare("SELECT count(DISTINCT(p.postID)) FROM " . TABLE_POSTS . " AS p LEFT JOIN " . TABLE_ALBUMS_PHOTOS . " AS pa ON pa.post_id = p.postID WHERE p.type='image' AND p.poster=%d AND pageID=%d", $profileID, $pageID);
} else {
$query = $db->prepare("SELECT count(DISTINCT(p.postID)) FROM " . TABLE_POSTS . " AS p LEFT JOIN " . TABLE_ALBUMS_PHOTOS . " AS pa ON pa.post_id = p.postID WHERE p.type='image' AND p.poster=%d AND p.visibility=1 AND pageID=%d", $profileID, $pageID);
}
if (buckys_not_null($albumID)) {
$query .= $db->prepare(" AND pa.album_id=%d", $albumID);
}
$count = $db->getVar($query);
return $count;
}
示例8: buckys_redirect
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';
}
if ($userID != buckys_is_logged_in()) {
$baseURLParts[] = "user=" . $userID;
}
$baseURL = '/feedback.php';
if (count($baseURLParts) > 0) {
$baseURL .= '?' . implode('&', $baseURLParts);
}
$view = [];
$feedbackIns = new BuckysFeedback();
$view['feedback'] = $feedbackIns->getFeedbackByUserID($userID, $paramType);
$view['feedback'] = fn_buckys_pagination($view['feedback'], $baseURL, $paramCurrentPage, COMMON_ROWS_PER_PAGE);
$view['myID'] = $userID;
$view['type'] = $paramType;
$view['myRatingInfo'] = $feedbackIns->getUserRating($userID);
$userData = $userIns->getUserBasicInfo($userID);
if ($userData) {
示例9: saveFeedback
/**
* 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."]);
}
}
}
示例10: isVoted
/**
* @param $topicID
* @param null $userID
* @return one
*/
public function isVoted($topicID, $userID = null)
{
global $db;
if (!$userID) {
$userID = buckys_is_logged_in();
}
$query = $db->prepare("SELECT voteID FROM " . TABLE_FORUM_VOTES . " WHERE objectID=%d AND voterID=%d AND objectType='topic'", $topicID, $userID);
$vid = $db->getVar($query);
return $vid;
}
示例11: render_result_messages
</script>
<!-- End DigiCert site seal HTML and JavaScript -->
</div>
</aside>
<section id="right_side" class="right_side_narrow" style="border-left:none;">
<div class="home-inner">
<?php
render_result_messages();
?>
<div class="banner-section">
<?php
if (buckys_is_logged_in()) {
echo '<a href="/shop/search.php"><img src="/images/shopHomePageBanner.jpg"></a>';
} else {
echo '<a href="/register.php"><img src="/images/shopHomePageBanner_3.jpg"></a>';
}
?>
</div>
<div class="clear"></div>
<div class="home-block top-ten-products">
<div class="pb10">
<span class="titles">Newest Items</span> <span><a href="/shop/search.php?sort=newly"
class="gray">(view more)</a></span>
</div>
示例12: render_footer_link_content
function render_footer_link_content($type, $data, $outFlag = true)
{
$userID = buckys_is_logged_in();
ob_start();
switch ($type) {
case 'my':
foreach ($data as $row) {
echo BuckysActivity::getActivityHTML($row, $userID);
}
echo '<a class="view-detail-links" href="/account.php">View All Notifications</a>';
break;
case 'friend':
$count = 0;
foreach ($data as $row) {
$count++;
if ($count > 5) {
break;
}
?>
<div class="activityComment">
<a href="/profile.php?user=<?php
echo $row['userID'];
?>
"><img
src="<?php
echo BuckysUser::getProfileIcon($row);
?>
"
class="dropDownNotificationImages"/></a> <a
href="/profile.php?user=<?php
echo $row['userID'];
?>
"><?php
echo $row['fullName'];
?>
</a> sent you new friend request
<a href="/myfriends.php?action=decline&friendID=<?php
echo $row['userID'];
echo buckys_get_token_param();
?>
&return=<?php
echo base64_encode("/profile.php?user=" . $row['userID']);
?>
"
class="redButton">Decline</a> <a
href="/myfriends.php?action=accept&friendID=<?php
echo $row['userID'];
echo buckys_get_token_param();
?>
&return=<?php
echo base64_encode("/profile.php?user=" . $row['userID']);
?>
"
class="redButton">Approve</a> <br clear="all"/>
</div>
<?php
}
?>
<a class="view-detail-links" href="/myfriends.php?type=requested"> View All Requests </a>
<?php
break;
case 'forum':
foreach ($data as $idx => $row) {
?>
<?php
if ($row['activityType'] == 'topic_approved' || $row['activityType'] == 'reply_approved') {
?>
<div class="activityComment">
<span>
<a href="/profile.php?user=<?php
echo $row['userID'];
?>
"><img
src="<?php
echo BuckysUser::getProfileIcon($TNB_GLOBALS['user']['userID']);
?>
"
class="dropDownNotificationImages"/></a>
<!-- <span class="redBold"><?php
echo $TNB_GLOBALS['user']['firstName'] . " " . $TNB_GLOBALS['user']['lastName'];
?>
</span> <br />-->
<?php
if ($row['activityType'] == 'topic_approved') {
?>
Your topic
<a href="/forum/topic.php?id=<?php
echo $row['activityType'] == 'topic_approved' ? $row['objectID'] : $row['actionID'];
?>
"><?php
echo buckys_truncate_string($row['topicTitle'], 30);
?>
</a> has been approved
<?php
} else {
?>
Your reply to
<a href="/forum/topic.php?id=<?php
echo $row['activityType'] == 'reply_approved' ? $row['objectID'] : $row['actionID'];
?>
//.........这里部分代码省略.........
示例13: buckys_is_forum_moderator
/**
* Check the current user is the moderator of the forum
*
* @param int $categoryID
* @return Boolean
*/
function buckys_is_forum_moderator($categoryID)
{
global $db;
if (!($userID = buckys_is_logged_in())) {
return false;
}
if (BuckysForumModerator::isModerator($categoryID, $userID)) {
return true;
} else {
return false;
}
}
示例14: dirname
<?php
require dirname(dirname(__FILE__)) . '/includes/bootstrap.php';
$categoryID = isset($_GET['id']) ? $_GET['id'] : 0;
if (isset($_REQUEST['action'])) {
if ($_REQUEST['action'] == 'follow' || $_REQUEST['action'] == 'unfollow') {
if (!($userID = buckys_is_logged_in()) && buckys_check_form_token('request')) {
buckys_redirect(isset($_REQUEST['return']) ? base64_decode($_REQUEST['return']) : '/forum', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
$category = BuckysForumCategory::getCategory($categoryID);
if (!$category || $_REQUEST['action'] == 'follow' && BuckysForumFollower::isFollow($category['categoryID'], $userID) || $_REQUEST['action'] == 'unfollow' && !BuckysForumFollower::isFollow($category['categoryID'], $userID) || $category['creatorID'] == $userID) {
buckys_redirect(isset($_REQUEST['return']) ? base64_decode($_REQUEST['return']) : '/forum', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
if ($_REQUEST['action'] == 'follow') {
BuckysForumFollower::followForum($userID, $categoryID);
buckys_add_message(MSG_FOLLOW_FORUM_SUCCESS);
} else {
BuckysForumFollower::unfollowForum($userID, $categoryID);
buckys_add_message(MSG_UNFOLLOW_FORUM_SUCCESS);
}
buckys_redirect(isset($_REQUEST['return']) ? base64_decode($_REQUEST['return']) : '/forum');
}
}
$category = BuckysForumCategory::getCategory($categoryID);
if (!$category) {
buckys_redirect('/forum');
}
//Getting Topics by category id
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'recent';
switch ($orderby) {
示例15: saveCategory
/**
* @param $id
* @param $name
* @param $description
* @return bool|int|null|string
*/
public static function saveCategory($id, $name, $description)
{
global $db;
$userID = buckys_is_logged_in();
if (!$id) {
//New Category
//Getting Sort Order
$query = "SELECT max(sortOrder) FROM " . TABLE_FORUM_CATEGORIES . " WHERE parentID=" . USER_FORUM_CATEGORY;
$sortOrder = $db->getVar($query);
$sortOrder = !$sortOrder ? 1 : $sortOrder + 1;
$query = $db->prepare("INSERT INTO " . TABLE_FORUM_CATEGORIES . "(`categoryName`, `description`,`sortOrder`, `creatorID`, `parentID`, `createdDate`)VALUES(%s, %s, %d, %d, %d, %s)", $name, $description, $sortOrder, $userID, USER_FORUM_CATEGORY, date("Y-m-d H:i:s"));
$id = $db->insert($query);
if (!$id) {
buckys_add_message($db->last_error, MSG_TYPE_ERROR);
return false;
}
//Make the user to follow this forum
BuckysForumFollower::followForum($userID, $id);
} else {
$query = $db->prepare("UPDATE " . TABLE_FORUM_CATEGORIES . " SET `categoryName`=%s, `description`=%s WHERE `categoryID`=%d", $name, $description, $id);
$db->query($query);
}
return $id;
}