/** * @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'); ?> <?php Komento::trigger('onBeforeKomentoBox', array('component' => $component, 'cid' => $cid, 'system' => &$system, 'comments' => &$comments)); ?> <script type='text/javascript'> Komento.ready(function($) { // declare master namespace variable for shared values Komento.component = "<?php echo $component; ?> "; Komento.cid = "<?php echo $cid; ?> "; Komento.contentLink = "<?php echo $contentLink;
* 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' ); ?> <?php // KURO THEME Komento::trigger( 'onBeforeProcessComment', array( 'component' => $row->component, 'cid' => $row->cid, 'comment' => &$row ) ); // Process data Komento::import( 'helper', 'comment' ); $row = KomentoCommentHelper::process( $row ); Komento::trigger( 'onAfterProcessComment', array( 'component' => $row->component, 'cid' => $row->cid, 'comment' => &$row ) ); // Construct classes for this row $classes = array(); $classes[] = 'kmt-item'; // Usergroup CSS classes if( $row->author->guest ) { $classes[] = $system->config->get( 'layout_css_public' ); } else { $classes[] = $system->config->get( 'layout_css_registered' ); }
<?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'); ?> <?php Komento::trigger( 'onBeforeKomentoBar', array( 'component' => $component, 'cid' => $cid, 'commentCount', &$commentCount ) ); ?> <?php $readmore = false; if( $component == 'com_content' ) { if( $system->config->get( 'layout_frontpage_readmore_use_joomla' ) == 0 && ( ( $system->config->get( 'layout_frontpage_readmore' ) == 2 ) || ( $system->config->get( 'layout_frontpage_readmore' ) == 1 && Komento::_('JParameter::get', $article->params, 'show_readmore') && $article->readmore ) ) ) { $readmore = true; } } else { if( $system->config->get( 'layout_frontpage_readmore' ) != 0 ) { $readmore = true; } }
/** * Push the email notification to MailQ * @param string $type type of notification * @param string $recipient recipient (subscribers,admins,author,me) * @param array $options various options * * @return nothing */ public function push( $type, $recipients, $options = array() ) { if( !empty( $options['commentId'] ) ) { $comment = Komento::getComment( $options['commentId'] ); $options['comment'] = $comment; $options['component'] = $comment->component; $options['cid'] = $comment->cid; $options['comment'] = Komento::getHelper( 'comment' )->process( $options['comment'] ); unset( $options['commentId'] ); } if( !isset( $options['component'] ) || !isset( $options['cid'] ) ) { return; } if( $type == 'new' && $options['comment']->parent_id ) { $type = 'reply'; } $recipients = explode(',', $recipients); $rows = array(); $skipMe = true; // process requested recipients first foreach ($recipients as $recipient) { $recipient = 'get' . ucfirst( strtolower( trim($recipient) ) ); if( !method_exists($this, $recipient) ) { continue; } if( $recipient == 'getMe' ) { $skipMe = false; } $result = $this->$recipient( $type, $options ); // stacking up all the emails and details $rows = $rows + $result; } // process usergroups notification based on notification type $rows = $rows + $this->getUsergroups( $type ); if( $type == 'report' ) { $admins = $this->getAdmins(); foreach( $admins as $admin ) { if( isset($rows[$options['comment']->email]) && $options['comment']->email === $admin->email ) { $skipMe = false; } } } if( empty($rows) ) { return; } // Do not send to the commentor/actor if( $skipMe && isset($rows[$options['comment']->email]) ) { unset( $rows[$options['comment']->email] ); } $lang = JFactory::getLanguage(); // Load English first as fallback $konfig = Komento::getKonfig(); if( $konfig->get( 'enable_language_fallback' ) ) { $lang->load( 'com_komento', JPATH_ROOT, 'en-GB', true ); } // Load site's selected language $lang->load( 'com_komento', JPATH_ROOT, $lang->getDefault(), true ); // Load user's preferred language file $lang->load( 'com_komento', JPATH_ROOT, null, true ); $jconfig = JFactory::getConfig(); $data = $this->prepareData( $type, $options ); $template = $this->prepareTemplate( $type, $options ); $subject = $this->prepareTitle( $type, $options ); $mailfrom = Komento::_( 'JFactory::getConfig', 'mailfrom' ); $fromname = Komento::_( 'JFactory::getConfig', 'fromname' ); $config = Komento::getConfig(); $sendHTML = $config->get( 'notification_sendmailinhtml' ) ? 'html' : 'text'; // Storing notifications into mailq foreach ($rows as $row) { if( Komento::trigger( 'onBeforeSendNotification', array( 'component' => $options['component'], 'cid' => $options['cid'], 'recipient' => &$row ) ) === false ) { continue; } if( empty( $row->email ) ) { continue; } $body = $this->getTemplateBuffer( $template, $data, array( 'recipient' => $row ) ); $mailQ = Komento::getTable( 'mailq' ); $mailQ->mailfrom = $mailfrom; $mailQ->fromname = $fromname; $mailQ->recipient = $row->email; $mailQ->subject = $subject; $mailQ->body = $body; $mailQ->created = Komento::getDate()->toMySQL(); $mailQ->type = $sendHTML; $mailQ->status = 0; $result = $mailQ->store(); } }
public function publish( $type = '1' ) { // set new = false $new = false; // Create the comment table object $commentTable = Komento::getTable( 'Comments' ); $commentTable->bind($this->getProperties()); // get date $now = Komento::getDate()->toMySQL(); // check original status == 2 if( $commentTable->published == 2 ) { $new = true; } $commentTable->published = $type; if( $type == '1' ) { $commentTable->publish_up = $now; } else { $commentTable->publish_down = $now; } // Trigger onBeforePublishComment( $this->component, $this->cid, &$this ) // Trigger onBeforeUnpublishComment( $this->component, $this->cid, &$this ) $triggerResult = true; if( $type == '1' ) { $triggerResult = Komento::trigger( 'onBeforePublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) ); } else { $triggerResult = Komento::trigger( 'onBeforeUnpublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) ); } if( $triggerResult === false ) { $this->setError( 'Trigger onBeforePublishComment/onBeforeUnpublishComment false' ); return false; } if( !$commentTable->store() ) { $this->setError( 'Comment publish/unpublish failed' ); return false; } // bind with comment table data after successfully saving comment table. $this->setProperties($commentTable->getProperties()); // Trigger onAfterPublishComment( $this->component, $this->cid, &$this ) // Trigger onAfterUnpublishComment( $this->component, $this->cid, &$this ) if( $type == '1' ) { Komento::trigger( 'onAfterPublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) ); } else { Komento::trigger( 'onAfterUnpublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) ); } if( $new ) { $config = Komento::getConfig( $commentTable->component ); $action = $commentTable->parent_id ? 'reply' : 'comment'; // send email if( $config->get( 'notification_enable' ) ) { if( ( $action == 'comment' && $config->get( 'notification_event_new_comment' ) ) || ( $action == 'reply' && $config->get( 'notification_event_new_reply' ) ) ) { Komento::getHelper( 'Notification' )->push( $action, 'subscribers,author,usergroups', array( 'commentId' => $commentTable->id ) ); } } // process activities $activity = Komento::getHelper( 'activity' )->process( $action, $commentTable->id ); // Manually get the attachment of this comment and process the "upload" activity $attachments = $commentTable->getAttachments(); $totalAttachments = count( $attachments ); for( $i = 0; $i < $totalAttachments; $i++ ) { Komento::getHelper( 'activity' )->process( 'upload', $commentTable->id ); } } return true; }