r303: Added SVN constant to user files; now ISSO debug information shows SVN details.
[bugdar.git] / favourite.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]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 require_once('./global.php');
16
17 if (!$bugsys->userinfo['userid'])
18 {
19 $message->error_permission();
20 }
21
22 // ###################################################################
23
24 if (empty($_REQUEST['do']))
25 {
26 $message->error(lang::p('error_invalid_id'));
27 }
28
29 // ###################################################################
30
31 if ($_REQUEST['do'] == 'handle')
32 {
33 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']) . ((!can_perform('canviewhidden')) ? " AND !bug.hidden" : ''));
34 if (!$bug)
35 {
36 $message->error(lang::p('error_invalid_id'));
37 }
38
39 if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "favourite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . intval($bugsys->in['bugid'])))
40 {
41 $db->query("DELETE FROM " . TABLE_PREFIX . "favourite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . intval($bugsys->in['bugid']));
42 $message->redirect('Favourite removed', "showreport.php?bugid=" . intval($bugsys->in['bugid']));
43 }
44 else
45 {
46 $db->query("INSERT INTO " . TABLE_PREFIX . "favourite (userid, bugid) VALUES (" . $bugsys->userinfo['userid'] . ", " . intval($bugsys->in['bugid']) . ")");
47 $message->redirect('Favourite added', "showreport.php?bugid=" . intval($bugsys->in['bugid']));
48 }
49 }
50
51 /*=====================================================================*\
52 || ###################################################################
53 || # $HeadURL$
54 || # $Id$
55 || ###################################################################
56 \*=====================================================================*/
57 ?>