From d386c110f449d39631c6af1aabced9799c7a372d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 26 Jan 2001 13:38:46 +0000 Subject: - removed redundant spaces --- modules/backend.class | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'modules/backend.class') diff --git a/modules/backend.class b/modules/backend.class index 7869b6530..04e25520d 100644 --- a/modules/backend.class +++ b/modules/backend.class @@ -48,27 +48,29 @@ class backend { } function rdf2sql($timout = 10) { + global $site_name; + 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); if ($fp) { // Get data from URL: fputs($fp, "GET $path HTTP/1.0\n"); - fputs($fp, "User-Agent: headline grabber\n"); + fputs($fp, "User-Agent: $site_name\n"); fputs($fp, "Host: ". $host ."\n"); fputs($fp, "Accept: */*\n\n"); while(!feof($fp)) $data .= fgets($fp, 128); - + // print "
$data

"; if (strstr($data, "200 OK")) { @@ -80,7 +82,7 @@ class backend { $data = ereg_replace("", "", $data); $data = ereg_replace("", $data); $number = 0; @@ -90,18 +92,18 @@ class backend { $link = ereg_replace(".*", "", $item); $link = ereg_replace(".*", "", $link); $title = ereg_replace(".*", "", $item); - $title = ereg_replace(".*", "", $title); + $title = ereg_replace(".*", "", $title); // Clean headlines: $title = stripslashes($title); - + // Count the number of stories: $number += 1; // Insert item in database: $result = db_query("INSERT INTO headlines (id, title, link, number) VALUES('". check_input($this->id) ."', '". check_input($title) ."', '". check_input($link) ."', '". check_input($number) ."')"); } - + // Mark channels as being updated: $result = db_query("UPDATE channel SET timestamp = '". time() ."' WHERE id = $this->id"); $this->timestamp = time(); @@ -143,8 +145,8 @@ class backend { } // Add timestamp: $update = round((time() - $this->timestamp) / 60); - $content .= "

[ site\">hlcolor2\">reset | updated $update min. ago ]

"; - + $content .= "

[ site\">hlcolor2\">reset | updated $update min. ago ]

"; + // Display box: $theme->box("$this->site", $content); } @@ -152,24 +154,24 @@ class backend { } function add() { - // Add channel: + // 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) ."', 1)"); } - + function delete() { - // Delete channel: + // Delete channel: $result = db_query("DELETE FROM channel WHERE id = $this->id"); // Delete headlines: - $result = db_query("DELETE FROM headlines WHERE id = $this->id"); + $result = db_query("DELETE FROM headlines WHERE id = $this->id"); } function refresh() { // Delete headlines: - $result = db_query("DELETE FROM headlines WHERE id = $this->id"); + $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 = 1 WHERE id = $this->id"); + $result = db_query("UPDATE channel SET timestamp = 1 WHERE id = $this->id"); } function dump() { -- cgit v1.2.3