public function __construct(&$subject, $config)
 {
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) {
         return;
     }
     parent::__construct($subject, $config);
 }
Ejemplo n.º 2
0
 /**
  * Gets the model description for CB Forums
  *
  * @return stdClass
  */
 public static function getModel()
 {
     global $_CB_framework;
     static $cache = array();
     $plugin = cbforumsClass::getPlugin();
     $forum = $plugin->params->get('forum_model', 1);
     if (!isset($cache[$forum])) {
         $path = $_CB_framework->getCfg('absolute_path');
         $model = new stdClass();
         if (in_array($forum, array(1, 3, 4, 5, 6)) && file_exists($path . '/administrator/components/com_kunena/api.php')) {
             /** @noinspection PhpIncludeInspection */
             require_once $path . '/administrator/components/com_kunena/api.php';
             if (!class_exists('KunenaForum') || !KunenaForum::installed()) {
                 $model->file = null;
             } else {
                 KunenaForum::setup();
                 $model->file = $plugin->absPath . '/models/kunena20.php';
             }
             $model->detected = $forum == 6 ? CBTxt::T('Kunena 3.x') : CBTxt::T('Kunena 2.x');
             $model->type = $forum == 6 ? 6 : 5;
         } else {
             $model->file = null;
             $model->detected = CBTxt::T('None');
             $model->type = 0;
         }
         if ($model->file) {
             /** @noinspection PhpIncludeInspection */
             require_once $model->file;
             $model->class = new cbforumsModel();
         }
         $cache[$forum] = $model;
     }
     return $cache[$forum];
 }
Ejemplo n.º 3
0
 /**
  * @return string
  */
 protected function getInput()
 {
     if (!class_exists('KunenaForum') || !KunenaForum::installed()) {
         echo '<a href="index.php?option=com_kunena">PLEASE COMPLETE KUNENA INSTALLATION</a>';
         return '';
     }
     KunenaFactory::loadLanguage('com_kunena');
     $size = $this->element['size'];
     $class = $this->element['class'];
     $attribs = ' ';
     if ($size) {
         $attribs .= 'size="' . $size . '"';
     }
     if ($class) {
         $attribs .= 'class="' . $class . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if (!empty($this->element['multiple'])) {
         $attribs .= ' multiple="multiple"';
     }
     // Get the field options.
     $options = $this->getOptions();
     return JHtml::_('kunenaforum.categorylist', $this->name, 0, $options, $this->element, $attribs, 'value', 'text', $this->value);
 }
Ejemplo n.º 4
0
 function shKUGetVersion()
 {
     static $version = null;
     if (is_null($version)) {
         // Make sure that Kunena API has been loaded
         $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
         if (is_file($api)) {
             require_once $api;
         }
         if (class_exists('KunenaForum')) {
             $version = KunenaForum::versionMajor();
             // Initialize Kunena 2.0 support
             kimport('kunena.forum.category');
             kimport('kunena.forum.topic');
         } elseif (class_exists('Kunena')) {
             $version = '1.6';
             // Initialize Kunena 1.6 support
             require_once KUNENA_PATH . '/router.php';
             KunenaRouter::loadCategories();
         } elseif (is_file(JPATH_ROOT . '/components/com_kunena/lib/kunena.defines.php')) {
             $version = '1.5';
         } elseif (is_file(JPATH_ROOT . '/components/com_kunena/lib/kunena.version.php')) {
             $version = '1.0';
         } else {
             $version = false;
         }
     }
     return $version;
 }
Ejemplo n.º 5
0
 /**
  * Display module contents.
  */
 public final function display()
 {
     // Load CSS only once
     if (static::$css) {
         $this->document->addStyleSheet(JURI::root(true) . static::$css);
         static::$css = null;
     }
     // Use caching also for registered users if enabled.
     if ($this->params->get('owncache', 0)) {
         /** @var $cache JCacheControllerOutput */
         $cache = JFactory::getCache('com_kunena', 'output');
         $me = KunenaFactory::getUser();
         $cache->setLifeTime($this->params->get('cache_time', 180));
         $hash = md5(serialize($this->params));
         if ($cache->start("display.{$me->userid}.{$hash}", 'mod_kunenalatest')) {
             return;
         }
     }
     // Initialize Kunena.
     KunenaForum::setup();
     // Display module.
     $this->_display();
     // Store cached page.
     if (isset($cache)) {
         $cache->end();
     }
 }
Ejemplo n.º 6
0
 public function __construct(&$subject, $config)
 {
     // Do not load if Kunena version is not supported or Kunena is offline
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) {
         return;
     }
     $app = JFactory::getApplication();
     // Do not load if CommunityBuilder is not installed
     $path = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
     if (!is_file($path)) {
         return;
     }
     require_once $path;
     cbimport('cb.database');
     cbimport('cb.tables');
     cbimport('language.front');
     cbimport('cb.tabs');
     cbimport('cb.field');
     global $ueConfig;
     parent::__construct($subject, $config);
     $this->loadLanguage('plg_kunena_comprofiler.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_comprofiler.sys', KPATH_ADMIN);
     require_once __DIR__ . "/integration.php";
     if ($app->isAdmin() && (!isset($ueConfig['version']) || version_compare($ueConfig['version'], $this->minCBVersion) < 0)) {
         $app->enqueueMessage(JText::sprintf('PLG_KUNENA_COMPROFILER_WARN_VERSION', $this->minCBVersion), 'notice');
     }
 }
