From 8c672011a267d193fa47cd7cbb523e90a643ee32 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Mon, 21 Jan 2002 17:31:13 +0000 Subject: - moved user block from theme.inc to user.module. * only problem is that the admin.php link is not available until the admin enables the block. * $theme->user is obsolete, will patch the themes properly in a later patch. - moved moderation block from theme.inc to queue.module. * removed theme_moderation_results(). - updated database/database.mysql. --- modules/queue.module | 29 +++++++++++++++++++++++++++++ modules/user.module | 45 +++++++++++++++++++++++++++++++++++++++++++++ modules/user/user.module | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) (limited to 'modules') diff --git a/modules/queue.module b/modules/queue.module index 11790447e..c301051d1 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -170,4 +170,33 @@ function queue_page() { } } +function queue_block() { + global $PHP_SELF; + if (strrchr($PHP_SELF, "/") == "/node.php") { + global $user, $id; + if ($user->uid) { + $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'")); + } + if ($node->moderate == 1) { + foreach (explode(",", $node->users) as $vote) { + if ($vote) { + $data = explode("=", $vote); + $account = user_load(array("uid" => $data[0])); + $output .= format_name($account) ." voted '$data[1]'.
"; + } + } + + $block[0]["subject"] = t("Moderation results"); + $block[0]["content"] = $output ? $output : t("This node has not been moderated yet."); + $block[0]["info"] = t("Moderation results"); + } + } + elseif (strrchr($PHP_SELF, "/") == "/admin.php") { + $block[0]["subject"] = t("Moderation results"); + $block[0]["info"] = t("Moderation results"); + } + + return $block; +} + ?> diff --git a/modules/user.module b/modules/user.module index 24a67d170..899901bda 100644 --- a/modules/user.module +++ b/modules/user.module @@ -454,6 +454,51 @@ function user_search($keys) { return $find; } +function user_block() { + global $user; + + if ($user->uid) { + // Display account settings: + $block[0]["subject"] = $user->name; + + $output .= "
\n"; + + foreach (module_list() as $name) { + if (module_hook($name, "link")) { + $links = module_invoke($name, "link", "menu"); + foreach ($links as $link) { + $output .= "$link
\n"; + } + } + } + + if (user_access("access administration pages")) { + $output .= "
\n"; + $output .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; + } + + $output .= "
"; + } + else { + $block[0]["subject"] = t("Log in"); + + $output .= "
\n"; + $output .= "
\n"; + $output .= " ". t("Username") .":

\n"; + $output .= " ". t("Password") .":

\n"; + $output .= form_checkbox(t("Remember me"), "remember_me", 1, 0); + $output .= "
\n"; + if (variable_get("account_register", 1)) $output .= " ". t("REGISTER") ."\n"; + $output .= "

\n"; + $output .= "
\n"; + } + $block[0]["content"] = $output; + $block[0]["info"] = t("User information"); + $block[0]["link"] = "module.php?mod=user"; + + return $block; +} + function user_link($type) { if ($type == "page") { $links[] = "". t("user account") .""; diff --git a/modules/user/user.module b/modules/user/user.module index 24a67d170..899901bda 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -454,6 +454,51 @@ function user_search($keys) { return $find; } +function user_block() { + global $user; + + if ($user->uid) { + // Display account settings: + $block[0]["subject"] = $user->name; + + $output .= "
\n"; + + foreach (module_list() as $name) { + if (module_hook($name, "link")) { + $links = module_invoke($name, "link", "menu"); + foreach ($links as $link) { + $output .= "$link
\n"; + } + } + } + + if (user_access("access administration pages")) { + $output .= "
\n"; + $output .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; + } + + $output .= "
"; + } + else { + $block[0]["subject"] = t("Log in"); + + $output .= "
\n"; + $output .= "
\n"; + $output .= " ". t("Username") .":

\n"; + $output .= " ". t("Password") .":

\n"; + $output .= form_checkbox(t("Remember me"), "remember_me", 1, 0); + $output .= "
\n"; + if (variable_get("account_register", 1)) $output .= " ". t("REGISTER") ."\n"; + $output .= "

\n"; + $output .= "
\n"; + } + $block[0]["content"] = $output; + $block[0]["info"] = t("User information"); + $block[0]["link"] = "module.php?mod=user"; + + return $block; +} + function user_link($type) { if ($type == "page") { $links[] = "". t("user account") .""; -- cgit v1.2.3