Example #1
0
 function onSystemStart()
 {
     if (!self::kunenaInstalled()) {
         return;
     }
     //initialize the toolbar object
     $toolbar = CFactory::getToolbar();
     // Kunena online check
     if (!Kunena::enabled()) {
         $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENAMENU_KUNENA_OFFLINE'), JRoute::_('index.php?option=com_kunena'));
         return;
     }
     //adding new 'tab' 'Forum Settings' to JomSocial toolbar
     $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENANENU_FORUM'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
     if ($this->params->get('sh_editprofile')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_EDITPROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_EDITPROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile&task=edit'));
     }
     if ($this->params->get('sh_myprofile')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_PROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_PROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
     }
     if ($this->params->get('sh_myposts')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_POSTS', JText::_('PLG_COMMUNITY_KUNENAMENU_POSTS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=userposts'));
     }
     if ($this->params->get('sh_mysubscriptions')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_SUBSCRIBES', JText::_('PLG_COMMUNITY_KUNENAMENU_SUBSCRIBTIONS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=subscriptions'));
     }
     if ($this->params->get('sh_myfavorites')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_FAVORITES', JText::_('PLG_COMMUNITY_KUNENAMENU_FAVORITES'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=favorites'));
     }
 }
Example #2
0
 /**
  * @throws Exception
  */
 public function delete()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->setRedirect(KunenaRoute::_($this->baseurl, false));
         return;
     }
     $cid = JFactory::getApplication()->input->get('cid', array(), 'post', 'array');
     // Array of integers
     Joomla\Utilities\ArrayHelper::toInteger($cid);
     if (!$cid) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_NO_ATTACHMENTS_SELECTED'), 'error');
         $this->setRedirect(KunenaRoute::_($this->baseurl, false));
         return;
     }
     foreach ($cid as $id) {
         $attachment = KunenaAttachmentHelper::get($id);
         $message = $attachment->getMessage();
         $attachments = array($attachment->id, 1);
         $attach = array();
         $removeList = array_keys(array_diff_key($attachments, $attach));
         Joomla\Utilities\ArrayHelper::toInteger($removeList);
         $message->removeAttachments($removeList);
         $message->save();
         $topic = $message->getTopic();
         $attachment->delete();
         if ($topic->attachments > 0) {
             $topic->attachments = $topic->attachments - 1;
             $topic->save(false);
         }
     }
     $this->app->enqueueMessage(JText::_('COM_KUNENA_ATTACHMENTS_DELETED_SUCCESSFULLY'));
     $this->setRedirect(KunenaRoute::_($this->baseurl, false));
 }
Example #3
0
 /**
  * @param        $user
  * @param string $task
  * @param bool   $xhtml
  *
  * @return bool
  */
 public function getProfileURL($user, $task = '', $xhtml = true)
 {
     if ($user == 0) {
         return false;
     }
     if (!$user instanceof KunenaUser) {
         $user = KunenaUserHelper::get($user);
     }
     if ($user === false) {
         return false;
     }
     $userid = "&userid={$user->userid}";
     if ($task && $task != 'edit') {
         // TODO: remove in the future.
         $do = $task ? '&do=' . $task : '';
         return KunenaRoute::_("index.php?option=com_kunena&func=profile{$do}{$userid}", $xhtml);
     } else {
         $layout = $task ? '&layout=' . $task : '';
         if ($layout) {
             return KunenaRoute::_("index.php?option=com_kunena&view=user{$layout}{$userid}", $xhtml);
         } else {
             return KunenaRoute::getUserUrl($user, $xhtml);
         }
     }
 }
