allowed <> '')?explode(',', $fbSession->allowed):array(); $forumLocked = 0; $topicLocked = 0; $kunena_db->setQuery("SELECT * FROM #__fb_messages AS a LEFT JOIN #__fb_messages_text AS b ON a.id=b.mesid WHERE a.id='{$id}' AND a.hold='0'"); unset($this_message); $this_message = $kunena_db->loadObject(); check_dberror('Unable to load message.'); if ((in_array($catid, $allow_forum)) || (isset($this_message->catid) && in_array($this_message->catid, $allow_forum))) { $view = $view == "" ? $settings[current_view] : $view; setcookie("fboard_settings[current_view]", $view, time() + 31536000, '/'); $topicLocked = $this_message->locked; if (count($this_message) < 1) { echo '
' . _MODERATION_INVALID_ID . '
'; } else { $thread = $this_message->parent == 0 ? $this_message->id : $this_message->thread; // Test if this is a valid SEO URL if not we should redirect using a 301 - permanent redirect if ($view == "flat" && ($thread != $this_message->id || $catid != $this_message->catid)) { // Invalid SEO URL detected! // Create permanent re-direct and quit // This query to calculate the page this reply is sitting on within this thread $query = "SELECT COUNT(*) FROM #__fb_messages AS a WHERE a.thread='{$thread}' AND a.id<='{$this_message->id}'"; $kunena_db->setQuery($query); $replyCount = $kunena_db->loadResult(); check_dberror('Unable to calculate replyCount.'); $replyPage = $replyCount > $fbConfig->messages_per_page ? ceil($replyCount / $fbConfig->messages_per_page) : 1; header("HTTP/1.1 301 Moved Permanently"); header("Location: " . htmlspecialchars_decode(CKunenaLink::GetThreadPageURL($fbConfig, 'view', $this_message->catid, $thread, $replyPage, $fbConfig->messages_per_page, $this_message->id))); $app->close(); } if ($kunena_my->id) { //mark this topic as read $kunena_db->setQuery("SELECT readtopics FROM #__fb_sessions WHERE userid='{$kunena_my->id}'"); $readTopics = $kunena_db->loadResult(); if ($readTopics == "") { $readTopics = $thread; } else { //get all readTopics in an array $_read_topics = @explode(',', $readTopics); if (!@in_array($thread, $_read_topics)) { $readTopics .= "," . $thread; } } $kunena_db->setQuery("UPDATE #__fb_sessions set readtopics='{$readTopics}' WHERE userid={$kunena_my->id}"); $kunena_db->query(); } //update the hits counter for this topic & exclude the owner if ($this_message->userid != $kunena_my->id) { $kunena_db->setQuery("UPDATE #__fb_messages SET hits=hits+1 WHERE id=$thread AND parent=0"); $kunena_db->query(); } // changed to 0 to fix the missing post when the thread splits over multiple pages $i = 0; $ordering = ($fbConfig->default_sort == 'desc' ? 'desc' : 'asc'); // Just to make sure only valid options make it // Get messages of current thread $kunena_db->setQuery("SELECT * FROM #__fb_messages AS a LEFT JOIN #__fb_messages_text AS b ON a.id=b.mesid WHERE (a.id='{$thread}' OR a.thread='{$thread}') AND a.hold='0' AND a.catid='{$catid}'"); if ($view != "flat") $flat_messages[] = $this_message; foreach ($kunena_db->loadObjectList() as $message) { if ($view == "flat") { $flat_messages[] = $message; if ($id == $message->id) { $idmatch = $i; } $i++; } else { $messages[$message->parent][] = $message; } } if ($ordering=='desc') { $idmatch = $i - $idmatch; } if ($view == "flat") { //prepare threading $limit = $fbConfig->messages_per_page; if ($idmatch > $limit) { $limitstart = (floor($idmatch / $limit)) * $limit; } else { $limitstart = 0; } $limitstart = JRequest::getInt('limitstart', $limitstart, $HASH = "REQUEST"); $total = count($flat_messages); if ($total > $limit) { jimport('joomla.html.pagination'); $pageNav = new JPagination( $total, $limitstart, $limit ); // slice out elements based on limits $flat_messages = array_slice($flat_messages, $pageNav->limitstart, $pageNav->limit); } else { $total = 0; } } //Get the category name for breadcrumb unset($objCatInfo, $objCatParentInfo); $kunena_db->setQuery("SELECT * FROM #__fb_categories WHERE id='{$catid}'"); $objCatInfo = $kunena_db->loadObject(); //Get Parent's cat.name for breadcrumb $kunena_db->setQuery("SELECT name, id FROM #__fb_categories WHERE id='{$objCatInfo->parent}'"); $objCatParentInfo = $kunena_db->loadObject(); $forumLocked = $objCatInfo->locked; //Perform subscriptions check only once $fb_cansubscribe = 0; if ($fbConfig->allowsubscriptions && ("" != $kunena_my->id || 0 != $kunena_my->id)) { $kunena_db->setQuery("SELECT thread FROM #__fb_subscriptions WHERE userid='{$kunena_my->id}' AND thread='{$thread}'"); $fb_subscribed = $kunena_db->loadResult(); if ($fb_subscribed == "") { $fb_cansubscribe = 1; } } //Perform favorites check only once $fb_canfavorite = 0; if ($fbConfig->allowfavorites && ("" != $kunena_my->id || 0 != $kunena_my->id)) { $kunena_db->setQuery("SELECT thread FROM #__fb_favorites WHERE userid='{$kunena_my->id}' AND thread='{$thread}'"); $fb_favorited = $kunena_db->loadResult(); if ($fb_favorited == "") { $fb_canfavorite = 1; } } //data ready display now ?>|
';
echo CKunenaLink::GetSamePageAnkerLink('forumbottom', isset($fbIcons['bottomarrow']) ? ' |
|
|
|
|
|---|---|
|
setQuery("SELECT a.userid FROM #__fb_users AS a LEFT JOIN #__fb_moderation AS b ON b.userid=a.userid WHERE b.catid='{$catid}'");
$catModerators = $kunena_db->loadResultArray();
/**
* note: please check if this routine is fine. there is no need to see for all messages if they are locked or not, either the thread or cat can be locked anyway
*/
//check if topic is locked
$_lockTopicID = $this_message->thread;
$topicLocked = $this_message->locked;
if ($_lockTopicID) // prev UNDEFINED $topicID!!
{
$lockedWhat = _TOPIC_NOT_ALLOWED; // UNUSED
}
else
{ //topic not locked; check if forum is locked
$kunena_db->setQuery("SELECT locked FROM #__fb_categories WHERE id='{$this_message->catid}'");
$topicLocked = $kunena_db->loadResult();
$lockedWhat = _FORUM_NOT_ALLOWED; // UNUSED
}
// END TOPIC LOCK
if (count($flat_messages) > 0)
{
foreach ($flat_messages as $fmessage)
{
$k = 1 - $k;
$mmm++;
if ($fmessage->parent == 0) {
$fb_thread = $fmessage->id;
}
else {
$fb_thread = $fmessage->thread;
}
//meta description and keywords
$metaKeys=(kunena_htmlspecialchars(stripslashes($fmessage->subject)). ', ' .kunena_htmlspecialchars(stripslashes($objCatParentInfo->name)) . ', ' . kunena_htmlspecialchars(stripslashes($fbConfig->board_title)) . ', ' . kunena_htmlspecialchars($app->getCfg('sitename')));
$metaDesc=(kunena_htmlspecialchars(stripslashes($fmessage->subject)) . ' - ' .kunena_htmlspecialchars(stripslashes($objCatParentInfo->name)) . ' - ' . kunena_htmlspecialchars(stripslashes($objCatInfo->name)) .' - ' . kunena_htmlspecialchars(stripslashes($fbConfig->board_title)));
$document =& JFactory::getDocument();
$cur = $document->get( 'description' );
$metaDesc = $cur .'. ' . $metaDesc;
$document =& JFactory::getDocument();
$document->setMetadata( 'keywords', $metaKeys );
$document->setDescription($metaDesc);
//filter out clear html
$fmessage->name = kunena_htmlspecialchars($fmessage->name);
$fmessage->email = kunena_htmlspecialchars($fmessage->email);
$fmessage->subject = kunena_htmlspecialchars($fmessage->subject);
//Get userinfo needed later on, this limits the amount of queries
unset($userinfo);
$kunena_db->setQuery("SELECT a.*, b.id, b.name, b.username, b.gid FROM #__fb_users AS a LEFT JOIN #__users AS b ON b.id=a.userid WHERE a.userid='{$fmessage->userid}'");
$userinfo = $kunena_db->loadObject();
if ($userinfo == NULL) {
$userinfo = new stdClass();
$userinfo->userid = 0;
$userinfo->name = '';
$userinfo->username = '';
$userinfo->avatar = '';
$userinfo->gid = 0;
$userinfo->rank = 0;
$userinfo->posts = 0;
$userinfo->karma = 0;
$userinfo->gender = _KUNENA_NOGENDER;
$userinfo->personalText = '';
$userinfo->ICQ = '';
$userinfo->location = '';
$userinfo->birthdate = '';
$userinfo->AIM = '';
$userinfo->MSN = '';
$userinfo->YIM = '';
$userinfo->SKYPE = '';
$userinfo->GTALK = '';
$userinfo->websiteurl = '';
$userinfo->signature = '';
}
if ($fbConfig->fb_profile == 'cb')
{
$triggerParams = array( 'userid'=> $fmessage->userid,
'userinfo'=> &$userinfo );
$kunenaProfile->trigger( 'profileIntegration', $triggerParams );
}
if ($fbConfig->username) {
$fb_queryName = "username";
}
else {
$fb_queryName = "name";
}
$fb_username = $userinfo->$fb_queryName;
if ($fb_username == "" || $fbConfig->changename) {
$fb_username = stripslashes($fmessage->name);
}
$fb_username = kunena_htmlspecialchars($fb_username);
$msg_id = $fmessage->id;
$lists["userid"] = $fmessage->userid;
$msg_username = $fmessage->email != "" && $kunena_my->id > 0 && $fbConfig->showemail ? CKunenaLink::GetEmailLink($fmessage->email, $fb_username) : $fb_username;
if ($fbConfig->allowavatar)
{
$Avatarname = $userinfo->username;
if ($fbConfig->avatar_src == "jomsocial")
{
// Get CUser object
$jsuser =& CFactory::getUser($fmessage->userid);
$msg_avatar = ' ' .
"" . _POSTS . " $numPosts" . "" .
" ";
$useGraph = 0;
}
else
{
$myGraph = new phpGraph;
//$myGraph->SetGraphTitle(_POSTS);
$myGraph->AddValue(_POSTS, $numPosts);
$myGraph->SetRowSortMode(0);
$myGraph->SetBarImg(KUNENA_URLGRAPHPATH . "col" . $fbConfig->statscolor . "m.png");
$myGraph->SetBarImg2(KUNENA_URLEMOTIONSPATH . "graph.gif");
$myGraph->SetMaxVal($maxPosts);
$myGraph->SetShowCountsMode(2);
$myGraph->SetBarWidth(4); //height of the bar
$myGraph->SetBorderColor("#333333");
$myGraph->SetBarBorderWidth(0);
$myGraph->SetGraphWidth(64); //should match column width in the | above -5 pixels
//$myGraph->BarGraphHoriz();
$useGraph = 1;
}
}
}
//karma points and buttons
if ($fbConfig->showkarma && $fmessage->userid != '0')
{
$karmaPoints = $userinfo->karma;
$karmaPoints = (int)$karmaPoints;
$msg_karma = "" . _KARMA . ": $karmaPoints";
if ($kunena_my->id != '0' && $kunena_my->id != $fmessage->userid)
{
$msg_karmaminus = CKunenaLink::GetKarmaLink('decrease', $catid, $fmessage->id, $fmessage->userid, ' ';
}
if ($userinfo->location != '') {
$msg_location = isset($fbIcons['msglocation']) ? '
","",$fb_message_txt); //$fb_message_txt = str_replace(" ","",$fb_message_txt); //$fb_message_txt = str_replace("
",$fb_message_txt);
// Code tag: restore TABS as we had to 'hide' them from the rest of the logic
$fb_message_txt = str_replace("__FBTAB__", " ", $fb_message_txt);
$msg_text = CKunenaTools::prepareContent($fb_message_txt);
$signature = $userinfo->signature;
if ($signature)
{
$signature = stripslashes(smile::smileReplace($signature, 0, $fbConfig->disemoticons, $smileyList));
$signature = nl2br($signature);
//wordwrap:
$signature = smile::htmlwrap($signature, $fbConfig->wrap);
//restore the \n (were replaced with _CTRL_) occurences inside code tags, but only after we have striplslashes; otherwise they will be stripped again
//$signature = str_replace("_CRLF_", "\\n", stripslashes($signature));
$msg_signature = $signature;
}
if ($is_Moderator || (($forumLocked == 0 && $topicLocked == 0) && ($kunena_my->id > 0 || $fbConfig->pubwrite)))
{
//user is allowed to reply/quote
$msg_reply = CKunenaLink::GetTopicPostReplyLink('reply', $catid, $fmessage->id , isset($fbIcons['reply']) ? ' |
|
';
echo CKunenaLink::GetSamePageAnkerLink('forumtop', isset($fbIcons['toparrow']) ? ' |
|
|
' : _GEN_FORUMLIST; ?>
getTemplate() . '/images/arrow.png')) {
echo '
';
}
else {
echo ' ';
}
?>
name; ?>
getTemplate() . '/images/arrow.png')) {
echo ' ';
}
else {
echo ' ';
}
?>
name; ?>
|
| enableforumjump) require_once (KUNENA_PATH_LIB .DS. 'kunena.forumjump.php'); ?> |
|---|