From 501353f297a7dd829ddbb6b9916dd92607653b63 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sat, 14 Jul 2001 14:19:45 +0000 Subject: [PATCH] - blog.module: + oops, fix small bug --- modules/blog.module | 18 +++++++++--------- modules/blog/blog.module | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/blog.module b/modules/blog.module index b73601973996..a568f4aa0028 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -67,7 +67,7 @@ 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 30"); + $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"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; while ($blog = db_fetch_object($result)) { @@ -86,15 +86,13 @@ function blog_page_user($name = 0, $date = 0) { $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"; - $theme->header(); $theme->box(strtr(t("%a's blog"), array("%a" => $name)), $output, "main"); - $theme->footer(); } -function blog_page_last($num = 20) { +function blog_page_last() { global $theme; - $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 $num"); + $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"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; while ($blog = db_fetch_object($result)) { @@ -109,9 +107,7 @@ function blog_page_last($num = 20) { $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"; - $theme->header(); $theme->box(t("User blogs"), $output, "main"); - $theme->footer(); } function blog_remove($nid) { @@ -210,7 +206,9 @@ function blog_edit_history($nid) { } function blog_page() { - global $op, $name, $date; + global $theme, $op, $name, $date; + + $theme->header(); if (user_access("access blogs")) { switch ($op) { @@ -232,8 +230,10 @@ function blog_page() { } } else { - print message_access(); + $theme->box(t("Access denied"), message_access()); } + + $theme->footer(); } function blog_user() { diff --git a/modules/blog/blog.module b/modules/blog/blog.module index b73601973996..a568f4aa0028 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -67,7 +67,7 @@ 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 30"); + $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"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; while ($blog = db_fetch_object($result)) { @@ -86,15 +86,13 @@ function blog_page_user($name = 0, $date = 0) { $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"; - $theme->header(); $theme->box(strtr(t("%a's blog"), array("%a" => $name)), $output, "main"); - $theme->footer(); } -function blog_page_last($num = 20) { +function blog_page_last() { global $theme; - $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 $num"); + $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"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; while ($blog = db_fetch_object($result)) { @@ -109,9 +107,7 @@ function blog_page_last($num = 20) { $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"; - $theme->header(); $theme->box(t("User blogs"), $output, "main"); - $theme->footer(); } function blog_remove($nid) { @@ -210,7 +206,9 @@ function blog_edit_history($nid) { } function blog_page() { - global $op, $name, $date; + global $theme, $op, $name, $date; + + $theme->header(); if (user_access("access blogs")) { switch ($op) { @@ -232,8 +230,10 @@ function blog_page() { } } else { - print message_access(); + $theme->box(t("Access denied"), message_access()); } + + $theme->footer(); } function blog_user() { -- GitLab