Ejemplo n.º 7
0
 function onSystemStart()
 {
     if (!self::kunenaInstalled()) {
         return;
     }
     //initialize the toolbar object
     $toolbar = CFactory::getToolbar();
     $user = JFactory::getUser();
     // Kunena online check
     if (!KunenaForum::enabled()) {
         $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENAMENU_KUNENA_OFFLINE'), KunenaRoute::_('index.php?option=com_kunena'));
         return;
     }
     //adding new 'tab' 'Forum Settings' to JomSocial toolbar
     $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENANENU_FORUM'), 'index.php?option=com_kunena&view=user&layout=default&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=user&layout=default'));
     if ($this->params->get('sh_editprofile', 1)) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_EDITPROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_EDITPROFILE'), 'index.php?option=com_kunena&view=user&layout=edit&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=user&layout=edit'));
     }
     if ($this->params->get('sh_myprofile', 1)) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_PROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_PROFILE'), 'index.php?option=com_kunena&view=user&layout=default&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=user&layout=default'));
     }
     if ($this->params->get('sh_myposts', 1)) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_POSTS', JText::_('PLG_COMMUNITY_KUNENAMENU_POSTS'), 'index.php?option=com_kunena&view=topics&layout=posts&mode=recent&userid=' . $user->id . '&sel=-1&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=topics&layout=posts&mode=recent&userid=' . $user->id . '&sel=-1'));
     }
     if ($this->params->get('sh_mysubscriptions', 1)) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_SUBSCRIBES', JText::_('PLG_COMMUNITY_KUNENAMENU_SUBSCRIBTIONS'), 'index.php?option=com_kunena&view=topics&layout=user&mode=subscriptions&sel=-1&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=topics&layout=user&mode=subscriptions&sel=-1'));
     }
     if ($this->params->get('sh_myfavorites', 1)) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_FAVORITES', JText::_('PLG_COMMUNITY_KUNENAMENU_FAVORITES'), 'index.php?option=com_kunena&view=topics&layout=user&mode=favorites&sel=-1&Itemid=' . KunenaRoute::getItemid('index.php?option=com_kunena&view=topics&layout=user&mode=favorite&sel=-1s'));
     }
 }
