Example #1
0
 public function __construct($config = array())
 {
     $document = JFactory::getDocument();
     //load dialog stylesheet in backend
     KomentoDocumentHelper::loadHeaders();
     $config = Komento::getConfig();
     $konfig = Komento::getKonfig();
     $toolbar = JToolbar::getInstance('toolbar');
     $toolbar->addButtonPath(KOMENTO_ADMIN_ROOT . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'images');
     if ($document->getType() == 'html') {
         require_once KOMENTO_CLASSES . DIRECTORY_SEPARATOR . 'configuration.php';
         $configuration = KomentoConfiguration::getInstance();
         $configuration->attach();
     }
     $version = str_ireplace('.', '', Komento::komentoVersion());
     $document->addScript(rtrim(JURI::root(), '/') . '/administrator/components/com_komento/assets/js/admin.js?' . $version);
     $document->addStyleSheet(rtrim(JURI::root(), '/') . '/administrator/components/com_komento/assets/css/reset.css?' . $version);
     $document->addStyleSheet(rtrim(JURI::root(), '/') . '/components/com_komento/assets/css/common.css?' . $version);
     $document->addStyleSheet(rtrim(JURI::root(), '/') . '/administrator/components/com_komento/assets/css/style.css?' . $version);
     // For the sake of loading the core.js in Joomla 1.6 (1.6.2 onwards)
     if (Komento::joomlaVersion() >= '1.6') {
         JHTML::_('behavior.framework');
     }
     parent::__construct($config);
 }
Example #2
0
 function getColumnsState()
 {
     $columns = array('comment', 'published', 'link', 'edit', 'component', 'article', 'date', 'author', 'email', 'homepage', 'ip', 'latitude', 'longitude', 'address', 'id');
     $columnsConfig = Komento::getConfig('com_komento_pending_columns', false);
     $html = $this->renderColumnsConfiguration($columns, $columnsConfig);
     return $html;
 }
Example #3
0
	/**
	 * This renders the necessary bootstrap data into the html headers.
	 */
	public function bootstrap()
	{
		static $isRendered	= false;

		$doc 				= JFactory::getDocument();

		if( !$isRendered && $doc->getType() == 'html' )
		{
			// @task: Include dependencies from foundry.
			require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'foundry' . DIRECTORY_SEPARATOR . '3.1' . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'configuration.php' );

			$config = Komento::getConfig();

			$environment = JRequest::getVar( 'komento_environment' , $config->get( 'komento_environment' ) );

			$folder	= 'scripts';

			// @task: Let's see if we should load the dev scripts.
			if( $environment == 'development' )
			{
				$folder		= 'scripts_';
			}

			$doc->addScript( rtrim( JURI::root() , '/' ) . '/media/com_komento/' . $folder . '/abstract.js' );

			$isRendered		= true;
		}

		return $isRendered;
	}
Example #4
0
	public function upload( $fileItem, $fileName = '', $storagePath = '', $published = 1 )
	{
		// $fileItem['name'] = filename
		// $fileItem['type'] = mime
		// $fileItem['tmp_name'] = temporary source
		// $fileItem['size'] = size

		if( empty( $fileItem ) )
		{
			return false;
		}

		// store record first
		$uploadtable = Komento::getTable( 'uploads' );

		$now = Komento::getDate()->toMySQL();
		$uploadtable->created = $now;

		$profile = Komento::getProfile();
		$uploadtable->created_by = $profile->id;

		$uploadtable->published = $published;

		$uploadtable->mime = $fileItem['type'];

		$uploadtable->size = $fileItem['size'];

		if( $fileName == '' )
		{
			$fileName = $fileItem['name'];
		}
		$uploadtable->filename = $fileName;

		if( $storagePath == '' )
		{
			$config = Komento::getConfig();
			$storagePath = $config->get( 'upload_path' );
		}
		$uploadtable->path = $storagePath;

		if( !$uploadtable->upload() )
		{
			return false;
		}

		$source = $fileItem['tmp_name'];
		$destination = $uploadtable->getFilePath();

		jimport( 'joomla.filesystem.file' );
		if( !JFile::copy( $source , $destination ) )
		{
			$uploadtable->rollback();
			return false;
		}

		return $uploadtable->id;
	}
