From 4d31d27ff0d9270f03456d17f5387f60bc99c22d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 27 Feb 2001 07:45:03 +0000 Subject: - added comment index for performance sake - improved comment module - code revision - improved backend module - moreover headlines now work - (automatically) stripped tabs and trailing whitespaces from Jeroen's theme. --- modules/backend.class | 11 ++--------- modules/comment.module | 24 ++++++++---------------- modules/comment/comment.module | 24 ++++++++---------------- 3 files changed, 18 insertions(+), 41 deletions(-) (limited to 'modules') diff --git a/modules/backend.class b/modules/backend.class index 7cdaa328b..6339afd53 100644 --- a/modules/backend.class +++ b/modules/backend.class @@ -51,24 +51,17 @@ class backend { if ($this->file) { // Decode URL: $url = parse_url($this->file); - $host = $url[host]; - $port = $url[port] ? $url[port] : 80; - $path = $url[path]; - - // print "
Debug: $url - $host - $port - $path
"; // Retrieve data from website: - $fp = fsockopen($host, $port, &$errno, &$errstr, $timout); + $fp = fsockopen($url[host], ($url[port] ? $url[port] : 80), &$errno, &$errstr, $timout); if ($fp) { // Request data via URL: - fputs($fp, "GET $path HTTP/1.0\nUser-Agent: $site_name\nHost: $host\nAccept: */*\n\n"); + fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\nUser-Agent: $site_name\nHost: $url[host]\nAccept: */*\n\n"); // Read data from socket: while(!feof($fp)) $data .= fgets($fp, 128); - // print "
$data

"; - if (strstr($data, "200 OK")) { // Remove existing entries: diff --git a/modules/comment.module b/modules/comment.module index ef0bce34a..6038d5ed2 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -26,24 +26,16 @@ function comment_edit($id) { $output .= "
\n"; - $output .= "

\n"; - $output .= " Author:
\n"; - $output .= " ". format_username($comment->userid) ."\n"; - $output .= "

\n"; + $output .= "Author:
\n"; + $output .= format_username($comment->userid) ."

\n"; - $output .= "

\n"; - $output .= " Subject:
\n"; - $output .= " subject) ."\">\n"; - $output .= "

\n"; + $output .= "Subject:
\n"; + $output .= "subject) ."\">

\n"; - $output .= "

\n"; $output .= "Comment:
\n"; - $output .= " \n"; - $output .= "

\n"; + $output .= "

\n"; - $output .= "

\n"; - $output .= " \n"; - $output .= "

\n"; + $output .= "\n"; $output .= "
\n"; print $output; @@ -51,7 +43,7 @@ function comment_edit($id) { function comment_save($id, $subject, $comment) { db_query("UPDATE comments SET subject = '". check_input($subject) ."', comment = '". check_input($comment) ."' WHERE cid = $id"); - watchdog("message", "comment: modified `$subject'"); + watchdog("message", "comment: modified '$subject'"); } function comment_display($order = "date") { @@ -105,7 +97,7 @@ function comment_admin() { break; case "Save comment": comment_save($id, $subject, $comment); - comment_edit($id); + comment_display(); break; case "Update": comment_display($order); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index ef0bce34a..6038d5ed2 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -26,24 +26,16 @@ function comment_edit($id) { $output .= "
\n"; - $output .= "

\n"; - $output .= " Author:
\n"; - $output .= " ". format_username($comment->userid) ."\n"; - $output .= "

\n"; + $output .= "Author:
\n"; + $output .= format_username($comment->userid) ."

\n"; - $output .= "

\n"; - $output .= " Subject:
\n"; - $output .= " subject) ."\">\n"; - $output .= "

\n"; + $output .= "Subject:
\n"; + $output .= "subject) ."\">

\n"; - $output .= "

\n"; $output .= "Comment:
\n"; - $output .= " \n"; - $output .= "

\n"; + $output .= "

\n"; - $output .= "

\n"; - $output .= " \n"; - $output .= "

\n"; + $output .= "\n"; $output .= "
\n"; print $output; @@ -51,7 +43,7 @@ function comment_edit($id) { function comment_save($id, $subject, $comment) { db_query("UPDATE comments SET subject = '". check_input($subject) ."', comment = '". check_input($comment) ."' WHERE cid = $id"); - watchdog("message", "comment: modified `$subject'"); + watchdog("message", "comment: modified '$subject'"); } function comment_display($order = "date") { @@ -105,7 +97,7 @@ function comment_admin() { break; case "Save comment": comment_save($id, $subject, $comment); - comment_edit($id); + comment_display(); break; case "Update": comment_display($order); -- cgit v1.2.3