summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-12-08 08:46:55 +0000
committerDries Buytaert <dries@buytaert.net>2001-12-08 08:46:55 +0000
commit8eb45a6ebaae86f29d96c35dd7b247030fbaec24 (patch)
tree11f9b40623ebf2b7cc65b45e5ae722cbb098edf7
parent20b4b7166f851221eef4c845d396af2efd581822 (diff)
downloadbrdo-8eb45a6ebaae86f29d96c35dd7b247030fbaec24.tar.gz
brdo-8eb45a6ebaae86f29d96c35dd7b247030fbaec24.tar.bz2
- 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.
-rw-r--r--modules/cloud.module31
1 files changed, 21 insertions, 10 deletions
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 @@
<?php
// $Id$
+function cloud_help() {
+ $output .= "The cloud monitor tracks related websites and displays the last modification dates. Visitors to the host site learn about relevant sites and can easily see if there is new content. Here is how it works:";
+ $output .= "<ul>";
+ $output .= " <li>The site administrator enters names and URLs of the relevant pages on the cloud monitor administration page.</li>";
+ $output .= " <li>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.)</li>";
+ $output .= " <li>The module exports both a page and a block that display the registered sites ordered by their last modification date.</li>";
+ $output .= "</ul>";
+
+ 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 "<SMALL><A HREF=\"admin.php?mod=cloud&op=add\">add new site</A> | <A HREF=\"admin.php?mod=cloud\">overview</A> | <A HREF=\"admin.php?mod=cloud&op=help\">help</A></SMALL><HR>\n";
+ print "<small><a href=\"admin.php?mod=cloud&op=add\">add new site</a> | <a href=\"admin.php?mod=cloud\">overview</a> | <a href=\"admin.php?mod=cloud&op=help\">help</a></small><hr />\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));