5 * Copyright 1999-2001 (c) VA Linux Systems
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once('../env.inc.php');
25 require_once $gfcommon.'include/pre.php';
27 if (!session_loggedin()) {
34 User obviously has to be logged in to monitor
37 $diary_user = getStringFromRequest('diary_user');
40 First check to see if they are already monitoring
41 If they are, unmonitor by deleting row.
42 If they are NOT, then insert a row into the db
45 site_user_header(array('title'=>_('Monitor a User')));
47 $result = db_query_params ('SELECT * FROM user_diary_monitor WHERE user_id=$1 AND monitored_user=$2;',
50 if (!$result || db_numrows($result) < 1) {
52 User is not already monitoring thread, so
53 insert a row so monitoring can begin
55 $result = db_query_params ('INSERT INTO user_diary_monitor (monitored_user,user_id) VALUES ($1,$2)',
60 echo '<p class="error">' . _('Error inserting into user_diary_monitor') . '</p>';
62 echo '<p class="feedback">' . _('User is now being monitored') . '</p>';
63 echo '<p>' . _("You will now be emailed this user's diary entries.") . '</p>';
64 echo '<p>' . _('To turn off monitoring, simply click the <strong>Monitor user</strong> link again.') . '</p>';
68 $result = db_query_params ('DELETE FROM user_diary_monitor WHERE user_id=$1 AND monitored_user=$2',
71 echo '<p class="feedback">' . _('Monitoring has been turned off') . "</p>";
72 echo _('You will not receive any more emails from this user');
75 $HTML->footer (array());
77 $HTML->header(array('title'=>_('Error - Choose a User To Monitor First')));
78 $HTML->footer (array());