本文整理汇总了PHP中template::set_template_file方法的典型用法代码示例。如果您正苦于以下问题:PHP template::set_template_file方法的具体用法?PHP template::set_template_file怎么用?PHP template::set_template_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::set_template_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_builder_content_handler
function form_builder_content_handler(&$sm)
{
$um =& $sm->get_url_manager();
$sm->set_theme();
$sm->_template->set_template_file(VIVVO_FS_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$content_template = new template($sm, $sm->_template);
require_once dirname(__FILE__) . '/form_builder.class.php';
$form_list =& new FormBuilderForms_list($sm);
$form =& $form_list->get_form_by_id($um->get_param('search_fid'));
$content_template->assign('form', $form);
if ($form) {
$form_element_list =& new FormBuilderFields_list($sm);
$form_element_list->get_elements_by_form_id($form->id);
$upload = false;
foreach ($form_element_list->list as $element) {
if ($element->get_type() == 'file_upload') {
$upload = true;
break;
}
}
$content_template->assign('form_elements', $form_element_list->list);
$content_template->assign('form_has_file_upload', $upload);
}
$action = $um->get_param('action');
if ($upload && !empty($action)) {
if (!empty($form->message_url)) {
$content_template->assign('message_url', $form->message_url);
}
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'box/plugin_form_builder.tpl');
} else {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/box_default/box_form.tpl');
}
$sm->_template->assign_template('PAGE_CONTENT', $content_template);
}
示例2: newsletter_content_handler
function newsletter_content_handler(&$sm)
{
$um =& $sm->get_url_manager();
$sm->set_theme();
$sm->_template->set_template_file(VIVVO_FS_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$content_template = new template($sm, $sm->_template);
if ($um->get_param('cmd') == 'subscriberUnSubscribe') {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'plugin/newsletter_unsubscribe.tpl');
} elseif ($um->get_param('cmd') == 'userUnSubscribe') {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'plugin/newsletter_user_unsubscribe.tpl');
} elseif ($um->get_param('cmd') == 'subscriberConfirm') {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'plugin/newsletter_confirm.tpl');
}
$sm->_template->assign_template('PAGE_CONTENT', $content_template);
}
示例3: array
/**
* Create template parser
*
* @return template
*/
function &set_template($params = array())
{
require_once dirname(__FILE__) . '/vivvo_xml_template.php';
$sm = vivvo_lite_site::get_instance();
if (!$this->_parent_template) {
$this->_parent_template = $sm->get_template();
}
$this->_template = new template(null, $this->_parent_template);
if (!empty($params)) {
if (!empty($params['template']) && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $params['template'])) {
$this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $params['template']);
$sm->debug_push("tpl:", VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $params['template']);
} elseif (!empty($params['template']) && file_exists(VIVVO_FS_TEMPLATE_ROOT . $params['template'])) {
$this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . $params['template']);
$sm->debug_push("tpl:", VIVVO_FS_TEMPLATE_ROOT . $params['template']);
} elseif (isset($params['template_string'])) {
$this->_template->set_string_template($params['template_string']);
} else {
$this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $this->_default_template_file);
$sm->debug_push("tpl:", VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $this->_default_template_file);
}
} else {
$this->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $this->_default_template_file);
$sm->debug_push("tpl:", VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $this->_default_template_file);
}
return $this->_template;
}
示例4: search_content_handler
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());
}
示例5: poll_content_handler
function poll_content_handler(&$sm)
{
$sm->set_theme();
$sm->_template->set_template_file(VIVVO_FS_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$content_template = new template($sm, $sm->_template);
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'plugin/poll.tpl');
$sm->_template->assign_template('PAGE_CONTENT', $content_template);
}
示例6: author_content_handler
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();
}
}
示例7: login_content_handler
function login_content_handler(&$sm)
{
$template = $sm->get_template();
$template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$um = $sm->get_url_manager();
$dm = $sm->get_dump_manager();
$dm->restore_dump(md5(make_proxied_url('login.html')));
if (defined('VIVVO_ABSOLUTE_URL')) {
$index_url = VIVVO_ABSOLUTE_URL;
} else {
$index_url = make_absolute_url('');
}
$action = $sm->action_status;
$template->assign('DUMP_MESSAGES', $dm->_dump_pool);
if ($action) {
if ($um->get_param('action') == 'login' && $um->get_param('cmd') == 'login') {
header('Location: ' . $index_url);
exit;
} elseif ($um->get_param('action') == 'login' && $um->get_param('cmd') == 'register' or $um->get_param('action') == 'login' && $um->get_param('cmd') == 'confirm') {
$template->assign('REGISTRATION', strval('1'));
} elseif ($um->get_param('action') == 'login' && $um->get_param('cmd') == 'changePassword') {
$template->assign('REGISTRATION', strval('0'));
} else {
$template->assign('REGISTRATION', strval('0'));
}
} elseif ($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);
if ($um->get_param('activation_key')) {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/change_password.tpl');
$content_template->assign('key', htmlspecialchars($um->get_param('activation_key')));
} else {
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/register.tpl');
}
$template->assign('PAGE_CONTENT', $content_template->get_output());
}
示例8: usercp_content_handler
function usercp_content_handler(&$sm)
{
$template = $sm->get_template();
$template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$um = $sm->get_url_manager();
$dm = $sm->get_dump_manager();
$dm->restore_dump(md5(VIVVO_PROXY_URL . 'usercp.html'));
$template->assign('DUMP_MESSAGES', $dm->_dump_pool);
$content_template = new template($sm, $template);
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/usercp.tpl');
$template->assign('PAGE_CONTENT', $content_template->get_output());
}
示例9: tag_content_handler
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();
}
}
示例10: step6
/**
* Step 6, sets administration parameters in database and creates welcome email.
* At this step installation is finished and user can choose further action.
*
* @param template $template
* @param dump_manager $dm
* @param vivvo_lang $lang
* @return void
*/
function step6(&$template, &$dm, &$lang)
{
require_once dirname(__FILE__) . '/../conf.php';
if ($db = @mysql_connect(VIVVO_DB_HOST, VIVVO_DB_USER, VIVVO_DB_PASSWORD)) {
if (mysql_select_db(VIVVO_DB_DATABASE, $db)) {
@mysql_query('SET NAMES utf8', $db);
$web_site_title = $_REQUEST['web_site_title'];
$administrator_email = $_REQUEST['administrator_email'];
$admin_username = $_REQUEST['admin_username'];
$admin_password = $_REQUEST['admin_password'];
$admin_password_retype = $_REQUEST['admin_password_retype'];
if (!preg_match("/^[-_a-zA-Z0-9]+(\\.[-_a-zA-Z0-9]+)*@[-a-zA-Z0-9]+(\\.[-a-zA-Z0-9]+)*\\.[a-zA-Z]{2,6}\$/", $administrator_email)) {
$dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_WRONG_EMAIL'));
$template->assign('step', strval(5));
} elseif ($admin_username == '') {
$dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_WRONG_USERNAME'));
$template->assign('step', strval(5));
} elseif (strlen($admin_password) < 6) {
$dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_PASSWORD_MINIMUM_6_CHAR'));
$template->assign('step', strval(5));
} elseif ($admin_password != $admin_password_retype) {
$dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_PASSWORD_AND_RETYPE_PASSWORD_MUST_BE_SAME'));
$template->assign('step', strval(5));
} else {
define('VIVVO_WEBSITE_TITLE', $web_site_title);
define('VIVVO_ADMINISTRATORS_EMAIL', $administrator_email);
define('VIVVO_EMAIL_SEND_FROM', $administrator_email);
define('VIVVO_ADMIN_USERNAME', $admin_username);
define('VIVVO_ADMIN_PASSWORD', $admin_password);
require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/framework/sqlrunner.class.php';
// load sql runner
$sqlRunner = new SQLRunner(array('db' => $db, 'stop_on_error' => true));
// Execute scheme.sql
if ($sqlRunner->load(dirname(__FILE__) . '/db/post-install.sql') > 0) {
try {
$scheme = $sqlRunner->run();
} catch (SQLRunnerException $e) {
$dm->add_dump('error', 0, $lang->get_value('LNG_INSTALLER_ERROR_EXECUTING_SQL'), $e->getMessage());
$template->assign('step', strval(4));
return;
}
} else {
$dm->add_dump('error', 0, $lang->get_value('LNG_INSTALLER_INVALID_SQL_FILE') . 'post-install.sql');
$template->assign('step', strval(4));
return;
}
$template->assign('step', strval(6));
// Send information email
$header = "From: Vivvo CMS Installation Wizard <" . $administrator_email . ">\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=utf-8\r\n";
$subject = "=?UTF-8?B?" . base64_encode('Installation Complete') . "?=";
$email_template = new template(null, $template);
$email_template->set_template_file(VIVVO_FS_ROOT . 'installer/templates/email.xml');
$body = $email_template->get_output();
@mail($administrator_email, $subject, $body, $header);
}
} else {
$dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_CANT_SELECT_DATABASE'));
$template->assign('step', strval(5));
}
} else {
$dm->add_dump('info', 0, $lang->get_value('LNG_INSTALLER_CANT_CONNECT_TO_DATABASE'));
$template->assign('step', strval(5));
}
}
示例11: _autocomplete_links
/**
* Autocomplete box feed
*/
public function _autocomplete_links()
{
$sm = vivvo_lite_site::get_instance();
$template = $sm->get_template();
$um = $sm->get_url_manager();
$pm = $sm->get_plugin_manager();
$content_template = new template(null, $template);
$content_template->set_template_file($this->_template_root . 'autocomplete_links.xml');
$hrefs = array();
$db = $sm->get_db();
$name = secure_sql($um->get_param('name'));
$sql = "(SELECT id, category_name AS title, sefriendly, '' AS category_id, 'Categories' AS type FROM " . VIVVO_DB_PREFIX . "categories WHERE category_name LIKE '{$name}%')\n\t\t\t\t\t UNION\n\t\t\t\t (SELECT id, title, sefriendly, category_id, 'Articles' AS type FROM " . VIVVO_DB_PREFIX . "articles WHERE title LIKE '{$name}%')";
if ($pm->is_installed('pages')) {
$sql .= "UNION (SELECT id, title, sefriendly, '' AS category_id, 'Pages' AS type FROM " . VIVVO_DB_PREFIX . "pages WHERE title LIKE '{$name}%')";
}
$sql .= "UNION (SELECT t.id, CONCAT(tg.name,': ',t.name) AS title, t.sefriendly AS sefriendly, tg.url AS category_id, 'Tags' AS type FROM " . VIVVO_DB_PREFIX . "tags AS t INNER JOIN " . VIVVO_DB_PREFIX . "tags_to_tags_groups AS ttg ON ttg.tag_id = t.id INNER JOIN " . VIVVO_DB_PREFIX . "tags_groups AS tg ON ttg.tags_group_id = tg.id WHERE t.name LIKE '{$name}%' GROUP BY t.id, tg.id) " . "UNION (SELECT id, name AS title, url AS sefriendly, '' AS category_id, 'Topics' AS type FROM " . VIVVO_DB_PREFIX . "tags_groups WHERE name LIKE '{$name}%')";
$res = $db->query($sql);
if (!PEAR::isError($res)) {
$i = 0;
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$hrefs[$i] = array();
$hrefs[$i]['title'] = $row['title'];
$hrefs[$i]['id'] = $row['id'];
$hrefs[$i]['type'] = $row['type'];
switch ($row['type']) {
case 'Articles':
if (!$article) {
require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
$article = new Articles();
}
$article->id = $row['id'];
$article->title = $row['title'];
$article->sefriendly = $row['sefriendly'];
$article->category_id = $row['category_id'];
$hrefs[$i]['href'] = $article->get_href();
break;
case 'Categories':
if (!$cat) {
$cat = $sm->get_categories();
}
$hrefs[$i]['href'] = $cat->list[$row['id']]->get_href();
break;
case 'Pages':
if (!$page) {
require_once VIVVO_FS_PLUGIN_ROOT . 'plugins/pages/Pages.class.php';
$page = new Pages();
}
$page->id = $row['id'];
$page->title = $row['title'];
$page->sefriendly = $row['sefriendly'];
$hrefs[$i]['href'] = $page->get_href();
break;
case 'Tags':
if (!$tag) {
require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Tags.class.php';
$tag = new Tags();
}
$tag->id = $row['id'];
$tag->name = $row['title'];
$tag->sefriendly = $row['sefriendly'];
$tag->group_url = $row['category_id'] . '/';
$hrefs[$i]['href'] = $tag->get_href();
break;
case 'Topics':
if (!$topic) {
require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/TagsGroups.class.php';
$topic = new TagsGroups();
}
$topic->id = $row['id'];
$topic->name = $row['title'];
$topic->url = $row['sefriendly'];
$hrefs[$i]['href'] = rtrim($topic->get_href(), '/');
break;
}
$i++;
}
}
$content_template->assign('link_list', $hrefs);
return $content_template;
}
示例12: article_content_handler
function article_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();
if ($um->get_param('search_id')) {
//Article page
$id = $um->get_param('search_id');
require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
$al = Articles_list::factory();
$sm->article = $al->get_article_by_id($id);
if ($sm->article !== false) {
$sm->set_categories();
$category = $sm->categories->list[$sm->article->get_category_id()];
if ($um->isset_param('force_template') && $sm->user && $sm->user->is_admin() && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'article/' . $um->get_param('force_template'))) {
$template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'article/' . $um->get_param('force_template'));
} else {
$template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'article/' . $category->get_article_template());
}
// 1. is user and is admin
// 2. is user and can read article category
// 3. guest and can read article category
if ($sm->user && ($sm->user->is_admin() || $sm->user->can('READ', 'Categories', $category->id)) || !$sm->user && $sm->guest_group && $sm->guest_group->can('READ', 'Categories', $category->id)) {
if (!defined('VIVVO_ADMIN_MODE')) {
if (($sm->article->status == 0 || strtotime($sm->article->created) > VIVVO_START_TIME) && !($sm->user && $sm->user->can('ACCESS_ADMIN'))) {
go_404();
}
$sm->article->on_display();
}
$template->assign('CURRENT_CATEGORY', $category);
if (isset($sm->article->author_obj)) {
$template->assign('CURRENT_AUTHOR', $sm->article->author_obj);
}
// revision view:
// 1. both 'news' and 'rev' parameters must be passed trough GET
// 2. 'news' parameter must be equal to 'search_id' parameter from url_manager
// 3. user must have EDITOR privilege for this category, or be an author of article (with WRITE privilege)
if (!empty($_GET['news']) and $_GET['news'] == $sm->article->get_id() and !empty($_GET['rev']) and $sm->user and ($sm->user->is('EDITOR', 'Categories', $category->get_id()) or count($sm->user->get_privilege_object_ids('WRITE', 'Categories')) and $sm->user->get_id() == $sm->article->get_user_id())) {
class_exists('ArticlesRevisions') or (require VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/ArticlesRevisions.class.php');
$revision = ArticlesRevisions_list::factory()->get_revision_by_article_id_ver($sm->article->get_id(), $_GET['rev'] << 0);
if ($revision) {
$sm->article->set_title($revision->get_title());
$sm->article->set_abstract($revision->get_abstract());
$sm->article->set_body($revision->get_body());
}
}
// end revision view
// add this article to printed list
$sm->printed_articles[] = $sm->article->get_id();
$template->assign('article', $sm->article);
if (!defined('VIVVO_ADMIN_MODE')) {
if (VIVVO_MODULES_FEED == 1) {
$header->add_rss(switch_format('rss', CURRENT_URL), $sm->article->get_title());
if (VIVVO_FRIENDY_URL) {
$header->add_rss(switch_format('rss', VIVVO_URL . $category->get_href()), $category->category_name);
} else {
$header->add_rss(switch_format('rss', $category->get_href()), $category->category_name);
}
}
$sm->page_title = $sm->article->get_title();
if ($um->isset_param('print')) {
$sm->set_theme($category->get_css(), true);
} else {
$sm->set_theme($category->get_css());
}
}
$sm->_template->assign('PAGE_TITLE', strval($sm->article->title));
$um->set_param('search_cid', $category->id);
} else {
$template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl');
$template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_RESTRICTED_ACCESS')));
$content_template = new template($sm, $template);
$content_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'system/restricted.tpl');
$template->assign_template('PAGE_CONTENT', $content_template);
}
} else {
go_404();
}
} else {
go_404();
}
}
示例13: render_responses
/**
* Renders responses
*
* @param string $template_file
* @return string
*/
public function render_responses($template_file)
{
$template = new template(null, vivvo_lite_site::get_instance()->get_template());
$template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . $template_file);
$template->assign('comment_list', $this->respones);
return $template->get_output();
}
示例14: archive_content_handler
function archive_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';
if (VIVVO_MODULES_ARCHIVE_VIEW == 1 && $um->isset_param('search_archive')) {
//Archive view page
if ($um->get_param('search_do_advanced')) {
$sm->article_list_params = Articles_list::get_search_params_from_url($sm);
$sm->article_list_params['search_options']['search_status'] = -1;
$sm->article_list_params['search_options']['search_status_limit'] = 0;
$sm->article_list_params['search_status'] = -1;
$sm->article_list_params['search_sort_by'] = 'created';
$sm->article_list_params['search_order'] = 'ascending';
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);
}
$template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_ARCHIVE')));
} elseif ($um->get_param('search_by_year')) {
$sm->article_list_params = Articles_list::get_search_params_from_url($sm);
$sm->article_list_params['search_options'] = array();
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_options']['search_status'] = -1;
$sm->article_list_params['search_options']['search_status_limit'] = 0;
$sm->article_list_params['search_status'] = -1;
$sm->article_list_params['search_sort_by'] = 'created';
$sm->article_list_params['search_order'] = 'ascending';
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);
}
$template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_ARCHIVE')));
} else {
$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 . 'box/archive_search.tpl');
$template->assign_template('PAGE_CONTENT', $content_template);
$template->assign('PAGE_TITLE', strval($sm->_lang->get_value('LNG_SEARCH_BUTTON') . ' ' . strtolower($sm->_lang->get_value('LNG_ARCHIVE'))));
}
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();
}
}
示例15: template
function get_admin_content(&$sm)
{
$template =& $sm->get_template();
$um =& $sm->get_url_manager();
$pm =& $sm->get_plugin_manager();
$content_template = new template($sm, $template);
if ($um->get_param('search_id')) {
$content_template->assign('search_id', $um->get_param('search_id'));
}
$content_template->set_template_file(VIVVO_FS_PLUGIN_ROOT . $pm->plugins['image_gallery']['root_dir'] . 'admin/templates/image_list.xml');
echo $content_template->get_output();
}