Commit 92995414 authored by Dries's avatar Dries

parent 432852fb
......@@ -110,6 +110,14 @@ function menu_execute_active_handler() {
}
}
function menu_active_handler_exists() {
global $_list;
$path = menu_get_active_item();
return function_exists($_list[$path]["callback"]);
}
/**
* Returns true when the path is in the active trail.
*/
......
......@@ -9,18 +9,34 @@
menu_build("system");
$mod = arg(0);
if (isset($mod) && module_hook($mod, "page")) {
module_invoke($mod, "page");
if (menu_active_handler_exists()) {
$breadcrumb = menu_get_active_breadcrumb();
array_pop($breadcrumb);
$title = menu_get_active_title();
theme("header");
theme("breadcrumb", $breadcrumb);
if ($help = menu_get_active_help()) {
$contents = "<small>$help</small><hr />";
}
$contents .= menu_execute_active_handler();
theme("box", $title, $contents);
theme("footer");
}
else {
if (module_hook(variable_get("site_frontpage", "node"), "page")) {
module_invoke(variable_get("site_frontpage", "node"), "page");
$mod = arg(0);
if (isset($mod) && module_hook($mod, "page")) {
module_invoke($mod, "page");
}
else {
theme("header");
theme("footer");
if (module_hook(variable_get("site_frontpage", "node"), "page")) {
module_invoke(variable_get("site_frontpage", "node"), "page");
}
else {
theme("header");
theme("footer");
}
}
}
......
......@@ -32,36 +32,9 @@ function admin_link($type) {
}
}
function admin_page() {
function admin_admin() {
if (user_access("access administration pages")) {
$title = menu_get_active_title();
theme("header", $title);
$contents = "";
if ($help = menu_get_active_help()) {
$contents .= "<small>$help</small><hr />";
}
if (arg(1)) {
$contents .= menu_execute_active_handler();
}
else {
$contents .= watchdog_overview("actions");
}
$breadcrumb = menu_get_active_breadcrumb();
array_pop($breadcrumb);
theme("breadcrumb", $breadcrumb);
theme("box", $title, $contents);
theme("footer");
}
else {
theme("header", t("Access denied"));
theme("box", t("Access denied"), message_access());
theme("footer");
return watchdog_overview("actions");
}
}
......
......@@ -252,10 +252,10 @@ function blog_link($type, $node = 0, $main) {
if ($type == "system") {
if (user_access("maintain personal blog")) {
menu("node/add/blog", t("blog entry"), "blog_page", 0);
menu("node/add/blog", t("blog entry"), "page", 0);
}
if (user_access("maintain personal blog")) {
menu("blog/" . $user->uid, t("my blog"), "user_page", 1);
menu("blog/" . $user->uid, t("my blog"), "page", 1);
}
}
......
......@@ -252,10 +252,10 @@ function blog_link($type, $node = 0, $main) {
if ($type == "system") {
if (user_access("maintain personal blog")) {
menu("node/add/blog", t("blog entry"), "blog_page", 0);
menu("node/add/blog", t("blog entry"), "page", 0);
}
if (user_access("maintain personal blog")) {
menu("blog/" . $user->uid, t("my blog"), "user_page", 1);
menu("blog/" . $user->uid, t("my blog"), "page", 1);
}
}
......
......@@ -71,7 +71,7 @@ function book_link($type, $node = 0, $main = 0) {
if ($type == "system") {
if (user_access("maintain books")) {
menu("node/add/book", t("book page"), "book_page", 0);
menu("node/add/book", t("book page"), "page", 0);
}
if (user_access("administer nodes")) {
menu("admin/node/book", t("books"), "book_admin", 4);
......
......@@ -71,7 +71,7 @@ function book_link($type, $node = 0, $main = 0) {
if ($type == "system") {
if (user_access("maintain books")) {
menu("node/add/book", t("book page"), "book_page", 0);
menu("node/add/book", t("book page"), "page", 0);
}
if (user_access("administer nodes")) {
menu("admin/node/book", t("books"), "book_admin", 4);
......
......@@ -94,7 +94,7 @@ function forum_link($type, $node = 0, $main = 0) {
}
if ($type == "system" && user_access("create forum topics")) {
menu("node/add/forum",t("forum topic"), "forum_page");
menu("node/add/forum",t("forum topic"), "page");
}
if (!$main && $type == "node" && $node->type == "forum") {
......
......@@ -94,7 +94,7 @@ function forum_link($type, $node = 0, $main = 0) {
}
if ($type == "system" && user_access("create forum topics")) {
menu("node/add/forum",t("forum topic"), "forum_page");
menu("node/add/forum",t("forum topic"), "page");
}
if (!$main && $type == "node" && $node->type == "forum") {
......
......@@ -89,7 +89,7 @@ function page_link($type) {
if ($type == "system") {
if (user_access("maintain static pages")) {
menu("node/add/page", t("static page"), "page_page", 0);
menu("node/add/page", t("static page"), "page", 0);
}
}
......
......@@ -89,7 +89,7 @@ function page_link($type) {
if ($type == "system") {
if (user_access("maintain static pages")) {
menu("node/add/page", t("static page"), "page_page", 0);
menu("node/add/page", t("static page"), "page", 0);
}
}
......
......@@ -182,7 +182,7 @@ function poll_link($type, $node = 0, $main) {
if ($type == "system") {
if (user_access("create polls")) {
menu("node/add/poll", t("poll"), "poll_page", 0);
menu("node/add/poll", t("poll"), "page", 0);
}
}
else if ($type == "page" && user_access("access content")) {
......
......@@ -182,7 +182,7 @@ function poll_link($type, $node = 0, $main) {
if ($type == "system") {
if (user_access("create polls")) {
menu("node/add/poll", t("poll"), "poll_page", 0);
menu("node/add/poll", t("poll"), "page", 0);
}
}
else if ($type == "page" && user_access("access content")) {
......
......@@ -35,7 +35,7 @@ function queue_perm() {
function queue_link($type) {
if ($type == "system") {
if (user_access("access submission queue")) {
menu("queue", t("view submissions"), "queue_page", 1);
menu("queue", t("view submissions"), "page", 1);
}
}
......
......@@ -53,7 +53,7 @@ function story_link($type) {
if ($type == "system") {
if (user_access("create stories")) {
menu("node/add/story", t("story"), "story_page", 0);
menu("node/add/story", t("story"), "page", 0);
}
}
......
......@@ -53,7 +53,7 @@ function story_link($type) {
if ($type == "system") {
if (user_access("create stories")) {
menu("node/add/story", t("story"), "story_page", 0);
menu("node/add/story", t("story"), "page", 0);
}
}
......
......@@ -22,7 +22,7 @@ function tracker_link($type) {
if ($type == "system") {
if (user_access("access content")) {
menu("tracker", t("recent posts"), "tracker_page", 1);
menu("tracker", t("recent posts"), "page", 1);
}
}
......
......@@ -22,7 +22,7 @@ function tracker_link($type) {
if ($type == "system") {
if (user_access("access content")) {
menu("tracker", t("recent posts"), "tracker_page", 1);
menu("tracker", t("recent posts"), "page", 1);
}
}
......
......@@ -496,9 +496,9 @@ function user_link($type) {
if ($type == "system") {
global $user;
if ($user->uid) {
menu("user", t("my account"), "user_page", 8);
menu("user/edit", t("edit account"), "user_page", 0);
menu("user/logout", t("log out"), "user_page", 10);
menu("user", t("my account"), "page", 8);
menu("user/edit", t("edit account"), "page", 0);
menu("user/logout", t("log out"), "page", 10);
}
if (user_access("administer users")) {
......
......@@ -496,9 +496,9 @@ function user_link($type) {
if ($type == "system") {
global $user;
if ($user->uid) {
menu("user", t("my account"), "user_page", 8);
menu("user/edit", t("edit account"), "user_page", 0);
menu("user/logout", t("log out"), "user_page", 10);
menu("user", t("my account"), "page", 8);
menu("user/edit", t("edit account"), "page", 0);
menu("user/logout", t("log out"), "page", 10);
}
if (user_access("administer users")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment