summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-01-06 11:39:43 +0000
committerDries Buytaert <dries@buytaert.net>2001-01-06 11:39:43 +0000
commit8511d9fb45bb2f5a016f0dd13b22a67d448c0d37 (patch)
treecde1eb77e8ef1f1f55818182a108d5997125f379 /modules
parentb604c438945f6d94472a470d2b09ad2b63c58651 (diff)
downloadbrdo-8511d9fb45bb2f5a016f0dd13b22a67d448c0d37.tar.gz
brdo-8511d9fb45bb2f5a016f0dd13b22a67d448c0d37.tar.bz2
A batch of patches:
- configuration: + renamed $db_name to $db_user + renamed $db_base to $db_name - fixed small diary glitch - fixed initial-comment-score problem - fixed comment rating bug: improved the API and updated the themes - removed some tabs from Steven ;) - fixed backend warnings and improved robustness I'm not happy yet with the headline grabber - it generates too many SQL errors. - some small cosmetic changes in comment.module - fixed minor glitch in format_interval()
Diffstat (limited to 'modules')
-rw-r--r--modules/backend.class6
-rw-r--r--modules/comment.module4
-rw-r--r--modules/comment/comment.module4
-rw-r--r--modules/diary.module2
-rw-r--r--modules/drupal.module2
-rw-r--r--modules/drupal/drupal.module2
-rw-r--r--modules/headline.module23
7 files changed, 24 insertions, 19 deletions
diff --git a/modules/backend.class b/modules/backend.class
index 888dcba0f..7869b6530 100644
--- a/modules/backend.class
+++ b/modules/backend.class
@@ -16,7 +16,7 @@ class backend {
// Contains the parsed rdf/rss/xml file:
var $headlines = array(); // latest headlines
- function backend($id, $site = "", $url = "", $file = "", $contact = "", $timout = 3600) {
+ function backend($id, $site = "", $url = "", $file = "", $contact = "", $timout = 10800) {
// Get channel info:
$result = db_query("SELECT * FROM channel WHERE id = '$id' OR site = '$site'");
@@ -153,7 +153,7 @@ class backend {
function add() {
// Add channel:
- $result = db_query("INSERT INTO channel (site, file, url, contact, timestamp) VALUES ('". check_input($this->site) ."', '". check_input($this->file) ."', '". check_input($this->url) ."', '". check_input($this->contact) ."', 42)");
+ $result = db_query("INSERT INTO channel (site, file, url, contact, timestamp) VALUES ('". check_input($this->site) ."', '". check_input($this->file) ."', '". check_input($this->url) ."', '". check_input($this->contact) ."', 1)");
}
function delete() {
@@ -169,7 +169,7 @@ class backend {
$result = db_query("DELETE FROM headlines WHERE id = $this->id");
// Mark channel as invalid to enforce an update:
- $result = db_query("UPDATE channel SET timestamp = 42 WHERE id = $this->id");
+ $result = db_query("UPDATE channel SET timestamp = 1 WHERE id = $this->id");
}
function dump() {
diff --git a/modules/comment.module b/modules/comment.module
index c3341442e..85b7b54dc 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -16,12 +16,12 @@ function comment_edit($id) {
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
- $output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_output(check_field($comment->subject)) ."\"><BR>\n";
+ $output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_output(check_field($comment->subject)) ."\">\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<B>Comment:</B><BR>\n";
- $output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_output($comment->comment) ."</TEXTAREA><BR>\n";
+ $output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_output($comment->comment) ."</TEXTAREA>\n";
$output .= "</P>\n";
$output .= "<P>\n";
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index c3341442e..85b7b54dc 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -16,12 +16,12 @@ function comment_edit($id) {
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
- $output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_output(check_field($comment->subject)) ."\"><BR>\n";
+ $output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" VALUE=\"". check_output(check_field($comment->subject)) ."\">\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<B>Comment:</B><BR>\n";
- $output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_output($comment->comment) ."</TEXTAREA><BR>\n";
+ $output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"comment\">". check_output($comment->comment) ."</TEXTAREA>\n";
$output .= "</P>\n";
$output .= "<P>\n";
diff --git a/modules/diary.module b/modules/diary.module
index 27a74dea4..8c05ffffa 100644
--- a/modules/diary.module
+++ b/modules/diary.module
@@ -220,7 +220,7 @@ function diary_user($username, $section, $operation) {
function diary_menu() {
global $user;
- return array("edit your diary" => "module.php?mod=diary&op=edit", "view your diary" => "module.php?mod=diary&op=view");
+ return array("edit your diary" => "module.php?mod=diary&op=add", "view your diary" => "module.php?mod=diary&op=view");
}
function diary_block() {
diff --git a/modules/drupal.module b/modules/drupal.module
index 3eb6d4455..0417c11c3 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -22,7 +22,7 @@ function drupal_page() {
";
$handle = opendir("drupal");
- while ($file = readdir($handle)) if (ereg(".jpg", $file)) $output .= " <LI><SMALL><A HREF=\"drupal/$file\">$file</A></SMALL></LI>\n";
+ while ($file = readdir($handle)) if (ereg(".jpg", $file) || ereg(".gif", $file)) $output .= " <LI><SMALL><A HREF=\"drupal/$file\">$file</A></SMALL></LI>\n";
closedir($handle);
$theme->header();
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index 3eb6d4455..0417c11c3 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -22,7 +22,7 @@ function drupal_page() {
";
$handle = opendir("drupal");
- while ($file = readdir($handle)) if (ereg(".jpg", $file)) $output .= " <LI><SMALL><A HREF=\"drupal/$file\">$file</A></SMALL></LI>\n";
+ while ($file = readdir($handle)) if (ereg(".jpg", $file) || ereg(".gif", $file)) $output .= " <LI><SMALL><A HREF=\"drupal/$file\">$file</A></SMALL></LI>\n";
closedir($handle);
$theme->header();
diff --git a/modules/headline.module b/modules/headline.module
index 278043be1..358a1cc04 100644
--- a/modules/headline.module
+++ b/modules/headline.module
@@ -27,11 +27,13 @@ function headline_blocks() {
// Load backend from database:
$backend = new backend($channel->id);
-
- // Read headline from backend class:
- $content = "";
- for (reset($backend->headline); $headline = current($backend->headline); next($backend->headline)) {
- $content .= "<LI>$headline</LI>\n";
+
+ if ($backend->headlines) {
+ unset($content);
+ foreach ($backend->headlines as $headline) $content .= "<LI>$headline</LI>\n";
+ }
+ else {
+ $content = "no headlines available\n";
}
// Print backend box to screen:
@@ -79,13 +81,16 @@ function headline_block() {
$result = db_query("SELECT * FROM channel");
while ($channel = db_fetch_object($result)) {
$backend = new Backend($channel->id);
- $content = "";
- if ($backend->headline) {
- for (reset($backend->headline); $headline = current($backend->headline); next($backend->headline)) {
+ if ($backend->headlines) {
+ unset($content);
+ foreach ($backend->headlines as $headline) {
$content .= "<LI>$headline</LI>\n";
}
}
+ else {
+ $content = "no headlines available";
+ }
$blocks[$channel->id]["subject"] = $backend->site;
$blocks[$channel->id]["content"] = $content;
@@ -111,7 +116,7 @@ function headline_admin_main() {
$output .= "<TR>\n";
$output .= " <TD><A HREF=\"$backend->url\">$backend->site</A></TD>\n";
$output .= " <TD><A HREF=\"mailto:$backend->contact\">$backend->contact</A></TD>\n";
- $output .= " <TD ALIGN=\"center\">". format_interval(time() - $backend->timestamp) ." ago</TD>\n";
+ $output .= " <TD ALIGN=\"center\">". ($backend->timestamp == 1 ? "failed" : format_interval(time() - $backend->timestamp) ." ago") ."</TD>\n";
$output .= " <TD ALIGN=\"center\"><A HREF=\"admin.php?mod=headline&op=refresh&id=$backend->id\">refresh</A></TD>\n";
$output .= " <TD ALIGN=\"center\"><A HREF=\"admin.php?mod=headline&op=delete&id=$backend->id\">delete</A></TD>\n";
$output .= "</TR>\n";