Example #4
0
	function delete() {
		$app =  JFactory::getApplication ();
		$db = JFactory::getDBO ();

		if (! JRequest::checkToken ()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$app->redirect ( KunenaRoute::_($this->baseurl, false) );
		}

		$cids = JRequest::getVar ( 'cid', array (), 'post', 'array' );

		if (! $cids) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_NO_ATTACHMENTS_SELECTED' ), 'error' );
			$app->redirect ( KunenaRoute::_($this->baseurl, false) );
		}

		foreach( $cids as $id ) {
			kimport ('kunena.forum.message.attachment.helper');
			$attachment = KunenaForumMessageAttachmentHelper::get($id);
			$attachment->delete();
		}

		$app->enqueueMessage ( JText::_('COM_KUNENA_ATTACHMENTS_DELETED_SUCCESSFULLY') );
		$app->redirect ( KunenaRoute::_($this->baseurl, false) );
	}
 /**
  * Generates HTML for posts in forum tab
  *
  * @param object  $template
  * @param object  $forum
  * @param object  $model
  * @return mixed
  */
 function ShowPosts($template, $forum, $model)
 {
     $html = null;
     $oneOrTwo = 1;
     if ($template->posts) {
         if ($template->showSearch) {
             $html .= '<div style="width:95%;text-align:right;">' . $template->searchForm . '</div><div style="clear:both;"></div><br />';
         }
         $html .= '<table width="100%" cellspacing="0" cellpadding="3" border="0">' . '<thead>' . '<tr class="sectiontableheader">' . '<th colspan="4">' . $template->title . '</th>' . '</tr>' . '<tr class="sectiontableheader">' . '<th width="20%">' . $template->titles->date . '</th>' . '<th width="50%">' . $template->titles->subject . '</th>' . '<th width="25%">' . $template->titles->category . '</th>' . '<th width="5%">' . $template->titles->hits . '</th>' . '</tr>' . '</thead>' . '<tbody>';
         foreach ($template->posts as $item) {
             $version = substr($forum->version, 0, 3);
             if ($forum->component == 'com_kunena' && strcasecmp($version, '1.6') >= 0) {
                 $postURL = KunenaRoute::_('index.php?option=' . $forum->component . '&func=view&catid=' . $item->catid . '&id=' . $item->id) . '#' . $item->id;
                 $catURL = KunenaRoute::_('index.php?option=' . $forum->component . '&func=showcat&catid=' . $item->catid);
             } else {
                 $postURL = cbSef('index.php?option=' . $forum->component . $forum->itemid . '&amp;func=view&amp;catid=' . $item->catid . '&amp;id=' . $item->id) . '#' . $item->id;
                 $catURL = cbSef('index.php?option=' . $forum->component . $forum->itemid . '&amp;func=' . ($forum->component == 'com_kunena' ? 'showcat' : 'view') . '&amp;catid=' . $item->catid);
             }
             $html .= '<tr class="sectiontableentry' . $oneOrTwo . '">' . '<td>' . getFieldValue('date', date('Y-m-d, H:i:s', $item->time)) . '</td>' . '<td><a href="' . $postURL . '">' . htmlspecialchars(stripslashes($item->subject)) . '</a></td>' . '<td><a href="' . $catURL . '">' . htmlspecialchars(stripslashes($item->catname)) . '</a></td>' . '<td>' . $item->threadhits . '</td>' . '</tr>';
             $oneOrTwo = $oneOrTwo == 1 ? 2 : 1;
         }
         $html .= '</tbody>' . '</table>';
         if ($template->showPaging) {
             $html .= '<br /><div style="width:95%;text-align:center;">' . $template->paging . '</div>';
         }
     } else {
         if ($template->noResults) {
             $html .= '<div style="width:95%;text-align:right;">' . $template->searchForm . '</div><div style="clear:both;"></div><div>' . CBTxt::T('No matching forum posts found.') . '</div>';
         } else {
             $html .= '<div>' . CBTxt::T('This user has no forum posts.') . '</div>';
         }
     }
     return $html;
 }
Example #6
0
	/**
	 * Method to get the RSS URL link with image
	 *
	 * @return string
	 */
	protected function getRSS()
	{
		$config = KunenaFactory::getConfig();

		if ($config->enablerss)
		{
			$mode = $config->rss_type;

			switch ($mode)
			{
				case 'topic' :
					$rss_type = 'mode=topics';
					break;
				case 'recent' :
					$rss_type = 'mode=replies';
					break;
				case 'post' :
					$rss_type = 'layout=posts';
					break;
			}

			return '<a href="' . KunenaRoute::_("index.php?option=com_kunena&view=topics&format=feed&layout=default&{$rss_type}", true) . '"><span class="icon-feed" title="' . JText::_('COM_KUNENA_CATEGORIES_LABEL_GETRSS') . '"></span></a>';
		}
		else
		{
			return null;
		}
	}
