Ejemplo n.º 1
0
function search_content_handler(&$sm)
{
    $um =& $sm->get_url_manager();
    if ($um->isset_param('search_do_advanced')) {
        require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
        $params = Articles_list::get_search_params_from_url($sm);
        unset($params['pg']);
        if ($um->isset_param('search_archive')) {
            $params['search_archive'] = 1;
        }
        $params['search_do_advanced'] = true;
        $params = strtr(rtrim(base64_encode(serialize($params)), '='), '+/', '-_');
        //$params = rtrim($params, '=');
        if ($um->isset_param('search_archive')) {
            header('Location:' . make_proxied_url('archive/index.html?search_options=' . $params));
        } else {
            header('Location:' . make_proxied_url('index.html?search_options=' . $params));
        }
        exit;
    }
    $template = $sm->get_template();
    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
    $content_template = new template($sm, $template);
    $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/advanced_search.tpl');
    $template->assign('PAGE_CONTENT', $content_template->get_output());
}
Ejemplo n.º 2
0
function author_content_handler(&$sm)
{
    $template =& $sm->get_template();
    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
    $header =& $sm->get_header_manager();
    $um =& $sm->get_url_manager();
    require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
    $sm->article_list_params = Articles_list::get_search_params_from_url($sm);
    $sm->article_list_params['search_options'] = array();
    if (VIVVO_MODULES_FEATURED_AUTHOR_PAGE == 1 && ($um->isset_param('show_authors') || $um->get_param('search_user_id') && !$um->get_param('search_do_advanced'))) {
        if ($um->isset_param('show_authors')) {
            $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
            $content_template = new template($sm, $template);
            $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/authors_page.tpl');
            $template->assign_template('PAGE_CONTENT', $content_template);
            $template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_AUTHORS')));
        } else {
            $user_manager =& $sm->get_user_manager();
            $user_list =& $user_manager->get_user_list($sm);
            $user_list_a =& $user_list->get_user_by_id($um->get_param('search_user_id'));
            if ($user_list_a) {
                $sm->article_list_params['search_options']['search_user_id'] = $user_list_a->get_id();
                if ($um->get_param('search_by_year')) {
                    $sm->article_list_params['search_options']['search_by_year'] = $um->get_param('search_by_year');
                }
                if ($um->get_param('search_by_month')) {
                    $sm->article_list_params['search_options']['search_by_month'] = $um->get_param('search_by_month');
                }
                if ($um->get_param('search_by_year')) {
                    $sm->article_list_params['search_limit'] = 200;
                }
                $template->assign('CURRENT_AUTHOR', $user_list_a);
                $template->assign('PAGE_TITLE', strval($user_list_a->get_name()));
                if ($um->isset_param('force_template') && $sm->user && $sm->user->is_admin() && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'author/' . $um->get_param('force_template'))) {
                    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'author/' . $um->get_param('force_template'));
                } else {
                    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'author/default.tpl');
                }
                if (VIVVO_MODULES_FEED == 1) {
                    $header->add_rss(switch_format('rss', CURRENT_URL), $user_list_a->get_name());
                }
            } else {
                go_404();
            }
        }
        if (defined('VIVVO_CACHE_ENABLE') && VIVVO_CACHE_ENABLE == 1 && !isset($sm->article_list_params['cache'])) {
            $sm->article_list_params['cache'] = 1;
        }
        $template->assign('content_params', $sm->article_list_params);
        $template->assign('CONTENT_PARAMS_OPTIONS', $sm->article_list_params['search_options']);
    } else {
        go_404();
    }
}
Ejemplo n.º 3
0
function tag_content_handler(&$sm)
{
    $template = $sm->get_template();
    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
    $header = $sm->get_header_manager();
    $um = $sm->get_url_manager();
    require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
    $sm->article_list_params = Articles_list::get_search_params_from_url($sm);
    $sm->article_list_params['search_options'] = array();
    if (VIVVO_MODULES_TAGS == 1 && ($um->isset_param('show_tags') || ($um->get_param('search_tag_id') || $um->get_param('search_tag')) && !$um->get_param('search_do_advanced'))) {
        //Tag view page
        if ($um->isset_param('show_tags')) {
            $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
            $content_template = new template($sm, $template);
            $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/tags_page.tpl');
            $template->assign_template('PAGE_CONTENT', $content_template);
            $template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_TAGS')));
        } else {
            require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Tags.class.php';
            if ($um->get_param('search_tag_id')) {
                $sm->article_list_params['search_options']['search_tag_id'] = $um->get_param('search_tag_id');
                $tag_list =& new Tags_list($sm);
                $tag =& $tag_list->get_tag_by_id($um->get_param('search_tag_id'));
            } else {
                $sm->article_list_params['search_options']['search_tag'] = $um->get_param('search_tag');
                $tag_list =& new Tags_list($sm);
                $tag =& $tag_list->get_tag_by_name($um->get_param('search_tag'));
            }
            if ($tag) {
                if (VIVVO_MODULES_FEED == 1) {
                    $header->add_rss(switch_format('rss', CURRENT_URL), $tag->name);
                }
                $template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_TAG') . ': ' . $tag->name));
                if ($um->isset_param('force_template') && $sm->user && $sm->user->is_admin() && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'tag/' . $um->get_param('force_template'))) {
                    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'tag/' . $um->get_param('force_template'));
                } else {
                    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'tag/' . VIVVO_TAG_LAYOUT);
                }
            } else {
                go_404();
            }
        }
        if (defined('VIVVO_CACHE_ENABLE') && VIVVO_CACHE_ENABLE == 1 && !isset($sm->article_list_params['cache'])) {
            $sm->article_list_params['cache'] = 1;
        }
        $template->assign('content_params', $sm->article_list_params);
        $template->assign('CONTENT_PARAMS_OPTIONS', $sm->article_list_params['search_options']);
    } else {
        go_404();
    }
}
Ejemplo n.º 4
0
function date_content_handler(&$sm)
{
    $template =& $sm->get_template();
    $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
    $header =& $sm->get_header_manager();
    $um =& $sm->get_url_manager();
    require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
    $sm->article_list_params = Articles_list::get_search_params_from_url($sm);
    $sm->article_list_params['search_options'] = array();
    if (VIVVO_MODULES_ARCHIVE_VIEW == 1 && ($um->get_param('search_by_year') && !$um->get_param('search_do_advanced'))) {
        //Date view page
        if ($um->get_param('search_by_year')) {
            $sm->article_list_params['search_options']['search_by_year'] = $um->get_param('search_by_year');
        }
        if ($um->get_param('search_by_month')) {
            $sm->article_list_params['search_options']['search_by_month'] = $um->get_param('search_by_month');
        }
        if ($um->get_param('search_by_day')) {
            $sm->article_list_params['search_options']['search_by_day'] = $um->get_param('search_by_day');
        }
        $sm->article_list_params['search_sort_by'] = 'created';
        $sm->article_list_params['search_order'] = 'ascending';
        if ($um->get_param('search_by_day')) {
            $template->assign('PAGE_TITLE', strval(intval($um->get_param('search_by_year')) . ' ' . intval($um->get_param('search_by_month')) . ' ' . intval($um->get_param('search_by_day'))));
        } elseif ($um->get_param('search_by_month')) {
            $template->assign('PAGE_TITLE', strval(intval($um->get_param('search_by_year')) . ' ' . intval($um->get_param('search_by_month'))));
        } else {
            $template->assign('PAGE_TITLE', intval($um->get_param('search_by_year')));
        }
        if ($um->isset_param('force_template') && $sm->user && $sm->user->is_admin() && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'archive/' . $um->get_param('force_template'))) {
            $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'archive/' . $um->get_param('force_template'));
        } else {
            $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'archive/' . VIVVO_ARCHIVE_LAYOUT);
        }
        if (defined('VIVVO_CACHE_ENABLE') && VIVVO_CACHE_ENABLE == 1 && !isset($sm->article_list_params['cache'])) {
            $sm->article_list_params['cache'] = 1;
        }
        $template->assign('content_params', $sm->article_list_params);
        $template->assign('CONTENT_PARAMS_OPTIONS', $sm->article_list_params['search_options']);
    } else {
        go_404();
    }
}
Ejemplo n.º 5
0
 function set_content()
 {
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/box/vivvo_box.php';
     $header = $this->get_header_manager();
     $pm = $this->get_plugin_manager();
     $um = $this->get_url_manager();
     if ($um->get_param('404')) {
         $this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/404.tpl');
         $this->_template->assign('URL', htmlspecialchars($um->get_param('url')));
     } elseif ($um->get_param('plugin')) {
         $this->set_theme();
         $this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
         $content = $pm->get_content($um->get_param('plugin'));
         if ($content !== false) {
             $this->_template->assign('PAGE_CONTENT', $content);
         }
     } elseif ($um->get_param('url_module')) {
         $this->call_url_content_handler($um->get_param('url_module'));
     } else {
         if ($um->get_param('search_id')) {
             $this->call_url_content_handler('article');
         } else {
             require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
             //Article list page
             $cur_page = (int) $um->get_param('pg');
             if (empty($cur_page)) {
                 $cur_page = 1;
             }
             $this->article_list_params['search_options'] = array();
             if ($um->get_param('search_cid') && !$um->get_param('search_do_advanced')) {
                 $this->call_url_content_handler('category');
             } else {
                 if ($um->get_param('search_do_advanced')) {
                     if (VIVVO_MODULES_SEARCH == 1 || defined('VIVVO_ADMIN_MODE')) {
                         //Search results
                         $this->article_list_params = Articles_list::get_search_params_from_url($this);
                         $this->_template->assign('PAGE_TITLE', strval($this->_lang->get_value('LNG_SEARCH_RESULTS')));
                         if ($um->get_param('type') == 'rss') {
                             define('VIVVO_RSS_FEED', true);
                             $this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/rss2.0.tpl');
                         } elseif ($um->isset_param('force_template') && $this->user && $this->user->is_admin() && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'search_results/' . $um->get_param('force_template'))) {
                             $this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'search_results/' . $um->get_param('force_template'));
                         } else {
                             $this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'search_results/' . VIVVO_SEARCH_RESULT_LAYOUT);
                         }
                     } else {
                         go_404();
                     }
                 }
             }
             if (empty($this->article_list_params['search_limit'])) {
                 $this->article_list_params['search_limit'] = 10;
             }
             $this->article_list_params['pg'] = $cur_page;
             $this->article_list_params['offset'] = ($cur_page - 1) * $this->article_list_params['search_limit'];
             if ($um->isset_param('search_sort_by')) {
                 $this->article_list_params['search_sort_by'] = $um->get_param('search_sort_by');
             }
             if ($um->isset_param('search_order')) {
                 $this->article_list_params['search_order'] = $um->get_param('search_order');
             }
             if (empty($this->article_list_params['search_sort_by'])) {
                 $this->article_list_params['search_sort_by'] = 'order_num';
                 $this->article_list_params['search_order'] = 'descending';
             } else {
                 if (empty($this->article_list_params['search_order'])) {
                     $this->article_list_params['search_order'] = 'ascending';
                 }
             }
             if (!defined('VIVVO_ADMIN_MODE')) {
                 if (defined('VIVVO_CACHE_ENABLE') && VIVVO_CACHE_ENABLE == 1 && !isset($this->article_list_params['cache'])) {
                     $this->article_list_params['cache'] = 1;
                 }
             }
             $this->_template->assign('content_params', $this->article_list_params);
             if (isset($this->article_list_params['search_options'])) {
                 $this->_template->assign('CONTENT_PARAMS_OPTIONS', $this->article_list_params['search_options']);
             }
         }
     }
 }
