tbrehm
2007-05-30 ba747c0be201755bed0e36e02edfb85d31f5214f
Enhanced getmail support and the installer.
15 files modified
4 files added
633 ■■■■■ changed files
install/install.php 20 ●●●● patch | view | raw | blame | history
install/lib/installer_base.lib.php 26 ●●●●● patch | view | raw | blame | history
install/tpl/config.inc.php.master 12 ●●●●● patch | view | raw | blame | history
install/uninstall.php 45 ●●●●● patch | view | raw | blame | history
interface/lib/classes/tform.inc.php 17 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/server.tform.php 25 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server.lng 23 ●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_edit_config.htm 16 ●●●●● patch | view | raw | blame | history
interface/web/client/templates/client_edit_limits.htm 2 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_get.lng 22 ●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_get_list.lng 27 ●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_spamfilter_policy.lng 78 ●●●● patch | view | raw | blame | history
interface/web/mail/lib/module.conf.php 235 ●●●● patch | view | raw | blame | history
interface/web/mail/mail_user_edit.php 6 ●●●● patch | view | raw | blame | history
server/lib/app.inc.php 2 ●●● patch | view | raw | blame | history
server/lib/classes/getconf.inc.php 60 ●●●●● patch | view | raw | blame | history
server/plugins-enabled/getmail_plugin.inc.php 13 ●●●● patch | view | raw | blame | history
server/scripts/getmail.sh 2 ●●●●● patch | view | raw | blame | history
server/server.php 2 ●●● patch | view | raw | blame | history
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";
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);
        
    }
    
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);
?>
install/uninstall.php
New file
@@ -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";
?>
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;
                }
        }
        /*
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
    ##################################
    )
);
?>
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';
?>
interface/web/admin/templates/server_edit_config.htm
New file
@@ -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">&nbsp;</td>
    <td class="frmText11">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</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>&nbsp;
      <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'}">
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>
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';
?>
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';
?>
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';
?>
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);
}
?>
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');
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 {
server/lib/classes/getconf.inc.php
New file
@@ -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");
    }
}
?>
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);
server/scripts/getmail.sh
New file
@@ -0,0 +1,2 @@
#!/bin/bash
getmail -g /etc/getmail/ -r /etc/getmail/*.conf
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");
?>