Commit 4b01b9d3 authored by Franco Fichtner's avatar Franco Fichtner

globals: further -- zap conf_path global

parent f0ec037b
...@@ -68,7 +68,7 @@ if(file_exists("/var/run/booting") && file_exists("/cf/conf/config.xml")) { ...@@ -68,7 +68,7 @@ if(file_exists("/var/run/booting") && file_exists("/cf/conf/config.xml")) {
/* user has just upgraded to m0n0wall, replace root xml tags */ /* user has just upgraded to m0n0wall, replace root xml tags */
log_error(gettext("Upgrading m0n0wall configuration to pfSense... ")); log_error(gettext("Upgrading m0n0wall configuration to pfSense... "));
$config_contents = str_replace("m0n0wall","pfsense", $config_contents); $config_contents = str_replace("m0n0wall","pfsense", $config_contents);
if (!config_validate("{$g['conf_path']}/config.xml")) if (!config_validate('/conf/config.xml'))
log_error(gettext("ERROR! Could not convert m0n0wall -> pfsense in config.xml")); log_error(gettext("ERROR! Could not convert m0n0wall -> pfsense in config.xml"));
conf_mount_rw(); conf_mount_rw();
$fd = fopen("/cf/conf/config.xml", "w"); $fd = fopen("/cf/conf/config.xml", "w");
......
...@@ -36,17 +36,22 @@ ...@@ -36,17 +36,22 @@
* RESULT * RESULT
* $config - rewrites config.xml without encryption * $config - rewrites config.xml without encryption
******/ ******/
function encrypted_configxml() { function encrypted_configxml()
{
global $g, $config; global $g, $config;
if (!file_exists($g['conf_path'] . "/config.xml")) $config_xml = '/conf/config.xml';
if (!file_exists($config_xml)) {
return; return;
}
if (!file_exists("/var/run/booting")) if (!file_exists('/var/run/booting')) {
return; return;
}
$configtxt = file_get_contents($g['conf_path'] . "/config.xml"); $configtxt = file_get_contents($config_xml);
if(tagfile_deformat($configtxt, $configtxt, "config.xml")) { if(tagfile_deformat($configtxt, $configtxt, 'config.xml')) {
$fp = fopen('php://stdin', 'r'); $fp = fopen('php://stdin', 'r');
$data = ""; $data = "";
echo "\n\n*** Encrypted config.xml detected ***\n"; echo "\n\n*** Encrypted config.xml detected ***\n";
...@@ -54,13 +59,14 @@ function encrypted_configxml() { ...@@ -54,13 +59,14 @@ function encrypted_configxml() {
echo "\nEnter the password to decrypt config.xml: "; echo "\nEnter the password to decrypt config.xml: ";
$decrypt_password = chop(fgets($fp)); $decrypt_password = chop(fgets($fp));
$data = decrypt_data($configtxt, $decrypt_password); $data = decrypt_data($configtxt, $decrypt_password);
if(!strstr($data, "<pfsense>")) if (!strstr($data, '<pfsense>')) {
$data = ""; $data = '';
}
if($data) { if($data) {
$fd = fopen($g['conf_path'] . "/config.xml.tmp", "w"); $fd = fopen($config_xml . '.tmp', 'w');
fwrite($fd, $data); fwrite($fd, $data);
fclose($fd); fclose($fd);
exec("/bin/mv {$g['conf_path']}/config.xml.tmp {$g['conf_path']}/config.xml"); exec("/bin/mv {$config_xml}.tmp {$config_xml}");
echo "\n" . gettext("Config.xml unlocked.") . "\n"; echo "\n" . gettext("Config.xml unlocked.") . "\n";
fclose($fp); fclose($fp);
} else { } else {
...@@ -78,18 +84,20 @@ function encrypted_configxml() { ...@@ -78,18 +84,20 @@ function encrypted_configxml() {
* RESULT * RESULT
* $config - array containing all configuration variables * $config - array containing all configuration variables
******/ ******/
function parse_config($parse = false) { function parse_config($parse = false)
{
global $g, $config_parsed, $config_extra; global $g, $config_parsed, $config_extra;
$config_xml = '/conf/config.xml';
$lockkey = lock('config'); $lockkey = lock('config');
$config_parsed = false; $config_parsed = false;
if (!file_exists("{$g['conf_path']}/config.xml") || filesize("{$g['conf_path']}/config.xml") == 0) { if (!file_exists($config_xml) || filesize($config_xml) == 0) {
$last_backup = discover_last_backup(); $last_backup = discover_last_backup();
if($last_backup) { if($last_backup) {
log_error(gettext("No config.xml found, attempting last known config restore.")); log_error(gettext("No config.xml found, attempting last known config restore."));
file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", "");
restore_backup("{$g['conf_path']}/backup/{$last_backup}"); restore_backup("/conf/backup/{$last_backup}");
} else { } else {
unlock($lockkey); unlock($lockkey);
die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup.")); die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup."));
...@@ -109,7 +117,7 @@ function parse_config($parse = false) { ...@@ -109,7 +117,7 @@ function parse_config($parse = false) {
$parse = true; $parse = true;
} }
if ($parse == true) { if ($parse == true) {
if(!file_exists($g['conf_path'] . "/config.xml")) { if (!file_exists($config_xml)) {
log_error("No config.xml found, attempting last known config restore."); log_error("No config.xml found, attempting last known config restore.");
file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", "");
$last_backup = discover_last_backup(); $last_backup = discover_last_backup();
...@@ -121,7 +129,7 @@ function parse_config($parse = false) { ...@@ -121,7 +129,7 @@ function parse_config($parse = false) {
die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup.")); die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup."));
} }
} }
$config = parse_xml_config($g['conf_path'] . '/config.xml', array($g['xml_rootobj'], 'pfsense')); $config = parse_xml_config($config_xml, array($g['xml_rootobj'], 'pfsense'));
if($config == -1) { if($config == -1) {
$last_backup = discover_last_backup(); $last_backup = discover_last_backup();
if ($last_backup) if ($last_backup)
...@@ -202,17 +210,20 @@ function restore_backup($file) { ...@@ -202,17 +210,20 @@ function restore_backup($file) {
* RESULT * RESULT
* null * null
******/ ******/
function parse_config_bootup() { function parse_config_bootup()
{
global $config, $g; global $config, $g;
$config_xml = '/conf/config.xml';
$lockkey = lock('config'); $lockkey = lock('config');
if (!file_exists("{$g['conf_path']}/config.xml")) { if (!file_exists($config_xml)) {
if (file_exists("/var/run/booting")) { if (file_exists("/var/run/booting")) {
if (strstr($g['platform'], "cdrom")) { if (strstr($g['platform'], "cdrom")) {
/* try copying the default config. to the floppy */ /* try copying the default config. to the floppy */
echo gettext("Resetting factory defaults...") . "\n"; echo gettext("Resetting factory defaults...") . "\n";
reset_factory_defaults(true); reset_factory_defaults(true);
if (!file_exists("{$g['conf_path']}/config.xml")) { if (!file_exists($config_xml)) {
echo gettext("No XML configuration file found - using factory defaults.\n" . echo gettext("No XML configuration file found - using factory defaults.\n" .
"Make sure that the configuration floppy disk with the conf/config.xml\n" . "Make sure that the configuration floppy disk with the conf/config.xml\n" .
"file is inserted. If it isn't, your configuration changes will be lost\n" . "file is inserted. If it isn't, your configuration changes will be lost\n" .
...@@ -225,7 +236,7 @@ function parse_config_bootup() { ...@@ -225,7 +236,7 @@ function parse_config_bootup() {
file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", "");
restore_backup("/cf/conf/backup/{$last_backup}"); restore_backup("/cf/conf/backup/{$last_backup}");
} }
if(!file_exists("{$g['conf_path']}/config.xml")) { if (!file_exists($config_xml)) {
echo sprintf(gettext("XML configuration file not found. %s cannot continue booting."), $g['product_name']) . "\n"; echo sprintf(gettext("XML configuration file not found. %s cannot continue booting."), $g['product_name']) . "\n";
unlock($lockkey); unlock($lockkey);
mwexec("/sbin/halt"); mwexec("/sbin/halt");
...@@ -241,12 +252,12 @@ function parse_config_bootup() { ...@@ -241,12 +252,12 @@ function parse_config_bootup() {
} }
} }
if (filesize("{$g['conf_path']}/config.xml") == 0) { if (filesize($config_xml) == 0) {
$last_backup = discover_last_backup(); $last_backup = discover_last_backup();
if($last_backup) { if($last_backup) {
log_error(gettext("No config.xml found, attempting last known config restore.")); log_error(gettext("No config.xml found, attempting last known config restore."));
file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", "");
restore_backup("{$g['conf_path']}/backup/{$last_backup}"); restore_backup("/conf/backup/{$last_backup}");
} else { } else {
unlock($lockkey); unlock($lockkey);
die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup.")); die(gettext("Config.xml is corrupted and is 0 bytes. Could not restore a previous backup."));
...@@ -466,6 +477,8 @@ function write_config($desc = 'Unknown', $backup = true) ...@@ -466,6 +477,8 @@ function write_config($desc = 'Unknown', $backup = true)
{ {
global $config, $g; global $config, $g;
$config_xml = '/conf/config.xml';
if (!empty($_SERVER['REMOTE_ADDR'])) { if (!empty($_SERVER['REMOTE_ADDR'])) {
if (!session_id()) { if (!session_id()) {
@session_start(); @session_start();
...@@ -507,17 +520,17 @@ function write_config($desc = 'Unknown', $backup = true) ...@@ -507,17 +520,17 @@ function write_config($desc = 'Unknown', $backup = true)
/* re-read configuration */ /* re-read configuration */
/* NOTE: We assume that the file can be parsed since we wrote it. */ /* NOTE: We assume that the file can be parsed since we wrote it. */
$config = parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']); $config = parse_xml_config($config_xml, $g['xml_rootobj']);
if ($config == -1) { if ($config == -1) {
copy("{$g['conf_path']}/config.xml", "{$g['conf_path']}/config.xml.bad"); copy($config_xml, $config_xml . '.bad');
$last_backup = discover_last_backup(); $last_backup = discover_last_backup();
if ($last_backup) { if ($last_backup) {
restore_backup("/cf/conf/backup/{$last_backup}"); restore_backup("/cf/conf/backup/{$last_backup}");
$config = parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']); $config = parse_xml_config($config_xml, $g['xml_rootobj']);
if (file_exists("/var/run/booting")) { if (file_exists("/var/run/booting")) {
echo "\n\n ************** WARNING **************"; echo "\n\n ************** WARNING **************";
echo "\n\n Configuration could not be validated. A previous configuration was restored. \n"; echo "\n\n Configuration could not be validated. A previous configuration was restored. \n";
echo "\n The failed configuration file has been saved as {$g['conf_path']}/config.xml.bad \n\n"; echo "\n The failed configuration file has been saved as {$config_xml}.bad \n\n";
} }
} else } else
log_error(gettext("Could not restore config.xml.")); log_error(gettext("Could not restore config.xml."));
...@@ -548,7 +561,8 @@ function write_config($desc = 'Unknown', $backup = true) ...@@ -548,7 +561,8 @@ function write_config($desc = 'Unknown', $backup = true)
* RESULT * RESULT
* integer - indicates completion * integer - indicates completion
******/ ******/
function reset_factory_defaults($lock = false) { function reset_factory_defaults($lock = false)
{
global $g; global $g;
conf_mount_rw(); conf_mount_rw();
...@@ -559,17 +573,17 @@ function reset_factory_defaults($lock = false) { ...@@ -559,17 +573,17 @@ function reset_factory_defaults($lock = false) {
safe_mkdir('/cf/conf'); safe_mkdir('/cf/conf');
/* clear out /conf */ /* clear out /conf */
$dh = opendir($g['conf_path']); $dh = opendir('/conf');
while ($filename = readdir($dh)) { while ($filename = readdir($dh)) {
if (($filename != ".") && ($filename != "..")) { if (($filename != '.') && ($filename != '..')) {
unlink_if_exists($g['conf_path'] . "/" . $filename); unlink_if_exists('/conf/' . $filename);
} }
} }
closedir($dh); closedir($dh);
unlink_if_exists($g['tmp_path'] . "/config.cache"); unlink_if_exists($g['tmp_path'] . "/config.cache");
/* copy default configuration */ /* copy default configuration */
copy("/usr/local/etc/config.xml", "{$g['conf_path']}/config.xml"); copy('/usr/local/etc/config.xml', '/conf/config.xml');
disable_security_checks(); disable_security_checks();
...@@ -627,7 +641,7 @@ function config_install($conffile) { ...@@ -627,7 +641,7 @@ function config_install($conffile) {
conf_mount_rw(); conf_mount_rw();
$lockkey = lock('config', LOCK_EX); $lockkey = lock('config', LOCK_EX);
copy($conffile, "{$g['conf_path']}/config.xml"); copy($conffile, '/conf/config.xml');
disable_security_checks(); disable_security_checks();
...@@ -753,7 +767,7 @@ function cleanup_backupcache($lock = false) { ...@@ -753,7 +767,7 @@ function cleanup_backupcache($lock = false) {
$newcache[$sliced] = $tocache[$sliced]; $newcache[$sliced] = $tocache[$sliced];
foreach($tocache as $version => $versioninfo) { foreach($tocache as $version => $versioninfo) {
if(!in_array($version, array_keys($newcache))) { if(!in_array($version, array_keys($newcache))) {
unlink_if_exists($g['conf_path'] . '/backup/config-' . $version . '.xml'); unlink_if_exists('/conf/backup/config-' . $version . '.xml');
} }
} }
$tocache = $newcache; $tocache = $newcache;
......
...@@ -137,8 +137,8 @@ ...@@ -137,8 +137,8 @@
global $config, $g; global $config, $g;
$this->_cacheFile = "{$g['conf_path']}/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}.cache"; $this->_cacheFile = "/conf/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}.cache";
$this->_cacheFile_v6 = "{$g['conf_path']}/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}_v6.cache"; $this->_cacheFile_v6 = "/conf/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}_v6.cache";
$this->_debugFile = "{$g['varetc_path']}/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}.debug"; $this->_debugFile = "{$g['varetc_path']}/dyndns_{$dnsIf}{$dnsService}" . escapeshellarg($dnsHost) . "{$dnsID}.debug";
$this->_curlIpresolveV4 = $curlIpresolveV4; $this->_curlIpresolveV4 = $curlIpresolveV4;
......
...@@ -44,7 +44,6 @@ $g = array( ...@@ -44,7 +44,6 @@ $g = array(
"vardb_path" => "/var/db", "vardb_path" => "/var/db",
"varlog_path" => "/var/log", "varlog_path" => "/var/log",
"tmp_path" => "/tmp", "tmp_path" => "/tmp",
"conf_path" => "/conf",
"cf_path" => "/cf", "cf_path" => "/cf",
"xml_rootobj" => "pfsense", "xml_rootobj" => "pfsense",
"admin_group" => "admins", "admin_group" => "admins",
......
...@@ -1840,8 +1840,8 @@ EOD; ...@@ -1840,8 +1840,8 @@ EOD;
/* Generate mpd.conf. If mpd_[interface].conf exists in the conf path, then link to it instead of generating a fresh conf file. */ /* Generate mpd.conf. If mpd_[interface].conf exists in the conf path, then link to it instead of generating a fresh conf file. */
if (file_exists("{$g['conf_path']}/mpd_{$interface}.conf")) if (file_exists("/conf/mpd_{$interface}.conf"))
@symlink("{$g['conf_path']}/mpd_{$interface}.conf", "{$g['varetc_path']}/mpd_{$interface}.conf"); @symlink("/conf/mpd_{$interface}.conf", "{$g['varetc_path']}/mpd_{$interface}.conf");
else { else {
$fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w"); $fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w");
if (!$fd) { if (!$fd) {
......
...@@ -2111,7 +2111,7 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false ...@@ -2111,7 +2111,7 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false
$wanip = get_interface_ip($dnsupdate['interface']); $wanip = get_interface_ip($dnsupdate['interface']);
$wanipv6 = get_interface_ipv6($dnsupdate['interface']); $wanipv6 = get_interface_ipv6($dnsupdate['interface']);
$cacheFile = "{$g['conf_path']}/dyndns_{$dnsupdate['interface']}_rfc2136_" . escapeshellarg($dnsupdate['host']) . "_{$dnsupdate['server']}.cache"; $cacheFile = "/conf/dyndns_{$dnsupdate['interface']}_rfc2136_" . escapeshellarg($dnsupdate['host']) . "_{$dnsupdate['server']}.cache";
$currentTime = time(); $currentTime = time();
if ($wanip || $wanipv6) { if ($wanip || $wanipv6) {
......
...@@ -70,7 +70,7 @@ function restore_history_backup($number) { ...@@ -70,7 +70,7 @@ function restore_history_backup($number) {
$confirm = strtoupper(chop(fgets($fp))); $confirm = strtoupper(chop(fgets($fp)));
if ($confirm == gettext("Y")) { if ($confirm == gettext("Y")) {
conf_mount_rw(); conf_mount_rw();
if(config_restore($g['conf_path'] . '/backup/config-' . $thisbackup['time'] . '.xml') == 0) { if(config_restore('/conf/backup/config-' . $thisbackup['time'] . '.xml') == 0) {
echo "\n"; echo "\n";
echo sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $thisbackup['time']), $thisbackup['description']); echo sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $thisbackup['time']), $thisbackup['description']);
echo "\n" . gettext("You may need to reboot the firewall or restart services before the restored configuration is fully active.") . "\n\n"; echo "\n" . gettext("You may need to reboot the firewall or restart services before the restored configuration is fully active.") . "\n\n";
......
...@@ -269,7 +269,7 @@ if ($_POST) { ...@@ -269,7 +269,7 @@ if ($_POST) {
if($options == "nopackages") { if($options == "nopackages") {
if(!$_POST['backuparea']) { if(!$_POST['backuparea']) {
/* backup entire configuration */ /* backup entire configuration */
$data = file_get_contents("{$g['conf_path']}/config.xml"); $data = file_get_contents('/conf/config.xml');
} else { } else {
/* backup specific area of configuration */ /* backup specific area of configuration */
$data = backup_config_section($_POST['backuparea']); $data = backup_config_section($_POST['backuparea']);
...@@ -282,7 +282,7 @@ if ($_POST) { ...@@ -282,7 +282,7 @@ if ($_POST) {
} else { } else {
if(!$_POST['backuparea']) { if(!$_POST['backuparea']) {
/* backup entire configuration */ /* backup entire configuration */
$data = file_get_contents("{$g['conf_path']}/config.xml"); $data = file_get_contents('/conf/config.xml');
} else if ($_POST['backuparea'] === "rrddata") { } else if ($_POST['backuparea'] === "rrddata") {
$data = rrd_data_xml(); $data = rrd_data_xml();
$name = "{$_POST['backuparea']}-{$name}"; $name = "{$_POST['backuparea']}-{$name}";
......
...@@ -48,20 +48,20 @@ if (isset($_POST['backupcount'])) { ...@@ -48,20 +48,20 @@ if (isset($_POST['backupcount'])) {
conf_mount_rw(); conf_mount_rw();
$confvers = unserialize(file_get_contents('/cf/conf/backup/backup.cache')); $confvers = unserialize(file_get_contents('/cf/conf/backup/backup.cache'));
if($_POST['newver'] != "") { if($_POST['newver'] != "") {
if(config_restore($g['conf_path'] . '/backup/config-' . $_POST['newver'] . '.xml') == 0) if(config_restore('/conf/backup/config-' . $_POST['newver'] . '.xml') == 0)
$savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']); $savemsg = sprintf(gettext('Successfully reverted to timestamp %1$s with description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['newver']), $confvers[$_POST['newver']]['description']);
else else
$savemsg = gettext("Unable to revert to the selected configuration."); $savemsg = gettext("Unable to revert to the selected configuration.");
} }
if($_POST['rmver'] != "") { if($_POST['rmver'] != "") {
unlink_if_exists($g['conf_path'] . '/backup/config-' . $_POST['rmver'] . '.xml'); unlink_if_exists('/conf/backup/config-' . $_POST['rmver'] . '.xml');
$savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$confvers[$_POST['rmver']]['description']); $savemsg = sprintf(gettext('Deleted backup with timestamp %1$s and description "%2$s".'), date(gettext("n/j/y H:i:s"), $_POST['rmver']),$confvers[$_POST['rmver']]['description']);
} }
conf_mount_ro(); conf_mount_ro();
} }
if($_GET['getcfg'] != "") { if($_GET['getcfg'] != "") {
$file = $g['conf_path'] . '/backup/config-' . $_GET['getcfg'] . '.xml'; $file = '/conf/backup/config-' . $_GET['getcfg'] . '.xml';
$exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml"); $exp_name = urlencode("config-{$config['system']['hostname']}.{$config['system']['domain']}-{$_GET['getcfg']}.xml");
$exp_data = file_get_contents($file); $exp_data = file_get_contents($file);
...@@ -77,13 +77,13 @@ if($_GET['getcfg'] != "") { ...@@ -77,13 +77,13 @@ if($_GET['getcfg'] != "") {
if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime']) if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime'])
&& is_numeric($_GET['oldtime']) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) { && is_numeric($_GET['oldtime']) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
$diff = ""; $diff = "";
$oldfile = $g['conf_path'] . '/backup/config-' . $_GET['oldtime'] . '.xml'; $oldfile = '/conf/backup/config-' . $_GET['oldtime'] . '.xml';
$oldtime = $_GET['oldtime']; $oldtime = $_GET['oldtime'];
if ($_GET['newtime'] == 'current') { if ($_GET['newtime'] == 'current') {
$newfile = $g['conf_path'] . '/config.xml'; $newfile = '/conf/config.xml';
$newtime = $config['revision']['time']; $newtime = $config['revision']['time'];
} else { } else {
$newfile = $g['conf_path'] . '/backup/config-' . $_GET['newtime'] . '.xml'; $newfile = '/conf/backup/config-' . $_GET['newtime'] . '.xml';
$newtime = $_GET['newtime']; $newtime = $_GET['newtime'];
} }
if (file_exists($oldfile) && file_exists($newfile)) { if (file_exists($oldfile) && file_exists($newfile)) {
......
...@@ -37,7 +37,7 @@ $a_dyndns = &$config['dyndnses']['dyndns']; ...@@ -37,7 +37,7 @@ $a_dyndns = &$config['dyndnses']['dyndns'];
if ($_GET['act'] == "del") { if ($_GET['act'] == "del") {
$conf = $a_dyndns[$_GET['id']]; $conf = $a_dyndns[$_GET['id']];
@unlink("{$g['conf_path']}/dyndns_{$conf['interface']}{$conf['type']}" . escapeshellarg($conf['host']) . "{$conf['id']}.cache"); @unlink("/conf/dyndns_{$conf['interface']}{$conf['type']}" . escapeshellarg($conf['host']) . "{$conf['id']}.cache");
unset($a_dyndns[$_GET['id']]); unset($a_dyndns[$_GET['id']]);
write_config(); write_config();
...@@ -140,8 +140,8 @@ $main_buttons = array( ...@@ -140,8 +140,8 @@ $main_buttons = array(
</td> </td>
<td class="listr"> <td class="listr">
<?php <?php
$filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; $filename = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
$filename_v6 = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache"; $filename_v6 = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
if (file_exists($filename)) { if (file_exists($filename)) {
$ipaddr = dyndnsCheckIP($dyndns['interface']); $ipaddr = dyndnsCheckIP($dyndns['interface']);
$cached_ip_s = explode(":", file_get_contents($filename)); $cached_ip_s = explode(":", file_get_contents($filename));
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2008 Ermal Luçi Copyright (C) 2008 Ermal Luçi
...@@ -119,7 +120,7 @@ $main_buttons = array( ...@@ -119,7 +120,7 @@ $main_buttons = array(
</td> </td>
<td class="listr"> <td class="listr">
<?php <?php
$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache"; $filename = "/conf/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
if (file_exists($filename)) { if (file_exists($filename)) {
echo "IPv4: "; echo "IPv4: ";
if (isset($rfc2136['usepublicip'])) if (isset($rfc2136['usepublicip']))
......
...@@ -49,7 +49,7 @@ if($_REQUEST['getdyndnsstatus']) { ...@@ -49,7 +49,7 @@ if($_REQUEST['getdyndnsstatus']) {
// Put a vertical bar delimiter between the echoed HTML for each entry processed. // Put a vertical bar delimiter between the echoed HTML for each entry processed.
echo "|"; echo "|";
$filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; $filename = "/conf/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
if (file_exists($filename)) { if (file_exists($filename)) {
$ipaddr = dyndnsCheckIP($dyndns['interface']); $ipaddr = dyndnsCheckIP($dyndns['interface']);
$cached_ip_s = split(":", file_get_contents($filename)); $cached_ip_s = split(":", file_get_contents($filename));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment