exit; } if (isset($_GET["rules-list"])) { echo rules_list(); exit; } if (isset($_GET["rule-form"])) { echo rule_form(); exit; } if (isset($_GET["EnablePOSTFWD2"])) { EnablePOSTFWD2(); exit; } if (isset($_GET["reconfigure"])) { reconfigure(); exit; } if (isset($_GET["postfwd2-action"])) { echo postfwd2_action_form(); exit; } if (isset($_GET["postfwd2-mod-action"])) { echo postfwd2_action_edit(); exit; } if (isset($_GET["postfwd2-item"])) { echo postfwd2_item_form(); exit; } if (isset($_GET["postfwd2-add-item"])) {
$tpl=new templates(); echo "alert('".$tpl->javascript_parse_text('{ERROR_NO_PRIVS}')."');"; die(); } if(isset($_GET["tabs"])){echo tabs();exit;} if(isset($_GET["status"])){echo status();exit;} if(isset($_GET["service-status"])){echo status_service();exit;} if(isset($_GET["rules"])){echo rules();exit;} if(isset($_GET["DeleteRuleMaster"])){DeleteRuleMaster();exit;} if(isset($_GET["rules-list"])){echo rules_list();exit;} if(isset($_GET["rule-form"])){echo rule_form();exit;} if(isset($_GET["EnablePOSTFWD2"])){EnablePOSTFWD2();exit;} if(isset($_GET["reconfigure"])){reconfigure();exit;} if(isset($_GET["postfwd2-action"])){echo postfwd2_action_form();exit;} if(isset($_GET["postfwd2-mod-action"])){echo postfwd2_action_edit();exit;} if(isset($_GET["postfwd2-item"])){echo postfwd2_item_form();exit;} if(isset($_GET["postfwd2-add-item"])){echo postfwd2_item_save();exit;} if(isset($_GET["postfwd2-delete-item"])){postfwd2_item_delete();exit;} if(isset($_GET["postfwd2-item-list"])){echo postfwd2_item_list();exit;} if(isset($_GET["item-form-selected"])){echo postfwd2_item_form_selected();exit;} if(isset($_GET["postfwd2Down"])){echo postfwd2Down();exit;} if(isset($_GET["postfwd2Up"])){echo postfwd2Up();exit;} if(isset($_GET["rbl-list"])){rbl_list();exit;} js();
function build(){ reconfigure(); }
function restart() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); stop_all(true); reconfigure(true); sleep(1); start_all(true); }
function run() { $sock = new sockets(); $unix = new unix(); $logrotate = $unix->find_program("logrotate"); if (!is_file($logrotate)) { return; } $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $timefile = "/etc/artica-postfix/pids/logrotate." . __FUNCTION__ . ".time"; $pid = @file_get_contents("{$pidfile}"); if ($unix->process_exists($pid, basename(__FILE__))) { system_admin_events("Already executed PID {$pid}", __FUNCTION__, __FILE__, __LINE__, "logrotate"); die; } @file_put_contents($pidfile, getmypid()); $time = $unix->file_time_min($timefile); if ($time < 60) { events("No less than 1h or delete {$timefile} file", __FUNCTION__, __FILE__, __LINE__, "logrotate"); die; } @unlink($timefile); @file_put_contents($timefile, time()); reconfigure(); $cmd = $unix->EXEC_NICE() . $logrotate . " -s /var/log/logrotate.state /etc/logrotate.conf 2>&1"; events("Executing: {$cmd}"); rotate_events("Last scan {$time}mn, Executing: {$cmd}", __FUNCTION__, __FILE__, __LINE__, "logrotate"); $t = time(); exec($cmd, $results); $took = $unix->distanceOfTimeInWords($t, time(), true); system_admin_events("Success took: {$took}\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "logrotate"); events("Success took: {$took}\n" . @implode("<br>", $results)); rotate_events("Success took: {$took}\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "logrotate"); }
function build() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $timepid = $unix->PROCCESS_TIME_MIN($pid); writelogs(basename(__FILE__) . ":Already executed PID: {$pid} since {$timepid}Mn {$argv[1]}.. aborting the process", basename(__FILE__), __FILE__, __LINE__); die; } @file_put_contents($pidfile, getmypid()); reconfigure(); }