"; echo "\n//"; echo "\n"; /* ensure that contents are written out */ ob_flush(); } // Post status message to terminal window. function pfbupdate_status($status) { $status = str_replace("\n", "\\n", $status); echo "\n"; /* ensure that contents are written out */ ob_flush(); } // Function to perform a Force Update, Cron or Reload function pfb_cron_update($type) { global $pfb; // Query for any active pfBlockerNG CRON jobs exec('/bin/ps -wx', $result_cron); if (preg_grep("/pfblockerng[.]php\s+?(cron|update)/", $result_cron)) { pfbupdate_status(gettext("Force {$type} Terminated - Failed due to Active Running Task. Click 'View' for running process")); exit; } if (!file_exists("{$pfb['log']}")) { touch("{$pfb['log']}"); } // Update status window with correct task if ($type == 'update') { pfbupdate_status(gettext('Running Force Update Task')); } elseif ($type == 'reload') { $reload_type = htmlspecialchars($_POST['rmode']); pfbupdate_status(gettext("Running Force Reload Task - {$reload_type}")); switch ($reload_type) { case 'IP': $type = 'updateip'; break; case 'DNSBL': $type = 'updatednsbl'; rmdir_recursive("{$pfb['dnsdir']}"); break; case 'All': default: $type = 'update'; rmdir_recursive("{$pfb['dnsdir']}"); } } else { pfbupdate_status(gettext('Running Force CRON Task')); } // Remove any existing pfBlockerNG CRON Jobs install_cron_job('pfblockerng.php cron', false); // Execute PHP process in the background mwexec_bg("/usr/local/bin/php /usr/local/www/pfblockerng/pfblockerng.php {$type} >> {$pfb['log']} 2>&1"); // Execute Live Tail function pfb_livetail($pfb['log'], 'force'); } $pgtitle = gettext('pfBlockerNG: Update'); include_once('head.inc'); include_once('fbegin.inc'); ?>