From ba747c0be201755bed0e36e02edfb85d31f5214f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 30 May 2007 10:11:32 -0400
Subject: [PATCH] Enhanced getmail support and the installer.
---
install/tpl/config.inc.php.master | 12 +
interface/web/client/templates/client_edit_limits.htm | 2
interface/web/admin/form/server.tform.php | 25 ++
interface/lib/classes/tform.inc.php | 17
interface/web/admin/templates/server_edit_config.htm | 16 +
interface/web/mail/lib/lang/en_mail_get.lng | 22 +-
interface/web/mail/mail_user_edit.php | 6
server/lib/app.inc.php | 2
interface/web/mail/lib/lang/en_mail_get_list.lng | 27 +-
server/lib/classes/getconf.inc.php | 60 +++++
install/install.php | 20 +
install/lib/installer_base.lib.php | 26 ++
interface/web/mail/lib/module.conf.php | 235 ++++++++++-----------
interface/web/mail/lib/lang/en_spamfilter_policy.lng | 78 +++---
server/server.php | 2
install/uninstall.php | 45 ++++
server/plugins-enabled/getmail_plugin.inc.php | 13
server/scripts/getmail.sh | 2
interface/web/admin/lib/lang/en_server.lng | 23 +-
19 files changed, 417 insertions(+), 216 deletions(-)
diff --git a/install/install.php b/install/install.php
index 39ad865..1805ef3 100644
--- a/install/install.php
+++ b/install/install.php
@@ -86,7 +86,11 @@
swriteln('Configuring Amavisd');
$inst->configure_amavis();
-// Configure Amavis
+// Configure Getmail
+swriteln('Configuring Getmail');
+$inst->configure_getmail();
+
+// Configure ISPConfig
swriteln('Installing ISPConfig');
$inst->install_ispconfig();
@@ -101,11 +105,19 @@
amavisd
calmd
spamd
-
-
-
*/
+exec("/etc/init.d/mysql restart");
+exec("/etc/init.d/postfix restart");
+exec("/etc/init.d/saslauthd restart");
+exec("/etc/init.d/amavis restart");
+exec("/etc/init.d/clamav-daemon restart");
+exec("/etc/init.d/courier-authdaemon restart");
+exec("/etc/init.d/courier-imap restart");
+exec("/etc/init.d/courier-imap-ssl restart");
+exec("/etc/init.d/courier-pop restart");
+exec("/etc/init.d/courier-pop-ssl restart");
+
echo "Installation finished.\n";
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 9c89a7c..a4c5a2b 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -439,6 +439,16 @@
wf($configfile,$content);
}
+ function configure_getmail() {
+ global $conf;
+
+ $command = "useradd -b /etc/getmail -d /etc/getmail getmail";
+ caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
+
+ $command = "chmod -R 700 /etc/getmail";
+ caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
+ }
+
function install_ispconfig() {
global $conf;
@@ -466,7 +476,7 @@
$command = "ln -s ".$conf["ispconfig_install_dir"]."/interface/web/ /var/www/ispconfig";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
- // Create the config file for ISPConfig
+ // Create the config file for ISPConfig interface
$configfile = 'config.inc.php';
if(is_file($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile)) copy($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile,$conf["ispconfig_install_dir"].'/interface/lib/'.$configfile.'~');
$content = rf("tpl/".$configfile.".master");
@@ -475,6 +485,17 @@
$content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
$content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
wf($conf["ispconfig_install_dir"].'/interface/lib/'.$configfile,$content);
+
+ // Create the config file for ISPConfig server
+ $configfile = 'config.inc.php';
+ if(is_file($conf["ispconfig_install_dir"].'/server/lib/'.$configfile)) copy($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$conf["ispconfig_install_dir"].'/interface/lib/'.$configfile.'~');
+ $content = rf("tpl/".$configfile.".master");
+ $content = str_replace('{mysql_server_ispconfig_user}',$conf["mysql_server_ispconfig_user"],$content);
+ $content = str_replace('{mysql_server_ispconfig_password}',$conf["mysql_server_ispconfig_password"],$content);
+ $content = str_replace('{mysql_server_database}',$conf["mysql_server_database"],$content);
+ $content = str_replace('{mysql_server_host}',$conf["mysql_server_host"],$content);
+ wf($conf["ispconfig_install_dir"].'/server/lib/'.$configfile,$content);
+
// Chmod the files
$command = "chmod -R 750 ".$conf["ispconfig_install_dir"];
@@ -491,6 +512,9 @@
$command = "adduser www-data ispconfig";
caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
+ // Make the shell scripts executable
+ $command = "chmod +x ".$conf["ispconfig_install_dir"]."/server/scripts/*.sh";
+ caselog($command." &> /dev/null", __FILE__, __LINE__,"EXECUTED: ".$command,"Failed to execute the command ".$command);
}
diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master
index 7915029..5bf2aed 100644
--- a/install/tpl/config.inc.php.master
+++ b/install/tpl/config.inc.php.master
@@ -35,6 +35,7 @@
$conf["app_title"] = "ISPConfig";
$conf["app_version"] = "3.0.0";
+$conf["server_id"] = "1";
/*
@@ -70,6 +71,13 @@
define("DB_PASSWORD",$conf["db_password"]);
/*
+ Logging
+*/
+
+$conf["log_file"] = $conf["rootpath"].$conf["fs_div"]."ispconfig.log";
+$conf["log_priority"] = 0; // 0 = Debug, 1 = Warning, 2 = Error
+
+/*
Themes
*/
@@ -104,4 +112,8 @@
$conf["default_expire"] = 604800;
$conf["default_minimum_ttl"] = 86400;
+define("LOGLEVEL_DEBUG",0);
+define("LOGLEVEL_WARN",1);
+define("LOGLEVEL_ERROR",2);
+
?>
\ No newline at end of file
diff --git a/install/uninstall.php b/install/uninstall.php
new file mode 100644
index 0000000..9a1702e
--- /dev/null
+++ b/install/uninstall.php
@@ -0,0 +1,45 @@
+<?php
+
+/*
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("/usr/local/ispconfig/server/lib/config.inc.php");
+require("/usr/local/ispconfig/server/lib/app.inc.php");
+
+// Delete the ISPConfig database
+$app->db->query('DROP DATABASE '.$conf["db_database"]);
+
+// Deleting the symlink in /var/www
+unlink("/var/www/ispconfig");
+
+// Delete the ispconfig files
+exec('rm -rf /usr/local/ispconfig');
+
+echo "Finished.\n";
+
+?>
\ No newline at end of file
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index ca6e594..a9ae437 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -875,14 +875,17 @@
}
function getAuthSQL($perm) {
+ if($_SESSION["s"]["user"]["typ"] == 'admin') {
+ return '1';
+ } else {
+ $sql = '(';
+ $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
+ $sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
+ $sql .= "sys_perm_other like '%$perm%'";
+ $sql .= ')';
- $sql = '(';
- $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
- $sql .= "(sys_groupid IN (".$_SESSION["s"]["user"]["groups"].") AND sys_perm_group like '%$perm%') OR ";
- $sql .= "sys_perm_other like '%$perm%'";
- $sql .= ')';
-
- return $sql;
+ return $sql;
+ }
}
/*
diff --git a/interface/web/admin/form/server.tform.php b/interface/web/admin/form/server.tform.php
index 9682180..f4ebd4c 100644
--- a/interface/web/admin/form/server.tform.php
+++ b/interface/web/admin/form/server.tform.php
@@ -123,4 +123,29 @@
);
+$form["tabs"]['config'] = array (
+ 'title' => "Config",
+ 'width' => 100,
+ 'template' => "templates/server_edit_config.htm",
+ 'fields' => array (
+ ##################################
+ # Begin Datatable fields
+ ##################################
+ 'config' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXTAREA',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '',
+ 'cols' => '40',
+ 'rows' => '20',
+ 'maxlength' => ''
+ ),
+ ##################################
+ # ENDE Datatable fields
+ ##################################
+ )
+);
+
+
?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_server.lng b/interface/web/admin/lib/lang/en_server.lng
index b8f1acf..f98f668 100644
--- a/interface/web/admin/lib/lang/en_server.lng
+++ b/interface/web/admin/lib/lang/en_server.lng
@@ -1,12 +1,13 @@
-<?php
-$wb["server_name_txt"] = 'Servername';
-$wb["mail_server_txt"] = 'Mailserver';
-$wb["web_server_txt"] = 'Webserver';
-$wb["dns_server_txt"] = 'DNS-Server';
-$wb["file_server_txt"] = 'Fileserver';
-$wb["db_server_txt"] = 'DB-Server';
-$wb["vserver_server_txt"] = 'VServer-Server';
-$wb["active_txt"] = 'Active';
-$wb["btn_save_txt"] = 'Save';
-$wb["btn_cancel_txt"] = 'Cancel';
+<?php
+$wb["config_txt"] = 'config';
+$wb["btn_save_txt"] = 'Save';
+$wb["btn_cancel_txt"] = 'Cancel';
+$wb["server_name_txt"] = 'Servername';
+$wb["mail_server_txt"] = 'Mailserver';
+$wb["web_server_txt"] = 'Webserver';
+$wb["dns_server_txt"] = 'DNS-Server';
+$wb["file_server_txt"] = 'Fileserver';
+$wb["db_server_txt"] = 'DB-Server';
+$wb["vserver_server_txt"] = 'VServer-Server';
+$wb["active_txt"] = 'Active';
?>
\ No newline at end of file
diff --git a/interface/web/admin/templates/server_edit_config.htm b/interface/web/admin/templates/server_edit_config.htm
new file mode 100644
index 0000000..3e1a335
--- /dev/null
+++ b/interface/web/admin/templates/server_edit_config.htm
@@ -0,0 +1,16 @@
+<table width="500" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td class="frmText11">{tmpl_var name='config_txt'}:</td>
+ <td class="frmText11"><textarea name='config' cols='60' rows='30'>{tmpl_var name='config'}</textarea></td>
+ </tr> <tr>
+ <td class="frmText11"> </td>
+ <td class="frmText11"> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_edit.php');"><div class="buttonEnding"></div>
+ <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_list.php');"><div class="buttonEnding"></div>
+ </td>
+ </tr>
+</table>
+<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm
index 21c9690..be92c42 100644
--- a/interface/web/client/templates/client_edit_limits.htm
+++ b/interface/web/client/templates/client_edit_limits.htm
@@ -34,10 +34,12 @@
<td class="frmText11">{tmpl_var name='limit_mailrouting_txt'}:</td>
<td class="frmText11"><input name="limit_mailrouting" type="text" class="text" value="{tmpl_var name='limit_mailrouting'}" size="10" maxlength="10"></td>
</tr>
+ <!--
<tr>
<td class="frmText11">{tmpl_var name='limit_mailfilter_txt'}:</td>
<td class="frmText11"><input name="limit_mailfilter" type="text" class="text" value="{tmpl_var name='limit_mailfilter'}" size="10" maxlength="10"></td>
</tr>
+ -->
<tr>
<td class="frmText11">{tmpl_var name='limit_fetchmail_txt'}:</td>
<td class="frmText11"><input name="limit_fetchmail" type="text" class="text" value="{tmpl_var name='limit_fetchmail'}" size="10" maxlength="10"></td>
diff --git a/interface/web/mail/lib/lang/en_mail_get.lng b/interface/web/mail/lib/lang/en_mail_get.lng
index f6d3731..f6828af 100644
--- a/interface/web/mail/lib/lang/en_mail_get.lng
+++ b/interface/web/mail/lib/lang/en_mail_get.lng
@@ -1,12 +1,12 @@
-<?php
-$wb["server_id_txt"] = 'server_id';
-$wb["type_txt"] = 'type';
-$wb["source_server_txt"] = 'source_server';
-$wb["source_username_txt"] = 'source_username';
-$wb["source_password_txt"] = 'source_password';
-$wb["source_delete_txt"] = 'source_delete';
-$wb["destination_txt"] = 'destination';
-$wb["active_txt"] = 'active';
-$wb["btn_save_txt"] = 'Save';
-$wb["btn_cancel_txt"] = 'Cancel';
+<?php
+$wb["server_id_txt"] = 'Server';
+$wb["type_txt"] = 'Type';
+$wb["source_server_txt"] = 'Pop3/Imap Server';
+$wb["source_username_txt"] = 'Username';
+$wb["source_password_txt"] = 'Password';
+$wb["source_delete_txt"] = 'Delete emails after retrieval';
+$wb["destination_txt"] = 'Destination';
+$wb["active_txt"] = 'Active';
+$wb["btn_save_txt"] = 'Save';
+$wb["btn_cancel_txt"] = 'Cancel';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_mail_get_list.lng b/interface/web/mail/lib/lang/en_mail_get_list.lng
index 11a4d02..94fdb06 100644
--- a/interface/web/mail/lib/lang/en_mail_get_list.lng
+++ b/interface/web/mail/lib/lang/en_mail_get_list.lng
@@ -1,14 +1,15 @@
-<?php
-$wb["list_head_txt"] = 'mail_get';
-$wb["active_txt"] = 'active';
-$wb["server_id_txt"] = 'server_id';
-$wb["source_server_txt"] = 'source_server';
-$wb["source_username_txt"] = 'source_username';
-$wb["destination_txt"] = 'destination';
-$wb["page_txt"] = 'Page';
-$wb["page_of_txt"] = 'of';
-$wb["page_next_txt"] = 'Next';
-$wb["page_back_txt"] = 'Back';
-$wb["delete_txt"] = 'Delete';
-$wb["filter_txt"] = 'Filter';
+<?php
+$wb["list_head_txt"] = 'Fetch emails from external POP3 / IMAP servers';
+$wb["active_txt"] = 'Active';
+$wb["server_id_txt"] = 'Server';
+$wb["source_server_txt"] = 'External Server';
+$wb["source_username_txt"] = 'Username';
+$wb["destination_txt"] = 'Destination';
+$wb["page_txt"] = 'Page';
+$wb["page_of_txt"] = 'of';
+$wb["page_next_txt"] = 'Next';
+$wb["page_back_txt"] = 'Back';
+$wb["delete_txt"] = 'Delete';
+$wb["filter_txt"] = 'Filter';
+$wb["add_new_record_txt"] = 'Add new Account';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_spamfilter_policy.lng b/interface/web/mail/lib/lang/en_spamfilter_policy.lng
index 879c2cb..bf5d943 100644
--- a/interface/web/mail/lib/lang/en_spamfilter_policy.lng
+++ b/interface/web/mail/lib/lang/en_spamfilter_policy.lng
@@ -1,40 +1,40 @@
-<?php
-$wb["policy_name_txt"] = 'policy_name';
-$wb["virus_lover_txt"] = 'virus_lover';
-$wb["spam_lover_txt"] = 'spam_lover';
-$wb["banned_files_lover_txt"] = 'banned_files_lover';
-$wb["bad_header_lover_txt"] = 'bad_header_lover';
-$wb["bypass_virus_checks_txt"] = 'bypass_virus_checks';
-$wb["bypass_banned_checks_txt"] = 'bypass_banned_checks';
-$wb["bypass_header_checks_txt"] = 'bypass_header_checks';
-$wb["btn_save_txt"] = 'Save';
-$wb["btn_cancel_txt"] = 'Cancel';
-$wb["virus_quarantine_to_txt"] = 'virus_quarantine_to';
-$wb["spam_quarantine_to_txt"] = 'spam_quarantine_to';
-$wb["banned_quarantine_to_txt"] = 'banned_quarantine_to';
-$wb["bad_header_quarantine_to_txt"] = 'bad_header_quarantine_to';
-$wb["clean_quarantine_to_txt"] = 'clean_quarantine_to';
-$wb["other_quarantine_to_txt"] = 'other_quarantine_to';
-$wb["spam_tag_level_txt"] = 'spam_tag_level';
-$wb["spam_tag2_level_txt"] = 'spam_tag2_level';
-$wb["spam_kill_level_txt"] = 'spam_kill_level';
-$wb["spam_dsn_cutoff_level_txt"] = 'spam_dsn_cutoff_level';
-$wb["spam_quarantine_cutoff_level_txt"] = 'spam_quarantine_cutoff_level';
-$wb["spam_modifies_subj_txt"] = 'spam_modifies_subj';
-$wb["spam_subject_tag_txt"] = 'spam_subject_tag';
-$wb["spam_subject_tag2_txt"] = 'spam_subject_tag2';
-$wb["addr_extension_virus_txt"] = 'addr_extension_virus';
-$wb["addr_extension_spam_txt"] = 'addr_extension_spam';
-$wb["addr_extension_banned_txt"] = 'addr_extension_banned';
-$wb["addr_extension_bad_header_txt"] = 'addr_extension_bad_header';
-$wb["warnvirusrecip_txt"] = 'warnvirusrecip';
-$wb["warnbannedrecip_txt"] = 'warnbannedrecip';
-$wb["warnbadhrecip_txt"] = 'warnbadhrecip';
-$wb["newvirus_admin_txt"] = 'newvirus_admin';
-$wb["virus_admin_txt"] = 'virus_admin';
-$wb["banned_admin_txt"] = 'banned_admin';
-$wb["bad_header_admin_txt"] = 'bad_header_admin';
-$wb["spam_admin_txt"] = 'spam_admin';
-$wb["message_size_limit_txt"] = 'message_size_limit';
-$wb["banned_rulenames_txt"] = 'banned_rulenames';
+<?php
+$wb["policy_name_txt"] = 'Policy Name';
+$wb["virus_lover_txt"] = 'Virusl lover';
+$wb["spam_lover_txt"] = 'SPAM lover';
+$wb["banned_files_lover_txt"] = 'Banned files lover';
+$wb["bad_header_lover_txt"] = 'Bad header lover';
+$wb["bypass_virus_checks_txt"] = 'Bypass virus checks';
+$wb["bypass_banned_checks_txt"] = 'Bypass banned checks';
+$wb["bypass_header_checks_txt"] = 'Bypass header checks';
+$wb["btn_save_txt"] = 'Save';
+$wb["btn_cancel_txt"] = 'Cancel';
+$wb["virus_quarantine_to_txt"] = 'Virus quarantine to';
+$wb["spam_quarantine_to_txt"] = 'Spam quarantine to';
+$wb["banned_quarantine_to_txt"] = 'Banned quarantine to';
+$wb["bad_header_quarantine_to_txt"] = 'Bad header quarantine to';
+$wb["clean_quarantine_to_txt"] = 'Clean quarantine to';
+$wb["other_quarantine_to_txt"] = 'Other quarantine to';
+$wb["spam_tag_level_txt"] = 'SPAM tag level';
+$wb["spam_tag2_level_txt"] = 'SPAM tag2 level';
+$wb["spam_kill_level_txt"] = 'SPAM kill level';
+$wb["spam_dsn_cutoff_level_txt"] = 'SPAM dsn cutoff level';
+$wb["spam_quarantine_cutoff_level_txt"] = 'SPAM quarantine cutoff level';
+$wb["spam_modifies_subj_txt"] = 'SPAM modifies subject';
+$wb["spam_subject_tag_txt"] = 'SPAM subject tag';
+$wb["spam_subject_tag2_txt"] = 'SPAM subject tag2';
+$wb["addr_extension_virus_txt"] = 'Addr. extension virus';
+$wb["addr_extension_spam_txt"] = 'Addr. extension SPAM';
+$wb["addr_extension_banned_txt"] = 'Addr. extension banned';
+$wb["addr_extension_bad_header_txt"] = 'Addr extension bad header';
+$wb["warnvirusrecip_txt"] = 'Warn virus recip.';
+$wb["warnbannedrecip_txt"] = 'Warn banned recip.';
+$wb["warnbadhrecip_txt"] = 'Warn bad header recip.';
+$wb["newvirus_admin_txt"] = 'Newvirus admin';
+$wb["virus_admin_txt"] = 'Virus admin';
+$wb["banned_admin_txt"] = 'Banned admin';
+$wb["bad_header_admin_txt"] = 'Bad header admin';
+$wb["spam_admin_txt"] = 'SPAM admin';
+$wb["message_size_limit_txt"] = 'Message size limit';
+$wb["banned_rulenames_txt"] = 'Banned rulenames';
?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php
index a7c7e1c..5cf7455 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -1,123 +1,114 @@
-<?php
-$module = array (
- 'name' => 'mail',
- 'title' => 'Email',
- 'template' => 'module.tpl.htm',
- 'navframe_page' => '',
- 'startpage' => 'mail/mail_domain_list.php',
- 'tab_width' => '',
- 'nav' =>
- array (
- 0 =>
- array (
- 'title' => 'Email Accounts',
- 'open' => 1,
- 'items' =>
- array (
- 0 =>
- array (
- 'title' => 'Domain',
- 'target' => 'content',
- 'link' => 'mail/mail_domain_list.php',
- ),
- 3 =>
- array (
- 'title' => 'Email Mailbox',
- 'target' => 'content',
- 'link' => 'mail/mail_user_list.php',
- ),
- 4 =>
- array (
- 'title' => 'Email Alias',
- 'target' => 'content',
- 'link' => 'mail/mail_alias_list.php',
- ),
- 5 =>
- array (
- 'title' => 'Email Forward',
- 'target' => 'content',
- 'link' => 'mail/mail_forward_list.php',
- ),
- 6 =>
- array (
- 'title' => 'Email Catchall',
- 'target' => 'content',
- 'link' => 'mail/mail_domain_catchall_list.php',
- ),
- 7 =>
- array (
- 'title' => 'Email Routing',
- 'target' => 'content',
- 'link' => 'mail/mail_transport_list.php',
- ),
- ),
- ),
- 1 =>
- array (
- 'title' => 'Email Filter',
- 'open' => 1,
- 'items' =>
- array (
- 0 =>
- array (
- 'title' => 'Whitelist',
- 'target' => 'content',
- 'link' => 'mail/mail_whitelist_list.php',
- ),
- 1 =>
- array (
- 'title' => 'Blacklist',
- 'target' => 'content',
- 'link' => 'mail/mail_blacklist_list.php',
- ),
- ),
- ),
- 2 =>
- array (
- 'title' => 'Spamfilter',
- 'open' => 1,
- 'items' =>
- array (
- 0 =>
- array (
- 'title' => 'Whitelist',
- 'target' => 'content',
- 'link' => 'mail/spamfilter_whitelist_list.php',
- ),
- 1 =>
- array (
- 'title' => 'Blacklist',
- 'target' => 'content',
- 'link' => 'mail/spamfilter_blacklist_list.php',
- ),
- 2 =>
- array (
- 'title' => 'User',
- 'target' => 'content',
- 'link' => 'mail/spamfilter_users_list.php',
- ),
- 3 =>
- array (
- 'title' => 'Policy',
- 'target' => 'content',
- 'link' => 'mail/spamfilter_policy_list.php',
- ),
- ),
- ),
- 3 =>
- array (
- 'title' => 'Fetchmail',
- 'open' => 1,
- 'items' =>
- array (
- 0 =>
- array (
- 'title' => 'Fetchmail',
- 'target' => 'content',
- 'link' => 'mail/mail_get_list.php',
- ),
- ),
- ),
- ),
-)
+<?php
+
+$module["name"] = "mail";
+$module["title"] = "Email";
+$module["template"] = "module.tpl.htm";
+$module["startpage"] = "mail/mail_domain_list.php";
+$module["tab_width"] = '';
+
+/*
+ Email accounts menu
+*/
+
+$items[] = array( 'title' => "Domain",
+ 'target' => 'content',
+ 'link' => 'mail/mail_domain_list.php');
+
+$items[] = array( 'title' => "Email Mailbox",
+ 'target' => 'content',
+ 'link' => 'mail/mail_user_list.php');
+
+$items[] = array( 'title' => "Email Alias",
+ 'target' => 'content',
+ 'link' => 'mail/mail_alias_list.php');
+
+$items[] = array( 'title' => "Email Forward",
+ 'target' => 'content',
+ 'link' => 'mail/mail_forward_list.php');
+
+$items[] = array( 'title' => "Email Catchall",
+ 'target' => 'content',
+ 'link' => 'mail/mail_domain_catchall_list.php');
+
+$items[] = array( 'title' => "Email Routing",
+ 'target' => 'content',
+ 'link' => 'mail/mail_transport_list.php');
+
+$module["nav"][] = array( 'title' => 'Email Accounts',
+ 'open' => 1,
+ 'items' => $items);
+
+// aufr�umen
+unset($items);
+
+/*
+ Spamfilter menu
+*/
+
+$items[] = array( 'title' => "Whitelist",
+ 'target' => 'content',
+ 'link' => 'mail/spamfilter_whitelist_list.php');
+
+$items[] = array( 'title' => "Blacklist",
+ 'target' => 'content',
+ 'link' => 'mail/spamfilter_blacklist_list.php');
+
+if($_SESSION["s"]["user"]["typ"] == 'admin') {
+
+ $items[] = array( 'title' => "User / Domain",
+ 'target' => 'content',
+ 'link' => 'mail/spamfilter_users_list.php');
+
+ $items[] = array( 'title' => "Policy",
+ 'target' => 'content',
+ 'link' => 'mail/spamfilter_policy_list.php');
+}
+
+$module["nav"][] = array( 'title' => 'Spamfilter',
+ 'open' => 1,
+ 'items' => $items);
+
+// aufr�umen
+unset($items);
+
+/*
+ Fetchmail menu
+*/
+
+
+$items[] = array( 'title' => "Fetchmail",
+ 'target' => 'content',
+ 'link' => 'mail/mail_get_list.php');
+
+
+$module["nav"][] = array( 'title' => 'Fetchmail',
+ 'open' => 1,
+ 'items' => $items);
+
+// aufr�umen
+unset($items);
+
+/*
+ Global filters menu
+*/
+
+if($_SESSION["s"]["user"]["typ"] == 'admin') {
+
+ $items[] = array( 'title' => "Whitelist",
+ 'target' => 'content',
+ 'link' => 'mail/mail_whitelist_list.php');
+
+ $items[] = array( 'title' => "Blacklist",
+ 'target' => 'content',
+ 'link' => 'mail/mail_blacklist_list.php');
+
+ $module["nav"][] = array( 'title' => 'Global Filters',
+ 'open' => 1,
+ 'items' => $items);
+
+ // aufr�umen
+ unset($items);
+}
+
+
?>
\ No newline at end of file
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index d611e23..4659d87 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -96,7 +96,7 @@
$app->tpl->setVar("email_domain",$domain_select);
// Convert quota from Bytes to MB
- $app->tpl->setVar("quota",$this->dataRecord["quota"] / 1024);
+ $app->tpl->setVar("quota",$this->dataRecord["quota"] / 1024/ 1024);
parent::onShowEnd();
}
@@ -133,7 +133,7 @@
// Check the quota and adjust
if($client["limit_mailquota"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
- $mailquota = $tmp["mailquota"] / 1024;
+ $mailquota = $tmp["mailquota"] / 1024 / 1024;
$new_mailbox_quota = intval($this->dataRecord["quota"]);
if($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) {
$max_free_quota = $client["limit_mailquota"] - $mailquota;
@@ -156,7 +156,7 @@
unset($this->dataRecord["email_domain"]);
// Convert quota from MB to Bytes
- $this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024;
+ $this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
// setting Maildir, Homedir, UID and GID
$app->uses('getconf');
diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php
index dd52be1..e8e9b93 100644
--- a/server/lib/app.inc.php
+++ b/server/lib/app.inc.php
@@ -104,7 +104,7 @@
if (!fwrite($fp, date("d.m.Y-H:i")." - ".$priority_txt." - ". $msg."\r\n")) {
die("Unable to write to logfile.");
}
- echo date("d.m.Y-H:i")." - ".$priority_txt." - ". $msg."<br>";
+ echo date("d.m.Y-H:i")." - ".$priority_txt." - ". $msg."<br>\n";
fclose($fp);
//} else {
diff --git a/server/lib/classes/getconf.inc.php b/server/lib/classes/getconf.inc.php
new file mode 100644
index 0000000..fd0c088
--- /dev/null
+++ b/server/lib/classes/getconf.inc.php
@@ -0,0 +1,60 @@
+<?php
+
+/*
+Copyright (c) 2006, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+class getconf {
+
+ var $config;
+
+ function get_server_config($server_id, $section = '') {
+ global $app;
+
+ if(!is_array($this->config[$server_id])) {
+ $app->uses('ini_parser');
+ $server_id = intval($server_id);
+ $server = $app->db->queryOneRecord("SELECT config FROM server WHERE server_id = $server_id");
+ $this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server["config"]));
+ }
+
+ if($section == '') {
+ return $this->config[$server_id];
+ } else {
+ return $this->config[$server_id][$section];
+ }
+ }
+
+ function get_global_config() {
+
+ die("not yet implemented");
+
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/server/plugins-enabled/getmail_plugin.inc.php b/server/plugins-enabled/getmail_plugin.inc.php
index cc18d2d..65569d4 100644
--- a/server/plugins-enabled/getmail_plugin.inc.php
+++ b/server/plugins-enabled/getmail_plugin.inc.php
@@ -34,7 +34,7 @@
var $class_name = 'getmail_plugin';
- var $getmail_config_dir = '/etc/getmail';
+ var $getmail_config_dir = '';
/*
This function is called when the plugin is loaded
@@ -51,6 +51,8 @@
$app->plugins->registerEvent('mail_get_update','getmail_plugin','update');
$app->plugins->registerEvent('mail_get_delete','getmail_plugin','delete');
+
+
}
function insert($event_name,$data) {
@@ -62,6 +64,11 @@
function update($event_name,$data) {
global $app, $conf;
+
+ // load the server specific configuration options for getmail
+ $app->uses("getconf");
+ $getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
+ $this->getmail_config_dir = $getmail_config["getmail_config_dir"];
// Check if the config directory exists.
if(!is_dir($this->getmail_config_dir)) {
@@ -79,7 +86,7 @@
}
- if($data["new"]["source_active"] == 'y') {
+ if($data["new"]["active"] == 'y') {
// Open master template
$tpl = file_get_contents($conf["rootpath"].'/conf/getmail.conf.master');
@@ -101,7 +108,7 @@
$tpl = str_replace('{SERVER}',$data["new"]["source_server"],$tpl);
$tpl = str_replace('{USERNAME}',$data["new"]["source_username"],$tpl);
$tpl = str_replace('{PASSWORD}',$data["new"]["source_password"],$tpl);
- $tpl = str_replace('{DESTINATION}',$data["new"]["source_destination"],$tpl);
+ $tpl = str_replace('{DESTINATION}',$data["new"]["destination"],$tpl);
// Write the config file.
file_put_contents($config_file_path,$tpl);
diff --git a/server/scripts/getmail.sh b/server/scripts/getmail.sh
new file mode 100644
index 0000000..cf9160a
--- /dev/null
+++ b/server/scripts/getmail.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+getmail -g /etc/getmail/ -r /etc/getmail/*.conf
\ No newline at end of file
diff --git a/server/server.php b/server/server.php
index b4973f8..89341eb 100644
--- a/server/server.php
+++ b/server/server.php
@@ -109,5 +109,5 @@
$app->log("Remove Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock",LOGLEVEL_DEBUG);
*/
-die('finished.');
+die("finished.\n");
?>
\ No newline at end of file
--
Gitblit v1.9.1