summaryrefslogtreecommitdiff
path: root/modules/weblogs.module
blob: c7e31fabb2a6fb6f509fda814d9689c5c106ae67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?

function weblogs_cron() {

  if (db_num_rows(db_query("SELECT nid FROM node WHERE status = '". node_status("posted") ."' AND timestamp > '". variable_get("weblogs_cron_last", time()) ."'", 1))) {
    weblogs_notify(variable_get("site_name", "drupal") , 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'");
  }
}

?>