1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-07 17:42:53 +03: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:
Greg
2007-06-20 01:48:44 +00:00
parent a5ce5620cf
commit d7cca670cb
12 changed files with 83 additions and 29 deletions

View File

@@ -6,6 +6,10 @@
# #
Version 2.1.1 -- TBD 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: main.php to admin dirctory (GregC)
- Added: Item "Main" on admin menu (GregC) - Added: Item "Main" on admin menu (GregC)
- Changed: Edit-vacation now edits for admins/superadmins (GregC) - Changed: Edit-vacation now edits for admins/superadmins (GregC)

View File

@@ -26,15 +26,30 @@ use DBI;
use strict; use strict;
use Sys::Syslog; use Sys::Syslog;
my $db_type = 'mysql'; # values that will be set in /etc/mail/vacation/vacationrc:
my $db_host = 'localhost'; our $db_type;
my $db_user = 'postfixadmin'; our $db_host;
my $db_pass = 'postfixadmin'; our $db_user;
my $db_name = 'postfix'; our $db_pass;
my $sendmail = "/usr/sbin/sendmail"; our $db_name;
my $logfile = ""; # specify a file name here for example: vacation.log our $sendmail;
my $debugfile = ""; # sepcify a file name here for example: vacation.debug our $logfile;
my $syslog = 0; # 1 if log entries should be sent to syslog 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); 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 ($messageid, $to, $from, $subject) = @_;
my $date; my $date;
if ( $syslog ) { 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; printf SYSLOG "Orig-To: %s From: %s MessageID: %s Subject: %s", $to, $from, $messageid, $subject;
close (SYSLOG); close (SYSLOG);
} }

View File

@@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
if ($_SERVER['REQUEST_METHOD'] == "POST") if ($_SERVER['REQUEST_METHOD'] == "POST")
{ {
if (isset ($_POST['fDomain'])) $fDomain = escape_string ($_POST['fDomain']); 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['fAliases'])) $fAliases = escape_string ($_POST['fAliases']);
if (isset ($_POST['fMailboxes'])) $fMailboxes = escape_string ($_POST['fMailboxes']); if (isset ($_POST['fMailboxes'])) $fMailboxes = escape_string ($_POST['fMailboxes']);
!empty ($_POST['fMaxquota']) ? $fMaxquota = escape_string ($_POST['fMaxquota']) : $fMaxquota = "0"; !empty ($_POST['fMaxquota']) ? $fMaxquota = escape_string ($_POST['fMaxquota']) : $fMaxquota = "0";

View File

@@ -138,10 +138,10 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if ($CONF['alias_control'] == "YES") 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']) 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 else

View File

@@ -144,20 +144,30 @@ function check_email ($email)
{ {
global $CONF; 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 ( if (
isset($CONF['emailcheck_resolve_domain']) isset($CONF['emailcheck_resolve_domain'])
&& 'YES'==$CONF['emailcheck_resolve_domain'] && 'YES'==$CONF['emailcheck_resolve_domain']
&& 'WINDOWS'!=(strtoupper(substr(php_uname('s'), 0, 7))) && 'WINDOWS'!=(strtoupper(substr(php_uname('s'), 0, 7)))
) { ) {
// Perform non-domain-part sanity checks // 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; return false;
} }
// Determine domain name // Determine domain name
$matches=array(); $matches=array();
if (!preg_match('|@(.+)$|',$email,$matches)) if (!preg_match('|@(.+)$|',$ce_email,$matches))
{ {
return false; return false;
} }
@@ -177,7 +187,7 @@ function check_email ($email)
return false; 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; return true;
} }

View File

