File: menu.php

package info (click to toggle)
postfixadmin 2.3.5-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,200 kB
  • sloc: php: 25,767; xml: 14,485; perl: 964; sh: 664; python: 169; makefile: 84
file content (113 lines) | stat: -rw-r--r-- 3,751 bytes parent folder | download | duplicates (2)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php if( !defined('POSTFIXADMIN') ) die( "This file cannot be used standalone." ); ?>
<?php
function _menulink ($href, $title, $submenu = "") {
    if ($submenu != "") $submenu = "<ul><li><a target='_top' href='$href'>$title</a>$submenu</li></ul>";
    return "<li><a target='_top' href='$href'>$title</a>$submenu</li>";
} 

authentication_has_role('global-admin');

echo "<div id='menu'>\n";
echo "<ul>\n";

$url = "create-mailbox.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . urlencode($_GET['domain']);
$submenu_virtual = _menulink($url, $PALANG['pMenu_create_mailbox']);

$url = "create-alias.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . urlencode($_GET['domain']);
$submenu_virtual .=  _menulink($url, $PALANG['pMenu_create_alias']);

if (boolconf('alias_domain')) {
    $url = "create-alias-domain.php"; if (isset ($_GET['domain'])) $url .= "?target_domain=" . urlencode($_GET['domain']);
    $submenu_virtual .=  _menulink($url, $PALANG['pMenu_create_alias_domain']);
}

$submenu_admin = _menulink("create-admin.php", $PALANG['pAdminMenu_create_admin']);

$submenu_fetchmail = _menulink("fetchmail.php?new=1", $PALANG['pFetchmail_new_entry']);


if (authentication_has_role('global-admin')) {
    $submenu_domain = _menulink("create-domain.php", $PALANG['pAdminMenu_create_domain']);
    $submenu_sendmail = _menulink("broadcast-message.php", $PALANG['pAdminMenu_broadcast_message']);
} else {
    $submenu_domain = "";
    $submenu_sendmail = "";
}

if (authentication_has_role('global-admin')) {
    print _menulink("list-admin.php", $PALANG['pAdminMenu_list_admin'], $submenu_admin);
} else {
    print _menulink("main.php", $PALANG['pMenu_main']);
}

print _menulink("list-domain.php", $PALANG['pAdminMenu_list_domain'], $submenu_domain);

$link = 'list-virtual.php';
if(isset($_SESSION['list_virtual_sticky_domain'])) {
    $link = "list-virtual.php?domain=" . htmlentities($_SESSION['list_virtual_sticky_domain'], ENT_QUOTES);
}
print _menulink($link, $PALANG['pAdminMenu_list_virtual'], $submenu_virtual);

if ($CONF['fetchmail'] == 'YES') {
    print _menulink("fetchmail.php", $PALANG['pMenu_fetchmail'], $submenu_fetchmail);
}

if ($CONF['sendmail'] == 'YES') {
    print _menulink("sendmail.php", $PALANG['pMenu_sendmail'], $submenu_sendmail);
} 

# not really useful in the admin menu
#if ($CONF['vacation'] == 'YES') {
#   print _menulink("edit-vacation.php", $PALANG['pUsersMenu_vacation']);
#}

print _menulink("password.php", $PALANG['pMenu_password']);

if (authentication_has_role('global-admin') && 'pgsql'!=$CONF['database_type'] && $CONF['backup'] == 'YES') {
    print _menulink("backup.php", $PALANG['pAdminMenu_backup']);
}

print _menulink("viewlog.php", $PALANG['pMenu_viewlog']);

print _menulink("logout.php", $PALANG['pMenu_logout']);

echo "</ul>\n";
echo "</div>\n";

print "<br clear='all' /><br>"; # TODO

if (authentication_has_role('global-admin')) {
    $motd_file = "motd-admin.txt";
} else {
    $motd_file = "motd.txt";
}

if (file_exists (realpath ($motd_file)))
{
    print "<div id=\"motd\">\n";
    include ($motd_file);
    print "</div>";
}



# IE can't handle :hover dropdowns correctly. It needs some JS instead.
?>
<script type='text/javascript'>
sfHover = function() {
    var sfEls = document.getElementById("menu").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>

<?php
/* vim: set ft=php expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>