Example #1
0
 /**
  * Prepare report message form.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $id = $this->input->getInt('id');
     $mesid = $this->input->getInt('mesid');
     $me = KunenaUserHelper::getMyself();
     if (!$this->config->reportmsg) {
         // Deny access if report feature has been disabled.
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     if (!$me->exists()) {
         // Deny access if user is guest.
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401);
     }
     if (!$mesid) {
         $this->topic = KunenaForumTopicHelper::get($id);
         $this->topic->tryAuthorise();
     } else {
         $this->message = KunenaForumMessageHelper::get($mesid);
         $this->message->tryAuthorise();
         $this->topic = $this->message->getTopic();
     }
     $this->category = $this->topic->getCategory();
     $this->uri = "index.php?option=com_kunena&view=topic&layout=report&catid={$this->category->id}" . "&id={$this->topic->id}" . ($this->message ? "&mesid={$this->message->id}" : '');
 }
Example #2
0
	function __construct($config = array()){
		parent::__construct($config);
		$this->profiler = KunenaProfiler::instance('Kunena');
		$this->me = KunenaUserHelper::getMyself();
		$this->config = KunenaFactory::getConfig();
		$this->template = KunenaFactory::getTemplate();
	}
Example #3
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
 }
Example #4
0
	/**
	 * Prepare announcement list display.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		$limit = $this->input->getInt('limit', 0);

		if ($limit < 1 || $limit > 100)
		{
			$limit = 20;
		}

		$limitstart = $this->input->getInt('limitstart', 0);

		if ($limitstart < 0)
		{
			$limitstart = 0;
		}

		$moderator = KunenaUserHelper::getMyself()->isModerator();
		$this->pagination = new KunenaPagination(KunenaForumAnnouncementHelper::getCount(!$moderator), $limitstart, $limit);
		$this->announcements = KunenaForumAnnouncementHelper::getAnnouncements(
			$this->pagination->limitstart,
			$this->pagination->limit,
			!$moderator
		);
	}
Example #5
0
	/**
	 * Prepare user attachments list.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		$userid = $this->input->getInt('userid');
		$params = array('file' => '1', 'image' => '1', 'orderby' => 'desc', 'limit' => '30');

		$this->template = KunenaFactory::getTemplate();
		$this->me = KunenaUserHelper::getMyself();
		$this->profile = KunenaUserHelper::get($userid);
		$this->attachments = KunenaAttachmentHelper::getByUserid($this->profile, $params);

		// Pre-load messages.
		$messageIds = array();

		foreach ($this->attachments as $attachment)
		{
			$messageIds[] = (int) $attachment->mesid;
		}

		$messages = KunenaForumMessageHelper::getMessages($messageIds, 'none');

		// Pre-load topics.
		$topicIds = array();

		foreach ($messages as $message)
		{
			$topicIds[] = $message->thread;
		}

		KunenaForumTopicHelper::getTopics($topicIds, 'none');

		$this->headerText = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS');
	}
Example #6
0
 public function __construct($config = array())
 {
     $name = isset($config['name']) ? $config['name'] : $this->getName();
     $this->document = JFactory::getDocument();
     $this->document->setBase('');
     $this->profiler = KunenaProfiler::instance('Kunena');
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
     $this->ktemplate = KunenaFactory::getTemplate();
     // Set the default template search path
     if ($this->app->isSite() && !isset($config['template_path'])) {
         $config['template_path'] = $this->ktemplate->getTemplatePaths("html/{$name}", true);
     }
     if ($this->app->isAdmin()) {
         $templateAdmin = KunenaFactory::getAdminTemplate();
         $templateAdmin->initialize();
         $config['template_path'] = $templateAdmin->getTemplatePaths($name);
     }
     parent::__construct($config);
     if ($this->app->isSite()) {
         // Add another template file lookup path specific to the current template
         $fallback = JPATH_THEMES . "/{$this->app->getTemplate()}/html/com_kunena/{$this->ktemplate->name}/{$this->getName()}";
         $this->addTemplatePath($fallback);
     }
     // Use our own browser side cache settings.
     JResponse::allowCache(false);
     JResponse::setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true);
     JResponse::setHeader('Last-Modified', gmdate("D, d M Y H:i:s") . ' GMT', true);
     JResponse::setHeader('Cache-Control', 'no-store, must-revalidate, post-check=0, pre-check=0', true);
 }
Example #7
0
	/**
	 * Change topic layout to threaded.
	 *
	 * @return void
	 */
	protected function before()
	{
		$layout = $this->input->getWord('layout');
		KunenaUserHelper::getMyself()->setTopicLayout($layout);

		parent::before();
	}
