r860: Renaming the branch to be the right name
[bugdar.git] / index.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 $fetchtemplates = array(
14 'trackerhome',
15 'trackerhome_bits',
16 'pagenav',
17 'pagenav_bit'
18 );
19
20 define('SVN', '$Id$');
21
22 $focus['index'] = 'focus';
23
24 require_once('./global.php');
25 require_once('./includes/class_pagination.php');
26
27 if (!can_perform('canviewbugs'))
28 {
29 $message->error_permission();
30 }
31
32 // ###################################################################
33
34 $pagination = new Pagination('p', 'pp');
35 $count = $db->query_first("
36 SELECT COUNT(*) AS count
37 FROM " . TABLE_PREFIX . "bug
38 WHERE (!hidden OR (hidden AND productid IN (" . fetch_on_bits('canviewhidden') . ")))
39 AND productid IN (" . fetch_on_bits('canviewbugs') . ")"
40 );
41
42 $pagination->total = $count['count'];
43 $pagination->split_pages();
44
45 $bugs_fetch = $db->query("
46 SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost, user3.displayname AS hiddenlastpost
47 FROM " . TABLE_PREFIX . "bug AS bug
48 LEFT JOIN " . TABLE_PREFIX . "user AS user1
49 ON (bug.userid = user1.userid)
50 LEFT JOIN " . TABLE_PREFIX . "user AS user2
51 ON (bug.lastpostby = user2.userid)
52 LEFT JOIN " . TABLE_PREFIX . "user AS user3
53 ON (bug.hiddenlastpostby = user3.userid)
54 WHERE bug.productid IN (" . fetch_on_bits('canviewbugs') . ")
55 AND (!hidden OR (hidden AND productid IN (" . fetch_on_bits('canviewhidden') . ")))
56 ORDER BY bug." . ((can_perform('canviewhidden')) ? "lastposttime" : "hiddenlastposttime") . " DESC
57 LIMIT " . $pagination->fetch_limit($pagination->page - 1) . ", " . $pagination->perpage
58 );
59
60 while ($bug = $db->fetch_array($bugs_fetch))
61 {
62 $funct->exec_swap_bg($stylevar['alt_colour'], '');
63 $bug['bgcolour'] = ($bugsys->userinfo['showcolours'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $funct->bgcolour);
64 $bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title'];
65 $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version'];
66 $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status'];
67 $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'];
68 $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority'];
69 $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity'];
70
71 $bug['hiddendisplay'] = ((!can_perform('canviewhidden', $bug['productid']) AND $bug['hiddenlastposttime']) ? true : false);
72
73 $bug['lastposttime'] = (($bug['hiddendisplay']) ? $bug['hiddenlastposttime'] : $bug['lastposttime']);
74 $bug['lastpost'] = (($bug['hiddendisplay']) ? $bug['hiddenlastpost'] : $bug['lastpost']);
75
76 $bug['lastposttime'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']);
77
78 eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";');
79 }
80
81 $db->free_result($bugs_fetch);
82
83 $show['pagenav'] = (($pagination->pagecount > 1) ? true : false);
84 $pagenav = $pagination->construct_page_nav('index.php');
85
86 eval('$template->flush("' . $template->fetch('trackerhome') . '");');
87
88 /*=====================================================================*\
89 || ###################################################################
90 || # $HeadURL$
91 || # $Id$
92 || ###################################################################
93 \*=====================================================================*/
94 ?>