} #Welcome text if ($cfg['bugsIntro']) { $view->info($cfg['bugsIntro']); } #Page title $view->title = $lang['BUGS']; #Get categories $res = $db->query('SELECT c.ID,c.name,c.dsc,c.post,c.num,c.last,s.title FROM ' . PRE . 'bugcats c LEFT JOIN ' . PRE . 'bugsect s ON c.sect = s.ID WHERE c.see=1 OR c.see="' . LANG . '" ORDER BY s.seq,c.name'); $cat = array(); $sect = ''; $show = 0; $num = 0; foreach ($res as $x) { #Section if ($x['title'] != $sect) { $sect = $x['title']; $show = 1; } elseif ($show == 1) { $show = 0; } $cat[] = array('url' => url('bugs/list/' . $x['ID']), 'num' => $x['num'], 'title' => $x['name'], 'desc' => $x['dsc'], 'class' => BugIsNew('', $x['last']) ? 'bugCatNew' : 'bugCat', 'section' => $show ? $sect : false); ++$num; } #No category if (!$num) { $view->info($lang['nocats']); } else { $view->css('plugins/bugs/style/bugs.css'); $view->add('cats', array('cat' => &$cat)); }
} #Page number if (isset($URL[3]) && is_numeric($URL[3]) && $URL[3] > 1) { $page = $URL[3]; $st = ($page - 1) * $cfg['bugsNum']; } else { $page = 1; $st = 0; } #Get issues $res = $db->prepare('SELECT ID,name,num,date,status,level FROM ' . PRE . 'bugs WHERE cat=?' . (admit('BUGS') ? '' : ' AND status!=5') . ' ORDER BY ID DESC LIMIT ?,?'); $res->bindValue(1, $id, 1); $res->bindValue(2, $st, 1); $res->bindValue(3, $cfg['bugsNum'], 1); $res->execute(); $all = array(); $num = 0; foreach ($res as $x) { $all[] = array('id' => $x['ID'], 'title' => $x['name'], 'status' => $x['status'], 'lv' => $x['level'], 'num' => $x['num'], 'url' => url('bugs/' . $x['ID']), 'date' => genDate($x['date'], 1), 'class' => BugIsNew('', $x['date']) ? 'New' : 'Old', 'level' => $lang['L' . $x['level']]); ++$num; } #Pages if (!$num) { $view->info($lang['noc']); } elseif ($cat['num'] > $num) { $pages = pages($page, $cat['num'], $cfg['bugsNum'], url('bugs/list/' . $id), 0, '/'); } else { $pages = ''; } #template $view->add('bugs', array('issue' => &$all, 'postURL' => BugRights($cat['post']) ? url('bugs/post', 'f=' . $id) : false));