Example #8
0
 /**
  * Prepare login display.
  *
  * @return boolean
  */
 protected function before()
 {
     parent::before();
     $login = KunenaLogin::getInstance();
     if (!$login->enabled()) {
         return false;
     }
     $this->me = KunenaUserHelper::getMyself();
     $this->name = $this->me->exists() ? 'Widget/Login/Logout' : 'Widget/Login/Login';
     $this->my = JFactory::getUser();
     if ($this->my->guest) {
         $this->registrationUrl = $login->getRegistrationUrl();
         $this->resetPasswordUrl = $login->getResetUrl();
         $this->remindUsernameUrl = $login->getRemindUrl();
         $this->rememberMe = $login->getRememberMe();
     } else {
         $this->lastvisitDate = KunenaDate::getInstance($this->my->lastvisitDate);
         $private = KunenaFactory::getPrivateMessaging();
         if ($private) {
             $count = $private->getUnreadCount($this->me->userid);
             $this->inboxCount = $count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX');
             $this->pm_link = $private->getInboxURL();
         }
         // Display announcements.
         if ($this->me->isModerator()) {
             $this->announcementsUrl = KunenaForumAnnouncementHelper::getUrl('list');
         }
     }
     return true;
 }
Example #9
0
	/**
	 * Prepare search results display.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		require_once KPATH_SITE . '/models/search.php';
		$this->model = new KunenaModelSearch(array(), $this->input);
		$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
		$this->state = $this->model->getState();

		$this->me = KunenaUserHelper::getMyself();
		$this->message_ordering = $this->me->getMessageOrdering();

		$this->searchwords = $this->model->getSearchWords();
		$this->isModerator = ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus());

		$this->results = array();
		$this->total = $this->model->getTotal();
		$this->results = $this->model->getResults();

		$this->pagination = new KunenaPagination(
			$this->total,
			$this->state->get('list.start'),
			$this->state->get('list.limit')
		);

		$this->error = $this->model->getError();
	}
Example #10
0
 /**
  * Prepare message actions display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('id');
     $me = KunenaUserHelper::getMyself();
     $this->category = KunenaForumCategory::getInstance($catid);
     $token = JSession::getFormToken();
     $task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1";
     $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}";
     $this->template = KunenaFactory::getTemplate();
     $this->categoryButtons = new JObject();
     // Is user allowed to post new topic?
     if ($this->category->getNewTopicCategory()->exists()) {
         $this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true));
     }
     // Is user allowed to mark forums as read?
     if ($me->exists()) {
         $this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true));
     }
     // Is user allowed to subscribe category?
     if ($this->category->isAuthorised('subscribe')) {
         $subscribed = $this->category->getSubscribed($me->userid);
         if (!$subscribed) {
             $this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true));
         } else {
             $this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true));
         }
     }
     JPluginHelper::importPlugin('kunena');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this));
 }
Example #11
0
 /**
  * Prepare category display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     require_once KPATH_SITE . '/models/category.php';
     $this->model = new KunenaModelCategory();
     $this->me = KunenaUserHelper::getMyself();
     $catid = $this->input->getInt('catid');
     $limitstart = $this->input->getInt('limitstart', 0);
     $limit = $this->input->getInt('limit', 0);
     if ($limit < 1 || $limit > 100) {
         $limit = $this->config->threads_per_page;
     }
     // TODO:
     $direction = 'DESC';
     $this->category = KunenaForumCategoryHelper::get($catid);
     $this->category->tryAuthorise();
     $this->headerText = JText::_('COM_KUNENA_THREADS_IN_FORUM') . ': ' . $this->category->name;
     $topic_ordering = $this->category->topic_ordering;
     $access = KunenaAccess::getInstance();
     $hold = $access->getAllowedHold($this->me, $catid);
     $moved = 1;
     $params = array('hold' => $hold, 'moved' => $moved);
     switch ($topic_ordering) {
         case 'alpha':
             $params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
             break;
         case 'creation':
             $params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . $direction;
             break;
         case 'lastpost':
         default:
             $params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . $direction;
     }
     list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
     if ($this->total > 0) {
         // Collect user ids for avatar prefetch when integrated.
         $userlist = array();
         $lastpostlist = array();
         foreach ($this->topics as $topic) {
             $userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
             $userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
             $lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
         }
         // Prefetch all users/avatars to avoid user by user queries during template iterations.
         if (!empty($userlist)) {
             KunenaUserHelper::loadUsers($userlist);
         }
         KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
         KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
         $lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
         // Fetch last / new post positions when user can see unapproved or deleted posts.
         if ($lastreadlist || $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) {
             KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
         }
     }
     $this->topicActions = $this->model->getTopicActions();
     $this->actionMove = $this->model->getActionMove();
     $this->pagination = new KunenaPagination($this->total, $limitstart, $limit);
     $this->pagination->setDisplayedPages(5);
 }
Example #12
0
 function displayDefault()
 {
     $this->categories = $this->get('AdminCategories');
     $this->pagination = $this->get('AdminNavigation');
     // Preprocess the list of items to find ordering divisions.
     $this->ordering = array();
     foreach ($this->categories as &$item) {
         $this->ordering[$item->parent_id][] = $item->id;
     }
     $this->setToolBarDefault();
     $this->sortFields = $this->getSortFields();
     $this->sortDirectionFields = $this->getSortDirectionFields();
     $this->user = JFactory::getUser();
     $this->me = KunenaUserHelper::getMyself();
     $this->userId = $this->user->get('id');
     $this->filterSearch = $this->escape($this->state->get('filter.search'));
     $this->filterPublished = $this->escape($this->state->get('filter.published'));
     $this->filterTitle = $this->escape($this->state->get('filter.title'));
     $this->filterType = $this->escape($this->state->get('filter.type'));
     $this->filterAccess = $this->escape($this->state->get('filter.access'));
     $this->filterLocked = $this->escape($this->state->get('filter.locked'));
     $this->filterReview = $this->escape($this->state->get('filter.review'));
     $this->filterAllow_polls = $this->escape($this->state->get('filter.allow_polls'));
     $this->filterAnonymous = $this->escape($this->state->get('filter.anonymous'));
     $this->filterActive = $this->escape($this->state->get('filter.active'));
     $this->listOrdering = $this->escape($this->state->get('list.ordering'));
     $this->listDirection = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = $this->listOrdering == 'a.ordering' && $this->listDirection == 'asc';
     $this->saveOrderingUrl = 'index.php?option=com_kunena&view=categories&task=saveorderajax&tmpl=component';
     $this->display();
 }
Example #13
0
 /**
  * Load user list.
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $config = KunenaConfig::getInstance();
     if ($config->userlist_allowed && JFactory::getUser()->guest) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
     }
     require_once KPATH_SITE . '/models/user.php';
     $this->model = new KunenaModelUser(array(), $this->input);
     $this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
     $this->state = $this->model->getState();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaConfig::getInstance();
     $start = $this->state->get('list.start');
     $limit = $this->state->get('list.limit');
     // Get list of super admins to exclude or not in filter by configuration.
     $filter = JAccess::getUsersByGroup(8);
     $finder = new KunenaUserFinder();
     $finder->filterByConfiguration($filter)->filterByName($this->state->get('list.search'));
     $this->total = $finder->count();
     $this->pagination = new KunenaPagination($this->total, $start, $limit);
     $alias = 'ku';
     $aliasList = array('id', 'name', 'username', 'email', 'block', 'registerDate', 'lastvisitDate');
     if (in_array($this->state->get('list.ordering'), $aliasList)) {
         $alias = 'a';
     }
     $this->users = $finder->order($this->state->get('list.ordering'), $this->state->get('list.direction') == 'asc' ? 1 : -1, $alias)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find();
 }
Example #14
0
	/**
	 * Load user profile.
	 *
	 * @return void
	 *
	 * @throws KunenaExceptionAuthorise
	 */
	protected function before()
	{
		parent::before();

		// If profile integration is disabled, this view doesn't exist.
		$integration = KunenaFactory::getProfile();

		if (get_class($integration) == 'KunenaProfileNone')
		{
			throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
		}

		$userid = $this->input->getInt('userid');

		require_once KPATH_SITE . '/models/user.php';
		$this->model = new KunenaModelUser(array(), $this->input);
		$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
		$this->state = $this->model->getState();

		$this->me = KunenaUserHelper::getMyself();
		$this->user = JFactory::getUser($userid);
		$this->profile = KunenaUserHelper::get($userid);
		$this->profile->tryAuthorise('read');

		// Update profile hits.
		if (!$this->profile->exists() || !$this->profile->isMyself())
		{
			$this->profile->uhits++;
			$this->profile->save();
		}

		$this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
	}