Example #7
0
 public function displayAll()
 {
     if ($this->me->isAdmin()) {
         if ($this->config->board_offline) {
             $this->app->enqueueMessage(JText::_('COM_KUNENA_FORUM_IS_OFFLINE'), 'notice');
         }
         if ($this->config->debug) {
             $this->app->enqueueMessage(JText::_('COM_KUNENA_WARNING_DEBUG'), 'notice');
         }
     }
     if ($this->me->isBanned()) {
         $banned = KunenaUserBan::getInstanceByUserid($this->me->userid, true);
         if (!$banned->isLifetime()) {
             $this->app->enqueueMessage(JText::sprintf('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS_EXPIRY', KunenaDate::getInstance($banned->expiration)->toKunena('date_today')), 'notice');
         } else {
             $this->app->enqueueMessage(JText::_('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS'), 'notice');
         }
     }
     $this->state = $this->get('State');
     require_once KPATH_SITE . '/lib/kunena.link.class.php';
     $this->ktemplate->initialize();
     if (JFactory::getApplication()->isAdmin()) {
         $this->displayLayout();
     } else {
         $this->document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
         include $this->ktemplate->getFile('html/display.php');
         echo $this->poweredBy();
     }
 }
Example #8
0
	/**
	 * Prepare menu display.
	 *
	 * @return bool
	 */
	protected function before()
	{
		parent::before();

		$this->basemenu = $basemenu = KunenaRoute::getMenu();

		if (!$basemenu)
		{
			return false;
		}

		$parameters = new JRegistry;
		$template = KunenaFactory::getTemplate();
		$parameters->set('showAllChildren', $template->params->get('menu_showall', 0));
		$parameters->set('menutype', $basemenu->menutype);
		$parameters->set('startLevel', $basemenu->level + 1);
		$parameters->set('endLevel', $basemenu->level + $template->params->get('menu_levels', 1));

		$this->list = KunenaMenuHelper::getList($parameters);
		$this->menu = $this->app->getMenu();
		$this->active = $this->menu->getActive();
		$this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
		$this->path = isset($this->active) ? $this->active->tree : array();
		$this->showAll = $parameters->get('showAllChildren');
		$this->class_sfx = htmlspecialchars($parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8');

		return true;
	}
Example #9
0
	function sync() {
		// FIXME: remove option:
		$usercache = JRequest::getBool ( 'usercache', 0 );
		$useradd = JRequest::getBool ( 'useradd', 0 );
		$userdel = JRequest::getBool ( 'userdel', 0 );
		$userrename = JRequest::getBool ( 'userrename', 0 );

		$app = JFactory::getApplication ();
		$db = JFactory::getDBO ();
		if (!JRequest::checkToken()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->setRedirect(KunenaRoute::_($this->baseurl, false));
			return;
		}

		if ($useradd) {
			$db->setQuery ( "INSERT INTO #__kunena_users (userid) SELECT a.id FROM #__users AS a LEFT JOIN #__kunena_users AS b ON b.userid=a.id WHERE b.userid IS NULL" );
			$db->query ();
			if (KunenaError::checkDatabaseError()) return;
			$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_ADD') . ' ' . $db->getAffectedRows () );
		}
		if ($userdel) {
			$db->setQuery ( "DELETE a FROM #__kunena_users AS a LEFT JOIN #__users AS b ON a.userid=b.id WHERE b.username IS NULL" );
			$db->query ();
			if (KunenaError::checkDatabaseError()) return;
			$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_DEL') . ' ' . $db->getAffectedRows () );
		}
		if ($userrename) {
			$model = $this->getModel('Syncusers');
			$cnt = $model->KupdateNameInfo ();
			$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_RENAME') . " $cnt" );
		}

		$this->setRedirect(KunenaRoute::_($this->baseurl, false));
	}
Example #10
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'));
     }
 }
Example #11
0
 public function logoutUser()
 {
     cbimport('cb.authentication');
     $cbAuthenticate = new CBAuthentication();
     $redirect_url = KunenaRoute::current();
     $resultError = $cbAuthenticate->logout($redirect_url);
     return $resultError ? $resultError : null;
 }
Example #12
0
 public function getStatisticsURL($action = '', $xhtml = true)
 {
     $config = KunenaFactory::getConfig();
     $my = JFactory::getUser();
     if ($config->statslink_allowed == 0 && $my->id == 0) {
         return false;
     }
     return KunenaRoute::_('index.php?option=com_kunena&view=statistics' . $action, $xhtml);
 }
Example #13
0
 public function getUserListURL($action = '', $xhtml = true)
 {
     $config = KunenaFactory::getConfig();
     $my = JFactory::getUser();
     if ($config->userlist_allowed == 1 && $my->id == 0) {
         return false;
     }
     return KunenaRoute::_('index.php?option=com_kunena&view=user&layout=list' . $action, $xhtml);
 }
