function displayDefault($tpl = null) { $params = $this->app->getParams('com_kunena'); $this->header = $params->get('page_title'); $this->body = $params->get('body'); $this->_prepareDocument(); $format = $params->get('body_format'); $this->header = $this->escape($this->header); if ($format == 'html') { $this->body = trim($this->body); } elseif ($format == 'text') { $this->body = $this->escape($this->body); } else { $this->body = KunenaHtmlParser::parseBBCode($this->body); } $this->render('Widget/Custom', $tpl); }
function displayAnnouncement($tpl = null) { if (KunenaFactory::getConfig()->showannouncement > 0) { $moderator = intval($this->me->isModerator('global')); $cache = JFactory::getCache('com_kunena', 'output'); if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return; // User needs to be global moderator to edit announcements if ($moderator) { $this->canEdit = true; } else { $this->canEdit = false; } // FIXME: move into model $db = JFactory::getDBO(); $query = "SELECT * FROM #__kunena_announcement WHERE published='1' ORDER BY created DESC"; $db->setQuery ( $query, 0, 1 ); $this->announcement = $db->loadObject (); if (KunenaError::checkDatabaseError()) return; if ($this->announcement) { $this->annTitle = KunenaHtmlParser::parseText($this->announcement->title); $this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300); $this->annDate = KunenaDate::getInstance($this->announcement->created); $this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list"); $this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null; $result = $this->loadTemplate($tpl); if (JError::isError($result)) { return $result; } echo $result; } else { echo ' '; } $cache->end(); } else echo ' '; }
function displayAnnouncement($tpl = null) { if (KunenaFactory::getConfig()->showannouncement > 0) { $moderator = intval($this->me->isModerator('global')); $cache = JFactory::getCache('com_kunena', 'output'); if ($cache->start("{$this->template->name}.common.announcement.{$moderator}", 'com_kunena.template')) return; // User needs to be global moderator to edit announcements if ($moderator) { $this->canEdit = true; } else { $this->canEdit = false; } $this->announcement = $this->get('Announcement'); if ($this->announcement) { $this->annTitle = KunenaHtmlParser::parseText($this->announcement->title); $this->annDescription = $this->announcement->sdescription ? KunenaHtmlParser::parseBBCode($this->announcement->sdescription) : KunenaHtmlParser::parseBBCode($this->announcement->description, 300); $this->annDate = KunenaDate::getInstance($this->announcement->created); $this->annListURL = KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=list"); $this->annMoreURL = !empty($this->announcement->description) ? KunenaRoute::_("index.php?option=com_kunena&view=announcement&id={$this->announcement->id}") : null; $result = $this->loadTemplate($tpl); if (JError::isError($result)) { return $result; } echo $result; } else { echo ' '; } $cache->end(); } else echo ' '; }
function createItem($title, $url, $description, $category, $date, $userid, $username) { if ($this->config->rss_author_in_title) { // We want author in item titles $title .= ' - ' . JText::_('COM_KUNENA_BY') . ': ' . $username; } $description = preg_replace('/\\[confidential\\](.*?)\\[\\/confidential\\]/s', '', $description); $description = preg_replace('/\\[hide\\](.*?)\\[\\/hide\\]/s', '', $description); $description = preg_replace('/\\[spoiler\\](.*?)\\[\\/spoiler\\]/s', '', $description); $description = preg_replace('/\\[code\\](.*?)\\[\\/code]/s', '', $description); if ((bool) $this->config->rss_allow_html) { $description = KunenaHtmlParser::parseBBCode($description, null, (int) $this->config->rss_word_count); } else { $description = KunenaHtmlParser::parseText($description, (int) $this->config->rss_word_count); } // Assign values to feed item $item = new JFeedItem(); $item->title = $title; $item->link = $url; $item->description = $description; $item->date = $date->toSql(); $item->author = $username; // FIXME: inefficient to load users one by one -- also vulnerable to J! 2.5 user is NULL bug if ($this->config->rss_author_format != 'name') { $item->authorEmail = JFactory::getUser($userid)->email; } $item->category = $category; // Finally add item to feed $this->document->addItem($item); }
public function onAfterReply($message) { if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) { CFactory::load('libraries', 'userpoints'); CUserPoints::assignPoint('com_kunena.thread.reply'); } $parent = new stdClass(); $parent->forceSecure = true; $parent->forceMinimal = true; $content = KunenaHtmlParser::parseBBCode($message->message, $parent, $this->params->get('activity_stream_limit', 0)); // Add readmore permalink $content .= '<br /><a rel="nofollow" href="' . $message->getPermaUrl() . '" class="small profile-newsfeed-item-action">' . JText::_('COM_KUNENA_READMORE') . '</a>'; $act = new stdClass(); $act->cmd = 'wall.write'; $act->actor = $message->userid; $act->target = 0; // no target $act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE', '<a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>')); $act->content = $content; $act->app = 'kunena.post'; $act->cid = $message->thread; $act->access = $this->getAccess($message->getCategory()); // Comments and like support $act->comment_id = $message->thread; $act->comment_type = 'kunena.post'; $act->like_id = $message->thread; $act->like_type = 'kunena.post'; // Do not add private activities if ($act->access > 20) { return; } CFactory::load('libraries', 'activities'); CActivityStream::add($act); }
/** * Method to display the layout of search results * * @return void */ public function displayRows() { // Run events $params = new JRegistry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'search'); $params->set('kunena_layout', 'default'); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('kunena'); $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->results, &$params, 0)); foreach ($this->results as $this->message) { $this->topic = $this->message->getTopic(); $this->category = $this->message->getCategory(); $this->categoryLink = $this->getCategoryLink($this->category->getParent()) . ' / ' . $this->getCategoryLink($this->category); $ressubject = KunenaHtmlParser::parseText($this->message->subject); $resmessage = KunenaHtmlParser::parseBBCode($this->message->message, 500); $profile = KunenaFactory::getUser((int) $this->message->userid); $this->useravatar = $profile->getAvatarImage('kavatar', 'post'); foreach ($this->searchwords as $searchword) { if (empty($searchword)) { continue; } $ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/iu", '<span class="searchword" >' . $searchword . '</span>', $ressubject); // FIXME: enable highlighting, but only after we can be sure that we do not break html // $resmessage = preg_replace ( "/" . preg_quote ( $searchword, '/' ) . "/iu", '<span class="searchword" >' . $searchword . '</span>', $resmessage ); } $this->author = $this->message->getAuthor(); $this->topicAuthor = $this->topic->getAuthor(); $this->topicTime = $this->topic->first_post_time; $this->subjectHtml = $ressubject; $this->messageHtml = $resmessage; $contents = $this->subLayout('Search/Results/Row')->setProperties($this->getProperties()); echo $contents; } }
function displayDefault($tpl = null) { $this->header = $this->escape($this->header); if (empty($this->html)) { $this->body = KunenaHtmlParser::parseBBCode($this->body); } $result = $this->loadTemplateFile($tpl); if (JError::isError($result)) { return $result; } echo $result; }
function displayEdit($tpl = null) { $body = JRequest::getVar('body', '', 'post', 'string', JREQUEST_ALLOWRAW); $response = array(); if ($this->me->exists()) { $msgbody = KunenaHtmlParser::parseBBCode($body, $this); $response['preview'] = $msgbody; } // Set the MIME type and header for JSON output. $this->document->setMimeEncoding('application/json'); JResponse::setHeader('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"'); echo json_encode($response); }
/** * @param null $tpl * * @throws Exception */ function displayEdit($tpl = null) { $body = JFactory::getApplication()->input->get('body', '', 'post', 'string', 'raw'); // RAW input $response = array(); if ($this->me->exists() || $this->config->pubwrite) { $msgbody = KunenaHtmlParser::parseBBCode($body, $this); $response['preview'] = $msgbody; } // Set the MIME type and header for JSON output. $this->document->setMimeEncoding('application/json'); JFactory::getApplication()->sendHeaders('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"'); echo json_encode($response); }
function displayMessage($id, $message, $template = null) { $layout = $this->getLayout(); if (!$template) { $template = $this->state->get('profile.location'); $this->setLayout('default'); } $this->mmm++; $this->message = $message; $this->profile = $this->message->getAuthor(); $this->replynum = $message->replynum; $usertype = $this->me->getType($this->category->id, true); if ($usertype == 'user' && $this->message->userid == $this->profile->userid) { $usertype = 'owner'; } // Thank you info and buttons $this->thankyou = array(); $this->total_thankyou = 0; $this->more_thankyou = 0; if (isset($message->thankyou)) { if ($this->config->showthankyou && $this->profile->userid) { $task = "index.php?option=com_kunena&view=topic&task=%s&catid={$this->category->id}&id={$this->topic->id}&mesid={$this->message->id}&" . JSession::getFormToken() . '=1'; // for normal users, show only limited number of thankyou (config->thankyou_max) if (!$this->me->isAdmin() && !$this->me->isModerator()) { if (count($message->thankyou) > $this->config->thankyou_max) { $this->more_thankyou = count($message->thankyou) - $this->config->thankyou_max; } $this->total_thankyou = count($message->thankyou); $thankyous = array_slice($message->thankyou, 0, $this->config->thankyou_max, true); } else { $thankyous = $message->thankyou; } if ($this->message->authorise('unthankyou') && $this->me->isModerator($this->message->getCategory())) { $canUnthankyou = true; } else { $canUnthankyou = false; } $userids_thankyous = array(); foreach ($thankyous as $userid => $time) { $userids_thankyous[] = $userid; } $loaded_users = KunenaUserHelper::loadUsers($userids_thankyous); $thankyou_delete = ''; foreach ($loaded_users as $userid => $user) { $thankyou_delete = $canUnthankyou === true ? ' <a title="' . JText::_('COM_KUNENA_BUTTON_THANKYOU_REMOVE_LONG') . '" href="' . KunenaRoute::_(sprintf($task, "unthankyou&userid={$userid}")) . '"><img src="' . $this->ktemplate->getImagePath('icons/publish_x.png') . '" title="" alt="" /></a>' : ''; $this->thankyou[] = $loaded_users[$userid]->getLink() . $thankyou_delete; } } } // TODO: add context (options, template) to caching $cache = JFactory::getCache('com_kunena', 'output'); $cachekey = "message.{$this->getTemplateMD5()}.{$layout}.{$template}.{$usertype}.c{$this->category->id}.m{$this->message->id}.{$this->message->modified_time}"; $cachegroup = 'com_kunena.messages'; if ($this->config->reportmsg && $this->me->exists()) { if (!$this->config->user_report && $this->me->userid == $this->message->userid && !$this->me->isModerator()) { $this->reportMessageLink = null; } else { $this->reportMessageLink = JHTML::_('kunenaforum.link', 'index.php?option=com_kunena&view=topic&layout=report&catid=' . intval($this->category->id) . '&id=' . intval($this->message->thread) . '&mesid=' . intval($this->message->id), JText::_('COM_KUNENA_REPORT'), JText::_('COM_KUNENA_REPORT')); } } $contents = false; //$cache->get($cachekey, $cachegroup); if (!$contents) { //Show admins the IP address of the user: if ($this->category->authorise('admin') || $this->category->authorise('moderate') && !$this->config->hide_ip) { if ($this->message->ip) { if (!empty($this->message->ip)) { $this->ipLink = '<a href="http://whois.domaintools.com/' . $this->message->ip . '" target="_blank"> IP: ' . $this->message->ip . '</a>'; } else { $this->ipLink = ' '; } } else { $this->ipLink = null; } } $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->profile->signature, null, $this->config->maxsig); $this->attachments = $this->message->getAttachments(); // Link to individual message if ($this->config->ordering_system == 'replyid') { $this->numLink = $this->getSamePageAnkerLink($message->id, '#[K=REPLYNO]'); } else { $this->numLink = $this->getSamePageAnkerLink($message->id, '#' . $message->id); } if ($this->message->hold == 0) { $this->class = 'kmsg'; } elseif ($this->message->hold == 1) { $this->class = 'kmsg kunapproved'; } else { if ($this->message->hold == 2 || $this->message->hold == 3) { $this->class = 'kmsg kdeleted'; } } // New post suffix for class $this->msgsuffix = ''; if ($this->message->isNew()) { $this->msgsuffix = '-new'; } $contents = (string) $this->loadTemplateFile($template); if ($usertype == 'guest') { $contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents); } // FIXME: enable caching after fixing the issues //if ($this->cache) $cache->store($contents, $cachekey, $cachegroup); } elseif ($usertype == 'guest') { echo $contents; $this->setLayout($layout); return; } $contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents); echo $contents; $this->setLayout($layout); }
/** * @param null $tpl * * @throws Exception */ protected function displayCommon($tpl = null) { $userid = JFactory::getApplication()->input->getInt('userid'); $this->_db = JFactory::getDBO(); $this->do = JFactory::getApplication()->input->getWord('layout'); if (!$userid) { $this->user = JFactory::getUser(); } else { $this->user = JFactory::getUser($userid); } if ($this->user->id == 0 || $this->me->userid == 0 && !$this->config->pubprofile) { $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice'); return; } $integration = KunenaFactory::getProfile(); $activityIntegration = KunenaFactory::getActivityIntegration(); $template = KunenaFactory::getTemplate(); $this->params = $template->params; if (get_class($integration) == 'KunenaProfileNone') { $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice'); return; } $this->allow = true; $this->profile = KunenaFactory::getUser($this->user->id); if (!$this->profile->exists()) { $this->profile->save(); } if ($this->profile->userid == $this->me->userid) { if ($this->do != 'edit') { $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_EDIT') . ' »', JText::_('COM_KUNENA_EDIT') . ' »', 'nofollow', 'edit', ''); } else { $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' »', JText::_('COM_KUNENA_BACK') . ' »', 'nofollow', '', ''); } } $this->name = $this->user->username; if ($this->config->showuserstats) { $this->rank_image = $this->profile->getRank(0, 'image'); $this->rank_title = $this->profile->getRank(0, 'title'); $this->posts = $this->profile->posts; $this->thankyou = $this->profile->thankyou; $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid); $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid); } if ($this->config->userlist_joindate || $this->me->isModerator()) { $this->registerdate = $this->user->registerDate; } if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) { $this->lastvisitdate = $this->user->lastvisitDate; } if (!isset($this->lastvisitdate) || $this->lastvisitdate == "0000-00-00 00:00:00") { $this->lastvisitdate = null; } $this->avatarlink = $this->profile->getAvatarImage('kavatar', 'profile'); $this->personalText = $this->profile->personalText; $this->signature = $this->profile->signature; $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->signature, null, $this->config->maxsig); $this->localtime = KunenaDate::getInstance('now', $this->user->getParam('timezone', $this->app->get('offset', null))); try { $offset = new DateTimeZone($this->user->getParam('timezone', $this->app->get('offset', null))); } catch (Exception $e) { $offset = null; } $this->localtime->setTimezone($offset); $this->moderator = KunenaAccess::getInstance()->getModeratorStatus($this->profile); $this->admin = $this->profile->isAdmin(); switch ($this->profile->gender) { case 1: $this->genderclass = 'male'; $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE'); break; case 2: $this->genderclass = 'female'; $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE'); break; default: $this->genderclass = 'unknown'; $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN'); } if ($this->profile->location) { $this->locationlink = '<a href="http://maps.google.com?q=' . $this->escape($this->profile->location) . '" target="_blank">' . $this->escape($this->profile->location) . '</a>'; } else { $this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN'); } $this->online = $this->profile->isOnline(); $this->showUnusedSocial = true; if (!preg_match("~^(?:f|ht)tps?://~i", $this->profile->websiteurl)) { $this->websiteurl = 'http://' . $this->profile->websiteurl; } else { $this->websiteurl = $this->profile->websiteurl; } $avatar = KunenaFactory::getAvatarIntegration(); $this->editavatar = $avatar instanceof KunenaAvatarKunena ? true : false; $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true); $this->canBan = $this->banInfo->canBan(); if ($this->config->showbannedreason) { $this->banReason = $this->banInfo->reason_public; } // Which tabs to show? $this->showUserPosts = true; $this->showSubscriptions = $this->config->allowsubscriptions && $this->me->userid == $this->profile->userid; $this->showFavorites = $this->config->allowfavorites && $this->me->userid == $this->profile->userid; $this->showThankyou = $this->config->showthankyou && $this->me->exists(); $this->showUnapprovedPosts = $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus(); // || $this->me->userid == $this->profile->userid; $this->showAttachments = $this->canManageAttachments() && ($this->me->isModerator() || $this->me->userid == $this->profile->userid); $this->showBanManager = $this->me->isModerator() && $this->me->userid == $this->profile->userid; $this->showBanHistory = $this->me->isModerator() && $this->me->userid != $this->profile->userid; $this->showBanUser = $this->canBan; if ($this->me->userid != $this->profile->userid) { $this->profile->uhits++; $this->profile->save(); } $private = KunenaFactory::getPrivateMessaging(); if ($this->me->userid == $this->user->id) { $this->pmCount = $private->getUnreadCount($this->me->userid); $this->pmLink = $private->getInboxLink($this->pmCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $this->pmCount) : JText::_('COM_KUNENA_PMS_INBOX')); } else { $this->pmLink = $this->profile->profileIcon('private'); } $this->_prepareDocument('common'); $layout = $this->getLayout() != 'default' ? "User/{$this->getLayout()}" : 'User/Item'; $this->render($layout, $tpl); }
/** * Render user signature. * * @return string * * @since K4.0 */ public function getSignature() { if (!isset($this->_signature)) { $this->_signature = KunenaHtmlParser::parseBBCode($this->signature, $this, KunenaConfig::getInstance()->maxsig); } return $this->_signature; }
<div class="kblock"> <div class="kheader clearfix"> <span class="ktoggler"><a class="ktoggler close" title="<?php echo JText::_('COM_KUNENA_TOGGLER_COLLAPSE'); ?> " rel="frontstats_tbody"></a></span> <h2><span><?php echo JText::_('COM_KUNENA_FORUM_HEADER'); ?> </span></h2> </div> <div class="kcontainer" id="frontstats_tbody"> <div class="kbody"> <div class="kfheadercontent"> <?php echo KunenaHtmlParser::parseBBCode($this->category->headerdesc); ?> </div> </div> </div> </div> <?php } ?> <?php if (!$this->category->isSection()) { ?> <table class="klist-actions"> <tr> <td class="klist-actions-goto">
</ul> </div> </div> <div class="clrline"></div> <div id="kprofile-rightcolbot"> <div class="kprofile-rightcol2"> <ul> <?php if ($this->config->showemail && (!$this->profile->hideEmail || $this->me->isModerator())): ?><li><span class="kicon-profile kicon-profile-email"></span><?php echo JHTML::_('email.cloak', $this->user->email) ?></li><?php endif; ?> <?php // FIXME: we need a better way to add http/https ?> <li><?php if (!empty($this->profile->websiteurl)):?><span class="kicon-profile kicon-profile-website"></span><?php endif;?><a href="http://<?php echo $this->escape($this->profile->websiteurl); ?>" target="_blank"><?php echo KunenaHtmlParser::parseText($this->profile->websitename); ?></a></li> </ul> </div> <div class="kprofile-rightcol1"> <h4><?php echo JText::_('COM_KUNENA_MYPROFILE_SIGNATURE'); ?></h4> <div class="kmsgsignature"><div><?php echo KunenaHtmlParser::parseBBCode($this->signature); ?></div></div> </div> </div> <div class="clrline"></div> <div id="kprofile-tabs"> <dl class="tabs"> <?php if ($this->me->isModerator()): ?> <dt class="open" title="<?php echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); ?>"><?php echo JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); ?></dt> <dd style="display: none;"> <?php $this->displayUnapprovedPosts(); ?> </dd> <?php endif; ?> <dt class="open" title="<?php echo JText::_('COM_KUNENA_USERPOSTS'); ?>"><?php echo JText::_('COM_KUNENA_USERPOSTS'); ?></dt>
/** * @param string $field * * @return int|string */ public function displayField($field, $html = true) { switch ($field) { case 'id': return intval($this->id); case 'subject': return KunenaHtmlParser::parseText($this->subject); case 'message': // FIXME: add context to BBCode parser (and fix logic in the parser) return $html ? KunenaHtmlParser::parseBBCode($this->message, $this) : KunenaHtmlParser::stripBBCode($this->message, $this->parent, $html); } return ''; }
public function parse($text, $len = 0, $parent) { if ($this instanceof KunenaViewSearch) { $parent_object = $parent; } else { $parent_object = $this; } return KunenaHtmlParser::parseBBCode($text, $parent_object, $len); }
echo '<sup class="knewchar">(' . $category->getNewCount() . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ")</sup>"; } if ($category->locked) { echo $this->getIcon('kforumlocked', JText::_('COM_KUNENA_LOCKED_CATEGORY')); } if ($category->review) { echo $this->getIcon('kforummoderated', JText::_('COM_KUNENA_GEN_MODERATED')); } ?> </div> <?php if (!empty($category->description)) { ?> <div class="kthead-desc km hidden-phone"><?php echo KunenaHtmlParser::parseBBCode($category->description); ?> </div> <?php } ?> <?php // Display subcategories if (!empty($this->categories[$category->id])) { ?> <div class="kthead-child"> <div class="kcc-table"> <?php foreach ($this->categories[$category->id] as $childforum) { ?> <div class="kcc-subcat km">
* @link http://www.kunena.org **/ defined ( '_JEXEC' ) or die (); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS') . ' - ' . $this->config->board_title); ?> <div id="kannounce"> <h2 class="kheader"> <a href="" title="<?php echo JText::_('COM_KUNENA_VIEW_COMMON_ANNOUNCE_LIST') ?>" rel="kannounce-detailsbox"> <?php echo KunenaHtmlParser::parseText($this->announcement->title) ?> </a> </h2> <?php if ($this->canEdit) : ?> <div class="kactions"> <?php echo CKunenaLink::GetAnnouncementLink( 'edit', $this->announcement->id, JText::_('COM_KUNENA_ANN_EDIT'), JText::_('COM_KUNENA_ANN_EDIT')); ?> | <?php echo CKunenaLink::GetAnnouncementLink( 'delete', $this->announcement->id, JText::_('COM_KUNENA_ANN_DELETE'), JText::_('COM_KUNENA_ANN_DELETE')); ?> | <?php echo CKunenaLink::GetAnnouncementLink( 'add',NULL, JText::_('COM_KUNENA_ANN_ADD'), JText::_('COM_KUNENA_ANN_ADD')); ?> | <?php echo CKunenaLink::GetAnnouncementLink( 'show', NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL')); ?> </div> <?php endif; ?> <div class="kdetailsbox" id="kannounce-detailsbox"> <ul class="kheader-desc"> <?php if ($this->announcement->showdate > 0) : ?> <li class="kannounce-date"><?php echo KunenaDate::getInstance($this->announcement->created)->toKunena('date_today') ?></li> <?php endif; ?> <li class="kannounce-desc"><p><?php echo !empty($this->announcement->description) ? KunenaHtmlParser::parseBBCode($this->announcement->description) : KunenaHtmlParser::parseBBCode($this->announcement->sdescription); ?></p></li> </ul> </div> </div> <?php echo $this->getModulePosition ( 'kunena_announcement' ) ?>
function parse($text, $len=0) { return KunenaHtmlParser::parseBBCode($text, $this, $len); }
/** * @param string $field Field to be displayed. * * @return int|string */ public function displayField($field) { switch ($field) { case 'id': return intval($this->id); case 'name': case 'icon': return KunenaHtmlParser::parseText($this->name); case 'description': case 'headerdesc': return KunenaHtmlParser::parseBBCode($this->{$field}); } return ''; }
public function displayField($field, $mode = null) { switch ($field) { case 'id': return intval($this->id); case 'title': return KunenaHtmlParser::parseText($this->title); case 'sdescription': return KunenaHtmlParser::parseBBCode($this->sdescription); case 'description': return KunenaHtmlParser::parseBBCode($this->description ? $this->description : $this->sdescription); case 'created_by': return $this->getAuthor()->getLink(); case 'created': if (!$mode) { $mode = 'date_today'; } return $this->getCreationDate()->toKunena($mode); } }
/** * Processes the stream item for new thanks * * @since 1.0 * @access public * @param SocialStreamItem The stream item object * @param bool Determine if we should include the privacy or not. * @return */ private function processThanked(&$item, $includePrivacy = true) { $message = KunenaForumMessageHelper::get($item->contextId); $topic = $message->getTopic(); $category = $topic->getCategory(); if (!$category->authorise('read') || !$topic->authorise('read')) { // user not allow to view the content. return; } // Apply likes on the stream $likes = FD::likes()->get($item->contextId, 'kunena', 'thank', SOCIAL_APPS_GROUP_USER, $item->uid); $item->likes = $likes; // disable comments on the stream $item->comments = false; // Define standard stream looks $item->display = SOCIAL_STREAM_DISPLAY_MINI; $item->color = '#6f90b5'; // Set the actor $actor = $item->actor; $target = $item->targets[0]; $parent = $this->createParent($message->id); $message->message = KunenaHtmlParser::parseBBCode($message->message, $parent, 250); $message->message = $this->filterContent($message->message); $this->set('actor', $actor); $this->set('target', $target); $this->set('topic', $topic); $this->set('message', $message); $item->title = parent::display('streams/' . $item->verb . '.title'); $item->opengraph->addDescription($item->title); }
?> <tr class="<?php echo $this->getTopicClass('k', 'row') ?>"> <td class="kcol-first kcol-ktopicicon"> <?php echo $this->getTopicLink ( $this->topic, 'unread', $this->topic->getIcon() ) ?> </td> <td class="kcol-mid ktopictittle"> <?php /*if ($this->message->attachments) { echo $this->getIcon ( 'ktopicattach', JText::_('COM_KUNENA_ATTACH') ); }*/ ?> <div class="ktopic-title-cover"> <?php echo $this->getTopicLink ( $this->topic, $this->message, KunenaHtmlParser::parseText ($this->message->subject, 30), KunenaHtmlParser::stripBBCode ($this->message->message), 'ktopic-title km' ) ?> </div> <div style="display:none"><?php echo KunenaHtmlParser::parseBBCode ($this->message->message);?></div> </td> <td class="kcol-mid ktopictittle"> <div class="ktopic-title-cover"> <?php echo $this->getTopicLink ( $this->topic, null, null, KunenaHtmlParser::stripBBCode ( $this->topic->first_post_message, 500), 'ktopic-title km' ); if ($this->topic->getUserTopic()->favorite) { echo $this->getIcon ( 'kfavoritestar', JText::_('COM_KUNENA_FAVORITE') ); } if ($this->topic->unread) { echo $this->getTopicLink ( $this->topic, 'unread', '<sup dir="ltr" class="knewchar">(' . $this->topic->unread . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ')</sup>' ); } if ($this->topic->locked != 0) { echo $this->getIcon ( 'ktopiclocked', JText::_('COM_KUNENA_GEN_LOCKED_TOPIC') ); }
public function edit() { $this->id = JRequest::getInt('mesid', 0); $message = KunenaForumMessageHelper::get($this->id); $topic = $message->getTopic(); $fields = array ( 'name' => JRequest::getString ( 'authorname', $message->name ), 'email' => JRequest::getString ( 'email', $message->email ), 'subject' => JRequest::getVar('subject', $message->subject, 'POST', 'string', JREQUEST_ALLOWRAW), // RAW input 'message' => JRequest::getVar('message', $message->message, 'POST', 'string', JREQUEST_ALLOWRAW), // RAW input 'modified_reason' => JRequest::getString ( 'modified_reason', $message->modified_reason ), 'icon_id' => JRequest::getInt ( 'topic_emoticon', $topic->icon_id ), 'anonymous' => JRequest::getInt ( 'anonymous', 0 ), 'poll_title' => JRequest::getString ( 'poll_title', null ), 'poll_options' => JRequest::getVar('polloptionsID', array (), 'post', 'array'), // Array of key => string 'poll_time_to_live' => JRequest::getString ( 'poll_time_to_live', 0 ), 'tags' => JRequest::getString ( 'tags', null ), 'mytags' => JRequest::getString ( 'mytags', null ) ); if (! JSession::checkToken('post')) { $this->app->setUserState('com_kunena.postfields', $fields); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' ); $this->redirectBack (); } if (!$message->authorise('edit')) { $this->app->setUserState('com_kunena.postfields', $fields); $this->app->enqueueMessage ( $message->getError(), 'notice' ); $this->redirectBack (); } // Update message contents $message->edit ( $fields ); // If requested: Make message to be anonymous if ($fields['anonymous'] && $message->getCategory()->allow_anonymous) { $message->makeAnonymous(); } // Mark attachments to be deleted $attachments = JRequest::getVar('attachments', array(), 'post', 'array'); // Array of integer keys $attachkeeplist = JRequest::getVar('attachment', array(), 'post', 'array'); // Array of integer keys $removeList = array_keys(array_diff_key($attachments, $attachkeeplist)); JArrayHelper::toInteger($removeList); $message->removeAttachment($removeList); // Upload new attachments foreach ($_FILES as $key=>$file) { $intkey = 0; if (preg_match('/\D*(\d+)/', $key, $matches)) $intkey = (int)$matches[1]; if ($file['error'] != UPLOAD_ERR_NO_FILE) $message->uploadAttachment($intkey, $key, $this->catid); } // Set topic icon if permitted if ($this->config->topicicons && isset($fields['icon_id']) && $topic->authorise('edit', null, false)) { $topic->icon_id = $fields['icon_id']; } // Check if we are editing first post and update topic if we are! if ($topic->first_post_id == $message->id) { $topic->subject = $fields['subject']; } // If user removed all the text and message doesn't contain images or objects, delete the message instead. $text = KunenaHtmlParser::parseBBCode($message->message); if (!preg_match('!(<img |<object )!', $text)) { $text = trim(JFilterOutput::cleanText($text)); } if (!$text) { // Reload message (we don't want to change it). $message->load(); if ($message->publish(KunenaForum::DELETED)) { $this->app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_DELETE')); } else { $this->app->enqueueMessage($message->getError(), 'notice'); } $this->app->redirect($message->getUrl($this->return, false)); } // Activity integration $activity = KunenaFactory::getActivityIntegration(); $activity->onBeforeEdit($message); // Save message $success = $message->save (); if (! $success) { $this->app->setUserState('com_kunena.postfields', $fields); $this->app->enqueueMessage ( $message->getError (), 'error' ); $this->redirectBack (); } // Display possible warnings (upload failed etc) foreach ( $message->getErrors () as $warning ) { $this->app->enqueueMessage ( $warning, 'notice' ); } $poll_title = $fields['poll_title']; if ($poll_title !== null && $message->id == $topic->first_post_id) { // Save changes into poll $poll_options = $fields['poll_options']; $poll = $topic->getPoll(); if (! empty ( $poll_options ) && ! empty ( $poll_title )) { $poll->title = $poll_title; $poll->polltimetolive = $fields['poll_time_to_live']; $poll->setOptions($poll_options); if (!$topic->poll_id) { // Create a new poll if (!$topic->authorise('poll.create')) { $this->app->enqueueMessage ( $topic->getError(), 'notice' ); } elseif (!$poll->save()) { $this->app->enqueueMessage ( $poll->getError(), 'notice' ); } else { $topic->poll_id = $poll->id; $topic->save(); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POLL_CREATED' ) ); } } else { // Edit existing poll if (!$topic->authorise('poll.edit')) { $this->app->enqueueMessage ( $topic->getError(), 'notice' ); } elseif (!$poll->save()) { $this->app->enqueueMessage ( $poll->getError(), 'notice' ); } else { $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POLL_EDITED' ) ); } } } elseif ($poll->exists() && $topic->authorise('poll.edit')) { // Delete poll if (!$topic->authorise('poll.delete')) { // Error: No permissions to delete poll $this->app->enqueueMessage ( $topic->getError(), 'notice' ); } elseif (!$poll->delete()) { $this->app->enqueueMessage ( $poll->getError(), 'notice' ); } else { $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POLL_DELETED' ) ); } } } // Update Tags $this->updateTags($message->thread, $fields['tags'], $fields['mytags']); $activity->onAfterEdit($message); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POST_SUCCESS_EDIT' ) ); if ($message->hold == 1) { // If user cannot approve message by himself, send email to moderators. if (!$topic->authorise('approve')) $message->sendNotification(); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_GEN_MODERATED' ) ); } $this->app->redirect ( $message->getUrl($this->return, false ) ); }
?> </p> <p><?php $profile = KunenaFactory::getUser(intval($this->message->userid)); $useravatar = $profile->getAvatarImage('', '', 'profile'); if ($useravatar) { echo $this->message->getAuthor()->getLink($useravatar); } ?> </p> </td> <td class="kmessage-left khistorymsg"> <div class="kmsgbody"> <div class="kmsgtext"> <?php echo KunenaHtmlParser::parseBBCode($this->message->message, $this); ?> </div> </div> <?php $this->attachments = $this->message->getAttachments(); if (!empty($this->attachments)) { ?> <div class="kmsgattach"> <?php echo JText::_('COM_KUNENA_ATTACHMENTS'); ?> <ul class="kfile-attach"> <?php foreach ($this->attachments as $attachment) { ?>
// Show new posts, locked, review echo $this->getCategoryLink($category); if ($category->getNewCount()) { echo '<sup class="knewchar">(' . $category->getNewCount() . ' ' . JText::_('COM_KUNENA_A_GEN_NEWCHAR') . ")</sup>"; } if ($category->locked) { echo $this->getIcon ( 'kforumlocked', JText::_('COM_KUNENA_GEN_LOCKED_FORUM') ); } if ($category->review) { echo $this->getIcon ( 'kforummoderated', JText::_('COM_KUNENA_GEN_MODERATED') ); } ?> </div> <?php if (!empty($category->description)) : ?> <div class="kthead-desc km"><?php echo KunenaHtmlParser::parseBBCode ($category->description) ?> </div> <?php endif; ?> <?php // Display subcategories if (! empty ( $this->categories [$category->id] )) : ?> <div class="kthead-child"> <div class="kcc-table"> <?php foreach ( $this->categories [$category->id] as $childforum ) : ?> <div class="kcc-subcat km"> <?php echo $this->getCategoryIcon($childforum, true); echo $this->getCategoryLink($childforum); echo '<span class="kchildcount ks">(' . $childforum->getTopics() . "/" . $childforum->getPosts() . ')</span>'; ?> </div>
<?php /** * @version $Id$ * Kunena Component * @package Kunena * * @Copyright (C) 2008 - 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="kblock kdefault"> <div class="kheader"> <h2><?php echo $this->escape($this->header); ?></h2> </div> <div class="kcontainer"> <div class="kbody"> <div class="kcontent"> <?php if (!empty($this->html)) : echo $this->body; else : echo KunenaHtmlParser::parseBBCode($this->body); endif; ?> </div> </div> </div> </div>
private function buildContent($message) { $parent = new stdClass(); $parent->forceSecure = true; $parent->forceMinimal = true; $content = KunenaHtmlParser::parseBBCode($message->message, $parent, $this->params->get('activity_stream_limit', 0)); // Add readmore permalink $content .= '<br/><br /><a rel="nofollow" href="' . $message->getPermaUrl() . '" class="small profile-newsfeed-item-action">' . JText::_('COM_KUNENA_READMORE') . '</a>'; return $content; }
function displayMessage($id, $message, $template = null) { $layout = $this->getLayout(); if (!$template) { $template = $this->state->get('profile.location'); $this->setLayout('default'); } $this->mmm++; $this->message = $message; $this->profile = $this->message->getAuthor(); $this->replynum = $id + 1; $usertype = $this->me->getType($this->category->id, true); if ($usertype == 'user' && $this->message->userid == $this->profile->userid) { $usertype = 'owner'; } // Thank you info and buttons $this->thankyou = array(); if (isset($message->thankyou)) { if ($this->config->showthankyou && $this->profile->userid) { $task = "index.php?option=com_kunena&view=topic&task=%s&catid={$this->category->id}&id={$this->topic->id}&mesid={$this->message->id}&" . JUtility::getToken() . '=1'; // for normal users, show only limited number of thankyou (config->thankyou_max) if (!$this->me->isAdmin() || !$this->me->isModerator()) { $message->thankyou = array_slice($message->thankyou, 0, $this->config->thankyou_max, true); } foreach ($message->thankyou as $userid => $time) { $thankyou_delete = $this->me->isModerator() ? ' <a title="' . JText::_('COM_KUNENA_BUTTON_THANKYOU_REMOVE_LONG') . '" href="' . KunenaRoute::_(sprintf($task, "unthankyou&userid={$userid}")) . '"><img src="' . $this->ktemplate->getImagePath('icons/publish_x.png') . '" title="" alt="" /></a>' : ''; $this->thankyou[] = KunenaFactory::getUser(intval($userid))->getLink() . $thankyou_delete; } } } // TODO: add context (options, template) to caching $cache = JFactory::getCache('com_kunena', 'output'); $cachekey = "message.{$this->getTemplateMD5()}.{$layout}.{$template}.{$usertype}.c{$this->category->id}.m{$this->message->id}.{$this->message->modified_time}"; $cachegroup = 'com_kunena.messages'; $contents = false; //$cache->get($cachekey, $cachegroup); if (!$contents) { //Show admins the IP address of the user: if ($this->message->ip && ($this->category->authorise('admin') || $this->category->authorise('moderate') && !$this->config->hide_ip)) { $this->ipLink = CKunenaLink::GetMessageIPLink($this->message->ip); } $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->profile->signature, null, $this->config->maxsig); $this->attachments = $this->message->getAttachments(); // Link to individual message if ($this->config->ordering_system == 'replyid') { $this->numLink = CKunenaLink::GetSamePageAnkerLink($message->id, '#[K=REPLYNO]'); } else { $this->numLink = CKunenaLink::GetSamePageAnkerLink($message->id, '#' . $message->id); } if ($this->message->hold == 0) { $this->class = 'kmsg'; } elseif ($this->message->hold == 1) { $this->class = 'kmsg kunapproved'; } else { if ($this->message->hold == 2 || $this->message->hold == 3) { $this->class = 'kmsg kdeleted'; } } // New post suffix for class $this->msgsuffix = ''; if ($this->message->isNew()) { $this->msgsuffix = '-new'; } $contents = $this->loadTemplateFile($template); if ($usertype == 'guest') { $contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents); } // FIXME: enable caching after fixing the issues //if ($this->cache) $cache->store($contents, $cachekey, $cachegroup); } elseif ($usertype == 'guest') { echo $contents; $this->setLayout($layout); return; } $contents = preg_replace_callback('|\\[K=(\\w+)(?:\\:(\\w+))?\\]|', array($this, 'fillMessageInfo'), $contents); echo $contents; $this->setLayout($layout); }
$this->displayLoginBox (); ?> <div class="kblock kannouncement"> <div class="kheader"> <h2> <span><?php echo KunenaHtmlParser::parseText($this->announcement->title); ?></span> </h2> </div> <div class="kcontainer" id="kannouncement"> <?php if ($this->canEdit) : ?> <div class="kactions"> <?php echo CKunenaLink::GetAnnouncementLink( 'edit', $this->announcement->id, JText::_('COM_KUNENA_ANN_EDIT'), JText::_('COM_KUNENA_ANN_EDIT')); ?> | <?php echo CKunenaLink::GetAnnouncementLink( 'delete', $this->announcement->id, JText::_('COM_KUNENA_ANN_DELETE'), JText::_('COM_KUNENA_ANN_DELETE')); ?> | <?php echo CKunenaLink::GetAnnouncementLink( 'add',NULL, JText::_('COM_KUNENA_ANN_ADD'), JText::_('COM_KUNENA_ANN_ADD')); ?> | <?php echo CKunenaLink::GetAnnouncementLink( 'show', NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL')); ?> </div> <?php endif; ?> <div class="kbody"> <div class="kanndesc"> <?php if ($this->announcement->showdate > 0) : ?> <div class="anncreated" title="<?php echo KunenaDate::getInstance($this->announcement->created)->toKunena('ago'); ?>"> <?php echo KunenaDate::getInstance($this->announcement->created)->toKunena('date_today'); ?> </div> <?php endif; ?> <div class="anndesc"><?php echo !empty($this->announcement->description) ? KunenaHtmlParser::parseBBCode($this->announcement->description) : KunenaHtmlParser::parseBBCode($this->announcement->sdescription); ?></div> </div> </div> </div> </div> <?php $this->displayFooter (); ?> </div>