2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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 [#]gpl[#] of the License.
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
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 \*=====================================================================*/
22 define('SVN', '$Id$');
24 if (empty($_REQUEST['do']))
26 $_REQUEST['do'] = 'manage
';
29 $focus[ ($_REQUEST['do'] == 'handle
' ? 'showreport
' : 'favourites
') ] = 'focus
';
31 $fetchtemplates = array(
36 require_once('./global.php
');
38 // ###################################################################
40 if ($_REQUEST['do'] == 'handle
')
42 $bugsys->input_clean('bugid
', TYPE_UINT);
43 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $bugsys->in['bugid
']);
44 if (!$bug OR (!can_perform('canviewhidden
', $bug['productid
']) AND $bug['hidden
']))
46 $message->error($lang->getlex('error_invalid_id
'));
49 if (!can_perform('cansubscribe
', $bug['productid
']) OR !can_perform('canviewbugs
', $bug['productid
']))
51 $message->error_permission();
54 if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "favourite WHERE userid = " . $bugsys->userinfo['userid
'] . " AND bugid = " . $bugsys->in['bugid
']))
56 $db->query("DELETE FROM " . TABLE_PREFIX . "favourite WHERE userid = " . $bugsys->userinfo['userid
'] . " AND bugid = " . $bugsys->in['bugid
']);
57 $message->redirect($lang->string('This bug has been removed from your favourites
list.'), "showreport.php?bugid=" . $bugsys->in['bugid
']);
61 $db->query("INSERT INTO " . TABLE_PREFIX . "favourite (userid, bugid) VALUES (" . $bugsys->userinfo['userid
'] . ", " . $bugsys->in['bugid
'] . ")");
62 $message->redirect($lang->string('This bug has been added to your favourites
list.'), "showreport.php?bugid=" . $bugsys->in['bugid
']);
66 // ###################################################################
68 if ($_REQUEST['do'] == 'manage
')
70 $favourites = $db->query("
71 SELECT favourite.bugid, bug.* FROM " . TABLE_PREFIX . "favourite AS favourite
72 RIGHT JOIN " . TABLE_PREFIX . "bug AS bug
73 ON (favourite.bugid = bug.bugid)
74 WHERE favourite.userid = " . $bugsys->userinfo['userid
']
76 while ($bug = $db->fetch_array($favourites))
78 $funct->exec_swap_bg($stylevar['alt_colour
'], '');
79 $bug['bgcolour
'] = ($bugsys->userinfo['showcolours
'] ? $bugsys->datastore['status
']["$bug[status]"]['color
'] : $funct->bgcolour);
80 $bug['product
'] = $bugsys->datastore['product
']["$bug[productid]"]['title
'];
81 $bug['version
'] = $bugsys->datastore['version
']["$bug[versionid]"]['version
'];
82 $bug['status
'] = $bugsys->datastore['status
']["$bug[status]"]['status
'];
83 $bug['resolution
'] = $bugsys->datastore['resolution
']["$bug[resolution]"]['resolution
'];
84 $bug['priority
'] = $bugsys->datastore['priority
']["$bug[priority]"]['priority
'];
85 $bug['severity
'] = $bugsys->datastore['severity
']["$bug[severity]"]['severity
'];
87 $bug['hiddendisplay
'] = ((!can_perform('canviewhidden
', $bug['productid
']) AND $bug['hiddenlastposttime
']) ? true : false);
89 $bug['lastposttime
'] = ($bug['hiddendisplay
'] ? $bug['hiddenlastposttime
'] : $bug['lastposttime
']);
90 $bug['lastpost
'] = ($bug['hiddendisplay
'] ? $bug['hiddenlastpostbyname
'] : $bug['lastpostbyname
']);
92 $bug['lastposttime
'] = $datef->format($bugsys->options['dateformat
'], $bug['lastposttime
']);
93 eval('$bugs .= "' . $template->fetch('trackerhome_bits') . '";');
96 eval('$template->flush("' . $template->fetch('favourites') . '");');
99 /*=====================================================================*\
100 || ###################################################################
103 || ###################################################################
104 \*=====================================================================*/