@@ -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_error'] = '<span class="error_msg">Konnte Ihre Automatische Antwort nicht einstellen!</span>';
$PALANG['pUsersVacation_result_succes'] = 'Ihre Automatische Antwort wurde gel&ouml;scht!'; $PALANG['pUsersVacation_result_succes'] = 'Ihre Automatische Antwort wurde gel&ouml;scht!';
$PALANG['pCreate_dbLog_createmailbox'] = 'create mailbox'; $PALANG['pCreate_dbLog_createmailbox'] = 'Mailbox hinzuf<75>gen';
$PALANG['pCreate_dbLog_createalias'] = 'create alias'; $PALANG['pCreate_dbLog_createalias'] = 'Alias hinzuf<75>gen';
$PALANG['pDelete_dbLog_deletealias'] = 'delete alias'; $PALANG['pDelete_dbLog_deletealias'] = 'Alias l<>schen';
$PALANG['pDelete_dbLog_deletemailbox'] = 'delete mailbox'; $PALANG['pDelete_dbLog_deletemailbox'] = 'Mailbox l<>schen';
$PALANG['pEdit_dbLog_editactive'] = 'change active state'; $PALANG['pEdit_dbLog_editactive'] = 'Aktiv-Status <20>ndern';
$PALANG['pEdit_dbLog_editalias'] = 'edit alias'; $PALANG['pEdit_dbLog_editalias'] = 'Alias bearbeiten';
$PALANG['pEdit_dbLog_editmailbox'] = 'edit mailbox'; $PALANG['pEdit_dbLog_editmailbox'] = 'Mailbox bearbeiten';
$PALANG['pSearch_welcome'] = 'Searching for: '; $PALANG['pSearch_welcome'] = 'Suche nach: ';
?> ?>

View File

@@ -213,6 +213,11 @@ table {
background: #D9FF43; /*#D6FF85;*/ /*#ffdddd;*/ 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 { #alias_table h3, #mailbox_table h3, #overview_table h3, #log_table h3, #admin_table h3 {
background: silver; background: silver;
text-align: left; text-align: left;

View File

@@ -82,4 +82,5 @@ if (sizeof ($list_domains) > 0)
print "</table>\n"; print "</table>\n";
} }
echo "<p><a href='create-domain.php'>{$PALANG['pAdminMenu_create_domain']}</a>";
?> ?>

View File

@@ -62,7 +62,11 @@ if (sizeof ($tAlias) > 0)
{ {
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
print " <td>" . $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"; 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"; print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
$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=$fDomain" . "\">" . $active . "</a></td>\n"; 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 "</table>\n";
} }
print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n";
if (sizeof ($tMailbox) > 0) if (sizeof ($tMailbox) > 0)
{ {
@@ -141,5 +146,6 @@ if (sizeof ($tMailbox) > 0)
} }
print "</table>\n"; 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: */ /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?> ?>

View File

@@ -11,8 +11,11 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php print isset ($PALANG['charset']) ? $PALANG['charset'] : 'iso-8859-1' ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php print isset ($PALANG['charset']) ? $PALANG['charset'] : 'iso-8859-1' ?>" />
<?php <?php
if (file_exists (realpath ("./stylesheet.css"))) print "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" />\n"; if (file_exists (realpath ("./stylesheet.css"))) {
if (file_exists (realpath ("../stylesheet.css"))) print "<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" />\n"; 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> <title>Postfix Admin - <?php print $_SERVER['HTTP_HOST']; ?></title>
</head> </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_logo\" src=\"images/postbox.png\" />\n";
print "<img id=\"login_header_logo2\" src=\"images/postfixadmin2.png\" />\n"; print "<img id=\"login_header_logo2\" src=\"images/postfixadmin2.png\" />\n";
} } elseif (file_exists (realpath ("../stylesheet.css")))
if (file_exists (realpath ("../stylesheet.css")))
{ {
print "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />\n"; print "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />\n";
print "<img id=\"login_header_logo2\" src=\"../images/postfixadmin2.png\" />\n"; print "<img id=\"login_header_logo2\" src=\"../images/postfixadmin2.png\" />\n";

View File

@@ -23,4 +23,10 @@
</tr> </tr>
</table> </table>
</form> </form>
<script tyle="text/javascript"><!--
document.login.fUsername.focus();
// -->
</script>
</div> </div>

View File

@@ -60,7 +60,11 @@ if (sizeof ($tAlias) > 0)
{ {
print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n";
print " <td>" . $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"; 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"; print " <td>" . $tAlias[$i]['modified'] . "</td>\n";
if ($CONF['special_alias_control'] == 'YES') if ($CONF['special_alias_control'] == 'YES')
@@ -94,6 +98,7 @@ if (sizeof ($tAlias) > 0)
print "</table>\n"; print "</table>\n";
} }
print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n";
if (sizeof ($tMailbox) > 0) if (sizeof ($tMailbox) > 0)
{ {
@@ -156,5 +161,6 @@ if (sizeof ($tMailbox) > 0)
} }
print "</table>\n"; 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: */ /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?> ?>