From e32241e59ae93dced80d561350e9c45bf1ca264d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 28 May 2001 18:53:48 +0000 Subject: - Renamed syndication.module to import.module. - Removed headline.module: it became obsolete. - Removed backend.class: it became obsolete. - Added export.module. For now, you can use: 1. http://drupal/export.php?headlines.rss 2. http://drupal/export.php?headlines.rdf - Renamed export to export.php. For now, you can use: 1. http://drupal/export.php?headlines.rss 2. http://drupal/export.php?headlines.rdf Renaming this file has main 3 advantages: 1. We no longer rely on .htaccess for being able to export. 2. It is more conform with the general naming conventions. 3. It removes a pseudo-hack with formatting the URI. - Made import.module export blocks with feeds. --- modules/headline.module | 326 ------------------------------------------------ 1 file changed, 326 deletions(-) delete mode 100644 modules/headline.module (limited to 'modules/headline.module') diff --git a/modules/headline.module b/modules/headline.module deleted file mode 100644 index 7d30bae50..000000000 --- a/modules/headline.module +++ /dev/null @@ -1,326 +0,0 @@ - -

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 export/headlines.rdf.

- format_interval(900), 1800 => format_interval(1800), 3600 => format_interval(3600), 7200 => format_interval(7200), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 64800 => format_interval(64800), 86400 => format_interval(86400), 1000000000 => t("Never")); - $output .= form_select(t("Update interval"), "headline_cron_time" , variable_get("headline_cron_time", 86400), $period, t("The update interval indicating how often you want to update your headline channels. Requires crontab.")); - return $output; -} - - -function headline_cron() { - if (time() - variable_get("headline_cron_last", 0) > variable_get("headline_cron_time", time())) { - variable_set("headline_cron_last", time()); - - $result = db_query("SELECT * FROM channel"); - while ($channel = db_fetch_object($result)) { - $backend = new Backend($channel->id); - } - } -} - -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_block() { - $result = db_query("SELECT * FROM channel"); - while ($channel = db_fetch_object($result)) { - $backend = new Backend($channel->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 .= "\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\">editid\">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_edit($id) { - $result = db_query("SELECT * FROM channel WHERE id='$id' ORDER BY id"); - - if ($channel = db_fetch_object($result)) { - $output .= "
    \n"; - $output .= " \n"; - $output .= "

    \n"; - $output .= " Site name:
    \n"; - $output .= " site\">\n"; - $output .= "

    \n"; - $output .= "

    \n"; - $output .= " URL:
    \n"; - $output .= " url\">\n"; - $output .= "

    \n"; - $output .= "

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

    \n"; - $output .= "

    \n"; - $output .= " Contact information:
    \n"; - $output .= " contact\">\n"; - $output .= "

    \n"; - $output .= " \n"; - $output .= "
    \n"; - } else { - $output .= "Invalid Channel ID.\n"; - } - print $output; -} - -function headline_admin_rehash() { - module_rehash_blocks("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 "edit": - headline_admin_edit(check_input($id)); - break; - case "delete": - $channel = new backend($id); - $channel->delete(); - headline_admin_rehash(); - headline_admin_display(); - break; - case "help": - headline_help(); - break; - case "refresh": - $channel = new backend($id); - $channel->refresh(); - headline_admin_display(); - break; - case "Add backend": - $channel = new backend(check_input($id), check_input($site), check_input($url), check_input($backend), check_input($contact)); - $channel->add(); - headline_admin_rehash(); - headline_admin_display(); - break; - case "Save backend": - $channel = new backend(check_input($id)); - $channel->site = $site; - $channel->url = $url; - $channel->file = $backend; - $channel->contact = $contact; - $channel->save(); - headline_admin_rehash(); - // fall through: - default: - headline_admin_display(); - } -} - -function headline_export_rdf() { - global $status; - - $uri = substr(path_uri(), 0, strlen(path_uri()) - strlen("export/")); - - header("Content-Type: text/plain"); - - print "\n"; - print "\n"; - - print "\n"; - print " ". variable_get(site_name, "drupal") ."\n"; - print " ". $uri ."\n"; - print " ". variable_get(site_name, "drupal") ."\n"; - print "\n"; - - $result = db_query("SELECT * FROM node WHERE promote = '1' 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 " ". $uri ."node.php?id=$node->nid\n"; - print "\n"; - } - - print "\n"; -} - -function headline_export_rss() { - global $status; - - $uri = substr(path_uri(), 0, strlen(path_uri()) - strlen("export/")); - - header("Content-Type: text/plain"); - - print "\n"; - print "\n\n"; - - print "\n"; - print " ". variable_get(site_name, "drupal") ."\n"; - print " ". $uri ."\n"; - print " ". variable_get(site_name, "drupal") ."\n"; - - print " \n"; - print " \n"; - - $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10"); - - while ($node = db_fetch_object($result)) { - print " nid\" />\n"; - } - - print " \n"; - print " \n"; - print "\n\n"; - - $result = db_query("SELECT * FROM node WHERE promote = '1' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10"); - - while ($node = db_fetch_object($result)) { - print "nid\">\n"; - print " ". check_export($node->title) ."\n"; - print " ". $uri ."node.php?id=$node->nid\n"; - - if ($node->abstract) print " ". check_output($node->abstract, 1) ."\n"; - if ($node->body) print " ". check_output($node->body, 1) ."\n"; - - print "\n"; - } - - print "\n"; -} - -function headline_export($uri) { - switch ($uri[2]) { - case "headlines.rss": - headline_export_rss(); - break; - case "headlines.rdf": - case "default": - headline_export_rdf(); - } -} - -?> -- cgit v1.2.3