From 8eb45a6ebaae86f29d96c35dd7b247030fbaec24 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 8 Dec 2001 08:46:55 +0000 Subject: - cloud.module: + made the cloud module export some documentation - thanks Joe! + XHTML-ified the emitted HTML code and quotes array indeces to be compliant with our coding standards. --- modules/cloud.module | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'modules/cloud.module') diff --git a/modules/cloud.module b/modules/cloud.module index a7824165c..9b40ca293 100644 --- a/modules/cloud.module +++ b/modules/cloud.module @@ -1,6 +1,17 @@ "; + $output .= "
  • The site administrator enters names and URLs of the relevant pages on the cloud monitor administration page.
  • "; + $output .= "
  • Drupal's cron function, triggers the cloud module to check all the registered websites for recent changes or updates. (A page is updated when there is a 50-character difference since the last time it checked.)
  • "; + $output .= "
  • The module exports both a page and a block that display the registered sites ordered by their last modification date.
  • "; + $output .= ""; + + return $output; +} + function cloud_cron() { if (time() % 250 == 0) { $result = db_query("SELECT * FROM site"); @@ -37,30 +48,30 @@ function cloud_update($site) { */ if (!ereg("^http://|ftp://", $site[link])) { - watchdog("warning", "cloud: invalid or missing URL for '$site[name]'"); + watchdog("warning", "cloud: invalid or missing URL for '". $site["name"] ."'"); } if (!ereg("^http://|ftp://", $site[feed])) { - watchdog("warning", "cloud: invalid or missing URL to monitor for '$site[name]'"); + watchdog("warning", "cloud: invalid or missing URL to monitor for '". $site["name"] ."'"); } /* ** Grab the page and update the database if required: */ - if ($fp = @fopen($site[feed], "r")) { - while(!feof($fp)) { + if ($fp = @fopen($site["feed"], "r")) { + while (!feof($fp)) { $data .= fgets($fp, 128); } - if (abs($site[size] - strlen($data)) > 50) { - db_query("UPDATE site SET size = '". strlen($data) ."', timestamp = '". time() ."' WHERE link = '". check_input($site[link]) ."'"); + if (abs($site["size"] - strlen($data)) > 50) { + db_query("UPDATE site SET size = '". strlen($data) ."', timestamp = '". time() ."' WHERE link = '". check_input($site["link"]) ."'"); } fclose($fp); } else { - watchdog("warning", "cloud: failed to syndicate from '$site[name]'". ($errstr ? ": $errstr" : "")); + watchdog("warning", "cloud: failed to syndicate from '". $site["name"] ."'". ($errstr ? ": $errstr" : "")); } } @@ -153,7 +164,7 @@ function cloud_admin() { global $op, $id, $edit; if (user_access("administer site cloud")) { - print "add new site | overview | help
    \n"; + print "add new site | overview | help
    \n"; switch ($op) { case "add": @@ -167,10 +178,10 @@ function cloud_admin() { print cloud_display(); break; case "help": - cloud_help(); + print cloud_help(); break; case "Delete": - $edit[name] = 0; + $edit["name"] = 0; // fall through: case "Submit": print status(cloud_save($edit)); -- cgit v1.2.3