Example #14
0
 function jump()
 {
     $catid = JRequest::getInt('catid', 0);
     if (!$catid) {
         $this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=category&layout=list'));
     } else {
         $this->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=category&catid={$catid}"));
     }
 }
Example #15
0
 /**
  * @throws Exception
  */
 function jump()
 {
     $catid = JFactory::getApplication()->input->getInt('catid', 0);
     if (!$catid) {
         $this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=category&layout=list', false));
     } else {
         $this->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=category&catid={$catid}", false));
     }
 }
Example #16
0
	function recount() {
		$app = JFactory::getApplication ();
		$state = $app->getUserState ( 'com_kunena.admin.recount', null );

		if ($state === null) {
			// First run
			$query = "SELECT MAX(id) FROM #__kunena_messages";
			$db = JFactory::getDBO();
			$db->setQuery ( $query );
			$state = new StdClass();
			$state->step = 0;
			$state->maxId = (int) $db->loadResult ();
			$state->start = 0;
		}

		$this->checkTimeout();
		while (1) {
			$count = mt_rand(95000, 105000);
			switch ($state->step) {
				case 0:
					// Update topic statistics
					KunenaForumTopicHelper::recount(false, $state->start, $state->start+$count);
					$state->start += $count;
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_TOPICS', min($state->start, $state->maxId), $state->maxId) );
					break;
				case 1:
					// Update usertopic statistics
					KunenaForumTopicUserHelper::recount(false, $state->start, $state->start+$count);
					$state->start += $count;
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERTOPICS', min($state->start, $state->maxId), $state->maxId) );
					break;
				case 2:
					// Update user statistics
					KunenaUserHelper::recount();
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USER') );
					break;
				case 3:
					// Update category statistics
					KunenaForumCategoryHelper::recount();
					//$app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_CATEGORY') );
					break;
				default:
					$app->setUserState ( 'com_kunena.admin.recount', null );
					$app->enqueueMessage (JText::_('COM_KUNENA_RECOUNTFORUMS_DONE'));
					$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena', false));
					return;
			}
			if (!$state->start || $state->start > $state->maxId) {
				$state->step++;
				$state->start = 0;
			}
			if ($this->checkTimeout()) break;
		}
		$app->setUserState ( 'com_kunena.admin.recount', $state );
		$this->setRedirect(KunenaRoute::_('index.php?option=com_kunena&view=recount&task=recount', false));
	}
Example #17
0
 function setdefault()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $this->config->reset();
     $this->config->save();
     $this->app->redirect('index.php?option=com_kunena&view=config', JText::_('COM_KUNENA_CONFIG_DEFAULT'));
 }
Example #18
0
	public function getProfileURL($user, $task='', $xhtml = true)
	{
		if ($user == 0) return false;
		$user = KunenaFactory::getUser($user);
		$my = JFactory::getUser();
		if ($user === false) return false;
		$userid = "&userid={$user->userid}";
		$do = $task ? '&do='.$task : '';
		return KunenaRoute::_("index.php?option=com_kunena&func=profile{$do}{$userid}", $xhtml);
	}
Example #19
0
 public function getUserListURL($action = '', $xhtml = true)
 {
     $config = KunenaFactory::getConfig();
     $my = JFactory::getUser();
     if ($config->userlist_allowed == 1 && $my->id == 0) {
         return false;
     } elseif ($this->params->get('userlist', 0) == 0) {
         return KunenaRoute::_('index.php?option=com_kunena&view=user&layout=list' . $action, $xhtml);
     } else {
         return JRoute::_('index.php?option=com_jsn&view=list&Itemid=' . $this->params->get('menuitem', ''), false);
     }
 }
Example #20
0
 protected function _display()
 {
     $this->ksearch_button = $this->params->get('ksearch_button', '');
     $this->ksearch_button_pos = $this->params->get('ksearch_button_pos', 'right');
     $this->ksearch_button_txt = $this->params->get('ksearch_button_txt', JText::_('Search'));
     $this->ksearch_width = intval($this->params->get('ksearch_width', 20));
     $this->ksearch_maxlength = $this->ksearch_width > 20 ? $this->ksearch_width : 20;
     $this->ksearch_txt = $this->params->get('ksearch_txt', JText::_('Search...'));
     $this->ksearch_moduleclass_sfx = $this->params->get('moduleclass_sfx', '');
     $this->url = KunenaRoute::_('index.php?option=com_kunena');
     require JModuleHelper::getLayoutPath('mod_kunenasearch');
 }