Ejemplo n.º 8
0
	/**
	 * @param object $subject
	 * @param array  $config
	 */
	public function __construct(&$subject, $config)
	{
		// Do not load if Kunena version is not supported or Kunena is offline
		if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('4.0') && KunenaForum::installed()))
		{
			return;
		}

		KunenaFactory::loadLanguage('plg_kunena_uddeim.sys', 'admin');
		$path = JPATH_SITE . "/components/com_uddeim/uddeim.api.php";

		if (!is_file($path))
		{
			return;
		}

		include_once($path);

		$uddeim = new uddeIMAPI();
		if ($uddeim->version() < 1)
		{
			return;
		}

		parent::__construct($subject, $config);

		$this->loadLanguage('plg_kunena_uddeim.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_uddeim.sys', KPATH_ADMIN);
	}
Ejemplo n.º 9
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     if (!class_exists('KunenaForum') || !KunenaForum::installed()) {
         echo '<a href="index.php?option=com_kunena">PLEASE COMPLETE KUNENA INSTALLATION</a>';
         return;
     }
     KunenaFactory::loadLanguage('com_kunena');
     $none = $node->attributes('none');
     $options = array();
     foreach ($node->children() as $option) {
         $options[] = JHTML::_('select.option', $option->attributes('value'), JText::_($option->data()));
     }
     $ctrl = $control_name . '[' . $name . ']';
     $size = $node->attributes('size');
     $class = $node->attributes('class');
     $attribs = ' ';
     if ($size) {
         $attribs .= 'size="' . $size . '"';
     }
     if ($class) {
         $attribs .= 'class="' . $class . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if ($node->attributes('multiple')) {
         $attribs .= ' multiple="multiple"';
         $ctrl .= '[]';
     }
     return JHTML::_('kunenaforum.categorylist', $ctrl, 0, $options, $node->attributes(), $attribs, 'value', 'text', $value);
 }
Ejemplo n.º 10
0
	public static function parseKunenaInstallFile($path) {
		$xml = simplexml_load_file($path);
		if (!$xml || $xml->getName() != 'kinstall') {
			return false;
		}

		$data = new stdClass();
		$data->name = (string) $xml->name;
		$data->type = (string) $xml->attributes()->type;
		$data->creationdate = (string) $xml->creationDate;
		$data->author = (string) $xml->author;
		$data->copyright = (string) $xml->copyright;
		$data->authorEmail = (string) $xml->authorEmail;
		$data->authorUrl = (string) $xml->authorUrl;
		$data->version = (string) $xml->version;
		$data->description = (string) $xml->description;
		$data->thumbnail = (string) $xml->thumbnail;

		if ($data->version == '@kunenaversion@') $data->version = KunenaForum::version();
		if ($data->creationdate == '@kunenaversiondate@') $data->creationdate = KunenaForum::versionDate();

		if (!$data->version) $data->version = JText::_('Unknown');
		if (!$data->creationdate) $data->creationdate = JText::_('Unknown');
		if (!$data->author) $data->author = JText::_('Unknown');

		return $data;
	}
Ejemplo n.º 11
0
	/**
	 * Returns the forum model instance
	 *
	 * @return null|ModelInterface
	 */
	static public function getModel()
	{
		global $_CB_framework, $_PLUGINS;

		static $model			=	null;

		if ( ! $model ) {
			static $params		=	null;

			if ( ! $params ) {
				$plugin			=	$_PLUGINS->getLoadedPlugin( 'user/plug_cbgroupjive/plugins', 'cbgroupjiveforums' );
				$params			=	$_PLUGINS->getPluginParams( $plugin );
			}

			switch( $params->get( 'groups_forums_model', 'kunena' ) ) {
				case 'kunena':
					$api		=	$_CB_framework->getCfg( 'absolute_path' ) . '/administrator/components/com_kunena/api.php';

					if ( file_exists( $api ) ) {
						require_once( $api );

						if ( class_exists( 'KunenaForum' ) ) {
							\KunenaForum::setup();
						}

						$model	=	new Model\Kunena\Model();
					}
					break;
			}
		}

		return $model;
	}
 public function __construct(&$subject, $config)
 {
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) {
         return;
     }
     JLoader::register('KunenaAvatarWoW_Avatar', __DIR__ . '/avatar.php');
     parent::__construct($subject, $config);
 }
