function show_full_list($category = false, $count = false)
 {
     global $offset, $search, $page;
     isset($offset) || ($offset = 0);
     isset($search) || ($search = false);
     $this->tpl->set_file('temp', 'news/tpl/news_list.html', 1);
     $this->tpl->set_var('newslist_page', $this->ini->read_var('avnews', 'newslist_page'));
     if (!empty($category)) {
         $info = $this->get_category_info($category);
         $this->tpl->set_var('category_info_info', $info['info'] . '<br>');
         $this->tpl->set_var('page_title', 'naujienos : ' . $info['name']);
     } else {
         $this->tpl->set_var('category_info_info', '');
         $category = false;
         $this->tpl->set_var('page_title', 'ðvieþiausios naujienos');
     }
     $ts = getmicrotime();
     $list = $this->get_full_list($category, $offset, $this->ini->read_var('avnews', 'item_count'), $search);
     if (isset($GLOBALS['bench'])) {
         echo "<br>check-news1: " . round(getmicrotime() - $ts, 2);
     }
     for ($i = 0; isset($list[$i]); $i++) {
         $list[$i]['file'] && ($list[$i]['file'] = '<img src="' . $this->ini->read_var('avnews', 'image_url') . $list[$i]['file'] . '" hspace=2 vspace=2 align="left">');
         if ($list[$i]['read_more'] < 100) {
             $list[$i]['read_more'] = '';
         } else {
             $list[$i]['read_more'] = $this->tpl->get_var('read_more');
         }
     }
     $this->tpl->set_var('navigator', avNavigator::show($offset, $this->get_full_list_count($category, $search), $this->ini->read_var('avnews', 'item_count'), 'navigator_link', &$this, 'news_list_self_link'));
     $this->tpl->set_var('search', $search);
     $this->tpl->set_loop('list', $list);
     $this->tpl->set_var('news_header_block', '');
     if ($page == $this->ini->read_var('avnews', 'newslist_page')) {
         $this->tpl->process('news_header_block', 'news_header');
     }
     return $this->tpl->process('out', 'temp', 2);
 }
 function show_thread_list($forum_id)
 {
     $in_page = 30;
     global $offset;
     empty($offset) && ($offset = 0);
     $this->tpl->set_file('file_thread_list', 'forum/tpl/forum_thread_list.html', 1);
     $mas = $this->get_threads_with_count((int) $forum_id);
     if (!$this->forum_exits($forum_id)) {
         return $this->userErr->Out("Tokio forumo nëra arba ávyko nenumatyta klaida, pasitikrinkit URL!");
     }
     $cnt = count($mas);
     // Apdorojimas pries parodyma
     // 1. striptags, 2. do_ubb
     $newlist = array();
     for ($x = $offset; $x < $offset + $in_page && isset($mas[$x]); $x++) {
         $mas[$x]['name'] = do_ubb(htmlspecialchars($mas[$x]['name']));
         $mas[$x]['username'] = htmlspecialchars($mas[$x]['username']);
         $mas[$x]['sticky'] == 'Y' ? $mas[$x]['image'] = 'sticky' : ($mas[$x]['image'] = 'rod');
         $newlist[] = $mas[$x];
     }
     $this->tpl->set_var('navigator', avNavigator::show($offset, count($mas), $in_page, false, &$this, 'thread_self_link'));
     $this->tpl->set_loop('list', $newlist);
     $forum_info = $this->get_forum($forum_id);
     $this->tpl->set_var('page_title', $forum_info['name']);
     $this->tpl->set_var('category_info_info', $forum_info['description']);
     $this->tpl->set_var('forum_id', $forum_info['id']);
     if (!isset($this->user->id) || empty($this->user->id)) {
         $this->tpl->set_var('infotext', $this->tpl->process('PleaseLogin', 'PleaseLogin'));
     } else {
         if ($this->thread_error != '') {
             $this->tpl->set_var('threadtext', htmlspecialchars(stripslashes($GLOBALS['subject'])));
             $this->tpl->set_var('threadbody', htmlspecialchars(stripslashes($GLOBALS['body'])));
             $out = $this->userErr->Out($this->thread_error);
             $out .= '<br><br>';
             $out .= $this->tpl->process('NewThread', 'NewThread');
             $this->tpl->set_var('infotext', $out);
         } else {
             $this->tpl->set_var('threadtext', '');
             $this->tpl->set_var('threadbody', '');
             $this->tpl->set_var('infotext', $this->tpl->process('NewThread', 'NewThread'));
         }
     }
     return $this->tpl->process('temp_out', 'file_thread_list', 2);
 }
 function show_list()
 {
     global $menuname, $category, $search, $user, $order, $count, $offset, $g_usr, $g_user_id;
     $this->tpl->set_file('list_tpl', 'darbai/tpl/list.html', 1);
     isset($menuname) || ($menuname = 'works_list');
     isset($category) || ($category = false);
     isset($search) || ($search = '');
     isset($order) || ($order = false);
     isset($user) || ($user = false);
     isset($offset) || ($offset = 0);
     isset($count) || ($count = 3);
     $count_sel[] = array('text' => '8', 'value' => '2');
     $count_sel[] = array('text' => '12', 'value' => '3');
     $count_sel[] = array('text' => '16', 'value' => '4');
     $count_sel[] = array('text' => '20', 'value' => '5');
     $sort_sel[] = array('text' => 'datà', 'value' => 'date');
     $sort_sel[] = array('text' => 'perþiûras', 'value' => 'views');
     $sort_sel[] = array('text' => 'balus', 'value' => 'summark');
     $sort_sel[] = array('text' => 'vid. balà', 'value' => 'mark');
     $this->tpl->set_var('count_sel', html_build_select('count', $count_sel, 'value', 'text', $count, 'inputfield'));
     $this->tpl->set_var('sort_sel', html_build_select('order', $sort_sel, 'value', 'text', $order, 'inputfield'));
     $this->tpl->set_var('order', $order);
     $this->tpl->set_var('count', $count);
     $this->tpl->set_var('menuname', $menuname);
     $this->tpl->set_var('category', $category);
     $this->tpl->set_var('search', $search);
     $this->tpl->set_var('order', $order);
     $this->tpl->set_var('user', $user);
     $this->tpl->set_var('count', $count);
     switch ($menuname) {
         case 'works_user':
             isset($user) || redirect('/');
             $category = false;
             $count_sel = array();
             $count_sel[] = array('text' => '6', 'value' => '2');
             $count_sel[] = array('text' => '9', 'value' => '3');
             $count_sel[] = array('text' => '12', 'value' => '4');
             $count_sel[] = array('text' => '15', 'value' => '5');
             $this->tpl->set_var('count_sel', html_build_select('count', $count_sel, 'value', 'text', $count, 'inputfield'));
             $info = $g_usr->get_user_info($user);
             $this->tpl->set_var('page_title', $info['username']);
             $this->tpl->set_var('title', '');
             $this->tpl->set_var('category_info_info', 'dalyvio <b>' . $info['username'] . '</b> darbø sàraðas<br>');
             $this->tpl->set_var('category', $info);
             $this->tpl->set_var('navigator', avNavigator::show($offset, $this->sql->get_full_list_count($category, $search, $user), $count * 3, 'navigator_link', &$this, 'works_list_self_link'));
             $list = $this->sql->get_full_list($category, $offset, $count * 3, $search, $order, $user);
             if ($user == $g_user_id) {
                 $show_delete = 1;
             } else {
                 $show_delete = 0;
             }
             if (in_array($g_usr->group_id, array(1, 4))) {
                 $show_delete = 1;
             }
             $this->tpl->set_var('list_block', $this->show_list_items('user_item', &$list, 3, $show_delete));
             break;
         case 'works_favourites':
             isset($user) || redirect('/');
             $category = false;
             $count_sel = array();
             $count_sel[] = array('text' => '6', 'value' => '2');
             $count_sel[] = array('text' => '9', 'value' => '3');
             $count_sel[] = array('text' => '12', 'value' => '4');
             $count_sel[] = array('text' => '15', 'value' => '5');
             $this->tpl->set_var('count_sel', html_build_select('count', $count_sel, 'value', 'text', $count, 'inputfield'));
             $info = $g_usr->get_user_info($user);
             $this->tpl->set_var('page_title', $info['username']);
             $this->tpl->set_var('title', '');
             $this->tpl->set_var('category_info_info', 'dalyviui <b>' . $info['username'] . '</b> labiausiai patikusiø darbø sàraðas<br>');
             $this->tpl->set_var('category', $info);
             $this->tpl->set_var('navigator', avNavigator::show($offset, $this->sql->get_full_list_count('favourites', $search, $user), $count * 3, 'navigator_link', &$this, 'works_list_self_link'));
             $list = $this->sql->get_full_list('favourites', $offset, $count * 3, $search, $order, $user);
             $this->tpl->set_var('list_block', $this->show_list_items('fav_item', &$list, 3));
             break;
         case 'works_category':
             isset($category) || redirect('/');
             $info = $this->sql->get_category_info($category);
             $this->tpl->set_var('page_title', $info['name']);
             $this->tpl->set_var('title', $info['name']);
             $this->tpl->set_var('category_info_info', $info['info'] . '<br>');
             $this->tpl->set_var('category', $info);
             $this->tpl->set_var('navigator', avNavigator::show($offset, $this->sql->get_full_list_count($category, $search), $count * 4, 'navigator_link', &$this, 'works_list_self_link'));
             $list = $this->sql->get_full_list($category, $offset, $count * 4, $search, $order, $user);
             $this->tpl->set_var('list_block', $this->show_list_items('category_item', &$list, 4));
             break;
         default:
             $this->tpl->set_var('page_title', 'visi darbai');
             $this->tpl->set_var('title', 'visi darbai');
             $this->tpl->set_var('category_info_info', '');
             $this->tpl->set_var('navigator', avNavigator::show($offset, $this->sql->get_full_list_count($category, $search), $count * 4, 'navigator_link', &$this, 'works_list_self_link'));
             $list = $this->sql->get_full_list($category, $offset, $count * 4, $search, $order, $user);
             $this->tpl->set_var('list_block', $this->show_list_items('norm_item', &$list, 4));
     }
     return $this->tpl->process('out', 'list_tpl', 1);
 }