Example #21
0
 function setdefault()
 {
     $db = JFactory::getDBO();
     if (!JRequest::checkToken()) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $this->config->reset();
     $this->config->save();
     $this->app->enqueueMessage(JText::_('COM_KUNENA_CONFIG_DEFAULT'));
     $this->app->redirect(KunenaRoute::_($this->baseurl, false));
 }
Example #22
0
 /**
  * Add path to breadcrumbs.
  * @param $text
  * @param $uri
  * @param $ignore
  *
  * @return $this
  */
 public function addBreadcrumb($text, $uri, $ignore = true)
 {
     if ($ignore) {
         $active = KunenaRoute::$active;
         $view = isset($active->query['view']) ? $active->query['view'] : '';
         $layout = isset($active->query['layout']) ? $active->query['layout'] : 'default';
         if ($active && $active->component == 'com_kunena' && strtolower("{$view}/{$layout}") == strtolower($this->_name)) {
             return $this;
         }
     }
     $this->breadcrumb->addItem($text, KunenaRoute::normalize($uri));
     return $this;
 }
Example #23
0
	public function onAfterReply($message) {
		// Check for permisions of the current category - activity only if public or registered
		if ( $this->_checkPermissions($message) ) {
			$datareference = '<a rel="nofollow" href="' . KunenaRoute::_($message->getPermaUrl()) . '">' . $message->subject . '</a>';
			$referreid = AlphaUserPointsHelper::getReferreid( $message->userid );
			if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) {
				if ( $this->_checkRuleEnabled( 'plgaup_kunena_topic_reply' ) ) {
					$keyreference = $this->_buildKeyreference( 'plgaup_kunena_topic_reply', $message->id ) ;
					AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', $referreid, $keyreference, $datareference );
				}
			}
		}
	}
Example #24
0
 public function template()
 {
     $name = JRequest::getString('name', JRequest::getString('kunena_template', '', 'COOKIE'));
     if ($name) {
         $name = KunenaPath::clean($name);
         if (!is_readable(KPATH_SITE . "/template/{$name}/template.xml")) {
             $name = 'blue_eagle';
         }
         setcookie('kunena_template', $name, 0, JUri::root(true) . '/');
     } else {
         setcookie('kunena_template', null, time() - 3600, JUri::root(true) . '/');
     }
     $this->setRedirect(KunenaRoute::_('index.php?option=com_kunena', false));
 }
Example #25
0
	public function display($cachable = false, $urlparams = false) {
		$menu = $this->app->getMenu ();
		$home = $menu->getActive ();
		if (!$home) {
			JRequest::setVar ( 'view', 'category' );
			JRequest::setVar ( 'layout', 'list' );
			//JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );

		} else {
			// Find default menu item
			$default = $this->_getDefaultMenuItem($menu, $home);
			if (!$default || $default->id == $home->id) {
				// There is no default menu item, use category view instead

				$default = $menu->getItem ( KunenaRoute::getItemID("index.php?option=com_kunena&view=category&layout=list") );
				if ($default) {
					$default = clone $default;
					$defhome = KunenaRoute::getHome($default);
					if (!$defhome || $defhome->id != $home->id) $default = clone $home;
					$default->query['view'] = 'category';
					$default->query['layout'] = 'list';
				}
			}
			if (!$default) {
				JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
			}

			// Add query variables from shown menu item
			foreach ( $default->query as $var => $value ) {
				JRequest::setVar ( $var, $value );
			}

			// Remove query variables coming from the home menu item
			JRequest::setVar ( 'defaultmenu', null );

			// Set active menu item to point the real page
			$menu->setActive ( $default->id );
		}

		// Reset our router
		KunenaRoute::initialize();

		// Run display task from our new controller
		$controller = KunenaController::getInstance();
		$controller->execute ('display');

		// Set redirect and message
		$this->setRedirect ($controller->getRedirect(), $controller->getMessage(), $controller->getMessageType());
	}