Ejemplo n.º 13
0
 public function __construct(&$subject, $config)
 {
     // Do not load if Kunena version is not supported or Kunena is offline
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) {
         return;
     }
     parent::__construct($subject, $config);
 }
Ejemplo n.º 14
0
	public function __construct(&$subject, $config) {
		// Do not load if Kunena version is not supported or Kunena is offline
		if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) return;

		parent::__construct ( $subject, $config );

		$this->loadLanguage ( 'plg_kunena_joomla.sys', JPATH_ADMINISTRATOR ) || $this->loadLanguage ( 'plg_kunena_joomla.sys', KPATH_ADMIN );
	}
Ejemplo n.º 15
0
 function _load_rules()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $total = 0;
     $filter_category = $app->getUserStateFromRequest('com_alphauserpoints' . '.filter_category', 'filter_category', 'all', 'word');
     // Get the pagination request variables
     $limit = $app->getUserStateFromRequest('com_alphauserpoints.limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = JFactory::getApplication()->input->get('limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     if ($filter_category != 'all') {
         $filter = "WHERE r.category = '{$filter_category}'";
     } else {
         $filter = "";
     }
     // check if Kunena forum is installed to show pre-installed rules for Kunena
     // Dectects Kunena 2.0+
     if (class_exists('KunenaForum') && KunenaForum::enabled()) {
         $filter != '' ? $filter .= " AND " : ($filter .= "WHERE ");
         $filter .= "(r.plugin_function!='plgaup_newtopic_kunena' AND r.plugin_function!='plgaup_reply_kunena' )";
         // Detects Kunena 1.6 and 1.7
     } elseif (class_exists('Kunena') && Kunena::enabled()) {
         if (substr(Kunena::version(), 0, 3) == '1.7') {
             $filter != '' ? $filter .= " AND " : ($filter .= "WHERE ");
             $filter .= "(r.plugin_function!='plgaup_newtopic_kunena' AND r.plugin_function!='plgaup_reply_kunena' )";
         } else {
             $filter != '' ? $filter .= " AND " : ($filter .= "WHERE ");
             $filter .= "(r.plugin_function!='plgaup_kunena_topic_create' AND r.plugin_function!='plgaup_kunena_topic_reply' AND r.plugin_function!='plgaup_kunena_message_delete' AND r.plugin_function!='plgaup_kunena_message_thankyou')";
         }
     }
     // end check Kunena pre_installed rules
     $query = "SELECT r.*, g.title AS groupname FROM #__alpha_userpoints_rules AS r LEFT JOIN #__viewlevels AS g ON g.id=r.access " . $filter . " ORDER BY r.category";
     $total = @$this->_getListCount($query);
     $result = $this->_getList($query, $limitstart, $limit);
     $lists = array();
     $options[] = JHTML::_('select.option', '', JText::_('AUP_NONE'));
     $options[] = JHTML::_('select.option', 'us', JText::_('AUP_CAT_USER'));
     $options[] = JHTML::_('select.option', 'co', JText::_('AUP_CAT_COMMUNITY'));
     $options[] = JHTML::_('select.option', 'ar', JText::_('AUP_CAT_ARTICLE'));
     $options[] = JHTML::_('select.option', 'li', JText::_('AUP_CAT_LINK'));
     $options[] = JHTML::_('select.option', 'po', JText::_('AUP_CAT_POLL_QUIZZ'));
     $options[] = JHTML::_('select.option', 're', JText::_('AUP_CAT_RECOMMEND_INVITE'));
     $options[] = JHTML::_('select.option', 'fo', JText::_('AUP_CAT_COMMENT_FORUM'));
     $options[] = JHTML::_('select.option', 'vi', JText::_('AUP_CAT_VIDEO'));
     $options[] = JHTML::_('select.option', 'ph', JText::_('CAT_CAT_PHOTO'));
     $options[] = JHTML::_('select.option', 'mu', JText::_('AUP_CAT_MUSIC'));
     $options[] = JHTML::_('select.option', 'sh', JText::_('AUP_CAT_SHOPPING'));
     $options[] = JHTML::_('select.option', 'pu', JText::_('AUP_CAT_PURCHASING'));
     $options[] = JHTML::_('select.option', 'cd', JText::_('AUP_CAT_COUPON_CODE'));
     $options[] = JHTML::_('select.option', 'su', JText::_('AUP_CAT_SUBSCRIPTION'));
     $options[] = JHTML::_('select.option', 'sy', JText::_('AUP_CAT_SYSTEM'));
     $options[] = JHTML::_('select.option', 'ot', JText::_('AUP_CAT_OTHER'));
     $options[] = JHTML::_('select.option', 'all', JText::_('AUP_ALL'));
     $lists['filter_category'] = JHTML::_('select.genericlist', $options, 'filter_category', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter_category);
     return array($result, $total, $limit, $limitstart, $lists);
 }
Ejemplo n.º 16
0
 public function __construct(&$subject, $config)
 {
     // Do not load if Kunena version is not supported or Kunena is offline
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) {
         return;
     }
     parent::__construct($subject, $config);
     $this->loadLanguage('plg_kunena_gravatar.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_gravatar.sys', KPATH_ADMIN);
     $this->path = dirname(__FILE__) . '/gravatar';
 }
Ejemplo n.º 17
0
function kunena_upgrade_161_delfiles($parent) {
	if (KunenaForum::isSVN()) return;

	//Import filesystem libraries.
	jimport ( 'joomla.filesystem.folder' );

	$path = JPATH_COMPONENT.'/views/article';
	if(JFolder::exists($path)) JFolder::delete($path);

	return array('action'=>'', 'name'=>JText::_ ( 'COM_KUNENA_INSTALL_161_DELFILES' ), 'success'=>true);
}
Ejemplo n.º 18
0
	public function __construct(&$subject, $config) {
		// Do not load if Kunena version is not supported or Kunena is offline
		if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) return;

		$aup = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
		if (! file_exists ( $aup ))
			return;
		require_once ($aup);

		parent::__construct ( $subject, $config );

		$this->loadLanguage ( 'plg_kunena_alphauserpoints.sys', JPATH_ADMINISTRATOR ) || $this->loadLanguage ( 'plg_kunena_alphauserpoints.sys', KPATH_ADMIN );
	}
Ejemplo n.º 19
0
 public function __construct(&$subject, $config)
 {
     // Do not load if Kunena version is not supported or Kunena is offline
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) {
         return true;
     }
     // Check if easysocial exists
     if (!$this->exists()) {
         return true;
     }
     parent::__construct($subject, $config);
     $this->loadLanguage('plg_kunena_community.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_community.sys', KPATH_ADMIN);
 }
Ejemplo n.º 20
0
	public function __construct(&$subject, $config) {
		// Do not load if Kunena version is not supported or Kunena is offline
		if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('4.0') && KunenaForum::installed())) return;

		// Do not load if JomSocial is not installed
		$path = JPATH_ROOT . '/components/com_community/libraries/core.php';
		if (!is_file ( $path )) return;
		include_once ($path);

		parent::__construct ( $subject, $config );

		$this->loadLanguage ( 'plg_kunena_community.sys', JPATH_ADMINISTRATOR ) || $this->loadLanguage ( 'plg_kunena_community.sys', KPATH_ADMIN );
	}
Ejemplo n.º 21
0
 /**
  * Construct plugin.
  *
  * @param object $subject
  * @param array $config
  */
 public function __construct(&$subject, $config)
 {
     // Do not enable plugin in administration.
     if (JFactory::getApplication()->isAdmin()) {
         return;
     }
     // Do not load if Kunena version is not supported or Kunena is not installed
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('4.0') && KunenaForum::installed())) {
         return;
     }
     parent::__construct($subject, $config);
     $this->loadLanguage('plg_content_kunena.sys');
 }
Ejemplo n.º 22
0
 function getLatestVersion()
 {
     $latestVersion = $this->getLatestKunenaVersion();
     if ($latestVersion['connect']) {
         if (version_compare($latestVersion['latest_version'], KunenaForum::version(), '<=')) {
             $needUpgrade = JText::sprintf('COM_KUNENA_COM_A_CHECK_VERSION_CORRECT', KunenaForum::version());
         } else {
             $needUpgrade = JText::sprintf('COM_KUNENA_COM_A_CHECK_VERSION_NEED_UPGRADE', $latestVersion['latest_version'], $latestVersion['released']);
         }
     } else {
         $needUpgrade = JText::_('COM_KUNENA_COM_A_CHECK_VERSION_CANNOT_CONNECT');
     }
     return $needUpgrade;
 }
Ejemplo n.º 23
0
 /**
  * Display Kunena backend icon in Joomla 2.5+
  *
  * @param string $context
  */
 public function onGetIcons($context)
 {
     if (!$context == 'mod_quickicon' || !JFactory::getUser()->authorise('core.manage', 'com_kunena')) {
         return;
     }
     KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
     if (KunenaForum::installed() && KunenaFactory::getConfig()->version_check && JFactory::getUser()->authorise('core.manage', 'com_installer')) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_kunena'));
         $db->setQuery($query);
         $cparams = new JRegistry((string) $db->loadResult());
         //$cparams = JComponentHelper::getParams('com_kunena');
         $liveupdate = new JRegistry($cparams->get('liveupdate', null));
         $lastCheck = $liveupdate->get('lastcheck', 0);
         $updateInfo = json_decode(trim((string) $liveupdate->get('updatedata', ''), '"'));
         $valid = abs(time() - $lastCheck) <= 24 * 3600;
         // 24 hours
         if (!$valid) {
             // If information is not valid, update it asynchronously.
             $ajax_url = JURI::base() . 'index.php?option=com_kunena&view=liveupdate&task=ajax';
             $script = "window.addEvent('domready', function() {\n\tvar com_kunena_updatecheck_ajax_structure = {\n\t\tonSuccess: function(msg, responseXML) {\n\t\t\tvar updateInfo = JSON.decode(msg, true);\n\t\t\tif (updateInfo.html) {\n\t\t\t\tdocument.id('com_kunena_icon').getElement('img').setProperty('src',updateInfo.img);\n\t\t\t\tdocument.id('com_kunena_icon').getElement('span').set('html', updateInfo.html);\n\t\t\t\tdocument.id('com_kunena_icon').getElement('a').set('href', updateInfo.link);\n\t\t\t}\n\t\t},\n\t\turl: '{$ajax_url}'\n\t};\n\tajax_object = new Request(com_kunena_updatecheck_ajax_structure);\n\tajax_object.send();\n});";
             $document = JFactory::getDocument();
             $document->addScriptDeclaration($script);
         }
     }
     $link = 'index.php?option=com_kunena';
     if (!KunenaForum::installed()) {
         // Not fully installed
         $img = 'kunena/icons/icon-48-kupdate-alert-white.png';
         $text = JText::_('PLG_QUICKICON_KUNENA_COMPLETE_INSTALLATION');
     } elseif (empty($updateInfo->supported)) {
         // Unsupported
         $img = 'kunena/icons/kunena-logo-48-white.png';
         $text = JText::_('COM_KUNENA');
     } elseif ($updateInfo->stuck) {
         // Stuck
         $img = 'kunena/icons/icon-48-kupdate-alert-white.png';
         $text = JText::_('COM_KUNENA') . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_CRASH');
     } elseif (version_compare(KunenaForum::version(), $updateInfo->version, '<')) {
         // Has updates
         $img = 'kunena/icons/icon-48-kupdate-update-white.png';
         $text = 'Kunena ' . $updateInfo->version . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_AVAILABLE');
         $link .= '&view=liveupdate';
     } else {
         // Already in the latest release
         $img = 'kunena/icons/icon-48-kupdate-good-white.png';
         $text = JText::_('COM_KUNENA');
     }
     return array(array('link' => JRoute::_($link), 'image' => $img, 'text' => $text, 'access' => array('core.manage', 'com_kunena'), 'id' => 'com_kunena_icon'));
 }
Ejemplo n.º 24
0
 function display()
 {
     KunenaForum::setup();
     KunenaFactory::loadLanguage();
     KunenaFactory::loadLanguage('com_kunena.templates');
     $this->params->def('greeting', 1);
     $this->document = JFactory::getDocument();
     $this->me = KunenaFactory::getUser();
     $token = JUtility::getToken();
     // Load CSS only once
     if (self::$cssadded == false) {
         $this->document->addStyleSheet(JURI::root(true) . '/modules/mod_kunenalogin/tmpl/css/kunenalogin.css');
         self::$cssadded = true;
     }
     $cache = JFactory::getCache('com_kunena', 'output');
     if ($cache->start("{$this->me->userid}.{$token}", 'mod_kunenalogin')) {
         return;
     }
     $login = KunenaLogin::getInstance();
     if (!$this->me->exists()) {
         $this->type = 'login';
         $this->login = null;
         if ($login) {
             $this->lostPasswordUrl = $login->getResetURL();
             $this->lostUsernameUrl = $login->getRemindURL();
             $this->registerUrl = $login->getRegistrationURL();
             $this->remember = JPluginHelper::isEnabled('system', 'remember');
         }
     } else {
         $this->type = 'logout';
         $this->logout = null;
         $this->lastvisitDate = new KunenaDate($this->me->lastvisitDate);
         if ($login) {
             $this->logout = $login->getLogoutURL();
             $this->recentPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics', JText::_('MOD_KUNENALOGIN_RECENT'));
             $this->myPosts = JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=topics&layout=user&mode=default', JText::_('MOD_KUNENALOGIN_MYPOSTS'));
         }
         // Private messages
         $private = KunenaFactory::getPrivateMessaging();
         $this->privateMessages = '';
         if ($this->params->get('showmessage') && $private) {
             $count = $private->getUnreadCount($this->me->userid);
             $this->privateMessages = $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX'));
         }
     }
     $this->return = $this->getReturnURL();
     require JModuleHelper::getLayoutPath('mod_kunenalogin');
     $cache->end();
 }
Ejemplo n.º 25
0
 public function __construct(&$subject, $config)
 {
     // Do not load if Kunena version is not supported or Kunena is offline
     if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('3.0') && KunenaForum::installed())) {
         return;
     }
     // Do not load if Easyblog is not installed
     $path = JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php';
     if (!is_file($path)) {
         return;
     }
     include_once $path;
     parent::__construct($subject, $config);
     $this->loadLanguage('plg_kunena_easyblog.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_easyblog.sys', KPATH_ADMIN);
 }
Ejemplo n.º 26
0
	public function __construct(&$subject, $config) {
		// Do not load if Kunena version is not supported or Kunena is offline
		if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) return;

		// Do not load if jomwall is not installed
		$path = JPATH_ROOT . '/components/com_awdwall/models/wall.php';
		if (!is_file ( $path )) return;
		include_once ($path);
		include_once (JPATH_ROOT . '/components/com_awdwall/helpers/user.php');

		parent::__construct ( $subject, $config );

		$this->loadLanguage ( 'plg_kunena_jomwall.sys', JPATH_ADMINISTRATOR ) || $this->loadLanguage ( 'plg_kunena_jomwall.sys', KPATH_ADMIN );

		$this->path = dirname ( __FILE__ ) . '/jomwall';
	}
Ejemplo n.º 27
0
 protected static function kunenaOnline()
 {
     // Kunena detection and version check
     $minKunenaVersion = '2.0';
     if (!class_exists('KunenaForum') || !KunenaForum::isCompatible($minKunenaVersion)) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_COMMUNITY_KUNENAGROUPS_KUNENA_NOT_INSTALLED', $minKunenaVersion), 'notice');
         return false;
     }
     // Kunena installed check
     if (!KunenaForum::installed()) {
         JFactory::getApplication()->enqueueMessage(JText::_('PLG_COMMUNITY_KUNENAGROUPS_KUNENA_OFFLINE'), 'notice');
         return false;
     }
     KunenaForum::setup();
     return true;
 }
