Пример #1
0
    mail_account_generate();
    $console .= _("Email user and domain files generated !");
    $console .= "\n";
}
if (isset($_REQUEST["gen_backup_script"]) && $_REQUEST["gen_backup_script"] == 1) {
    backup_script_generate();
    $console .= _("Backup script generated !");
    $console .= "\n";
}
if (isset($_REQUEST["gen_stat_script"]) && $_REQUEST["gen_stat_script"] == 1) {
    stat_script_generate();
    $console .= _("Stat script generated !");
    $console .= "\n";
}
if (isset($_REQUEST["gen_fetchmail_script"]) && $_REQUEST["gen_fetchmail_script"] == 1) {
    fetchmail_generate();
    $console .= _("Fetchmail script generated !");
    $console .= "\n";
}
if ($conf_demo_version == "true") {
    $browse_files_button = "\n<a href=\"../etc\">" . _("Browse all generated files") . "</a>";
} else {
    $browse_files_button = "";
}
// Links to the command executed on top
$top_commands = "\n<br><b><font size=\"-2\">\n\n<table border=\"0\" width=\"100%\" height=\"1\">\n<tr><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&gen_pro_vhost=1&gen_stat_script=1&gen_named_files=1&gen_backup_script=1&gen_email_account=1&gen_fetchmail_script=1\">\n\t<img border=\"0\" src=\"gfx/dtc/all_scripts.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("ALL FILES AND SCRIPTS") . "</font></a>\n</div>\n</td><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&gen_pro_vhost=1\">\n\t<img border=\"0\" src=\"gfx/dtc/generate_web.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("APACHE VHOST") . "</font></a>\n</div>\n</td><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&gen_email_account=1\">\n\t<img border=\"0\" src=\"gfx/dtc/generate_mail.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("E-MAIL ACCOUNTS") . "</font></a>\n</div>\n</td><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&gen_named_files=1\">\n\t<img border=\"0\" src=\"gfx/dtc/generate_named.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("NAMED ZONES FILES") . "</font></a>\n</div>\n</td><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&reinit_named_zones=1\">\n\t<img border=\"0\" src=\"gfx/dtc/reinit_named.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("REINIT NAMED ZONES") . "</font></a>\n</div>\n</td><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&gen_backup_script=1\">\n\t<img border=\"0\" src=\"gfx/dtc/generate_backup.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("BACKUP SCRIPTS") . "</font></a>\n</div>\n</td><td valign=\"bottom\">\n<div align=\"center\">\n\t<a href=\"" . $_SERVER["PHP_SELF"] . "?rub=generate&gen_fetchmail_script=1\">\n\t<img border=\"0\" src=\"gfx/dtc/generate_mail.gif\"><br>\n\t<font face=\"Arial\" size=\"-2\">" . _("FETCHMAIL SCRIPTS") . "</font></a>\n</div>\n</td></tr></table>\n{$browse_files_button}</font></b>";
function listTypePopup()
{
    global $admlist_type;
    global $cur_admlist_type;
    global $panel_type;
Пример #2
0
function cronMailSystem()
{
    global $keep_mail_generate_flag;
    global $conf_mta_type;
    global $conf_dtc_system_username;
    global $conf_generated_file_path;
    global $conf_unix_type;
    $cronjob_table_content = getCronFlags();
    if ($cronjob_table_content["gen_qmail"] == "yes") {
        echo "Generating mail accounts\n";
        mail_account_generate();
        if ($keep_mail_generate_flag == "no") {
            markCronflagOk("gen_qmail='no'");
        }
        if (file_exists($conf_generated_file_path . "/postfix_virtual_mailbox_domains")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_virtual_mailbox_domains");
        }
        if (file_exists($conf_generated_file_path . "/local_domains")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/local_domains");
        }
        if (file_exists($conf_generated_file_path . "/postfix_virtual")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_virtual");
        }
        if (file_exists($conf_generated_file_path . "/postfix_aliases")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_aliases");
        }
        if (file_exists($conf_generated_file_path . "/postfix_vmailbox")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_vmailbox");
        }
        if (file_exists($conf_generated_file_path . "/postfix_virtual_uid_mapping")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_virtual_uid_mapping");
        }
        if (file_exists($conf_generated_file_path . "/postfix_relay_domains")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_relay_domains");
        }
        if (file_exists($conf_generated_file_path . "/postfix_relay_recipients")) {
            system("chown {$conf_dtc_system_username} {$conf_generated_file_path}/postfix_relay_recipients");
        }
    }
    /* Didnt want it to put to seperate function, because I think its fit well in mail system's cronjob */
    if ($cronjob_table_content["gen_fetchmail"] == "yes") {
        echo "Generating fetchmailrc";
        fetchmail_generate();
    }
    if ($cronjob_table_content["qmail_newu"] == "yes") {
        echo "Starting qmail-newu\n";
        switch ($conf_mta_type) {
            case "qmail":
                //system("/var/qmail/bin/qmail-newu");
                system("{$conf_qmail_newu_path}");
                break;
            case "postfix":
                //not sure what newu equiv in postfix
                break;
        }
        markCronflagOk("qmail_newu='no'");
    }
    if ($cronjob_table_content["restart_qmail"] == "yes") {
        switch ($conf_mta_type) {
            case "postfix":
                echo "Reloading postfix\n";
                if (file_exists("/etc/init.d/postfix")) {
                    $PATH_POSTFIX_SCRIPT = "/etc/init.d/postfix";
                } else {
                    if (file_exists("/usr/local/etc/rc.d/postfix")) {
                        $PATH_POSTFIX_SCRIPT = "/usr/local/etc/rc.d/postfix";
                    } else {
                        if (file_exists("/etc/rc.d/rc.postfix")) {
                            $PATH_POSTFIX_SCRIPT = "/etc/rc.d/rc.postfix";
                        }
                    }
                }
                if ($conf_unix_type == "gentoo" && file_exists("/etc/init.d/postfix")) {
                    $PATH_POSTFIX_SCRIPT = "/usr/sbin/postfix";
                }
                if ($conf_unix_type == "bsd" && file_exists("/usr/local/etc/rc.d/postfix")) {
                    $PATH_POSTFIX_SCRIPT = "/usr/local/sbin/postfix";
                }
                system("{$PATH_POSTFIX_SCRIPT} reload");
                $PATH_POSTSUPER = "/usr/sbin/postsuper";
                if (file_exists("/usr/sbin/postsuper")) {
                    $PATH_POSTSUPER = "/usr/sbin/postsuper";
                } else {
                    if (file_exists("/usr/local/sbin/postsuper")) {
                        $PATH_POSTSUPER = "/usr/local/sbin/postsuper";
                    } else {
                        if (file_exists("/usr/bin/postsuper")) {
                            $PATH_POSTSUPER = "/usr/bin/postsuper";
                        }
                    }
                }
                // first stop queue processing in postfix
                echo "Stopping postfix queue...\n";
                system("{$PATH_POSTSUPER} -h ALL 2>&1");
                echo "Reloading amavis\n";
                if (file_exists("/etc/init.d/amavis")) {
                    system("/etc/init.d/amavis force-reload");
                } else {
                    if (file_exists("/etc/init.d/amavisd")) {
                        // Seems a restart is best (gentoo needs it)
                        system("/etc/init.d/amavisd restart");
                        // This one seems ok for slackware
                    } else {
                        if (file_exists("/etc/rc.d/rc.amavisd")) {
                            system("/etc/rc.d/rc.amavisd restart");
                            // This is for FreeBSD
                        } else {
                            if (file_exists("/usr/local/etc/rc.d/amavisd")) {
                                system("/usr/local/etc/rc.d/amavisd restart");
                            }
                        }
                    }
                }
                if (file_exists("/etc/init.d/dkimproxy")) {
                    echo "Reloading dkfilter to reload it's domains...\n";
                    system("/etc/init.d/dkimproxy stop");
                    sleep(1);
                    system("/etc/init.d/dkimproxy start");
                }
                echo "Starting postfix queue...\n";
                system("{$PATH_POSTSUPER} -H ALL 2>&1");
                echo "Flushing the queue now, to make sure we have some mail delivery happening after amavisd restart...\n";
                system("{$PATH_POSTFIX_SCRIPT} flush");
                break;
            case "qmail":
            default:
                echo "Sending qmail-send a HUP\n";
                // This runs well on stock debian woody qmail-src package. Anyone had trouble with it ?
                system("killall -HUP qmail-send");
                break;
        }
        if ($keep_mail_generate_flag == "no") {
            markCronflagOk("restart_qmail='no'");
        }
    }
}