mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
patches by Christian Boltz applied
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@3 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
a5ce5620cf
commit
d7cca670cb
@ -6,6 +6,10 @@
|
||||
#
|
||||
Version 2.1.1 -- TBD
|
||||
--------------------
|
||||
- Fixed: function check_email will ignore vacation_domain if vacation==YES (GregC)
|
||||
- Changed: applied patches from Christian Boltz posted at
|
||||
http://www.cboltz.de/tmp/postfixadmin-3.patch, referenced at
|
||||
https://sourceforge.net/tracker/index.php?func=detail&aid=1696647&group_id=191583&atid=937966 (GregC)
|
||||
- Added: main.php to admin dirctory (GregC)
|
||||
- Added: Item "Main" on admin menu (GregC)
|
||||
- Changed: Edit-vacation now edits for admins/superadmins (GregC)
|
||||
|
@ -26,15 +26,30 @@ use DBI;
|
||||
use strict;
|
||||
use Sys::Syslog;
|
||||
|
||||
my $db_type = 'mysql';
|
||||
my $db_host = 'localhost';
|
||||
my $db_user = 'postfixadmin';
|
||||
my $db_pass = 'postfixadmin';
|
||||
my $db_name = 'postfix';
|
||||
my $sendmail = "/usr/sbin/sendmail";
|
||||
my $logfile = ""; # specify a file name here for example: vacation.log
|
||||
my $debugfile = ""; # sepcify a file name here for example: vacation.debug
|
||||
my $syslog = 0; # 1 if log entries should be sent to syslog
|
||||
# values that will be set in /etc/mail/vacation/vacationrc:
|
||||
our $db_type;
|
||||
our $db_host;
|
||||
our $db_user;
|
||||
our $db_pass;
|
||||
our $db_name;
|
||||
our $sendmail;
|
||||
our $logfile;
|
||||
our $debugfile;
|
||||
our $syslog;
|
||||
our $logger;
|
||||
|
||||
require "/etc/mail/vacation/vacationrc";
|
||||
# example config file:
|
||||
# $db_type = 'mysql';
|
||||
# $db_host = 'localhost';
|
||||
# $db_user = 'postfixadmin';
|
||||
# $db_pass = 'postfixadmin';
|
||||
# $db_name = 'postfix';
|
||||
# $sendmail = "/usr/sbin/sendmail";
|
||||
# $logfile = ""; # specify a file name here for example: vacation.log
|
||||
# $debugfile = ""; # sepcify a file name here for example: vacation.debug
|
||||
# $syslog = 0; # 1 if log entries should be sent to syslog
|
||||
# $logger = "/usr/bin/logger";
|
||||
|
||||
|
||||
my $dbh = DBI->connect("DBI:$db_type:$db_name:$db_host", "$db_user", "$db_pass", { RaiseError => 1 }) or &exit_error($DBI::errstr);
|
||||
@ -83,7 +98,7 @@ sub do_log {
|
||||
my ($messageid, $to, $from, $subject) = @_;
|
||||
my $date;
|
||||
if ( $syslog ) {
|
||||
open (SYSLOG, "|/usr/bin/logger -p mail.info -t Vacation") or die ("Unable to open logger");
|
||||
open (SYSLOG, "|$logger -p mail.info -t Vacation") or die ("Unable to open logger");
|
||||
printf SYSLOG "Orig-To: %s From: %s MessageID: %s Subject: %s", $to, $from, $messageid, $subject;
|
||||
close (SYSLOG);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']);
|
||||
!empty ($_POST['fDescription']) ? $fDescription = escape_string ($_POST['fDescription']) : $fDescription = "No Description";
|
||||
!empty ($_POST['fDescription']) ? $fDescription = escape_string ($_POST['fDescription']) : $fDescription = "";
|
||||
if (isset ($_POST['fAliases'])) $fAliases = escape_string ($_POST['fAliases']);
|
||||
if (isset ($_POST['fMailboxes'])) $fMailboxes = escape_string ($_POST['fMailboxes']);
|
||||
!empty ($_POST['fMaxquota']) ? $fMaxquota = escape_string ($_POST['fMaxquota']) : $fMaxquota = "0";
|
||||
|
@ -138,10 +138,10 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
|
||||
if ($CONF['alias_control'] == "YES")
|
||||
{
|
||||
$query = "SELECT address,goto,modified,active FROM alias WHERE domain='$fDomain' ORDER BY address LIMIT $fDisplay, $page_size";
|
||||
$query = "SELECT address,goto,modified,active FROM $table_alias WHERE domain='$fDomain' ORDER BY address LIMIT $fDisplay, $page_size";
|
||||
if ('pgsql'==$CONF['database_type'])
|
||||
{
|
||||
$query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM alias WHERE domain='$fDomain' ORDER BY alias.address LIMIT $page_size OFFSET $fDisplay";
|
||||
$query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' ORDER BY $table_alias.address LIMIT $page_size OFFSET $fDisplay";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -144,20 +144,30 @@ function check_email ($email)
|
||||
{
|
||||
global $CONF;
|
||||
|
||||
$ce_email=$email;
|
||||
|
||||
//strip the vacation domain out if we are using it
|
||||
if ($CONF['vacation'] == 'YES')
|
||||
{
|
||||
$vacation_domain = $CONF['vacation_domain'];
|
||||
$ce_email = preg_replace("/@$vacation_domain/", '', $ce_email);
|
||||
}
|
||||
|
||||
if (
|
||||
isset($CONF['emailcheck_resolve_domain'])
|
||||
&& 'YES'==$CONF['emailcheck_resolve_domain']
|
||||
&& 'WINDOWS'!=(strtoupper(substr(php_uname('s'), 0, 7)))
|
||||
) {
|
||||
|
||||
// Perform non-domain-part sanity checks
|
||||
if (!preg_match ('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '[^@]+$/i', trim ($email)))
|
||||
if (!preg_match ('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '[^@]+$/i', trim ($ce_email)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine domain name
|
||||
$matches=array();
|
||||
if (!preg_match('|@(.+)$|',$email,$matches))
|
||||
if (!preg_match('|@(.+)$|',$ce_email,$matches))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -177,7 +187,7 @@ function check_email ($email)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (preg_match ('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '([-0-9A-Z]+\.)+' . '([0-9A-Z]){2,4}$/i', trim ($email)))
|
||||
if (preg_match ('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '([-0-9A-Z]+\.)+' . '([0-9A-Z]){2,4}$/i', trim ($ce_email)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -289,14 +289,14 @@ $PALANG['pUsersVacation_button_back'] = 'Ich bin zurück';
|
||||
$PALANG['pUsersVacation_result_error'] = '<span class="error_msg">Konnte Ihre Automatische Antwort nicht einstellen!</span>';
|
||||
$PALANG['pUsersVacation_result_succes'] = 'Ihre Automatische Antwort wurde gelöscht!';
|
||||
|
||||
$PALANG['pCreate_dbLog_createmailbox'] = 'create mailbox';
|
||||
$PALANG['pCreate_dbLog_createalias'] = 'create alias';
|
||||
$PALANG['pDelete_dbLog_deletealias'] = 'delete alias';
|
||||
$PALANG['pDelete_dbLog_deletemailbox'] = 'delete mailbox';
|
||||
$PALANG['pCreate_dbLog_createmailbox'] = 'Mailbox hinzufügen';
|
||||
$PALANG['pCreate_dbLog_createalias'] = 'Alias hinzufügen';
|
||||
$PALANG['pDelete_dbLog_deletealias'] = 'Alias löschen';
|
||||
$PALANG['pDelete_dbLog_deletemailbox'] = 'Mailbox löschen';
|
||||
|
||||
$PALANG['pEdit_dbLog_editactive'] = 'change active state';
|
||||
$PALANG['pEdit_dbLog_editalias'] = 'edit alias';
|
||||
$PALANG['pEdit_dbLog_editmailbox'] = 'edit mailbox';
|
||||
$PALANG['pEdit_dbLog_editactive'] = 'Aktiv-Status ändern';
|
||||
$PALANG['pEdit_dbLog_editalias'] = 'Alias bearbeiten';
|
||||
$PALANG['pEdit_dbLog_editmailbox'] = 'Mailbox bearbeiten';
|
||||
|
||||
$PALANG['pSearch_welcome'] = 'Searching for: ';
|
||||
$PALANG['pSearch_welcome'] = 'Suche nach: ';
|
||||
?>
|
||||
|
@ -213,6 +213,11 @@ table {
|
||||
background: #D9FF43; /*#D6FF85;*/ /*#ffdddd;*/
|
||||
}
|
||||
|
||||
#alias_table tr:hover, #mailbox_table tr:hover, #overview_table tr:hover, #log_table tr:hover, #admin_table tr:hover {
|
||||
background: #D9FF43; /*#D6FF85;*/ /*#ffdddd;*/
|
||||
}
|
||||
|
||||
|
||||
#alias_table h3, #mailbox_table h3, #overview_table h3, #log_table h3, #admin_table h3 {
|
||||
background: silver;
|
||||
text-align: left;
|
||||
|
@ -82,4 +82,5 @@ if (sizeof ($list_domains) > 0)
|
||||
|
||||
print "</table>\n";
|
||||
}
|
||||
echo "<p><a href='create-domain.php'>{$PALANG['pAdminMenu_create_domain']}</a>";
|
||||
?>
|
||||
|
@ -62,7 +62,11 @@ if (sizeof ($tAlias) > 0)
|
||||
{
|
||||
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\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";
|
||||
} else {
|
||||
print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n";
|
||||
}
|
||||
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";
|
||||
@ -73,6 +77,7 @@ if (sizeof ($tAlias) > 0)
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n";
|
||||
|
||||
if (sizeof ($tMailbox) > 0)
|
||||
{
|
||||
@ -141,5 +146,6 @@ if (sizeof ($tMailbox) > 0)
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n";
|
||||
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
|
||||
?>
|
||||
|
@ -11,8 +11,11 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php print isset ($PALANG['charset']) ? $PALANG['charset'] : 'iso-8859-1' ?>" />
|
||||
<?php
|
||||
if (file_exists (realpath ("./stylesheet.css"))) print "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" />\n";
|
||||
if (file_exists (realpath ("../stylesheet.css"))) print "<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" />\n";
|
||||
if (file_exists (realpath ("./stylesheet.css"))) {
|
||||
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" />\n";
|
||||
} elseif (file_exists (realpath ("../stylesheet.css"))) {
|
||||
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" />\n";
|
||||
}
|
||||
?>
|
||||
<title>Postfix Admin - <?php print $_SERVER['HTTP_HOST']; ?></title>
|
||||
</head>
|
||||
@ -23,9 +26,7 @@ if (file_exists (realpath ("./stylesheet.css")))
|
||||
{
|
||||
print "<img id=\"login_header_logo\" src=\"images/postbox.png\" />\n";
|
||||
print "<img id=\"login_header_logo2\" src=\"images/postfixadmin2.png\" />\n";
|
||||
}
|
||||
|
||||
if (file_exists (realpath ("../stylesheet.css")))
|
||||
} elseif (file_exists (realpath ("../stylesheet.css")))
|
||||
{
|
||||
print "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />\n";
|
||||
print "<img id=\"login_header_logo2\" src=\"../images/postfixadmin2.png\" />\n";
|
||||
|
@ -23,4 +23,10 @@
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script tyle="text/javascript"><!--
|
||||
document.login.fUsername.focus();
|
||||
// -->
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
@ -60,7 +60,11 @@ if (sizeof ($tAlias) > 0)
|
||||
{
|
||||
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\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";
|
||||
} else {
|
||||
print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n";
|
||||
}
|
||||
print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
|
||||
|
||||
if ($CONF['special_alias_control'] == 'YES')
|
||||
@ -94,6 +98,7 @@ if (sizeof ($tAlias) > 0)
|
||||
|
||||
print "</table>\n";
|
||||
}
|
||||
print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n";
|
||||
|
||||
if (sizeof ($tMailbox) > 0)
|
||||
{
|
||||
@ -156,5 +161,6 @@ if (sizeof ($tMailbox) > 0)
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n";
|
||||
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user