summaryrefslogtreecommitdiffstats
path: root/etc/inc/config.lib.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/config.lib.inc')
-rw-r--r--etc/inc/config.lib.inc74
1 files changed, 37 insertions, 37 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc
index 01bd7ec..9ac40c9 100644
--- a/etc/inc/config.lib.inc
+++ b/etc/inc/config.lib.inc
@@ -76,10 +76,10 @@ function encrypted_configxml() {
fwrite($fd, $data);
fclose($fd);
exec("/bin/mv {$g['conf_path']}/config.xml.tmp {$g['conf_path']}/config.xml");
- echo "\nConfig.xml unlocked.\n";
+ echo "\n" . gettext("Config.xml unlocked.") . "\n";
fclose($fp);
} else {
- echo "\nInvalid password entered. Please try again.\n";
+ echo "\n" . gettext("Invalid password entered. Please try again.") . "\n";
}
}
}
@@ -102,12 +102,12 @@ function parse_config($parse = false) {
if (!file_exists("{$g['conf_path']}/config.xml") || filesize("{$g['conf_path']}/config.xml") == 0) {
$last_backup = discover_last_backup();
if($last_backup) {
- 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", "");
+ 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", "");
restore_backup("{$g['conf_path']}/backup/{$last_backup}");
} else {
unlock($lockkey);
- die("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."));
}
}
@@ -135,9 +135,9 @@ function parse_config($parse = false) {
if ($last_backup)
restore_backup("/cf/conf/backup/{$last_backup}");
else {
- log_error("Could not restore config.xml.");
+ log_error(gettext("Could not restore config.xml."));
unlock($lockkey);
- die("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'));
@@ -207,8 +207,8 @@ function restore_backup($file) {
unlink_if_exists("{$g['tmp_path']}/config.cache");
copy("$file","/cf/conf/config.xml");
disable_security_checks();
- log_error("{$g['product_name']} is restoring the configuration $file");
- file_notice("config.xml", "{$g['product_name']} is restoring the configuration $file", "{$g['product_name']}Configurator", "");
+ log_error(sprintf(gettext('%1$s is restoring the configuration %2$s'), $g['product_name'], $file));
+ file_notice("config.xml", sprintf(gettext('%1$s is restoring the configuration %2$s'), $g['product_name'], $file), "pfSenseConfigurator", "");
conf_mount_ro();
}
}
@@ -230,29 +230,29 @@ function parse_config_bootup() {
if ($g['booting']) {
if (strstr($g['platform'], "cdrom")) {
/* try copying the default config. to the floppy */
- echo "Resetting factory defaults...\n";
+ echo gettext("Resetting factory defaults...") . "\n";
reset_factory_defaults(true);
if (!file_exists("{$g['conf_path']}/config.xml")) {
- echo "No XML configuration file found - using factory defaults.\n";
- echo "Make sure that the configuration floppy disk with the conf/config.xml\n";
- echo "file is inserted. If it isn't, your configuration changes will be lost\n";
- echo "on reboot.\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" .
+ "file is inserted. If it isn't, your configuration changes will be lost\n" .
+ "on reboot.\n");
}
} else {
$last_backup = discover_last_backup();
if($last_backup) {
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", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", "");
restore_backup("/cf/conf/backup/{$last_backup}");
}
if(!file_exists("{$g['conf_path']}/config.xml")) {
- echo "XML configuration file not found. {$g['product_name']} cannot continue booting.\n";
+ echo sprintf(gettext("XML configuration file not found. %s cannot continue booting."), $g['product_name']) . "\n";
unlock($lockkey);
mwexec("/sbin/halt");
exit;
}
log_error("Last known config found and restored. Please double check your configuration file for accuracy.");
- file_notice("config.xml", "Last known config found and restored. Please double check your configuration file for accuracy.", "pfSenseConfigurator", "");
+ file_notice("config.xml", gettext("Last known config found and restored. Please double check your configuration file for accuracy."), "pfSenseConfigurator", "");
}
} else {
unlock($lockkey);
@@ -263,12 +263,12 @@ function parse_config_bootup() {
if (filesize("{$g['conf_path']}/config.xml") == 0) {
$last_backup = discover_last_backup();
if($last_backup) {
- 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", "");
+ 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", "");
restore_backup("{$g['conf_path']}/backup/{$last_backup}");
} else {
unlock($lockkey);
- die("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."));
}
}
unlock($lockkey);
@@ -314,7 +314,7 @@ function conf_mount_rw() {
$status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}");
if($status <> 0) {
if($g['booting'])
- echo "Disk is dirty. Running fsck -y\n";
+ echo gettext("Disk is dirty. Running fsck -y") . "\n";
mwexec("/sbin/fsck -y {$g['cf_path']}");
$status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}");
}
@@ -325,7 +325,7 @@ function conf_mount_rw() {
$status = mwexec("/sbin/mount -u -w -o sync,noatime /");
/* we could not mount this correctly. kick off fsck */
if($status <> 0) {
- log_error("File system is dirty. Launching FSCK for /");
+ log_error(gettext("File system is dirty. Launching FSCK for /"));
mwexec("/sbin/fsck -y /");
$status = mwexec("/sbin/mount -u -w -o sync,noatime /");
}
@@ -376,7 +376,7 @@ function conf_mount_ro() {
function convert_config() {
global $config, $g;
$now = date("H:i:s");
- log_error("Start Configuration upgrade at $now, set execution timeout to 15 minutes");
+ log_error(sprintf(gettext("Start Configuration upgrade at %s, set execution timeout to 15 minutes"), $now));
//ini_set("max_execution_time", "900");
/* special case upgrades */
@@ -386,8 +386,8 @@ function convert_config() {
if(stristr($config['cron']['item'][$x]['command'], "rc.update_bogons.sh")) {
if($config['cron']['item'][$x]['hour'] == "*" ) {
$config['cron']['item'][$x]['hour'] = "3";
- write_config("Updated bogon update frequency to 3am");
- log_error("Updated bogon update frequency to 3am");
+ write_config(gettext("Updated bogon update frequency to 3am"));
+ log_error(gettext("Updated bogon update frequency to 3am"));
}
}
}
@@ -417,10 +417,10 @@ function convert_config() {
}
$now = date("H:i:s");
- log_error("Ended Configuration upgrade at $now");
+ log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now));
if ($prev_version != $config['version'])
- write_config("Upgraded config version level from {$prev_version} to {$config['version']}");
+ write_config(sprintf(gettext('Upgraded config version level from %1$s to %2$s'), $prev_version, $config['version']));
}
/****f* config/safe_write_file
@@ -509,7 +509,7 @@ function write_config($desc="Unknown", $backup = true) {
/* Log the running script so it's not entirely unlogged what changed */
if ($desc == "Unknown")
- $desc = "{$_SERVER['SCRIPT_NAME']} made unknown change";
+ $desc = sprintf(gettext("%s made unknown change"), $_SERVER['SCRIPT_NAME']);
$config['revision']['description'] = "{$username}: " . $desc;
$config['revision']['username'] = $username;
@@ -522,9 +522,9 @@ function write_config($desc="Unknown", $backup = true) {
/* write new configuration */
if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) {
- log_error("WARNING: Config contents could not be save. Could not open file!");
+ log_error(gettext("WARNING: Config contents could not be save. Could not open file!"));
unlock($lockkey);
- file_notice("config.xml", "Unable to open {$g['cf_conf_path']}/config.xml for writing in write_config()\n");
+ file_notice("config.xml", sprintf(gettext("Unable to open %s/config.xml for writing in write_config()%s"), $g['cf_conf_path'], "\n"));
return -1;
}
@@ -633,7 +633,7 @@ function config_restore($conffile) {
conf_mount_ro();
- write_config("Reverted to " . array_pop(explode("/", $conffile)) . ".", false);
+ write_config(gettext("Reverted to") . " " . array_pop(explode("/", $conffile)) . ".", false);
return 0;
}
@@ -648,9 +648,9 @@ function config_install($conffile) {
return 1;
if($g['booting'] == true)
- echo "Installing configuration...\n";
+ echo gettext("Installing configuration...") . "\n";
else
- log_error("Installing configuration ....");
+ log_error(gettext("Installing configuration ...."));
conf_mount_rw();
$lockkey = lock('config', LOCK_EX);
@@ -701,13 +701,13 @@ function config_validate($conffile) {
$xml_parser = xml_parser_create();
if (!($fp = fopen($conffile, "r"))) {
- $xmlerr = "XML error: unable to open file";
+ $xmlerr = gettext("XML error: unable to open file");
return false;
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
- $xmlerr = sprintf("%s at line %d",
+ $xmlerr = sprintf(gettext('%1$s at line %2$d'),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser));
return false;
@@ -753,9 +753,9 @@ function cleanup_backupcache($revisions = 30, $lock = false) {
echo ".";
$newxml = parse_xml_config($backup, array($g['xml_rootobj'], 'pfsense'));
if($newxml == "-1") {
- log_error("The backup cache file $backup is corrupted. Unlinking.");
+ log_error(sprintf(gettext("The backup cache file %s is corrupted. Unlinking."), $backup));
unlink($backup);
- log_error("The backup cache file $backup is corrupted. Unlinking.");
+ log_error(sprintf(gettext("The backup cache file %s is corrupted. Unlinking."), $backup));
continue;
}
if($newxml['revision']['description'] == "")
OpenPOWER on IntegriCloud