예제 #1
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.pendings', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     $filter_component = $mainframe->getUserStateFromRequest('com_komento.pending.filter_component', 'filter_component', '*', 'string');
     $search = $mainframe->getUserStateFromRequest('com_komento.pending.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $order = $mainframe->getUserStateFromRequest('com_komento.pending.filter_order', 'filter_order', 'created', 'cmd');
     $orderDirection = $mainframe->getUserStateFromRequest('com_komento.pending.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
     // Set Options
     $options['published'] = 2;
     $options['no_tree'] = 1;
     $options['no_child'] = 1;
     // Get data from the model
     $commentsModel = Komento::getModel('comments');
     $comments = $commentsModel->getData($options);
     $pagination = $commentsModel->getPagination();
     $this->assignRef('comments', $comments);
     $this->assignRef('pagination', $pagination);
     $this->assign('search', $search);
     $this->assign('order', $order);
     $this->assign('orderDirection', $orderDirection);
     $this->assign('component', $this->getComponentState($filter_component));
     $this->assign('columns', Komento::getConfig('com_komento_pending_columns', false));
     $this->assign('columnCount', 2);
     parent::display($tpl);
 }
예제 #2
0
 function registerToolbar()
 {
     $parentId = JRequest::getVar('parentid', 0);
     // JToolBarHelper::title( text, iconfilename )
     if ($parentId) {
         if ($parentId) {
             $parent = Komento::getTable('comments');
             $parent->load($parentId);
         }
         JToolBarHelper::title(JText::_('COM_KOMENTO_COMMENTS_TITLE_CHILD_OF') . $parentId, 'comments');
         JToolBarHelper::back(JText::_('COM_KOMENTO_BACK'), 'index.php?option=com_komento&view=comments&parentid=' . $parent->parent_id);
     } else {
         JToolBarHelper::title(JText::_('COM_KOMENTO_COMMENTS_TITLE'), 'comments');
         JToolBarHelper::back(JText::_('COM_KOMENTO_ADMIN_HOME'), 'index.php?option=com_komento');
     }
     JToolBarHelper::divider();
     if (Komento::joomlaVersion() >= '3.0') {
         JToolBarHelper::custom('stick', 'star', '', JText::_('COM_KOMENTO_STICK'));
         JToolBarHelper::custom('unstick', 'star-empty', '', JText::_('COM_KOMENTO_UNSTICK'));
     } else {
         JToolBarHelper::custom('stick', 'kmt-stick', '', JText::_('COM_KOMENTO_STICK'));
         JToolBarHelper::custom('unstick', 'kmt-unstick', '', JText::_('COM_KOMENTO_UNSTICK'));
     }
     JToolBarHelper::divider();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::divider();
     JToolBarHelper::deleteList();
 }
예제 #3
0
	public function __construct()
	{
		$version 	= Komento::joomlaVersion();
		$className	= $version >= '2.5' ? 'KomentoDatabaseJoomla30' : 'KomentoDatabaseJoomla15';

		$this->helper 	= new $className();
	}
예제 #4
0
 public function form($tpl = null)
 {
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.acl', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     $component = JRequest::getString('component', '');
     if ($component == '') {
         $mainframe->redirect('index.php?option=com_komento&view=acl');
     }
     $components = $this->getComponentState($component);
     $id = $mainframe->getUserStateFromRequest('com_komento.acl.id', 'id', '0');
     $type = JRequest::getCmd('type', 'usergroup');
     $usergroups = '';
     if ($type == 'usergroup') {
         $usergroups = $this->getUsergroupState($id);
     }
     $type = JRequest::getCmd('type');
     $id = JRequest::getInt('id');
     $model = Komento::getModel('acl', true);
     $model->updateUserGroups($component);
     $rulesets = $model->getData($component, $type, $id);
     $this->assignRef('rulesets', $rulesets);
     $this->assignRef('component', $component);
     $this->assignRef('components', $components);
     $this->assignRef('type', $type);
     $this->assignRef('id', $id);
     $this->assignRef('usergroups', $usergroups);
     parent::display($tpl);
 }
예제 #5
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);
 }
