From 2d1e9126cb10f52e7711ce121f8bdaa5bdc71aa4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 16 Sep 2001 11:33:14 +0000 Subject: - Added the new user module! --- includes/theme.inc | 48 +++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) (limited to 'includes/theme.inc') diff --git a/includes/theme.inc b/includes/theme.inc index 1ff536d18..6b0a97e88 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -13,9 +13,9 @@ class BaseTheme { global $REQUEST_URI, $user; $output .= "
\n"; $output .= "
\n"; - $output .= comment_mode(($user->id ? $user->mode : $mode)); - $output .= comment_order(($user->id ? $user->sort : $order)); - $output .= comment_threshold(($user->id ? $user->threshold : $threshold)); + $output .= comment_mode(($user->uid ? $user->mode : $mode)); + $output .= comment_order(($user->uid ? $user->sort : $order)); + $output .= comment_threshold(($user->uid ? $user->threshold : $threshold)); $output .= "\n"; $output .= "\n"; $output .= "
\n"; @@ -40,21 +40,9 @@ function theme_init() { function theme_account($region, $theme) { global $user; - if ($user->id) { + if ($user->uid) { // Display account settings: $content .= "
\n"; - $content .= "". t("your information") ."
\n"; - $content .= "". t("your settings") ."
\n"; - $content .= "". t("your blocks") ."
\n"; - $content .= "". t("your comments") ."
\n"; - $content .= "". t("your submissions") ."
\n"; - $content .= "". strtr(t("your %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; - $content .= "

\n"; - - if (user_access("access administration pages")) { - $content .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; - $content .= "

\n"; - } foreach (module_list() as $name) { if (module_hook($name, "link")) { @@ -62,40 +50,30 @@ function theme_account($region, $theme) { foreach ($links as $link) $content .= "$link
\n"; } } - if ($link) $content .= "

\n"; - $content .= "". t("logout") ."\n"; + if (user_access("access administration pages")) { + $content .= "

\n"; + $content .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; + } + $content .= "

\n"; $theme->box($user->name, $content, $region); } - else { - $output .= "
\n"; - $output .= "
\n"; - $output .= " ". t("Username") .":

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

\n"; - $output .= "
\n"; - if (variable_get("account_register", 1)) $output .= " ". t("REGISTER") ."\n"; - $output .= "

\n"; - $output .= "
\n"; - - $theme->box(t("Login"), $output, $region); - } } - function theme_blocks($region, $theme) { global $id, $PHP_SELF, $status, $user; switch (strrchr($PHP_SELF, "/")) { case "/node.php": if ($region != "left") { - if ($user->id) $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'")); + if ($user->uid) $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'")); if ($node->status == $status[queued]) theme_moderation_results($theme, $node, $region); } break; case "/index.php": - if ($user->id) $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.user = '$user->id'))". (($region == "left" || $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." ORDER BY weight"); + if ($user->uid) $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.user = '$user->uid'))". (($region == "left" || $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." ORDER BY weight"); else $result = db_query("SELECT * FROM blocks WHERE status = 2". (($region == "left" || $region == "right") ? ($region == "left" ? " AND region = 0" : " AND region = 1") : "") ." ORDER BY weight"); while ($block = db_fetch_object($result)) { $blocks = module_invoke($block->module, "block"); @@ -109,8 +87,8 @@ function theme_moderation_results($theme, $node, $region) { foreach (explode(",", $node->users) as $vote) { if ($vote) { $data = explode("=", $vote); - $account = user_get($data[0]); - $output .= format_name($account->name) ." voted '$data[1]'.
"; + $account = user_load(array("uid" => $data[0])); + $output .= format_name($account) ." voted '$data[1]'.
"; } } -- cgit v1.2.3