Commit 168bb7b5 authored by Franco Fichtner's avatar Franco Fichtner

src: strip gettext() from write_config(); closes #1158

(cherry picked from commit 5585e109)
parent f82c6fa7
...@@ -138,7 +138,7 @@ function convert_config() ...@@ -138,7 +138,7 @@ function convert_config()
} }
if ($prev_version != $config['version']) { if ($prev_version != $config['version']) {
write_config(sprintf(gettext('Upgraded config version level from %s to %s'), $prev_version, $config['version'])); write_config(sprintf('Upgraded config version level from %s to %s', $prev_version, $config['version']));
} }
} }
...@@ -216,7 +216,7 @@ function config_restore($conffile) ...@@ -216,7 +216,7 @@ function config_restore($conffile)
$config = parse_config(); $config = parse_config();
write_config(gettext("Reverted to") . " " . array_pop(explode("/", $conffile)) . ".", false); write_config(sprintf('Reverted to %s', array_pop(explode('/', $conffile))), false);
return 0; return 0;
} }
...@@ -306,7 +306,7 @@ function make_config_revision_entry($desc = '') ...@@ -306,7 +306,7 @@ function make_config_revision_entry($desc = '')
} }
if (empty($desc)) { if (empty($desc)) {
$desc = sprintf(gettext('%s made changes'), $_SERVER['SCRIPT_NAME']); $desc = sprintf('%s made changes', $_SERVER['SCRIPT_NAME']);
} }
$revision = array(); $revision = array();
......
...@@ -2355,31 +2355,6 @@ function configure_cron() ...@@ -2355,31 +2355,6 @@ function configure_cron()
{ {
global $config; global $config;
/*
* Strip the cron jobs that we no longer save explicitly.
* This can be safely removed on our final road to 17.1.
*/
if (isset($config['cron']['item'])) {
$flush = false;
$index = 0;
/* PHP retains the index, can iterate all and unset */
foreach ($config['cron']['item'] as $item) {
unset($config['cron']['item'][$index]);
$flush = true;
$index++;
}
if (!count($config['cron']['item'])) {
unset($config['cron']);
$flush = true;
}
if ($flush) {
write_config(gettext('Removed obsolete cron jobs'));
}
}
$autocron = array(); $autocron = array();
/* hourly */ /* hourly */
......
...@@ -981,7 +981,7 @@ function system_webgui_configure() ...@@ -981,7 +981,7 @@ function system_webgui_configure()
cert_import($cert, $crt, $key); cert_import($cert, $crt, $key);
$a_cert[] = $cert; $a_cert[] = $cert;
$config['system']['webgui']['ssl-certref'] = $cert['refid']; $config['system']['webgui']['ssl-certref'] = $cert['refid'];
write_config(gettext("Importing HTTPS certificate")); write_config('Importing HTTPS certificate');
} else { } else {
$crt = base64_decode($cert['crt']); $crt = base64_decode($cert['crt']);
$key = base64_decode($cert['prv']); $key = base64_decode($cert['prv']);
......
...@@ -200,7 +200,7 @@ function restore_config_section_xmlrpc($new_config) ...@@ -200,7 +200,7 @@ function restore_config_section_xmlrpc($new_config)
/* Log what happened */ /* Log what happened */
$mergedkeys = implode(",", array_merge(array_keys($new_config), $sync_full_done)); $mergedkeys = implode(",", array_merge(array_keys($new_config), $sync_full_done));
write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."), $mergedkeys)); write_config(sprintf('Merged %s config sections from XMLRPC client.', $mergedkeys));
/* /*
* Handle virtual ips * Handle virtual ips
......
...@@ -72,7 +72,7 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) { ...@@ -72,7 +72,7 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
local_user_set_password($admin_user, $g['factory_shipped_password']); local_user_set_password($admin_user, $g['factory_shipped_password']);
local_user_set($admin_user); local_user_set($admin_user);
write_config(gettext("password changed from console menu")); write_config('Password reset from console menu');
printf("\n\n"); printf("\n\n");
printf(gettext("The password has been reset.")); printf(gettext("The password has been reset."));
......
...@@ -492,7 +492,7 @@ if (!$config['interfaces']['lan']) { ...@@ -492,7 +492,7 @@ if (!$config['interfaces']['lan']) {
$upperifname = strtoupper($interface); $upperifname = strtoupper($interface);
if (!$dry_run) { if (!$dry_run) {
echo "\nPlease wait while the changes are saved to {$upperifname}..."; echo "\nPlease wait while the changes are saved to {$upperifname}...";
write_config(sprintf(gettext("%s IP configuration from console menu"), $interface)); write_config(sprintf('%s IP configuration from console menu', $interface));
interface_reconfigure(strtolower($upperifname)); interface_reconfigure(strtolower($upperifname));
echo "\n Reloading filter..."; echo "\n Reloading filter...";
filter_configure_sync(); filter_configure_sync();
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<stepbeforeformdisplay> <stepbeforeformdisplay>
if (isset($config['trigger_initial_wizard'])) { if (isset($config['trigger_initial_wizard'])) {
unset($config['trigger_initial_wizard']); unset($config['trigger_initial_wizard']);
write_config(gettext("Triggered initial wizard")); write_config('Triggered initial wizard');
} }
</stepbeforeformdisplay> </stepbeforeformdisplay>
</step> </step>
......
...@@ -57,7 +57,7 @@ function restore_config_section($section_name, $new_contents) ...@@ -57,7 +57,7 @@ function restore_config_section($section_name, $new_contents)
$config[$section_name] = $xml[$section_name]; $config[$section_name] = $xml[$section_name];
write_config(sprintf(gettext("Restored %s of config file"), $section_name)); write_config(sprintf('Restored section %s of config file', $section_name));
convert_config(); convert_config();
disable_security_checks(); disable_security_checks();
......
...@@ -94,7 +94,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -94,7 +94,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
if (count($input_errors) == 0) { if (count($input_errors) == 0) {
$config['system']['backupcount'] = $pconfig['backupcount']; $config['system']['backupcount'] = $pconfig['backupcount'];
write_config(gettext('Changed backup revision count.')); write_config('Changed backup revision count');
$savemsg = get_std_save_message(); $savemsg = get_std_save_message();
} }
} }
......
...@@ -51,9 +51,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -51,9 +51,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'del' && isset($id)) { } elseif (isset($pconfig['action']) && $pconfig['action'] == 'del' && isset($id)) {
// delete single entry // delete single entry
unset($a_1to1[$id]); unset($a_1to1[$id]);
if (write_config()) { write_config();
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_1to1.php"); header("Location: firewall_nat_1to1.php");
exit; exit;
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) { } elseif (isset($pconfig['action']) && $pconfig['action'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
...@@ -61,9 +60,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -61,9 +60,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach ($pconfig['rule'] as $rulei) { foreach ($pconfig['rule'] as $rulei) {
unset($a_1to1[$rulei]); unset($a_1to1[$rulei]);
} }
if (write_config()) { write_config();
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_1to1.php"); header("Location: firewall_nat_1to1.php");
exit; exit;
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'move') { } elseif (isset($pconfig['action']) && $pconfig['action'] == 'move') {
...@@ -75,9 +73,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -75,9 +73,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
$a_1to1 = legacy_move_config_list_items($a_1to1, $id, $pconfig['rule']); $a_1to1 = legacy_move_config_list_items($a_1to1, $id, $pconfig['rule']);
if (write_config()) { write_config();
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_1to1.php"); header("Location: firewall_nat_1to1.php");
exit; exit;
} }
...@@ -88,9 +85,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -88,9 +85,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} else { } else {
$a_1to1[$id]['disabled'] = true; $a_1to1[$id]['disabled'] = true;
} }
if (write_config(gettext('Toggled NAT rule'))) { write_config('Toggled NAT 1:1 rule');
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_1to1.php"); header("Location: firewall_nat_1to1.php");
exit; exit;
} }
......
...@@ -50,9 +50,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -50,9 +50,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'del' && isset($id)) { } elseif (isset($pconfig['act']) && $pconfig['act'] == 'del' && isset($id)) {
// delete single record // delete single record
unset($a_npt[$id]); unset($a_npt[$id]);
if (write_config()) { write_config();
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_npt.php"); header("Location: firewall_nat_npt.php");
exit; exit;
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) { } elseif (isset($pconfig['act']) && $pconfig['act'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
...@@ -62,12 +61,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -62,12 +61,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
unset($a_npt[$rulei]); unset($a_npt[$rulei]);
} }
} }
if (write_config()) { write_config();
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_npt.php"); header("Location: firewall_nat_npt.php");
exit; exit;
} elseif ( isset($pconfig['act']) && $pconfig['act'] == 'move') { } elseif (isset($pconfig['act']) && $pconfig['act'] == 'move') {
// move records // move records
if (isset($pconfig['rule']) && count($pconfig['rule']) > 0) { if (isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
// if rule not set/found, move to end // if rule not set/found, move to end
...@@ -76,9 +74,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -76,9 +74,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
$a_npt = legacy_move_config_list_items($a_npt, $id, $pconfig['rule']); $a_npt = legacy_move_config_list_items($a_npt, $id, $pconfig['rule']);
} }
if (write_config()) { write_config();
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_npt.php"); header("Location: firewall_nat_npt.php");
exit; exit;
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'toggle' && isset($id)) { } elseif (isset($pconfig['act']) && $pconfig['act'] == 'toggle' && isset($id)) {
...@@ -88,9 +85,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -88,9 +85,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} else { } else {
$a_npt[$id]['disabled'] = true; $a_npt[$id]['disabled'] = true;
} }
if (write_config(gettext("Firewall: NAT: NPT, enable/disable NAT rule"))) { write_config('Toggled NAT NPT rule');
mark_subsystem_dirty('natconf'); mark_subsystem_dirty('natconf');
}
header("Location: firewall_nat_npt.php"); header("Location: firewall_nat_npt.php");
exit; exit;
} }
......
...@@ -83,7 +83,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -83,7 +83,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif(isset($config['widgets']['column_count'])) { } elseif(isset($config['widgets']['column_count'])) {
unset($config['widgets']['column_count']); unset($config['widgets']['column_count']);
} }
write_config(gettext('Widget configuration has been changed.')); write_config('Widget configuration has been changed');
header('Location: index.php'); header('Location: index.php');
exit; exit;
} }
......
...@@ -101,7 +101,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -101,7 +101,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} else { } else {
$a_rfc2136[] = $rfc2136; $a_rfc2136[] = $rfc2136;
} }
write_config(gettext("New/Edited RFC2136 dnsupdate entry was posted."));
write_config('New/Edited RFC2136 dnsupdate entry was posted');
if (!empty($pconfig['force'])) { if (!empty($pconfig['force'])) {
services_dnsupdate_process("", $rfc2136['host'], true); services_dnsupdate_process("", $rfc2136['host'], true);
......
...@@ -148,7 +148,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -148,7 +148,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// sync to config // sync to config
$config['installedpackages']['miniupnpd']['config'] = $upnp; $config['installedpackages']['miniupnpd']['config'] = $upnp;
write_config(gettext('Modified Universal Plug and Play settings.')); write_config('Modified Universal Plug and Play settings');
sync_package_miniupnpd(); sync_package_miniupnpd();
header("Location: services_upnp.php"); header("Location: services_upnp.php");
exit; exit;
......
...@@ -158,7 +158,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -158,7 +158,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($a_crl[$cid]); unset($a_crl[$cid]);
} }
} }
write_config("Deleted CRL {$name}."); write_config(sprintf('Deleted CRL %s', $name));
header("Location: system_crlmanager.php"); header("Location: system_crlmanager.php");
exit; exit;
} }
...@@ -181,11 +181,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -181,11 +181,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$name = $thiscert['descr']; $name = $thiscert['descr'];
if (cert_unrevoke($thiscert, $thiscrl)) { if (cert_unrevoke($thiscert, $thiscrl)) {
openvpn_refresh_crls(); openvpn_refresh_crls();
write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $name, $thiscrl['descr'])); write_config(sprintf('Deleted certificate %s from CRL %s', $name, $thiscrl['descr']));
header("Location: system_crlmanager.php"); header("Location: system_crlmanager.php");
exit; exit;
} else { } else {
$savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $name, $thiscrl['descr']) . "<br />"; $savemsg = sprintf(gettext("Failed to delete certificate %s from CRL %s"), $name, $thiscrl['descr']) . "<br />";
} }
$act="edit"; $act="edit";
} elseif ($act == "addcert") { } elseif ($act == "addcert") {
...@@ -214,7 +214,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -214,7 +214,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason']; $reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
cert_revoke($cert, $crl, $reason); cert_revoke($cert, $crl, $reason);
openvpn_refresh_crls(); openvpn_refresh_crls();
write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}."); write_config(sprintf('Revoked certificate %s in CRL %s', $cert['descr'], $crl['descr']));
header("Location: system_crlmanager.php"); header("Location: system_crlmanager.php");
exit; exit;
} }
...@@ -269,7 +269,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -269,7 +269,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$a_crl[] = $crl; $a_crl[] = $crl;
} }
write_config("Saved CRL {$crl['descr']}"); write_config(sprintf('Saved CRL %s', $crl['descr']));
openvpn_refresh_crls(); openvpn_refresh_crls();
header("Location: system_crlmanager.php"); header("Location: system_crlmanager.php");
exit; exit;
......
...@@ -49,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -49,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// delete entry // delete entry
if (isset($config['ipsec']['mobilekey'][$_POST['id']])) { if (isset($config['ipsec']['mobilekey'][$_POST['id']])) {
unset($config['ipsec']['mobilekey'][$_POST['id']]); unset($config['ipsec']['mobilekey'][$_POST['id']]);
write_config(gettext("Deleted IPsec Pre-Shared Key")); write_config('Deleted pre-shared IPsec key');
mark_subsystem_dirty('ipsec'); mark_subsystem_dirty('ipsec');
header("Location: vpn_ipsec_keys.php"); header("Location: vpn_ipsec_keys.php");
exit; exit;
......
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