32 lines
1.4 KiB
Plaintext
32 lines
1.4 KiB
Plaintext
<?php
|
|
// $Id$
|
|
|
|
function weblogs_help() {
|
|
$output .= "<p><a href=\"http://www.weblogs.com/\">Weblogs.com</a> is a website that tracks and displays updates to weblogs and news-oriented websites. To get your Drupal site listed, weblogs.com must be informed about your site's updates. This is the job of the weblog module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://www.weblogs.com/\">weblogs.com system</a>. The weblog module automatically notifies weblogs.com when your site is updated. To do so, Drupal implements the <a href=\"http://www.xmlrpc.com/weblogsCom/\">XML-RPC interface of weblogs.com</a>.</p>";
|
|
return $output;
|
|
}
|
|
|
|
function weblogs_cron() {
|
|
|
|
if (db_num_rows(db_query("SELECT nid FROM node WHERE status = 1 AND moderate = 0 AND (created > '". variable_get("weblogs_cron_last", time()) ."' OR changed > '". variable_get("weblogs_cron_last", time()) ."')"), 1)) {
|
|
weblogs_notify(variable_get("site_name", "drupal") ." - ". variable_get("site_slogan", ""), path_uri());
|
|
}
|
|
|
|
variable_set("weblogs_cron_last", time());
|
|
}
|
|
|
|
function weblogs_notify($name, $url) {
|
|
|
|
$client = new xmlrpc_client("/RPC2", "rpc.weblogs.com", 80);
|
|
|
|
$message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($name), new xmlrpcval($url)));
|
|
|
|
$result = $client->send($message);
|
|
|
|
if (!$result || $result->faultCode()) {
|
|
watchdog("error", "failed to notify 'weblogs.com'");
|
|
}
|
|
}
|
|
|
|
?>
|