Ejemplo n.º 28
0
 function displaySchemaDiff()
 {
     require_once KPATH_ADMIN . '/install/schema.php';
     $schema = new KunenaModelSchema();
     $diff = $schema->getDiffSchema();
     $sql = $schema->getSchemaSQL($diff);
     echo '<textarea cols="80" rows="20">';
     echo $this->escape($diff->saveXML());
     echo '</textarea>';
     if (KunenaForum::isDev()) {
         echo '<textarea cols="80" rows="20">';
         foreach ($sql as $item) {
             echo $this->escape($item['sql']) . "\n\n";
         }
         echo '</textarea>';
     }
 }
Ejemplo n.º 29
0
	/**
	 * @param string $type
	 * @param JInstallerFile $parent
	 * @return bool
	 */
	public function preflight($type, $parent) {
		if (!in_array($type, array('install', 'update'))) return true;

		$app = JFactory::getApplication();

		// Do not install if Kunena doesn't exist.
		if (!class_exists('KunenaForum') || !KunenaForum::isCompatible('4.0')) {
			$app->enqueueMessage(sprintf ( 'Kunena %s has not been installed, aborting!', '4.0' ), 'notice');
			return false;
		}
		if (KunenaForum::isDev()) {
			$app->enqueueMessage(sprintf ( 'You have installed Kunena from GitHub, aborting!' ), 'notice');
			return false;
		}

		// Get list of languages to be installed.
		$source = $parent->getParent()->getPath('source').'/language';
		$languages = JFactory::getLanguage()->getKnownLanguages();
		/** @var SimpleXMLElement $files */
		$files = $parent->manifest->files;
		foreach ($languages as $language) {
			$name = "com_kunena_{$language['tag']}";
			$search = JFolder::files($source, $name);
			if (empty($search)) continue;
			// Generate <file type="file" client="site" id="fi-FI">com_kunena_fi-FI_v2.0.0-BETA2-DEV2.zip</file>
			$file = $files->addChild('file', array_pop($search));
			$file->addAttribute('type', 'file');
			$file->addAttribute('client', 'site');
			$file->addAttribute('id', $name);
			echo sprintf('Installing language %s - %s ...', $language['tag'], $language['name']) . '<br />';
		}
		if (empty($files)) {
			$app->enqueueMessage(sprintf ( 'Your site is English only. There\'s no need to install Kunena language pack.' ), 'notice');
			return false;
		}

		// Remove old K1.7 style language pack.
		$table = JTable::getInstance('extension');
		$id = $table->find(array('type'=>'file', 'element'=>"kunena_language_pack"));
		if ($id) {
			$installer = new JInstaller();
			$installer->uninstall ( 'file', $id );
		}

		return true;
	}
 /**
  * Get forum version
  *
  * @param object $forum
  * @return string
  */
 function getVersion($forum)
 {
     global $_CB_database;
     static $version = null;
     if ($version === null) {
         if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
             if (isset($forum->config['version'])) {
                 $version = $forum->config['version'];
             } elseif ($forum->component == 'com_fireboard' || $forum->component == 'com_kunena') {
                 $query = 'SELECT ' . $_CB_database->NameQuote('version') . "\n FROM " . $_CB_database->NameQuote('#__' . $forum->prefix . '_version') . "\n ORDER BY " . $_CB_database->NameQuote('id') . " DESC";
                 $_CB_database->setQuery($query, 0, 1);
                 $version = $_CB_database->loadResult();
             } else {
                 $version = '0.0.0';
             }
         } elseif (class_exists('KunenaForum')) {
             $version = KunenaForum::version();
         } else {
             $version = '0.0.0';
         }
     }
     return $version;
 }