r860: Renaming the branch to be the right name
[bugdar.git] / favourite.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 define('SVN', '$Id$');
14
15 $focus['showreport'] = 'focus';
16
17 require_once('./global.php');
18
19 // ###################################################################
20
21 if (empty($_REQUEST['do']))
22 {
23 $message->error($lang->getlex('error_invalid_id'));
24 }
25
26 // ###################################################################
27
28 if ($_REQUEST['do'] == 'handle')
29 {
30 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
31 if (!$bug OR (!can_perform('canviewhidden', $bug['productid']) AND $bug['hidden']))
32 {
33 $message->error($lang->getlex('error_invalid_id'));
34 }
35
36 if (!can_perform('cansubscribe', $bug['productid']) OR !can_perform('canviewbugs', $bug['productid']))
37 {
38 $message->error_permission();
39 }
40
41 if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "favourite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . intval($bugsys->in['bugid'])))
42 {
43 $db->query("DELETE FROM " . TABLE_PREFIX . "favourite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . intval($bugsys->in['bugid']));
44 $message->redirect($lang->string('This bug has been removed from your favourites list.'), "showreport.php?bugid=" . intval($bugsys->in['bugid']));
45 }
46 else
47 {
48 $db->query("INSERT INTO " . TABLE_PREFIX . "favourite (userid, bugid) VALUES (" . $bugsys->userinfo['userid'] . ", " . intval($bugsys->in['bugid']) . ")");
49 $message->redirect($lang->string('This bug has been added to your favourites list.'), "showreport.php?bugid=" . intval($bugsys->in['bugid']));
50 }
51 }
52
53 /*=====================================================================*\
54 || ###################################################################
55 || # $HeadURL$
56 || # $Id$
57 || ###################################################################
58 \*=====================================================================*/
59 ?>