SEND_PROGRESS($start, $func, "Error {$func} no such function..."); continue; } try { SEND_PROGRESS($start, "Action 2, {$start}% Please wait, executing {$func}() {$i}/{$tot}.."); call_user_func($func); } catch (Exception $e) { SEND_PROGRESS($start, $func, "Error on {$func} ({$e})"); } } $reste = 100 - $start; $reste++; SEND_PROGRESS($reste, "mydestination"); $hashT = new main_hash_table(); $hashT->mydestination(); SEND_PROGRESS(100, "Reload postfix"); shell_exec("{$GLOBALS["postfix"]} reload >/dev/null 2>&1"); function build_progress_smtp_generic_maps($text, $pourc) { $GLOBALS["CACHEFILE"] = "/usr/share/artica-postfix/ressources/logs/web/smtp_generic_maps"; echo "{$pourc}% {$text}\n"; $cachefile = $GLOBALS["CACHEFILE"]; $array["POURC"] = $pourc; $array["TEXT"] = $text; @file_put_contents($cachefile, serialize($array)); @chmod($cachefile, 0755); } function build_progress_sender_routing($text, $pourc) { $GLOBALS["CACHEFILE"] = "/usr/share/artica-postfix/ressources/logs/web/build_progress_sender_routing"; echo "{$pourc}% {$text}\n";
function _DefaultSettings() { if ($GLOBALS["EnablePostfixMultiInstance"] == 1) { shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.postfix-multi.php --from-main-null"); return; } shell_exec("{$GLOBALS["postconf"]} -e 'debug_peer_level = 2' >/dev/null 2>&1"); $start = 5; $functions = array("CleanUpMainCf", "debug_peer_list", "cleanMultiplesInstances", "SetTLS", "inet_interfaces", "imap_sockets", "MailBoxTransport", "mynetworks", "headers_check", "mime_header_checks", "smtpd_recipient_restrictions", "smtpd_client_restrictions_clean", "smtpd_client_restrictions", "smtpd_sasl_exceptions_networks", "sender_bcc_maps", "CleanMyHostname", "OthersValues", "luser_relay", "smtpd_sender_restrictions", "smtpd_end_of_data_restrictions", "perso_settings", "remove_virtual_mailbox_base", "postscreen", "smtp_sasl_security_options", "smtp_sasl_auth_enable", "SetSALS", "BodyChecks", "postfix_templates", "haproxy_compliance", "smtpd_milters", "MasterCFBuilder", "ReloadPostfix"); $tot = count($functions); $i = 0; while (list($num, $func) = each($functions)) { $i++; $start++; if (!function_exists($func)) { SEND_PROGRESS($start, $func, "Error {$func} no such function..."); continue; } try { SEND_PROGRESS($start, "Action 1, {$start}% Please wait, executing {$func}() {$i}/{$tot}.."); call_user_func($func); } catch (Exception $e) { SEND_PROGRESS($start, $func, "Error on {$func} ({$e})"); } } if ($GLOBALS["URGENCY"]) { $unix = new unix(); $php5 = $unix->LOCATE_PHP5_BIN(); $nohup = $unix->find_program("nohup"); shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.postfix.hashtables.php >/dev/null 2>&1 &"); } else { HashTables($start); } }