summaryrefslogtreecommitdiff
path: root/modules/admin.module
blob: f8667f1f635261939a1a60dd5f9ce8425777733c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
// $Id$

include_once "includes/common.inc";

function status($message) {
  if ($message) {
    return "<b>Status:</b> $message<hr />\n";
  }
}

function admin_help($section) {
  $output = "";

  switch ($section) {
    case "admin/system/modules#description":
      $output .= t("Handles the administration pages.");
      break;
    case "admin":
      $output .= t("Welcome to the administration section. Below are the most recent system events.");
      break;
    case "admin/overview":
      $output = t("This is a complete overview of the site administration page.");
      break;
  }
  return $output;
}

function admin_link($type) {
  if ($type == "system" && user_access("access administration pages")) {
    menu("admin", t("administer"), "admin_admin", 9);
  }
}

function admin_page() {
  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");
  }
}

?>