diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-08-05 14:33:53 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-08-05 14:33:53 +0000 |
commit | 30ad2effd4d8e45c53906b552bf859420d48ad27 (patch) | |
tree | 8e6049879d1f0e231245d4244ef2b7ac973f52e9 | |
parent | 2d13b53000bebc3e75d8d63aed69d75849b57d57 (diff) | |
download | brdo-30ad2effd4d8e45c53906b552bf859420d48ad27.tar.gz brdo-30ad2effd4d8e45c53906b552bf859420d48ad27.tar.bz2 |
- various updates
-rw-r--r-- | modules/aggregator.module | 7 | ||||
-rw-r--r-- | modules/aggregator/aggregator.module | 7 | ||||
-rw-r--r-- | modules/blog.module | 55 | ||||
-rw-r--r-- | modules/blog/blog.module | 55 | ||||
-rw-r--r-- | modules/cloud.module | 2 | ||||
-rw-r--r-- | modules/import.module | 7 |
6 files changed, 92 insertions, 41 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module index b782dad0b..52d039c2e 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -2,7 +2,6 @@ function import_help() { ?> - <P><I>TODO: introduction on syndication and a few pointers to more information.</I></P> <P>In Drupal you have <I>feeds</I> and <I>bundles</I>. Feeds define news sources and bundles categoriz syndicated content by source, topic or any other heuristic. Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called "Sport".</P> <P>You can have several providers of news feeds. You can add a feed by clicking the "add feed" link on the import administration pages. Give the feed a name, supply the URI and a comma-separated list of attributes that you want to associate the feed with. The update interval defines how often Drupal should go out to try and grab fresh content. The expiration time defines how long syndicated content is kept in the database. So set the update and expiration time and save your settings. You have just defined your first feed. If you have more feeds repeat as necessary.</P> <P>To verify whether your feed works, press "update items" at the overview page. The number of items that have been sucessfully fetched, should then become visible in the third column of the feed overview.</P> @@ -139,7 +138,7 @@ function import_refresh($feed) { ** Grab the headlines: */ - if ($fp = fopen($feed[url], "r")) { + if ($fp = @fopen($feed[url], "r")) { // fetch data: while (!feof($fp)) { $data .= fgets($fp, 128); @@ -212,7 +211,7 @@ function import_refresh($feed) { } } else { - watchdog("warning", "failed to syndicate from '$feed[title]'". ($errstr ? ": $errstr" : "")); + watchdog("warning", "import: failed to syndicate from '$feed[title]'". ($errstr ? ": $errstr" : "")); } return "feed '$feed[title]' updated."; @@ -353,7 +352,7 @@ function import_fd_collect($edit) { set_time_limit(180); - if ($fp = fopen($edit[url], "r")) { + if ($fp = @fopen($edit[url], "r")) { // fetch data: while (!feof($fp)) { $data .= fgets($fp, 128); diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index b782dad0b..52d039c2e 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -2,7 +2,6 @@ function import_help() { ?> - <P><I>TODO: introduction on syndication and a few pointers to more information.</I></P> <P>In Drupal you have <I>feeds</I> and <I>bundles</I>. Feeds define news sources and bundles categoriz syndicated content by source, topic or any other heuristic. Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called "Sport".</P> <P>You can have several providers of news feeds. You can add a feed by clicking the "add feed" link on the import administration pages. Give the feed a name, supply the URI and a comma-separated list of attributes that you want to associate the feed with. The update interval defines how often Drupal should go out to try and grab fresh content. The expiration time defines how long syndicated content is kept in the database. So set the update and expiration time and save your settings. You have just defined your first feed. If you have more feeds repeat as necessary.</P> <P>To verify whether your feed works, press "update items" at the overview page. The number of items that have been sucessfully fetched, should then become visible in the third column of the feed overview.</P> @@ -139,7 +138,7 @@ function import_refresh($feed) { ** Grab the headlines: */ - if ($fp = fopen($feed[url], "r")) { + if ($fp = @fopen($feed[url], "r")) { // fetch data: while (!feof($fp)) { $data .= fgets($fp, 128); @@ -212,7 +211,7 @@ function import_refresh($feed) { } } else { - watchdog("warning", "failed to syndicate from '$feed[title]'". ($errstr ? ": $errstr" : "")); + watchdog("warning", "import: failed to syndicate from '$feed[title]'". ($errstr ? ": $errstr" : "")); } return "feed '$feed[title]' updated."; @@ -353,7 +352,7 @@ function import_fd_collect($edit) { set_time_limit(180); - if ($fp = fopen($edit[url], "r")) { + if ($fp = @fopen($edit[url], "r")) { // fetch data: while (!feof($fp)) { $data .= fgets($fp, 128); diff --git a/modules/blog.module b/modules/blog.module index e6748a6ef..fa8f2fbf7 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -71,22 +71,36 @@ function blog_page_user($name = 0, $date = 0) { $name = check_input($name ? $name : $user->userid); $date = check_input($date ? $date : time()); - $result = db_query("SELECT n.nid, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id WHERE u.userid = '$name' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id WHERE u.userid = '$name' AND n.timestamp < '$date' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; + while ($blog = db_fetch_object($result)) { + if ($date != date("dny", $blog->timestamp)) { $date = date("dny", $blog->timestamp); - if ($user->id && $user->userid == $name) { - $links = array("<a href=\"submit.php?mod=blog&op=edit&id=$blog->nid\">". t("edit") ."</a>"); - $output .= "<tr><td><b>". format_date($blog->timestamp, custom, "d M Y") .":</b></td><td align=\"right\">". $theme->links($links) ."</td></tr>"; - } - else { - $output .= "<tr><td colspan=\"2\"><b>". format_date($blog->timestamp, custom, "d M Y") .":</b></td></tr>"; - } + $output .= "<tr><td colspan=\"2\"><b><a href=\"module.php?mod=blog&name=$name&date=". mktime(23, 59, 59, date("n", $blog->timestamp), date("d", $blog->timestamp), date("Y", $blog->timestamp)) ."\">". format_date($blog->timestamp, custom, "d M Y") .":</a></b></td></tr>"; + } + + if ($user->id && $user->userid == $name) { + $links[] = "<a href=\"submit.php?mod=blog&op=edit&id=$blog->nid\">". t("edit") ."</a>"; + } + + if ($user->id && user_access("post blogs")) { + $links[] = "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\">". t("blog") ."</a>"; + } + + if ($blog->comment) { + $links[] = "<a href=\"node.php?id=$blog->nid\">". t("discuss") ."</a>"; } - $output .= "<tr><td colspan=\"2\" style=\"margin-left: 20px;\">". check_output($blog->body, 1) ."</td></tr>"; + + $output .= "<tr><td><div style=\"margin-left: 20px;\"><b>". check_output($blog->title) ."</b></div></td><td align=\"right\">". $theme->links($links) ."</td></tr>"; + $output .= "<tr><td colspan=\"2\"><div style=\"margin-left: 40px;\">". check_output($blog->body, 1) ."</div><br /></td></tr>"; + + unset($links); + } + $output .= "</table>"; $output .= "<a href=\"module.php?mod=blog&op=feed&name=". urlencode($name) ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n"; @@ -94,20 +108,34 @@ function blog_page_user($name = 0, $date = 0) { } function blog_page_last() { - global $theme; + global $theme, $user; - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.userid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id ORDER BY b.lid DESC LIMIT 20"); + $result = db_query("SELECT n.author, n.nid, n.title, n.comment, n.timestamp, b.body, u.userid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id ORDER BY b.lid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; + while ($blog = db_fetch_object($result)) { + $links[] = "<a href=\"module.php?mod=blog&op=view&name=". urlencode($blog->userid) ."\">". strtr(t("%a's blog"), array("%a" => $blog->userid)) ."</a>"; - $links[] = "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\">". t("blog") ."</a>"; - $links[] = "<a href=\"node.php?id=$blog->nid\">". t("discuss") ."</a>"; + + if ($blog->author == $user->id) { + $links[] = "<a href=\"submit.php?mod=blog&op=edit&id=$blog->nid\">". t("edit") ."</a>"; + } + + if ($user->id && user_access("post blogs")) { + $links[] = "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\">". t("blog") ."</a>"; + } + + if ($blog->comment) { + $links[] = "<a href=\"node.php?id=$blog->nid\">". t("discuss") ."</a>"; + } $output .= "<tr><td><b>". check_output($blog->title) ."</b></td><td align=\"right\">". $theme->links($links) ."</td></tr>"; $output .= "<tr><td colspan=\"2\"><div style=\"margin-left: 20px;\">". check_output($blog->body, 1) ."</div><br /></td></tr>"; + unset($links); } + $output .= "</table>"; $output .= "<a href=\"module.php?mod=blog&op=feed\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n"; @@ -215,7 +243,6 @@ function blog_edit_history($nid) { function blog_page() { global $theme, $op, $name, $date; - if (user_access("access blogs")) { switch ($op) { case "feed": diff --git a/modules/blog/blog.module b/modules/blog/blog.module index e6748a6ef..fa8f2fbf7 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -71,22 +71,36 @@ function blog_page_user($name = 0, $date = 0) { $name = check_input($name ? $name : $user->userid); $date = check_input($date ? $date : time()); - $result = db_query("SELECT n.nid, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id WHERE u.userid = '$name' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id WHERE u.userid = '$name' AND n.timestamp < '$date' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; + while ($blog = db_fetch_object($result)) { + if ($date != date("dny", $blog->timestamp)) { $date = date("dny", $blog->timestamp); - if ($user->id && $user->userid == $name) { - $links = array("<a href=\"submit.php?mod=blog&op=edit&id=$blog->nid\">". t("edit") ."</a>"); - $output .= "<tr><td><b>". format_date($blog->timestamp, custom, "d M Y") .":</b></td><td align=\"right\">". $theme->links($links) ."</td></tr>"; - } - else { - $output .= "<tr><td colspan=\"2\"><b>". format_date($blog->timestamp, custom, "d M Y") .":</b></td></tr>"; - } + $output .= "<tr><td colspan=\"2\"><b><a href=\"module.php?mod=blog&name=$name&date=". mktime(23, 59, 59, date("n", $blog->timestamp), date("d", $blog->timestamp), date("Y", $blog->timestamp)) ."\">". format_date($blog->timestamp, custom, "d M Y") .":</a></b></td></tr>"; + } + + if ($user->id && $user->userid == $name) { + $links[] = "<a href=\"submit.php?mod=blog&op=edit&id=$blog->nid\">". t("edit") ."</a>"; + } + + if ($user->id && user_access("post blogs")) { + $links[] = "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\">". t("blog") ."</a>"; + } + + if ($blog->comment) { + $links[] = "<a href=\"node.php?id=$blog->nid\">". t("discuss") ."</a>"; } - $output .= "<tr><td colspan=\"2\" style=\"margin-left: 20px;\">". check_output($blog->body, 1) ."</td></tr>"; + + $output .= "<tr><td><div style=\"margin-left: 20px;\"><b>". check_output($blog->title) ."</b></div></td><td align=\"right\">". $theme->links($links) ."</td></tr>"; + $output .= "<tr><td colspan=\"2\"><div style=\"margin-left: 40px;\">". check_output($blog->body, 1) ."</div><br /></td></tr>"; + + unset($links); + } + $output .= "</table>"; $output .= "<a href=\"module.php?mod=blog&op=feed&name=". urlencode($name) ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n"; @@ -94,20 +108,34 @@ function blog_page_user($name = 0, $date = 0) { } function blog_page_last() { - global $theme; + global $theme, $user; - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.userid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id ORDER BY b.lid DESC LIMIT 20"); + $result = db_query("SELECT n.author, n.nid, n.title, n.comment, n.timestamp, b.body, u.userid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.id ORDER BY b.lid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; + while ($blog = db_fetch_object($result)) { + $links[] = "<a href=\"module.php?mod=blog&op=view&name=". urlencode($blog->userid) ."\">". strtr(t("%a's blog"), array("%a" => $blog->userid)) ."</a>"; - $links[] = "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\">". t("blog") ."</a>"; - $links[] = "<a href=\"node.php?id=$blog->nid\">". t("discuss") ."</a>"; + + if ($blog->author == $user->id) { + $links[] = "<a href=\"submit.php?mod=blog&op=edit&id=$blog->nid\">". t("edit") ."</a>"; + } + + if ($user->id && user_access("post blogs")) { + $links[] = "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\">". t("blog") ."</a>"; + } + + if ($blog->comment) { + $links[] = "<a href=\"node.php?id=$blog->nid\">". t("discuss") ."</a>"; + } $output .= "<tr><td><b>". check_output($blog->title) ."</b></td><td align=\"right\">". $theme->links($links) ."</td></tr>"; $output .= "<tr><td colspan=\"2\"><div style=\"margin-left: 20px;\">". check_output($blog->body, 1) ."</div><br /></td></tr>"; + unset($links); } + $output .= "</table>"; $output .= "<a href=\"module.php?mod=blog&op=feed\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n"; @@ -215,7 +243,6 @@ function blog_edit_history($nid) { function blog_page() { global $theme, $op, $name, $date; - if (user_access("access blogs")) { switch ($op) { case "feed": diff --git a/modules/cloud.module b/modules/cloud.module index d17f2eafa..75e9fb63e 100644 --- a/modules/cloud.module +++ b/modules/cloud.module @@ -50,7 +50,7 @@ function cloud_update($site) { ** Grab the page and update the database if required: */ - if ($fp = fopen($site[feed], "r")) { + if ($fp = @fopen($site[feed], "r")) { while(!feof($fp)) { $data .= fgets($fp, 128); } diff --git a/modules/import.module b/modules/import.module index b782dad0b..52d039c2e 100644 --- a/modules/import.module +++ b/modules/import.module @@ -2,7 +2,6 @@ function import_help() { ?> - <P><I>TODO: introduction on syndication and a few pointers to more information.</I></P> <P>In Drupal you have <I>feeds</I> and <I>bundles</I>. Feeds define news sources and bundles categoriz syndicated content by source, topic or any other heuristic. Bundles provide a generalized way of creating composite feeds. They allow you, for example, to combine various sport-related feeds into one bundle called "Sport".</P> <P>You can have several providers of news feeds. You can add a feed by clicking the "add feed" link on the import administration pages. Give the feed a name, supply the URI and a comma-separated list of attributes that you want to associate the feed with. The update interval defines how often Drupal should go out to try and grab fresh content. The expiration time defines how long syndicated content is kept in the database. So set the update and expiration time and save your settings. You have just defined your first feed. If you have more feeds repeat as necessary.</P> <P>To verify whether your feed works, press "update items" at the overview page. The number of items that have been sucessfully fetched, should then become visible in the third column of the feed overview.</P> @@ -139,7 +138,7 @@ function import_refresh($feed) { ** Grab the headlines: */ - if ($fp = fopen($feed[url], "r")) { + if ($fp = @fopen($feed[url], "r")) { // fetch data: while (!feof($fp)) { $data .= fgets($fp, 128); @@ -212,7 +211,7 @@ function import_refresh($feed) { } } else { - watchdog("warning", "failed to syndicate from '$feed[title]'". ($errstr ? ": $errstr" : "")); + watchdog("warning", "import: failed to syndicate from '$feed[title]'". ($errstr ? ": $errstr" : "")); } return "feed '$feed[title]' updated."; @@ -353,7 +352,7 @@ function import_fd_collect($edit) { set_time_limit(180); - if ($fp = fopen($edit[url], "r")) { + if ($fp = @fopen($edit[url], "r")) { // fetch data: while (!feof($fp)) { $data .= fgets($fp, 128); |