mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
src: strip gettext() from write_config(); closes #1158
This commit is contained in:
parent
b1af5b7b2f
commit
5585e10967
@ -138,7 +138,7 @@ function convert_config()
|
||||
}
|
||||
|
||||
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']));
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ function config_restore($conffile)
|
||||
|
||||
$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;
|
||||
}
|
||||
@ -312,7 +312,7 @@ function make_config_revision_entry($desc = '')
|
||||
}
|
||||
|
||||
if (empty($desc)) {
|
||||
$desc = sprintf(gettext('%s made changes'), $_SERVER['SCRIPT_NAME']);
|
||||
$desc = sprintf('%s made changes', $_SERVER['SCRIPT_NAME']);
|
||||
}
|
||||
|
||||
$revision = array();
|
||||
|
||||
@ -2355,31 +2355,6 @@ function configure_cron()
|
||||
{
|
||||
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();
|
||||
|
||||
/* hourly */
|
||||
|
||||
@ -981,7 +981,7 @@ function system_webgui_configure()
|
||||
cert_import($cert, $crt, $key);
|
||||
$a_cert[] = $cert;
|
||||
$config['system']['webgui']['ssl-certref'] = $cert['refid'];
|
||||
write_config(gettext("Importing HTTPS certificate"));
|
||||
write_config('Importing HTTPS certificate');
|
||||
} else {
|
||||
$crt = base64_decode($cert['crt']);
|
||||
$key = base64_decode($cert['prv']);
|
||||
|
||||
@ -200,7 +200,7 @@ function restore_config_section_xmlrpc($new_config)
|
||||
|
||||
/* Log what happened */
|
||||
$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
|
||||
|
||||
@ -72,7 +72,7 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
|
||||
|
||||
local_user_set_password($admin_user, $g['factory_shipped_password']);
|
||||
local_user_set($admin_user);
|
||||
write_config(gettext("password changed from console menu"));
|
||||
write_config('Password reset from console menu');
|
||||
|
||||
printf("\n\n");
|
||||
printf(gettext("The password has been reset."));
|
||||
|
||||
@ -492,7 +492,7 @@ if (!$config['interfaces']['lan']) {
|
||||
$upperifname = strtoupper($interface);
|
||||
if (!$dry_run) {
|
||||
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));
|
||||
echo "\n Reloading filter...";
|
||||
filter_configure_sync();
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<stepbeforeformdisplay>
|
||||
if (isset($config['trigger_initial_wizard'])) {
|
||||
unset($config['trigger_initial_wizard']);
|
||||
write_config(gettext("Triggered initial wizard"));
|
||||
write_config('Triggered initial wizard');
|
||||
}
|
||||
</stepbeforeformdisplay>
|
||||
</step>
|
||||
|
||||
@ -57,7 +57,7 @@ function restore_config_section($section_name, $new_contents)
|
||||
|
||||
$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();
|
||||
|
||||
disable_security_checks();
|
||||
|
||||
@ -94,7 +94,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
if (count($input_errors) == 0) {
|
||||
$config['system']['backupcount'] = $pconfig['backupcount'];
|
||||
write_config(gettext('Changed backup revision count.'));
|
||||
write_config('Changed backup revision count');
|
||||
$savemsg = get_std_save_message();
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,9 +51,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'del' && isset($id)) {
|
||||
// delete single entry
|
||||
unset($a_1to1[$id]);
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_1to1.php");
|
||||
exit;
|
||||
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
|
||||
@ -61,9 +60,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
foreach ($pconfig['rule'] as $rulei) {
|
||||
unset($a_1to1[$rulei]);
|
||||
}
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_1to1.php");
|
||||
exit;
|
||||
} elseif (isset($pconfig['action']) && $pconfig['action'] == 'move') {
|
||||
@ -75,9 +73,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
$a_1to1 = legacy_move_config_list_items($a_1to1, $id, $pconfig['rule']);
|
||||
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_1to1.php");
|
||||
exit;
|
||||
}
|
||||
@ -88,9 +85,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
} else {
|
||||
$a_1to1[$id]['disabled'] = true;
|
||||
}
|
||||
if (write_config(gettext('Toggled NAT rule'))) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
write_config('Toggled NAT 1:1 rule');
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_1to1.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -47,52 +47,48 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$savemsg = get_std_save_message();
|
||||
clear_subsystem_dirty('natconf');
|
||||
clear_subsystem_dirty('filter');
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'del' && isset($id)) {
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'del' && isset($id)) {
|
||||
// delete single record
|
||||
unset($a_npt[$id]);
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
|
||||
/* delete selected rules */
|
||||
foreach ($pconfig['rule'] as $rulei) {
|
||||
if (isset($a_npt[$rulei])) {
|
||||
unset($a_npt[$rulei]);
|
||||
}
|
||||
}
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
} elseif ( isset($pconfig['act']) && $pconfig['act'] == 'move') {
|
||||
// move records
|
||||
if (isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
|
||||
// if rule not set/found, move to end
|
||||
if (!isset($id)) {
|
||||
$id = count($a_npt);
|
||||
}
|
||||
$a_npt = legacy_move_config_list_items($a_npt, $id, $pconfig['rule']);
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
|
||||
/* delete selected rules */
|
||||
foreach ($pconfig['rule'] as $rulei) {
|
||||
if (isset($a_npt[$rulei])) {
|
||||
unset($a_npt[$rulei]);
|
||||
}
|
||||
if (write_config()) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'move') {
|
||||
// move records
|
||||
if (isset($pconfig['rule']) && count($pconfig['rule']) > 0) {
|
||||
// if rule not set/found, move to end
|
||||
if (!isset($id)) {
|
||||
$id = count($a_npt);
|
||||
}
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'toggle' && isset($id)) {
|
||||
// toggle item
|
||||
if(isset($a_npt[$id]['disabled'])) {
|
||||
unset($a_npt[$id]['disabled']);
|
||||
} else {
|
||||
$a_npt[$id]['disabled'] = true;
|
||||
}
|
||||
if (write_config(gettext("Firewall: NAT: NPT, enable/disable NAT rule"))) {
|
||||
mark_subsystem_dirty('natconf');
|
||||
}
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
$a_npt = legacy_move_config_list_items($a_npt, $id, $pconfig['rule']);
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
} elseif (isset($pconfig['act']) && $pconfig['act'] == 'toggle' && isset($id)) {
|
||||
// toggle item
|
||||
if(isset($a_npt[$id]['disabled'])) {
|
||||
unset($a_npt[$id]['disabled']);
|
||||
} else {
|
||||
$a_npt[$id]['disabled'] = true;
|
||||
}
|
||||
write_config('Toggled NAT NPT rule');
|
||||
mark_subsystem_dirty('natconf');
|
||||
header("Location: firewall_nat_npt.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
} elseif(isset($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');
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -101,7 +101,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
} else {
|
||||
$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'])) {
|
||||
services_dnsupdate_process("", $rfc2136['host'], true);
|
||||
|
||||
@ -148,7 +148,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// sync to config
|
||||
$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();
|
||||
header("Location: services_upnp.php");
|
||||
exit;
|
||||
|
||||
@ -158,7 +158,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
unset($a_crl[$cid]);
|
||||
}
|
||||
}
|
||||
write_config("Deleted CRL {$name}.");
|
||||
write_config(sprintf('Deleted CRL %s', $name));
|
||||
header("Location: system_crlmanager.php");
|
||||
exit;
|
||||
}
|
||||
@ -181,11 +181,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$name = $thiscert['descr'];
|
||||
if (cert_unrevoke($thiscert, $thiscrl)) {
|
||||
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");
|
||||
exit;
|
||||
} 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";
|
||||
} elseif ($act == "addcert") {
|
||||
@ -214,7 +214,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$reason = (empty($pconfig['crlreason'])) ? OCSP_REVOKED_STATUS_UNSPECIFIED : $pconfig['crlreason'];
|
||||
cert_revoke($cert, $crl, $reason);
|
||||
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");
|
||||
exit;
|
||||
}
|
||||
@ -269,7 +269,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$a_crl[] = $crl;
|
||||
}
|
||||
|
||||
write_config("Saved CRL {$crl['descr']}");
|
||||
write_config(sprintf('Saved CRL %s', $crl['descr']));
|
||||
openvpn_refresh_crls();
|
||||
header("Location: system_crlmanager.php");
|
||||
exit;
|
||||
|
||||
@ -49,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// delete entry
|
||||
if (isset($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');
|
||||
header("Location: vpn_ipsec_keys.php");
|
||||
exit;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user