$threadPages = ceil($message->msgcount / $this->config->messages_per_page); $unreadPage = ceil($curMessageNo / $this->config->messages_per_page); if ($message->attachments) { echo CKunenaTools::showIcon('ktopicattach', JText::_('COM_KUNENA_ATTACH')); } ?> <div class="ktopic-title-cover"> <?php echo CKunenaLink::GetThreadLink('view', intval($message->catid), intval($message->id), KunenaParser::parseText($message->subject, 30), KunenaParser::stripBBCode($message->message), 'follow', 'ktopic-title km'); ?> </div> </td> <td class="kcol-mid ktopictittle"> <?php echo CKunenaLink::GetThreadLink('view', intval($firstpost->catid), intval($firstpost->id), KunenaParser::parseText($firstpost->subject, 20), KunenaParser::stripBBCode($firstpost->message), 'follow', 'ktopic-title km'); ?> <?php if ($message->favcount) { if ($message->myfavorite) { echo CKunenaTools::showIcon('kfavoritestar', JText::_('COM_KUNENA_FAVORITE')); } else { echo CKunenaTools::showIcon('kfavoritestar-grey', JText::_('COM_KUNENA_FAVORITE')); } } ?> <?php if ($message->unread) { echo CKunenaLink::GetThreadPageLink('view', intval($message->catid), intval($message->id), $unreadPage, intval($this->config->messages_per_page), '<sup class="knewchar"> (' . intval($message->unread) . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>', intval($message->lastread)); } if ($message->locked != 0) {
protected function showPlugin($catid, $thread, &$row, $linkOnly) { // Show a simple form to allow posting to forum from the plugin $plgShowForm = $this->params->get ( 'form', 1 ); // Default is to put QuickPost at the very bottom. $formLocation = $this->params->get ( 'form_location', 0 ); // Don't repeat the CSS for each instance of this plugin in a page! if (! self::$includedCss) { $doc = JFactory::getDocument (); $doc->addStyleSheet ( KUNENA_JLIVEURL . $this->basepath .'/kunenadiscuss/discuss.css' ); self::$includedCss = true; } $subject = $row->title; $published = JFactory::getDate(isset($row->publish_up) ? $row->publish_up : 'now')->toUnix(); $now = JFactory::getDate()->toUnix(); // Find cross reference and the real topic $query = "SELECT d.content_id, d.thread_id, m.id AS mesid, t.thread, t.time FROM #__kunenadiscuss AS d LEFT JOIN #__kunena_messages AS m ON d.thread_id = m.id LEFT JOIN #__kunena_messages AS t ON t.id = m.thread WHERE d.content_id = {$this->_db->quote($row->id)}"; $this->_db->setQuery ( $query ); $result = $this->_db->loadObject (); CKunenaTools::checkDatabaseError (); if ( is_object($result) ) { if ($thread && $thread != $result->mesid) { // Custom Topic is not the same as cross reference, additional check needed $query = "SELECT t.thread FROM #__kunena_messages AS m LEFT JOIN #__kunena_messages AS t ON t.id = m.thread WHERE m.id = {$this->_db->quote($thread)}"; $this->_db->setQuery ( $query ); $result->thread = $this->_db->loadResult (); CKunenaTools::checkDatabaseError (); if (!$result->thread) { $this->debug ( "showPlugin: Custom Topic does not exist, aborting" ); return ''; } $this->debug ( "showPlugin: Custom Topic points to new location {$result->thread}" ); } if ($result->thread != $result->thread_id) { // Topic has been moved, has been deleted or tag inside message has been changed $this->debug ( "showPlugin: Removing cross reference record pointing to topic {$result->thread_id}" ); $query = "DELETE FROM #__kunenadiscuss WHERE content_id={$this->_db->quote($result->content_id)}"; $this->_db->setQuery ( $query ); $this->_db->query (); CKunenaTools::checkDatabaseError (); // We may need to add new cross reference or create new topic $thread = $result->thread; $result = null; } } if ( !is_object($result) && $thread) { // Find the real topic $query = "SELECT {$this->_db->quote($row->id)} AS content_id, t.id AS thread_id, m.id AS mesid, t.thread, t.time FROM #__kunena_messages AS m LEFT JOIN #__kunena_messages AS t ON t.id = m.thread WHERE m.id = {$this->_db->quote($thread)}"; $this->_db->setQuery ( $query ); $result = $this->_db->loadObject (); CKunenaTools::checkDatabaseError (); if ( !is_object($result) ) { $this->createReference ( $row, $thread ); $this->debug ( "showPlugin: First hit to Custom Topic, created cross reference to topic {$thread}" ); } else { $this->debug ( "showPlugin: First hit to Custom Topic, cross reference not created to topic {$thread} because it exist already" ); } } else if (! is_object($result) ) { $thread = 0; $create = $this->params->get ( 'create', 0 ); $createTime = $this->params->get ( 'create_time', 0 )*604800; // Weeks in seconds if ($createTime && $published+$createTime < $now) { $this->debug ( "showPlugin: Topic creation time expired, cannot start new discussion anymore" ); return ''; } if ($create) { $thread = $this->createTopic ( $row, $catid, $subject ); $this->debug ( "showPlugin: First hit, created new topic {$thread} into forum" ); } } else { $thread = $result->thread_id; $this->debug ( "showPlugin: Topic {$thread} exists in the forum" ); } // Do we allow answers into the topic? $closeTime = $this->params->get ( 'close_time', 0 ) * 604800; // Weeks in seconds or 0 if ($closeTime) { $this->debug ( "showPlugin: Check if topic is closed" ); if ($result) { $closeReason = $this->params->get ( 'close_reason', 0 ); if ($closeReason) { // Close topic by last post time $query = "SELECT MAX(time) FROM #__kunena_messages WHERE thread = {$this->_db->quote($result->thread)}"; $this->_db->setQuery ( $query ); $closeTime = $this->_db->loadResult () + $closeTime; CKunenaTools::checkDatabaseError (); $this->debug ( "showPlugin: Close time by last post" ); } else { // Close topic by cration time $closeTime = $result->time + $closeTime; $this->debug ( "showPlugin: Close time by topic creation" ); } } else { $closeTime = $now; } } if ($linkOnly && $thread) { $this->debug ( "showPlugin: Link only" ); $sql = "SELECT COUNT(*) FROM #__kunena_messages WHERE hold=0 AND parent!=0 AND thread={$this->_db->quote($thread)}"; $this->_db->setQuery ( $sql ); $postCount = $this->_db->loadResult (); CKunenaTools::checkDatabaseError (); $linktitle = JText::sprintf ( 'PLG_KUNENADISCUSS_DISCUSS_ON_FORUMS', $postCount ); require_once (KPATH_SITE . '/lib/kunena.link.class.php'); $link = CKunenaLink::GetThreadLink ( 'view', $catid, $thread, $linktitle, $linktitle ); return '<div class="kunenadiscuss">' . $link . '</div>'; } // ************************************************************************ // Process the QuickPost form $quickPost = ''; if (!$plgShowForm) { $this->debug ( "showPlugin: Form has been disabled" ); } elseif (!$closeTime || $closeTime >= $now) { $canPost = $this->canPost ( $catid, $thread ); if ($canPost && JRequest::getInt ( 'kdiscussContentId', 0, 'POST' ) == $row->id) { $this->debug ( "showPlugin: Reply topic!" ); $quickPost .= $this->replyTopic ( $row, $catid, $thread, $subject ); } else { $quickPost .= $this->showForm ( $row, $catid, $thread, $subject ); } } // This will be used all the way through to tell users how many posts are in the forum. $content = $this->showTopic ( $catid, $thread ); if (!$content && !$quickPost) { return ''; } if ($formLocation) { $content = '<div class="kunenadiscuss">' . $content . '<br />' . $quickPost . '</div>'; } else { $content = '<div class="kunenadiscuss">' . $quickPost . "<br />" . $content . '</div>'; } return $content; }
<td class = "td-2"> <?php echo CKunenaLink::GetSimpleLink($id); ?> <img src = "<?php echo KUNENA_URLEMOTIONSPATH; ?> arrow.gif" alt = "emo"/> </td> <td class = "td-3"> <div class = "fb-topic-title-cover"> <?php echo CKunenaLink::GetThreadLink('view', $newURLParams['catid'], $newURLParams['id'], kunena_htmlspecialchars(stripslashes($leaf->subject)), kunena_htmlspecialchars(stripslashes($leaf->subject)), 'follow', 'fb-topic-title fbm'); ?> </div> <?php } ?> <div class="fbs"> <!-- By --> <span class="topic_posted_time"><?php echo _KUNENA_POSTED_AT;
<?php /** * @version $Id$ * Kunena Discuss Plug-in * @package Kunena Discuss * * @Copyright (C) 2010-2011 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined('_JEXEC') or die(''); ?> <div class="kdiscuss-title"><?php echo CKunenaLink::GetThreadLink('view', $this->catid, $this->thread, JText::_('PLG_KUNENADISCUSS_POSTS'), JText::_('PLG_KUNENADISCUSS_POSTS'), 'follow'); ?> </div> <?php foreach ($this->messages as $message) { if ($message->parent) { $this->displayMessage($message); } } ?> <div class="kdiscuss-more"><?php echo CKunenaLink::GetThreadLink('view', $this->catid, $this->thread, JText::_('COM_KUNENA_ANN_READMORE'), JText::_('COM_KUNENA_ANN_READMORE'), 'follow'); ?> </div>
public function loadTopPolls($limit=0) { $limit = $limit ? $limit : $this->_config->poppollscount; if (count($this->topPolls) < $limit) { $query = "SELECT m.*, poll.*, SUM(opt.votes) AS count FROM #__kunena_polls_options AS opt INNER JOIN #__kunena_polls AS poll ON poll.id=opt.pollid LEFT JOIN #__kunena_messages AS m ON poll.threadid=m.id GROUP BY pollid ORDER BY count DESC"; $this->_db->setQuery($query, 0, $limit); $this->topPolls = $this->_db->loadObjectList(); KunenaError::checkDatabaseError(); $top = reset($this->topPolls); if (empty($top->count)){ $this->topPolls = array(); return; } foreach ($this->topPolls as $item) { $item->link = CKunenaLink::GetThreadLink( 'view', $item->catid, $item->id, KunenaHtmlParser::parseText ($item->subject), '' ); $item->percent = round(100 * $item->count / $top->count); } $top->title = JText::_('COM_KUNENA_STAT_TOP') .' '. $limit .' '. JText::_('COM_KUNENA_STAT_POPULAR') .' '. JText::_('COM_KUNENA_STAT_POPULAR_POLLS_KGSG'); $top->titleName = JText::_('COM_KUNENA_POLL_STATS_NAME'); $top->titleCount = JText::_('COM_KUNENA_USRL_VOTES'); } return array_slice($this->topPolls, 0, $limit); }
<?php } ?> <?php } elseif ($this->type == 'polls') { ?> <?php foreach ($this->stats as $stat) { ?> <tr class="krow<?php echo ($i ^= 1) + 1; ?> "> <td class="kcol-first"><?php echo CKunenaLink::GetThreadLink('view', $stat->catid, $stat->threadid, JString::substr(htmlspecialchars($stat->title), '0', $this->params->get('titlelength')), $stat->title); ?> </td> <td class="kcol-last"><span class="kstats-hits-bg"><span class="kstats-hits" style="width:<?php echo $this->getBarWidth($stat->total); ?> %;"><?php echo CKunenaTools::formatLargeNumber($stat->total, 3); ?> </span></span></td> </tr> <?php } ?> <?php
</tr> <?php if (empty($this->stats)) : ?> <tr class="krow<?php echo ($i^=1)+1;?>"><td><?php echo JText::_('MOD_KUNENASTATS_NO_ITEMS'); ?></td></tr> <?php else : ?> <?php if ( $this->type == 'topics' ) : ?> <?php foreach ( $this->stats as $stat) : ?> <tr class="krow<?php echo ($i^=1)+1;?>"> <td class="kcol-first"><?php echo CKunenaLink::GetThreadLink('view', $stat->catid, $stat->thread, JString::substr ( htmlspecialchars ($stat->subject), '0', $this->params->get ( 'titlelength' ) ), htmlspecialchars ($stat->subject) ); ?></td> <td class="kcol-last"><span class="kstats-hits-bg"><span class="kstats-hits" style="width:<?php echo $this->getBarWidth($stat->hits);?>%;"><?php echo CKunenaTools::formatLargeNumber($stat->hits, 3);?></span></span></td> </tr> <?php endforeach; ?> <?php elseif ( $this->type == 'polls' ) : ?> <?php foreach ( $this->stats as $stat) : ?> <tr class="krow<?php echo ($i^=1)+1;?>"> <td class="kcol-first"><?php echo CKunenaLink::GetThreadLink('view', $stat->catid, $stat->threadid, JString::substr ( htmlspecialchars ($stat->title), '0', $this->params->get ( 'titlelength' ) ), $stat->title); ?></td> <td class="kcol-last"><span class="kstats-hits-bg"><span class="kstats-hits" style="width:<?php echo $this->getBarWidth($stat->total);?>%;"><?php echo CKunenaTools::formatLargeNumber($stat->total, 3);?></span></span></td> </tr> <?php endforeach; ?> <?php elseif ( $this->type == 'posters' ) : ?> <?php foreach ( $this->stats as $stat) : ?> <tr class="krow<?php echo ($i^=1)+1;?>"> <td class="kcol-first"><?php echo CKunenaLink::GetProfileLink($stat->userid, JString::substr ( htmlspecialchars ($stat->username), '0', $this->params->get ( 'titlelength' ) )); ?></td> <td class="kcol-last"><span class="kstats-hits-bg"><span class="kstats-hits" style="width:<?php echo $this->getBarWidth($stat->posts);?>%;"><?php echo CKunenaTools::formatLargeNumber($stat->posts, 3);?></span></span></td> </tr> <?php endforeach; ?> <?php elseif ( $this->type == 'profiles' ) : ?> <?php foreach ( $this->stats as $stat) : ?> <tr class="krow<?php echo ($i^=1)+1;?>">
<?php foreach ($this->toppolls as $toppoll) { $k = 1 - $k; if (intval($toppoll->total) == $this->toppollvotes) { $barwidth = 100; } else { $barwidth = round(intval($toppoll->total) * 100 / $this->toppollvotes); } ?> <tr class = "k<?php echo $this->escape($tabclass[$k]); ?> "> <td class="kcol-first"> <?php echo CKunenaLink::GetThreadLink('view', intval($toppoll->catid), intval($toppoll->threadid), $this->escape($toppoll->title), ''); ?> </td> <td class="kcol-mid"> <img class = "kstats-bar" src = "<?php echo KUNENA_TMPLTMAINIMGURL . 'images/bar.png'; ?> " alt = "" height = "10" width = "<?php echo intval($barwidth); ?> %"/> </td> <td class="kcol-last"> <?php echo intval($toppoll->total); ?>
echo '</font></div>'; } } echo "</td>"; echo " <td class=\"td-3 fbm\" align=\"center\" >{$numtopics}</td>"; echo " <td class=\"td-4 fbm\" align=\"center\" >{$numreplies}</td>"; if ($numtopics != 0) { ?> <td class = "td-5" align="left"> <div class = "<?php echo $boardclass; ?> latest-subject fbm"> <?php echo CKunenaLink::GetThreadLink('view', $latestcatid, $latestthread, kunena_htmlspecialchars(stripslashes($latestsubject)), kunena_htmlspecialchars(stripslashes($latestsubject)), $rel = 'nofollow'); ?> </div> <div class = "<?php echo $boardclass; ?> latest-subject-by fbs"> <?php echo _GEN_BY; ?> <?php echo CKunenaLink::GetProfileLink($fbConfig, $latestuserid, $latestname, $rel = 'nofollow'); ?>
<?php /** * @version $Id$ * Kunena Discuss Plug-in * @package Kunena Discuss * * @Copyright (C) 2010-2011 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined( '_JEXEC' ) or die ( '' ); ?> <div class="kdiscuss-title"><?php echo CKunenaLink::GetThreadLink ( 'view', $this->catid, $this->thread, JText::_('PLG_KUNENADISCUSS_POSTS'), 'follow') ?></div> <?php foreach ( $this->messages as $message ) { if ($message->parent) $this->displayMessage($message); } ?> <div class="kdiscuss-more"><?php echo CKunenaLink::GetThreadLink ( 'view', $this->catid, $this->thread, JText::_('COM_KUNENA_ANN_READMORE'), 'follow') ?></div>
<?php echo $this->ktemplate->getTopicIcon($item); ?> </li> <?php } ?> <li class="klatest-subject"> <?php if ($this->params->get('sh_sticky')) { if ($item->ordering) { echo '<img src="' . JURI::root() . 'modules/mod_kunenalatest/tmpl/images/sticky.png" alt="' . JText::_('MOD_KUNENALATEST_STICKY_TOPIC') . '" title="' . JText::_('MOD_KUNENALATEST_STICKY_TOPIC') . '" />'; } } if ($this->params->get('choosemodel') != 'latestposts' && $this->params->get('choosemodel') != 'latesttopics') { echo CKunenaLink::GetThreadLink('view', $item->catid, $item->id, JString::substr(htmlspecialchars($item->subject), '0', $this->params->get('titlelength')), JString::substr(htmlspecialchars(KunenaParser::stripBBCode($item->message)), '0', $this->params->get('messagelength')), 'follow'); } else { if ($this->topic_ordering == 'ASC') { echo CKunenaLink::GetThreadPageSpecialLink('view', intval($item->catid), intval($item->thread), $threadPages, intval($this->kunena_config->messages_per_page), JString::substr(htmlspecialchars($item->subject), '0', $this->params->get('titlelength')), intval($item->id), '', '', JString::substr(htmlspecialchars(KunenaParser::stripBBCode($item->message)), '0', $this->params->get('messagelength'))); } else { echo CKunenaLink::GetThreadPageSpecialLink('view', intval($item->catid), intval($item->thread), 1, intval($this->kunena_config->messages_per_page), JString::substr(htmlspecialchars($item->subject), '0', $this->params->get('titlelength')), intval($item->id), '', '', JString::substr(htmlspecialchars(KunenaParser::stripBBCode($item->message)), '0', $this->params->get('messagelength'))); } } if ($item->unread) { echo '<sup class="knewchar">(' . JText::_($this->params->get('unreadindicator')) . ")</sup>"; } if ($this->params->get('sh_favorite')) { if ($item->favcount) { if ($item->myfavorite) { echo '<img class="favoritestar" src="' . $this->ktemplate->getImagePath('icons/favoritestar.png') . '" alt="' . JText::_('MOD_KUNENALATEST_FAVORITE') . '" title="' . JText::_('MOD_KUNENALATEST_FAVORITE') . '" />'; } else {
?> </ul> <input type="hidden" name="kpoll-id" value="<?php echo intval($this->id); ?> "> <?php echo JHTML::_('form.token'); ?> </fieldset> <div class="kpoll-btns"> <input id="kpoll-button-vote" class="kbutton ks" type="submit" value="<?php echo JText::_('COM_KUNENA_POLL_BUTTON_VOTE'); ?> " /> <?php echo ' ' . CKunenaLink::GetThreadLink('view', intval($this->catid), intval($this->id), JText::_('COM_KUNENA_POLL_NAME_URL_RESULT'), JText::_('COM_KUNENA_POLL_NAME_URL_RESULT'), 'follow'); ?> </div> <input type="hidden" id="kpollvotejsonurl" value="<?php echo CKunenaLink::GetJsonURL($json_action, '', true); ?> " /> </form> </div> </td> </tr> </table> </div> </div> </div>