5 * Copyright 1999-2001, Tim Perdue - Sourceforge
6 * Copyright 2002, Tim Perdue - GForge, LLC
7 * Copyright 2010 (c) Franck Villaume - Capgemini
8 * http://fusionforge.org
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once '../env.inc.php';
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfcommon.'forum/ForumHTML.class.php';
29 require_once $gfcommon.'forum/Forum.class.php';
31 session_require_login();
33 $forum_id = getIntFromRequest('forum_id');
34 $group_id = getIntFromRequest('group_id');
36 if ($forum_id && $group_id) {
38 // Set up local objects
40 $g = group_get_object($group_id);
41 if (!$g || !is_object($g) || $g->isError()) {
45 $f=new Forum($g,$forum_id);
46 if (!$f || !is_object($f)) {
47 exit_error(_('Error Getting Forum'),'forums');
48 } elseif ($f->isError()) {
49 exit_error($f->getErrorMessage(),'forums');
52 if (getStringFromRequest('stop')) {
53 $confirm = getStringFromRequest('confirm');
54 $cancel = getStringFromRequest('cancel');
56 session_redirect('/forum/forum.php?forum_id='.$forum_id.'&group_id='.$group_id);
59 forum_header(array('title'=>_('Stop Monitoring'), 'modal' => 1));
60 echo $HTML->confirmBox(
61 sprintf(_('You are about to stop monitoring the %1$s forum.'),$f->getName()).
63 _('Do you really want to unsubscribe ?'),
64 array('group_id' => $group_id, 'forum_id' => $forum_id, 'stop' => 1),
65 array('confirm' => _('Unsubscribe'), 'cancel' => _('Cancel')) );
66 forum_footer(array());
69 if (!$f->stopMonitor()) {
70 exit_error($f->getErrorMessage(),'forums');
72 session_redirect('/forum/forum.php?forum_id='.$forum_id.'&group_id='.$group_id.'&feedback='.urlencode(_('Forum monitoring deactivated')));
74 } elseif(getIntFromRequest('start')) {
75 if (!$f->setMonitor()) {
76 exit_error($f->getErrorMessage(),'forums');
78 session_redirect('/forum/forum.php?forum_id='.$forum_id.'&group_id='.$group_id.'&feedback='.urlencode(_('Forum monitoring started')));
82 exit_missing_param('',array(_('Forum ID'),_('Project ID')),'forums');