示例#1
0
 function setup()
 {
     $this->smarty->assign('themes', theme_list());
     $this->smarty->assign('lang_list', lang_list());
     $static_list = array();
     foreach (static_getlist() as $id) {
         $static_list[$id] = static_parse($id);
     }
     $this->smarty->assign('static_list', $static_list);
 }
 function main()
 {
     if ($this->page) {
         $arr = static_parse($this->page);
         if (THEME_LEGACY_MODE) {
             theme_entry_filters($arr, null);
         }
         $this->smarty->assign('entry', $arr);
     } else {
         return 1;
     }
 }
示例#3
0
 function main()
 {
     global $lang;
     $this->smarty->assign('static_id', 'static' . date_time());
     if (isset($_GET['page'])) {
         $id = $_GET['page'];
         $arr = static_parse($id);
         // if entry does not exists,
         // we print the list
         if ($arr) {
             $this->_makePreview($arr, $id);
         }
     }
     add_filter('wp_title', array(&$this, 'makePageTitle'), 10, 2);
 }
示例#4
0
function index_staticpage($page, $explicit_req, &$params, &$module)
{
    global $smarty, $title;
    if (static_exists($page)) {
        $arr = static_parse($page);
        $title = $arr['subject'];
        if ($explicit_req) {
            add_filter('wp_title', 'index_gentitle', 1, 2);
        }
        $smarty->assign('static_id', $page);
        $smarty->assign('static_page', $arr);
        return $module = 'static.tpl';
    }
    if (user_loggedin()) {
        utils_redirect('admin.php?p=static&action=write&page=' . $page);
    } else {
        $module = index_404error();
    }
    return $module;
}
示例#5
0
function smarty_block_static($params, $content, &$smarty, &$repeat)
{
    global $fpdb;
    static $pointer = 0;
    // clean old variables
    $smarty->assign(array('subject' => '', 'content' => '', 'date' => '', 'author' => '', 'version' => '', 'id' => ''));
    if ($arr = $smarty->get_template_vars('static_page')) {
        $smarty->assign('id', $smarty->get_template_vars('static_id'));
        if (THEME_LEGACY_MODE) {
            theme_entry_filters($arr);
        }
        $smarty->assign($arr);
        return $content;
    }
    if (isset($params['content']) && is_array($params['content']) && $params['content']) {
        //foreach ($params['entry'] as $k => $val)
        $smarty->assign($params['content']);
        return $content;
    }
    if (isset($params['alwaysshow']) && $params['alwaysshow']) {
        return $content;
    }
    $list = $smarty->get_template_vars('statics');
    if (isset($list[$pointer])) {
        //foreach ($entry as $k => $val)
        $smarty->assign(static_parse($list[$pointer]));
        $smarty->assign('id', $list[$pointer]);
        $pointer++;
        $repeat = true;
    } else {
        $repeat = false;
    }
    return $content;
}