Esempio n. 1
0
 function show_more()
 {
     header('Content-Type: text/html; charset=utf-8');
     global $display;
     $anchor_index = intval(Url::get('anchor_index', 0));
     $cid = intval(Url::get('cid', 0));
     if ($cid != 0) {
         $where = ' AND category_id = ' . $cid;
     }
     $item_per_page = 20;
     $list_news = News::get_news($where, $anchor_index * $item_per_page, $item_per_page + 1);
     if (count($list_news) == $item_per_page + 1) {
         $is_next = 1;
         array_pop($list_news);
     } else {
         $is_next = 0;
     }
     if (empty($list_news)) {
         exit;
     }
     $display->add('list_news', $list_news);
     $display->add('anchor_index', $anchor_index);
     $display->add('is_next', $is_next);
     $display->output('CmsNews/ajax/ShowMore');
     exit;
 }
Esempio n. 2
0
File: list.php Progetto: hqd276/bigs
 function draw()
 {
     global $display;
     $type = (int) $_SESSION['type'];
     if ($type < 0) {
         $type = 0;
     }
     $cat_id = intval(Url::get('catid', 0));
     if ($cat_id != 0) {
         $where = ' AND category_id = ' . $cat_id;
     }
     $where .= ' AND type = ' . $type;
     $item_per_page = 5;
     $list_news = News::get_news($where, 0, $item_per_page);
     if (count($list_news > 0)) {
         foreach ($list_news as $key => $value) {
             // $list_news[$key]['title'] = Util::split_char($value['title'],40,-1) . ' ...';
             if ($value['uid'] > 0) {
                 $author = User::getUserById($value['uid']);
                 // var_dump($author);die;
                 if ($author['full_name'] == '') {
                     $list_news[$key]['author'] = $author['user_name'];
                 } else {
                     $list_news[$key]['author'] = $author['full_name'];
                 }
             }
         }
     }
     $display->add('list_news', $list_news);
     $display->add('cid', $cat_id);
     $display->add('uid', User::id());
     $display->output("List");
 }
Esempio n. 3
0
    if ($settings['enable_fullfeeds'] && $_GET['get_1'] == 'rss-fullfeed') {
        $template->assign('rss_items', $news->get_feed($settings['rss_maximum_items'], true));
        if (isset($cache)) {
            $cache->cacheId = PAGE . ',rss-fullfeed';
        }
    } else {
        $template->assign('rss_items', $news->get_feed($settings['rss_maximum_items'], false));
        if (isset($cache)) {
            $cache->cacheId = PAGE . ',rss';
        }
    }
    $template->assign('wfw', $news->wfw);
    $content_type = 'text/xml';
    $template_file = 'rss.tpl';
} else {
    $template->assign('news', $news->get_news());
    $template->assign('current_category', htmlspecialchars($news->category));
    $template->assign('current_category_urlencoded', $news->category_urlencoded);
    $template->assign('subtemplate', 'news.inc.tpl');
    $template->assign('pagination', pagination($news->total_pages, $news->current_page));
    if (isset($cache)) {
        if ($news->category && $news->current_page == 1) {
            $cache->cacheId = PAGE . ',' . CATEGORY_IDENTIFIER . str_replace('&', AMPERSAND_REPLACEMENT, $news->category);
        } elseif ($news->current_page > 1) {
            if ($news->category) {
                $category = CATEGORY_IDENTIFIER . str_replace('&', AMPERSAND_REPLACEMENT, $news->category);
            } else {
                $category = '';
            }
            $cache->cacheId = PAGE . ',' . $category . ',' . $news->current_page;
        } else {