diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 327cecb8..54134e63 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -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) diff --git a/DOCUMENTS/UPGRADE.TXT b/DOCUMENTS/UPGRADE.TXT index 12524fc6..d092c3d9 100644 --- a/DOCUMENTS/UPGRADE.TXT +++ b/DOCUMENTS/UPGRADE.TXT @@ -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!! diff --git a/admin/delete.php b/admin/delete.php index b7b9e92f..c20e2e21 100644 --- a/admin/delete.php +++ b/admin/delete.php @@ -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); } } } diff --git a/admin/list-virtual.php b/admin/list-virtual.php index f0c105e7..41f9a438 100644 --- a/admin/list-virtual.php +++ b/admin/list-virtual.php @@ -130,6 +130,7 @@ if (isset ($limit)) } } + include ("../templates/header.tpl"); include ("../templates/admin_menu.tpl"); include ("../templates/admin_list-virtual.tpl"); diff --git a/edit-active.php b/edit-active.php index 9b1851f9..b7a3a172 100644 --- a/edit-active.php +++ b/edit-active.php @@ -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 { diff --git a/functions.inc.php b/functions.inc.php index ba6868dc..cb2f27cd 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -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 .= "" . $CONF['show_status_text'] . " "; + } + else + { + $stat_string .= $CONF['show_status_text'] . " "; + } + + } + else + { + $stat_string .= $CONF['show_status_text'] . " "; + } + + // 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 .= "" . $CONF['show_status_text'] . " "; + } + else + { + $stat_string .= $CONF['show_status_text'] . " "; + } + } + + // 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 .= "" . $CONF['show_status_text'] . " "; + } + else + { + $stat_string .= $CONF['show_status_text'] . " "; + } + } + } + else + { + $stat_string .= "; "; + } + +// $stat_string .= "    " . +// "    "; + return $stat_string; +} + $table_admin = table_by_key ('admin'); $table_alias = table_by_key ('alias'); diff --git a/languages/en.lang b/languages/en.lang index 90e6f8d7..0527d751 100644 --- a/languages/en.lang +++ b/languages/en.lang @@ -85,7 +85,7 @@ $PALANG['pCreate_alias_address_text_error3'] = '
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.
The TO is not valid!'; $PALANG['pCreate_alias_result_error'] = 'Unable to add the alias to the alias table!'; $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" <suport@my.domain.tld>'; +$PALANG['pBroadcast_from_help'] = 'From address should be like e.g. "Systems Team" <support@my.domain.tld>'; $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 '; ?> diff --git a/stylesheet.css b/stylesheet.css index e28f53c2..234af527 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -249,3 +249,10 @@ table { text-decoration: underline; color: #777777; } + +#hovertext { + POSITION: absolute; + VISIBILITY: hidden; + Z-INDEX: 200; +} + diff --git a/templates/admin_list-virtual.tpl b/templates/admin_list-virtual.tpl index 45a61714..60e330e5 100644 --- a/templates/admin_list-virtual.tpl +++ b/templates/admin_list-virtual.tpl @@ -32,6 +32,7 @@ for ($i = 0; $i < sizeof ($list_domains); $i++) ".$PALANG['pOverview_alias_title']."  "; ($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 "

" . $PALANG['pOverview_alias_title'] . "

"; print " "; print " \n"; + if ($CONF['show_status'] == 'YES') { print "\n"; } print " " . $PALANG['pAdminList_virtual_alias_address'] . "\n"; print " " . $PALANG['pAdminList_virtual_alias_goto'] . "\n"; print " " . $PALANG['pAdminList_virtual_alias_modified'] . "\n"; @@ -79,6 +81,11 @@ if (sizeof ($tAlias) > 0) if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) { print " \n"; + if ($CONF['show_status'] == 'YES') + { + print " " . gen_show_status($tAlias[$i]['address']) . "\n"; + } + print " " . $tAlias[$i]['address'] . "\n"; if ($CONF['alias_goto_limit'] > 0) { print " " . ereg_replace (",", "
", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "\n"; @@ -87,7 +94,7 @@ if (sizeof ($tAlias) > 0) } print " " . $tAlias[$i]['modified'] . "\n"; $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " " . $active . "\n"; + print " " . $active . "\n"; print " " . $PALANG['edit'] . "\n"; print " " . $PALANG['del'] . "\n"; print " \n"; @@ -136,6 +143,7 @@ if (sizeof ($tMailbox) > 0) print "

" . $PALANG['pOverview_mailbox_title'] . "

"; print " "; print " \n"; + if ($CONF['show_status'] == 'YES') { print "\n"; } print " " . $PALANG['pAdminList_virtual_mailbox_username'] . "\n"; print " " . $PALANG['pAdminList_virtual_mailbox_name'] . "\n"; if ($CONF['quota'] == 'YES') print " " . $PALANG['pAdminList_virtual_mailbox_quota'] . "\n"; @@ -156,6 +164,12 @@ if (sizeof ($tMailbox) > 0) if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) { print " \n"; + + if ($CONF['show_status'] == 'YES') + { + print " " . gen_show_status($tMailbox[$i]['username']) . "\n"; + } + print " " . $tMailbox[$i]['username'] . "\n"; print " " . $tMailbox[$i]['name'] . "\n"; if ($CONF['quota'] == 'YES') @@ -212,5 +226,30 @@ if (sizeof ($tMailbox) > 0) print "

" . $PALANG['pMenu_create_mailbox'] . "\n"; } + +if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES') +{ + print "

"; + if ($CONF['show_undeliverable'] == 'YES') + { + print " " . $CONF['show_status_text'] . "=" . $PALANG['pStatus_undeliverable'] . "\n"; + } + if ($CONF['show_popimap'] == 'YES') + { + print " " . $CONF['show_status_text'] . "=" . $PALANG['pStatus_popimap'] . "\n"; + } + if ( $CONF['show_custom_count'] > 0 ) + { + for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++) + { + print " " . + $CONF['show_status_text'] . "=" . $PALANG['pStatus_custom'] . + $CONF['show_custom_domains'][$i] . "\n"; + } + } + +} /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ ?> diff --git a/templates/overview.tpl b/templates/overview.tpl index eb097863..9e2d1bb7 100644 --- a/templates/overview.tpl +++ b/templates/overview.tpl @@ -61,6 +61,7 @@ if (sizeof ($tAlias) > 0) print "

".$PALANG['pOverview_alias_title']."

"; print " "; print " \n"; + if ($CONF['show_status'] == 'YES') { print "\n"; } print " " . $PALANG['pOverview_alias_address'] . "\n"; print " " . $PALANG['pOverview_alias_goto'] . "\n"; print " " . $PALANG['pOverview_alias_modified'] . "\n"; @@ -73,6 +74,11 @@ if (sizeof ($tAlias) > 0) if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) { print " \n"; + if ($CONF['show_status'] == 'YES') + { + print " " . gen_show_status($tAlias[$i]['address']) . "\n"; + } + print " " . $tAlias[$i]['address'] . "\n"; if ($CONF['alias_goto_limit'] > 0) { print " " . ereg_replace (",", "
", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "\n"; @@ -150,6 +156,7 @@ if (sizeof ($tMailbox) > 0) print "

".$PALANG['pOverview_mailbox_title']."

"; print " "; print " \n"; + if ($CONF['show_status'] == 'YES') { print "\n"; } print " " . $PALANG['pOverview_mailbox_username'] . "\n"; print " " . $PALANG['pOverview_mailbox_name'] . "\n"; if ($CONF['quota'] == 'YES') print " " . $PALANG['pOverview_mailbox_quota'] . "\n"; @@ -166,6 +173,11 @@ if (sizeof ($tMailbox) > 0) if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) { print " \n"; + if ($CONF['show_status'] == 'YES') + { + print " " . gen_show_status($tMailbox[$i]['username']) . "\n"; + } + print " " . $tMailbox[$i]['username'] . "\n"; print " " . $tMailbox[$i]['name'] . "\n"; if ($CONF['quota'] == 'YES') @@ -220,5 +232,31 @@ if (sizeof ($tMailbox) > 0) print "

" . $PALANG['pMenu_create_mailbox'] . "\n"; } + +if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES') +{ + print "

"; + if ($CONF['show_undeliverable'] == 'YES') + { + print " " . $CONF['show_status_text'] . "=" . $PALANG['pStatus_undeliverable'] . "\n"; + } + if ($CONF['show_popimap'] == 'YES') + { + print " " . $CONF['show_status_text'] . "=" . $PALANG['pStatus_popimap'] . "\n"; + } + if ( $CONF['show_custom_count'] > 0 ) + { + for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++) + { + print " " . + $CONF['show_status_text'] . "=" . $PALANG['pStatus_custom'] . + $CONF['show_custom_domains'][$i] . "\n"; + } + } + +} + /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ ?>