r1587: Adding the release preparation script
[bugdar.git] / index.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'trackerhome',
24 'trackerhome_bits',
25 'list_head',
26 'pagenav',
27 'pagenav_bit'
28 );
29
30 define('SVN', '$Id$');
31
32 $focus['index'] = 'focus';
33
34 require_once('./global.php');
35 require_once('./includes/class_sort.php');
36
37 if (!can_perform('canviewbugs'))
38 {
39 $message->errorPermission();
40 }
41
42 $sort = new ListSorter('index');
43 LoadPaginationFramework();
44
45 // ###################################################################
46
47 $count = $db->query_first("
48 SELECT COUNT(*) AS count
49 FROM " . TABLE_PREFIX . "bug
50 WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (hidden AND userid = " . $bugsys->userinfo['userid'] . " AND product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")
51 AND product IN (" . fetch_on_bits('canviewbugs') . ")" . (($bugsys->options['hidestatuses'] OR isset($bugsys->userinfo['hidestatuses'])) ? "
52 AND status NOT IN (" . ($bugsys->userinfo['hidestatuses'] != '' ? $bugsys->userinfo['hidestatuses'] : $bugsys->options['hidestatuses']) . ")" : "")
53 );
54
55 if (!$count['count'])
56 {
57 $message->error(_('There are no bugs to display. This could be because you do not have permission to view bugs, or there may be none in the database.'));
58 }
59
60 $pagination->setTotal($count['count']);
61 $pagination->splitPages();
62
63 $bugs_fetch = $db->query($sort->fetch_sql_query(null, $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()));
64
65 while ($bug = $db->fetch_array($bugs_fetch))
66 {
67 $funct->exec_swap_bg('altcolor', '');
68 $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour);
69 $bugs .= $sort->constructRow($bug);
70 }
71
72 $db->free_result($bugs_fetch);
73
74 $columnHeads = $sort->constructColumnHeaders(true, 'p=' . $pagination->page . '&amp;pp=' . $pagination->perpage);
75 $show['pagenav'] = ($pagination->getPageCount() > 1);
76 $pagenav = $pagination->constructPageNav($sort->fetch_sort_link($sort->sortkey));
77
78 eval('$template->flush("' . $template->fetch('trackerhome') . '");');
79
80 /*=====================================================================*\
81 || ###################################################################
82 || # $HeadURL$
83 || # $Id$
84 || ###################################################################
85 \*=====================================================================*/
86 ?>