Example #5
0
 /**
  * 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);
             }
         }
     }
 }
Example #6
0
 public static function getNoun($var, $count, $includeCount = false)
 {
     static $zeroIsPlural;
     if (!isset($zeroIsPlural)) {
         $config = Komento::getConfig();
         $zeroIsPlural = $config->get('layout_zero_as_plural');
     }
     $count = (int) $count;
     $var = $count === 1 || $count === -1 || $count === 0 && !$zeroIsPlural ? $var . '_SINGULAR' : $var . '_PLURAL';
     return $includeCount ? JText::sprintf($var, $count) : JText::_($var);
 }
Example #7
0
	/**
	 * Get the captcha class
	 */
	public function getInstance()
	{
		if (is_null(self::$instance))
		{
			$config	= Komento::getConfig();
			$class	= '';

			if( $config->get( 'antispam_captcha_enable' ) == 1 )
			{
				if( $config->get( 'antispam_captcha_type') == 0)
				{
					$class = 'captcha';
				}
				else
				{
					if( $config->get( 'antispam_captcha_type') == 1 && $config->get('antispam_recaptcha_public_key') && $config->get('antispam_recaptcha_private_key') )
					{
						$class = 'recaptcha';
					}
				}
			}

			if( empty($class) )
			{
				self::$instance = false;
				return false;
			}

			$file = KOMENTO_CLASSES . DIRECTORY_SEPARATOR . 'captcha' . DIRECTORY_SEPARATOR . strtolower($class) . '.php';

			if( !JFile::exists($file) )
			{
				self::$instance = false;
				return false;
			}

			require_once( $file );

			$class = 'Komento' . ucfirst( strtolower($class) );

			if ( !class_exists($class) )
			{
				return false;
			}

			self::$instance = new $class();
		}

		return self::$instance;
	}
Example #8
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<embed src="http://media.mtvnservices.com/mgid:uma:video:mtv.com:' . $code . '" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" flashVars="configParams=id%3D' . $code . '%26vid%3D' . $code . '%26uri%3Dmgid%3Auma%3Avideo%3Amtv.com%3A' . $code . '" allowFullScreen="true" allowScriptAccess="always" base="."></embed>';
		}
		return false;
	}
Example #9
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<embed flashVars="playerVars=showStats=yes|autoPlay=no" src="http://www.metacafe.com/fplayer/' . $code . '/easyblog.swf" width="' . $width . '" height="' . $height . '" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_' . $code . '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>';
		}
		return false;
	}
Example #10
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.liveleak.com/e/' . $code . '"></param><param name="wmode" value="transparent"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.liveleak.com/e/' . $code . '" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="' . $width . '" height="' . $height . '"></embed></object>';
		}
		return false;
	}
Example #11
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<iframe src="http://player.vimeo.com/video/' . $code . '" width="' . $width . '" height="' . $height . '" frameborder="0"></iframe>';
		}
		return false;
	}
Example #12
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<script src="http://ext.nicovideo.jp/thumb_watch/' . $code . '?w=' . $width . '&h=' . $height . '&n=1" type="text/javascript"></script><noscript>Javascript is required to load the player</noscript>';
		}
		return false;
	}
Example #13
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<script src="http://flash.revver.com/player/1.0/player.js?mediaId:' . $code . ';width:' . $width . ';height:' . $height . ';" type="text/javascript"></script>';
		}
		return false;
	}
Example #14
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<embed id=VideoPlayback src=http://video.google.com/googleplayer.swf?docid=' . $code . '&hl=en&fs=true style=width:' . $width . 'px;height:' . $height . 'px allowFullScreen=true allowScriptAccess=always type=application/x-shockwave-flash> </embed>';
		}

		return false;
	}
Example #15
0
 public function getHTML()
 {
     $template = Komento::getTheme();
     $config = Komento::getConfig();
     $publicKey = $config->get('antispam_recaptcha_public_key');
     $language = $config->get('antispam_recaptcha_lang', 'en');
     $theme = $config->get('antispam_recaptcha_theme', 'clean');
     $server = $config->get('antispam_recaptcha_ssl') ? self::RECAPTCHA_API_SECURE_SERVER : self::RECAPTCHA_API_SERVER;
     $template->set('server', $server);
     $template->set('publicKey', $publicKey);
     $template->set('language', $language);
     $template->set('theme', $theme);
     // Use AJAX method to prevent operation aborted problems with IE
     return $template->fetch('comment/recaptcha.php');
 }
Example #16
0
	public function upload()
	{
		$component	= JRequest::getString( 'component' );
		Komento::setCurrentComponent( $component );

		$profile	= Komento::getProfile();
		$config		= Komento::getConfig();

		// acl stuffs here
		if( !$config->get( 'upload_enable' ) || !$profile->allow( 'upload_attachment' ) )
		{
			echo json_encode( array( 'status' => 'notallowed' ) ); exit;
		}

		$file	= JRequest::getVar( 'file', '', 'FILES', 'array' );

		// check for file size if runtime HTML4 is used
		if( $file['size'] > ( $config->get( 'upload_max_size' ) * 1024 * 1024 ) )
		{
			echo json_encode( array( 'status' => 'exceedfilesize' ) ); exit;
		}

		// $file['name'] = filename
		// $file['type'] = mime
		// $file['tmp_name'] = temporary source
		// $file['size'] = size

		$id = Komento::getHelper( 'file' )->upload( $file );

		$result = array(
			'status'	=> 1,
			'id'		=> 0
		);

		if( $id === false )
		{
			$result['status'] = 0;
		}
		else
		{
			$result['id'] = $id;
		}

		// do not return
		// echo json string instead and exit

		echo json_encode( $result ); exit;
	}
Example #17
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			$html 	= '<iframe frameborder="0" width="' . $width . '" height="' . $height . '" src="http://www.dailymotion.com/embed/video/' . $code . '"></iframe>';

			return $html;
		}
		return false;
	}
Example #18
0
 function loadReplies()
 {
     $ajax = Komento::getAjax();
     $model = Komento::getModel('comments');
     $options['parent_id'] = JRequest::getInt('parentId');
     $startCount = JRequest::getInt('startCount');
     $commentsModel = Komento::getModel('comments');
     $comments = $commentsModel->getData($options);
     $count = count($comments);
     $this->assign('comments', $comments);
     $this->assign('search', '');
     $this->assign('startCount', $startCount);
     $this->assign('columns', Komento::getConfig('com_komento_comments_columns', false));
     $html = $this->loadTemplate('list_' . $this->getTheme());
     $ajax->success($html);
     $ajax->send();
 }
Example #19
0
	public function __construct()
	{
		$konfig = Komento::getKonfig();
		$config = Komento::getConfig();

		// @legacy: If environment is set to production, change to static.
		$environment = $konfig->get('komento_environment');
		if ($environment=='production') {
			$environment='static';
		}

		$this->fullName		= 'Komento';
		$this->shortName	= 'kmt';
		$this->environment	= $environment;
		$this->mode			= $konfig->get('komento_mode');
		$this->version		= (string) Komento::getHelper( 'Version' )->getLocalVersion();
		$this->baseUrl		= Komento::getHelper( 'Document' )->getBaseUrl();
		$this->token		= Komento::_( 'getToken' );

		$newConfig = clone $config->toObject();
		$newKonfig = clone $konfig->toObject();

		unset( $newConfig->antispam_recaptcha_private_key );
		unset( $newConfig->antispam_recaptcha_public_key );
		unset( $newConfig->antispam_akismet_key );
		unset( $newConfig->layout_phpbb_path );
		unset( $newConfig->layout_phpbb_url );
		unset( $newKonfig->layout_phpbb_path );
		unset( $newKonfig->layout_phpbb_url );

		$this->options     = array(
			"responsive"	=> (bool) $config->get('enable_responsive'),
			"jversion"		=> Komento::joomlaVersion(),
			"spinner"		=> JURI::root() . 'media/com_komento/images/loader.gif',
			"view"			=> JRequest::getString( 'view', '' ),
			"guest"			=> Komento::getProfile()->guest ? 1 : 0,
			"config"		=> $newConfig,
			"konfig"		=> $newKonfig,
			"acl"			=> Komento::getACL(),
			"element"		=> new stdClass()
		);

		parent::__construct();
	}
Example #20
0
	private function init( $url = '' )
	{
		$config		= Komento::getConfig();

		if( !$config->get( 'antispam_akismet_key' ) )
		{
			return false;
		}

		if( is_null( $this->akismet ) )
		{
			require_once( KOMENTO_CLASSES . DIRECTORY_SEPARATOR . 'akismet.php' );

			$url			= !empty( $url ) ? $url : JURI::root();
			$this->akismet	= new Akismet( $url , $config->get( 'antispam_akismet_key' ) );
		}

		return $this;
	}
Example #21
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			return '<div class="video-container"><iframe title="YouTube video player" width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $code . '?wmode=transparent" frameborder="0" allowfullscreen></iframe></div>';
		}
		else
		{
		    // this video do not have a code. so include the url directly.
			return '<div class="video-container"><iframe title="YouTube video player" width="' . $width . '" height="' . $height . '" src="' . $url . '&wmode=transparent" frameborder="0" allowfullscreen></iframe></div>';
		}
		return false;
	}
Example #22
0
	public function getEmbedHTML( $url )
	{
		$code	= $this->getCode( $url );

		$config	= Komento::getConfig();
		$width	= $config->get( 'bbcode_video_width' );
		$height	= $config->get( 'bbcode_video_height' );

		if( $code )
		{
			$html	= '<object width="' . $width . '" height="' . $height . '">'
					. '<param name="movie" value="http://d.yimg.com/nl/cbe/butterfinger/player.swf"></param>'
					. '<param name="flashVars" value="browseCarouselUI=hide&shareUrl=http%3A//comedy.video.yahoo.com/%3Fv%3D' . $code . '&repeat=0&vid=' . $code . '"></param>'
					. '<param name="allowfullscreen" value="true"></param>'
					. '<param name="wmode" value="transparent"></param>'
					. '<embed width="' . $width . '" height="' . $height . '" allowFullScreen="true" src="http://d.yimg.com/nl/cbe/butterfinger/player.swf" type="application/x-shockwave-flash" flashvars="browseCarouselUI=hide&shareUrl=http%3A//comedy.video.yahoo.com/%3Fv%3D' . $code . '&repeat=0&vid=' . $code . '&"></embed>'
					. '</object>';
			return $html;
		}
		return false;
	}
Example #23
0
    public function renderSetting($text, $configName, $type = 'checkbox', $options = '')
    {
        $type = 'render' . $type;
        $state = Komento::getConfig(self::$extension)->get($configName);
        if (($configName === 'email_regex' || $configName === 'website_regex') && is_array($state)) {
            $state = urldecode($state[0]);
        }
        ob_start();
        ?>
		<tr>
			<td width="150" class="key">
				<span class="<?php 
        echo $configName;
        ?>
"><?php 
        echo JText::_($text);
        ?>
</span>
			</td>
			<td valign="top">
				<div class="has-tip">
					<div class="tip"><i></i><?php 
        echo JText::_($text . '_DESC');
        ?>
</div>
					<?php 
        echo $this->{$type}($configName, $state, $options);
        ?>
				</div>
			</td>
		</tr>

	<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Example #24
0
	public function addJomSocialActivityLike( $comment, $uid )
	{
		if( !is_object( $comment ) )
		{
			$comment = Komento::getComment( $comment );
		}

		$comment = Komento::getHelper( 'comment' )->process( $comment );
		$comment->comment = JString::substr( strip_tags( $comment->comment ), 0 , Komento::getConfig()->get( 'jomsocial_comment_length' ) );

		$options = array(
			'title'			=> JText::sprintf('COM_KOMENTO_JOMSOCIAL_ACTIVITY_LIKED_COMMENT', $comment->permalink, $comment->pagelink, $comment->extension->getContentTitle() ),
			'content'		=> $comment->comment,
			'cmd'			=> 'komento.comment.like',
			// 'app'			=> $comment->component,
			// due to js 2.8
			'app'			=> 'komento',
			'cid'			=> $comment->cid,
			'actor'			=> $uid,
			'comment_id'	=> $comment->id,
			'comment_type'	=> 'com_komento.comments',
			'like_id'		=> $comment->id,
			'like_type'		=> 'com_komento.likes'
		);
		self::addJomSocialActivity( $options );
	}
Example #25
0
    public function renderTextarea($configName, $state = '', $options = array())
    {
        if ($state == '') {
            $config = Komento::getConfig();
            $state = $config->get($configName, '');
        }
        $cols = isset($options['cols']) ? $options['cols'] : 25;
        $rows = isset($options['rows']) ? $options['rows'] : 5;
        ob_start();
        ?>
		<textarea name="<?php 
        echo $configName;
        ?>
" class="inputbox full-width" cols="<?php 
        echo $cols;
        ?>
" rows="<?php 
        echo $rows;
        ?>
"><?php 
        echo str_replace('<br />', "\n", $state);
        ?>
</textarea>
		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Example #26
0
	public function addMailq($component, $cid)
	{
		$config = Komento::getConfig();

		$subscribers = Komento::getModel('subscription')->getSubscribers($component, $cid);

		$mainframe	= JFactory::getApplication();
		$mailfrom	= $mainframe->getCfg( 'mailfrom' );
		$fromname 	= $mainframe->getCfg( 'fromname' );

		if( $config->get( 'admin_email' ) )
		{
			// get from config if config exist
		}

		if( count( $subscribers ) > 0 )
		{
			foreach( $subscribers as $subscriber )
			{
				$data = array(
					'mailfrom'	=> $mailfrom,
					'fromname'	=> $fromname,
					'recipient'	=> $subscriber->email,
					'subject'	=> 'new email',
					'body'		=> 'body',
					'created'	=> Komento::getDate()->toMySQL(),
					'status'	=> 0
				);

				$mailqTable = Komento::getTable( 'mailq' );

				$mailqTable->bind( $data );
				$mailqTable->store();
			}

			return true;
		}

		return false;
	}
Example #27
0
 public static function convertOrphanitem($id)
 {
     $config = Komento::getConfig();
     $comment = Komento::getTable('comments');
     $comment->load($id);
     $comment->created_by = $config->get('orphanitem_ownership');
     $comment->store();
     return true;
 }
Example #28
0
 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;
 }
Example #29
0
?>
">
	<?php 
foreach ($activities as $activity) {
    $activity->comment = Komento::getComment($activity->comment_id, $process = true);
    $activity->comment->comment = strip_tags($activity->comment->comment);
    // trim comment length
    if (JString::strlen($activity->comment->comment) > $params->get('maxcommentlength')) {
        $activity->comment->comment = JString::substr($activity->comment->comment, 0, $params->get('maxcommentlength')) . '...';
    }
    // trim title length
    if (JString::strlen($activity->comment->contenttitle) > $params->get('maxtitlelength')) {
        $activity->comment->contenttitle = JString::substr($activity->comment->contenttitle, 0, $params->get('maxtitlelength')) . '...';
    }
    $profile = Komento::getProfile($activity->uid);
    $config = Komento::getConfig($activity->comment->component);
    if ($activity->uid != 0 && $profile->id != $activity->uid && $config->get('enable_orphanitem_convert')) {
        $table = Komento::getTable('activities');
        $table->load($activity->id);
        $table->uid = $config->get('orphanitem_ownership');
        $table->store();
        $activity->uid = $config->get('orphanitem_ownership');
    }
    ?>
	<div class="mod-item stream kmt-activity-<?php 
    echo $activity->id;
    ?>
">
		<div class="stream-head stream-<?php 
    echo $activity->type;
    ?>
 public function __construct($profile)
 {
     $config = Komento::getConfig();
     $phpbbpath = $config->get('layout_phpbb_path');
     $phpbburl = $config->get('layout_phpbb_url');
     $phpbburl = Jstring::rtrim($phpbburl, '/', '');
     $phpbbDB = $this->_getPhpbbDBO($phpbbpath);
     $phpbbConfig = $this->_getPhpbbConfig();
     $phpbbuserid = 0;
     if (empty($phpbbConfig)) {
         return false;
     }
     $juser = JFactory::getUser($profile->id);
     $sql = 'SELECT `user_id`, `username`, `user_avatar`, `user_avatar_type` ' . 'FROM `#__users` WHERE LOWER(`username`) = ' . $phpbbDB->quote(strtolower($juser->username)) . ' ' . 'LIMIT 1';
     $phpbbDB->setQuery($sql);
     $result = $phpbbDB->loadObject();
     $phpbbuserid = empty($result->user_id) ? '0' : $result->user_id;
     if (!empty($result->user_avatar)) {
         switch ($result->user_avatar_type) {
             case '1':
                 $subpath = $phpbbConfig->avatar_upload_path;
                 $phpEx = JFile::getExt(__FILE__);
                 $source = $phpbburl . '/download/file.' . $phpEx . '?avatar=' . $result->user_avatar;
                 break;
             case '2':
                 $source = $result->user_avatar;
                 break;
             case '3':
                 $subpath = $phpbbConfig->avatar_gallery_path;
                 $source = $phpbburl . '/' . $subpath . '/' . $result->user_avatar;
                 break;
             default:
                 $subpath = '';
                 $source = '';
         }
     } else {
         $sql = 'SELECT ' . $phpbbDB->nameQuote('theme_name') . ' ' . 'FROM ' . $phpbbDB->nameQuote('#__styles_theme') . ' ' . 'WHERE ' . $phpbbDB->nameQuote('theme_id') . ' = ' . $phpbbDB->quote($phpbbConfig->default_style);
         $phpbbDB->setQuery($sql);
         $theme = $phpbbDB->loadObject();
         $defaultPath = 'styles/' . $theme->theme_name . '/theme/images/no_avatar.gif';
         $source = $phpbburl . '/' . $defaultPath;
     }
     $this->avatar = $source;
     $this->link = $phpbburl . '/memberlist.php?mode=viewprofile&u=' . $phpbbuserid;
     return parent::__construct($profile);
 }