Added optional feature to indicate broken aliases and where mailboxes deliver to. Includes

new language variables:
$PALANG['pStatus_undeliverable'] = 'maybe UNDELIVERABLE ';
$PALANG['pStatus_custom'] = 'Delivers to ';
$PALANG['pStatus_popimap'] = 'POP/IMAP ';

Some bug fixes. Maybe some new bugs added.



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@46 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
Greg 17 years ago
parent e7d80192e9
commit 97aeb7a567

@ -6,6 +6,8 @@
#
Version 2.1.1 -- TBD
--------------------
- Added: Feature to show status of aliases/mailboxes (GregC)
- Fixed: Many admin/*.php files merged with /*.php
- Fixed: 'alias' instead of '$table_alias' being used by some .php files (GregC)
- Fixed: Overview no longer lists alias entries for mailboxes (GregC)
- Changed: Added exit buttons to several edit options. (GregC)

@ -15,6 +15,11 @@ REQUIRED!!
READ THIS FIRST!
----------------
Note: !!This document describes upgrading from v1.5x to 2.0. Only
items 3 and 5 apply to general PostfixAdmin installs!! See SVN.TXT
for how to update versions 2.1.0 and higher.
It's recommened that you install Postfix Admin in a new folder and not
on-top of the old install!!

@ -95,7 +95,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
else
{
$url = "list-virtual.php?domain=$fDomain";
db_log ($CONF['admin_email'], $fDomain, "delete alias", $fDelete);
db_log ($SESSID_USERNAME , $fDomain, "delete alias", $fDelete);
}
if (!$error)
@ -124,7 +124,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
{
$url = "list-virtual.php?domain=$fDomain";
db_query ("DELETE FROM $table_vacation WHERE email='$fDelete' AND domain='$fDomain'");
db_log ($CONF['admin_email'], $fDomain, "delete mailbox", $fDelete);
db_log ($SESSID_USERNAME, $fDomain, "delete mailbox", $fDelete);
}
}
}

@ -130,6 +130,7 @@ if (isset ($limit))
}
}
include ("../templates/header.tpl");
include ("../templates/admin_menu.tpl");
include ("../templates/admin_list-virtual.tpl");

@ -74,11 +74,12 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
if ($error != 1)
{
if ( $fReturn != "" )
if ( preg_match( "/^list-virtual.php.*/", $fReturn ) ||
preg_match( "/^overview.php.*/", $fReturn ) ||
preg_match( "/^search.php.*/", $fReturn ) )
{
### TODO: prevent possible URL injection (return=http://www.irgendwas.de)
### http://sourceforge.net/tracker/index.php?func=detail&aid=1770514&group_id=191583&atid=937964
header ("Location: $fReturn");
//$fReturn appears OK, jump there
header ("Location: $fReturn");
}
else
{

@ -1630,6 +1630,115 @@ function create_mailbox_subfolders($login,$cleartext_password)
}
//
// gen_show_status
// Action: Return a string of colored  's that indicate
// the if an alias goto has an error or is sent to
// addresses list in show_custom_domains
// Call: gen_show_status (string alias_address)
//
function gen_show_status ($show_alias)
{
global $CONF, $table_alias;
$stat_string = "";
$stat_goto = "";
$stat_result = db_query ("SELECT goto FROM $table_alias WHERE address='$show_alias'");
if ($stat_result['rows'] > 0)
{
$row = db_row ($stat_result['result']);
$stat_goto = $row[0];
}
// UNDELIVERABLE CHECK
if ( $CONF['show_undeliverable'] == 'YES' )
{
$gotos=array();
$gotos=explode(',',$stat_goto);
$undel_string="";
//make sure this alias goes somewhere known
$stat_ok = 1;
while ( ($g=array_pop($gotos)) && $stat_ok )
{
//$stat_result = db_query ("SELECT address FROM $table_alias WHERE goto='$g' AND address != '$g'");
$stat_result = db_query ("SELECT address FROM $table_alias WHERE address = '$g'");
if ($stat_result['rows'] == 0)
{
$stat_ok = 0;
}
if ( $stat_ok == 0 )
{
$stat_domain = substr($g,strpos($g,"@")+1);
for ($i=0; $i < sizeof($CONF['show_undeliverable_exceptions']);$i++)
{
if ( $stat_domain == $CONF['show_undeliverable_exceptions'][$i] )
{
$stat_ok = 1;
break;
}
}
}
} // while
if ( $stat_ok == 0 )
{
$stat_string .= "<span style='background-color:" . $CONF['show_undeliverable_color'] .
"'>" . $CONF['show_status_text'] . "</span>&nbsp;";
}
else
{
$stat_string .= $CONF['show_status_text'] . "&nbsp;";
}
}
else
{
$stat_string .= $CONF['show_status_text'] . "&nbsp;";
}
// POP/IMAP CHECK
if ( $CONF['show_popimap'] == 'YES' )
{
//if the address passed in appears in its own goto filed, its POP/IMAP
if (preg_match ('/^' . $show_alias . '.*$/', $stat_goto) ||
preg_match ('/,' . $show_alias . '.*$/', $stat_goto) )
{
$stat_string .= "<span style='background-color:" . $CONF['show_popimap_color'] .
"'>" . $CONF['show_status_text'] . "</span>&nbsp;";
}
else
{
$stat_string .= $CONF['show_status_text'] . "&nbsp;";
}
}
// CUSTOM DESTINATION CHECK
if ( $CONF['show_custom_count'] > 0 )
{
for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++)
{
if (preg_match ('/^.*' . $CONF['show_custom_domains'][$i] . '.*$/', $stat_goto))
{
$stat_string .= "<span style='background-color:" . $CONF['show_custom_colors'][$i] .
"'>" . $CONF['show_status_text'] . "</span>&nbsp;";
}
else
{
$stat_string .= $CONF['show_status_text'] . "&nbsp;";
}
}
}
else
{
$stat_string .= ";&nbsp;";
}
// $stat_string .= "<span style='background-color:green'> &nbsp; </span> &nbsp;" .
// "<span style='background-color:blue'> &nbsp; </span> &nbsp;";
return $stat_string;
}
$table_admin = table_by_key ('admin');
$table_alias = table_by_key ('alias');

@ -85,7 +85,7 @@ $PALANG['pCreate_alias_address_text_error3'] = '<br /><span class="error_msg">Yo
$PALANG['pCreate_alias_goto'] = 'To';
$PALANG['pCreate_alias_active'] = 'Active';
$PALANG['pCreate_alias_button'] = 'Add Alias';
$PALANG['pCreate_alias_goto_text'] = 'Where the mail needs to be send to.';
$PALANG['pCreate_alias_goto_text'] = 'Where the mail needs to be sent to.';
$PALANG['pCreate_alias_goto_text_error'] = 'Where the email needs to go.<br /><span class="error_msg">The TO is not valid!</span>';
$PALANG['pCreate_alias_result_error'] = '<span class="error_msg">Unable to add the alias to the alias table!</span>';
$PALANG['pCreate_alias_result_succes'] = 'The alias has been added to the alias table!';
@ -326,11 +326,15 @@ $PALANG['pSearch_welcome'] = 'Searching for: ';
$PALANG['pBroadcast_title'] = 'Send broadcast message';
$PALANG['pBroadcast_from'] = 'From';
$PALANG['pBroadcast_from_help'] = 'From address should be like e.g. "Systems Team" &lt;suport@my.domain.tld&gt;';
$PALANG['pBroadcast_from_help'] = 'From address should be like e.g. "Systems Team" &lt;support@my.domain.tld&gt;';
$PALANG['pBroadcast_subject'] = 'Subject';
$PALANG['pBroadcast_message'] = 'Message';
$PALANG['pBroadcast_send'] = 'Send message';
$PALANG['pBroadcast_success'] = 'Your broadcast message was sent.';
$PALANG['pAdminMenu_broadcast_message'] = 'BC message';
$PALANG['pBroadcast_error_empty'] = 'The fields From, Subject and Message should\'t be empty !';
$PALANG['pStatus_undeliverable'] = 'maybe UNDELIVERABLE ';
$PALANG['pStatus_custom'] = 'Delivers to ';
$PALANG['pStatus_popimap'] = 'POP/IMAP ';
?>

@ -249,3 +249,10 @@ table {
text-decoration: underline;
color: #777777;
}
#hovertext {
POSITION: absolute;
VISIBILITY: hidden;
Z-INDEX: 200;
}