예제 #6
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.subscribers', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     $filter_component = $mainframe->getUserStateFromRequest('com_komento.subscribers.filter_component', 'filter_component', '*', 'string');
     $order = $mainframe->getUserStateFromRequest('com_komento.subscribers.filter_order', 'filter_order', 'created', 'cmd');
     $orderDirection = $mainframe->getUserStateFromRequest('com_komento.subscribers.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
     // Get data from the model
     $subscriptionModel = Komento::getModel('subscription');
     $subscribers = $subscriptionModel->getData();
     $pagination = $subscriptionModel->getPagination();
     foreach ($subscribers as $subscriber) {
         $subscriber = self::process($subscriber);
     }
     $this->assignRef('subscribers', $subscribers);
     $this->assignRef('pagination', $pagination);
     $this->assign('order', $order);
     $this->assign('orderDirection', $orderDirection);
     $this->assign('component', $this->getComponentState($filter_component));
     parent::display($tpl);
 }
예제 #7
0
	public function toFormat( $format='%Y-%m-%d %H:%M:%S' )
	{
		if( Komento::joomlaVersion() >= '3.0' )
		{
			if( JString::stristr( $format, '%' ) !== false )
			{
				Komento::import( 'helper', 'date' );
				$format = KomentoDateHelper::strftimeToDate( $format );
			}

			return $this->date->format( $format, true );
		}
		else
		{
			// There is no way to have cross version working, except for detecting % in the format
			if( JString::stristr( $format , '%' ) === false )
			{
				if( Komento::isJoomla15() )
				{
					// forced fallback for Joomla 15 if format doesn't have %
					$format = '%c';
				}
				else
				{
					return $this->date->format( $format , true );
				}

			}

			return $this->date->toFormat( $format, true );
		}
	}
예제 #8
0
 function display($tpl = null)
 {
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.migrators', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     parent::display($tpl);
 }
예제 #9
0
    public function addButton($link, $image, $text, $description = '', $newWindow = false, $acl = '', $notification = 0)
    {
        if (!empty($acl) && Komento::joomlaVersion() >= '1.6') {
            if (!JFactory::getUser()->authorise('komento.manage.' . $acl, 'com_komento')) {
                return '';
            }
        }
        $target = $newWindow ? ' target="_blank"' : '';
        $bubble = $notification > 0 ? '<b>' . $notification . '</b>' : '';
        ?>
	<li>
		<a href="<?php 
        echo $link;
        ?>
"<?php 
        echo $target;
        ?>
>
			<img src="<?php 
        echo JURI::root();
        ?>
administrator/components/com_komento/assets/images/cpanel/<?php 
        echo $image;
        ?>
" width="32" />
			<span class="item-title">
				<span><?php 
        echo $text;
        ?>
</span>
				<?php 
        if ($notification > 0) {
            ?>
					<b><?php 
            echo $notification;
            ?>
</b>
				<?php 
        }
        ?>
			</span>
		</a>
		<div class="item-description">
			<div class="tipsArrow"></div>
			<div class="tipsBody"><?php 
        echo $description;
        ?>
</div>
		</div>
	</li>
<?php 
    }
예제 #10
0
 /**
  * Determines if needed to load the bootstrap or joomla version
  * of the theme file.
  *
  * @since	3.7
  * @access	public
  * @author	Mark Lee <*****@*****.**>
  */
 public function getTheme()
 {
     $version = Komento::joomlaVersion();
     if ($version >= '3.0') {
         JHtmlSidebar::addEntry(JText::_('COM_TEMPLATES_SUBMENU_STYLES'), 'index.php?option=com_templates&view=styles', true);
         JHtmlSidebar::addEntry(JText::_('COM_TEMPLATES_SUBMENU_TEMPLATES'), 'index.php?option=com_templates&view=templates', false);
         if (method_exists($this, 'addSidebar')) {
             $this->addSidebar();
         }
         return 'bootstrap';
     }
     return 'joomla';
 }
예제 #11
0
 public function getCategories()
 {
     $db = Komento::getDBO();
     $query = 'SELECT a.id, a.title, a.level, a.parent_id' . ' FROM `#__categories` AS a' . ' WHERE a.extension = ' . $db->quote('com_content') . ' AND a.parent_id > 0' . ' ORDER BY a.lft';
     if (Komento::joomlaVersion() == '1.5') {
         $query = 'SELECT a.id, a.title' . ' FROM `#__categories` AS a' . ' ORDER BY a.ordering';
     }
     $db->setQuery($query);
     $categories = $db->loadObjectList();
     if (Komento::joomlaVersion() >= '1.6') {
         foreach ($categories as &$row) {
             $repeat = $row->level - 1 >= 0 ? $row->level - 1 : 0;
             $row->treename = str_repeat('.&#160;&#160;&#160;', $repeat) . ($row->level - 1 > 0 ? '|_&#160;' : '') . $row->title;
         }
     }
     return $categories;
 }
예제 #12
0
	/**
	 * Creates a new instance of the Joomla parser.
	 *
	 * @since	1.0
	 * @access	public
	 */
	public function __construct( $contents = '' , $isFile = false )
	{
		$this->version 	= Komento::joomlaVersion();

		if( $this->version >= '3.0' )
		{
			$parser 	= JFactory::getXML( $contents , $isFile );
		}
		else
		{
			$parser 	= JFactory::getXMLParser( 'Simple' );
			$parser->loadString( $contents );
		}

		$this->parser 	= $parser;

		return $this;
	}
예제 #13
0
 public function display($tpl = null)
 {
     // This is necessary for tabbing.
     jimport('joomla.html.pane');
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.system', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     $konfig = Komento::getKonfig();
     $version = Komento::joomlaVersion();
     $this->assignRef('konfig', $konfig);
     $this->assignRef('joomlaVersion', $version);
     parent::display($tpl);
 }
예제 #14
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();
	}
예제 #15
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     if (Komento::joomlaVersion() >= '1.6') {
         if (!$user->authorise('komento.manage.mailq', 'com_komento')) {
             $mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             $mainframe->close();
         }
     }
     // Get data from the model
     $model = Komento::getModel('Mailq', true);
     $pagination = $model->getPagination();
     $items = $model->getItems();
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
예제 #16
0
	public function __construct()
	{
		$this->plugin = strtolower( str_replace( 'KomentoHelper', '', get_class( $this ) ) );

		$this->pluginpath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'komento';
		$this->pluginbase = rtrim( JURI::root(), '/' ) . '/plugins/komento';

		if( Komento::joomlaVersion() >= '1.6' )
		{
			$this->pluginpath .= DIRECTORY_SEPARATOR . $this->plugin;
			$this->pluginbase .= '/' . $this->plugin;
		}

		// load plugin language
		JFactory::getLanguage()->load( 'plg_komento_' . $this->plugin, JPATH_ROOT );

		// load plugin params
		$this->params = Komento::getRegistry( JPluginHelper::getPlugin( 'komento', $this->plugin )->params );
	}
예제 #17
0
 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);
 }
예제 #18
0
 public function registerToolbar()
 {
     // Set the titlebar text
     JToolBarHelper::title(JText::_('COM_KOMENTO'), 'home');
     if (Komento::joomlaVersion() >= '1.6') {
         JToolBarHelper::preferences('com_komento');
     }
 }
예제 #19
0
 public function getEditorList($selected)
 {
     $db = Komento::getDBO();
     // compile list of the editors
     if (Komento::joomlaVersion() >= '1.6') {
         $query = 'SELECT `element` AS value, `name` AS text' . ' FROM `#__extensions`' . ' WHERE `folder` = "editors"' . ' AND `type` = "plugin"' . ' AND `enabled` = 1' . ' ORDER BY ordering, name';
     } else {
         $query = 'SELECT element AS value, name AS text' . ' FROM #__plugins' . ' WHERE folder = "editors"' . ' AND published = 1' . ' ORDER BY ordering, name';
     }
     //echo $query;
     $db->setQuery($query);
     $editors = $db->loadObjectList();
     if (count($editors) > 0) {
         if (Komento::joomlaVersion() >= '1.6') {
             $lang = JFactory::getLanguage();
             for ($i = 0; $i < count($editors); $i++) {
                 $editor = $editors[$i];
                 $lang->load($editor->text . '.sys', JPATH_ADMINISTRATOR, null, false, false);
                 $editor->text = JText::_($editor->text);
             }
         }
     }
     // temporary. remove when wysiwyg editors are ready
     $editors = array();
     $bbcode = new stdClass();
     $bbcode->value = 'bbcode';
     $bbcode->text = JText::_('COM_KOMENTO_EDITOR_BBCODE');
     $none = new stdClass();
     $none->value = 'none';
     $none->text = JText::_('COM_KOMENTO_EDITOR_NONE');
     $editors[] = $bbcode;
     $editors[] = $none;
     return JHTML::_('select.genericlist', $editors, 'form_editor', 'class="inputbox" size="1"', 'value', 'text', $selected);
 }
예제 #20
0
	public static function getOffSet( $numberOnly	= false )
	{
		if(Komento::joomlaVersion() >= '1.6')
		{
			//return a timezone object
			return KomentoDateHelper::getOffSet16($numberOnly);
		}

		$mainframe	= JFactory::getApplication();
		$user		= JFactory::getUser();
		$config		= Komento::getConfig();

		$userTZ		= '';
		$dstOffset	= $config->get('main_dstoffset', 0);


		if($user->id != 0)
		{
			$userTZ	= $user->getParam('timezone') + $dstOffset;
		}

		//if user did not set timezone, we use joomla one.
		if(empty($userTZ))
		{
			$userTZ	= $mainframe->getCfg('offset') + $dstOffset;
		}

		return $userTZ;
	}
예제 #21
0
	/**
	 * Processes all AJAX calls here
	 */
	public function process()
	{
		$namespace		= JRequest::getCmd( 'namespace' , '' );
		$isAjaxCall 	= JRequest::getCmd( 'format' ) == 'ajax' && !empty( $namespace );

		if( !$isAjaxCall )
		{
			return false;
		}

		//@task: Process namespace
		$namespace		= explode( '.' , $namespace );

		if( !JRequest::checkToken() && !JRequest::checkToken( 'get' ) )
		{
			echo 'Invalid token';
			exit;
		}

		// @rule: All calls should be made a minimum out of 3 parts of dots (.)
		if( count( $namespace ) < 4 )
		{
			$this->fail( JText::_( 'Invalid calls') );
			return $this->send();
		}

		/**
		 * Namespaces are broken into the following
		 *
		 * site.views.viewname.methodname - Front end ajax calls
		 * admin.views.viewname.methodname - Back end ajax calls
		 * plugin.views.pluginname.methodname - Plugin ajax calls (for extended plugin)
		 */

		list( $location , $type , $view , $method ) = $namespace;

		if( $type != 'views' )
		{
			$this->fail( JText::_( 'Currently only serving views' ) );
			return $this->send();
		}

		$location	= strtolower( $location );
		$view 		= strtolower( $view );

		$path = JPATH_ROOT;
		$class = '';

		switch( $location )
		{
			case 'admin':
				$path .= DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $view . DIRECTORY_SEPARATOR . 'view.ajax.php';
				$class 	= 'KomentoView' . preg_replace( '/[^A-Z0-9_]/i' , '' , $view );
				break;
			case 'site':
				$path .= DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $view . DIRECTORY_SEPARATOR . 'view.ajax.php';
				$class 	= 'KomentoView' . preg_replace( '/[^A-Z0-9_]/i' , '' , $view );
				break;
			case 'plugin':
				$path .= DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'komento';
				if( Komento::joomlaVersion() >= '1.6' )
				{
					$path .= DIRECTORY_SEPARATOR . $view;
				}
				$path .= DIRECTORY_SEPARATOR . $view . '.ajax.php';
				$class 	= 'KomentoPlugin' . preg_replace( '/[^A-Z0-9_]/i' , '' , $view );
				break;
		}

		if( !class_exists( $class ) )
		{
			jimport( 'joomla.filesystem.file' );

			if( !JFile::exists( $path ) )
			{
				$this->fail( JText::_( 'View file does not exist.') );
				return $this->send();
			}

			require_once( $path );
		}

		$object 	= new $class();
		$args 		= JRequest::getVar( 'args' , '' );

		if(!method_exists( $object , $method ) )
		{
			$this->fail( JText::sprintf( 'The method %1s does not exists.' , $method ) );
			return $this->send();
		}

		if( !empty( $args ) )
		{
			require_once( KOMENTO_CLASSES . DIRECTORY_SEPARATOR . 'json.php' );
			$json 	= new Services_JSON();
			$args 	= $json->decode( $args );

			if( !is_array( $args ) )
			{
				$args 	= array( $args );
			}

			call_user_func_array( array( $object , $method ) , $args );
		}
		else
		{
			$object->$method();
		}
		$this->send();
	}
예제 #22
0
 public function onExecute(&$article, $html, $view, $options = array())
 {
     // introtext, text, excerpt, intro, content
     if ($view == 'listing') {
         return $html;
     }
     if ($view == 'entry') {
         if (Komento::joomlaVersion() == '1.5') {
             $article->text .= $html;
         }
         return $html;
     }
 }
예제 #23
0
 * @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');
?>

<script type="text/javascript">

<?php 
if (Komento::joomlaVersion() >= 1.6) {
    ?>
	Joomla.submitbutton = function( action )
	{
		submitbutton(action);
	}
<?php 
}
?>

Komento.ready(function($) {

	window.submitbutton = function(action)
	{
		if(action == 'enableall')
		{
예제 #24
0
 public static function getUsersByGroup($gid)
 {
     $userArr = array();
     if (Komento::joomlaVersion() >= '1.6') {
         $userArr = JAccess::getUsersByGroup($gid);
     } else {
         $sql = Komento::getSql();
         $sql->select('#__users')->column('id')->where('gid', $gid);
         $userArr = $sql->loadResultArray();
     }
     return $userArr;
 }
예제 #25
0
 public function getEventTrigger()
 {
     $entryTrigger = Komento::joomlaVersion() > '1.5' ? 'onContentAfterDisplay' : 'onAfterDisplayContent';
     return $entryTrigger;
 }
예제 #26
0
 public static function getBaseUrl()
 {
     static $url;
     if (isset($url)) {
         return $url;
     }
     if (Komento::joomlaVersion() >= '1.6') {
         $uri = JFactory::getURI();
         $language = $uri->getVar('lang', 'none');
         $app = JFactory::getApplication();
         $jconfig = JFactory::getConfig();
         $router = $app->getRouter();
         $url = rtrim(JURI::root(), '/') . '/index.php?option=com_komento&lang=' . $language;
         if ($router->getMode() == JROUTER_MODE_SEF && JPluginHelper::isEnabled("system", "languagefilter")) {
             $rewrite = $jconfig->get('sef_rewrite');
             $base = str_ireplace(JURI::root(true), '', $uri->getPath());
             $path = $rewrite ? $base : JString::substr($base, 10);
             $path = JString::trim($path, '/');
             $parts = explode('/', $path);
             if ($parts) {
                 // First segment will always be the language filter.
                 $language = reset($parts);
             } else {
                 $language = 'none';
             }
             if ($rewrite) {
                 $url = rtrim(JURI::root(), '/') . '/' . $language . '/?option=com_komento';
                 $language = 'none';
             } else {
                 $url = rtrim(JURI::root(), '/') . '/index.php/' . $language . '/?option=com_komento';
             }
         }
     } else {
         $url = rtrim(JURI::root(), '/') . '/index.php?option=com_komento';
     }
     $menu = JFactory::getApplication()->getMenu();
     $item = $menu->getActive();
     if (isset($item->id)) {
         $url .= '&Itemid=' . $item->id;
     }
     // Some SEF components tries to do a 301 redirect from non-www prefix to www prefix.
     // Need to sort them out here.
     $currentURL = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
     if (!empty($currentURL)) {
         // When the url contains www and the current accessed url does not contain www, fix it.
         if (stristr($currentURL, 'www') === false && stristr($url, 'www') !== false) {
             $url = str_ireplace('www.', '', $url);
         }
         // When the url does not contain www and the current accessed url contains www.
         if (stristr($currentURL, 'www') !== false && stristr($url, 'www') === false) {
             $url = str_ireplace('://', '://www.', $url);
         }
     }
     return $url;
 }
예제 #27
0
	public function getCategories()
	{
		$db		= Komento::getDBO();
		$query	= 'SELECT a.id, a.title, a.parent_id, count(b.id) - 1 AS level'
				. ' FROM `#__easyblog_category` AS a'
				. ' INNER JOIN `#__easyblog_category` AS b ON a.lft BETWEEN b.lft and b.rgt'
				. ' GROUP BY a.id'
				. ' ORDER BY a.lft ASC';

		$db->setQuery( $query );
		$categories = $db->loadObjectList();

		if( Komento::joomlaVersion() >= '1.6' )
		{
			foreach( $categories as &$row )
			{
				$repeat = ( $row->level - 1 >= 0 ) ? $row->level - 1 : 0;
				$row->treename = str_repeat( '.&#160;&#160;&#160;', $repeat ) . ( $row->level - 1 > 0 ? '|_&#160;' : '' ) . $row->title;
			}
		}

		return $categories;
	}
예제 #28
0
	public function getUsergroups( $recursive = false )
	{
		if( Komento::joomlaVersion() >= '1.6' )
		{
			return JAccess::getGroupsByUser( $this->id, $recursive );
		}
		else
		{
			if( $this->gid == 0 )
			{
				return array( 29 );
			}

			return array( $this->gid );
		}
	}
?>

					<!-- nofollow for links -->
					<?php 
echo $this->renderSetting('COM_KOMENTO_SETTINGS_LAYOUT_LINKS_NOFOLLOW', 'links_nofollow');
?>

					<!-- Use Date/Time as Permalink -->
					<?php 
echo $this->renderSetting('COM_KOMENTO_SETTINGS_LAYOUT_DATETIME_PERMALINK', 'datetime_permalink');
?>

					<!-- Date format -->
					<?php 
$dateFormatLink = 'http://php.net/manual/en/function.date.php';
if (Komento::joomlaVersion() == '1.5') {
    $dateFormatLink = 'http://php.net/manual/en/function.strftime.php';
}
echo $this->renderText('<a href="' . $dateFormatLink . '" target="_blank">' . JText::_('COM_KOMENTO_SETTINGS_DATE_FORMAT_REFERENCE') . '</a>');
?>

					<?php 
echo $this->renderSetting('COM_KOMENTO_SETTINGS_LAYOUT_DATE_FORMAT', 'date_format', 'input', 10);
?>

					<!-- Image Width -->
					<?php 
echo $this->renderSetting('COM_KOMENTO_SETTINGS_LAYOUT_IMAGE_WIDTH', 'max_image_width', 'input', array('posttext' => ' px'));
?>

					<!-- Image Height -->
예제 #30
0
 * 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.
 */
// No direct access
defined('_JEXEC') or die('Restricted access');
// Load constants and helpers
require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
// Require the base controller
require_once KOMENTO_ADMIN_ROOT . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . 'controller.php';
// Include dependencie
jimport('joomla.application.component.controller');
// Check access
if (Komento::joomlaVersion() >= '1.6') {
    if (!JFactory::getUser()->authorise('core.manage', 'com_komento')) {
        JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
        JFactory::getApplication()->close();
    }
}
// else
// {
// 	if ( !JFactory::getUser()->authorize('com_komento', 'manage') )
// 	{
// 		return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
// 	}
// }
if (JRequest::getBool('compile')) {
    $minify = JRequest::getBool('minify', false);
    $compiler = Komento::getClass('compiler', 'KomentoCompiler');