templates/: refactoring and some fixes

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@68 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent cf5b117aa5
commit 2539dc47a4

@ -1,8 +1,12 @@
<div id="footer"> <div id="footer">
<a target="_blank" href="http://postfixadmin.com/">Postfix Admin <?php print $version; ?></a> <a target="_blank" href="http://postfixadmin.com/">Postfix Admin <?php print $version; ?></a>
&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<?php print(isset($SESSID_USERNAME) ? "Logged as $SESSID_USERNAME &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : "") ?> <?php
<?php print(isset($USERID_USERNAME) ? "Logged as $USERID_USERNAME &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : "") ?> if(isset($_SESSION['sessid']['username'])) {
echo "Logged as " . authentication_get_username();
}
?>
&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a target="_blank" href="http://postfixadmin.com/?version=<?php print $version; ?>"><?php print $PALANG['check_update']; ?></a> <a target="_blank" href="http://postfixadmin.com/?version=<?php print $version; ?>"><?php print $PALANG['check_update']; ?></a>
<?php <?php
if (($CONF['show_footer_text'] == "YES") and ($CONF['footer_link'])) if (($CONF['show_footer_text'] == "YES") and ($CONF['footer_link']))

@ -7,6 +7,9 @@
<?php $url = "create-mailbox.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?> <?php $url = "create-mailbox.php"; if (isset ($_GET['domain'])) $url .= "?domain=" . $_GET['domain']; ?>
<li><a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pMenu_create_mailbox']; ?></a></li> <li><a target="_top" href="<?php print $url; ?>"><?php print $PALANG['pMenu_create_mailbox']; ?></a></li>
<?php if ($CONF['sendmail'] == 'YES') { ?><li><a target="_top" href="sendmail.php"><?php print $PALANG['pMenu_sendmail']; ?></a></li><?php } ?> <?php if ($CONF['sendmail'] == 'YES') { ?><li><a target="_top" href="sendmail.php"><?php print $PALANG['pMenu_sendmail']; ?></a></li><?php } ?>
<?php if ($CONF['vacation'] == "YES") { ?>
<li><a target="_top" href="edit-vacation.php"><?php print $PALANG['pUsersMenu_vacation']; ?></a></li>
<?php } ?>
<li><a target="_top" href="password.php"><?php print $PALANG['pMenu_password']; ?></a></li> <li><a target="_top" href="password.php"><?php print $PALANG['pMenu_password']; ?></a></li>
<li><a target="_top" href="viewlog.php"><?php print $PALANG['pMenu_viewlog']; ?></a></li> <li><a target="_top" href="viewlog.php"><?php print $PALANG['pMenu_viewlog']; ?></a></li>
<li><a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a></li> <li><a target="_top" href="logout.php"><?php print $PALANG['pMenu_logout']; ?></a></li>

@ -202,8 +202,20 @@ if (sizeof ($tMailbox) > 0)
print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
if ($CONF['vacation_control_admin'] == 'YES') if ($CONF['vacation_control_admin'] == 'YES')
{ {
$v_active = ($tMailbox[$i]['v_active'] == 1) ? $PALANG['pOverview_vacation_edit'] : $PALANG['pOverview_vacation_option']; $v_active_int = $tMailbox[$i]['v_active'];
print " <td><a href=\"edit-vacation.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $v_active . "</a></td>\n"; if($v_active_int !== -1) {
if($v_active_int == 1) {
$v_active = $PALANG['pOverview_vacation_edit'];
}
else {
$v_active = $PALANG['pOverview_vacation_option'];
}
print "<td><a href=\"edit-vacation.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $v_active . "</a></td>\n";
}
else {
// can't tell vacation state - broken pgsql query
echo "<td> &nbsp; </td>\n";
}
} }
if ($CONF['alias_control_admin'] == 'YES') if ($CONF['alias_control_admin'] == 'YES')
{ {

@ -9,7 +9,7 @@
</td> </td>
<?php <?php
if (check_admin($SESSID_USERNAME)) { if (authentication_has_role('global-admin')) {
print '<td></td>'; print '<td></td>';
print '<td align=right><select class="flat" name="fDomain" >'; print '<td align=right><select class="flat" name="fDomain" >';
@ -25,7 +25,7 @@ for ($i = 1; $i < sizeof ($list_domains); $i++)
?> ?>
</select> </select>
<?php <?php
if (check_admin($SESSID_USERNAME)) { if (authentication_has_role('global-admin')) {
# TODO: make "Return to" translatable # TODO: make "Return to" translatable
?> ?>
<input class="button" type="submit" name="fGo" value="<?php print $PALANG['pReturn_to'] . ' ' . $PALANG['pAdminMenu_list_virtual']; ?>" /></td> <input class="button" type="submit" name="fGo" value="<?php print $PALANG['pReturn_to'] . ' ' . $PALANG['pAdminMenu_list_virtual']; ?>" /></td>
@ -77,13 +77,13 @@ if (sizeof ($tAlias) > 0)
} }
print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n"; print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n";
print " <td>" . $tAlias[$i]['modified'] . "</td>\n"; print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
if ($CONF['special_alias_control'] == 'YES' || check_admin($SESSID_USERNAME)) if ($CONF['special_alias_control'] == 'YES' || authentication_has_role('global-admin'))
{ {
$active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "&return=search.php?search=" . urlencode ($fSearch) . "\">" . $active . "</a></td>\n"; print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "&return=search.php?search=" . urlencode ($fSearch) . "\">" . $active . "</a></td>\n";
print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n"; print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
print " <td><a href=\"delete.php?"; print " <td><a href=\"delete.php?";
if (check_admin($SESSID_USERNAME)) { if (authentication_has_role('global-admin')) {
print "table=alias&"; print "table=alias&";
} }
print "delete=" . urlencode ($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; print "delete=" . urlencode ($tAlias[$i]['address']) . "&domain=" . $tAlias[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
@ -127,7 +127,7 @@ if (sizeof ($tMailbox) > 0)
if ($CONF['vacation_control_admin'] == 'YES') $colspan=$colspan+1; if ($CONF['vacation_control_admin'] == 'YES') $colspan=$colspan+1;
if ($CONF['alias_control_admin'] == 'YES') $colspan=$colspan+1; if ($CONF['alias_control_admin'] == 'YES') $colspan=$colspan+1;
if (check_admin($SESSID_USERNAME) && $CONF['alias_control'] == 'YES') { if (authentication_has_role('global-admin') && $CONF['alias_control'] == 'YES') {
$colspan = 3; $colspan = 3;
} }
print " <td colspan=\"$colspan\">&nbsp;</td>\n"; print " <td colspan=\"$colspan\">&nbsp;</td>\n";
@ -158,7 +158,7 @@ if (sizeof ($tMailbox) > 0)
print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "&return=search.php?search=" . urlencode ($fSearch) . "\">" . $active . "</a></td>\n"; print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "&return=search.php?search=" . urlencode ($fSearch) . "\">" . $active . "</a></td>\n";
$has_alias_control = 0; # temporary variable to simplify admin vs. superadmin code $has_alias_control = 0; # temporary variable to simplify admin vs. superadmin code
if (check_admin($SESSID_USERNAME)) { if (authentication_has_role('global-admin')) {
if ($CONF['alias_control'] == 'YES') $has_alias_control = 1; if ($CONF['alias_control'] == 'YES') $has_alias_control = 1;
} else { } else {
if ($CONF['alias_control_admin'] == 'YES') $has_alias_control = 1; if ($CONF['alias_control_admin'] == 'YES') $has_alias_control = 1;
@ -175,7 +175,7 @@ $has_alias_control = 0; # temporary variable to simplify admin vs. superadmin co
print " <td><a href=\"edit-mailbox.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n"; print " <td><a href=\"edit-mailbox.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>\n";
print " <td><a href=\"delete.php?"; print " <td><a href=\"delete.php?";
if (check_admin($SESSID_USERNAME)) { if (authentication_has_role('global-admin')) {
print "table=mailbox&"; print "table=mailbox&";
} }
print "delete=" . urlencode ($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n"; print "delete=" . urlencode ($tMailbox[$i]['username']) . "&domain=" . $tMailbox[$i]['domain'] . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n";

@ -27,7 +27,7 @@ else
for ($i = 0 ; $i < sizeof ($array) ; $i++) for ($i = 0 ; $i < sizeof ($array) ; $i++)
{ {
if (empty ($array[$i])) continue; if (empty ($array[$i])) continue;
if ($array[$i] == "$USERID_USERNAME@$vacation_domain") if ($array[$i] == "$vacation_goto")
{ {
$vacation = "YES"; $vacation = "YES";
continue; continue;
@ -52,7 +52,7 @@ for ($i = 0 ; $i < sizeof ($array) ; $i++)
<tr> <tr>
<td colspan="3" class="hlp_center"> <td colspan="3" class="hlp_center">
<input class="button" type="submit" name="submit" value="<?php print $PALANG['pEdit_alias_button']; ?>"> <input class="button" type="submit" name="submit" value="<?php print $PALANG['pEdit_alias_button']; ?>">
<input class="button" type="submit" name="submit" value="<?php print $PALANG['exit']; ?>" action="main.php" > <input class="button" type="submit" name="fCancel" value="<?php print $PALANG['exit']; ?>" >
</td> </td>
</tr> </tr>
<tr> <tr>

@ -2,7 +2,7 @@
<table> <table>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td><?php print $_SESSION['userid']['username']; ?></td> <td><?php print $_SESSION['sessid']['username']; ?></td>
</tr> </tr>
<?php if ($CONF['vacation'] == 'YES') { ?> <?php if ($CONF['vacation'] == 'YES') { ?>
<tr> <tr>

@ -22,7 +22,7 @@
<td colspan="3" class="hlp_center"> <td colspan="3" class="hlp_center">
<input class="button" type="submit" name="fAway" value="<?php print $PALANG['pUsersVacation_button_away']; ?>" /> <input class="button" type="submit" name="fAway" value="<?php print $PALANG['pUsersVacation_button_away']; ?>" />
<input class="button" type="submit" name="fBack" value="<?php print $PALANG['pUsersVacation_button_back']; ?>" /> <input class="button" type="submit" name="fBack" value="<?php print $PALANG['pUsersVacation_button_back']; ?>" />
<input class="button" type="submit" name="fCancel" value="<?php print $PALANG['exit']; ?>" action="main.php" /> <input class="button" type="submit" name="fCancel" value="<?php print $PALANG['exit']; ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>

Loading…
Cancel
Save