@ -32,6 +32,7 @@ for ($i = 0; $i < sizeof ($list_domains); $i++)
<?php
if ($limit['alias_pgindex_count'] ) print "<b>".$PALANG['pOverview_alias_title']."</b>&nbsp&nbsp";
($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0;
$current_limit=$highlight_at * $CONF['page_size'];
for ($i = 0; $i < $limit['alias_pgindex_count']; $i++)
{
if ( $i == $highlight_at )
@ -67,6 +68,7 @@ if (sizeof ($tAlias) > 0)
print " <td colspan=\"6\"><h3>" . $PALANG['pOverview_alias_title'] . "</h3></td>";
print " </tr>";
print " <tr class=\"header\">\n";
if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
print " <td>" . $PALANG['pAdminList_virtual_alias_address'] . "</td>\n";
print " <td>" . $PALANG['pAdminList_virtual_alias_goto'] . "</td>\n";
print " <td>" . $PALANG['pAdminList_virtual_alias_modified'] . "</td>\n";
@ -79,6 +81,11 @@ if (sizeof ($tAlias) > 0)
if ((is_array ($tAlias) and sizeof ($tAlias) > 0))
{
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
if ($CONF['show_status'] == 'YES')
{
print " <td>" . gen_show_status($tAlias[$i]['address']) . "</td>\n";
}
print " <td>" . $tAlias[$i]['address'] . "</td>\n";
if ($CONF['alias_goto_limit'] > 0) {
print " <td>" . ereg_replace (",", "<br>", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "</td>\n";
@ -87,7 +94,7 @@ if (sizeof ($tAlias) > 0)
}
print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
$active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO'];
print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n";
print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain&return=list-virtual.php?domain=$fDomain" . urlencode ("&limit=" . $current_limit) . "\">" . $active . "</a></td>\n";
print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n";
print " <td><a href=\"delete.php?table=alias" . "&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n";
print " </tr>\n";
@ -136,6 +143,7 @@ if (sizeof ($tMailbox) > 0)
print " <td colspan=\"7\"><h3>" . $PALANG['pOverview_mailbox_title'] . "</h3></td>";
print " </tr>";
print " <tr class=\"header\">\n";
if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
print " <td>" . $PALANG['pAdminList_virtual_mailbox_username'] . "</td>\n";
print " <td>" . $PALANG['pAdminList_virtual_mailbox_name'] . "</td>\n";
if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pAdminList_virtual_mailbox_quota'] . "</td>\n";
@ -156,6 +164,12 @@ if (sizeof ($tMailbox) > 0)
if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0))
{
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
if ($CONF['show_status'] == 'YES')
{
print " <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n";
}
print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
if ($CONF['quota'] == 'YES')
@ -212,5 +226,30 @@ if (sizeof ($tMailbox) > 0)
print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n";
}
if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES')
{
print "<br><br>";
if ($CONF['show_undeliverable'] == 'YES')
{
print "&nbsp;<span style='background-color:" . $CONF['show_undeliverable_color'] .
"'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_undeliverable'] . "\n";
}
if ($CONF['show_popimap'] == 'YES')
{
print "&nbsp;<span style='background-color:" . $CONF['show_popimap_color'] .
"'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_popimap'] . "\n";
}
if ( $CONF['show_custom_count'] > 0 )
{
for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++)
{
print "&nbsp;<span style='background-color:" . $CONF['show_custom_colors'][$i] . "'>" .
$CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_custom'] .
$CONF['show_custom_domains'][$i] . "\n";
}
}
}
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>

@ -61,6 +61,7 @@ if (sizeof ($tAlias) > 0)
print " <td colspan=\"6\"><h3>".$PALANG['pOverview_alias_title']."</h3></td>";
print " </tr>";
print " <tr class=\"header\">\n";
if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n";
print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n";
print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n";
@ -73,6 +74,11 @@ if (sizeof ($tAlias) > 0)
if ((is_array ($tAlias) and sizeof ($tAlias) > 0))
{
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
if ($CONF['show_status'] == 'YES')
{
print " <td>" . gen_show_status($tAlias[$i]['address']) . "</td>\n";
}
print " <td>" . $tAlias[$i]['address'] . "</td>\n";
if ($CONF['alias_goto_limit'] > 0) {
print " <td>" . ereg_replace (",", "<br>", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "</td>\n";
@ -150,6 +156,7 @@ if (sizeof ($tMailbox) > 0)
print " <td colspan=\"7\"><h3>".$PALANG['pOverview_mailbox_title']."</h3></td>";
print " </tr>";
print " <tr class=\"header\">\n";
if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; }
print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n";
print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n";
if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n";
@ -166,6 +173,11 @@ if (sizeof ($tMailbox) > 0)
if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0))
{
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
if ($CONF['show_status'] == 'YES')
{
print " <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n";
}
print " <td>" . $tMailbox[$i]['username'] . "</td>\n";
print " <td>" . $tMailbox[$i]['name'] . "</td>\n";
if ($CONF['quota'] == 'YES')
@ -220,5 +232,31 @@ if (sizeof ($tMailbox) > 0)
print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n";
}
if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES')
{
print "<br><br>";
if ($CONF['show_undeliverable'] == 'YES')
{
print "&nbsp;<span style='background-color:" . $CONF['show_undeliverable_color'] .
"'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_undeliverable'] . "\n";
}
if ($CONF['show_popimap'] == 'YES')
{
print "&nbsp;<span style='background-color:" . $CONF['show_popimap_color'] .
"'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_popimap'] . "\n";
}
if ( $CONF['show_custom_count'] > 0 )
{
for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++)
{
print "&nbsp;<span style='background-color:" . $CONF['show_custom_colors'][$i] . "'>" .
$CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_custom'] .
$CONF['show_custom_domains'][$i] . "\n";
}
}
}
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>

Loading…
Cancel
Save