"headline_page", "cron" => "headline_cron", "help" => "headline_help", "block" => "headline_block", "admin" => "headline_admin", "export" => "headline_export"); include_once "includes/common.inc"; include_once "modules/backend.class"; function headline_blocks() { global $theme; // Get channel info: $result = db_query("SELECT * FROM channel ORDER BY id"); $theme->header(); print "\n"; while ($channel = db_fetch_object($result)) { if ($state % 3 == 0) print " \n"; print " \n"; if ($state % 3 == 2) print " \n"; $state += 1; } print "
\n"; // Load backend from database: $backend = new backend($channel->id); if ($backend->headlines) { unset($content); foreach ($backend->headlines as $headline) $content .= "
  • $headline
  • \n"; } else { $content = "no headlines available\n"; } // Print backend box to screen: $theme->box($backend->site, $content); print "
    \n"; $theme->footer(); } function headline_page() { global $type; switch($type) { case "rdf": headline_rdf(); break; default: headline_blocks(); } } function headline_cron() { $result = db_query("SELECT * FROM channel"); while ($channel = db_fetch_object($result)) { $backend = new Backend($channel->id); } } function headline_help() { ?>

    Drupal's headline module both imports and exports RDF/RSS headlines.

    A lot of news-oriented websites are now publishing news (headlines) and making their content available through XML, RSS and RDF backend files. They syndicate free content and allow retrieval and further transmission, aggregation, and online publication. In its current state, drupal's headline module supports RDF and RSS backends.

    RSS was originally developed by Netscape to allow adding news channels to "My Netscape" sites, but it has since become adopted as the de facto net standard for distributing headlines and brief dynamic texts.

    The headline module goes out to a list of configured news sites once an hour or so (driven by cron), downloads new RSS/RDF data and makes it available to your visitors. In addition, your headlines are exported as well and can be retrieved by other sites from http://yourdomain.com/export/headlines.rdf.

    id); if ($backend->headlines) { unset($content); foreach ($backend->headlines as $headline) { $content .= "
  • $headline
  • \n"; } } else { $content = "no headlines available"; } $blocks[$channel->id]["subject"] = $backend->site; $blocks[$channel->id]["content"] = $content; $blocks[$channel->id]["info"] = "$backend->site headlines"; $blocks[$channel->id]["link"] = $backend->url; } return $blocks; } function headline_admin_display() { global $theme; // Get channel info: $result = db_query("SELECT * FROM channel ORDER BY id"); $output .= "\n"; $output .= " \n"; while ($channel = db_fetch_object($result)) { // Load backend from database: $backend = new backend($channel->id); $output .= "\n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= "\n"; } $output .= "
    sitecontactlast updateoperations
    ". format_url($backend->url, $backend->site) ."". format_email($backend->contact) ."". ($backend->timestamp == 1 ? "failed" : format_interval(time() - $backend->timestamp) ." ago") ."id\">refreshid\">delete
    \n"; print $output; } function headline_admin_add() { $output .= "
    \n"; $output .= "

    \n"; $output .= " Site name:
    \n"; $output .= " \n"; $output .= "

    \n"; $output .= "

    \n"; $output .= " URL:
    \n"; $output .= " \n"; $output .= "

    \n"; $output .= "

    \n"; $output .= " Backend file:
    \n"; $output .= " \n"; $output .= "

    \n"; $output .= "

    \n"; $output .= " Contact information:
    \n"; $output .= " \n"; $output .= "

    \n"; $output .= " \n"; $output .= "
    \n"; print $output; } function headline_admin_rehash() { global $repository; module_rehash_blocks("headline", $repository["headline"]); } function headline_admin() { global $op, $id, $site, $url, $backend, $contact; print "add new channel | overview | help
    "; switch($op) { case "add": headline_admin_add(); break; case "delete": $backend = new backend($id); $backend->delete(); headline_admin_rehash(); headline_admin_display(); break; case "help": headline_help(); break; case "refresh": $backend = new backend($id); $backend->refresh(); headline_admin_display(); break; case "Add backend": $backend = new backend($id, $site, $url, $backend, $contact); $backend->add(); headline_admin_rehash(); // fall through: default: headline_admin_display(); } } function headline_export($uri) { global $site_name, $site_url, $status, $HTTP_REFERER, $HTTP_USER_AGENT; if ($uri[1] == "headlines.rdf") { watchdog("message", "grabbed 'headlines.rdf' - referring url: $HTTP_REFERER - user agent: $HTTP_USER_AGENT"); header("Content-Type: text/plain"); print "\n"; print "\n"; print "\n"; print " $site_name\n"; print " $site_url\n"; print " $site_name\n"; print "\n"; $result = db_query("SELECT * FROM nodes WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10"); while ($node = db_fetch_object($result)) { print "\n"; print " ". check_export($node->title) ."\n"; print " ". $site_url ."node.php?id=$node->nid\n"; print "\n"; } print "\n"; } } ?>