Пример #1
0
 function main()
 {
     parent::main();
     //$smarty = $this->smarty;
     // parameters for the list
     // start offset and count (now defaults to 8...)
     $this->smarty->assign('categories_all', entry_categories_get('defs'));
     $this->smarty->assign('saved_flags', entry_flags_get());
     $defcount = 8;
     // <-- no magic numbers! todo: add config option?
     global $fpdb;
     if (!empty($_REQUEST['entry'])) {
         utils_redirect('admin.php?p=entry&action=write&entry=' . $_REQUEST['entry']);
     }
     isset($_REQUEST['m']) ? $params['m'] = $_REQUEST['m'] : null;
     isset($_REQUEST['y']) ? $params['y'] = $_REQUEST['y'] : null;
     // $params['start'] = isset($_REQUEST['start'])? $_REQUEST['start'] : 0;
     $params['count'] = isset($_REQUEST['count']) ? $_REQUEST['count'] : $defcount;
     $params['page'] = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
     isset($_REQUEST['category']) ? $params['category'] = $_REQUEST['category'] : ($params['category'] = 'all');
     $params['fullparse'] = false;
     $params['comments'] = true;
     $fpdb->query($params);
     return 0;
 }
Пример #2
0
 function categories($force = true)
 {
     if ($this->categories) {
         return;
     }
     if ($force || !file_exists(PRETTYURLS_CATS)) {
         $d = entry_categories_get('defs');
         $list = array();
         foreach ($d as $k => $v) {
             $list[$k] = sanitize_title($v);
         }
         io_write_file(PRETTYURLS_CATS, serialize($list));
     } else {
         $f = io_load_file(PRETTYURLS_CATS);
         $list = unserialize($f);
     }
     $this->categories = $list;
 }
Пример #3
0
 function init()
 {
     #if (!$this->_indexer) {
     #$this->_indexer = new entry_indexer();
     $this->_categories = entry_categories_get();
     #$obj =& $this->_indexer;
     #$this->entry_index = $obj->getList();
     #}
 }
Пример #4
0
function theme_entry_categories($cats, $link = true, $separator = ', ')
{
    if (!$cats) {
        return;
    } else {
        $filed = array();
        if ($tmp1 = entry_categories_get('defs')) {
            foreach ($tmp1 as $k => $c) {
                if (array_intersect(array($k), $cats)) {
                    $filed[] = $link ? "<a href=\"" . get_category_link($k) . "\">{$c}</a>" : $c;
                }
            }
        }
        if ($filed) {
            return implode($separator, $filed);
        }
    }
}