From 2026396d092c48df91b60c24cb5e1dcef54ce710 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 14 Feb 2002 19:25:01 +0000 Subject: - Commited some changes made by Kjartan. --- modules/blog/blog.module | 57 ++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 38 deletions(-) (limited to 'modules/blog/blog.module') diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 0791a2237..60b36c446 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -135,7 +135,7 @@ function blog_feed_last() { } -function blog_page_user($uid = 0, $date = 0) { +function blog_page_user($uid = 0, $date = 0, $all = 0) { global $theme, $user; if ($uid) { @@ -149,7 +149,7 @@ function blog_page_user($uid = 0, $date = 0) { $date = time(); } - $result = db_query("SELECT nid FROM node WHERE type = 'blog' AND uid = '$account->uid' AND created <= '$date' ORDER BY nid DESC"); + $result = db_query("SELECT nid FROM node WHERE type = 'blog' AND uid = '$account->uid' AND created <= '$date' ORDER BY nid DESC". ($all ? "" : " LIMIT 20")); $output .= ""; @@ -157,34 +157,28 @@ function blog_page_user($uid = 0, $date = 0) { $blog = node_load(array("nid" => $node->nid)); - $links = array(); - if ($date != date("dny", $blog->created)) { $date = date("dny", $blog->created); $output .= ""; } - if ($user->uid && $user->uid == $uid) { - $links[] = "nid\" title=\"". t("Make changes to your blog entry.") ."\">". t("edit") .""; - } - - if ($user->uid) { - $links[] = "nid\" title=\"". t("Comment on this blog entry in your personal blog.") ."\">". t("blog it") .""; - } - - if ($blog->comment) { - $links[] = "nid\" title=\"". t("Read this posting and all of its comments.") ."\">". format_plural(comment_num_all($blog->nid), t("comment"), t("comments")) .""; - } + $links = link_node($blog, 1); $output .= ""; - $output .= ""; + $output .= ""; } $output .= "
uid&date=". mktime(23, 59, 59, date("n", $blog->created), date("d", $blog->created), date("Y", $blog->created)) ."\" title=\"". t("Permanent link to this blog entry.") ."\">". format_date($blog->created, custom, "d M Y") .":
". check_output($blog->title) ."
". $theme->links($links) ."
". check_output($blog->body, 1) ."

". check_output($blog->teaser, 1) ."

"; $output .= "uid\" title=\"". t("Read the XML version of this page.") ."\">image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />\n"; + if (!$all) { + $output .= "uid&all=1\" title=\"". t("Show all blogs by this user") ."\">". t("show all blogs") .""; + } + else { + $output .= "uid\" title=\"". t("Show recent blogs by this user") ."\">". t("show recent blogs") .""; + } - $theme->box(sprintf(t("%s's blog"), $account->name), $output, "main"); + $theme->box(sprintf(t("%s's blog"), $account->name), $output); } function blog_page_last() { @@ -197,24 +191,10 @@ function blog_page_last() { while ($node = db_fetch_object($result)) { $blog = node_load(array("nid" => $node->nid)); - $links = array(); - - $links[] = "uid\" title=\"". sprintf(t("Read %s's latest blog entries."), $blog->name) ."\">". sprintf("%s's blog", $blog->name) .""; - - if ($blog->uid == $user->uid) { - $links[] = "nid\" title=\"". t("Edit this blog entry.") ."\">". t("edit") .""; - } - - if ($user->uid) { - $links[] = "nid\" title=\"". t("Comment on this blog entry in your personal blog.") ."\">". t("blog it") .""; - } - - if ($blog->comment) { - $links[] = "nid\" title=\"". t("Read the posted comments or add a new comment.") ."\">". format_plural(comment_num_all($blog->nid), t("comment"), t("comments")) .""; - } + $links = link_node($blog, 1); $output .= "". check_output($blog->title) ."". $theme->links($links) .""; - $output .= "
". check_output($blog->body, 1) ."

"; + $output .= "
". check_output($blog->teaser, 1) ."

"; } @@ -270,7 +250,7 @@ function blog_form(&$node, &$help, &$error) { function blog_page() { - global $theme, $id, $op, $date; + global $theme, $id, $op, $date, $all; if (user_access("access content")) { switch ($op) { @@ -285,7 +265,7 @@ function blog_page() { default: $theme->header(); if ($id) { - blog_page_user($id, $date); + blog_page_user($id, $date, $all); } else { blog_page_last(); @@ -301,7 +281,7 @@ function blog_page() { } -function blog_link($type, $node = 0) { +function blog_link($type, $node = 0, $main) { global $user; if ($type == "page" && user_access("access content")) { @@ -317,11 +297,12 @@ function blog_link($type, $node = 0) { } if ($type == "node" && $node->type == "blog") { + global $op; if (blog_access("update", $node)) { $links[] = "nid\" title=\"". t("Edit this blog entry.") ."\">". t("edit this blog") .""; } - else { - $links[] = "uid\" title=\"". sprintf(t("Read %s's latest blog entries."), $node->name) ."\">". strtr(t("%a's blog"), array("%a" => $node->name)) .""; + elseif ($op != "view") { + $links[] = "uid\" title=\"". sprintf(t("Read %s's latest blog entries."), $node->name) ."\">". sprintf("%s's blog", $node->name) .""; } } -- cgit v1.2.3