/**
  * 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;
 }
Exemplo n.º 2
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'));
     }
 }
Exemplo n.º 3
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));
 }
Exemplo n.º 4
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();
     }
 }
Exemplo n.º 5
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) );
	}
Exemplo n.º 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;
		}
	}
Exemplo n.º 7
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'));
     }
 }
Exemplo n.º 8
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);
         }
     }
 }
Exemplo n.º 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));
	}
Exemplo n.º 10
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);
 }
Exemplo n.º 11
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));
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 13
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}"));
     }
 }
Exemplo n.º 14
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));
	}
Exemplo n.º 15
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'));
 }
Exemplo n.º 16
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);
	}
Exemplo n.º 17
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);
     }
 }
Exemplo n.º 18
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');
 }
Exemplo n.º 19
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));
 }
Exemplo n.º 20
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 );
				}
			}
		}
	}
Exemplo n.º 21
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));
 }
Exemplo n.º 22
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));
 }
Exemplo n.º 23
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 ();
	}
Exemplo n.º 24
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');
 }
Exemplo n.º 25
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) );
	}
Exemplo n.º 26
0
 function delete()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $cids = JRequest::getVar('cid', array(), 'post', 'array');
     if (!$cids) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_NO_ATTACHMENTS_SELECTED'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     foreach ($cids as $id) {
         $attachment = KunenaForumMessageAttachmentHelper::get($id);
         $attachment->delete();
     }
     $this->app->enqueueMessage(JText::_('COM_KUNENA_ATTACHMENTS_DELETED_SUCCESSFULLY'));
     $this->app->redirect(KunenaRoute::_($this->baseurl, false));
 }
Exemplo n.º 27
0
	public function onAfterReply($message) {
		// Check for permisions of the current category - activity only if public or registered
		$category = $message->getCategory();
		if ($category->pub_access == 0 || $category->pub_access == - 1) {
			require_once KPATH_SITE.'/lib/kunena.link.class.php';
			$datareference = '<a rel="nofollow" href="' . KunenaRoute::_($message->getPermaUrl()) . '">' . $message->subject . '</a>';
			if ($this->_config->alphauserpointsnumchars > 0) {
				// use if limit chars for a response
				if (JString::strlen ( $message->message ) > $this->_config->alphauserpointsnumchars) {
					if ( $this->_getAUPversion() < '1.5.12' ) {
						$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_reply_kunena' );
						if ($ruleEnabled) {
							AlphaUserPointsHelper::newpoints ( 'plgaup_reply_kunena', '', $message->id, $datareference );
						} else {
							return;
						}
					} elseif ( $this->_getAUPversion() >= '1.5.12' ) {
						$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_kunena_topic_reply' );
						if ($ruleEnabled) {
							AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', '', $message->id, $datareference );
						} else {
							return;
						}
					}
				}
			} else {
				if ( $this->_getAUPversion() < '1.5.12' ) {
					$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_reply_kunena' );
					if ($ruleEnabled) {
						AlphaUserPointsHelper::newpoints ( 'plgaup_reply_kunena', '', $message->id, $datareference );
					} else {
						return;
					}
				} elseif ( $this->_getAUPversion() >= '1.5.12' ) {
					$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_kunena_topic_reply' );
					if ($ruleEnabled) {
						AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', '', $message->id, $datareference );
					} else {
						return;
					}
				}
			}
		}
	}
Exemplo n.º 28
0
	function displayAll() {
		$this->app = JFactory::getApplication ();
		if ($this->config->board_offline) {
			$this->app->enqueueMessage ( JText::_('COM_KUNENA_FORUM_IS_OFFLINE'), $this->me->isAdmin () ? 'notice' : 'error');
		}
		if ($this->config->debug && $this->me->isAdmin ()) {
			$this->app->enqueueMessage ( JText::_('COM_KUNENA_WARNING_DEBUG'), 'notice');
		}

		$this->assignRef ( 'state', $this->get ( 'State' ) );
		require_once KPATH_SITE . '/lib/kunena.link.class.php';
		$this->template->initialize();

		if (JFactory::getApplication()->isAdmin()) {
			$this->displayLayout();
		} else {
			$this->document->addHeadLink( KunenaRoute::_(), 'canonical', 'rel', '' );
			include $this->template->getFile ('html/display.php');
		}
	}
Exemplo n.º 29
0
 function displayPosts($tpl = null)
 {
     $this->layout = 'posts';
     $this->params = $this->state->get('params');
     $this->messages = $this->get('Messages');
     $this->topics = $this->get('Topics');
     $this->total = $this->get('Total');
     $this->postActions = $this->get('PostActions');
     $this->actionMove = false;
     $this->message_ordering = $this->me->getMessageOrdering();
     $this->URL = KunenaRoute::_();
     if ($this->embedded) {
         $this->moreUri = 'index.php?option=com_kunena&view=topics&layout=posts&mode=' . $this->state->get('list.mode');
         $userid = $this->state->get('user');
         if ($userid) {
             $this->moreUri .= "&userid={$userid}";
         }
     }
     $this->_prepareDocument('posts');
     $this->render('Message/List', $tpl);
 }
Exemplo n.º 30
0
	function doprune() {
		$app = JFactory::getApplication ();
		if (!JRequest::checkToken()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->setRedirect(KunenaRoute::_($this->baseurl, false));
			return;
		}
		$category = KunenaForumCategoryHelper::get(JRequest::getInt ( 'prune_forum', 0 ));
		if (!$category->authorise('admin')) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CHOOSEFORUMTOPRUNE' ), 'error' );
			$this->setRedirect(KunenaRoute::_($this->baseurl, false));
			return;
		}

		// Convert days to seconds for timestamp functions...
		$prune_days = JRequest::getInt ( 'prune_days', 36500 );
		$prune_date = JFactory::getDate()->toUnix() - ($prune_days * 86400);

		$trashdelete = JRequest::getInt( 'trashdelete', 0);

		// Get up to 100 oldest topics to be deleted
		$params = array(
			'orderby'=>'tt.last_post_time ASC',
			'where'=>"AND tt.last_post_time<{$prune_date} AND ordering=0",
		);
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics($category->id, 0, 100, $params);
		$deleted = 0;
		foreach ( $topics as $topic ) {
			$deleted++;
			if ( $trashdelete ) $topic->delete(false);
			else $topic->trash();
		}
		KunenaUserHelper::recount();
		KunenaForumCategoryHelper::recount();
		KunenaForumMessageAttachmentHelper::cleanup();
		if ( $trashdelete ) $app->enqueueMessage ( "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNEDELETED') . " {$deleted}/{$count} " . JText::_('COM_KUNENA_PRUNETHREADS') );
		else $app->enqueueMessage ( "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNETRASHED') . " {$deleted}/{$count} " . JText::_('COM_KUNENA_PRUNETHREADS') );
		$this->setRedirect(KunenaRoute::_($this->baseurl, false));
	}