diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-06-29 22:08:57 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-06-29 22:08:57 +0000 |
commit | 9c43e8fc7a192dfe768c76a539373915bddaa0aa (patch) | |
tree | 32dfe7f04171c2600be4164ca529d7f42766ec32 /includes/theme.inc | |
parent | 124694ee4dbcc1df5dfc2d419ed2393619883071 (diff) | |
download | brdo-9c43e8fc7a192dfe768c76a539373915bddaa0aa.tar.gz brdo-9c43e8fc7a192dfe768c76a539373915bddaa0aa.tar.bz2 |
Extremely large commit:
- Fixed tiny quote problem in account.php.
- Fixed tiny bug in comment.inc.
- Fixed tiny bug in comment.module.
- Fixed tiny bug in meta.module.
- Simplified user_access() API.
- Rewrote link system: still needs fine-tuning and testing so don't
upgrade if you are running a production site. ;)
Updated all modules and themes to reflect this change. All other
themes and modules need updating too!
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index b01638d60..9530c60b1 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1,16 +1,8 @@ <?php class BaseTheme { - function links(&$links, $state = 0) { - // $state = 0 : default behaviour - // $state = 1 : main page - // $state = 2 : theme_link() - // Subject to change coz its messy - foreach ($links as $link) { - if ($link[0]) $_links[] = count($link) == 2 ? "<A HREF=\"$link[0]\"><FONT COLOR=\"$theme->link\">". t($link[1]) ."</FONT></A>" : t($link[0]); - } - - return ($_links ? implode(" | ", $_links) : ""); + function links($links, $delimiter = " | ") { + return implode($delimiter, $links); } } @@ -26,21 +18,6 @@ function theme_init() { return new Theme(); } -function theme_link() { - global $user, $theme; - $links[] = array("index.php", t("home")); - $links[] = array("search.php", t("search")); - $links[] = array("submit.php", t("submit")); - $links[] = array("account.php", t("account")); - - foreach (module_list() as $name) { - if (module_hook($name, "page")) $links[] = array("module.php?mod=$name", t($name)); - } - - return $theme->links($links, 2); -} - - function theme_account($theme) { global $user; @@ -55,13 +32,14 @@ function theme_account($theme) { $content .= "<A HREF=\"account.php?op=edit&topic=content\">". t("edit your content") ."</A><BR>\n"; $content .= "<P>\n"; - if (user_access($user, "access administration pages")) { + if (user_access("access administration pages")) { $content .= "<A HREF=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</A><BR>\n"; $content .= "<P>\n"; } foreach (module_list() as $name) { - if ($links = module_invoke($name, "menu")) { + if (module_hook($name, "link")) { + $links = module_invoke($name, "link", "menu"); foreach ($links as $link) $content .= "$link<BR>\n"; } } @@ -119,29 +97,4 @@ function theme_moderation_results($theme, $node) { $theme->box(t("Moderation results"), ($output ? $output : t("This node has not been moderated yet."))); } -/* -// -// depricated -> new block strategy -// -function theme_new_headlines($theme, $num = 10) { - $result = db_query("SELECT nid, title FROM node WHERE status = 2 AND type = 'story' ORDER BY nid DESC LIMIT $num"); - while ($node = db_fetch_object($result)) $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n"; - $theme->box(t("Latest headlines"), $content); -} - -function theme_old_headlines($theme, $num = 10) { - global $user; - - $result = db_query("SELECT id, subject, timestamp FROM story WHERE status = 2 ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : $num) .", $num"); - while ($node = db_fetch_object($result)) { - if ($time != date("F jS", $node->timestamp)) { - $content .= "<P><B>". date("l, M jS", $node->timestamp) ."</B></P>\n"; - $time = date("F jS", $node->timestamp); - } - $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n"; - } - $theme->box(t("Older headlines"), $content); -} -*/ - ?> |