Пример #1
0
 static function getTree($xmap, $parent, &$params)
 {
     if ($xmap->isNews) {
         // This component does not provide news content. don't waste time/resources
         return false;
     }
     // Make sure that we can load the kunena api
     if (!xmap_com_kunena::loadKunenaApi()) {
         return false;
     }
     if (!self::$profile) {
         self::$config = KunenaFactory::getConfig();
         self::$profile = KunenaFactory::getUser();
     }
     $user = JFactory::getUser();
     $catid = 0;
     $link_query = parse_url($parent->link);
     if (!isset($link_query['query'])) {
         return;
     }
     parse_str(html_entity_decode($link_query['query']), $link_vars);
     $view = JArrayHelper::getValue($link_vars, 'view', '');
     switch ($view) {
         case 'showcat':
         case 'category':
             $link_query = parse_url($parent->link);
             parse_str(html_entity_decode($link_query['query']), $link_vars);
             $catid = JArrayHelper::getValue($link_vars, 'catid', 0);
             break;
         case 'listcat':
         case 'entrypage':
             $catid = 0;
             break;
         default:
             return true;
             // Do not expand links to posts
     }
     $include_topics = JArrayHelper::getValue($params, 'include_topics', 1);
     $include_topics = $include_topics == 1 || $include_topics == 2 && $xmap->view == 'xml' || $include_topics == 3 && $xmap->view == 'html' || $xmap->view == 'navigator';
     $params['include_topics'] = $include_topics;
     $priority = JArrayHelper::getValue($params, 'cat_priority', $parent->priority);
     $changefreq = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq);
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['cat_priority'] = $priority;
     $params['cat_changefreq'] = $changefreq;
     $params['groups'] = implode(',', $user->getAuthorisedViewLevels());
     $priority = JArrayHelper::getValue($params, 'topic_priority', $parent->priority);
     $changefreq = JArrayHelper::getValue($params, 'topic_changefreq', $parent->changefreq);
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['topic_priority'] = $priority;
     $params['topic_changefreq'] = $changefreq;
     if ($include_topics) {
         $ordering = JArrayHelper::getValue($params, 'topics_order', 'ordering');
         if (!in_array($ordering, array('id', 'ordering', 'time', 'subject', 'hits'))) {
             $ordering = 'ordering';
         }
         $params['topics_order'] = 't.`' . $ordering . '`';
         $params['include_pagination'] = $xmap->view == 'xml';
         $params['limit'] = '';
         $params['days'] = '';
         $limit = JArrayHelper::getValue($params, 'max_topics', '');
         if (intval($limit)) {
             $params['limit'] = ' LIMIT ' . $limit;
         }
         $days = JArrayHelper::getValue($params, 'max_age', '');
         $params['days'] = false;
         if (intval($days)) {
             $params['days'] = $xmap->now - intval($days) * 86400;
         }
     }
     $params['table_prefix'] = xmap_com_kunena::getTablePrefix();
     xmap_com_kunena::getCategoryTree($xmap, $parent, $params, $catid);
 }
Пример #2
0
 function getTree(&$xmap, &$parent, &$params)
 {
     // Make sure that we can load the kunena api
     if (!xmap_com_kunena::loadKunenaApi()) {
         return false;
     }
     if (!self::$profile) {
         self::$config = KunenaFactory::getConfig();
         self::$profile = KunenaFactory::getUser();
     }
     $user = JFactory::getUser();
     $catid = 0;
     $link_query = parse_url($parent->link);
     if (!isset($link_query['query'])) {
         return;
     }
     parse_str(html_entity_decode($link_query['query']), $link_vars);
     $view = JArrayHelper::getValue($link_vars, 'view', '');
     switch ($view) {
         case 'showcat':
             $link_query = parse_url($parent->link);
             parse_str(html_entity_decode($link_query['query']), $link_vars);
             $catid = JArrayHelper::getValue($link_vars, 'catid', 0);
             break;
         case 'entrypage':
             $catid = 0;
             break;
         default:
             return true;
             // Do not expand links to posts
     }
     $include_topics = JArrayHelper::getValue($params, 'include_topics', 1);
     $include_topics = $include_topics == 1 || $include_topics == 2 && $xmap->view == 'xml' || $include_topics == 3 && $xmap->view == 'html' || $xmap->view == 'navigator';
     $params['include_topics'] = $include_topics;
     $priority = JArrayHelper::getValue($params, 'cat_priority', $parent->priority);
     $changefreq = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq);
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['cat_priority'] = $priority;
     $params['cat_changefreq'] = $changefreq;
     $params['groups'] = implode(',', $user->authorisedLevels());
     $priority = JArrayHelper::getValue($params, 'topic_priority', $parent->priority);
     $changefreq = JArrayHelper::getValue($params, 'topic_changefreq', $parent->changefreq);
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['topic_priority'] = $priority;
     $params['topic_changefreq'] = $changefreq;
     if ($include_topics) {
         $ordering = JArrayHelper::getValue($params, 'topics_order', 'ordering');
         $params['topics_order'] = 'modified desc';
         $params['include_pagination'] = $xmap->view == 'xml';
         $params['limit'] = '';
         $params['days'] = '';
         $limit = JArrayHelper::getValue($params, 'max_topics', '');
         if (intval($limit)) {
             $params['limit'] = ' LIMIT ' . $limit;
         }
         $days = JArrayHelper::getValue($params, 'max_age', '');
         if (intval($days)) {
             $params['days'] = ' AND time >=' . ($xmap->now - $days * 86400) . " ";
         }
     }
     xmap_com_kunena::getCategoryTree($xmap, $parent, $params, $catid);
 }