summaryrefslogtreecommitdiff
path: root/modules/blog.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/blog.module')
-rw-r--r--modules/blog.module49
1 files changed, 20 insertions, 29 deletions
diff --git a/modules/blog.module b/modules/blog.module
index 14863d550..d08c94f27 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -52,7 +52,7 @@ function blog_head($main = 0) {
if ($mod == "blog" && $id) {
$account = user_load(array("uid" => $id));
- $output[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->name. "'s blog\" href=\"". path_uri(). "module.php?mod=blog&op=view&id=$id\" />";
+ $output[] = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS - ". $account->name. "'s blog\" href=\"". path_uri() . url("blog/view/$id") ." />";
}
return $output ? $output : array();
}
@@ -61,7 +61,7 @@ function blog_user($type, &$edit, &$user) {
switch ($type) {
case "view_public":
case "view_private":
- return form_item(t("Blog"), lm(t("view recent entries"), array("mod" => "blog", "id" => $user->uid), "") ."<br />". lm(t("view all entries"), array("mod" => "blog", "id" => $user->uid, "all" => 1), ""));
+ return form_item(t("Blog"), l(t("view recent blog entries"), "blog/$user->uid"));
}
}
@@ -130,16 +130,15 @@ function blog_feed_user($uid = 0) {
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15");
$channel["title"] = $account->name. "'s blog";
- $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view", "id" => $uid), "module");
+ $channel["link"] = path_uri() . url("blog/view/$uid");
$channel["description"] = $term->description;
node_feed($result, $channel);
-
}
function blog_feed_last() {
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15");
- $channel["title"] = variable_get("site_name", "drupal"). "blogs";
- $channel["link"] = path_uri(). drupal_url(array ("mod" => "blog", "op" => "view"), "module");
+ $channel["title"] = variable_get("site_name", "drupal") ." blogs";
+ $channel["link"] = path_uri() . url("blog/view");
$channel["description"] = $term->description;
node_feed($result, $channel);
}
@@ -153,16 +152,13 @@ function blog_page_user($uid = 0) {
else {
$account = $user;
}
- $links[] = lm(t("view %username's profile", array("%username" => $account->name)), array("mod" => "user", "id" => $account->uid), "", array("title" => t("View %username's profile information.", array("%username" => $account->name))));
- $links[] = lm(t("view recent blog entries"), array("mod" => "blog", "op" => "view"), "", array("title" => t("View all recent blog entries.")));
- $theme->box(t("%username's blog", array ("%username" => $account->name)), "<center>". $theme->links($links). "</center>");
$result = pager_query("SELECT nid FROM node WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", $user->nodes ? $user->nodes : variable_get("default_nodes_main", 10));
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- print lm("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), "", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name))));
+ print l("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array ("%username" => $account->name))));
}
function blog_page_last() {
@@ -174,7 +170,7 @@ function blog_page_last() {
$output = node_view(node_load(array("nid" => $node->nid)), 1);
}
$output .= pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
- $output .= lm("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), "", array("title" => t("Read the XML version of all blogs.")));
+ $output .= l("<img align=\"right\" src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" />", "blog/feed", array("title" => t("Read the XML version of all blogs.")));
return $output;
}
@@ -182,7 +178,6 @@ function blog_form(&$node, &$help, &$error) {
global $nid, $iid;
if (isset($node->body)) {
-
/*
** Validate the size of the blog:
*/
@@ -205,7 +200,7 @@ function blog_form(&$node, &$help, &$error) {
*/
if ($nid && $blog = node_load(array("nid" => $nid))) {
- $node->body = "<i>". $blog->body ."</i> [".lm($blog->name, array("mod" => "blog", "id" => $blog->uid, "date" => $blog->created))."]";
+ $node->body = "<i>". $blog->body ."</i> [". l($blog->name, "node/view/$nid") ."]";
}
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%s' AND i.fid = f.fid", $iid))) {
@@ -223,13 +218,13 @@ function blog_form(&$node, &$help, &$error) {
}
function blog_page() {
- global $theme, $id, $op, $name;
+ global $theme;
if (user_access("access content")) {
- switch ($op) {
+ switch (arg(1)) {
case "feed":
- if ($id) {
- blog_feed_user($id);
+ if (arg(2)) {
+ blog_feed_user(arg(2));
}
else {
blog_feed_last();
@@ -237,12 +232,8 @@ function blog_page() {
break;
default:
$theme->header();
- if ($name) {
- $user = user_load(array("name" => $name));
- $id = $user->uid;
- }
- if ($id) {
- blog_page_user($id);
+ if (arg(1)) {
+ blog_page_user(arg(1));
}
else {
print blog_page_last();
@@ -262,25 +253,25 @@ function blog_link($type, $node = 0, $main) {
global $user;
if ($type == "page" && user_access("access content")) {
- $links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
+ $links[] = l(t("user blogs"), "blog", array("title" => t("Read the latest blog entries.")));
}
if ($type == "menu.create" && user_access("maintain personal blog")) {
- $links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
+ $links[] = l(t("create blog entry"), "node/add/blog", array("title" => t("Add a new personal blog entry.")));
}
if ($type == "menu.view" && user_access("maintain personal blog")) {
- $links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
+ $links[] = l(t("view personal blog"), "blog/$user->uid", array("title" => t("Read your latest blog entries.")));
}
if ($type == "node" && $node->type == "blog") {
global $mod, $op, $id;
if (blog_access("update", $node)) {
- $links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Edit this blog entry.")));
+ $links[] = l(t("edit this blog entry"), "node/edit/$node->nid", array("title" => t("Edit this blog entry.")));
}
elseif (empty($id)) {
- $links[] = lm(t("%username's blog", array("%username" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), "", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
+ $links[] = l(t("%username's blog", array("%username" => $node->name)), "blog/$node->uid", array("title" => t("Read %username's latest blog entries.", array("%username" => $node->name))));
}
}
@@ -296,7 +287,7 @@ function blog_block($op = "list", $delta = 0) {
else {
if (user_access("access content")) {
$block["content"] = node_title_list(db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 10"));
- $block["content"] .= "<div align=\"right\" id=\"blog_more\">". lm(t("more"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))) ."</div>";
+ $block["content"] .= "<div align=\"right\" id=\"blog_more\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>";
$block["subject"] = t("User blogs");
}
return $block;