Example #26
0
 public function search()
 {
     $model = $this->getModel('user');
     $uri = new JUri('index.php?option=com_kunena&view=user&layout=list');
     $state = $model->getState();
     $search = $state->get('list.search');
     $limitstart = $state->get('list.start');
     if ($search) {
         $uri->setVar('search', $search);
     }
     if ($limitstart) {
         $uri->setVar('limitstart', $search);
     }
     $this->setRedirect(KunenaRoute::_($uri, false));
 }
Example #27
0
	function displayDefault($tpl = null) {
		$this->config = KunenaFactory::getConfig ();
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_KUNENA_STAT_FORUMSTATS') . ' - ' .      $this->config->board_title);

		require_once(KPATH_SITE.'/lib/kunena.link.class.php');
		$kunena_stats = KunenaForumStatistics::getInstance ( );
		$kunena_stats->loadAll();

		$this->assign($kunena_stats);
		$this->latestMemberLink = CKunenaLink::GetProfileLink($this->lastUserId);
		$this->userlist = CKunenaLink::GetUserlistLink('', intval($this->get('memberCount')));
		$this->statisticsURL = KunenaRoute::_('index.php?option=com_kunena&view=statistics');

		parent::display ();
	}
Example #28
0
 /**
  * Redirect to home page.
  *
  * @return KunenaLayout
  *
  * @throws KunenaExceptionAuthorise
  */
 public function execute()
 {
     $menu = $this->app->getMenu();
     $home = $menu->getActive();
     if (!$home) {
         $this->input->set('view', 'category');
         $this->input->set('layout', 'list');
         // throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
     } else {
         // Find default menu item.
         $default = $this->getDefaultMenuItem($menu, $home);
         if (!$default || $default->id == $home->id) {
             // There is no default menu item, use category view instead.
             $default = $menu->getItem(KunenaRoute::getItemID('index.php?option=com_kunena&view=category&layout=list'));
             if ($default) {
                 $default = clone $default;
                 $defhome = KunenaRoute::getHome($default);
                 if (!$defhome || $defhome->id != $home->id) {
                     $default = clone $home;
                 }
                 $default->query['view'] = 'category';
                 $default->query['layout'] = 'list';
             }
         }
         if (!$default) {
             throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
         }
         // Add query variables from shown menu item.
         foreach ($default->query as $var => $value) {
             $this->input->set($var, $value);
         }
         // Remove query variables coming from the home menu item.
         $this->input->set('defaultmenu', null);
         // Set active menu item to point the real page.
         $this->input->set('Itemid', $default->id);
         $menu->setActive($default->id);
     }
     // Reset our router.
     KunenaRoute::initialize();
     // Get HMVC controller for the current page.
     $controller = KunenaControllerApplication::getInstance($this->input->getCmd('view'), $this->input->getCmd('layout', 'default'), $this->input->getCmd('task', 'display'), $this->input, $this->app);
     if (!$controller) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     return $controller->execute();
 }
Example #29
0
 public function display()
 {
     // Load CSS only once
     if (self::$cssadded == false) {
         $this->document->addStyleSheet(JURI::root(true) . '/modules/mod_kunenasearch/tmpl/css/kunenasearch.css');
         self::$cssadded = true;
     }
     $this->ksearch_button = $this->params->get('ksearch_button', '');
     $this->ksearch_button_pos = $this->params->get('ksearch_button_pos', 'right');
     $this->ksearch_button_txt = $this->params->get('ksearch_button_txt', JText::_('Search'));
     $this->ksearch_width = intval($this->params->get('ksearch_width', 20));
     $this->ksearch_maxlength = $this->ksearch_width > 20 ? $this->ksearch_width : 20;
     $this->ksearch_txt = $this->params->get('ksearch_txt', JText::_('Search...'));
     $this->ksearch_moduleclass_sfx = $this->params->get('moduleclass_sfx', '');
     $this->url = KunenaRoute::_('index.php?option=com_kunena');
     require JModuleHelper::getLayoutPath('mod_kunenasearch');
 }
Example #30
0
	function setdefault() {
		$db = JFactory::getDBO ();
		$app = JFactory::getApplication ();
		$config = KunenaFactory::getConfig ();

		if (! JRequest::checkToken ()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$app->redirect ( KunenaRoute::_($this->baseurl, false) );
		}

		$config->backup ();
		$config->remove ();
		$config = new CKunenaConfig();
		$config->create();

		$app->enqueueMessage ( JText::_('COM_KUNENA_CONFIG_DEFAULT'));
		$app->redirect ( KunenaRoute::_($this->baseurl, false) );
	}