Ejemplo n.º 6
0
/**
 * Mobile url manager
 */
function mobile_url_handler(&$sm, $url_array)
{
    $um = $sm->get_url_manager();
    $sm->set_theme('mobile');
    array_shift($um->_url_array);
    define('VIVVO_TEMPLATE_DIR_OVERWRITE', 'mobile');
    $template = $sm->get_template();
    if (defined('VIVVO_SYSTEM_PROXY_URL')) {
        if (!defined('VIVVO_PROXY_URL')) {
            define('VIVVO_PROXY_URL', VIVVO_SYSTEM_PROXY_URL . 'mobile/');
        } else {
            define('VIVVO_PROXY_URL_OVERWRITE', VIVVO_SYSTEM_PROXY_URL . 'mobile/');
            $template->assign('VIVVO_PROXY_URL', strval(VIVVO_PROXY_URL_OVERWRITE));
        }
    } elseif (defined('VIVVO_PROXY_URL')) {
        define('VIVVO_PROXY_URL_OVERWRITE', VIVVO_PROXY_URL . 'mobile/');
    } else {
        define('VIVVO_PROXY_URL', 'mobile/');
    }
    if (defined('VIVVO_ABSOLUTE_URL')) {
        $template->assign('VIVVO_ABSOLUTE_URL', make_absolute_url(''));
    } else {
        define('VIVVO_ABSOLUTE_URL', make_absolute_url(''));
    }
    if ($um->_url_array[0] == 'search') {
        if ($um->isset_param('search_do_advanced')) {
            require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
            $params = Articles_list::get_search_params_from_url($sm);
            unset($params['pg']);
            if ($um->isset_param('search_archive')) {
                $params['search_archive'] = 1;
            }
            $params['search_do_advanced'] = true;
            $params = base64_encode(serialize($params));
            $params = rtrim($params, '=');
            header('Location:' . make_absolute_url('mobile/index.html?search_options=' . $params));
            exit;
        }
        $sm->set_template_dir();
        $sm->load_action_handlers();
        $sm->set_theme();
        $template->set_template_file(VIVVO_FS_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
        $content_template = new template($sm, $template);
        $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/advanced_search.tpl');
        $template->assign_template('PAGE_CONTENT', $content_template);
        $output = $sm->get_output();
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        echo str_replace('$generation_time$', time() - $_generation_time . 's', $output);
        exit;
    } elseif ($um->_url_array[0] == 'login') {
        $dm = $sm->get_dump_manager();
        $dm->restore_dump(md5(VIVVO_URL . 'mobile/login'));
        $sm->set_template_dir();
        $sm->load_action_handlers();
        $sm->set_theme();
        $action = $sm->execute_action();
        $template->set_template_file(VIVVO_FS_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
        $template->assign('DUMP_MESSAGES', $dm->_dump_pool);
        if ($sm->user) {
            $template->assign('CURRENT_USER', $sm->user);
        }
        if ($um->isset_param('action') && $action === false) {
            $in_user = $um->get_param_regexp('/^USER_/');
            $current_user = new Users($sm, $in_user);
            $template->assign('user', $current_user);
        } else {
            $template->assign('REGISTRATION', strval('0'));
        }
        $content_template = new template($sm, $template);
        $content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/register.tpl');
        $template->assign_template('PAGE_CONTENT', $content_template);
        $output = $sm->get_output();
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        echo str_replace('$generation_time$', time() - $_generation_time . 's', $output);
        ob_end_flush();
        exit;
    } else {
        $um->parse_url();
    }
    return true;
}
Ejemplo n.º 7
0
 /**
  * Set fields in article
  *
  * @param	array	$articles_ids
  * @param	string	$field_name
  * @param	string	$value
  * @param	integer	$all_matching
  * @return	boolean	true on success or false on fail
  */
 function set_field($article_ids, $field_name, $value, $all_matching = 0)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('article_setField', array(&$article_ids, &$field_name, &$value, &$all_matching))) {
         return vivvo_hooks_manager::get_status();
     }
     $sm = vivvo_lite_site::get_instance();
     if ($sm->user) {
         $editor_restriction = $sm->user->get_privilege_object_ids('EDITOR', 'Categories');
         if (!empty($editor_restriction)) {
             $article_list = new Articles_list();
             if (!in_array('0', $editor_restriction)) {
                 if ($field_name == 'category_id' && !in_array($value, $editor_restriction)) {
                     $this->set_error_code(2012);
                     return false;
                 }
             }
             if ($field_name == 'status' && !$sm->user->can_change_status($value, '*')) {
                 $this->set_error_code(2012);
                 return false;
             }
             if ($all_matching == 1) {
                 $article_params = Articles_list::get_search_params_from_url($sm);
                 if (!is_array($article_params['search_options']['search_cid'])) {
                     $article_params['search_options']['search_cid'] = explode(',', $article_params['search_options']['search_cid']);
                 }
                 if (!in_array('0', $editor_restriction) && isset($article_params['search_options']['search_cid'])) {
                     $article_params['search_options']['search_cid'] = array_intersect($editor_restriction, $article_params['search_options']['search_cid']);
                 }
                 $article_list->search($article_params['search_options'], '', 'ascending', 0, 0, false);
                 if (!in_array($field_name, array('applyTags', 'editTags'))) {
                     if ($article_list->sql_update_list($this->_post_master, array($field_name => $value), NULL, true)) {
                         admin_log($sm->user->get_username(), 'Edited articles #' . trim(implode(',', $article_ids)));
                         return true;
                     } else {
                         $this->set_error_code(2010);
                         return false;
                     }
                 } else {
                     $res = $sm->get_db()->query('SELECT a.id ' . $article_list->_query->get_from() . ' ' . $article_list->_query->get_join() . ' ' . $article_list->_query->get_where() . ' ' . $article_list->_query->get_group_by() . ' ' . $article_list->_query->get_having());
                     if (PEAR::isError($res)) {
                         $this->set_error_code(2010);
                         return false;
                     }
                     $article_ids = $res->fetchCol();
                     $res->free();
                 }
             } elseif (!in_array($field_name, array('applyTags', 'editTags'))) {
                 $article_list->get_articles_by_ids($article_ids, $editor_restriction);
                 if ($article_list->sql_update_list($this->_post_master, array($field_name => $value))) {
                     admin_log($sm->user->get_username(), 'Edited articles #' . trim(implode(',', $article_ids)));
                     return true;
                 } else {
                     $this->set_error_code(2011);
                     return false;
                 }
             }
             if ($field_name == 'applyTags') {
                 require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/service/Tags.service.php';
                 $this->tag_service = new tag_service($sm);
                 $tags = array_map(array($this, 'parse_tags'), explode(',', $value));
                 foreach ($article_ids as $article_id) {
                     foreach ($tags as $id) {
                         $this->tag_service->add_tag_to_group($id[1], $id[0], $article_id);
                     }
                 }
                 return true;
             } elseif ($field_name == 'editTags') {
                 $tags = explode(',', $value);
                 foreach ($article_ids as $article_id) {
                     $this->manageTags($tags, $article_id);
                 }
                 return true;
             }
             $this->set_error_code(2011);
             return false;
         } else {
             $this->set_error_code(2012);
             return false;
         }
     } else {
         $this->set_error_code(2013);
         return false;
     }
 }
Ejemplo n.º 8
0
function feed_url_handler(&$sm, $url_array)
{
    if (!defined('VIVVO_PROXY_URL')) {
        if (defined('VIVVO_SYSTEM_PROXY_URL')) {
            define('VIVVO_PROXY_URL', VIVVO_SYSTEM_PROXY_URL);
        } else {
            define('VIVVO_PROXY_URL', '');
        }
    }
    defined('VIVVO_ABSOLUTE_URL') or define('VIVVO_ABSOLUTE_URL', make_absolute_url(''));
    $template = $sm->get_template();
    $um = $sm->get_url_manager();
    array_shift($um->_url_array);
    if ($_GET['output_type'] == 'sitemap') {
        define('VIVVO_SKIP_URL_PARSING', true);
    }
    $um->parse_url();
    $template->assign('CURRENT_TIME', date('Y-m-d H:i:s', VIVVO_START_TIME));
    require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
    if (empty($sm->article_list_params)) {
        $sm->article_list_params = Articles_list::get_search_params_from_url($sm);
    }
    if (!$um->get_param('output_type')) {
        $um->set_param('output_type', 'rss');
    }
    if ($um->get_param('output_type') == 'atom') {
        if (VIVVO_MODULES_FEED == 1) {
            if (VIVVO_MODULES_CATEGORY_INCLUDE_FEED) {
                if (empty($sm->article_list_params['search_options']['search_cid'])) {
                    $sm->article_list_params['search_options']['search_cid'] = VIVVO_MODULES_CATEGORY_INCLUDE_FEED;
                } else {
                    $search_cid = explode(',', $sm->article_list_params['search_options']['search_cid']);
                    $restrict_cid = explode(',', VIVVO_MODULES_CATEGORY_INCLUDE_FEED);
                    $search_cid = array_intersect($search_cid, $restrict_cid);
                    if (!empty($search_cid)) {
                        $sm->article_list_params['search_options']['search_cid'] = implode(',', $search_cid);
                    } else {
                        $sm->article_list_params['search_options']['search_cid'] = '-1';
                    }
                }
            }
            $sm->article_list_params['search_options']['search_rss_feed'] = '1';
            header("Content-type: text/xml; charset=UTF-8");
            if (isset($sm->article_list_params['search_options']['search_id']) && $sm->article_list_params['search_options']['search_id'] != '') {
                $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/atom1.0_comments.tpl');
            } else {
                $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/atom1.0.tpl');
            }
        } else {
            go_404();
        }
    } elseif ($um->get_param('output_type') == 'rss') {
        if (VIVVO_MODULES_FEED == 1) {
            if (VIVVO_MODULES_CATEGORY_INCLUDE_FEED) {
                if (empty($sm->article_list_params['search_options']['search_cid'])) {
                    $sm->article_list_params['search_options']['search_cid'] = VIVVO_MODULES_CATEGORY_INCLUDE_FEED;
                } else {
                    $search_cid = explode(',', $sm->article_list_params['search_options']['search_cid']);
                    $restrict_cid = explode(',', VIVVO_MODULES_CATEGORY_INCLUDE_FEED);
                    $search_cid = array_intersect($search_cid, $restrict_cid);
                    if (!empty($search_cid)) {
                        $sm->article_list_params['search_options']['search_cid'] = implode(',', $search_cid);
                    } else {
                        $sm->article_list_params['search_options']['search_cid'] = '-1';
                    }
                }
            }
            $sm->article_list_params['search_options']['search_rss_feed'] = '1';
            header("Content-type: text/xml; charset=UTF-8");
            if (isset($sm->article_list_params['search_options']['search_id']) && $sm->article_list_params['search_options']['search_id'] != '') {
                $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/rss2.0_comments.tpl');
            } else {
                $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/rss2.0.tpl');
            }
        } else {
            go_404();
        }
    } elseif ($um->get_param('output_type') == 'txt') {
        if (VIVVO_MODULES_PLAINTEXT == 1) {
            header("Content-type: text/plain; charset=UTF-8");
            if ($um->get_param('search_id')) {
                $sm->set_content();
                $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/article_text.tpl');
            } else {
                $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/text.tpl');
            }
        } else {
            go_404();
        }
    } elseif ($um->get_param('output_type') == 'sitemap') {
        header("Content-type: text/xml; charset=UTF-8");
        echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
        $template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . 'templates/_syndication/google_sitemap.tpl');
    } else {
        go_404();
    }
    $template->assign('content_params', $sm->article_list_params);
    echo $sm->get_output();
    exit;
}