"; 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|updatednsbl)/", $result_cron)) { pfbupdate_status(gettext("Force {$type} Terminated - Failed due to Active Running Task. Click 'View' for running process")); header('Location: /pfblockerng/pfblockerng_update.php'); 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'); ?>

$line) { if ($key == 0) { $cron_hour_begin = $line; } if (($line * 3600) + ($pfb['min'] * 60) > $currentdaysec) { $cron_hour_next = $line; break; } } } // Roll over to the first cron hour setting if (empty($cron_hour_next)) { $cron_hour_next = $cron_hour_begin; } } $cron_seconds_next = ($cron_hour_next * 3600) + ($pfb['min'] * 60); if ($currentdaysec < $cron_seconds_next) { // The next cron job is ahead of us in the day $sec_remain = $cron_seconds_next - $currentdaysec; } else { // The next cron job is tomorrow $sec_remain = (24*60*60) + $cron_seconds_next - $currentdaysec; } // Ensure hour:min:sec variables are two digit $pfb['min'] = str_pad($pfb['min'], 2, '0', STR_PAD_LEFT); $sec_final = str_pad(($sec_remain % 60), 2, '0', STR_PAD_LEFT); $min_remain = str_pad(floor($sec_remain / 60), 2, '0', STR_PAD_LEFT); $min_final = str_pad(($min_remain % 60), 2, '0', STR_PAD_LEFT); $hour_final = str_pad(floor($min_remain / 60), 2, '0', STR_PAD_LEFT); $cron_hour_next = str_pad($cron_hour_next, 2, '0', STR_PAD_LEFT); $cronreal = "{$cron_hour_next}:{$pfb['min']}"; $nextcron = "{$hour_final}:{$min_final}:{$sec_final}"; } if (empty($pfb['enable']) || empty($cron_hour_next)) { $cronreal = ' [ Disabled ]'; $nextcron = '--'; } echo "NEXT Scheduled CRON Event will run at  {$cronreal}  with  {$nextcron}  time remaining."; // Query for any active pfBlockerNG CRON jobs exec('/bin/ps -wax', $result_cron); if (preg_grep("/pfblockerng[.]php\s+?(cron|update|updatednsbl)/", $result_cron)) { echo "   Active pfBlockerNG CRON Job  "; echo ""; } echo "
Refresh to update current Status and time remaining"; ?>
"); ?>
" . gettext("** AVOID ** ") . " " . "" . gettext("Running these Options - when CRON is expected to RUN!") . gettext("

") . "" . gettext("Force Update") . "" . gettext(" will download any new Alias/Lists.") . gettext("
") . "" . gettext("Force Cron") . "" . gettext(" will download any Alias/Lists that are within the Frequency Setting (due for Update).") . gettext("
") . "" . gettext("Force Reload") . "" . gettext(" will reload all Lists using the existing Downloaded files.") . gettext(" This is useful when Lists are out of 'sync' or Reputation changes were made.") ;?>
" /> " /> " />  />
"); ?>
"/> "/> " . gettext(' pfBlockerNG ') . "" . gettext(" Log.   (Select 'End View' to terminate the viewer.)"); ?>