本文整理汇总了PHP中unlink_if_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP unlink_if_exists函数的具体用法?PHP unlink_if_exists怎么用?PHP unlink_if_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unlink_if_exists函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fetch_blacklist
function fetch_blacklist()
{
global $config, $g;
$url = $config['installedpackages']['dansguardianblacklist']['config'][0]['url'];
if (is_url($url)) {
conf_mount_rw();
print "file download start..";
unlink_if_exists("/usr/local/etc/dansguardian/lists/blacklist.tgz");
exec("/usr/bin/fetch -o /usr/local/etc/dansguardian/lists/blacklist.tgz " . escapeshellarg($url));
chdir("/usr/local/etc/dansguardian/lists");
if (is_dir("blacklists.old")) {
exec('rm -rf /usr/local/etc/dansguardian/lists/blacklists.old');
}
rename("blacklists", "blacklists.old");
exec('/usr/bin/tar -xvzf /usr/local/etc/dansguardian/lists/blacklist.tgz 2>&1', $output, $return);
if (preg_match("/x\\W+(\\w+)/", $output[0], $matches)) {
if ($matches[1] != "blacklists") {
rename("./" . $matches[1], "blacklists");
}
read_lists();
} else {
file_notice("Dansguardian - Could not determine Blacklist extract dir. Categories not updated", "");
}
} else {
file_notice("Dansguardian - Blacklist url is invalid.", "");
}
}
开发者ID:nagyrobi,项目名称:pfsense-packages,代码行数:27,代码来源:dansguardian.php
示例2: fetch_blacklist
function fetch_blacklist($log_notice = true, $install_process = false)
{
global $config, $g;
if (is_array($config['installedpackages']['dansguardianblacklist']) && is_array($config['installedpackages']['dansguardianblacklist']['config'])) {
$url = $config['installedpackages']['dansguardianblacklist']['config'][0]['url'];
$uw = "Found a previouns install, checking Blacklist config...";
} else {
$uw = "Found a clean install, reading default access lists...";
}
conf_mount_rw();
if ($install_process == true) {
update_output_window($uw);
}
if (isset($url) && is_url($url)) {
if ($log_notice == true) {
print "file download start..";
unlink_if_exists("/usr/local/pkg/blacklist.tgz");
exec("/usr/bin/fetch -o /usr/local/pkg/blacklist.tgz " . escapeshellarg($url), $output, $return);
} else {
#install process
if (file_exists("/usr/local/pkg/blacklist.tgz")) {
update_output_window("Found previous blacklist database, skipping download...");
$return = 0;
} else {
update_output_window("Fetching blacklist");
download_file_with_progress_bar($url, "/usr/local/pkg/blacklist.tgz");
if (file_exists("/usr/local/pkg/blacklist.tgz")) {
$return = 0;
}
}
}
if ($return == 0) {
chdir(DANSGUARDIAN_DIR . "/etc/dansguardian/lists");
if (is_dir("blacklists.old")) {
exec('rm -rf ' . DANSGUARDIAN_DIR . '/etc/dansguardian/lists/blacklists.old');
}
rename("blacklists", "blacklists.old");
exec('/usr/bin/tar -xvzf /usr/local/pkg/blacklist.tgz 2>&1', $output, $return);
if (preg_match("/x\\W+(\\w+)/", $output[1], $matches)) {
if ($matches[1] != "blacklists") {
rename("./" . $matches[1], "blacklists");
}
read_lists($log_notice);
} else {
file_notice("Dansguardian - Could not determine Blacklist extract dir. Categories not updated", "");
}
} else {
file_notice("Dansguardian - Could not fetch blacklists from url", "");
}
} else {
if ($install_process == true) {
read_lists(false, $uw);
} elseif (!empty($url)) {
file_notice("Dansguardian - Blacklist url is invalid.", "");
}
}
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:57,代码来源:dansguardian.php
示例3: crypt_data
function crypt_data($val, $pass, $opt)
{
$file = tempnam("/tmp", "php-encrypt");
file_put_contents("{$file}.dec", $val);
exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in {$file}.dec -out {$file}.enc -k " . escapeshellarg($pass));
if (file_exists("{$file}.enc")) {
$result = file_get_contents("{$file}.enc");
} else {
$result = "";
log_error("Failed to encrypt/decrypt data!");
}
unlink_if_exists($file);
unlink_if_exists("{$file}.dec");
unlink_if_exists("{$file}.enc");
return $result;
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:16,代码来源:crypt_acb.php
示例4: htmlspecialchars
$domain = htmlspecialchars($_POST['domain']);
$domainparse = str_replace('.', '\\.', $domain);
$pfb['dsupp'] =& $config['installedpackages']['pfblockerngdnsblsettings']['config'][0]['suppression'];
// Collect existing suppression list
$dnssupp_ex = collectsuppression();
// Query for domain in Unbound DNSBL file.
$dnsbl_query = exec("/usr/bin/grep -Hm1 ' \"{$domain} 60 IN A' {$pfb['dnsbl_file']}.conf");
// Save new suppress domain to suppress list.
if (empty($dnsbl_query)) {
$savemsg = gettext("Domain: [ {$domain} ] does not exist in the Unbound Resolver DNSBL");
exec("/usr/local/sbin/unbound-control -c {$pfb['dnsbldir']}/unbound.conf flush {$domain}.");
} else {
// Remove domain from Unbound resolver pfb_dnsbl.conf file
exec("{$pfb['sed']} -i '' '/ \"{$domain} 60 IN A/d' {$pfb['dnsbl_file']}.conf");
$cache_dumpfile = '/var/tmp/unbound_cache';
unlink_if_exists("{$cache_dumpfile}");
$chroot_cmd = "chroot -u unbound -g unbound / /usr/local/sbin/unbound-control -c {$g['unbound_chroot_path']}/unbound.conf";
exec("{$chroot_cmd} dump_cache > {$cache_dumpfile}");
exec("{$chroot_cmd} reload");
if (file_exists($cache_dumpfile) && filesize($cache_dumpfile) > 0) {
exec("{$chroot_cmd} load_cache < {$cache_dumpfile}");
}
exec("/usr/local/sbin/unbound-control -c {$pfb['dnsbldir']}/unbound.conf flush {$domain}");
if (!in_array($domain, $dnssupp_ex)) {
$dnssupp_ex[] = $domain;
$dnssupp_new = base64_encode(implode("\n", $dnssupp_ex));
$pfb['dsupp'] = "{$dnssupp_new}";
write_config("pfBlockerNG: Added {$domain} to DNSBL suppress list");
}
$savemsg = gettext("Removed Domain: [ {$domain} ] from Unbound Resolver DNSBL. You may need to flush your browsers DNS Cache");
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:pfblockerng_alerts.php
示例5: begin_install
function begin_install()
{
global $g, $savemsg;
if (file_exists("/tmp/install_complete")) {
return;
}
unlink_if_exists("/tmp/install_complete");
update_installer_status_win(sprintf(gettext("Beginning installation on disk %s."), $disk));
start_installation();
}
开发者ID:mtisza,项目名称:pfsense,代码行数:10,代码来源:installer.php
示例6: unlink_if_exists
// Delete any leftover suricata PID files in /var/run
unlink_if_exists("{$g['varrun_path']}/suricata_*.pid");
}
// Hard kill any running Barnyard2 processes
if (is_process_running("barnyard")) {
killbyname("barnyard2");
sleep(2);
// Delete any leftover barnyard2 PID files in /var/run
unlink_if_exists("{$g['varrun_path']}/barnyard2_*.pid");
}
// Set flag for post-install in progress
$g['suricata_postinstall'] = true;
// Mount file system read/write so we can modify some files
conf_mount_rw();
// Remove any previously installed script since we rebuild it
unlink_if_exists("{$rcdir}suricata.sh");
// Create the top-tier log directory
safe_mkdir(SURICATALOGDIR);
// Create the IP Rep and SID Mods lists directory
safe_mkdir(SURICATA_SID_MODS_PATH);
safe_mkdir(SURICATA_IPREP_PATH);
// Make sure config variable is an array
if (!is_array($config['installedpackages']['suricata']['config'][0])) {
$config['installedpackages']['suricata']['config'][0] = array();
}
// Download the latest GeoIP DB updates and create cron task if the feature is not disabled
if ($config['installedpackages']['suricata']['config'][0]['autogeoipupdate'] != 'off') {
log_error(gettext("[Suricata] Installing free GeoIP country database files..."));
include "/usr/local/pkg/suricata/suricata_geoipupdate.php";
install_cron_job("/usr/bin/nice -n20 /usr/local/bin/php -f /usr/local/pkg/suricata/suricata_geoipupdate.php", TRUE, 0, 0, 8, "*", "*", "root");
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_post_install.php
示例7: defCmdT
defCmdT("last 1000 NTP log entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
defCmdT("last 1000 OpenVPN log entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
defCmdT("last 1000 Captive Portal auth log entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
defCmdT("last 1000 PPP log entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
defCmdT("last 1000 relayd log entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
defCmdT("last 1000 resolver log entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
defCmdT("last 1000 routing log entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
defCmdT("last 1000 wireless log entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
if (file_exists("/tmp/PHP_errors.log")) {
defCmdT("PHP Error Log", "/bin/cat /tmp/PHP_errors.log");
}
defCmdT("System Message Buffer", "/sbin/dmesg -a");
defCmdT("System Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
defCmdT("sysctl values", "/sbin/sysctl -a");
defCmdT("Kernel Environment", "/bin/kenv");
defCmdT("Installed OS Packages", "/usr/sbin/pkg info");
exec("/bin/date", $dateOutput, $dateStatus);
$currentDate = $dateOutput[0];
$pgtitle = array("{$g['product_name']}", "Status");
include "head.inc";
print_info_box(gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting " . "information from this page in public places (like mailing lists).") . '<br />' . gettext("Common password fields in config.xml have been automatically redacted.") . '<br />' . gettext("When the page has finished loading, the output will be stored in {$output_file}. It may be downloaded via scp or ") . "<a href=\"/exec.php?dlPath={$output_file}\">" . gettext("Diagnostics > Command Prompt.") . '</a>');
listCmds();
execCmds();
print gettext("Saving output to archive...");
if (is_dir($output_path)) {
mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
unlink_if_exists("{$output_path}/*");
@rmdir($output_path);
}
print gettext("Done.");
include "foot.inc";
开发者ID:NextMagic,项目名称:pfsense,代码行数:31,代码来源:status.php
示例8: sprintf
$input_errors[] = $vertical_bar_err_text;
}
} else {
$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
}
}
} else {
if ($_POST['type'] == "url" || $_POST['type'] == "url_ports") {
$desc_fmt_err_found = false;
/* item is a url type */
for ($x = 0; $x < $max_alias_addresses - 1; $x++) {
$_POST['address' . $x] = trim($_POST['address' . $x]);
if ($_POST['address' . $x]) {
/* fetch down and add in */
$temp_filename = tempnam("{$g['tmp_path']}/", "alias_import");
unlink_if_exists($temp_filename);
$verify_ssl = isset($config['system']['checkaliasesurlcert']);
mkdir($temp_filename);
download_file($_POST['address' . $x], $temp_filename . "/aliases", $verify_ssl);
/* if the item is tar gzipped then extract */
if (stristr($_POST['address' . $x], ".tgz")) {
process_alias_tgz($temp_filename);
} else {
if (stristr($_POST['address' . $x], ".zip")) {
process_alias_unzip($temp_filename);
}
}
if (!isset($alias['aliasurl'])) {
$alias['aliasurl'] = array();
}
$alias['aliasurl'][] = $_POST['address' . $x];
开发者ID:jefersonJim,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases_edit.php
示例9: write_config
exit;
}
if ($_POST['apply']) {
write_config();
$retval = 0;
/* Setup pf rules since the user may have changed the optimization value */
$retval = filter_configure();
$savemsg = get_std_save_message($retval);
if (stristr($retval, "error") != true) {
$savemsg = get_std_save_message($retval);
} else {
$savemsg = $retval;
}
/* reset rrd queues */
unlink_if_exists("/var/db/rrd/*queuedrops.rrd");
unlink_if_exists("/var/db/rrd/*queues.rrd");
enable_rrd_graphing();
clear_subsystem_dirty('shaper');
}
$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Wizards"));
$shortcut_section = "trafficshaper";
$wizards = array(gettext("Multiple Lan/Wan") => "traffic_shaper_wizard_multi_all.xml", gettext("Dedicated Links") => "traffic_shaper_wizard_dedicated.xml");
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
$tab_array = array();
$tab_array[] = array(gettext("By Interface"), false, "firewall_shaper.php");
$tab_array[] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
$tab_array[] = array(gettext("Limiter"), false, "firewall_shaper_vinterface.php");
$tab_array[] = array(gettext("Wizards"), true, "firewall_shaper_wizards.php");
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:firewall_shaper_wizards.php
示例10: update_status
@copy("{$tmpfname}/{$emergingthreats_filename_md5}", "{$suricatadir}{$emergingthreats_filename_md5}");
}
if ($pkg_interface != "console") {
update_status(gettext("Extraction of {$et_name} rules completed..."));
update_output_window(gettext("Installation of {$et_name} rules completed..."));
}
error_log(gettext("\tInstallation of {$et_name} rules completed.\n"), 3, SURICATA_RULES_UPD_LOGFILE);
rmdir_recursive("{$tmpfname}/emerging");
}
}
/* Untar Snort rules file to tmp */
if ($snortdownload == 'on') {
if (file_exists("{$tmpfname}/{$snort_filename}")) {
/* Remove the old Snort rules files */
$vrt_prefix = VRT_FILE_PREFIX;
unlink_if_exists("{$suricatadir}rules/{$vrt_prefix}*.rules");
if ($pkg_interface != "console") {
update_status(gettext("Extracting Snort VRT rules..."));
update_output_window(gettext("Installing Sourcefire VRT rules..."));
}
error_log(gettext("\tExtracting and installing Snort VRT rules...\n"), 3, SURICATA_RULES_UPD_LOGFILE);
/* extract snort.org rules and add prefix to all snort.org files */
safe_mkdir("{$tmpfname}/snortrules");
exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$tmpfname}/snortrules rules/");
$files = glob("{$tmpfname}/snortrules/rules/*.rules");
foreach ($files as $file) {
$newfile = basename($file);
@copy($file, "{$suricatadir}rules/" . VRT_FILE_PREFIX . "{$newfile}");
}
/* IP lists */
$files = glob("{$tmpfname}/snortrules/rules/*.txt");
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_check_for_rule_updates.php
示例11: elseif
}
} elseif ($openappid_detectors == 'on') {
/**************************************************************************************/
/* Only updated OpenAppID detectors, so do not need to rebuild all interface rules. */
/* Restart snort if running, and not in post-install, so as to pick up the detectors. */
/**************************************************************************************/
if (!$g['snort_postinstall'] && is_service_running("snort") && count($config['installedpackages']['snortglobal']['rule']) > 0) {
if ($pkg_interface != "console") {
update_status(gettext('Restarting Snort to activate the new OpenAppID detectors...'));
update_output_window(gettext("Please wait ... restarting Snort will take some time..."));
}
error_log(gettext("\tRestarting Snort to activate the new OpenAppID detectors...\n"), 3, SNORT_RULES_UPD_LOGFILE);
touch("{$g['varrun_path']}/snort_pkg_starting.lck");
snort_restart_all_interfaces(TRUE);
sleep(2);
unlink_if_exists("{$g['varrun_path']}/snort_pkg_starting.lck");
if ($pkg_interface != "console") {
update_output_window(gettext("Snort has restarted with your new set of OpenAppID detectors..."));
}
log_error(gettext("[Snort] Snort has restarted with your new set of OpenAppID detectors..."));
error_log(gettext("\tSnort has restarted with your new set of OpenAppID detectors.\n"), 3, SNORT_RULES_UPD_LOGFILE);
} else {
if ($pkg_interface != "console") {
update_output_window(gettext("The rules update task is complete..."));
}
}
}
/* remove $tmpfname files */
if (is_dir("{$tmpfname}")) {
rmdir_recursive($tmpfname);
}
开发者ID:schinken,项目名称:pfsense-packages,代码行数:31,代码来源:snort_check_for_rule_updates.php
示例12: thebrig_populate
if (!$input_errors) {
// We have specified a new location for thebrig's installation, and it's valid, and we don't already have
// a jail at the old location. Call thebrig_populate, which will move all the web stuff and create the
// directory tree
// Also add startup command when thebrig completly installed
thebrig_populate($pconfig['rootfolder'], $config['thebrig']['rootfolder']);
$config['thebrig']['rootfolder'] = $pconfig['rootfolder'];
// Store the newly specified folder in the XML config
$config['thebrig']['template'] = $pconfig['template'];
$config['thebrig']['basejail']['folder'] = $pconfig['basejail'];
$langfile = file("ext/thebrig/lang.inc");
$version_1 = preg_split("/VERSION_NBR, 'v/", $langfile[1]);
$config['thebrig']['version'] = 0 + substr($version_1[1], 0, 3);
write_config();
// Write the config to disk
unlink_if_exists("/tmp/thebrig.tmp");
// Whatever we did, we did it successfully
$retval = 0;
$savemsg = get_std_save_message($retval);
}
// end of no input errors
}
// end of POST
// Display the page title, based on the constants defined in lang.inc
$pgtitle = array(_THEBRIG_EXTN, _THEBRIG_TITLE, _THEBRIG_BASIC_CONFIG, _THEBRIG_VERSION_NBR);
// Uses the global fbegin include
include "fbegin.inc";
// This will evaluate if there were any input errors from prior to the user clicking "save"
if ($input_errors) {
print_input_errors($input_errors);
} elseif ($savemsg) {
开发者ID:kinged007,项目名称:thebrig,代码行数:31,代码来源:extensions_thebrig_config.php
示例13: move_uploaded_file
}
}
return FALSE;
}
if (isset($_POST['upload'])) {
if ($_FILES["iprep_fileup"]["error"] == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["iprep_fileup"]["tmp_name"];
$name = $_FILES["iprep_fileup"]["name"];
move_uploaded_file($tmp_name, "{$iprep_path}{$name}");
} else {
$input_errors[] = gettext("Failed to upload file {$_FILES["iprep_fileup"]["name"]}");
}
}
if (isset($_POST['iplist_delete']) && isset($_POST['iplist_fname'])) {
if (!snort_is_iplist_active($_POST['iplist_fname'])) {
unlink_if_exists("{$iprep_path}{$_POST['iplist_fname']}");
} else {
$input_errors[] = gettext("This IP List is currently assigned as a Whitelist or Blackist for an interface and cannot be deleted.");
}
}
if (isset($_POST['iplist_edit']) && isset($_POST['iplist_fname'])) {
$file = $iprep_path . basename($_POST['iplist_fname']);
$data = file_get_contents($file);
if ($data !== FALSE) {
$iplist_data = htmlspecialchars($data);
$iplist_edit_style = "display: table-row-group;";
$iplist_name = basename($_POST['iplist_fname']);
unset($data);
} else {
$input_errors[] = gettext("An error occurred reading the file.");
}
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:31,代码来源:snort_ip_list_mgmt.php
示例14: unset
$a_nat[$id]['ips_policy_enable'] = 'off';
unset($a_nat[$id]['ips_policy']);
}
$enabled_items = "";
if (is_array($_POST['toenable'])) {
$enabled_items = implode("||", $_POST['toenable']);
} else {
$enabled_items = $_POST['toenable'];
}
$a_nat[$id]['rulesets'] = $enabled_items;
if ($_POST['autoflowbits'] == "on") {
$a_nat[$id]['autoflowbitrules'] = 'on';
} else {
$a_nat[$id]['autoflowbitrules'] = 'off';
if (file_exists("{$snortdir}/snort_{$snort_uuid}_{$if_real}/rules/{$flowbit_rules_file}")) {
unlink_if_exists("{$snortdir}/snort_{$snort_uuid}_{$if_real}/rules/{$flowbit_rules_file}");
}
}
write_config("Snort pkg: save enabled rule categories for {$a_nat[$id]['interface']}.");
/*************************************************/
/* Update the snort conf file and rebuild the */
/* rules for this interface. */
/*************************************************/
$rebuild_rules = true;
conf_mount_rw();
snort_generate_conf($a_nat[$id]);
conf_mount_ro();
$rebuild_rules = false;
/* Soft-restart Snort to live-load new rules */
snort_reload_config($a_nat[$id]);
$pconfig = $_POST;
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:snort_rulesets.php
示例15: date
require_once "/etc/inc/filter.inc";
require_once "/etc/inc/config.inc";
$hour = date('H');
$pfbdir = '/usr/local/pkg/pfblocker';
$updates = 0;
$cron = array('01hour' => 1, '04hours' => 4, '12hours' => 12, 'EveryDay' => 23);
if ($config['installedpackages']['pfblockerlists']['config'] != "") {
foreach ($config['installedpackages']['pfblockerlists']['config'] as $list) {
if (is_array($list['row'])) {
foreach ($list['row'] as $row) {
if ($row['url'] != "" && $hour > 0) {
$md5_url = md5($row['url']);
$update_hour = array_key_exists($list['cron'], $cron) ? $cron[$list['cron']] : 25;
if ($row['url'] && $hour % $update_hour == 0) {
print $update_hour . " " . $pfbdir . '/' . $md5_url . '.txt' . "\n";
unlink_if_exists($pfbdir . '/' . $md5_url . '.txt');
$updates++;
}
}
}
}
}
}
if ($updates > 0) {
include "/usr/local/pkg/pfblocker.inc";
sync_package_pfblocker("cron");
}
}
function pfblocker_get_countries()
{
$files = array("Africa" => "/usr/local/pkg/Africa_cidr.txt", "Asia" => "/usr/local/pkg/Asia_cidr.txt", "Europe" => "/usr/local/pkg/Europe_cidr.txt", "North America" => "/usr/local/pkg/North_America_cidr.txt", "Oceania" => "/usr/local/pkg/Oceania_cidr.txt", "South America" => "/usr/local/pkg/South_America_cidr.txt");
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:pfblocker.php
示例16: find_alias_reference
find_alias_reference(array('nat', 'outbound', 'rule'), array('destination', 'address'), $alias_name, $is_alias_referenced, $referenced_by);
find_alias_reference(array('nat', 'outbound', 'rule'), array('dstport'), $alias_name, $is_alias_referenced, $referenced_by);
find_alias_reference(array('nat', 'outbound', 'rule'), array('target'), $alias_name, $is_alias_referenced, $referenced_by);
// Alias in an alias
find_alias_reference(array('aliases', 'alias'), array('address'), $alias_name, $is_alias_referenced, $referenced_by);
// Load Balancer
find_alias_reference(array('load_balancer', 'lbpool'), array('port'), $alias_name, $is_alias_referenced, $referenced_by);
find_alias_reference(array('load_balancer', 'virtual_server'), array('port'), $alias_name, $is_alias_referenced, $referenced_by);
// Static routes
find_alias_reference(array('staticroutes', 'route'), array('network'), $alias_name, $is_alias_referenced, $referenced_by);
if ($is_alias_referenced == true) {
$savemsg = sprintf(gettext("Cannot delete alias. Currently in use by %s"), htmlspecialchars($referenced_by));
} else {
if (preg_match("/urltable/i", $a_aliases[$_GET['id']]['type'])) {
// this is a URL table type alias, delete its file as well
unlink_if_exists("/var/db/aliastables/" . $a_aliases[$_GET['id']]['name'] . ".txt");
}
unset($a_aliases[$_GET['id']]);
if (write_config()) {
filter_configure();
mark_subsystem_dirty('aliases');
}
header("Location: firewall_aliases.php?tab=" . $tab);
exit;
}
}
}
function find_alias_reference($section, $field, $origname, &$is_alias_referenced, &$referenced_by)
{
global $config;
if (!$origname || $is_alias_referenced) {
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases.php
示例17: unlink_if_exists
if (file_exists("{$suricata_rules_upd_log}")) {
unlink_if_exists("{$suricata_rules_upd_log}");
}
}
if ($_POST['update']) {
// Go see if new updates for rule sets are available
header("Location: /suricata/suricata_download_rules.php");
exit;
}
if ($_POST['force']) {
// Mount file system R/W since we need to remove files
conf_mount_rw();
// Remove the existing MD5 signature files to force a download
unlink_if_exists("{$suricatadir}{$emergingthreats_filename}.md5");
unlink_if_exists("{$suricatadir}{$snort_community_rules_filename}.md5");
unlink_if_exists("{$suricatadir}{$snort_rules_file}.md5");
// Revert file system to R/O.
conf_mount_ro();
// Go download the updates
header("Location: /suricata/suricata_download_rules.php");
exit;
}
/* check for logfile */
if (file_exists("{$suricata_rules_upd_log}")) {
$suricata_rules_upd_log_chk = 'yes';
} else {
$suricata_rules_upd_log_chk = 'no';
}
if ($_POST['view'] && $suricata_rules_upd_log_chk == 'yes') {
$contents = @file_get_contents($suricata_rules_upd_log);
if (empty($contents)) {
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_download_updates.php
示例18: delete_package
delete_package($pkgtodo['name'] . '-' . $pkgtodo['version'], $pkg_id);
delete_package_xml($pkgtodo['name']);
install_package($pkgtodo['name']);
$pkg_id++;
}
}
update_status("All packages reinstalled.");
$static_output .= "\n\nAll packages reinstalled.";
start_service(htmlspecialchars($_GET['pkg']));
update_output_window($static_output);
break;
default:
$status = install_package(htmlspecialchars($_GET['id']));
if ($status == -1) {
update_status("Installation of " . htmlspecialchars($_GET['id']) . " FAILED!");
$static_output .= "\n\nInstallation halted.";
} else {
update_status("Installation of " . $_GET['id'] . " completed.");
$static_output .= "\n\nInstallation completed. Please check to make sure that the package is configured from the respective menu then start the package.";
}
update_output_window($static_output);
}
// Delete all temporary package tarballs and staging areas.
unlink_if_exists("/tmp/apkg_*");
rmdir_recursive("/var/tmp/instmp*");
/* read only fs */
conf_mount_ro();
// close log
if ($fd_log) {
fclose($fd_log);
}
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:pkg_mgr_install.php
示例19: elseif
} elseif ($_GET) {
if (!isset($_GET['newver']) && !isset($_GET['rmver']) && !isset($_GET['getcfg']) && !isset($_GET['diff'])) {
header("Location: diag_confbak.php");
return;
}
conf_mount_rw();
$confvers = unserialize(file_get_contents($g['cf_conf_path'] . '/backup/backup.cache'));
if ($_GET['newver'] != "") {
if (config_restore($g['conf_path'] . '/backup/config-' . $_GET['newver'] . '.xml') == 0) {
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['newver']), htmlspecialchars($confvers[$_GET['newver']]['description']));
} else {
$savemsg = gettext("Unable to revert to the selected configuration.");
}
}
if ($_GET['rmver'] != "") {
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_GET['rmver'] . '.xml');
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_GET['rmver']), htmlspecialchars($confvers[$_GET['rmver']]['description']));
}
conf_mount_ro();
}
if ($_GET['getcfg'] != "") {
$file = $g['conf_path'] . '/backup/config-' . $_GET['getcfg'] . '.xml';
$exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml");
$exp_data = file_get_contents($file);
$exp_size = strlen($exp_data);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$exp_name}");
header("Content-Length: {$exp_size}");
echo $exp_data;
exit;
}
开发者ID:dariomas,项目名称:pfsense,代码行数:31,代码来源:diag_confbak.php
示例20: print_info_box
$savemsg .= <<<EOF
\t\t\t\t\t\t\t<br />
\t\t\t\t\t\t<form action="reboot.php" method="post">
\t\t\t\t\t\t\tWould you like to reboot?
\t\t\t\t\t\t\t<input name="Submit" type="submit" class="formbtn" value=" Yes " />
\t\t\t\t\t\t\t<input name="Submit" type="submit" class="formbtn" value=" No " />
\t\t\t\t\t\t</form>
EOF;
} else {
$savemsg = "Unable to revert to the selected configuration.";
}
print_info_box($savemsg);
} else {
log_error("There was an error when restoring the AutoConfigBackup item");
}
unlink_if_exists("/tmp/config_restore.xml");
conf_mount_ro();
}
if ($_REQUEST['download']) {
// Phone home and obtain backups
$curl_session = curl_init();
curl_setopt($curl_session, CURLOPT_URL, $get_url);
curl_setopt($curl_session, CURLOPT_HTTPHEADER, array("Authorization: Basic " . base64_encode("{$username}:{$password}")));
curl_setopt($curl_session, CURLOPT_POST, 3);
curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=restore" . "&hostname=" . urlencode($hostname) . "&revision=" . urlencode($_REQUEST['download']));
curl_setopt($curl_session, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
// Proxy
curl_setopt_array($curl_session, configure_proxy());
$data = curl_exec($curl_session);
开发者ID:heper,项目名称:pfsense-packages,代码行数:31,代码来源:autoconfigbackup.php
注:本文中的unlink_if_exists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论