3 * GForge Monitor Diary Page
5 * Copyright 1999-2001 (c) VA Linux Systems
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge 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
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../env.inc.php');
28 require_once $gfwww.'include/pre.php';
30 if (!session_loggedin()) {
37 User obviously has to be logged in to monitor
40 $diary_user = getStringFromRequest('diary_user');
43 First check to see if they are already monitoring
44 If they are, unmonitor by deleting row.
45 If they are NOT, then insert a row into the db
48 $HTML->header (array('title'=>_('Monitor a User')));
51 <h2>'._('Monitor a User').'</h2>';
53 $sql="SELECT * FROM user_diary_monitor WHERE user_id='".user_getid()."' AND monitored_user='$diary_user';";
55 $result = db_query($sql);
57 if (!$result || db_numrows($result) < 1) {
59 User is not already monitoring thread, so
60 insert a row so monitoring can begin
62 $sql="INSERT INTO user_diary_monitor (monitored_user,user_id) VALUES ('$diary_user','".user_getid()."')";
64 $result = db_query($sql);
67 echo "<span class=\"error\">"._('Error inserting into user_diary_monitor')."</span>";
69 echo "<span class=\"feedback\">"._('User is now being monitored')."</span>";
70 echo _('<p>You will now be emailed this user\'s diary entries.</p><p>To turn off monitoring, simply click the <strong>Monitor user</strong> link again.</p>');
75 $sql="DELETE FROM user_diary_monitor WHERE user_id='".user_getid()."' AND monitored_user='$diary_user';";
76 $result = db_query($sql);
77 echo "<span class=\"feedback\">"._('Monitoring has been turned off')."</span>";
78 echo _('You will not receive any more emails from this user');
81 $HTML->footer (array());
83 $HTML->header (array('title'=>_('Choose a User first')));
85 <h1>'._('Error - Choose a User To Monitor First').'</h1>';
86 $HTML->footer (array());