/** * Function to add js file, js script block and css file * to HEAD section */ public static function load($list, $type = 'js', $location = 'themes') { $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = Komento::getConfig(); $kApp = Komento::loadApplication(); // Always load mootools first so it will not conflict. // JHTML::_('behavior.mootools'); $files = explode(',', $list); $dir = JURI::root() . 'components/com_komento/assets'; $pathdir = KOMENTO_ASSETS; $theme = $config->get('layout_theme'); $version = str_ireplace('.', '', Komento::komentoVersion()); if ($location != 'assets') { $dir = JURI::root() . 'components/com_komento/themes/' . $theme; $pathdir = KOMENTO_THEMES . DIRECTORY_SEPARATOR . $theme; } foreach ($files as $file) { if ($type == 'js') { $file .= '.js?' . $version; } elseif ($type == 'css') { $file .= '.css'; } $path = ''; if ($location == 'themes') { $checkOverride = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file; $checkComponent = $kApp->getComponentThemePath() . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file; $checkSelected = KOMENTO_THEMES . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file; $checkDefault = KOMENTO_THEMES . DIRECTORY_SEPARATOR . 'kuro' . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file; $overridePath = JURI::root() . 'templates/' . $mainframe->getTemplate() . '/html/com_komento/' . $type . '/' . $file; $componentPath = $kApp->getComponentThemeURI() . '/' . $type . '/' . $file; $selectedPath = $dir . '/' . $type . '/' . $file; $defaultPath = JURI::root() . 'components/com_komento/themes/kuro/' . $type . '/' . $file; // 1. Template overrides if (JFile::exists($checkOverride)) { $path = $overridePath; $pathdir = $checkOverride; } elseif (JFile::exists($checkSelected)) { $path = $selectedPath; $pathdir = $checkSelected; } else { $path = $defaultPath; $path = $checkDefault; } } else { $path = $dir . '/' . $type . '/' . $file; $pathdir = $pathdir . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $file; } if ($type == 'js') { $document->addScript($path); } elseif ($type == 'css') { if (JFile::exists($pathdir)) { $document->addStylesheet($path); } } } }
function getComponentState($filter_component = '*') { $model = Komento::getModel('subscription'); $components = $model->getUniqueComponents(); $component_state[] = JHTML::_('select.option', '*', JText::_('COM_KOMENTO_ALL_COMPONENTS')); foreach ($components as $component) { $component_state[] = JHTML::_('select.option', $component, Komento::loadApplication($component)->getComponentName()); } return JHTML::_('select.genericlist', $component_state, 'filter_component', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $filter_component); }
public static function loadComments( $id, $component, $options = array() ) { $commentsModel = Komento::getModel( 'comments' ); $comments = $commentsModel->getComments( $component, $id, $options ); $commentsModel = Komento::getModel( 'comments' ); $commentCount = $commentsModel->getCount( $component, $id ); if( array_key_exists('raw', $options) ) { return $comments; } // @task: load necessary css and javascript files. Komento::getHelper( 'Document' )->loadHeaders(); $application = Komento::loadApplication( $component ); if( $application->load( $id ) === false ) { $application = Komento::getErrorApplication( $component, $id ); } $theme = Komento::getTheme(); $theme->set( 'component', $component ); $theme->set( 'cid', $id ); $theme->set( 'comments', $comments ); $theme->set( 'options', $options ); $theme->set( 'componentHelper', $application ); $theme->set( 'application', $application ); $theme->set( 'commentCount', $commentCount ); $contentLink = $application->getContentPermalink(); $theme->set( 'contentLink', $contentLink ); $html = $theme->fetch('comment/box.php'); /* [KOMENTO_POWERED_BY_LINK] */ // free version powered by link append (for reference only) // $html .= '<div style="text-align: center; padding: 20px 0;"><a href="http://stackideas.com">' . JText::_( 'COM_KOMENTO_POWERED_BY_KOMENTO' ) . '</a></div>'; return $html; }
function display($tpl = null) { //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); $mainframe = JFactory::getApplication(); $components = array(); $result = Komento::getHelper('components')->getAvailableComponents(); if (Komento::joomlaVersion() >= '1.6') { if (!$user->authorise('komento.manage.comments', 'com_komento')) { $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $mainframe->close(); } } //Load pane behavior jimport('joomla.html.pane'); $commentId = JRequest::getVar('commentid', ''); $comment = Komento::getTable('Comments'); $comment->load($commentId); $this->comment = $comment; // Set default values for new entries. if (empty($comment->created)) { Komento::import('helper', 'date'); $date = KomentoDateHelper::getDate(); $now = KomentoDateHelper::toFormat($date); $comment->created = $now; $comment->published = true; } // Set all non published comments to unpublished if ($comment->published != 1) { $comment->published = 0; } // @task: Translate each component with human readable name. foreach ($result as $item) { $components[] = JHTML::_('select.option', $item, Komento::loadApplication($item)->getComponentName()); } $this->assignRef('comment', $comment); $this->assignRef('components', $components); parent::display($tpl); }
function display($tmpl = null) { $mainframe = JFactory::getApplication(); $commentsModel = Komento::getModel( 'comments' ); $cid = JRequest::getVar( 'cid', 'all' ); $filter['component'] = $mainframe->getUserStateFromRequest( 'com_komento.reports.filter_component', 'filter-component', 'all', 'string' ); $filter['sort'] = $mainframe->getUserStateFromRequest( 'com_komento.reports.filter_sort', 'filter-sort', 'latest', 'string' ); $filter['search'] = trim( JString::strtolower( $mainframe->getUserStateFromRequest( 'com_komento.reports.filter_search', 'filter-search', '', 'string' ) ) ); $options = array( 'limit' => 0, 'sort' => $filter['sort'], 'search' => $filter['search'], 'published' => 'all', 'threaded' => 0 ); $comments = $commentsModel->getComments( $filter['component'], $cid, $options ); $pagination = $commentsModel->getPagination(); $result = $commentsModel->getUniqueComponents(); $components = array(); // @task: Let's replace it with a proper text. foreach( $result as $item ) { $components[ $item ] = Komento::loadApplication( $item )->getComponentName(); } $theme = Komento::getTheme(); $theme->set( 'components', $components ); $theme->set( 'pagination', $pagination ); $theme->set( 'comments', $comments ); $theme->set( 'filter', $filter ); echo $theme->fetch( 'dashboard/flags.php' ); }
</time> </dd> <?php } if ($params->get('show_hits')) { ?> <dd> <div class="item_hits"> <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $item->hits); ?> </div> </dd> <?php } if (Komento::loadApplication('com_content')) { ?> <dd class="komento"> <?php echo Komento::commentify('com_content', $item); ?> </dd> <?php } ?> </dl> </footer> <?php } ?> </article>
<?php /** * @package Komento * @copyright Copyright (C) 2012 Stack Ideas Private Limited. All rights reserved. * @license GNU/GPL, see LICENSE.php * Komento is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $componentHelper = Komento::getHelper('components'); if ($componentHelper->isInstalled('com_slicomments')) { $contentObj = Komento::loadApplication('com_content'); $categories = $contentObj->getCategories(); ?> <table id="migrator-slicomments" migrator-type="slicomments" migration-type="article" class="noshow migratorTable"> <tr> <td width="50%" valign="top"> <fieldset class="adminform"> <legend><?php echo JText::_('COM_KOMENTO_MIGRATORS_LAYOUT_MAIN'); ?> </legend> <table class="migrator-options admintable"> <tr> <td class="key"><span><?php echo JText::_('COM_KOMENTO_MIGRATORS_SELECT_JOOMLA_CATEGORIES');
<div class="t"> <div class="t"></div> </div> </div> <div class="m"> <div class="kmt-component-select"> <?php $app = JFactory::getApplication(); $component = $app->getUserStateFromRequest('com_komento.integrations.component', 'component', 'com_content'); // Get a list of components $components = array(); $result = Komento::getHelper('components')->getAvailableComponents(); // @task: Translate each component with human readable name. foreach ($result as $item) { $components[] = JHTML::_('select.option', $item, Komento::loadApplication($item)->getComponentName()); } echo JText::_('COM_KOMENTO_SETTINGS_SELECT_COMPONENT') . ': ' . JHTML::_('select.genericlist', $components, 'test', 'class="inputbox" onchange="changeComponent(this.value)"', 'value', 'text', $component); ?> </div> <div class="submenu-box"> <div class="submenu-pad"> <ul id="submenu" class="integrations"> <?php if (Komento::joomlaVersion() <= '1.5') { ?> <li><a id="home" class="goback" href="<?php echo JRoute::_('index.php?option=com_komento'); ?> ">« <?php
public function getComponentSelection() { $query = "SELECT DISTINCT `component` FROM `#__komento_comments`"; $sql = Komento::getSql(); $sql->raw($query); $result = $sql->loadColumn(); $options = array($this->renderOption('all', '*')); foreach ($result as $row) { $options[] = $this->renderOption($row, Komento::loadApplication($row)->getComponentName()); } $html = JHtml::_('select.genericlist', $options, 'componentSelection', 'size="1" class="inputbox componentSelection"', 'value', 'text'); return $html; }
<?php /** * @package Komento * @copyright Copyright (C) 2012 Stack Ideas Private Limited. All rights reserved. * @license GNU/GPL, see LICENSE.php * Komento is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $componentHelper = Komento::getHelper('components'); if ($componentHelper->isInstalled('com_easyblog')) { $easyblogObj = Komento::loadApplication('com_easyblog'); $categories = $easyblogObj->getCategories(); $selection = $this->renderMultilist('category', '', $categories); ?> <table id="migrator-easyblog" migrator-type="easyblog" migration-type="article" class="noshow migratorTable"> <tr> <td width="50%" valign="top"> <fieldset class="adminform"> <legend><?php echo JText::_('COM_KOMENTO_MIGRATORS_LAYOUT_MAIN'); ?> </legend> <table class="migrator-options admintable"> <tr> <td class="key"><span><?php echo JText::_('COM_KOMENTO_MIGRATORS_SELECT_EASYBLOG_CATEGORIES');
function display($tmpl = null) { $config = Komento::getConfig(); if (!$config->get('enable_rss')) { return; } require_once KOMENTO_HELPERS . DIRECTORY_SEPARATOR . 'helper.php'; $component = JRequest::getString('component', 'all'); $cid = JRequest::getInt('cid'); $cid = !$cid ? 'all' : $cid; $userid = JRequest::getInt('userid', null); if ($component != 'all' && $cid != 'all') { $application = Komento::loadApplication($component)->load($cid); if ($application === false) { $application = Komento::getErrorApplication($component, $cid); } $contentTitle = $component != 'all' && $cid != 'all' ? $application->getContentTitle() : ''; } $username = $userid !== null ? Komento::getProfile($userid)->getName() : ''; $document = JFactory::getDocument(); // to do: get permalink or view name from api/componentlist if ($component != 'all' && $cid != 'all') { $document->link = $application->getContentPermalink(); } else { $document->link = JURI::root(); } // to do : get article name from api/componentlist // document title based on request parameter // integrate settings for rss // allow all component rss // allow all article rss // allow all user rss // allow all guest rss $document->setTitle(JText::_('COM_KOMENTO_FEEDS_LATEST_TITLE')); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_LATEST_TITLE_DESCRIPTION')); if ($component == 'all') { if ($cid != 'all') { // impossible all component and specific article echo 'Error! Component = all, cid != all.'; exit; } // all component all article if (is_null($userid)) { // all users/guests $document->setTitle(JText::_('COM_KOMENTO_FEEDS_ALL_COMMENTS_TITLE')); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_ALL_COMMENTS_TITLE_DESCRIPTION')); } else { if ($userid === 0) { // for all guest $userid = 0 $document->setTitle(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_TITLE')); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_TITLE_DESCRIPTION')); } else { // specific user $document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_TITLE') . ' : ' . $username); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_TITLE_DESCRIPTION') . ' : ' . $username); } } } else { // specific component if ($cid == 'all') { // all article if (is_null($userid)) { // all users/guests $document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName()); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_TITLE_DESCRIPTION')); } else { if ($userid === 0) { // for all guest $userid = 0 $document->setTitle(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName()); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_TITLE_DESCRIPTION')); } else { // specific user $document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE') . ' : ' . $username . ' : ' . Komento::loadApplication($component)->getComponentName()); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE_DESCRIPTION') . ' : ' . $username); } } } else { // specific article if (is_null($userid)) { // all users/guests $document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName() . ' : ' . $contentTitle); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE_DESCRIPTION')); } else { if ($userid === 0) { // for all guest $userid = 0 $document->setTitle(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE') . ' : ' . Komento::loadApplication($component)->getComponentName() . ' : ' . $contentTitle); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_GUEST_COMMENTS_FOR_COMPONENT_OF_ARTICLE_TITLE_DESCRIPTION')); } else { // specific user $document->setTitle(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE_OF_ARTICLE') . ' : ' . $username . ' : ' . Komento::loadApplication($component)->getComponentName() . ' : ' . $contentTitle); $document->setDescription(JText::_('COM_KOMENTO_FEEDS_COMMENTS_FROM_USER_FOR_COMPONENT_TITLE_OF_ARTICLE_DESCRIPTION') . ' : ' . $username); } } } } $options = array('sort' => 'latest', 'limit' => $config->get('rss_max_items'), 'userid' => $userid === null ? 'all' : $userid, 'threaded' => 0); $commentsModel = Komento::getModel('comments'); $comments = $commentsModel->getComments($component, $cid, $options); if (!empty($comments)) { foreach ($comments as $row) { $row = Komento::getHelper('comment')->process($row); // Todo : configurable $title = 'Comment - ' . $row->created; // Assign to feed item $item = new JFeedItem(); $item->title = $title; $item->link = $row->permalink; $item->description = $row->comment; $item->date = $row->unformattedDate; $item->author = $row->name; $item->authorEmail = $row->email; $document->addItem($item); } } }
* @package Komento * @copyright Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved. * @license GNU/GPL, see LICENSE.php * Komento is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $componentHelper = Komento::getHelper('components'); if ($componentHelper->isInstalled('com_rscomments')) { $components = Komento::getModel('migrators', true)->getMigrator('rscomments')->getUniqueComponents(); $selection = array(); foreach ($components as $component) { $selection[] = JHtml::_('select.option', $component, Komento::loadApplication($component)->getComponentName()); } $componentSelect = JHTML::_('select.genericlist', $selection, 'components', 'multiple="multiple" size="10" style="height: auto !important;"', 'value', 'text'); ?> <div id="migrator-rscomments" migrator-type="rscomments" migration-type="component" class="noshow migratorTable"> <div class="row"> <div class="col-md-6"> <fieldset class="panel"> <div class="panel-head"><?php echo JText::_('COM_KOMENTO_MIGRATORS_LAYOUT_MAIN'); ?> </div> <div class="panel-body"> <table class="migrator-options admintable"> <tr>
public static function trigger($event, $params = array()) { $config = Komento::getConfig(); $component = null; $cid = null; if (isset($params['component'])) { $component = $params['component']; unset($params['component']); } if (isset($params['cid'])) { $cid = $params['cid']; unset($params['cid']); } if ($config->get('trigger_method') === 'joomla') { static $plugin = false; if ($plugin === false) { $plugin = true; JPluginHelper::importPlugin('komento'); } $application = JFactory::getApplication(); $arguments = array(); if (!empty($component)) { $arguments[] = $component; } if (!empty($cid)) { $arguments[] = $cid; } $arguments[] =& $params; $results = $application->triggerEvent($event, $arguments); if (is_array($results) && in_array(false, $results)) { return false; } return true; } if ($config->get('trigger_method') === 'component') { if (!empty($component)) { $application = Komento::loadApplication($component); if (!empty($cid)) { $application->load($cid); } return call_user_func_array(array($application, $event), $params); } } return true; }
public static function allow( $type, $comment = '', $component = '', $cid = '' ) { // for complicated acl situations // $type = ['edit', 'delete', 'publish', 'unpublish', 'stick', 'delete_attachment']; if( !empty( $comment ) && ( empty( $component ) || empty( $cid ) ) ) { if( !is_object( $comment ) ) { $comment = Komento::getComment( $comment ); } $component = $comment->component; $cid = $comment->cid; } if( empty( $component ) || empty( $cid ) ) { return false; } $profile = Komento::getProfile(); $application = Komento::loadApplication( $component )->load( $cid ); Komento::setCurrentComponent( $component ); switch( $type ) { case 'edit': if( $profile->id != 0 && ($profile->allow( 'edit_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_edit_comment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'edit_own_comment' )))) { return true; } break; case 'delete': if( $profile->id != 0 && ($profile->allow( 'delete_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_delete_comment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'delete_own_comment' )))) { return true; } break; case 'publish': if( $profile->allow( 'publish_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_publish_comment' ) ) ) { return true; } break; case 'unpublish': if( $profile->allow( 'unpublish_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_unpublish_comment' ) ) ) { return true; } break; case 'stick': if( $profile->allow( 'stick_all_comment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_stick_comment' ) ) ) { return true; } break; case 'like': if( $profile->allow( 'like_comment' ) ) { return true; } break; case 'report': if( $profile->allow( 'report_comment' ) ) { return true; } break; case 'delete_attachment': if( $profile->allow( 'delete_all_attachment' ) || ( $profile->id == $application->getAuthorId() && $profile->allow( 'author_delete_attachment' ) ) || ( $profile->id == $comment->created_by && $profile->allow( 'delete_own_attachment' ) ) ) { return true; } break; } return false; }
$comments = ''; $options = array( 'threaded' => 0, 'sort' => $params->get( 'sort' ), 'limit' => $params->get( 'limit' ), 'sticked' => $params->get( 'filtersticked' ) ? 1 : 'all', 'random' => $params->get( 'random' ) ); $component = $params->get( 'component' ); $cid = array(); $category = $params->get( 'category' ); if( $component != 'all' && !empty( $category ) ) { $application = Komento::loadApplication( $component ); $cid = $application->getContentIds( $category ); if( count( $cid ) == 1 ) { $cid = $cid[0]; } } else { $cid = 'all'; } switch( $params->get( 'sort' ) ) { case 'latest':
public function getNotificationTarget( $target, $action, $comment ) { $ids = array(); switch( $target ) { case 'usergroup': $gids = $this->config->get( 'notification_es_to_usergroup_' . $action ); if( !empty( $gids ) ) { if( !is_array( $gids ) ) { $gids = explode( ',', $gids ); } foreach( $gids as $gid ) { $ids += Komento::getUsersByGroup( $gid ); } } break; case 'author': if( $this->config->get( 'notification_es_to_author' ) ) { $application = Komento::loadApplication( $comment->component )->load( $comment->cid ); $author = $application->getAuthorId(); if( !empty( $author ) ) { $ids = array( $author ); } } break; case 'parent': if( !empty( $comment->parent_id ) ) { $parent = Komento::getTable( 'comments' ); $state = $parent->load( $comment->parent_id ); if( $state && !empty( $parent->created_by ) ) { $ids = array( $parent->created_by ); } } break; case 'owner': if( !empty( $comment->created_by ) ) { $ids = array( $comment->created_by ); } break; case 'participant': if( $this->config->get( 'notification_es_to_participant' ) ) { $options = array( 'component' => $comment->component, 'cid' => $comment->cid, 'noguest' => true, 'state' => 1 ); $model = Komento::getModel( 'comments' ); $ids = $model->getUsers( $options ); } break; } return $ids; }
if( !Komento::getProfile( $row->created_by )->guest) { ?> </a> <?php } ?> </li> <!-- Time --> <li class="kmt-date"> <?php if( $system->config->get( 'enable_lapsed_time') ) { echo KomentoDateHelper::getLapsedTime( $row->created ); } else { echo $row->created; } ?> </li> <!-- Permalink --> <li class="kmt-permalink"><a href="<?php echo Komento::loadApplication( $row->component )->load( $row->cid )->getContentPermalink() . '#kmt-' . $row->id; ?>"><?php echo JText::_( 'COM_KOMENTO_COMMENT_PERMALINK' ) ; ?></a></li> <!-- Status --> <li class="kmt-status"><?php echo $row->published ? JText::_( 'COM_KOMENTO_PUBLISHED' ) : JText::_( 'COM_KOMENTO_UNPUBLISHED' );?></li> </ul> <div class="kmt-body"> <?php // parseBBcode to HTML $row->comment = KomentoCommentHelper::parseBBCode($row->comment); $row->comment = nl2br($row->comment); ?> <span class="kmt-text"><?php echo $row->comment; ?></span> </div> </td>
public function getPermalink() { if( !isset( $this->permalink ) ) { $application = Komento::loadApplication( $this->component )->load( $this->cid ); $this->permalink = $application->getContentPermalink() . '#kmt-' . $this->id; } return $this->permalink; }
public function resolve( $file ) { if(defined('KOMENTO_CLI')) { $defaultPath = KOMENTO_THEMES . DIRECTORY_SEPARATOR . KOMENTO_THEME_BASE . DIRECTORY_SEPARATOR . $file; return $defaultPath; } $path = ''; $mainframe = JFactory::getApplication(); $config = Komento::getConfig(); // load the file based on the theme's config.ini $info = $this->getThemeInfo( $this->_theme ); /** * Precedence in order. * 1. Template override * 2. Component override * 3. Selected theme * 4. Parent theme * 5. Default system theme */ $overridePath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . $file; $componentPath = Komento::loadApplication()->getComponentThemePath() . DIRECTORY_SEPARATOR . $file; $selectedPath = KOMENTO_THEMES . DIRECTORY_SEPARATOR . $this->_theme . DIRECTORY_SEPARATOR . $file; $parentPath = KOMENTO_THEMES . DIRECTORY_SEPARATOR . $info->get( 'parent' ) . DIRECTORY_SEPARATOR . $file; $defaultPath = KOMENTO_THEMES . DIRECTORY_SEPARATOR . KOMENTO_THEME_BASE . DIRECTORY_SEPARATOR . $file; // 1. Template override if( $config->get( 'layout_template_override', true ) && JFile::exists( $overridePath ) ) { $path = $overridePath; } // 2. Component override elseif( $config->get( 'layout_component_override', true ) && JFile::exists( $componentPath ) ) { $path = $componentPath; } // 3. Selected themes elseif( JFile::exists( $selectedPath ) ) { $path = $selectedPath; } // 4. Parent themes elseif( JFile::exists( $parentPath ) ) { $path = $parentPath; } // 5. Default system theme else { $path = $defaultPath; } return $path; }
<?php /** * @package Komento * @copyright Copyright (C) 2012 Stack Ideas Private Limited. All rights reserved. * @license GNU/GPL, see LICENSE.php * Komento is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $componentHelper = Komento::getHelper('components'); if ($componentHelper->isInstalled('com_k2')) { $k2Obj = Komento::loadApplication('com_k2'); $categories = $k2Obj->getCategories(); $selection = $this->renderMultilist('category', '', $categories); ?> <table id="migrator-k2" migrator-type="k2" migration-type="article" class="noshow migratorTable"> <tr> <td width="50%" valign="top"> <fieldset class="adminform"> <legend><?php echo JText::_('COM_KOMENTO_MIGRATORS_LAYOUT_MAIN'); ?> </legend> <table class="migrator-options admintable"> <tr> <td class="key"><span><?php
public function getAuthor( $type, $options ) { $config = Komento::getConfig(); if( !$config->get( 'notification_to_author' ) ) { return array(); } $application = Komento::loadApplication( $options['component'] )->load( $options['cid'] ); if( $application === false ) { $application = Komento::getErrorApplication( $options['component'], $options['cid'] ); } $userid = $application->getAuthorId(); $obj = new stdClass(); $user = JFactory::getUser( $userid ); $obj->id = $user->id; $obj->fullname = JText::_( $user->name ); $obj->email = $user->email; return array( $user->email => $obj ); }
/** * Process comments data **/ public static function process($row, $admin = 0) { if (isset($row->processed) && $row->processed) { return $row; } Komento::setCurrentComponent($row->component); $config = Komento::getConfig(); $konfig = Komento::getKonfig(); $user = JFactory::getUser()->id; $commentsModel = Komento::getModel('comments'); Komento::import('helper', 'date'); // Duplicate created date first before lapsed time messing up the original date $row->unformattedDate = $row->created; // get number of child for each comment $row->childs = $commentsModel->getTotalChilds($row->id); // set url to proper url if (!empty($row->url)) { // Add 'http://' if not present $row->url = 0 === strpos($row->url, 'http') ? $row->url : 'http://' . $row->url; } // 1. Load article and article details $application = Komento::loadApplication($row->component)->load($row->cid); if ($application === false) { $application = Komento::getErrorApplication($row->component, $row->cid); } // set component title $row->componenttitle = $application->getComponentName(); // set content title $row->contenttitle = $application->getContentTitle(); // get permalink $row->pagelink = $application->getContentPermalink(); $row->permalink = $row->pagelink . '#kmt-' . $row->id; // set parentlink if ($row->parent_id != 0) { $row->parentlink = $row->pagelink . '#kmt-' . $row->parent_id; } // to be reassign $row->shortlink = $row->permalink; // set extension object // use this to check if application is able to load article details // if row->extension is false, means error loading article details $row->extension = $application; if ($admin == 0) { // frontend $actionsModel = Komento::getModel('actions'); $socialHelper = Komento::getHelper('social'); // parse comments HTML $row->comment = self::parseComment($row->comment); // author's object $row->author = Komento::getProfile($row->created_by); // don't convert for guest if ($row->created_by != 0 && $row->created_by != $row->author->id) { if ($config->get('enable_orphanitem_convert')) { KomentoCommentHelper::convertOrphanitem($row->id); } } if ($row->created_by != 0) { switch ($config->get('name_type')) { case 'username': // force username $row->name = $row->author->getUsername(); break; case 'name': $row->name = $row->author->getName(); break; case 'default': default: // default name to profile if name is null if (empty($row->name)) { $row->name = $row->author->getName(); } break; } } else { if (empty($row->name)) { $row->name = JText::_('COM_KOMENTO_GUEST'); } else { if ($config->get('guest_label')) { $row->name = JText::_('COM_KOMENTO_GUEST') . ' - ' . $row->name; } } } // set datetime if ($config->get('enable_lapsed_time')) { $row->created = KomentoDateHelper::getLapsedTime($row->unformattedDate); } else { $dateformat = $config->get('date_format'); $row->created = KomentoDateHelper::toFormat(KomentoDateHelper::dateWithOffSet($row->created), $dateformat); // $row->created = Komento::getDate( $row->created )->toFormat( $dateformat ); } // get actions likes $row->likes = $actionsModel->countAction('likes', $row->id); // get user liked $row->liked = $actionsModel->liked($row->id, $user); // get user reported $row->reported = $actionsModel->reported($row->id, $user); } else { // backend // format comments $row->comment = nl2br(Komento::getHelper('comment')->parseBBCode($row->comment)); $row->created = KomentoDateHelper::dateWithOffSet($row->created); } $row->processed = true; return $row; }
echo JText::_('COM_KOMENTO_SETTINGS_MIGRATE_SETTINGS_COMPONENTS'); ?> </span></td> <td> <select id="componentSettings"> <?php foreach ($availableComponents as $availableComponent) { ?> <?php if ($availableComponent != $this->component) { ?> <option value="<?php echo $availableComponent; ?> "><?php echo Komento::loadApplication($availableComponent)->getComponentName(); ?> </option> <?php } ?> <?php } ?> </select> </td> </tr> </div> <div class="panel-foot"> <a href="javascript:void(0);" data-current-component="<?php echo $this->component;
<?php /** * @package Komento * @copyright Copyright (C) 2012 Stack Ideas Private Limited. All rights reserved. * @license GNU/GPL, see LICENSE.php * Komento is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Restricted access'); $componentHelper = Komento::getHelper('components'); if ($componentHelper->isInstalled('com_zoo')) { $zooObj = Komento::loadApplication('com_zoo'); $categories = $zooObj->getCategories(); $selection = $this->renderMultilist('category', '', $categories); ?> <table id="migrator-zoo" migrator-type="zoo" migration-type="article" class="noshow migratorTable"> <tr> <td width="50%" valign="top"> <fieldset class="adminform"> <legend><?php echo JText::_('COM_KOMENTO_MIGRATORS_LAYOUT_MAIN'); ?> </legend> <table class="migrator-options admintable"> <tr> <td class="key"><span><?php
public function addComponent($component) { // $package = Komento::getPackage(); // if( $package !== 'paid' && in_array( $component, Komento::getPaidComponents() ) ) // { // return; // } $application = Komento::loadApplication($component); $link = JURI::root() . 'administrator/index.php?option=com_komento&view=integrations&component=' . $component; $name = $application->getComponentName(); $image = $application->getComponentIcon(); ?> <li> <a href="<?php echo $link; ?> "> <img src="<?php echo $image; ?> " width="32" /> <span class="item-title"><?php echo $name; ?> </span> </a> </li> <?php }
public function process( $action, $comment ) { // process all activities and 3rd party integration here // Due to the possible conflict data of $comment->created containing lapsed time instead of raw date, we use the table object directly instead if( !( $comment instanceof KomentoTableComments ) ) { $id = 0; if( is_int( $comment ) || is_string( $comment ) ) { $id = $comment; } if( $comment instanceof KomentoComment ) { $id = $comment->id; } $comment = Komento::getTable( 'comments' ); $comment->load( $id ); } if( $action != 'remove' && $comment->published != 1 ) { return false; } $config = Komento::getConfig(); $profile = Komento::getProfile(); $application = Komento::loadApplication( $comment->component )->load( $comment->cid ); if( $application === false) { $application = Komento::getErrorApplication( $comment->component, $comment->cid ); } $pagelink = $application->getContentPermalink(); $permalink = $pagelink . '#' . $comment->id; $author = $application->getAuthorId(); $title = $application->getContentTitle(); if( $profile->id == 0 ) { return false; } // native activity if( ( $action == 'comment' && $config->get( 'activities_comment' ) ) || ( $action == 'reply' && $config->get( 'activities_reply' ) ) || ( $action == 'like' && $config->get( 'activities_like' ) ) ) { $this->addActivity( $action, $comment->id, $comment->created_by ); } // Add jomsocial activity if( $action == 'comment' && $config->get( 'jomsocial_enable_comment' ) ) { $this->addJomSocialActivityComment( $comment ); } if( $action == 'reply' && $config->get( 'jomsocial_enable_reply' ) ) { $this->addJomSocialActivityReply( $comment ); } if( $action == 'like' && $config->get( 'jomsocial_enable_like' ) ) { $this->addJomSocialActivityLike( $comment, $profile->id ); } // Add jomsocial userpoints if( $config->get( 'jomsocial_enable_userpoints' ) ) { switch( $action ) { case 'comment': Komento::addJomSocialPoint( 'com_komento.comment.add' ); Komento::addJomSocialPoint( 'com_komento.comment.add.author', $author ); break; case 'reply': Komento::addJomSocialPoint( 'com_komento.comment.reply' ); break; case 'like': Komento::addJomSocialPoint( 'com_komento.comment.like' ); Komento::addJomSocialPoint( 'com_komento.comment.liked', $comment->created_by ); break; case 'unlike': Komento::addJomSocialPoint( 'com_komento.comment.unlike' ); Komento::addJomSocialPoint( 'com_komento.comment.unliked', $comment->created_by ); break; case 'report': Komento::addJomSocialPoint( 'com_komento.comment.report' ); Komento::addJomSocialPoint( 'com_komento.comment.reported', $comment->created_by ); break; case 'unreported': Komento::addJomSocialPoint( 'com_komento.comment.unreport' ); Komento::addJomSocialPoint( 'com_komento.comment.unreported', $comment->created_by ); break; case 'stick': Komento::addJomSocialPoint( 'com_komento.comment.sticked' ); break; case 'unstick': Komento::addJomSocialPoint( 'com_komento.comment.unsticked' ); break; case 'remove': Komento::addJomSocialPoint( 'com_komento.comment.removed' ); Komento::addJomSocialPoint( 'com_komento.comment.removed.author', $author ); break; } } // Add aup if( $config->get( 'enable_aup' ) ) { switch( $action ) { case 'comment': Komento::addAUP( 'plgaup_komento_post_comment', $comment->created_by, 'komento_post_comment_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_POST_COMMENT', $permalink, $title ) ); Komento::addAUP( 'plgaup_komento_add_comment_author', $author, 'komento_post_comment_on_' . $comment->component . '_' . $comment->cid, JText::sprintf( 'COM_KOMENTO_AUP_POST_COMMENT', $permalink, $title ) ); break; case 'reply': Komento::addAUP( 'plgaup_komento_reply_comment', $comment->created_by, 'komento_reply_comment_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_REPLY_COMMENT', $permalink, $title ) ); break; case 'like': Komento::addAUP( 'plgaup_komento_like_comment', $profile->id, 'komento_like_comment_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_LIKE_COMMENT', $permalink, $title ) ); Komento::addAUP( 'plgaup_komento_comment_liked', $comment->created_by, 'komento_comment_liked_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_LIKED', $permalink, $title ) ); break; case 'unlike': Komento::addAUP( 'plgaup_komento_unlike_comment', $profile->id, 'komento_unlike_comment_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_UNLIKE_COMMENT', $permalink, $title ) ); Komento::addAUP( 'plgaup_komento_comment_unliked', $comment->created_by, 'komento_comment_unliked_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_UNLIKED', $permalink, $title ) ); break; case 'report': Komento::addAUP( 'plgaup_komento_report_comment', $profile->id, 'komento_report_comment_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_REPORT_COMMENT', $permalink, $title ) ); Komento::addAUP( 'plgaup_komento_comment_reported', $comment->created_by, 'komento_comment_reported_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_REPORTED', $permalink, $title ) ); break; case 'unreport': Komento::addAUP( 'plgaup_komento_unreport_comment', $profile->id, 'komento_unreport_comment_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_UNREPORT_COMMENT', $permalink, $title ) ); Komento::addAUP( 'plgaup_komento_comment_unreported', $comment->created_by, 'komento_comment_unreported_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_UNREPORTED', $permalink, $title ) ); break; case 'stick': Komento::addAUP( 'plgaup_komento_comment_sticked', $comment->created_by, 'komento_comment_sticked_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_STICKED', $permalink, $title ) ); break; case 'unstick': Komento::addAUP( 'plgaup_komento_comment_unsticked', $comment->created_by, 'komento_comment_unsticked_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_UNSTICKED', $permalink, $title ) ); break; case 'remove': Komento::addAUP( 'plgaup_komento_comment_removed', $comment->created_by, 'komento_comment_removed_' . $comment->id, JText::sprintf( 'COM_KOMENTO_AUP_COMMENT_REMOVED', $pagelink, $title ) ); Komento::addAUP( 'plgaup_komento_remove_comment_author', $author, 'komento_remove_comment_on_' . $comment->component . '_' . $comment->cid, JText::sprintf( 'COM_KOMENTO_AUP_REMOVED_COMMENT_AUTHOR', $pagelink, $title ) ); break; } } // Add Discuss points if( $config->get( 'enable_discuss_points' ) ) { switch( $action ) { case 'comment': Komento::addDiscussPoint( 'komento.add.comment', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_ADD_COMMENT', $title ) ); Komento::addDiscussPoint( 'komento.add.comment.article.author', $author, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_ADD_COMMENT_ARTICLE_AUTHOR', $title ) ); break; case 'reply': Komento::addDiscussPoint( 'komento.reply.comment', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_REPLY_COMMENT', $title ) ); break; case 'like': Komento::addDiscussPoint( 'komento.like.comment', $profile->id, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_LIKE_COMMENT', $title ) ); Komento::addDiscussPoint( 'komento.comment.liked', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_LIKED', $title ) ); break; case 'unlike': Komento::addDiscussPoint( 'komento.unlike.comment', $profile->id, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_UNLIKE_COMMENT', $title ) ); Komento::addDiscussPoint( 'komento.comment.unliked', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_UNLIKED', $title ) ); break; case 'report': Komento::addDiscussPoint( 'komento.report.comment', $profile->id, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_REPORT_COMMENT', $title ) ); Komento::addDiscussPoint( 'komento.comment.reported', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_REPORTED', $title ) ); break; case 'unreport': Komento::addDiscussPoint( 'komento.unreport.comment', $profile->id, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_UNREPORT_COMMENT', $title ) ); Komento::addDiscussPoint( 'komento.comment.unreported', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_UNREPORTED', $title ) ); break; case 'stick': Komento::addDiscussPoint( 'komento.comment.sticked', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_STICKED', $title ) ); break; case 'unstick': Komento::addDiscussPoint( 'komento.comment.unsticked', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_UNSTICKED', $title ) ); break; case 'remove': Komento::addDiscussPoint( 'komento.comment.removed', $comment->created_by, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_COMMENT_REMOVED', $title ) ); Komento::addDiscussPoint( 'komento.remove.comment.article.author', $author, JText::sprintf( 'COM_KOMENTO_DISCUSS_HISTORY_REMOVE_COMMENT_ARTICLE_AUTHOR', $title ) ); break; } } if( $config->get( 'enable_easysocial_points' ) ) { $es = Komento::getHelper( 'EasySocial' ); switch( $action ) { case 'comment': $es->assignPoints( 'komento.add.comment' , $comment->created_by, $comment); //Add points to user when a user post a comment. $es->assignPoints( 'komento.add.comment.article.author' , $author, $comment); //Add points for article author when a user posts a new comment on that article. break; case 'reply': $es->assignPoints( 'komento.reply.comment', $comment->created_by, $comment); //Add points to user when a user reply to a comment. break; case 'like': $es->assignPoints( 'komento.like.comment' , $profile->id ); //Add points to user when a user likes a comment. $es->assignPoints( 'komento.comment.liked' , $comment->created_by ); //Add points to comment author when a user likes the comment. *? break; case 'unlike': $es->assignPoints( 'komento.unlike.comment' , $profile->id ); //Add points to user when a user unlikes a comment. $es->assignPoints( 'komento.comment.unliked' , $comment->created_by ); //Deduct points to comment author when a user unlike the comment. break; case 'report': $es->assignPoints( 'komento.report.comment' , $profile->id ); // Add points to user when a user reports a comment. $es->assignPoints( 'komento.comment.reported' , $comment->created_by ); //Deduct points to comment author when a comment is reported. break; case 'unreport': $es->assignPoints( 'komento.unreport.comment' , $profile->id ); // Deduct points to user when a user unreports a comment. $es->assignPoints( 'komento.comment.unreported' , $comment->created_by ); //Add points to comment author when a comment is unreported. break; case 'stick': $es->assignPoints( 'komento.comment.sticked' , $comment->created_by ); //Add points to comment author when a comment is sticked. break; case 'unstick': $es->assignPoints( 'komento.comment.unsticked' , $comment->created_by ); //Deduct points to comment author when a comment is unsticked. break; case 'remove': $es->assignPoints( 'komento.comment.removed' , $comment->created_by ); //Deduct points to comment author when a comment is removed. $es->assignPoints( 'komento.remove.comment.article.author' , $author ); //Deduct points for article author when a comment is removed from that article. break; case 'upload': $es->assignPoints( 'komento.upload.attachments' , $comment->created_by ); //Deduct points to comment author when a comment is removed. break; } } if( $config->get( 'enable_easysocial_badges' ) ) { $es = Komento::getHelper( 'EasySocial' ); switch( $action ) { case 'comment': $es->assignBadge( 'komento.add.comment', JText::_( 'COM_KOMENTO_EASYSOCIAL_BADGES_ADD_COMMENTS_MESSAGE' ) ); break; case 'reply': $es->assignBadge( 'komento.reply.comment', JText::_( 'COM_KOMENTO_EASYSOCIAL_BADGES_REPLY_COMMENTS_MESSAGE' ) ); break; case 'like': $es->assignBadge( 'komento.like.comment', JText::_( 'COM_KOMENTO_EASYSOCIAL_BADGES_LIKE_COMMENTS_MESSAGE' ) ); break; case 'report': $es->assignBadge( 'komento.report.comment', JText::_( 'COM_KOMENTO_EASYSOCIAL_BADGES_REPORT_COMMENTS_MESSAGE' ) ); break; case 'upload': $es->assignBadge( 'komento.upload.attachments', JText::_( 'COM_KOMENTO_EASYSOCIAL_BADGES_UPLOAD_COMMENTS_MESSAGE' ) ); break; } } if( $config->get( 'notification_es_enable' ) && ( $config->get( 'notification_es_event_new_' . $action ) ) ) { $es = Komento::getHelper( 'EasySocial' ); $es->notify( $action, $comment ); } // If action is reply and sync comment is on, then we don't create a stream // If comment params->source is from com_easysocial, then we don't create a stream if( ( ( in_array( $action, array( 'comment', 'like' ) ) && $config->get( 'enable_easysocial_stream_' . $action ) ) || $action === 'reply' && !$config->get( 'enable_easysocial_sync_comment' ) ) && ( empty( $comment->params->source ) || $comment->params->source !== 'com_easysocial' ) ) { $es = Komento::getHelper( 'EasySocial' ); $es->createStream( $action, $comment ); } if( $action === 'reply' && $config->get( 'enable_easysocial_sync_comment' ) && empty( $comment->params->social->source ) ) { $es = Komento::getHelper( 'EasySocial' ); $es->injectComment( $comment ); } if( $action === 'remove' && $config->get( 'enable_easysocial_sync_comment' ) ) { $es = Komento::getHelper( 'EasySocial' ); $es->removeComment( $comment ); } if( $action === 'like' && $config->get( 'enable_easysocial_sync_like' ) ) { $es = Komento::getHelper( 'EasySocial' ); $es->injectLike( $comment ); } if( $action === 'unlike' && $config->get( 'enable_easysocial_sync_like' ) ) { $es = Komento::getHelper( 'EasySocial' ); $es->removeLike( $comment ); } }
function publish( $type = 1 ) { $id = JRequest::getInt( 'id' ); $affectChild = JRequest::getInt( 'affectChild', 1 ); $ajax = Komento::getAjax(); $commentObj = Komento::getComment( $id ); $commentModel = Komento::getModel( 'comments' ); $acl = Komento::getHelper( 'Acl' ); $application = Komento::loadApplication( $commentObj->component )->load( $commentObj->cid ); if( $application === false ) { $application = Komento::getErrorApplication( $commentObj->component, $commentObj->cid ); } if( ( $type == 1 && $acl->allow( 'publish', $commentObj ) ) || ( $type == 0 && $acl->allow( 'unpublish', $commentObj ) ) ) { if( $affectChild ) { $childs = $commentModel->getChilds( $id ); if( count( $childs ) > 0 ) { foreach( $childs as $child ) { $childObj = Komento::getComment( $child ); if( !$childObj->publish( $type ) ) { $errors = JText::_( 'COM_KOMENTO_ERROR' ); if( $childObj->getErrors() ) { $errors = implode( '\n', $childObj->getErrors() ); } $ajax->fail( $errors ); $ajax->send(); } } } } if( !$commentObj->publish( $type ) ) { $errors = JText::_( 'COM_KOMENTO_ERROR' ); if( $commentObj->getErrors() ) { $errors = implode( '\n', $commentObj->getErrors() ); } $ajax->fail( $errors ); $ajax->send(); } $ajax->success(); } else { $ajax->fail( JText::_( 'COM_KOMENTO_ACL_NO_PERMISSION' ) ); } $ajax->send(); }