From 6f2ad759f4785262dc63b2b01829fbf9ed4a9a8f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 7 Jul 2001 13:07:03 +0000 Subject: - import.module: + added internal improvements suggested by Julian. + XHTML-ified - admin.php: + XHTML-ified --- modules/aggregator/aggregator.module | 48 +++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'modules/aggregator/aggregator.module') diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 44f0b480a..30f350300 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -40,10 +40,10 @@ function import_bundle($attributes, $limit = 100) { $keys = explode(",", $attributes); foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'"; - $result = db_query("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY timestamp DESC LIMIT $limit"); + $result = db_query("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY iid DESC LIMIT $limit"); while ($item = db_fetch_object($result)) { - $output .= "
  • link) ."\">". check_output($item->title) ."
  • "; + $output .= "
  • link) ."\">". check_output($item->title) ."
  • "; } return "$output"; @@ -53,7 +53,7 @@ function import_bundle($attributes, $limit = 100) { function import_view_bundle() { $result = db_query("SELECT * FROM bundle ORDER BY title"); while ($bundle = db_fetch_object($result)) { - $output .= "$bundle->title"; + $output .= "$bundle->title"; } return $output; } @@ -91,14 +91,16 @@ function import_update($feed) { // print "
    ". htmlentities($data[0]) ."
    "; - foreach (explode("", $data[0]) as $item) { + $items = array_reverse(explode("", $data[0])); + + foreach ($items as $item) { $t = eregi("(.*)", $item, $title); $l = eregi("(.*)", $item, $link); $a = eregi("(.*)", $item, $author); $d = eregi("(.*)", $item, $description); if ($l || $t || $a || $d) { - import_save_item(array(fid => $feed[fid], title => $title[0], link => $link[0], author => $author[0], description => $description[0], attributes => $feed[attributes])); + import_save_item(array(fid => $feed[fid], title => $title[1], link => $link[1], author => $author[1], description => $description[1], attributes => $feed[attributes])); } } @@ -209,23 +211,23 @@ function import_get_bundle($bid) { function import_view_feed() { $result = db_query("SELECT f.*, COUNT(i.iid) AS items FROM feed f LEFT JOIN item i ON f.fid = i.fid GROUP BY f.fid ORDER BY f.title"); - $output .= "

    Feed overview

    "; - $output .= "\n"; - $output .= " \n"; + $output .= "

    Feed overview

    "; + $output .= "
    titleattributesitemslast updatenext updateoperations
    \n"; + $output .= " \n"; while ($feed = db_fetch_object($result)) { - $output .= " \n"; + $output .= " \n"; } - $output .= "
    titleattributesitemslast updatenext updateoperations
    ". check_output($feed->title) ."". check_output($feed->attributes) ."". format_plural($feed->items, "item", "items") ."". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."fid\">edit feedfid\">remove itemsfid\">update items
    ". check_output($feed->title) ."". check_output($feed->attributes) ."". format_plural($feed->items, "item", "items") ."". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."fid\">edit feedfid\">remove itemsfid\">update items
    \n"; + $output .= "\n"; $result = db_query("SELECT * FROM bundle ORDER BY title"); - $output .= "

    Bundle overview

    "; - $output .= "\n"; - $output .= " \n"; + $output .= "

    Bundle overview

    "; + $output .= "
    titleattributesoperations
    \n"; + $output .= " \n"; while ($bundle = db_fetch_object($result)) { - $output .= " \n"; + $output .= " \n"; } - $output .= "
    titleattributesoperations
    ". check_output($bundle->title) ."". check_output($bundle->attributes) ."bid\">edit bundle
    ". check_output($bundle->title) ."". check_output($bundle->attributes) ."bid\">edit bundle
    \n"; + $output .= "\n"; return $output; } @@ -235,15 +237,15 @@ function import_view_item() { $result = db_query("SELECT i.*, f.title AS feed FROM item i LEFT JOIN feed f ON i.fid = f.fid ORDER BY i.timestamp DESC LIMIT 50"); - $output .= "
    \n"; - $output .= "\n"; - $output .= " \n"; + $output .= "\n"; + $output .= "
    timefeeditem
    \n"; + $output .= " \n"; while ($item = db_fetch_object($result)) { - $output .= " \n"; + $output .= " \n"; } - $output .= "
    timefeeditem
    ". format_date($item->timestamp, "custom", "m/d/y") ."
    ".format_date($item->timestamp, "custom", "H:i") ."
    fid\">". check_output($item->feed) ."link) ."\">". check_output($item->title) ."". ($item->description ? "
    ". check_output($item->description) ."" : "") ."
    iid]\" VALUE=\"". check_form($item->attributes) ."\" SIZE=\"50\">
    ". format_date($item->timestamp, "custom", "m/d/y") ."
    ".format_date($item->timestamp, "custom", "H:i") ."
    fid\">". check_output($item->feed) ."link) ."\">". check_output($item->title) ."". ($item->description ? "
    ". check_output($item->description) ."" : "") ."
    iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" />
    \n"; - $output .= "\n"; - $output .= "
    \n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; return $output; } @@ -253,7 +255,7 @@ function import_admin() { if (user_access("administer news feeds")) { - print "add new bundle | add new feed | available bundles | available items | overview | help
    "; + print "add new bundle | add new feed | available bundles | available items | overview | help
    "; switch($op) { case "help": -- cgit v1.2.3