<?php require dirname(__FILE__) . '/includes/bootstrap.php'; if (!($userID = buckys_is_logged_in())) { exit; } if ($_POST['action'] == 'activity-notification') { $acount = isset($_POST['acount']) ? intval($_POST['acount']) : 15; $rows = BuckysActivity::getActivities($userID, $acount); $activities = ''; foreach ($rows as $row) { $activities .= BuckysActivity::getActivityHTML($row, $userID); } if (count($rows) == $acount) { $activities .= "<div class='clear'></div><a href='#' class='view-more'>view more</a>"; } $ncount = isset($_POST['ncount']) ? intval($_POST['ncount']) : 15; $rows = BuckysActivity::getNotifications($userID, $ncount); $notifications = ''; foreach ($rows as $row) { $notifications .= BuckysActivity::getActivityHTML($row, $userID); } if (count($rows) == $ncount) { $notifications .= "<div class='clear'></div><a href='#' class='view-more'>view more</a>"; } render_result_xml(['notifications' => $notifications, 'activities' => $activities]); exit; }
<div class="clear"></div> <a href="#" class="view-more">view more</a> <?php } ?> </div> <div class="clear"></div> <br/> <h2 class="activityHeader" style="background-color: #2980B9;">Friend Activity</h2> <div id="activities" data-count="15"> <?php foreach ($activities as $row) { echo BuckysActivity::getActivityHTML($row, $userID); } ?> <?php if (count($activities) == 15) { ?> <div class="clear"></div> <a href="#" class="view-more">view more</a> <?php } ?> </div> </section> </section> </section>
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="******" 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="******" 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']; ?> "><?php echo buckys_truncate_string($row['topicTitle'], 30); ?> </a> has been approved <?php } ?> <span class="createdDate"><?php echo buckys_format_date($row['createdDate']); ?> </span> <br clear="all"/> </span> </div> <?php } else { ?> <div class="activityComment"> <span> <a href="/profile.php?user=<?php echo $row['replierID']; ?> "><img src="<?php echo BuckysUser::getProfileIcon(['userID' => $row['replierID'], 'thumbnail' => $row['rThumbnail']]); ?> " class="dropDownNotificationImages"/></a> <a href="/profile.php?user=<?php echo $row['replierID']; ?> "><?php echo $row['rName']; ?> </a> replied to <?php echo $row['activityType'] == "replied_to_topic" ? "your" : "the"; ?> topic <a href="/forum/topic.php?id=<?php echo $row['objectID']; ?> &page=9999"><?php echo buckys_truncate_string($row['topicTitle'], 30); ?> </a> <span class="createdDate"><?php echo buckys_format_date($row['createdDate']); ?> </span> <br clear="all"/> </span> </div> <?php } ?> <?php } ?> <a class="view-detail-links" href="/forum"> Go to Forum </a> <?php break; case 'mail': foreach ($data as $idx => $row) { ?> <a class="singleNotificationListItem" href="/messages_read.php?message=<?php echo $row['messageID']; ?> "> <span> <img src="<?php echo BuckysUser::getProfileIcon($row['sender']); ?> " class="dropDownNotificationImages"/> <span class="redBold" style="font-weight:normal;"><?php echo $row['senderName']; ?> </span> <span style="font-size:11px; color:#888; float:right;"><?php echo buckys_format_date($row['created_date']); ?> </span> <br/> <?php echo substr($row['body'], 0, 120); if (strlen($row['body']) > 120) { echo "..."; } ?> </span> </a> <?php if ($idx > 4) { break; } } ?> <a class="view-detail-links" href="/messages_inbox.php">Go to Inbox</a> <?php break; case 'trade': foreach ($data as $idx => $row) { $htmlBodyContent = ''; if ($row['activityType'] == BuckysTradeNotification::ACTION_TYPE_OFFER_ACCEPTED) { $actionUrl = '/trade/traded.php'; $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">%s</span>', $row['senderName']); $htmlBodyContent .= sprintf('<span> accepted your </span>'); $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">offer</span>'); } else { if ($row['activityType'] == BuckysTradeNotification::ACTION_TYPE_OFFER_DECLINED) { $actionUrl = '/trade/offer_declined.php'; $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">%s</span>', $row['senderName']); $htmlBodyContent .= sprintf('<span> declined your </span>'); $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">offer</span>'); } else { if ($row['activityType'] == BuckysTradeNotification::ACTION_TYPE_OFFER_RECEIVED) { $actionUrl = '/trade/offer_received.php'; $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">%s</span>', $row['senderName']); $htmlBodyContent .= sprintf('<span> made you an </span>'); $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">offer</span>'); } else { if ($row['activityType'] == BuckysTradeNotification::ACTION_TYPE_FEEDBACK) { $actionUrl = '/feedback.php?user='******'<span class="redBold" style="font-weight:normal;">%s</span>', $row['senderName']); $htmlBodyContent .= sprintf('<span> left you </span>'); $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">feedback</span>'); $row['feedback'] = strip_tags($row['feedback']); if (strlen($row['feedback']) > 120) { $row['feedback'] = substr($row['feedback'], 0, 120) . '...'; } $htmlBodyContent .= sprintf('<span> "%s"</span>', $row['feedback']); } else { $actionUrl = '#'; //not sure if we can be here. } } } } ?> <a class="singleNotificationListItem" href="<?php echo $actionUrl; ?> "> <img src="<?php echo BuckysUser::getProfileIcon($row['senderID']); ?> " class="dropDownNotificationImages"/> <?php echo $htmlBodyContent; ?> </a> <?php } ?> <a class="view-detail-links" href="/trade/available.php">My Trading Account</a> <?php break; case 'shop': foreach ($data as $idx => $row) { $htmlBodyContent = ''; if ($row['activityType'] == BuckysShopNotification::ACTION_TYPE_PRODUCT_SOLD) { $actionUrl = '/shop/sold.php'; $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">%s</span>', $row['senderName']); $htmlBodyContent .= sprintf('<span> purchased your </span>'); $htmlBodyContent .= sprintf('<span class="redBold" style="font-weight:normal;">product</span>'); } else { $actionUrl = '#'; //not sure if we can be here. } ?> <a class="singleNotificationListItem" href="<?php echo $actionUrl; ?> "> <img src="<?php echo BuckysUser::getProfileIcon($row['senderID']); ?> " class="dropDownNotificationImages"/> <?php echo $htmlBodyContent; ?> </a> <?php } ?> <a class="view-detail-links" href="/shop/available.php">My Shop Account</a> <?php break; } $output = ob_get_contents(); ob_end_clean(); if ($outFlag == true) { echo $output; return true; } else { return $output; } }