summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/backend.class4
-rw-r--r--modules/block.module13
-rw-r--r--modules/block/block.module13
-rw-r--r--modules/book.module8
-rw-r--r--modules/book/book.module8
-rw-r--r--modules/diary.module2
-rw-r--r--modules/headline.module10
-rw-r--r--modules/headlineRSS10.module17
-rw-r--r--modules/moderation.module9
-rw-r--r--modules/story.module6
-rw-r--r--modules/story/story.module6
-rw-r--r--modules/watchdog.module67
-rw-r--r--modules/watchdog/watchdog.module67
13 files changed, 71 insertions, 159 deletions
diff --git a/modules/backend.class b/modules/backend.class
index b31372fb5..6c0914d57 100644
--- a/modules/backend.class
+++ b/modules/backend.class
@@ -46,8 +46,6 @@ class backend {
}
function url2sql($timout = 10) {
- global $site_name;
-
if ($this->file) {
// Decode URL:
$url = parse_url($this->file);
@@ -57,7 +55,7 @@ class backend {
if ($fp) {
// Request data via URL:
- fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\nUser-Agent: $site_name\nHost: $url[host]\nAccept: */*\n\n");
+ fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\nUser-Agent: ". variable_get(site_name, "drupal") ."\nHost: $url[host]\nAccept: */*\n\n");
// Read data from socket:
while(!feof($fp)) $data .= fgets($fp, 128);
diff --git a/modules/block.module b/modules/block.module
index 73b6b7f55..c2b53240b 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -84,7 +84,6 @@ function block_admin_display() {
}
function block_admin_overview() {
- global $site_name;
$result = db_query("SELECT * FROM blocks WHERE status > 0 AND region = 0 ORDER BY weight");
$lblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
@@ -98,9 +97,9 @@ function block_admin_overview() {
$output .= "<P><B>layout 1:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">$site_name header</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">header</TD></TR>\n";
$output .= " <TR><TD>\n". ($lblocks ? $lblocks : "&nbsp;") ."</TD><TD WIDTH=\"300\">&nbsp;</TD><TD>\n". ($rblocks ? $rblocks : "&nbsp;") ."</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">$site_name footer</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">footer</TD></TR>\n";
$output .= "</TABLE>\n";
$result = db_query("SELECT * FROM blocks WHERE status > 0 ORDER BY weight");
@@ -110,16 +109,16 @@ function block_admin_overview() {
$output .= "<P><B>layout 2:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name header</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
$output .= " <TR><TD WIDTH=\"400\">&nbsp;</TD><TD>\n". ($blocks ? $blocks : "&nbsp;") ."</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name footer</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
$output .= "</TABLE>\n";
$output .= "<P><B>layout 3:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name header</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
$output .= " <TR><TD>\n". ($blocks ? $blocks : "&nbsp;") ."</TD><TD WIDTH=\"400\">&nbsp;</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name footer</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
$output .= "</TABLE>\n";
print $output;
diff --git a/modules/block/block.module b/modules/block/block.module
index 73b6b7f55..c2b53240b 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -84,7 +84,6 @@ function block_admin_display() {
}
function block_admin_overview() {
- global $site_name;
$result = db_query("SELECT * FROM blocks WHERE status > 0 AND region = 0 ORDER BY weight");
$lblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
@@ -98,9 +97,9 @@ function block_admin_overview() {
$output .= "<P><B>layout 1:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">$site_name header</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">header</TD></TR>\n";
$output .= " <TR><TD>\n". ($lblocks ? $lblocks : "&nbsp;") ."</TD><TD WIDTH=\"300\">&nbsp;</TD><TD>\n". ($rblocks ? $rblocks : "&nbsp;") ."</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">$site_name footer</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">footer</TD></TR>\n";
$output .= "</TABLE>\n";
$result = db_query("SELECT * FROM blocks WHERE status > 0 ORDER BY weight");
@@ -110,16 +109,16 @@ function block_admin_overview() {
$output .= "<P><B>layout 2:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name header</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
$output .= " <TR><TD WIDTH=\"400\">&nbsp;</TD><TD>\n". ($blocks ? $blocks : "&nbsp;") ."</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name footer</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
$output .= "</TABLE>\n";
$output .= "<P><B>layout 3:</B></P>\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name header</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
$output .= " <TR><TD>\n". ($blocks ? $blocks : "&nbsp;") ."</TD><TD WIDTH=\"400\">&nbsp;</TD></TR>\n";
- $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">$site_name footer</TD></TR>\n";
+ $output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
$output .= "</TABLE>\n";
print $output;
diff --git a/modules/book.module b/modules/book.module
index 4a8603ad8..b2f09b84c 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -126,11 +126,9 @@ function book_form($edit = array()) {
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"edit[body]\" MAXLENGTH=\"20\">". check_textarea($edit[body]) ."</TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
- if ($edit[pid]) {
- $output .= "<B>". t("Log message") .":</B><BR>\n";
- $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"5\" NAME=\"edit[log]\" MAXLENGTH=\"20\">". check_textarea($edit[log]) ."</TEXTAREA><BR>\n";
- $output .= "<SMALL><I>". t("An explanation of the updates being made to help the group understand the changes.") ."</I></SMALL><P>\n";
- }
+ $output .= "<B>". t("Log message") .":</B><BR>\n";
+ $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"5\" NAME=\"edit[log]\" MAXLENGTH=\"20\">". check_textarea($edit[log]) ."</TEXTAREA><BR>\n";
+ $output .= "<SMALL><I>". t("An explanation of the additions or updates being made to help the group understand your motivations.") ."</I></SMALL><P>\n";
if (user_access($user, "book")) {
$output .= "<B>". t("Weight") .":</B><BR>\n";
diff --git a/modules/book/book.module b/modules/book/book.module
index 4a8603ad8..b2f09b84c 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -126,11 +126,9 @@ function book_form($edit = array()) {
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"edit[body]\" MAXLENGTH=\"20\">". check_textarea($edit[body]) ."</TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
- if ($edit[pid]) {
- $output .= "<B>". t("Log message") .":</B><BR>\n";
- $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"5\" NAME=\"edit[log]\" MAXLENGTH=\"20\">". check_textarea($edit[log]) ."</TEXTAREA><BR>\n";
- $output .= "<SMALL><I>". t("An explanation of the updates being made to help the group understand the changes.") ."</I></SMALL><P>\n";
- }
+ $output .= "<B>". t("Log message") .":</B><BR>\n";
+ $output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"5\" NAME=\"edit[log]\" MAXLENGTH=\"20\">". check_textarea($edit[log]) ."</TEXTAREA><BR>\n";
+ $output .= "<SMALL><I>". t("An explanation of the additions or updates being made to help the group understand your motivations.") ."</I></SMALL><P>\n";
if (user_access($user, "book")) {
$output .= "<B>". t("Weight") .":</B><BR>\n";
diff --git a/modules/diary.module b/modules/diary.module
index a706a106f..a3b757d79 100644
--- a/modules/diary.module
+++ b/modules/diary.module
@@ -164,7 +164,7 @@ function diary_page_submit($text, $id = 0) {
db_query("UPDATE diaries SET text = '$text' WHERE id = '$id'");
}
else {
- watchdog("diary", "diary: new diary entry added");
+ watchdog("special", "diary: new diary entry added");
db_query("INSERT INTO diaries (author, text, timestamp) VALUES ('$user->id', '$text', '". time() ."')");
}
diff --git a/modules/headline.module b/modules/headline.module
index df525cac5..81a52e580 100644
--- a/modules/headline.module
+++ b/modules/headline.module
@@ -189,7 +189,7 @@ function headline_admin() {
}
function headline_export($uri) {
- global $site_name, $site_url, $status, $HTTP_REFERER, $HTTP_USER_AGENT;
+ global $status, $HTTP_REFERER, $HTTP_USER_AGENT;
if ($uri[1] == "headlines.rdf") {
watchdog("message", "grabbed 'headlines.rdf' - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT");
@@ -202,9 +202,9 @@ function headline_export($uri) {
print " xmlns=\"http://my.netscape.com/rdf/simple/0.9/\">\n";
print "<channel>\n";
- print " <title>$site_name</title>\n";
- print " <link>$site_url</link>\n";
- print " <description>$site_name</description>\n";
+ print " <title>". variable_get(site_name, "drupal") ."</title>\n";
+ print " <link>". variable_get(site_url, "http://drupal/") ."</link>\n";
+ print " <description>". variable_get(site_name, "drupal") ."</description>\n";
print "</channel>\n";
$result = db_query("SELECT * FROM node WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
@@ -212,7 +212,7 @@ function headline_export($uri) {
while ($node = db_fetch_object($result)) {
print "<item>\n";
print " <title>". check_export($node->title) ."</title>\n";
- print " <link>". $site_url ."node.php?id=$node->nid</link>\n";
+ print " <link>". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid</link>\n";
print "</item>\n";
}
diff --git a/modules/headlineRSS10.module b/modules/headlineRSS10.module
index 5714ac9f2..1e15ceb1b 100644
--- a/modules/headlineRSS10.module
+++ b/modules/headlineRSS10.module
@@ -10,7 +10,7 @@ include_once "includes/common.inc";
include_once "modules/backend.class";
function headlineRSS10_export($uri) {
- global $site_name, $site_url, $status, $HTTP_REFERER, $HTTP_USER_AGENT;
+ global $status, $HTTP_REFERER, $HTTP_USER_AGENT;
if ($uri[1] == "headlinesRSS10.rdf") {
watchdog("message", "grabbed 'headlinesRSS10.rdf' - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT");
@@ -23,10 +23,10 @@ function headlineRSS10_export($uri) {
print "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
print "xmlns=\"http://purl.org/rss/1.0/\">\n\n";
- print "<channel rdf:about=\"".$site_url."export/headlinesRSS10.rdf\">\n";
- print " <title>$site_name</title>\n";
- print " <link>$site_url</link>\n";
- print " <description>$site_name</description>\n";
+ print "<channel rdf:about=\"". variable_get(site_url, "http://drupal/") ."export/headlinesRSS10.rdf\">\n";
+ print " <title>". variable_get(site_name, "drupal") ."</title>\n";
+ print " <link>". variable_get(site_url, "http://drupal/") ."</link>\n";
+ print " <description>". variable_get(site_name, "drupal") ."</description>\n";
print " <items>\n";
@@ -35,8 +35,7 @@ function headlineRSS10_export($uri) {
$result = db_query("SELECT * FROM node WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
- print " <rdf:li resource=\"". $site_url ."node.php?id=$node->nid\" />\n";
-
+ print " <rdf:li resource=\"". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid\" />\n";
}
print " </rdf:Seq>\n";
@@ -46,9 +45,9 @@ function headlineRSS10_export($uri) {
$result = db_query("SELECT * FROM node WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
- print "<item rdf:about=\"".$site_url ."node.php?id=$node->nid\">\n";
+ print "<item rdf:about=\"". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid\">\n";
print " <title>". check_export($node->title) ."</title>\n";
- print " <link>". $site_url ."node.php?id=$node->nid</link>\n";
+ print " <link>". variable_get(site_url, "http://drupal/") ."node.php?id=$node->nid</link>\n";
if ($node->abstract)
print " <description>". check_output($node->abstract, 1) ."</description>\n";
diff --git a/modules/moderation.module b/modules/moderation.module
index 9f7a7049f..ac193c166 100644
--- a/modules/moderation.module
+++ b/modules/moderation.module
@@ -82,9 +82,12 @@ function moderation_node($id) {
header("Location: node.php?id=$node->nid");
}
else {
- if ($node->pid && $n = node_get_object("nid", $node->pid)) {
- if ($node->pid) $output .= " ". t("The above node is a suggested update for an existing node:") ." \"<A HREF=\"node.php?id=$n->nid\">". check_output($n->title) ."</A>\".";
- if ($node->log) $output .= " ". t("The log message to accompany this update is given below:") ."<P><I>". check_output($node->log, 1) ."</I></P>";
+ if ($n = node_get_object("nid", $node->pid)) {
+ $output .= " ". t("The above node is a proposed update of an existing node:") ." \"<A HREF=\"node.php?id=$n->nid\">". check_output($n->title) ."</A>\".";
+ }
+
+ if ($node->log) {
+ $output .= " ". t("The log message to accompany this submission is given below:") ."<P><I>". check_output($node->log, 1) ."</I></P>";
}
// moderation form:
diff --git a/modules/story.module b/modules/story.module
index d83557456..a750beffc 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -20,15 +20,15 @@ class Story {
}
function story_post_threshold($node, $default) {
- return $default;
+ return section_post_threshold($node->section, $default);
}
function story_dump_threshold($node, $default) {
- return $default;
+ return section_dump_threshold($node->section, $default);
}
function story_timout_threshold($node, $default) {
- return $default;
+ return section_timout_threshold($node->section, $default);
}
function story_find($keys) {
diff --git a/modules/story/story.module b/modules/story/story.module
index d83557456..a750beffc 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -20,15 +20,15 @@ class Story {
}
function story_post_threshold($node, $default) {
- return $default;
+ return section_post_threshold($node->section, $default);
}
function story_dump_threshold($node, $default) {
- return $default;
+ return section_dump_threshold($node->section, $default);
}
function story_timout_threshold($node, $default) {
- return $default;
+ return section_timout_threshold($node->section, $default);
}
function story_find($keys) {
diff --git a/modules/watchdog.module b/modules/watchdog.module
index c912ee85b..18279db1b 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -2,7 +2,6 @@
$module = array("help" => "watchdog_help",
"cron" => "watchdog_cron",
- "conf" => "watchdog_conf",
"admin" => "watchdog_admin");
function watchdog_help() {
@@ -13,44 +12,24 @@ function watchdog_help() {
}
function watchdog_cron() {
- watchdog_clean();
+ db_query("DELETE FROM watchdog WHERE ". time() ." - timestamp > ". variable_get(watchdog_clear, "302400"));
}
function watchdog_overview($order = "date") {
- $colors = array("#D8BFD8", "#6495ED", "#6A5ADF", "#FFFFFF", "#FFA500", "#FF3C3C");
- $fields = array("date" => "id DESC", "username" => "user", "location" => "location", "message" => "message DESC", "level" => "level DESC");
+ $colors = array(message => "#FFFFFF", special => "#836FFF", warning => "#FFAA22", error => "#EE2C2C");
- // Perform query:
- $result = db_query("SELECT l.*, u.userid FROM watchdog l LEFT JOIN users u ON l.user = u.id ORDER BY l.$fields[$order]");
+ $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id");
- // Generate output:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR>\n";
- $output .= " <TH ALIGN=\"right\" COLSPAN=\"4\">\n";
- $output .= " <FORM ACTION=\"admin.php?mod=watchdog\" METHOD=\"post\">\n";
- $output .= " <SELECT NAME=\"order\">\n";
- foreach ($fields as $key=>$value) {
- $output .= " <OPTION VALUE=\"$key\"". ($key == $order ? " SELECTED" : "") .">Sort by $key</OPTION>\n";
- }
- $output .= " </SELECT>\n";
- $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n";
- $output .= " </FORM>\n";
- $output .= " </TH>\n";
- $output .= " </TR>\n";
- $output .= " <TR>\n";
- $output .= " <TH>date</TH>\n";
- $output .= " <TH>message</TH>\n";
- $output .= " <TH>user</TH>\n";
- $output .= " <TH>operations</TH>\n";
- $output .= " </TR>\n";
-
+ $output .= " <TR><TH>date</TH><TH>type</TH><TH>message</TH><TH>user</TH><TH>operations</TH></TR>\n";
while ($watchdog = db_fetch_object($result)) {
- $output .= " <TR BGCOLOR=\"". $colors[$watchdog->level] ."\"><TD>". format_date($watchdog->timestamp) ."</TD><TD>". substr(check_output($watchdog->message), 0, 44) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
+ if ($color = $colors[$watchdog->type]) {
+ $output .= " <TR BGCOLOR=\"$color\"><TD>". format_date($watchdog->timestamp) ."</TD><TD ALIGN=\"center\">$watchdog->link</TD><TD>". substr(check_output($watchdog->message), 0, 50) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
+ }
}
-
$output .= "</TABLE>\n";
- print $output;
+ return $output;
}
function watchdog_view($id) {
@@ -58,33 +37,16 @@ function watchdog_view($id) {
if ($watchdog = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
- $output .= " <TR><TH>Level:</TH><TD>". check_output($watchdog->level) ."</TD></TR>\n";
+ $output .= " <TR><TH>Type:</TH><TD>". check_output($watchdog->type) ."</TD></TR>\n";
$output .= " <TR><TH>Date:</TH><TD>". format_date($watchdog->timestamp, "large") ."</TD></TR>\n";
$output .= " <TR><TH>User:</TH><TD>". format_username($watchdog->userid) ."</TD></TR>\n";
$output .= " <TR><TH>Location:</TH><TD>". check_output($watchdog->location). "</TD></TR>\n";
$output .= " <TR><TH>Message:</TH><TD>". check_output($watchdog->message) ."</TD></TR>\n";
$output .= " <TR><TH>Hostname:</TH><TD>". check_output($watchdog->hostname) ."</TD></TR>\n";
$output .= "</TABLE>\n";
- print $output;
- }
-}
-
-function watchdog_conf() {
- global $conf;
- $rate = array(1 => "maximum 1 every second", 5 => "maximum 1 every 5 seconds", 15 => "maximum 1 every 15 seconds", 30 => "maximum 1 every 30 seconds", 60 => "maximum 1 every minute", 300 => "maximum 1 every 5 minutes", 900 => "maximum 1 every 15 minutes", 1800 => "maximum 1 every 30 minutes", 3600 => "maximum 1 every hour", 21600 => "maximum 1 every 6 hour", 43200 => "maximum 1 every 12 hour");
-
- $output .= "<B>Maximum node rate:</B><BR>\n";
- foreach ($rate as $key=>$value) $options1 .= " <OPTION VALUE=\"$key\"". (($conf[max_node_rate] == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
- $output .= "<SELECT NAME=\"edit[max_node_rate]\">$options1</SELECT><BR>\n";
- $output .= "<I><SMALL>The maximum submission rate for nodes. Its purpose is to stop denial of service attacks.</SMALL></I><P>\n";
-
- $output .= "<B>Maximum comment rate:</B><BR>\n";
- foreach ($rate as $key=>$value) $options2 .= " <OPTION VALUE=\"$key\"". (($conf[max_comment_rate] == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
- $output .= "<SELECT NAME=\"edit[max_comment_rate]\"$options2</SELECT><BR>\n";
- $output .= "<I><SMALL>The maximum submission rate for comments. Its purpose is to stop denial of service attacks.</SMALL></I><P>\n";
-
- return $output;
+ return $output;
+ }
}
function watchdog_admin() {
@@ -97,13 +59,10 @@ function watchdog_admin() {
watchdog_help();
break;
case "view":
- watchdog_view(check_input($id));
- break;
- case "Update":
- watchdog_overview(check_input($order));
+ print watchdog_view(check_input($id));
break;
default:
- watchdog_overview();
+ print watchdog_overview();
}
}
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index c912ee85b..18279db1b 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -2,7 +2,6 @@
$module = array("help" => "watchdog_help",
"cron" => "watchdog_cron",
- "conf" => "watchdog_conf",
"admin" => "watchdog_admin");
function watchdog_help() {
@@ -13,44 +12,24 @@ function watchdog_help() {
}
function watchdog_cron() {
- watchdog_clean();
+ db_query("DELETE FROM watchdog WHERE ". time() ." - timestamp > ". variable_get(watchdog_clear, "302400"));
}
function watchdog_overview($order = "date") {
- $colors = array("#D8BFD8", "#6495ED", "#6A5ADF", "#FFFFFF", "#FFA500", "#FF3C3C");
- $fields = array("date" => "id DESC", "username" => "user", "location" => "location", "message" => "message DESC", "level" => "level DESC");
+ $colors = array(message => "#FFFFFF", special => "#836FFF", warning => "#FFAA22", error => "#EE2C2C");
- // Perform query:
- $result = db_query("SELECT l.*, u.userid FROM watchdog l LEFT JOIN users u ON l.user = u.id ORDER BY l.$fields[$order]");
+ $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id");
- // Generate output:
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR>\n";
- $output .= " <TH ALIGN=\"right\" COLSPAN=\"4\">\n";
- $output .= " <FORM ACTION=\"admin.php?mod=watchdog\" METHOD=\"post\">\n";
- $output .= " <SELECT NAME=\"order\">\n";
- foreach ($fields as $key=>$value) {
- $output .= " <OPTION VALUE=\"$key\"". ($key == $order ? " SELECTED" : "") .">Sort by $key</OPTION>\n";
- }
- $output .= " </SELECT>\n";
- $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n";
- $output .= " </FORM>\n";
- $output .= " </TH>\n";
- $output .= " </TR>\n";
- $output .= " <TR>\n";
- $output .= " <TH>date</TH>\n";
- $output .= " <TH>message</TH>\n";
- $output .= " <TH>user</TH>\n";
- $output .= " <TH>operations</TH>\n";
- $output .= " </TR>\n";
-
+ $output .= " <TR><TH>date</TH><TH>type</TH><TH>message</TH><TH>user</TH><TH>operations</TH></TR>\n";
while ($watchdog = db_fetch_object($result)) {
- $output .= " <TR BGCOLOR=\"". $colors[$watchdog->level] ."\"><TD>". format_date($watchdog->timestamp) ."</TD><TD>". substr(check_output($watchdog->message), 0, 44) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
+ if ($color = $colors[$watchdog->type]) {
+ $output .= " <TR BGCOLOR=\"$color\"><TD>". format_date($watchdog->timestamp) ."</TD><TD ALIGN=\"center\">$watchdog->link</TD><TD>". substr(check_output($watchdog->message), 0, 50) ."</TD><TD ALIGN=\"center\">". format_username($watchdog->userid) ."</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=watchdog&op=view&id=$watchdog->id\">details</A></TD></TR>\n";
+ }
}
-
$output .= "</TABLE>\n";
- print $output;
+ return $output;
}
function watchdog_view($id) {
@@ -58,33 +37,16 @@ function watchdog_view($id) {
if ($watchdog = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
- $output .= " <TR><TH>Level:</TH><TD>". check_output($watchdog->level) ."</TD></TR>\n";
+ $output .= " <TR><TH>Type:</TH><TD>". check_output($watchdog->type) ."</TD></TR>\n";
$output .= " <TR><TH>Date:</TH><TD>". format_date($watchdog->timestamp, "large") ."</TD></TR>\n";
$output .= " <TR><TH>User:</TH><TD>". format_username($watchdog->userid) ."</TD></TR>\n";
$output .= " <TR><TH>Location:</TH><TD>". check_output($watchdog->location). "</TD></TR>\n";
$output .= " <TR><TH>Message:</TH><TD>". check_output($watchdog->message) ."</TD></TR>\n";
$output .= " <TR><TH>Hostname:</TH><TD>". check_output($watchdog->hostname) ."</TD></TR>\n";
$output .= "</TABLE>\n";
- print $output;
- }
-}
-
-function watchdog_conf() {
- global $conf;
- $rate = array(1 => "maximum 1 every second", 5 => "maximum 1 every 5 seconds", 15 => "maximum 1 every 15 seconds", 30 => "maximum 1 every 30 seconds", 60 => "maximum 1 every minute", 300 => "maximum 1 every 5 minutes", 900 => "maximum 1 every 15 minutes", 1800 => "maximum 1 every 30 minutes", 3600 => "maximum 1 every hour", 21600 => "maximum 1 every 6 hour", 43200 => "maximum 1 every 12 hour");
-
- $output .= "<B>Maximum node rate:</B><BR>\n";
- foreach ($rate as $key=>$value) $options1 .= " <OPTION VALUE=\"$key\"". (($conf[max_node_rate] == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
- $output .= "<SELECT NAME=\"edit[max_node_rate]\">$options1</SELECT><BR>\n";
- $output .= "<I><SMALL>The maximum submission rate for nodes. Its purpose is to stop denial of service attacks.</SMALL></I><P>\n";
-
- $output .= "<B>Maximum comment rate:</B><BR>\n";
- foreach ($rate as $key=>$value) $options2 .= " <OPTION VALUE=\"$key\"". (($conf[max_comment_rate] == $key) ? " SELECTED" : "") .">$value</OPTION>\n";
- $output .= "<SELECT NAME=\"edit[max_comment_rate]\"$options2</SELECT><BR>\n";
- $output .= "<I><SMALL>The maximum submission rate for comments. Its purpose is to stop denial of service attacks.</SMALL></I><P>\n";
-
- return $output;
+ return $output;
+ }
}
function watchdog_admin() {
@@ -97,13 +59,10 @@ function watchdog_admin() {
watchdog_help();
break;
case "view":
- watchdog_view(check_input($id));
- break;
- case "Update":
- watchdog_overview(check_input($order));
+ print watchdog_view(check_input($id));
break;
default:
- watchdog_overview();
+ print watchdog_overview();
}
}