Example #15
0
 public function isMyself()
 {
     static $result = null;
     if ($result === null) {
         $result = KunenaUserHelper::getMyself()->userid == $this->userid;
     }
     return $result;
 }
	/**
	 * @access public
	 * @return void
	 */
	public function __construct() {
		$this->_db		= JFactory::getDBO ();
		$this->_my		= JFactory::getUser ();
		$this->_me		= KunenaUserHelper::getMyself ();
		$this->_config	= KunenaFactory::getConfig ();

		$this->_ResetErrorMessage ();
	}
Example #17
0
 public function __construct()
 {
     parent::__construct();
     $this->profiler = KunenaProfiler::instance('Kunena');
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
 }
Example #18
0
 /**
  * Constructor.
  *
  * @param	array	$config	An optional associative array of configuration settings.
  * @see		JController
  */
 public function __construct($config = array())
 {
     if (empty($config['filter_fields'])) {
         $config['filter_fields'] = array('id', 'username', 'name', 'email', 'signature', 'enabled', 'banned', 'moderator');
     }
     $this->me = KunenaUserHelper::getMyself();
     parent::__construct($config);
 }
Example #19
0
 /**
  * @param   array  $config
  * @param   JInput $input
  *
  * @throws Exception
  */
 public function __construct($config = array(), JInput $input = null)
 {
     $this->option = 'com_kunena';
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
     $this->input = $input ? $input : $this->app->input;
 }
