diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cloud.module | 31 |
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)); |