/** * 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(); }
function displayDefault($tpl = null) { $this->message_ordering = $this->me->getMessageOrdering(); //TODO: Need to move the select markup outside of view. Otherwise difficult to stylize $this->searchwords = $this->get('SearchWords'); $this->isModerator = ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus($this->me)); $this->results = array(); $this->total = $this->get('Total'); if ($this->total) { $this->results = $this->get('Results'); $this->search_class = ' open'; $this->search_style = ' style="display: none;"'; $this->search_title = JText::_('COM_KUNENA_TOGGLER_EXPAND'); } else { $this->search_class = ' close'; $this->search_style = ''; $this->search_title = JText::_('COM_KUNENA_TOGGLER_COLLAPSE'); } $this->selected = ' selected="selected"'; $this->checked = ' checked="checked"'; $this->error = $this->get('Error'); $this->_prepareDocument(); $this->render('Search', $tpl); }
/** * Prepare topics by pre-loading needed information. * * @param array $userIds List of additional user Ids to be loaded. * @param array $mesIds List of additional message Ids to be loaded. * * @return void */ protected function prepareTopics(array $userIds = array(), array $mesIds = array()) { // Collect user Ids for avatar prefetch when integrated. $lastIds = array(); foreach ($this->topics as $topic) { $userIds[(int) $topic->first_post_userid] = (int) $topic->first_post_userid; $userIds[(int) $topic->last_post_userid] = (int) $topic->last_post_userid; $lastIds[(int) $topic->last_post_id] = (int) $topic->last_post_id; } // Prefetch all users/avatars to avoid user by user queries during template iterations. if (!empty($userIds)) { KunenaUserHelper::loadUsers($userIds); } $topicIds = array_keys($this->topics); KunenaForumTopicHelper::getUserTopics($topicIds); /* KunenaForumTopicHelper::getKeywords($topicIds); */ $mesIds += KunenaForumTopicHelper::fetchNewStatus($this->topics); // Fetch also last post positions when user can see unapproved or deleted posts. // TODO: Optimize? Take account of configuration option... if ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) { $mesIds += $lastIds; } // Load position information for all selected messages. if ($mesIds) { KunenaForumMessageHelper::loadLocation($mesIds); } }
public function onAfterReply($message) { if (JString::strlen($message->message) > $this->params->get('activity_points_limit', 0)) { CFactory::load('libraries', 'userpoints'); CUserPoints::assignPoint('com_kunena.thread.reply'); } // Get users who have subscribed to the topic, excluding current user. $acl = KunenaAccess::getInstance(); $subscribers = $acl->getSubscribers($message->catid, $message->thread, KunenaAccess::TOPIC_SUBSCRIPTION, false, false, array($message->userid)); foreach ($subscribers as $userid) { $actor = CFactory::getUser($message->userid); $target = CFactory::getUser($userid); $params = new CParameter(''); $params->set('actorName', $actor->getDisplayName()); $params->set('recipientName', $target->getDisplayName()); $params->set('url', JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $message->getPermaUrl(null)); // {url} tag for activity. Used when hovering over avatar in notification window, as well as in email notification $params->set('title', $message->displayField('subject')); // (title) tag in language file $params->set('title_url', $message->getPermaUrl()); // Make the title in notification - linkable $params->set('message', $message->displayField('message')); // (message) tag in language file $params->set('actor', $actor->getDisplayName()); // Actor in the stream $params->set('actor_url', 'index.php?option=com_community&view=profile&userid=' . $actor->id); // Actor Link // Finally, send notifications CNotificationLibrary::add('kunena_reply', $actor->id, $target->id, JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE_ACT'), JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TEXT'), '', $params); } /* Activity stream */ $act = new stdClass(); $act->cmd = 'wall.write'; $act->actor = $message->userid; $act->target = 0; // no target $act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_REPLY_TITLE', '<a href="' . $message->getTopic()->getUrl() . '">' . $message->subject . '</a>')); $act->content = $this->buildContent($message); $act->app = 'kunena.thread.reply'; $act->cid = $message->thread; $act->access = $this->getAccess($message->getCategory()); // Comments and like support $act->comment_id = $message->thread; $act->comment_type = 'kunena.thread.reply'; $act->like_id = $message->thread; $act->like_type = 'kunena.thread.reply'; // Do not add private activities if ($act->access > 20) { return; } CFactory::load('libraries', 'activities'); $table = CActivityStream::add($act); if (is_object($table)) { $table->like_id = $table->id; $table->store(); } }
public function __construct() { $this->integration = KunenaIntegration::getInstance('communitybuilder'); if (!$this->integration || !$this->integration->isLoaded()) { return; } $this->joomlaAccess = KunenaAccess::getInstance('joomla'); $this->priority = 50; }
/** * 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(); }
function displaySubscriptions() { $id = $this->app->input->get('id', 0, 'int'); $topic = KunenaForumTopicHelper::get($id); $acl = KunenaAccess::getInstance(); $cat_subscribers = $acl->loadSubscribers($topic, KunenaAccess::CATEGORY_SUBSCRIPTION); $this->cat_subscribers_users = KunenaUserHelper::loadUsers($cat_subscribers); $topic_subscribers = $acl->loadSubscribers($topic, KunenaAccess::TOPIC_SUBSCRIPTION); $this->topic_subscribers_users = KunenaUserHelper::loadUsers($topic_subscribers); $this->cat_topic_subscribers = $acl->getSubscribers($topic->getCategory()->id, $id, KunenaAccess::CATEGORY_SUBSCRIPTION | KunenaAccess::TOPIC_SUBSCRIPTION, 1, 1); $this->display(); }
protected function populateState() { $active = $this->app->getMenu ()->getActive (); $active = $active ? (int) $active->id : 0; $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 = KunenaAccess::getInstance(); $value = $access->getAllowedHold($this->me, $catid); $this->setState ( 'hold', $value ); $value = $this->getInt ( 'limit', 0 ); if ($value < 1 || $value > 100) $value = $this->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 = $this->config->default_sort == 'asc' ? 'asc' : 'desc'; } } if ($value != 'asc') $value = 'desc'; $this->setState ( 'list.direction', $value ); }
function save() { $db = JFactory::getDBO(); if (!JRequest::checkToken()) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->app->redirect(KunenaRoute::_($this->baseurl, false)); } $newview = JRequest::getVar('newview'); $newrank = JRequest::getVar('newrank'); $signature = JRequest::getVar('signature'); $deleteSig = JRequest::getVar('deleteSig'); $moderator = JRequest::getInt('moderator'); $uid = JRequest::getInt('uid'); $avatar = JRequest::getVar('avatar'); $deleteAvatar = JRequest::getVar('deleteAvatar'); $neworder = JRequest::getInt('neworder'); $modCatids = $moderator ? JRequest::getVar('catid', array()) : array(); if ($deleteSig == 1) { $signature = ""; } $avatar = ''; if ($deleteAvatar == 1) { $avatar = ",avatar=''"; } $db->setQuery("UPDATE #__kunena_users SET signature={$db->quote($signature)}, view='{$newview}', ordering='{$neworder}', rank='{$newrank}' {$avatar} WHERE userid='{$uid}'"); $db->query(); if (KunenaError::checkDatabaseError()) { return; } $this->app->enqueueMessage(JText::_('COM_KUNENA_USER_PROFILE_SAVED_SUCCESSFULLY')); // Update moderator rights $categories = KunenaForumCategoryHelper::getCategories(false, false, 'admin'); $user = KunenaFactory::getUser($uid); foreach ($categories as $category) { $category->setModerator($user, in_array($category->id, $modCatids)); } // Global moderator is a special case if ($this->me->isAdmin()) { KunenaAccess::getInstance()->setModerator(0, $user, in_array(0, $modCatids)); } $this->app->redirect(KunenaRoute::_($this->baseurl, false)); }
function displayForumJump($tpl = null) { if ($this->offline) { return; } $allowed = md5(serialize(KunenaAccess::getInstance()->getAllowedCategories())); $cache = JFactory::getCache('com_kunena', 'output'); if ($cache->start("{$this->ktemplate->name}.common.jump.{$allowed}", 'com_kunena.template')) { return; } $options = array(); $options[] = JHtml::_('select.option', '0', JText::_('COM_KUNENA_FORUM_TOP')); $cat_params = array('sections' => 1, 'catid' => 0); $this->categorylist = JHtml::_('kunenaforum.categorylist', 'catid', 0, $options, $cat_params, 'class="inputbox fbs" size="1" onchange = "this.form.submit()"', 'value', 'text', $this->catid); $result = $this->loadTemplateFile($tpl); if (JError::isError($result)) { return $result; } echo $result; $cache->end(); }
/** * Prepare topic list for moderators. * * @return void */ protected function before() { parent::before(); $this->me = KunenaUserHelper::getMyself(); $access = KunenaAccess::getInstance(); $this->moreUri = null; $params = $this->app->getParams('com_kunena'); $start = $this->input->getInt('limitstart', 0); $limit = $this->input->getInt('limit', 0); if ($limit < 1 || $limit > 100) { $limit = $this->config->threads_per_page; } // Get configuration from menu item. $categoryIds = $params->get('topics_categories', array()); $reverse = !$params->get('topics_catselection', 1); // Make sure that category list is an array. if (!is_array($categoryIds)) { $categoryIds = explode(',', $categoryIds); } if (!$reverse && empty($categoryIds) || in_array(0, $categoryIds)) { $categoryIds = false; } $categories = KunenaForumCategoryHelper::getCategories($categoryIds, $reverse); $finder = new KunenaForumTopicFinder(); $finder->filterByCategories($categories)->filterAnsweredBy(array_keys($access->getModerators() + $access->getAdmins()), true)->filterByMoved(false)->where('locked', '=', 0); $this->pagination = new KunenaPagination($finder->count(), $start, $limit); if ($this->moreUri) { $this->pagination->setUri($this->moreUri); } $this->topics = $finder->order('last_post_time', -1)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find(); if ($this->topics) { $this->prepareTopics(); } $actions = array('delete', 'approve', 'undelete', 'move', 'permdelete'); $this->actions = $this->getTopicActions($this->topics, $actions); // TODO <- $this->headerText = JText::_('Topics Needing Attention'); }
/** * @param bool|array $ids * @param bool $reverse * @param string $authorise * * @return array|KunenaForumCategory[] */ public static function getCategories($ids = false, $reverse = false, $authorise = 'read') { KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null; if ($ids === false) { if ($authorise == 'none') { KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null; return self::$_instances; } $ids = self::$_instances; } elseif (is_array($ids)) { $ids = array_flip($ids); } else { $ids = array(intval($ids) => 1); } if (!$reverse) { $allowed = $authorise != 'none' ? array_intersect_key($ids, KunenaAccess::getInstance()->getAllowedCategories()) : $ids; $list = array_intersect_key(self::$_instances, $allowed); if ($authorise != 'none' && $authorise != 'read') { foreach ($list as $category) { // @var KunenaForumCategory $category if (!$category->authorise($authorise, null, true)) { unset($list[$category->id]); } } } } else { $allowed = $authorise != 'none' ? array_intersect_key(self::$_instances, KunenaAccess::getInstance()->getAllowedCategories()) : self::$_instances; $list = array_diff_key($allowed, $ids); if ($authorise != 'none' && $authorise != 'read') { foreach ($list as $category) { // @var KunenaForumCategory $category if (!$category->authorise($authorise, null, true)) { unset($list[$category->id]); } } } } KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null; return $list; }
/** * @param KunenaUser $user * * @return KunenaExceptionAuthorise|null */ protected function authoriseRead(KunenaUser $user) { static $catids = false; if ($catids === false) { $catids = KunenaAccess::getInstance()->getAllowedCategories($user); } // Checks if user can read category if (!$this->exists()) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404); } if (empty($catids[$this->id])) { if ($user->exists()) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 403); } else { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401); } } return null; }
/** * @param int $mesid * @param null|string $direction * @param null|array $hold * * @return int */ public static function getLocation($mesid, $direction = null, $hold = null) { if (is_null($direction)) { $direction = KunenaUserHelper::getMyself()->getMessageOrdering(); } if (!$hold) { $me = KunenaUserHelper::getMyself(); $mes_instance = KunenaForumMessageHelper::get($mesid); $hold = KunenaAccess::getInstance()->getAllowedHold($me->userid, $mes_instance->catid, false); } if (!isset(self::$_location[$mesid])) { self::loadLocation(array($mesid)); } $location = self::$_location[$mesid]; $count = 0; foreach ($location->hold as $meshold => $values) { if (isset($hold[$meshold])) { $count += $values[$direction == 'asc' ? 'before' : 'after']; if ($direction == 'both') { $count += $values['before']; } } } return $count; }
/** * @param KunenaUser $user * * @return KunenaExceptionAuthorise|null */ protected function authoriseRead(KunenaUser $user) { // Check that user can read topic if (!$this->exists()) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404); } // TODO: Allow owner to see his posts. if ($this->hold) { if (!$user->exists()) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401); } $access = KunenaAccess::getInstance(); $hold = $access->getAllowedHold($user->userid, $this->category_id, false); if (!in_array($this->hold, $hold)) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 403); } } return null; }
public function batch_moderators() { if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->app->redirect(KunenaRoute::_($this->baseurl, false)); } $cid = JRequest::getVar('cid', array(), 'post', 'array'); // Array of integers JArrayHelper::toInteger($cid); $catids = JRequest::getVar('catid', array(), 'post', 'array'); // Array of integers JArrayHelper::toInteger($catids); if (empty($cid)) { $this->app->enqueueMessage(JText::_('COM_KUNENA_USERS_BATCH_NO_USERS_SELECTED'), 'error'); $this->app->redirect(KunenaRoute::_($this->baseurl, false)); } if (empty($catids)) { $this->app->enqueueMessage(JText::_('COM_KUNENA_USERS_BATCH_NO_CATEGORIES_SELECTED'), 'error'); $this->app->redirect(KunenaRoute::_($this->baseurl, false)); } // Update moderator rights $categories = KunenaForumCategoryHelper::getCategories(false, false, 'admin'); $users = KunenaUserHelper::loadUsers($cid); foreach ($users as $user) { foreach ($categories as $category) { if (in_array($category->id, $catids)) { $category->setModerator($user, true); } } // Global moderator is a special case if ($this->me->isAdmin() && in_array(0, $catids)) { KunenaAccess::getInstance()->setModerator(0, $user, true); } } $this->app->enqueueMessage(JText::_('COM_KUNENA_USERS_SET_MODERATORS_DONE')); $this->app->redirect(KunenaRoute::_($this->baseurl, false)); }
public function getTopics() { if ($this->topics === false) { $catid = $this->getState('item.id'); $limitstart = $this->getState('list.start'); $limit = $this->getState('list.limit'); $format = $this->getState('format'); $topic_ordering = $this->getCategory()->topic_ordering; $access = KunenaAccess::getInstance(); $hold = $format == 'feed' ? 0 : $access->getAllowedHold($this->me, $catid); $moved = $format == 'feed' ? 0 : 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 ' . strtoupper($this->getState('list.direction')); break; case 'lastpost': default: $params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . strtoupper($this->getState('list.direction')); } if ($format == 'feed') { $catid = array_keys(KunenaForumCategoryHelper::getChildren($catid, 100) + array($catid => 1)); } 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 (($lastpostlist || $lastreadlist) && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) { KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist); } } } return $this->topics; }
/** * Method to get tabs for user profile * * @return array */ public function getTabs() { $banInfo = KunenaUserBan::getInstanceByUserid($this->user->id, true); $myProfile = $this->profile->isMyself(); $moderator = $this->me->isModerator(); // Decide which tabs to display. $showPosts = true; $showSubscriptions = $this->config->allowsubscriptions && $myProfile; $showFavorites = $this->config->allowfavorites && $myProfile; $showThankYou = $this->config->showthankyou && $this->me->exists(); $showUnapproved = $myProfile && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()); $showAttachments = $this->config->show_imgfiles_manage_profile && ($moderator || $myProfile); $showBanManager = $moderator && $myProfile; $showBanHistory = $banInfo->canBan(); $showBanUser = $banInfo->canBan(); // Define all tabs. $tabs = array(); if ($showPosts) { $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'latest', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc', 'display' => $this->state->get('display', '')); $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_USERPOSTS'); $tab->content = $this->subRequest('Message/List/Recent', new JInput($params), $params); $tab->active = true; $tabs['posts'] = $tab; } if ($showSubscriptions) { $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_SUBSCRIPTIONS'); $tab->content = ''; if ($this->config->category_subscriptions != 'disabled') { $params = array('embedded' => 1, 'userid' => $this->profile->userid, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc'); $tab->content .= $this->subRequest('Category/Subscriptions', new JInput($params), $params); } if ($this->config->topic_subscriptions != 'disabled') { $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'subscriptions', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc'); $tab->content .= $this->subRequest('Topic/List/User', new JInput($params), $params); } $tab->active = false; if ($tab->content) { $tabs['subscriptions'] = $tab; } } if ($showFavorites) { $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'favorites', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc'); $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_FAVORITES'); $tab->content = $this->subRequest('Topic/List/User', new JInput($params), $params); $tab->active = false; $tabs['favorites'] = $tab; } if ($showThankYou) { $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_THANK_YOU'); $tab->content = ''; $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'mythanks', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc'); $tab->content .= $this->subRequest('Message/List/Recent', new JInput($params), $params); $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'thankyou', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc'); $tab->content .= $this->subRequest('Message/List/Recent', new JInput($params), $params); $tab->active = false; $tabs['thankyou'] = $tab; } if ($showUnapproved) { $params = array('embedded' => 1, 'topics_categories' => 0, 'topics_catselection' => 1, 'userid' => $this->profile->userid, 'mode' => 'unapproved', 'sel' => -1, 'limit' => 10, 'filter_order' => 'time', 'limitstart' => 0, 'filter_order_Dir' => 'desc'); $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_MESSAGE_ADMINISTRATION'); $tab->content = $this->subRequest('Message/List/Recent', new JInput($params), $params); $tab->active = false; $tabs['unapproved'] = $tab; } if ($showAttachments) { $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS'); $tab->content = $this->subRequest('User/Attachments'); $tab->active = false; $tabs['attachments'] = $tab; } if ($showBanManager) { $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_BAN_BANMANAGER'); $tab->content = $this->subRequest('User/Ban/Manager'); $tab->active = false; $tabs['banmanager'] = $tab; } if ($showBanHistory) { $tab = new stdClass(); $tab->title = JText::_('COM_KUNENA_BAN_BANHISTORY'); $tab->content = $this->subRequest('User/Ban/History'); $tab->active = false; $tabs['banhistory'] = $tab; } if ($showBanUser) { $tab = new stdClass(); $tab->title = $banInfo->exists() ? JText::_('COM_KUNENA_BAN_EDIT') : JText::_('COM_KUNENA_BAN_NEW'); $tab->content = $this->subRequest('User/Ban/Form'); $tab->active = false; $tabs['banuser'] = $tab; } return $tabs; }
function report() { if (!JRequest::checkToken()) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->redirectBack(); } if (!$this->me->exists() || $this->config->reportmsg == 0) { // Deny access if report feature has been disabled or user is guest $this->app->enqueueMessage(JText::_('COM_KUNENA_NO_ACCESS'), 'notice'); $this->redirectBack(); } if (!$this->config->get('send_emails')) { // Emails have been disabled $this->app->enqueueMessage(JText::_('COM_KUNENA_EMAIL_DISABLED'), 'notice'); $this->redirectBack(); } jimport('joomla.mail.helper'); if (!$this->config->getEmail() || !JMailHelper::isEmailAddress($this->config->getEmail())) { // Error: email address is invalid $this->app->enqueueMessage(JText::_('COM_KUNENA_EMAIL_INVALID'), 'error'); $this->redirectBack(); } // Get target object for the report if ($this->mesid) { $message = $target = KunenaForumMessageHelper::get($this->mesid); $topic = $target->getTopic(); } else { $topic = $target = KunenaForumTopicHelper::get($this->id); $message = KunenaForumMessageHelper::get($topic->first_post_id); } $messagetext = $message->message; $baduser = KunenaFactory::getUser($message->userid); if (!$target->authorise('read')) { // Deny access if user cannot read target $this->app->enqueueMessage($target->getError(), 'notice'); $this->redirectBack(); } $category = $topic->getCategory(); $reason = JRequest::getString('reason'); $text = JRequest::getString('text'); if (empty($reason) && empty($text)) { // Do nothing: empty subject or reason is empty $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_FORG0T_SUB_MES')); $this->redirectBack(); } else { $acl = KunenaAccess::getInstance(); $emailToList = $acl->getSubscribers($topic->category_id, $topic->id, false, true, false, $this->me->userid); if (!empty($emailToList)) { $mailsender = JMailHelper::cleanAddress($this->config->board_title . ' ' . JText::_('COM_KUNENA_FORUM') . ': ' . $this->me->getName()); $mailsubject = "[" . $this->config->board_title . " " . JText::_('COM_KUNENA_FORUM') . "] " . JText::_('COM_KUNENA_REPORT_MSG') . ": "; if ($reason) { $mailsubject .= $reason; } else { $mailsubject .= $topic->subject; } jimport('joomla.environment.uri'); $uri = JURI::getInstance(JURI::base()); $msglink = $uri->toString(array('scheme', 'host', 'port')) . $target->getPermaUrl(null, false); $mailmessage = "" . JText::_('COM_KUNENA_REPORT_RSENDER') . " {$this->me->username} ({$this->me->name})"; $mailmessage .= "\n"; $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_RREASON') . " " . $reason; $mailmessage .= "\n"; $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_RMESSAGE') . " " . $text; $mailmessage .= "\n\n"; $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_POSTER') . " {$baduser->username} ({$baduser->name})"; $mailmessage .= "\n"; $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_SUBJECT') . ": " . $topic->subject; $mailmessage .= "\n"; $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_MESSAGE') . "\n-----\n" . KunenaHtmlParser::stripBBCode($messagetext, 0, false); $mailmessage .= "\n-----\n\n"; $mailmessage .= "" . JText::_('COM_KUNENA_REPORT_POST_LINK') . " " . $msglink; $mailmessage = JMailHelper::cleanBody(strtr($mailmessage, array(' ' => ''))); foreach ($emailToList as $emailTo) { if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) { continue; } JUtility::sendMail($this->config->getEmail(), $mailsender, $emailTo->email, $mailsubject, $mailmessage); } $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_SUCCESS')); } else { $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_NOT_SEND')); } } $this->app->redirect($target->getUrl($this->return, false)); }
/** * @param KunenaUser $user * * @return KunenaExceptionAuthorise|null */ protected function authoriseRead(KunenaUser $user) { if ($this->hold && !$user->exists()) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401); } // Check that user has the right to see the post (user can see his own unapproved posts) if ($this->hold > 1 || $this->hold == 1 && $this->userid != $user->userid) { $access = KunenaAccess::getInstance(); $hold = $access->getAllowedHold($user->userid, $this->catid, false); if (!in_array($this->hold, $hold)) { return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 403); } } return null; }
/** * Get users type as a string inside the specified category. * * @param int $catid Category id or 0 for global. * @param bool $code True if we want to return the code, otherwise return translation key. * * @return string */ public function getType($catid = 0, $code = false) { static $types = array('admin' => 'COM_KUNENA_VIEW_ADMIN', 'localadmin' => 'COM_KUNENA_VIEW_ADMIN', 'globalmod' => 'COM_KUNENA_VIEW_GLOBAL_MODERATOR', 'moderator' => 'COM_KUNENA_VIEW_MODERATOR', 'user' => 'COM_KUNENA_VIEW_USER', 'guest' => 'COM_KUNENA_VIEW_VISITOR', 'banned' => 'COM_KUNENA_VIEW_BANNED', 'blocked' => 'COM_KUNENA_VIEW_BLOCKED'); $adminCategories = KunenaAccess::getInstance()->getAdminStatus($this); $moderatedCategories = KunenaAccess::getInstance()->getModeratorStatus($this); if ($this->userid == 0) { $type = 'guest'; } elseif ($this->isBlocked()) { $type = 'blocked'; } elseif ($this->isBanned()) { $type = 'banned'; } elseif (!empty($adminCategories[0])) { $type = 'admin'; } elseif (!empty($adminCategories[$catid])) { $type = 'localadmin'; } elseif (!empty($moderatedCategories[0])) { $type = 'globalmod'; } elseif (!empty($moderatedCategories[$catid])) { $type = 'moderator'; } elseif (!$catid && !empty($moderatedCategories)) { $type = 'moderator'; } else { $type = 'user'; } // Deprecated in K4.0 if ($code === 'class') { $userClasses = KunenaFactory::getTemplate()->getUserClasses(); return isset($userClasses[$type]) ? $userClasses[$type] : $userClasses[0] . $type; } return $code ? $type : $types[$type]; }
/** * @param array $userlist * @param array $postlist */ protected function _common(array $userlist = array(), array $postlist = array()) { if ($this->total > 0) { // collect user ids for avatar prefetch when integrated $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 ($postlist || $lastreadlist || $this->me->userid && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) { KunenaForumMessageHelper::loadLocation($postlist + $lastpostlist + $lastreadlist); } } }
/** * @param null $tpl * * @throws Exception */ protected function displayCommon($tpl = null) { $userid = JFactory::getApplication()->input->getInt('userid'); $this->_db = JFactory::getDBO(); $this->do = JFactory::getApplication()->input->getWord('layout'); if (!$userid) { $this->user = JFactory::getUser(); } else { $this->user = JFactory::getUser($userid); } if ($this->user->id == 0 || $this->me->userid == 0 && !$this->config->pubprofile) { $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice'); return; } $integration = KunenaFactory::getProfile(); $activityIntegration = KunenaFactory::getActivityIntegration(); $template = KunenaFactory::getTemplate(); $this->params = $template->params; if (get_class($integration) == 'KunenaProfileNone') { $this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice'); return; } $this->allow = true; $this->profile = KunenaFactory::getUser($this->user->id); if (!$this->profile->exists()) { $this->profile->save(); } if ($this->profile->userid == $this->me->userid) { if ($this->do != 'edit') { $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_EDIT') . ' »', JText::_('COM_KUNENA_EDIT') . ' »', 'nofollow', 'edit', ''); } else { $this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' »', JText::_('COM_KUNENA_BACK') . ' »', 'nofollow', '', ''); } } $this->name = $this->user->username; if ($this->config->showuserstats) { $this->rank_image = $this->profile->getRank(0, 'image'); $this->rank_title = $this->profile->getRank(0, 'title'); $this->posts = $this->profile->posts; $this->thankyou = $this->profile->thankyou; $this->userpoints = $activityIntegration->getUserPoints($this->profile->userid); $this->usermedals = $activityIntegration->getUserMedals($this->profile->userid); } if ($this->config->userlist_joindate || $this->me->isModerator()) { $this->registerdate = $this->user->registerDate; } if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) { $this->lastvisitdate = $this->user->lastvisitDate; } if (!isset($this->lastvisitdate) || $this->lastvisitdate == "0000-00-00 00:00:00") { $this->lastvisitdate = null; } $this->avatarlink = $this->profile->getAvatarImage('kavatar', 'profile'); $this->personalText = $this->profile->personalText; $this->signature = $this->profile->signature; $this->signatureHtml = KunenaHtmlParser::parseBBCode($this->signature, null, $this->config->maxsig); $this->localtime = KunenaDate::getInstance('now', $this->user->getParam('timezone', $this->app->get('offset', null))); try { $offset = new DateTimeZone($this->user->getParam('timezone', $this->app->get('offset', null))); } catch (Exception $e) { $offset = null; } $this->localtime->setTimezone($offset); $this->moderator = KunenaAccess::getInstance()->getModeratorStatus($this->profile); $this->admin = $this->profile->isAdmin(); switch ($this->profile->gender) { case 1: $this->genderclass = 'male'; $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE'); break; case 2: $this->genderclass = 'female'; $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE'); break; default: $this->genderclass = 'unknown'; $this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN'); } if ($this->profile->location) { $this->locationlink = '<a href="http://maps.google.com?q=' . $this->escape($this->profile->location) . '" target="_blank">' . $this->escape($this->profile->location) . '</a>'; } else { $this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN'); } $this->online = $this->profile->isOnline(); $this->showUnusedSocial = true; if (!preg_match("~^(?:f|ht)tps?://~i", $this->profile->websiteurl)) { $this->websiteurl = 'http://' . $this->profile->websiteurl; } else { $this->websiteurl = $this->profile->websiteurl; } $avatar = KunenaFactory::getAvatarIntegration(); $this->editavatar = $avatar instanceof KunenaAvatarKunena ? true : false; $this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true); $this->canBan = $this->banInfo->canBan(); if ($this->config->showbannedreason) { $this->banReason = $this->banInfo->reason_public; } // Which tabs to show? $this->showUserPosts = true; $this->showSubscriptions = $this->config->allowsubscriptions && $this->me->userid == $this->profile->userid; $this->showFavorites = $this->config->allowfavorites && $this->me->userid == $this->profile->userid; $this->showThankyou = $this->config->showthankyou && $this->me->exists(); $this->showUnapprovedPosts = $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus(); // || $this->me->userid == $this->profile->userid; $this->showAttachments = $this->canManageAttachments() && ($this->me->isModerator() || $this->me->userid == $this->profile->userid); $this->showBanManager = $this->me->isModerator() && $this->me->userid == $this->profile->userid; $this->showBanHistory = $this->me->isModerator() && $this->me->userid != $this->profile->userid; $this->showBanUser = $this->canBan; if ($this->me->userid != $this->profile->userid) { $this->profile->uhits++; $this->profile->save(); } $private = KunenaFactory::getPrivateMessaging(); if ($this->me->userid == $this->user->id) { $this->pmCount = $private->getUnreadCount($this->me->userid); $this->pmLink = $private->getInboxLink($this->pmCount ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $this->pmCount) : JText::_('COM_KUNENA_PMS_INBOX')); } else { $this->pmLink = $this->profile->profileIcon('private'); } $this->_prepareDocument('common'); $layout = $this->getLayout() != 'default' ? "User/{$this->getLayout()}" : 'User/Item'; $this->render($layout, $tpl); }
/** * Prepare topic display. * * @return void * * @throws KunenaExceptionAuthorise */ protected function before() { parent::before(); $catid = $this->input->getInt('catid', 0); $id = $this->input->getInt('id', 0); $mesid = $this->input->getInt('mesid', 0); $start = $this->input->getInt('limitstart', 0); $limit = $this->input->getInt('limit', 0); if ($limit < 1 || $limit > 100) { $limit = $this->config->messages_per_page; } $this->me = KunenaUserHelper::getMyself(); // Load topic and message. if ($mesid) { // If message was set, use it to find the current topic. $this->message = KunenaForumMessageHelper::get($mesid); $this->topic = $this->message->getTopic(); } else { // Note that redirect loops throw RuntimeException because of we added KunenaForumTopic::getTopic() call! $this->topic = KunenaForumTopicHelper::get($id)->getTopic(); $this->message = KunenaForumMessageHelper::get($this->topic->first_post_id); } // Load also category (prefer the URI variable if available). if ($catid && $catid != $this->topic->category_id) { $this->category = KunenaForumCategoryHelper::get($catid); $this->category->tryAuthorise(); } else { $this->category = $this->topic->getCategory(); } // Access check. $this->message->tryAuthorise(); // Check if we need to redirect (category or topic mismatch, or resolve permanent URL). if ($this->primary) { $channels = $this->category->getChannels(); if ($this->message->thread != $this->topic->id || $this->topic->category_id != $this->category->id && !isset($channels[$this->topic->category_id]) || $mesid && $this->layout != 'threaded') { while (@ob_end_clean()) { } $this->app->redirect($this->message->getUrl(null, false)); } } // Load messages from the current page and set the pagination. $hold = KunenaAccess::getInstance()->getAllowedHold($this->me, $this->category->id, false); $finder = new KunenaForumMessageFinder(); $finder->where('thread', '=', $this->topic->id)->filterByHold($hold); $start = $mesid ? $this->topic->getPostLocation($mesid) : $start; $this->pagination = new KunenaPagination($finder->count(), $start, $limit); $this->messages = $finder->order('time', $this->me->getMessageOrdering() == 'asc' ? 1 : -1)->start($this->pagination->limitstart)->limit($this->pagination->limit)->find(); $this->prepareMessages($mesid); // Run events. $params = new JRegistry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'topic'); $params->set('kunena_layout', 'default'); $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('kunena'); $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0)); $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->messages, &$params, 0)); // Get user data, captcha & quick reply. $this->userTopic = $this->topic->getUserTopic(); $this->quickReply = $this->topic->isAuthorised('reply') && $this->me->exists(); $this->headerText = JText::_('COM_KUNENA_TOPIC') . ' ' . html_entity_decode($this->topic->displayField('subject')); }
/** * Get a list of subscribers for a thread * * @since 5.0 * @access public * @param string * @return */ public function getSubscribers($message) { $config = KunenaFactory::getConfig(); if ($message->hold > 1) { return false; } elseif ($message->hold == 1) { $mailsubs = 0; $mailmods = $config->mailmod >= 0; $mailadmins = $config->mailadmin >= 0; } else { $mailsubs = (bool) $config->allowsubscriptions; $mailmods = $config->mailmod >= 1; $mailadmins = $config->mailadmin >= 1; } $once = false; if ($mailsubs) { if (!$message->parent) { // New topic: Send email only to category subscribers $mailsubs = $config->category_subscriptions != 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : 0; $once = $config->category_subscriptions == 'topic'; } elseif ($config->category_subscriptions != 'post') { // Existing topic: Send email only to topic subscribers $mailsubs = $config->topic_subscriptions != 'disabled' ? KunenaAccess::TOPIC_SUBSCRIPTION : 0; $once = $config->topic_subscriptions == 'first'; } else { // Existing topic: Send email to both category and topic subscribers $mailsubs = $config->topic_subscriptions == 'disabled' ? KunenaAccess::CATEGORY_SUBSCRIPTION : KunenaAccess::CATEGORY_SUBSCRIPTION | KunenaAccess::TOPIC_SUBSCRIPTION; // FIXME: category subcription can override topic $once = $config->topic_subscriptions == 'first'; } } //get all subscribers, moderators and admins who will get the email $me = KunenaUserHelper::get(); $acl = KunenaAccess::getInstance(); $subscribers = $acl->getSubscribers($message->catid, $message->thread, $mailsubs, $mailmods, $mailadmins, $me->userid); if (!$subscribers) { return false; } $result = array(); foreach ($subscribers as $subscriber) { if ($subscriber->id) { $result[] = $subscriber->id; } } return $result; }
?> <label id="childforums-lbl"> <input type="checkbox" name="childforums" value="1" <?php if ($this->state->get('query.childforums')) { echo 'checked="checked"'; } ?> /> <span onclick="document.searchform.childforums.checked=(! document.searchform.childforums.checked);"><?php echo JText::_('COM_KUNENA_SEARCH_SEARCHIN_CHILDREN'); ?> </span> </label> </fieldset> <?php if (KunenaAccess::getInstance()->getModeratorStatus()) { ?> <fieldset class="fieldset"> <legend><?php echo JText::_('COM_KUNENA_SEARCH_SHOW'); ?> </legend> <input id="show0" type="radio" name="show" value="0" <?php if ($this->state->get('query.show') == 0) { echo 'checked="checked"'; } ?> /> <label for="show0"><?php echo JText::_('COM_KUNENA_SEARCH_SHOW_NORMAL'); ?>
/** * @param int $catid * @param bool|string $code * * @return string */ public function getType($catid = 0, $code = false) { static $types = array('admin' => 'COM_KUNENA_VIEW_ADMIN', 'globalmod' => 'COM_KUNENA_VIEW_GLOBAL_MODERATOR', 'moderator' => 'COM_KUNENA_VIEW_MODERATOR', 'user' => 'COM_KUNENA_VIEW_USER', 'guest' => 'COM_KUNENA_VIEW_VISITOR', 'banned' => 'COM_KUNENA_VIEW_BANNED', 'blocked' => 'COM_KUNENA_VIEW_BANNED'); $moderatedCategories = KunenaAccess::getInstance()->getModeratorStatus($this); if (!$this->_type) { if ($this->userid == 0) { $this->_type = 'guest'; } elseif ($this->isBanned()) { $this->_type = 'banned'; } elseif ($this->isAdmin(KunenaForumCategoryHelper::get($catid))) { $this->_type = 'admin'; } elseif ($this->isModerator(null)) { $this->_type = 'globalmod'; } elseif (!$catid && !empty($moderatedCategories)) { $this->_type = 'moderator'; } elseif ($catid && isset($moderatedCategories[$catid])) { $this->_type = 'moderator'; } else { $this->_type = 'user'; } $userClasses = KunenaFactory::getTemplate()->getUserClasses(); $this->_class = isset($userClasses[$this->_type]) ? $userClasses[$this->_type] : $userClasses[0] . $this->_type; } return $code == 'class' ? $this->_class : ($code == false ? $types[$this->_type] : $this->_type); }
/** * Clear Kunena access cache. */ public static function clearAccess() { KunenaAccess::getInstance()->clearCache(); }
public function getListmodcats() { $user = $this->getUser(); $modCatList = array_keys(KunenaAccess::getInstance()->getModeratorStatus($user)); if (empty($modCatList)) { $modCatList[] = 0; } $categoryList = array(); if ($this->me->isAdmin()) { $categoryList[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_GLOBAL_MODERATOR')); } $params = array('sections' => false, 'action' => 'read'); $modCats = JHtml::_('kunenaforum.categorylist', 'catid[]', 0, $categoryList, $params, 'class="inputbox" multiple="multiple" size="15"', 'value', 'text', $modCatList, 'kforums'); return $modCats; }
public function getAdminOptions() { $category = $this->getAdminCategory(); if (!$category) { return false; } $catList = array(); $catList[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_TOPLEVEL')); // make a standard yes/no list $published = array(); $published[] = JHtml::_('select.option', 1, JText::_('COM_KUNENA_PUBLISHED')); $published[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_UNPUBLISHED')); // make a standard yes/no list $yesno = array(); $yesno[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_NO')); $yesno[] = JHtml::_('select.option', 1, JText::_('COM_KUNENA_YES')); // Anonymous posts default $post_anonymous = array(); $post_anonymous[] = JHtml::_('select.option', '0', JText::_('COM_KUNENA_CATEGORY_ANONYMOUS_X_REG')); $post_anonymous[] = JHtml::_('select.option', '1', JText::_('COM_KUNENA_CATEGORY_ANONYMOUS_X_ANO')); $cat_params = array(); $cat_params['ordering'] = 'ordering'; $cat_params['toplevel'] = JText::_('COM_KUNENA_TOPLEVEL'); $cat_params['sections'] = 1; $cat_params['unpublished'] = 1; $cat_params['catid'] = $category->id; $cat_params['action'] = 'admin'; $channels_params = array(); $channels_params['catid'] = $category->id; $channels_params['action'] = 'admin'; $channels_options = array(); $channels_options[] = JHtml::_('select.option', 'THIS', JText::_('COM_KUNENA_CATEGORY_CHANNELS_OPTION_THIS')); $channels_options[] = JHtml::_('select.option', 'CHILDREN', JText::_('COM_KUNENA_CATEGORY_CHANNELS_OPTION_CHILDREN')); if (empty($category->channels)) { $category->channels = 'THIS'; } $topic_ordering_options = array(); $topic_ordering_options[] = JHtml::_('select.option', 'lastpost', JText::_('COM_KUNENA_CATEGORY_TOPIC_ORDERING_OPTION_LASTPOST')); $topic_ordering_options[] = JHtml::_('select.option', 'creation', JText::_('COM_KUNENA_CATEGORY_TOPIC_ORDERING_OPTION_CREATION')); $topic_ordering_options[] = JHtml::_('select.option', 'alpha', JText::_('COM_KUNENA_CATEGORY_TOPIC_ORDERING_OPTION_ALPHA')); $aliases = array_keys($category->getAliases()); $lists = array(); $lists['accesstypes'] = KunenaAccess::getInstance()->getAccessTypesList($category); $lists['accesslists'] = KunenaAccess::getInstance()->getAccessOptions($category); $lists['categories'] = JHtml::_('kunenaforum.categorylist', 'parent_id', 0, null, $cat_params, 'class="inputbox"', 'value', 'text', $category->parent_id); $lists['channels'] = JHtml::_('kunenaforum.categorylist', 'channels[]', 0, $channels_options, $channels_params, 'class="inputbox" multiple="multiple"', 'value', 'text', explode(',', $category->channels)); $lists['aliases'] = $aliases ? JHtml::_('kunenaforum.checklist', 'aliases', $aliases, true) : null; $lists['published'] = JHtml::_('select.genericlist', $published, 'published', 'class="inputbox"', 'value', 'text', $category->published); $lists['forumLocked'] = JHtml::_('select.genericlist', $yesno, 'locked', 'class="inputbox" size="1"', 'value', 'text', $category->locked); $lists['forumReview'] = JHtml::_('select.genericlist', $yesno, 'review', 'class="inputbox" size="1"', 'value', 'text', $category->review); $lists['allow_polls'] = JHtml::_('select.genericlist', $yesno, 'allow_polls', 'class="inputbox" size="1"', 'value', 'text', $category->allow_polls); $lists['allow_anonymous'] = JHtml::_('select.genericlist', $yesno, 'allow_anonymous', 'class="inputbox" size="1"', 'value', 'text', $category->allow_anonymous); $lists['post_anonymous'] = JHtml::_('select.genericlist', $post_anonymous, 'post_anonymous', 'class="inputbox" size="1"', 'value', 'text', $category->post_anonymous); $lists['topic_ordering'] = JHtml::_('select.genericlist', $topic_ordering_options, 'topic_ordering', 'class="inputbox" size="1"', 'value', 'text', $category->topic_ordering); // TODO: /* $topicicons = array (); jimport( 'joomla.filesystem.folder' ); $topiciconslist = JFolder::folders(JPATH_ROOT.'/media/kunena/topicicons'); foreach( $topiciconslist as $icon ) { $topicicons[] = JHtml::_ ( 'select.option', $icon, $icon ); } $lists ['category_iconset'] = JHtml::_ ( 'select.genericlist', $topicicons, 'iconset', 'class="inputbox" size="1"', 'value', 'text', $category->iconset ); */ return $lists; }