Example #20
0
 /**
  * Prepare topic reply form.
  *
  * @return void
  *
  * @throws RuntimeException
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('catid');
     $id = $this->input->getInt('id');
     $mesid = $this->input->getInt('mesid');
     $quote = $this->input->getBool('quote', false);
     $saved = $this->app->getUserState('com_kunena.postfields');
     $this->me = KunenaUserHelper::getMyself();
     $this->template = KunenaFactory::getTemplate();
     if (!$mesid) {
         $this->topic = KunenaForumTopicHelper::get($id);
         $parent = KunenaForumMessageHelper::get($this->topic->first_post_id);
     } else {
         $parent = KunenaForumMessageHelper::get($mesid);
         $this->topic = $parent->getTopic();
     }
     $this->category = $this->topic->getCategory();
     if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) {
         if (JPluginHelper::isEnabled('captcha')) {
             $plugin = JPluginHelper::getPlugin('captcha');
             $params = new JRegistry($plugin[0]->params);
             $captcha_pubkey = $params->get('public_key');
             $catcha_privkey = $params->get('private_key');
             if (!empty($captcha_pubkey) && !empty($catcha_privkey)) {
                 JPluginHelper::importPlugin('captcha');
                 $dispatcher = JDispatcher::getInstance();
                 $result = $dispatcher->trigger('onInit', 'dynamic_recaptcha_1');
                 $this->captchaEnabled = $result[0];
             }
         } else {
             $this->captchaEnabled = false;
         }
     }
     $parent->tryAuthorise('reply');
     // Run event.
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'reply');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0));
     // Can user edit topic icons?
     if ($this->config->topicicons && $this->topic->isAuthorised('edit')) {
         $this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id);
     }
     list($this->topic, $this->message) = $parent->newReply($saved ? $saved : $quote);
     $this->action = 'post';
     $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category);
     $this->post_anonymous = $saved ? $saved['anonymous'] : !empty($this->category->post_anonymous);
     $this->subscriptionschecked = $saved ? $saved['subscribe'] : $this->config->subscriptionschecked == 1;
     $this->app->setUserState('com_kunena.postfields', null);
     $this->canSubscribe = $this->canSubscribe();
     $this->headerText = JText::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ' ' . $this->topic->subject;
 }
Example #21
0
 /**
  * Prepare ban history.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $userid = $this->input->getInt('userid');
     $this->me = KunenaUserHelper::getMyself();
     $this->profile = KunenaUserHelper::get($userid);
     $this->profile->tryAuthorise('ban');
     $this->banHistory = KunenaUserBan::getUserHistory($this->profile->userid);
     $this->headerText = JText::sprintf('COM_KUNENA_BAN_BANHISTORYFOR', $this->profile->getName());
 }
	protected function __construct($db, $config) {
		$this->_db = $db;
		$this->_my = &JFactory::getUser ();
		$this->_me = KunenaUserHelper::getMyself();
		$this->_session = KunenaFactory::getSession ();
		// FIXME:
		$this->_allowed = array();
		$this->_ResetErrorMessage ();
		$this->_config = $config;
	}
Example #23
0
 /**
  * Prepare search form display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     require_once KPATH_SITE . '/models/search.php';
     $this->model = new KunenaModelSearch(array(), $this->input);
     $this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
     $this->state = $this->model->getState();
     $this->me = KunenaUserHelper::getMyself();
     $this->isModerator = $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus();
     $this->error = $this->model->getError();
 }
Example #24
0
	function getCanEdit() {
		$me = KunenaUserHelper::getMyself();

		// User needs to be global moderator to edit announcements
		if ($me->exists() && $me->isModerator('global')) {
			$this->canEdit = true;
		} else {
			$this->canEdit = false;
		}
		return $this->canEdit;
	}
Example #25
0
	protected function populateState() {
		$app = JFactory::getApplication ();
		$this->me = KunenaUserHelper::getMyself();
		$config = KunenaFactory::getConfig ();
		$active = $app->getMenu ()->getActive ();
		$active = $active ? (int) $active->id : 0;

		$layout = $this->getWord ( 'layout', 'default' );
		$layout = $this->me->getTopicLayout ();
		$this->setState ( 'layout', $layout );

		$template = KunenaFactory::getTemplate();
		$profile_location = $template->params->get('avatarPosition', 'left');
		$profile_direction = $profile_location == 'left' || $profile_location == 'right' ? 'vertical' : 'horizontal';
		$this->setState ( 'profile.location', $profile_location );
		$this->setState ( 'profile.direction', $profile_direction );

		$catid = $this->getInt ( 'catid', 0 );
		$this->setState ( 'item.catid', $catid );

		$id = $this->getInt ( 'id', 0 );
		$this->setState ( 'item.id', $id );

		$id = $this->getInt ( 'mesid', 0 );
		$this->setState ( 'item.mesid', $id );

		$access = KunenaFactory::getAccessControl();
		$value = $access->getAllowedHold($this->me, $catid);
		$this->setState ( 'hold', $value );

		$value = $this->getInt ( 'limit', 0 );
		if ($value < 1) $value = $config->messages_per_page;
		$this->setState ( 'list.limit', $value );

		$value = $this->getUserStateFromRequest ( "com_kunena.topic_{$active}_{$layout}_list_ordering", 'filter_order', 'time', 'cmd' );
		//$this->setState ( 'list.ordering', $value );

		$value = $this->getInt ( 'limitstart', 0 );
		if ($value < 0) $value = 0;
		$this->setState ( 'list.start', $value );

		$value = $this->getUserStateFromRequest ( "com_kunena.topic_{$active}_{$layout}_list_direction", 'filter_order_Dir', '', 'word' );
		if (!$value) {
			if ($this->me->ordering != '0') {
				$value = $this->me->ordering == '1' ? 'desc' : 'asc';
			} else {
				$value = $config->default_sort == 'asc' ? 'asc' : 'desc';
			}
		}
		if ($value != 'asc')
			$value = 'desc';
		$this->setState ( 'list.direction', $value );
	}
Example #26
0
 /**
  * Prepare ban manager.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $this->me = KunenaUserHelper::getMyself();
     // TODO: add authorisation
     // TODO: add pagination
     $this->userBans = KunenaUserBan::getBannedUsers(0, 50);
     if (!empty($this->userBans)) {
         KunenaUserHelper::loadUsers(array_keys($this->userBans));
     }
     $this->headerText = JText::_('COM_KUNENA_BAN_BANMANAGER');
 }
Example #27
0
	public function enabled() {
		$me = KunenaUserHelper::getMyself();
		$config = KunenaFactory::getConfig();
		// Enabled if guest captcha is enabled and user is not logged in
		if ($config->captcha && !$me->exists())
			return true;
		// Enabled if user is moderator or has more posts than the threshold
		if ($me->exists() && !$me->isModerator() && $me->posts < $config->captcha_post_limit)
			return true;
		// Captcha is disabled
		return false;
	}
Example #28
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->profiler = KunenaProfiler::instance('Kunena');
     $this->app = JFactory::getApplication();
     $this->config = KunenaFactory::getConfig();
     $this->me = KunenaUserHelper::getMyself();
     // Save user profile if it didn't exist.
     if ($this->me->userid && !$this->me->exists()) {
         $this->me->save();
     }
 }
Example #29
0
 /**
  * Prepare AJAX display.
  *
  * @return void
  */
 protected function before()
 {
     // Load language files.
     KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
     KunenaFactory::loadLanguage('com_kunena.templates');
     KunenaFactory::loadLanguage('com_kunena.models');
     KunenaFactory::loadLanguage('com_kunena.views');
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaConfig::getInstance();
     $this->document = JFactory::getDocument();
     $this->template = KunenaFactory::getTemplate();
     $this->template->initialize();
 }
 function __construct($catid = null)
 {
     $this->_db = JFactory::getDBO();
     $this->_my = JFactory::getUser();
     $this->_session = KunenaFactory::getSession();
     $this->_config = KunenaFactory::getConfig();
     $this->_isimage = false;
     $this->_isfile = false;
     $me = KunenaUserHelper::getMyself();
     $this->validImageExts = (array) KunenaForumMessageAttachmentHelper::getImageExtensions($catid, $me->userid);
     $this->validFileExts = (array) KunenaForumMessageAttachmentHelper::getFileExtensions($catid, $me->userid);
     $this->setImageResize(intval($this->_config->imagesize) * 1024, intval($this->_config->imagewidth), intval($this->_config->imageheight), intval($this->_config->imagequality));
 }