function stripBBCode($txt, $len = 0) { if (!$txt) { return; } if (!self::$emoticons) { self::$emoticons = smile::getEmoticons(0); } $txt = smile::purify($txt); if ($len && JString::strlen($txt) > $len) { $txt = JString::substr($txt, 0, $len) . '...'; } $txt = self::escape($txt); $txt = self::prepareContent($txt); return $txt; }
function smileParserCallback($fb_message, $history, $emoticons, $iconList = null) { // from context HTML into HTML // where $history can be 1 or 0. If 1 then we need to load the grey // emoticons for the Topic History. If 0 we need the normal ones static $regexp_trans = array('/' => '\\/', '^' => '\\^', '$' => '\\$', '.' => '\\.', '[' => '\\[', ']' => '\\]', '|' => '\\|', '(' => '\\(', ')' => '\\)', '?' => '\\?', '*' => '\\*', '+' => '\\+', '{' => '\\{', '}' => '\\}', '\\' => '\\\\', '^' => '\\^', '-' => '\\-'); $type = $history == 1 ? "-grey" : ""; $message_emoticons = array(); $message_emoticons = $iconList ? $iconList : smile::getEmoticons($history); // now the text is parsed, next are the emoticons $fb_message_txt = $fb_message; if ($emoticons != 1) { foreach ($message_emoticons as $emo_txt => $emo_src) { $emo_rtxt = strtr($emo_txt, $regexp_trans); // Check that smileys are not part of text like:soon (:s) $fb_message_txt = preg_replace('/(\\W|\\A)' . $emo_rtxt . '(\\W|\\Z)/u', '\\1<img class="ksmiley" src="' . $emo_src . '" alt="" />\\2', $fb_message_txt); // Previous check causes :) :) not to work, workaround is to run the same regexp twice $fb_message_txt = preg_replace('/(\\W|\\A)' . $emo_rtxt . '(\\W|\\Z)/u', '\\1<img class="ksmiley" src="' . $emo_src . '" alt="" />\\2', $fb_message_txt); } } return $fb_message_txt; }
$fromBot = 0; $prefview = $fbConfig->default_view; // JOOMLA STYLE CHECK if ($fbConfig->joomlastyle < 1) { $boardclass = "fb_"; } // Include preview here before inclusion of other files if ($func == "getpreview") { $message = utf8_urldecode(utf8_decode(stripslashes($msgpreview))); $smileyList = smile::getEmoticons(1); $msgbody = smile::smileReplace($message, 0, $fbConfig->disemoticons, $smileyList); $msgbody = nl2br($msgbody); $msgbody = str_replace("__FBTAB__", "\t", $msgbody); $msgbody = CKunenaTools::prepareContent($msgbody); // $msgbody = ereg_replace('%u0([[:alnum:]]{3})', '',$msgbody); $msgbody = smile::htmlwrap($msgbody, $fbConfig->wrap); header("Content-Type: text/html; charset=utf-8"); echo $msgbody; $app->close(); } if ($no_html == 0) { $document =& JFactory::getDocument(); // inline jscript with image location $document->addScriptDeclaration('jr_expandImg_url = "' . KUNENA_URLIMAGESPATH . '";'); if (is_object($kunenaProfile) && $kunenaProfile->useProfileIntegration()) { if (defined('KUNENA_COREJSURL')) { global $_CB_framework; $_CB_framework->addJQueryPlugin('kunena_tmpl', KUNENA_COREJSPATH); $_CB_framework->outputCbJQuery('', 'kunena_tmpl'); } } else {
function listThreadHistory($id, $fbConfig, $kunena_db) { if ($id != 0) { //get the parent# for the post on which 'reply' or 'quote' is chosen $kunena_db->setQuery("SELECT parent FROM #__fb_messages WHERE id='{$id}'"); $this_message_parent = $kunena_db->loadResult(); //Get the thread# for the same post $kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE id='{$id}'"); $this_message_thread = $kunena_db->loadResult(); //determine the correct thread# for the entire thread if ($this_message_parent == 0) { $thread = $id; } else { $thread = $this_message_thread; } //get all the messages for this thread $kunena_db->setQuery("SELECT * FROM #__fb_messages AS m LEFT JOIN #__fb_messages_text AS t ON m.id=t.mesid WHERE (thread='{$thread}' OR id='{$thread}') AND hold='0' ORDER BY time DESC LIMIT " . $fbConfig->historylimit); $messages = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); //and the subject of the first thread (for reference) $kunena_db->setQuery("SELECT subject FROM #__fb_messages WHERE id='{$thread}' and parent='0'"); $this_message_subject = $kunena_db->loadResult(); check_dberror("Unable to load messages."); echo "<b>" . _POST_TOPIC_HISTORY . ":</b> " . kunena_htmlspecialchars(stripslashes($this_message_subject)) . " <br />" . _POST_TOPIC_HISTORY_MAX . " {$fbConfig->historylimit} " . _POST_TOPIC_HISTORY_LAST . "<br />"; ?> <table border = "0" cellspacing = "1" cellpadding = "3" width = "100%" class = "fb_review_table"> <tr> <td class = "fb_review_header" width = "20%" align = "center"> <strong><?php echo _GEN_AUTHOR; ?> </strong> </td> <td class = "fb_review_header" align = "center"> <strong><?php echo _GEN_MESSAGE; ?> </strong> </td> </tr> <?php $k = 0; $smileyList = smile::getEmoticons(1); foreach ($messages as $mes) { $k = 1 - $k; $mes->name = kunena_htmlspecialchars($mes->name); $mes->email = kunena_htmlspecialchars($mes->email); $mes->subject = kunena_htmlspecialchars($mes->subject); $fb_message_txt = stripslashes($mes->message); $fb_message_txt = smile::smileReplace($fb_message_txt, 1, $fbConfig->disemoticons, $smileyList); $fb_message_txt = nl2br($fb_message_txt); $fb_message_txt = str_replace("__FBTAB__", "\t", $fb_message_txt); ?> <tr> <td class = "fb_review_body<?php echo $k; ?> " valign = "top"> <?php echo stripslashes($mes->name); ?> </td> <td class = "fb_review_body<?php echo $k; ?> "> <?php $fb_message_txt = str_replace("</P><br />", "</P>", $fb_message_txt); //Long Words Wrap: $fb_message_txt = smile::htmlwrap($fb_message_txt, $fbConfig->wrap); $fb_message_txt = CKunenaTools::prepareContent($fb_message_txt); echo $fb_message_txt; ?> </td> </tr> <?php } ?> </table> <?php } //else: this is a new topic so there can't be a history }
$is_user = strtolower($kunena_my->usertype) != ''; // BEGIN: READ ANN if ($do == "read") { $kunena_db->setQuery("SELECT id, title, sdescription, description, created, published, showdate FROM #__fb_announcement WHERE id='{$id}' AND published='1'"); $anns_ = $kunena_db->loadObjectList(); check_dberror("Unable to load announcements."); $ann = $anns_[0]; $annID = $ann->id; $anntitle = stripslashes($ann->title); $smileyList = smile::getEmoticons(0); $annsdescription = stripslashes(smile::smileReplace($ann->sdescription, 0, $fbConfig->disemoticons, $smileyList)); $annsdescription = nl2br($annsdescription); $annsdescription = smile::htmlwrap($annsdescription, $fbConfig->wrap); $anndescription = stripslashes(smile::smileReplace($ann->description, 0, $fbConfig->disemoticons, $smileyList)); $anndescription = nl2br($anndescription); $anndescription = smile::htmlwrap($anndescription, $fbConfig->wrap); $anncreated = KUNENA_timeformat(strtotime($ann->created)); $annpublished = $ann->published; $annshowdate = $ann->showdate; if ($annpublished > 0) { ?> <table class = "fb_blocktable" id = "fb_announcement" border = "0" cellspacing = "0" cellpadding = "0" width="100%"> <thead> <tr> <th> <div class = "fb_title_cover fbm"> <span class = "fb_title fbl"> <?php echo $app->getCfg('sitename'); ?> <?php
$fb_message_txt = stripslashes($fmessage->message); $fb_message_txt = smile::smileReplace($fb_message_txt, 0, $fbConfig->disemoticons, $smileyList); $fb_message_txt = nl2br($fb_message_txt); //$fb_message_txt = str_replace("<P> </P><br />","",$fb_message_txt); //$fb_message_txt = str_replace("</P><br />","</P>",$fb_message_txt); //$fb_message_txt = str_replace("<P><br />","<P>",$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); $fb_message_txt = smile::htmlwrap($fb_message_txt, $fbConfig->wrap); $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']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['reply'] . '" alt="Reply" border="0" title="' . _VIEW_REPLY . '" />' : _GEN_REPLY); $msg_quote = CKunenaLink::GetTopicPostReplyLink('quote', $catid, $fmessage->id, isset($fbIcons['quote']) ? '<img src="' . KUNENA_URLICONSPATH . $fbIcons['quote'] . '" alt="Quote" border="0" title="' . _VIEW_QUOTE . '" />' : _GEN_QUOTE); } else { //user is not allowed to write a post if ($topicLocked == 1 || $forumLocked) { $msg_closed = _POST_LOCK_SET; } else { $msg_closed = _VIEW_DISABLED; }
/** * Display results * @param string actionstring */ function show() { $fbConfig =& CKunenaConfig::getInstance(); extract($this->params); $q = implode(" ", $this->get_searchstrings()); $searchuser = $this->get_searchusername(); $limitstart = $this->get_limitstart(); $limit = $this->get_limit(); $selected = ' selected="selected"'; $checked = ' checked="checked"'; $fb_advsearch_hide = 1; if ($this->int_kunena_errornr) { $q = $this->searchword; $fb_advsearch_hide = 0; } if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/advancedsearch/advsearch.php')) { include KUNENA_ABSTMPLTPATH . '/plugin/advancedsearch/advsearch.php'; } else { include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'plugin/advancedsearch/advsearch.php'; } $results = $this->get_results(); $totalRows = $this->total; $pagination = KunenaSearchPagination($this->func, $q, $this->getUrlParams(), floor($limitstart / $limit) + 1, $limit, floor($totalRows / $limit) + 1, 7); if (defined('KUNENA_DEBUG')) { echo '<p style="background-color:#FFFFCC;border:1px solid red;">' . $this->str_kunena_errormsg . '</p>'; } ?> <?php if (empty($q) && empty($searchuser)) { return; } $boardclass = 'fb_'; ?> <div class="<?php echo $boardclass; ?> _bt_cvr1"> <div class="<?php echo $boardclass; ?> _bt_cvr2"> <div class="<?php echo $boardclass; ?> _bt_cvr3"> <div class="<?php echo $boardclass; ?> _bt_cvr4"> <div class="<?php echo $boardclass; ?> _bt_cvr5"> <table class = "fb_blocktable" id ="fb_forumsearch" border = "0" cellspacing = "0" cellpadding = "0" width="100%"> <thead> <tr> <th colspan = "3"> <div class = "fb_title_cover"> <span class="fb_title fbl"><?php echo _KUNENA_SEARCH_RESULTS; ?> </span> <b><?php printf(_FORUM_SEARCH, $q); ?> </b> </div> </th> </tr> </thead> <tbody> <tr class = "fb_sth"> <th class = "th-1 <?php echo $boardclass; ?> sectiontableheader"> <?php echo _GEN_SUBJECT; ?> </th> <th class = "th-2 <?php echo $boardclass; ?> sectiontableheader"> <?php echo _GEN_AUTHOR; ?> </th> <th class = "th-3 <?php echo $boardclass; ?> sectiontableheader"> <?php echo _GEN_DATE; ?> </th> </tr> <?php $tabclass = array("sectiontableentry1", "sectiontableentry2"); $k = 0; if ($totalRows == 0 && $this->int_kunena_errornr) { echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '" ><td colspan="3" style="text-align:center;font-weight:bold">' . $this->str_kunena_errormsg . '</td></tr>'; } // Cleanup incoming searchword; international chars can cause garbage at the end // real problem might lie with search box form and how we post and receive the data // However, this works for now $q = trim($q); // JJ Add different color $searchlist = $this->get_searchstrings(); foreach ($results as $result) { $k = 1 - $k; $ressubject = $result->subject; // Clean up subject $ressubject = stripslashes(smile::purify($ressubject)); $resmessage = stripslashes($result->message); // Strip smiles and bbcode out of search results; they look ugly $resmessage = CKunenaTools::prepareContent($resmessage); $resmessage = smile::purify($resmessage); $resmessage = kn_mb_substr(kunena_htmlspecialchars($resmessage), 0, 300); $utf8 = KUNENA_CHARSET == 'UTF-8' ? "u" : ""; foreach ($searchlist as $searchword) { if (empty($searchword)) { continue; } $ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/i" . $utf8, '<span class="searchword" >' . $searchword . '</span>', $ressubject); $resmessage = preg_replace("/" . preg_quote($searchword, '/') . "/i" . $utf8, '<span class="searchword" >' . $searchword . '</span>', $resmessage); } echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '">'; echo '<td class = "td-1" ><a href="' . JRoute::_(KUNENA_LIVEURL . '&func=view&id=' . $result->id . '&catid=' . $result->catid) . '#' . $result->id . '" >' . $ressubject . '</a><br />' . $resmessage . '<br /><br /></td>'; echo '<td class = "td-2" >' . kunena_htmlspecialchars(stripslashes($result->name)) . '</td>'; echo '<td class = "td-3" >' . date(_DATETIME, $result->time) . '</td></tr>'; echo "\n"; } ?> <?php if ($totalRows > $limit) { ?> <tr class = "fb_sth" > <th colspan = "3" style = "text-align:center" class = "th-1 <?php echo $boardclass; ?> sectiontableheader"> <?php echo $pagination; ?> </th> </tr> <?php } ?> <tr class = "fb_sth" > <th colspan = "3" style = "text-align:center" class = "th-1 <?php echo $boardclass; ?> sectiontableheader"> <?php $resStart = $limitstart + 1; $resStop = $limitstart + count($results); if ($resStart < $resStop) { $resStartStop = (string) $resStart . ' - ' . (string) $resStop; } else { $resStartStop = '0'; } printf(_FORUM_SEARCHRESULTS, $resStartStop, $totalRows); ?> </th> </tr> </tbody> </table> </div> </div> </div> </div> </div> <?php }
" onmouseover="javascript:document.id('helpbox').set('value', '<?php echo KunenaParser::JSText('COM_KUNENA_EDITOR_HELPLINE_VIDEOAPPLY2'); ?> ')" /> </div> </td> </tr> <?php } if (!$this->config->disemoticons) { ?> <tr> <td class="kpostbuttons"> <div id="smilie"><?php $emoticons = smile::getEmoticons(0, 1); foreach ($emoticons as $emo_code => $emo_url) { echo '<img class="btnImage" src="' . $emo_url . '" border="0" alt="' . $emo_code . ' " title="' . $emo_code . ' " onclick="kbbcode.insert(\' ' . $emo_code . ' \', \'after\', true);" style="cursor:pointer"/> '; } ?> </div> </td> </tr> <?php } ?> <!-- end of extendable secondary toolbar --> <tr> <td class="kposthint"><input type="text" name="helpbox" id="helpbox" size="45" class="kinputbox" disabled="disabled" maxlength="100" value="<?php
function Encode(&$text_new, &$task, $text_old, $context) { # Encode strings for output # Regard interpreter mode if needed # context: 'text' # context: 'tagremove' # RET: # TAGPARSER_RET_NOTHING: No Escaping done # TAGPARSER_RET_REPLACED: Escaping done // special states are liable for encoding (Extended Tag hit) if ($task->in_code) { // everything inside [code] is getting converted/encoded by tag delegation return TAGPARSER_RET_NOTHING; } if ($task->in_noparse) { // noparse is also needed to get encoded $text_new = kunena_htmlspecialchars($text_old, ENT_QUOTES); return TAGPARSER_RET_REPLACED; } // generally $text_new = $text_old; // pasting " " allows regexp to apply on \s at end // HTMLize from plaintext $text_new = kunena_htmlspecialchars($text_new, ENT_QUOTES); if ($context == 'text' && $task->autolink_disable == 0) { // Build links HTML2HTML $text_new = KunenaBBCodeInterpreter::hyperlink($text_new); // Calculate smilies HTML2HTML $text_new = smile::smileParserCallback($text_new, $task->history, $task->emoticons, $task->iconList); } return TAGPARSER_RET_REPLACED; }
$kunena_db->setQuery($query, $offset, $threads_per_page); $threadids = $kunena_db->loadResultArray(); check_dberror("Unable to load thread list."); $idstr = @join(",", $threadids); $favthread = array(); $thread_counts = array(); $messages = array(); $messages[0] = array(); if (count($threadids) > 0) { $query = "SELECT a.*, j.id AS userid, t.message AS messagetext, l.myfavorite, l.favcount, l.attachmesid, l.msgcount, l.lastid, u.avatar, c.id AS catid, c.name AS catname\n\tFROM (\n\t\tSELECT m.thread, (f.userid IS NOT null AND f.userid='{$kunena_my->id}') AS myfavorite, COUNT(DISTINCT f.userid) AS favcount, COUNT(a.mesid) AS attachmesid,\n\t\t\tCOUNT(DISTINCT m.id) AS msgcount, MAX(m.id) AS lastid, MAX(m.time) AS lasttime\n\t\tFROM #__fb_messages AS m\n\t\tLEFT JOIN #__fb_favorites AS f ON f.thread = m.thread\n\t\tLEFT JOIN #__fb_attachments AS a ON a.mesid = m.thread\n\t\tWHERE m.hold='0' AND m.moved='0' AND m.thread IN ({$idstr})\n\t\tGROUP BY thread\n\t) AS l\n\tINNER JOIN #__fb_messages AS a ON a.thread = l.thread\n\tINNER JOIN #__fb_messages_text AS t ON a.thread = t.mesid\n\tLEFT JOIN #__users AS j ON j.id = a.userid\n\tLEFT JOIN #__fb_users AS u ON u.userid = j.id\n\tLEFT JOIN #__fb_categories AS c ON c.id = a.catid\n\tWHERE (a.parent='0' OR a.id=l.lastid)\n\tORDER BY {$order}"; $kunena_db->setQuery($query); $messagelist = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); foreach ($messagelist as $message) { $messages[$message->parent][] = $message; $messagetext[$message->id] = substr(smile::purify($message->messagetext), 0, 500); if ($message->parent == 0) { $hits[$message->id] = $message->hits; $thread_counts[$message->id] = $message->msgcount - 1; $last_read[$message->id]->unread = 0; if ($message->favcount) { $favthread[$message->id] = $message->favcount; } if ($message->id == $message->lastid) { $last_read[$message->id]->lastread = $last_reply[$message->id] = $message; } } else { $last_read[$message->thread]->lastread = $last_reply[$message->thread] = $message; } } $kunena_db->setQuery("SELECT thread, MIN(id) AS lastread, SUM(1) AS unread FROM #__fb_messages " . "WHERE hold='0' AND moved='0' AND thread IN ({$idstr}) AND time>'{$prevCheck}' GROUP BY thread");
if (sizeof($rows) == 0) { echo '' . _GEN_NOFORUMS . ''; } else { foreach ($rows as $singlerow) { $obj_fb_cat = new jbCategory($kunena_db, $singlerow->id); $is_Mod = fb_has_moderator_permission($kunena_db, $obj_fb_cat, $kunena_my->id, $is_admin); if (in_array($singlerow->id, $allow_forum)) { // $k=for alternating row colors: $k = 1 - $k; $numtopics = $singlerow->numTopics; $numreplies = $singlerow->numPosts; $lastPosttime = $singlerow->time_last_msg; $lastptime = KUNENA_timeformat(CKunenaTools::fbGetShowTime($singlerow->time_last_msg)); $forumDesc = stripslashes(smile::smileReplace($singlerow->description, 0, $fbConfig->disemoticons, $smileyList)); $forumDesc = nl2br($forumDesc); $forumDesc = smile::htmlwrap($forumDesc, $fbConfig->wrap); // Get the forumsubparent categories :: get the subcategories here $kunena_db->setQuery("SELECT id, name, numTopics, numPosts FROM #__fb_categories WHERE parent='{$singlerow->id}' AND published='1' ORDER BY ordering"); $forumparents = $kunena_db->loadObjectList(); check_dberror("Unable to load categories."); foreach ($forumparents as $childnum => $childforum) { if (!in_array($childforum->id, $allow_forum)) { unset($forumparents[$childnum]); } } $forumparents = array_values($forumparents); if ($kunena_my->id) { // get all threads with posts after the users last visit; don't bother for guests $kunena_db->setQuery("SELECT DISTINCT thread FROM #__fb_messages WHERE catid='{$singlerow->id}' AND hold='0' AND moved='0' AND time>'{$prevCheck}' GROUP BY thread"); $newThreadsAll = $kunena_db->loadObjectList(); check_dberror("Unable to load messages.");
<image> <url><?php echo KUNENA_URLEMOTIONSPATH; ?> rss.gif</url> <title>Powered by Kunena</title> <link><?php echo JURI::root(); ?> </link> <description>Kunena Site Syndication</description> </image> <?php foreach ($rows as $row) { echo " <item>\n"; echo " <title>" . _GEN_SUBJECT . ": " . stripslashes(kunena_htmlspecialchars($row->subject)) . " - " . _GEN_BY . ": " . stripslashes(kunena_htmlspecialchars($row->lastpostname)) . "</title>" . "\n"; echo " <link>"; $uri =& JURI::getInstance(JURI::base()); $itemlink = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetThreadPageURL($fbConfig, 'view', $row->catid, $row->thread, ceil($row->numberposts / $fbConfig->messages_per_page), $fbConfig->messages_per_page, $row->lastpostid); echo $itemlink; echo "</link>\n"; $words = $row->lastpostmessage; $words = smile::purify($words); echo " <description>" . kunena_htmlspecialchars($words) . "</description>" . "\n"; echo " <pubDate>" . date('r', $row->lastposttime) . "</pubDate>" . "\n"; echo " </item>\n"; } ?> </channel> </rss>
/** * Lists messages to be moderated * @param array allMes list of object * @param string fbs action string */ function jbListMessages($allMes, $catid) { $fbConfig =& CKunenaConfig::getInstance(); echo '<form action="' . JRoute::_(KUNENA_LIVEURLREL . '&func=review') . '" name="moderation" method="post">'; ?> <script> function ConfirmDelete() { if (confirm("<?php echo _MODERATION_DELETE_MESSAGE; ?> ")) document.moderation.submit(); else return false; } </script> <table width = "100%" border = 0 cellspacing = 1 cellpadding = 3> <tr height = "10" class = "fb_table_header"> <th align = "center"> <b><?php echo _GEN_DATE; ?> </b> </th> <th width = "8%" align = "center"> <b><?php echo _GEN_AUTHOR; ?> </b> </th> <th width = "13%" align = "center"> <b><?php echo _GEN_SUBJECT; ?> </b> </th> <th width = "55%" align = "center"> <b><?php echo _GEN_MESSAGE; ?> </b> </th> <th width = "13%" align = "center"> <b><?php echo _GEN_ACTION; ?> </b> </th> </tr> <?php $i = 1; //avoid calling it each time $smileyList = smile::getEmoticons(""); foreach ($allMes as $message) { $i = 1 - $i; echo '<tr class="fb_message' . $i . '">'; echo '<td valign="top">' . date(_DATETIME, $message->time) . '</td>'; echo '<td valign="top">' . $message->name . '</td>'; echo '<td valign="top"><b>' . $message->subject . '<b></td>'; $fb_message_txt = stripslashes($message->message); echo '<td valign="top">' . smile::smileReplace($fb_message_txt, 0, $fbConfig->disemoticons, $smileyList) . '</td>'; echo '<td valign="top"><input type="checkbox" name="cid[]" value="' . $message->id . '" /></td>'; echo '</tr>'; } ?> <tr> <td colspan = "5" align = "center" valign = "top" style = "text-align:center"> <input type = "hidden" name = "catid" value = "<?php echo $catid; ?> "/> <input type = "submit" align = "center" class = "button" name = "action" value = "<?php echo _MOD_APPROVE; ?> " border = "0"> <input type = "submit" align = "center" class = "button" name = "action" onclick = "ConfirmDelete()" value = "<?php echo _MOD_DELETE; ?> " border = "0"> </td> </tr> <tr height = "10" bgcolor = "#e2e2e2"> <td colspan = "5"> </td> </tr> </table> </form> <?php }
echo '<sup><span class="newchar"> (' . $newPostsAvailable . ' ' . stripslashes($fbConfig->newchar) . ")</span></sup>"; } $cxThereisNewInForum = 0; if ($singlerow->locked) { echo isset($fbIcons['forumlocked']) ? ' <img src="' . KUNENA_URLICONSPATH . $fbIcons['forumlocked'] . '" border="0" alt="' . _GEN_LOCKED_FORUM . '" title="' . _GEN_LOCKED_FORUM . '"/>' : ' <img src="' . KUNENA_URLEMOTIONSPATH . 'lock.gif" border="0" alt="' . _GEN_LOCKED_FORUM . '">'; $lockedForum = 1; } if ($singlerow->review) { echo isset($fbIcons['forummoderated']) ? ' <img src="' . KUNENA_URLICONSPATH . $fbIcons['forummoderated'] . '" border="0" alt="' . _GEN_MODERATED . '" title="' . _GEN_MODERATED . '"/>' : ' <img src="' . KUNENA_URLEMOTIONSPATH . 'review.gif" border="0" alt="' . _GEN_MODERATED . '"/>'; $moderatedForum = 1; } echo '</div>'; if ($forumDesc != "") { $tmpforumdesc = stripslashes(smile::smileReplace($forumDesc, 0, $fbConfig->disemoticons, $smileyList)); $tmpforumdesc = nl2br($tmpforumdesc); $tmpforumdesc = smile::htmlwrap($tmpforumdesc, $fbConfig->wrap); echo '<div class="' . $boardclass . 'thead-desc fbm">' . $tmpforumdesc . ' </div>'; } if (count($forumparents) > 0) { if (count($forumparents) == 1) { echo '<div class="' . $boardclass . 'thead-child fbs"><b>' . _KUNENA_CHILD_BOARD . ' </b>'; } else { echo '<div class="' . $boardclass . 'thead-child fbs"><b>' . _KUNENA_CHILD_BOARDS . ' </b>'; } foreach ($forumparents as $forumparent) { ?> <?php //Begin: parent read unread iconset if ($fbConfig->showchildcaticon) { //
$topicToolbar = smile::topicToolbar($emoid_selected, $fbConfig->rtewidth); echo $topicToolbar; ?> </td> </tr> <?php } ?> <?php if ($fbConfig->rtewidth == 0) { $useRte = 0; } else { $useRte = 1; } $fbTextArea = smile::fbWriteTextarea('message', $htmlText, $fbConfig->rtewidth, $fbConfig->rteheight, $useRte, $fbConfig->disemoticons); echo $fbTextArea; if ($setFocus == 0) { echo '<tr><td style="display:none;"><script type="text/javascript">document.postform.message.focus();</script></td></tr>'; } //check if this user is already subscribed to this topic but only if subscriptions are allowed if ($fbConfig->allowsubscriptions == 1) { if ($id == 0) { $fb_thread = -1; } else { $kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE id='{$id}'"); $fb_thread = $kunena_db->loadResult(); } $kunena_db->setQuery("SELECT thread FROM #__fb_subscriptions WHERE userid='{$kunena_my->id}' AND thread='{$fb_thread}'"); $fb_subscribed = $kunena_db->loadResult(); if ($fb_subscribed == "" || $id == 0) {
function getView() { // Is user allowed to read category from the URL? if ($this->catid && !$this->session->canRead($this->catid)) { return; } $this->allow = 1; $where[] = "a.hold IN ({$this->hold})"; $where = implode(' AND ', $where); $query = "SELECT a.*, b.*, p.id AS poll_id, modified.name AS modified_name, modified.username AS modified_username\n\t\t\tFROM #__kunena_messages AS a\n\t\t\tLEFT JOIN #__kunena_messages_text AS b ON a.id=b.mesid\n\t\t\tLEFT JOIN #__users AS modified ON a.modified_by = modified.id\n\t\t\tLEFT JOIN #__kunena_polls AS p ON a.id=p.threadid\n\t\t\tWHERE a.id={$this->db->Quote($this->id)} AND {$where}"; $this->db->setQuery($query); $this->first_message = $this->db->loadObject(); // Invalid message id (deleted, on hold?) if (KunenaError::checkDatabaseError() || !$this->first_message) { return; } // Is user allowed to see the forum specified in the message? if (!$this->session->canRead($this->first_message->catid)) { $this->allow = 0; return; } $this->thread = $this->first_message->thread; // Test if this is a valid URL. If not, redirect browser to the right location if ($this->first_message->moved || $this->thread != $this->id || $this->catid != $this->first_message->catid) { $this->catid = $this->first_message->catid; if ($this->first_message->moved) { $newurl = array(); parse_str($this->first_message->message, $newloc); $this->id = $newloc['id']; $query = "SELECT catid, thread FROM #__kunena_messages AS a WHERE a.id='{$this->id}'"; $this->db->setQuery($query); $newpos = $this->db->loadObject(); if (!$newpos) { $this->allow = 0; return; } if (KunenaError::checkDatabaseError()) { return; } $this->thread = $newpos->thread; $this->catid = $newpos->catid; } // This query to calculate the page this reply is sitting on within this thread $query = "SELECT COUNT(*) FROM #__kunena_messages AS a WHERE a.thread={$this->db->Quote($this->thread)} AND {$where} AND a.id<={$this->db->Quote($this->id)}"; $this->db->setQuery($query); $replyCount = $this->db->loadResult(); if (KunenaError::checkDatabaseError()) { return; } $replyPage = $replyCount > $this->config->messages_per_page ? ceil($replyCount / $this->config->messages_per_page) : 1; $this->redirect = CKunenaLink::GetThreadPageURL('view', $this->catid, $this->thread, $replyPage, $this->config->messages_per_page, $this->first_message->id, false); } //Get the category name for breadcrumb $this->db->setQuery("SELECT * FROM #__kunena_categories WHERE id={$this->db->Quote($this->catid)}"); $this->catinfo = $this->db->loadObject(); if (KunenaError::checkDatabaseError()) { return; } //Get Parent's cat.name for breadcrumb $this->db->setQuery("SELECT id, name FROM #__kunena_categories WHERE id={$this->db->Quote($this->catinfo->parent)}"); $objCatParentInfo = $this->db->loadObject(); if (KunenaError::checkDatabaseError()) { return; } // START $this->emoticons = smile::getEmoticons(0); $this->prevCheck = $this->session->lasttime; $this->read_topics = explode(',', $this->session->readtopics); $showedEdit = 0; $this->kunena_forum_locked = $this->catinfo->locked; //check if topic is locked $this->topicLocked = $this->first_message->locked; if (!$this->topicLocked) { //topic not locked; check if forum is locked $this->topicLocked = $this->catinfo->locked; } $this->topicSticky = $this->first_message->ordering; CKunenaTools::markTopicRead($this->thread, $this->my->id); //update the hits counter for this topic & exclude the owner if ($this->my->id == 0 || $this->first_message->userid != $this->my->id) { $this->db->setQuery("UPDATE #__kunena_messages SET hits=hits+1 WHERE id={$this->db->Quote($this->thread)} AND parent='0'"); $this->db->query(); KunenaError::checkDatabaseError(); } $query = "SELECT COUNT(*) FROM #__kunena_messages AS a WHERE a.thread={$this->db->Quote($this->thread)} AND {$where}"; $this->db->setQuery($query); $this->total_messages = $this->db->loadResult(); KunenaError::checkDatabaseError(); // If page does not exist, redirect to the last page if ($this->total_messages <= $this->limitstart) { $page = ceil($this->total_messages / $this->limit); $this->redirect = CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, $page, $this->limit, '', false); } $maxpages = 7 - 2; // odd number here (show - 2) $totalpages = ceil($this->total_messages / $this->limit); $page = floor($this->limitstart / $this->limit) + 1; $firstpage = 1; if ($this->ordering == 'desc') { $firstpage = $totalpages; } // Get replies of current thread $query = "SELECT a.*, b.*, modified.name AS modified_name, modified.username AS modified_username\n\t\t\t\t\tFROM #__kunena_messages AS a\n\t\t\t\t\tLEFT JOIN #__kunena_messages_text AS b ON a.id=b.mesid\n\t\t\t\t\tLEFT JOIN #__users AS modified ON a.modified_by = modified.id\n\t\t\t\t\tWHERE a.thread={$this->db->Quote($this->thread)} AND {$where}\n\t\t\t\t\tORDER BY id {$this->ordering}"; $this->db->setQuery($query, $this->limitstart, $this->limit); $this->messages = (array) $this->db->loadObjectList('id'); KunenaError::checkDatabaseError(); // First collect the message ids of the first message and all replies $messageids = array(); $this->threaded = array(); $userlist = array(); foreach ($this->messages as $message) { $messageids[] = $message->id; // Threaded ordering if (isset($this->messages[$message->parent])) { $this->threaded[$message->parent][] = $message->id; } else { $this->threaded[0][] = $message->id; } $userlist[intval($message->userid)] = intval($message->userid); $userlist[intval($message->modified_by)] = intval($message->modified_by); } if (!isset($this->messages[$this->mesid])) { $this->mesid = reset($messageids); } if ($this->layout != 'view') { if (!isset($this->messages[$this->id])) { $this->messages = $this->getThreadedOrdering(0, array('edge')); } else { $this->messages = $this->getThreadedOrdering(); } } // create a list of ids we can use for our sql $idstr = @join(",", $messageids); // Load attachments require_once KUNENA_PATH_LIB . '/kunena.attachments.class.php'; $attachments = CKunenaAttachments::getInstance(); if (is_a($attachments, 'CKunenaAttachments')) { $message_attachments = $attachments->get($idstr); // Now that we have all relevant messages in messages, asign any matching attachments foreach ($this->messages as $message) { // Mark as new if ($this->my->id && $this->prevCheck < $message->time && !in_array($message->thread, $this->read_topics)) { $message->new = true; } else { $message->new = false; } // Assign attachments if (isset($message_attachments[$message->id])) { $message->attachments = $message_attachments[$message->id]; } } // Done with attachments } $this->pagination = $this->getPagination($this->catid, $this->thread, $page, $totalpages, $maxpages); //meta description and keywords $metaKeys = kunena_htmlspecialchars("{$this->first_message->subject}, {$objCatParentInfo->name}, {$this->config->board_title}, " . JText::_('COM_KUNENA_GEN_FORUM') . ', ' . $this->app->getCfg('sitename')); // Create Meta Description form the content of the first message // better for search results display but NOT for search ranking! $metaDesc = KunenaParser::stripBBCode($this->first_message->message); $metaDesc = strip_tags($metaDesc); // Now remove all tags $metaDesc = preg_replace('/\\s+/', ' ', $metaDesc); // remove newlines $metaDesc = preg_replace('/^[^\\w0-9]+/', '', $metaDesc); // remove characters at the beginning that are not letters or numbers $metaDesc = trim($metaDesc); // Remove trailing spaces and beginning // remove multiple spaces while (strpos($metaDesc, ' ') !== false) { $metaDesc = str_replace(' ', ' ', $metaDesc); } // limit to 185 characters - google will cut off at ~150 if (strlen($metaDesc) > 185) { $metaDesc = rtrim(JString::substr($metaDesc, 0, 182)) . '...'; } $metaDesc = htmlspecialchars($metaDesc); $document =& JFactory::getDocument(); $document->setMetadata('keywords', $metaKeys); $document->setDescription($metaDesc); $this->layout_buttons = array(); if ($this->config->enable_threaded_layouts) { if ($this->layout != 'view') { $this->layout_buttons[] = CKunenaLink::GetThreadLayoutLink('flat', $this->catid, $this->thread, $this->mesid, CKunenaTools::showButton('layout-flat', JText::_('COM_KUNENA_BUTTON_LAYOUT_FLAT')), $this->limitstart, $this->limit, JText::_('COM_KUNENA_BUTTON_LAYOUT_FLAT_LONG'), 'nofollow', 'kicon-button kbuttonuser btn-left'); } if ($this->layout != 'threaded') { $this->layout_buttons[] = CKunenaLink::GetThreadLayoutLink('threaded', $this->catid, $this->thread, $this->mesid, CKunenaTools::showButton('layout-threaded', JText::_('COM_KUNENA_BUTTON_LAYOUT_THREADED')), $this->limitstart, $this->limit, JText::_('COM_KUNENA_BUTTON_LAYOUT_THREADED_LONG'), 'nofollow', 'kicon-button kbuttonuser btn-left'); } if ($this->layout != 'indented') { $this->layout_buttons[] = CKunenaLink::GetThreadLayoutLink('indented', $this->catid, $this->thread, $this->mesid, CKunenaTools::showButton('layout-indented', JText::_('COM_KUNENA_BUTTON_LAYOUT_INDENTED')), $this->limitstart, $this->limit, JText::_('COM_KUNENA_BUTTON_LAYOUT_INDENTED_LONG'), 'nofollow', 'kicon-button kbuttonuser btn-left'); } } //Perform subscriptions check only once $this->cansubscribe = 0; if ($this->config->allowsubscriptions && $this->config->topic_subscriptions != 'disabled' && $this->my->id) { $this->db->setQuery("SELECT thread, future1 FROM #__kunena_subscriptions WHERE userid={$this->db->Quote($this->my->id)} AND thread={$this->db->Quote($this->thread)}"); $fb_subscribed = $this->db->loadObject(); KunenaError::checkDatabaseError(); if (!$fb_subscribed) { $this->cansubscribe = 1; } elseif ($fb_subscribed->future1 == 1) { $query_thread = "UPDATE #__kunena_subscriptions\n\t\t\t\t\tSET future1=0 WHERE thread={$this->db->Quote($this->thread)} AND userid={$this->db->Quote($this->my->id)}"; $this->db->setQuery($query_thread); $this->db->query(); } } //Perform favorites check only once $fb_canfavorite = 0; $this->db->setQuery("SELECT MAX(userid={$this->db->Quote($this->my->id)}) AS favorited, COUNT(*) AS totalfavorited FROM #__kunena_favorites WHERE thread={$this->db->Quote($this->thread)}"); list($this->favorited, $this->totalfavorited) = $this->db->loadRow(); KunenaError::checkDatabaseError(); if ($this->config->allowfavorites && $this->my->id) { if (!$this->favorited) { $fb_canfavorite = 1; } } //get the Moderator list for display $this->db->setQuery("SELECT m.*, u.* FROM #__kunena_moderation AS m INNER JOIN #__users AS u ON u.id=m.userid WHERE m.catid={$this->db->Quote($this->catid)} AND u.block=0"); $this->modslist = $this->db->loadObjectList(); KunenaError::checkDatabaseError(); $this->catModerators = array(); foreach ($this->modslist as $mod) { $this->catModerators[] = $mod->userid; $userlist[intval($mod->userid)] = intval($mod->userid); } // Prefetch all users/avatars to avoid user by user queries during template iterations KunenaUser::loadUsers($userlist); //data ready display now if (CKunenaTools::isModerator($this->my->id, $this->catid) || $this->topicLocked == 0) { //this user is allowed to reply to this topic $this->thread_reply = CKunenaLink::GetTopicPostReplyLink('reply', $this->catid, $this->thread, CKunenaTools::showButton('reply', JText::_('COM_KUNENA_BUTTON_REPLY_TOPIC')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_REPLY_TOPIC_LONG')); } // Thread Subscription if ($this->cansubscribe == 1) { // this user is allowed to subscribe - check performed further up to eliminate duplicate checks // for top and bottom navigation $this->thread_subscribe = CKunenaLink::GetTopicPostLink('subscribe', $this->catid, $this->id, CKunenaTools::showButton('subscribe', JText::_('COM_KUNENA_BUTTON_SUBSCRIBE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_SUBSCRIBE_TOPIC_LONG')); } if ($this->my->id != 0 && $this->config->allowsubscriptions && $this->config->topic_subscriptions != 'disabled' && $this->cansubscribe == 0) { // this user is allowed to unsubscribe $this->thread_subscribe = CKunenaLink::GetTopicPostLink('unsubscribe', $this->catid, $this->id, CKunenaTools::showButton('subscribe', JText::_('COM_KUNENA_BUTTON_UNSUBSCRIBE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_UNSUBSCRIBE_TOPIC_LONG')); } //START: FAVORITES if ($fb_canfavorite == 1) { // this user is allowed to add a favorite - check performed further up to eliminate duplicate checks // for top and bottom navigation $this->thread_favorite = CKunenaLink::GetTopicPostLink('favorite', $this->catid, $this->id, CKunenaTools::showButton('favorite', JText::_('COM_KUNENA_BUTTON_FAVORITE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_FAVORITE_TOPIC_LONG')); } if ($this->my->id != 0 && $this->config->allowfavorites && $fb_canfavorite == 0) { // this user is allowed to unfavorite $this->thread_favorite = CKunenaLink::GetTopicPostLink('unfavorite', $this->catid, $this->id, CKunenaTools::showButton('favorite', JText::_('COM_KUNENA_BUTTON_UNFAVORITE_TOPIC')), 'nofollow', 'kicon-button kbuttonuser btn-left', JText::_('COM_KUNENA_BUTTON_UNFAVORITE_TOPIC_LONG')); } // FINISH: FAVORITES if (CKunenaTools::isModerator($this->my->id, $this->catid) || !$this->kunena_forum_locked) { //this user is allowed to post a new topic $this->thread_new = CKunenaLink::GetPostNewTopicLink($this->catid, CKunenaTools::showButton('newtopic', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_NEW_TOPIC_LONG')); } if (CKunenaTools::isModerator($this->my->id, $this->catid)) { // offer the moderator always the move link to relocate a topic to another forum // and the (un)sticky bit links // and the (un)lock links if ($this->topicSticky == 0) { $this->thread_sticky = CKunenaLink::GetTopicPostLink('sticky', $this->catid, $this->id, CKunenaTools::showButton('sticky', JText::_('COM_KUNENA_BUTTON_STICKY_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_STICKY_TOPIC_LONG')); } else { $this->thread_sticky = CKunenaLink::GetTopicPostLink('unsticky', $this->catid, $this->id, CKunenaTools::showButton('sticky', JText::_('COM_KUNENA_BUTTON_UNSTICKY_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNSTICKY_TOPIC_LONG')); } if ($this->topicLocked == 0) { $this->thread_lock = CKunenaLink::GetTopicPostLink('lock', $this->catid, $this->id, CKunenaTools::showButton('lock', JText::_('COM_KUNENA_BUTTON_LOCK_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_LOCK_TOPIC_LONG')); } else { $this->thread_lock = CKunenaLink::GetTopicPostLink('unlock', $this->catid, $this->id, CKunenaTools::showButton('lock', JText::_('COM_KUNENA_BUTTON_UNLOCK_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNLOCK_TOPIC_LONG')); } $this->thread_delete = CKunenaLink::GetTopicPostLink('deletethread', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_TOPIC_LONG')); $this->thread_moderate = CKunenaLink::GetTopicPostReplyLink('moderatethread', $this->catid, $this->id, CKunenaTools::showButton('moderate', JText::_('COM_KUNENA_BUTTON_MODERATE_TOPIC')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_MODERATE')); } $this->headerdesc = nl2br(smile::smileReplace($this->catinfo->headerdesc, 0, $this->config->disemoticons, $this->emoticons)); $tabclass = array("row1", "row2"); $this->mmm = 0; $this->replydir = $this->ordering == 'DESC' ? -1 : 1; if ($this->replydir < 0) { $this->replynum = $this->total_messages - $this->limitstart + 1; } else { $this->replynum = $this->limitstart; } $this->myname = $this->config->username ? $this->my->username : $this->my->name; $this->allow_anonymous = !empty($this->catinfo->allow_anonymous) && $this->my->id; $this->anonymous = $this->allow_anonymous && !empty($this->catinfo->post_anonymous); }
if (file_exists(KUNENA_ABSTMPLTPATH . '/fb_pathway.php')) { require_once KUNENA_ABSTMPLTPATH . '/fb_pathway.php'; } else { require_once KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'fb_pathway.php'; } ?> <!-- / Pathway --> <?php if ($objCatInfo->headerdesc) { ?> <div class="fb_forum-headerdesc"><?php $smileyList = smile::getEmoticons(0); $headerdesc = stripslashes(smile::smileReplace($objCatInfo->headerdesc, 0, $fbConfig->disemoticons, $smileyList)); $headerdesc = nl2br($headerdesc); //wordwrap: $headerdesc = smile::htmlwrap($headerdesc, $fbConfig->wrap); echo $headerdesc; ?> </div> <?php } //(JJ) if (file_exists(KUNENA_ABSTMPLTPATH . '/fb_sub_category_list.php')) { include KUNENA_ABSTMPLTPATH . '/fb_sub_category_list.php'; } else { include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'fb_sub_category_list.php'; } ?> <!-- top nav --> <table border = "0" cellspacing = "0" class = "jr-topnav" cellpadding = "0">
</td> <td class="kcol-mid kcol-ktopicviews"> <!-- Views --> <span class="ktopic-views-number"><?php echo CKunenaTools::formatLargeNumber(intval($mes->hits)); ?> </span> <span class="ktopic-views"> <?php echo JText::_('COM_KUNENA_GEN_HITS'); ?> </span> <!-- /Views --> </td> <td class="kcol-mid"> <?php echo smile::smileReplace($mes->message, 0, $this->config->disemoticons, smile::getEmoticons("")); ?> </td> <?php if (CKunenaTools::isModerator($this->my->id, $this->catid)) { ?> <td class="kcol-mid ktopicmoderation"> <input class ="kDelete_bulkcheckboxes" type="checkbox" name="cb[<?php echo intval($mes->id); ?> ]" value="0" /> </td> <?php } ?> </tr>