***********************
** FILE NAME : notification.php
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.3 $
+** VERSION NUMBER : $Revision: 1.4 $
**
** DESCRIPTION : Display and handle notifications.
** There are two major views to this page: either a list of
/*****************************
$Log: notification.php,v $
- Revision 1.3 2003-02-21 08:49:16 arjen
+ Revision 1.4 2007-01-11 13:44:29 arjen
+ Manually edit parameters.
+ View logs from abusing IP addresses.
+
+ Revision 1.3 2003/02/21 08:49:16 arjen
Keep a record of each time a notification
is displayed. Either on a listing or in detail.
******************************/
-// RCSID = "$Id: notification.php,v 1.3 2003-02-21 08:49:16 arjen Exp $";
+// RCSID = "$Id: notification.php,v 1.4 2007-01-11 13:44:29 arjen Exp $";
ini_set('include_path', '.:./classes:../phpclasses');
class notification_page extends page
{
+ function notification_list($objectid)
+ {
+
+ // Display a list of all notifications for this object['oid']
+
+ $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid=" . $objectid);
+ $obj = pg_fetch_object($res, 0);
+ echo "<h1>Notifications for " . $obj->objectname . "</h1><hr>";
+
+ $res = pg_exec($this->database, "SELECT notificationid, timestamp, type_of_issueid,
+ statuscode, priority
+ FROM notification WHERE objectid= CAST ('"
+ . $objectid ."' AS BIGINT) AND statuscode != 'cls'"
+ . " ORDER BY notificationid");
+
+ echo "<table>";
+ $row = 0;
+ while ($row < pg_numrows($res))
+ {
+ $note = pg_fetch_object($res, $row);
+ $r = pg_exec($this->database, "SELECT name from type_of_issue WHERE type_of_issueid = CAST('"
+ . $note->type_of_issueid . "' AS BIGINT)");
+ $issue = pg_fetch_object($r, 0);
+ echo "<tr><td align='center'>\n";
+ echo $note->timestamp;
+ echo "</td><td>";
+ echo $note->notificationid;
+ echo "</td><td>";
+ echo "<a href='notification.php?notid=";
+ echo $note->notificationid;
+ echo "'>";
+ echo $issue->name;
+ echo "</a>";
+ echo "</td><td>";
+ echo $note->statuscode;
+ echo "</td><td>";
+ echo $note->priority;
+ echo "</td></tr>\n";
+ $row++;
+
+ //Save evidence that this notification was presented to the user.
+ //$note->statuscode = add_action($this->database, $note, 21,
+ // "This notification was displayed with others from the same object");
+ }
+ echo "</table>";
+ }
+
function display_notification($note)
{
$res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid= CAST ('" . $note->objectid . "' AS BIGINT)");
$r = pg_exec($this->database, "SELECT * FROM log WHERE logid IN
( SELECT logid FROM log_notification
WHERE notificationid = CAST ('"
- . $note->notificationid . "' AS BIGINT))");
+ . $note->notificationid . "' AS BIGINT)) ORDER BY object_timestamp");
if (pg_numrows($r) > 0)
{
echo "<h2>Log entries involved in this notification</h2>";
echo "</td><td>";
echo $p->servicecode;
echo "</td><td>";
- echo $p->rawdata;
+ echo htmlentities($p->rawdata);
echo "</td></tr>";
}
$possible_action = array
(
- "opn" => array (3, 6, 7),
+ "opn" => array (3, 6, 7, 13),
"pen" => array (3, 6, 7, 8, 11, 18),
"inv" => array (3, 9),
"vrf" => array (12, 13),
$row++;
//Save evidence that this notification was presented to the user.
- $note->statuscode = add_action($this->database, $note, 21,
- "This notification was displayed with others from the same object");
+ //$note->statuscode = add_action($this->database, $note, 21,
+ // "This notification was displayed with others from the same object");
}
echo "</table>";
}
$this->display_notification($note);
echo "<hr>";
$this->notification_form($note);
+ $this->notification_list($note->objectid);
}
else if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['notid']))
{
$this->display_notification($note);
echo "<hr>";
$this->notification_form($note);
+ $this->notification_list($note->objectid);
}
else
{